// generated by bun run generate from the SwiftUI SDK and codegen/catalog.ts.
// edit the generator or catalog, then regenerate.
import { Platform } from 'react-native'
import { assertTextInputOptions } from '../textTypes'
import { useControlled } from '../controlled'
import { assertSwiftUIValue } from './swiftui'
import { swiftStyleNative, dispatchSDKEvent } from './swiftStyleNative'
import type * as Types from './controlTypes'
import { iconColorRoles } from '../ui/iconRoles'
import { chartPointsNative, chartStyleNative } from '../chartNative'
import { getSyncStateId, isSyncState } from '../syncStore'
import { syncHandleOf, useSyncValue } from '../syncNativeState'
import NativePicker from '../specs/OneNativePickerNativeComponent'
export function Picker({
  selection,
  onSelectionChange,
  revision = 0,
  label = '',
  disabled = false,
  options,
  pickerStyle = 'automatic',
  swiftStyle,
  style,
  ...props
}: Types.PickerProps) {
  if (
    !Array.isArray(options) ||
    options.some(
      (option) => typeof option?.value !== 'string' || typeof option?.label !== 'string'
    )
  )
    throw new Error('Picker options must contain string value and label fields')
  if (!options.length) throw new Error('Picker options must not be empty')
  if (new Set(options.map((option) => option.value)).size !== options.length)
    throw new Error('Picker option values must be unique')
  if (!options.some((option) => option.value === selection))
    throw new Error('Picker selection must match an option value')
  if (pickerStyle === 'navigationLink')
    throw new Error(
      'PickerStyle.navigationLink requires a native navigation context that One Native does not provide yet'
    )
  assertSwiftUIValue(
    'PickerStyle',
    pickerStyle,
    Number.parseFloat(String(Platform.Version))
  )
  const controlled = useControlled<{
    value: string
    eventCount: number
    revision: number
  }>((event) => onSelectionChange(event.value), revision)
  return (
    <NativePicker
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={selection}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      label={label}
      disabled={disabled}
      options={options}
      pickerStyle={pickerStyle}
      onNativePickerValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeDatePicker from '../specs/OneNativeDatePickerNativeComponent'
export function DatePicker({
  selection,
  onSelectionChange,
  revision = 0,
  label = '',
  disabled = false,
  minimumDate = new Date(-62135769600000),
  maximumDate = new Date(64092211200000),
  displayedComponents = 'dateAndTime',
  datePickerStyle = 'automatic',
  swiftStyle,
  style,
  ...props
}: Types.DatePickerProps) {
  const selectionTime = selection instanceof Date ? selection.getTime() : NaN
  const minimumTime = minimumDate instanceof Date ? minimumDate.getTime() : NaN
  const maximumTime = maximumDate instanceof Date ? maximumDate.getTime() : NaN
  if (![selectionTime, minimumTime, maximumTime].every(Number.isFinite))
    throw new Error(
      'DatePicker selection, minimumDate, and maximumDate must be valid Date values'
    )
  if (minimumTime > maximumTime)
    throw new Error('DatePicker minimumDate must not be after maximumDate')
  if (selectionTime < minimumTime || selectionTime > maximumTime)
    throw new Error('DatePicker selection must be within minimumDate and maximumDate')
  if (!['date', 'hourAndMinute', 'dateAndTime'].includes(displayedComponents))
    throw new Error(
      'DatePicker displayedComponents must be date, hourAndMinute, or dateAndTime'
    )
  assertSwiftUIValue(
    'DatePickerStyle',
    datePickerStyle,
    Number.parseFloat(String(Platform.Version))
  )
  const controlled = useControlled<{
    value: number
    eventCount: number
    revision: number
  }>((event) => onSelectionChange(new Date(event.value)), revision)
  return (
    <NativeDatePicker
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={selection.getTime()}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      label={label}
      disabled={disabled}
      minimumDate={minimumDate.getTime()}
      maximumDate={maximumDate.getTime()}
      displayedComponents={displayedComponents}
      datePickerStyle={datePickerStyle}
      onNativeDatePickerValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeColorPicker from '../specs/OneNativeColorPickerNativeComponent'
export function ColorPicker({
  selection,
  onSelectionChange,
  revision = 0,
  label = '',
  disabled = false,
  supportsOpacity = true,
  swiftStyle,
  style,
  ...props
}: Types.ColorPickerProps) {
  if (
    typeof selection !== 'string' ||
    !/^#[0-9A-Fa-f]{6}(?:[0-9A-Fa-f]{2})?$/.test(selection)
  )
    throw new Error('ColorPicker selection must be #RRGGBB or #RRGGBBAA')

  const controlled = useControlled<{
    value: string
    eventCount: number
    revision: number
  }>((event) => onSelectionChange(event.value), revision)
  return (
    <NativeColorPicker
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={selection}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      label={label}
      disabled={disabled}
      supportsOpacity={supportsOpacity}
      onNativeColorPickerValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeMultiDatePicker from '../specs/OneNativeMultiDatePickerNativeComponent'
export function MultiDatePicker({
  selection,
  onSelectionChange,
  revision = 0,
  label = '',
  disabled = false,
  minimumDate = new Date(-62135769600000),
  maximumDate = new Date(64092211200000),
  swiftStyle,
  style,
  ...props
}: Types.MultiDatePickerProps) {
  if (
    !Array.isArray(selection) ||
    selection.some((date) => !(date instanceof Date) || Number.isNaN(date.getTime()))
  )
    throw new Error('MultiDatePicker selection must be an array of valid Dates')
  const minimumTime = minimumDate instanceof Date ? minimumDate.getTime() : NaN
  const maximumTime = maximumDate instanceof Date ? maximumDate.getTime() : NaN
  if (![minimumTime, maximumTime].every(Number.isFinite))
    throw new Error(
      'MultiDatePicker minimumDate and maximumDate must be valid Date values'
    )
  if (minimumTime > maximumTime)
    throw new Error('MultiDatePicker minimumDate must not be after maximumDate')
  if (
    selection.some((date) => date.getTime() < minimumTime || date.getTime() > maximumTime)
  )
    throw new Error(
      'MultiDatePicker selection must be within minimumDate and maximumDate'
    )

  const controlled = useControlled<{
    value: string
    eventCount: number
    revision: number
  }>(
    (event) =>
      onSelectionChange(JSON.parse(event.value).map((time: number) => new Date(time))),
    revision
  )
  return (
    <NativeMultiDatePicker
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={JSON.stringify(
        selection.map((date) => date.getTime()).sort((a, b) => a - b)
      )}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      label={label}
      disabled={disabled}
      minimumDate={minimumDate.getTime()}
      maximumDate={maximumDate.getTime()}
      onNativeMultiDatePickerValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeToggle from '../specs/OneNativeToggleNativeComponent'
export function Toggle({
  isOn,
  onIsOnChange,
  revision = 0,
  label = '',
  disabled = false,
  systemImage = '',
  toggleStyle = 'automatic',
  swiftStyle,
  style,
  ...props
}: Types.ToggleProps) {
  const syncHandle = syncHandleOf<boolean>(isOn)
  const syncedIsOn = useSyncValue<boolean>(isOn)
  {
    const isOn = syncedIsOn
    if (typeof isOn !== 'boolean' && !isSyncState(isOn))
      throw new Error('Toggle isOn must be a boolean or NativeState handle')
    if (typeof systemImage !== 'string')
      throw new Error('Toggle systemImage must be a string')
  }
  assertSwiftUIValue(
    'ToggleStyle',
    toggleStyle,
    Number.parseFloat(String(Platform.Version))
  )
  const controlled = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => {
    syncHandle?.set(event.value)
    onIsOnChange(event.value)
  }, revision)
  return (
    <NativeToggle
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={syncedIsOn}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      syncStateId={syncHandle ? (getSyncStateId(syncHandle) ?? 0) : 0}
      label={label}
      disabled={disabled}
      systemImage={systemImage}
      toggleStyle={toggleStyle}
      onNativeToggleValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeSlider from '../specs/OneNativeSliderNativeComponent'
export function Slider({
  value,
  onValueChange,
  revision = 0,
  label = '',
  disabled = false,
  minimumValue = 0,
  maximumValue = 100,
  step = 1,
  minimumValueLabel = '',
  maximumValueLabel = '',
  minimumValueImage = '',
  maximumValueImage = '',
  swiftStyle,
  style,
  ...props
}: Types.SliderProps) {
  const syncHandle = syncHandleOf<number>(value)
  const syncedValue = useSyncValue<number>(value)
  {
    const value = syncedValue
    if (![value, minimumValue, maximumValue, step].every(Number.isFinite))
      throw new Error(
        'Slider value, minimumValue, maximumValue, and step must be finite numbers'
      )
    if (minimumValue >= maximumValue)
      throw new Error('Slider minimumValue must be less than maximumValue')
    if (step <= 0) throw new Error('Slider step must be greater than 0')
    if (value < minimumValue || value > maximumValue)
      throw new Error('Slider value must be within minimumValue and maximumValue')
  }

  const controlled = useControlled<{
    value: number
    eventCount: number
    revision: number
  }>((event) => {
    syncHandle?.set(event.value)
    onValueChange(event.value)
  }, revision)
  return (
    <NativeSlider
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={syncedValue}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      syncStateId={syncHandle ? (getSyncStateId(syncHandle) ?? 0) : 0}
      label={label}
      disabled={disabled}
      minimumValue={minimumValue}
      maximumValue={maximumValue}
      step={step}
      minimumValueLabel={minimumValueLabel}
      maximumValueLabel={maximumValueLabel}
      minimumValueImage={minimumValueImage}
      maximumValueImage={maximumValueImage}
      onNativeSliderValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeStepper from '../specs/OneNativeStepperNativeComponent'
export function Stepper({
  value,
  onValueChange,
  revision = 0,
  label = '',
  disabled = false,
  minimumValue = 0,
  maximumValue = 100,
  step = 1,
  swiftStyle,
  style,
  ...props
}: Types.StepperProps) {
  const syncHandle = syncHandleOf<number>(value)
  const syncedValue = useSyncValue<number>(value)
  {
    const value = syncedValue
    if (![value, minimumValue, maximumValue, step].every(Number.isFinite))
      throw new Error(
        'Stepper value, minimumValue, maximumValue, and step must be finite numbers'
      )
    if (minimumValue >= maximumValue)
      throw new Error('Stepper minimumValue must be less than maximumValue')
    if (step <= 0) throw new Error('Stepper step must be greater than 0')
    if (value < minimumValue || value > maximumValue)
      throw new Error('Stepper value must be within minimumValue and maximumValue')
  }

  const controlled = useControlled<{
    value: number
    eventCount: number
    revision: number
  }>((event) => {
    syncHandle?.set(event.value)
    onValueChange(event.value)
  }, revision)
  return (
    <NativeStepper
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={syncedValue}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      syncStateId={syncHandle ? (getSyncStateId(syncHandle) ?? 0) : 0}
      label={label}
      disabled={disabled}
      minimumValue={minimumValue}
      maximumValue={maximumValue}
      step={step}
      onNativeStepperValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativePasteButton from '../specs/OneNativePasteButtonNativeComponent'
export function PasteButton({
  onPaste,
  disabled = false,
  swiftStyle,
  style,
  ...props
}: Types.PasteButtonProps) {
  return (
    <NativePasteButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      disabled={disabled}
      onNativePasteButtonPaste={({ nativeEvent }) =>
        onPaste?.(JSON.parse(nativeEvent.values) as string[])
      }
    />
  )
}
import NativeText from '../specs/OneNativeTextNativeComponent'
export function Text({ text = '', swiftStyle, style, ...props }: Types.TextProps) {
  if (typeof text !== 'string') throw new Error('Text text must be a string')

  return (
    <NativeText
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      text={text}
    />
  )
}
import NativeLabel from '../specs/OneNativeLabelNativeComponent'
export function Label({
  label = '',
  disabled = false,
  systemImage = '',
  swiftStyle,
  style,
  ...props
}: Types.LabelProps) {
  if (typeof label !== 'string' || !label)
    throw new Error('Label label must be a non-empty string')
  if (typeof systemImage !== 'string' || !systemImage)
    throw new Error('Label systemImage must be a non-empty SF Symbol name')

  return (
    <NativeLabel
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      label={label}
      disabled={disabled}
      systemImage={systemImage}
    />
  )
}
import NativeProgressView from '../specs/OneNativeProgressViewNativeComponent'
export function ProgressView({
  label = '',
  disabled = false,
  value = undefined,
  total = 1,
  progressViewStyle = 'automatic',
  swiftStyle,
  style,
  ...props
}: Types.ProgressViewProps) {
  if (value !== undefined && !Number.isFinite(value))
    throw new Error('ProgressView value must be a finite number or undefined')
  if (!Number.isFinite(total) || total <= 0)
    throw new Error('ProgressView total must be a finite number greater than 0')
  if (value !== undefined && (value < 0 || value > total))
    throw new Error('ProgressView value must be between 0 and total')
  assertSwiftUIValue(
    'ProgressViewStyle',
    progressViewStyle,
    Number.parseFloat(String(Platform.Version))
  )
  return (
    <NativeProgressView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      label={label}
      disabled={disabled}
      value={value ?? 0}
      total={total}
      indeterminate={value === undefined}
      progressViewStyle={progressViewStyle}
    />
  )
}
import NativeGauge from '../specs/OneNativeGaugeNativeComponent'
export function Gauge({
  label = '',
  disabled = false,
  value = 0,
  minimumValue = 0,
  maximumValue = 1,
  currentValueLabel = '',
  minimumValueLabel = '',
  maximumValueLabel = '',
  gaugeStyle = 'automatic',
  swiftStyle,
  style,
  ...props
}: Types.GaugeProps) {
  if (![value, minimumValue, maximumValue].every(Number.isFinite))
    throw new Error('Gauge value, minimumValue, and maximumValue must be finite numbers')
  if (minimumValue >= maximumValue)
    throw new Error('Gauge minimumValue must be less than maximumValue')
  if (value < minimumValue || value > maximumValue)
    throw new Error('Gauge value must be within minimumValue and maximumValue')
  assertSwiftUIValue(
    'GaugeStyle',
    gaugeStyle,
    Number.parseFloat(String(Platform.Version))
  )
  return (
    <NativeGauge
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      label={label}
      disabled={disabled}
      value={value}
      minimumValue={minimumValue}
      maximumValue={maximumValue}
      currentValueLabel={currentValueLabel}
      minimumValueLabel={minimumValueLabel}
      maximumValueLabel={maximumValueLabel}
      gaugeStyle={gaugeStyle}
    />
  )
}
import NativeImage from '../specs/OneNativeImageNativeComponent'
export function Image({
  systemName = '',
  uri = '',
  renderingMode = 'original',
  symbolRenderingMode = '',
  symbolVariant = '',
  imageScale = '',
  variableValue = undefined,
  colorRole = '',
  resizable = false,
  swiftStyle,
  style,
  ...props
}: Types.ImageProps) {
  if (!systemName === !uri)
    throw new Error(
      'Image takes exactly one of systemName (an SF Symbol name) or uri (a remote image)'
    )
  if (renderingMode !== 'original' && renderingMode !== 'template')
    throw new Error("Image renderingMode must be 'original' or 'template'")
  if (renderingMode === 'template' && !uri)
    throw new Error(
      'Image renderingMode applies to a uri image; an SF Symbol is already a template'
    )
  if (variableValue !== undefined && !Number.isFinite(variableValue))
    throw new Error('Image variableValue must be a finite number or undefined')
  if (variableValue !== undefined && (variableValue < 0 || variableValue > 1))
    throw new Error('Image variableValue must be between 0 and 1')
  if (colorRole && !iconColorRoles.includes(colorRole))
    throw new Error('Image colorRole must be a One.UI icon color role')
  if (resizable && uri)
    throw new Error(
      'Image resizable applies to an SF Symbol; a uri image is always resizable'
    )
  if (symbolRenderingMode)
    assertSwiftUIValue(
      'SymbolRenderingMode',
      symbolRenderingMode,
      Number.parseFloat(String(Platform.Version))
    )
  if (symbolVariant)
    assertSwiftUIValue(
      'SymbolVariants',
      symbolVariant,
      Number.parseFloat(String(Platform.Version))
    )
  if (imageScale)
    assertSwiftUIValue(
      'ImageScale',
      imageScale,
      Number.parseFloat(String(Platform.Version))
    )
  return (
    <NativeImage
      {...props}
      style={style}
      accessible={false}
      accessibilityElementsHidden={!props.accessibilityLabel}
      accessibilityRole="image"
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      systemName={systemName}
      uri={uri}
      renderingMode={renderingMode}
      symbolRenderingMode={symbolRenderingMode}
      symbolVariant={symbolVariant}
      imageScale={imageScale}
      variableValue={variableValue ?? 0}
      hasVariableValue={variableValue !== undefined}
      colorRole={colorRole}
      resizable={resizable}
    />
  )
}
import NativeShareLink from '../specs/OneNativeShareLinkNativeComponent'
export function ShareLink({
  label = '',
  disabled = false,
  systemImage = '',
  item = '',
  itemType = 'text',
  subject = '',
  message = '',
  swiftStyle,
  style,
  ...props
}: Types.ShareLinkProps) {
  if (typeof label !== 'string' || !label)
    throw new Error('ShareLink label must be a non-empty string')
  if (typeof item !== 'string' || !item)
    throw new Error('ShareLink item must be a non-empty string')
  if (itemType !== 'text' && itemType !== 'url')
    throw new Error("ShareLink itemType must be 'text' or 'url'")

  return (
    <NativeShareLink
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      label={label}
      disabled={disabled}
      systemImage={systemImage}
      item={item}
      itemType={itemType}
      subject={subject}
      message={message}
    />
  )
}
import NativeContentUnavailableView from '../specs/OneNativeContentUnavailableViewNativeComponent'
export function ContentUnavailableView({
  onAction,
  title = '',
  systemImage = '',
  description = '',
  actions,
  swiftStyle,
  style,
  ...props
}: Types.ContentUnavailableViewProps) {
  if (typeof title !== 'string' || !title)
    throw new Error('ContentUnavailableView title must be a non-empty string')
  for (const action of actions) {
    if (typeof action?.id !== 'string' || typeof action?.label !== 'string')
      throw new Error(
        'ContentUnavailableView actions must contain string id and label fields'
      )
    if (action.role)
      assertSwiftUIValue(
        'ButtonRole',
        action.role,
        Number.parseFloat(String(Platform.Version))
      )
  }
  if (new Set(actions.map((action) => action.id)).size !== actions.length)
    throw new Error('ContentUnavailableView action ids must be unique')

  return (
    <NativeContentUnavailableView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      title={title}
      systemImage={systemImage}
      description={description}
      actions={actions}
      onNativeContentUnavailableViewAction={({ nativeEvent }) =>
        onAction?.(nativeEvent.id)
      }
    />
  )
}
import NativeCircle from '../specs/OneNativeCircleNativeComponent'
export function Circle({
  fill = undefined,
  strokeBorder = undefined,
  lineWidth = 1,
  swiftStyle,
  style,
  ...props
}: Types.CircleProps) {
  if (!Number.isFinite(lineWidth) || lineWidth < 0)
    throw new Error('Circle lineWidth must be a non-negative number')

  return (
    <NativeCircle
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      fill={fill}
      strokeBorder={strokeBorder}
      lineWidth={lineWidth}
    />
  )
}
import NativeCapsule from '../specs/OneNativeCapsuleNativeComponent'
export function Capsule({
  fill = undefined,
  strokeBorder = undefined,
  lineWidth = 1,
  swiftStyle,
  style,
  ...props
}: Types.CapsuleProps) {
  if (!Number.isFinite(lineWidth) || lineWidth < 0)
    throw new Error('Capsule lineWidth must be a non-negative number')

  return (
    <NativeCapsule
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      fill={fill}
      strokeBorder={strokeBorder}
      lineWidth={lineWidth}
    />
  )
}
import NativeRectangle from '../specs/OneNativeRectangleNativeComponent'
export function Rectangle({
  fill = undefined,
  strokeBorder = undefined,
  lineWidth = 1,
  swiftStyle,
  style,
  ...props
}: Types.RectangleProps) {
  if (!Number.isFinite(lineWidth) || lineWidth < 0)
    throw new Error('Rectangle lineWidth must be a non-negative number')

  return (
    <NativeRectangle
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      fill={fill}
      strokeBorder={strokeBorder}
      lineWidth={lineWidth}
    />
  )
}
import NativeRoundedRectangle from '../specs/OneNativeRoundedRectangleNativeComponent'
export function RoundedRectangle({
  fill = undefined,
  strokeBorder = undefined,
  lineWidth = 1,
  cornerRadius = 0,
  swiftStyle,
  style,
  ...props
}: Types.RoundedRectangleProps) {
  if (!Number.isFinite(cornerRadius) || cornerRadius < 0)
    throw new Error('RoundedRectangle cornerRadius must be a non-negative number')
  if (!Number.isFinite(lineWidth) || lineWidth < 0)
    throw new Error('RoundedRectangle lineWidth must be a non-negative number')

  return (
    <NativeRoundedRectangle
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      fill={fill}
      strokeBorder={strokeBorder}
      lineWidth={lineWidth}
      cornerRadius={cornerRadius}
    />
  )
}
import NativeEllipse from '../specs/OneNativeEllipseNativeComponent'
export function Ellipse({
  fill = undefined,
  strokeBorder = undefined,
  lineWidth = 1,
  swiftStyle,
  style,
  ...props
}: Types.EllipseProps) {
  if (!Number.isFinite(lineWidth) || lineWidth < 0)
    throw new Error('Ellipse lineWidth must be a non-negative number')

  return (
    <NativeEllipse
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      fill={fill}
      strokeBorder={strokeBorder}
      lineWidth={lineWidth}
    />
  )
}
import NativeUnevenRoundedRectangle from '../specs/OneNativeUnevenRoundedRectangleNativeComponent'
export function UnevenRoundedRectangle({
  fill = undefined,
  strokeBorder = undefined,
  lineWidth = 1,
  topLeadingRadius = 0,
  bottomLeadingRadius = 0,
  bottomTrailingRadius = 0,
  topTrailingRadius = 0,
  swiftStyle,
  style,
  ...props
}: Types.UnevenRoundedRectangleProps) {
  for (const radius of [
    topLeadingRadius,
    bottomLeadingRadius,
    bottomTrailingRadius,
    topTrailingRadius,
  ])
    if (!Number.isFinite(radius) || radius < 0)
      throw new Error('UnevenRoundedRectangle radii must be non-negative numbers')
  if (!Number.isFinite(lineWidth) || lineWidth < 0)
    throw new Error('UnevenRoundedRectangle lineWidth must be a non-negative number')

  return (
    <NativeUnevenRoundedRectangle
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      fill={fill}
      strokeBorder={strokeBorder}
      lineWidth={lineWidth}
      topLeadingRadius={topLeadingRadius}
      bottomLeadingRadius={bottomLeadingRadius}
      bottomTrailingRadius={bottomTrailingRadius}
      topTrailingRadius={topTrailingRadius}
    />
  )
}
import NativeConcentricRectangle from '../specs/OneNativeConcentricRectangleNativeComponent'
export function ConcentricRectangle({
  fill = undefined,
  swiftStyle,
  style,
  ...props
}: Types.ConcentricRectangleProps) {
  if (Number.parseFloat(String(Platform.Version)) < 26)
    throw new Error('ConcentricRectangle requires iOS 26 or newer')

  return (
    <NativeConcentricRectangle
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      fill={fill}
    />
  )
}
import NativeLinearGradient from '../specs/OneNativeLinearGradientNativeComponent'
export function LinearGradient({
  colors,
  startPoint = { x: 0.5, y: 0 },
  endPoint = { x: 0.5, y: 1 },
  swiftStyle,
  style,
  ...props
}: Types.LinearGradientProps) {
  if (
    !Array.isArray(colors) ||
    !colors.every(
      (color) =>
        typeof color === 'string' && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color)
    )
  )
    throw new Error(
      'LinearGradient colors must be an array of #RRGGBB or #RRGGBBAA colors'
    )
  for (const point of [startPoint, endPoint])
    if (!point || !Number.isFinite(point.x) || !Number.isFinite(point.y))
      throw new Error('LinearGradient points must have finite x and y coordinates')

  return (
    <NativeLinearGradient
      {...props}
      style={style}
      accessible={false}
      accessibilityElementsHidden={!props.accessibilityLabel}
      accessibilityRole="image"
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      colors={colors}
      startPoint={JSON.stringify(startPoint)}
      endPoint={JSON.stringify(endPoint)}
    />
  )
}
import NativeRadialGradient from '../specs/OneNativeRadialGradientNativeComponent'
export function RadialGradient({
  colors,
  center = { x: 0.5, y: 0.5 },
  startRadius = 0,
  endRadius,
  swiftStyle,
  style,
  ...props
}: Types.RadialGradientProps) {
  if (
    !Array.isArray(colors) ||
    !colors.every(
      (color) =>
        typeof color === 'string' && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color)
    )
  )
    throw new Error(
      'RadialGradient colors must be an array of #RRGGBB or #RRGGBBAA colors'
    )
  if (!center || !Number.isFinite(center.x) || !Number.isFinite(center.y))
    throw new Error('RadialGradient center must have finite x and y coordinates')
  if (!Number.isFinite(startRadius) || !Number.isFinite(endRadius))
    throw new Error('RadialGradient radii must be finite numbers')

  return (
    <NativeRadialGradient
      {...props}
      style={style}
      accessible={false}
      accessibilityElementsHidden={!props.accessibilityLabel}
      accessibilityRole="image"
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      colors={colors}
      center={JSON.stringify(center)}
      startRadius={startRadius}
      endRadius={endRadius}
    />
  )
}
import NativeEllipticalGradient from '../specs/OneNativeEllipticalGradientNativeComponent'
export function EllipticalGradient({
  colors,
  center = { x: 0.5, y: 0.5 },
  startRadiusFraction = 0,
  endRadiusFraction = 0.5,
  swiftStyle,
  style,
  ...props
}: Types.EllipticalGradientProps) {
  if (
    !Array.isArray(colors) ||
    !colors.every(
      (color) =>
        typeof color === 'string' && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color)
    )
  )
    throw new Error(
      'EllipticalGradient colors must be an array of #RRGGBB or #RRGGBBAA colors'
    )
  if (!center || !Number.isFinite(center.x) || !Number.isFinite(center.y))
    throw new Error('EllipticalGradient center must have finite x and y coordinates')
  if (!Number.isFinite(startRadiusFraction) || !Number.isFinite(endRadiusFraction))
    throw new Error('EllipticalGradient radius fractions must be finite numbers')

  return (
    <NativeEllipticalGradient
      {...props}
      style={style}
      accessible={false}
      accessibilityElementsHidden={!props.accessibilityLabel}
      accessibilityRole="image"
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      colors={colors}
      center={JSON.stringify(center)}
      startRadiusFraction={startRadiusFraction}
      endRadiusFraction={endRadiusFraction}
    />
  )
}
import NativeAngularGradient from '../specs/OneNativeAngularGradientNativeComponent'
export function AngularGradient({
  colors,
  center = { x: 0.5, y: 0.5 },
  angle = { radians: 0 },
  swiftStyle,
  style,
  ...props
}: Types.AngularGradientProps) {
  if (
    !Array.isArray(colors) ||
    !colors.every(
      (color) =>
        typeof color === 'string' && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color)
    )
  )
    throw new Error(
      'AngularGradient colors must be an array of #RRGGBB or #RRGGBBAA colors'
    )
  if (!center || !Number.isFinite(center.x) || !Number.isFinite(center.y))
    throw new Error('AngularGradient center must have finite x and y coordinates')
  if (!angle || !Number.isFinite(angle.radians))
    throw new Error('AngularGradient angle must have finite radians')

  return (
    <NativeAngularGradient
      {...props}
      style={style}
      accessible={false}
      accessibilityElementsHidden={!props.accessibilityLabel}
      accessibilityRole="image"
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      colors={colors}
      center={JSON.stringify(center)}
      angle={JSON.stringify(angle)}
    />
  )
}
import NativeMeshGradient from '../specs/OneNativeMeshGradientNativeComponent'
export function MeshGradient({
  meshWidth,
  meshHeight,
  points,
  colors,
  background = '#00000000',
  smoothsColors = true,
  colorSpace = 'device',
  swiftStyle,
  style,
  ...props
}: Types.MeshGradientProps) {
  if (Number.parseFloat(String(Platform.Version)) < 18)
    throw new Error('MeshGradient requires iOS 18 or newer')
  if (
    !Number.isSafeInteger(meshWidth) ||
    meshWidth < 2 ||
    !Number.isSafeInteger(meshHeight) ||
    meshHeight < 2
  )
    throw new Error(
      'MeshGradient meshWidth and meshHeight must be integers of at least 2'
    )
  if (
    !Array.isArray(points) ||
    points.length !== meshWidth * meshHeight ||
    !points.every(
      (point) =>
        point &&
        Number.isFinite(point.x) &&
        Number.isFinite(point.y) &&
        Number.isFinite(Math.fround(point.x)) &&
        Number.isFinite(Math.fround(point.y))
    )
  )
    throw new Error(
      'MeshGradient points must contain meshWidth × meshHeight finite Float32 coordinates'
    )
  if (
    !Array.isArray(colors) ||
    colors.length !== meshWidth * meshHeight ||
    !colors.every(
      (color) =>
        typeof color === 'string' && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color)
    )
  )
    throw new Error(
      'MeshGradient colors must contain meshWidth × meshHeight #RRGGBB or #RRGGBBAA colors'
    )
  if (
    typeof background !== 'string' ||
    !/^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(background)
  )
    throw new Error('MeshGradient background must be #RRGGBB or #RRGGBBAA')
  if (colorSpace !== 'device' && colorSpace !== 'perceptual')
    throw new Error('MeshGradient colorSpace must be device or perceptual')

  return (
    <NativeMeshGradient
      {...props}
      style={style}
      accessible={false}
      accessibilityElementsHidden={!props.accessibilityLabel}
      accessibilityRole="image"
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      meshWidth={meshWidth}
      meshHeight={meshHeight}
      points={JSON.stringify(points)}
      colors={colors}
      background={background}
      smoothsColors={smoothsColors}
      colorSpace={colorSpace}
    />
  )
}
import NativeVideoPlayer from '../specs/OneNativeVideoPlayerNativeComponent'
export function VideoPlayer({
  onPlaybackStatus,
  url = '',
  autoplay = false,
  command = '',
  commandRevision = 0,
  seekToMs = 0,
  swiftStyle,
  style,
  ...props
}: Types.VideoPlayerProps) {
  if (typeof url !== 'string' || !url)
    throw new Error('VideoPlayer url must be a non-empty string')
  if (!['', 'play', 'pause', 'seek'].includes(command))
    throw new Error('Unknown VideoPlayer command: ' + command)
  if (!Number.isSafeInteger(commandRevision) || commandRevision < 0)
    throw new Error('VideoPlayer commandRevision must be a nonnegative safe integer')
  if (command && commandRevision === 0)
    throw new Error('VideoPlayer command requires a positive commandRevision')
  if (!command && commandRevision > 0)
    throw new Error('VideoPlayer commandRevision requires a command')
  if (!Number.isFinite(seekToMs) || seekToMs < 0)
    throw new Error('VideoPlayer seekToMs must be a nonnegative finite number')

  return (
    <NativeVideoPlayer
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      url={url}
      autoplay={autoplay}
      command={command}
      commandRevision={commandRevision}
      seekToMs={seekToMs}
      onNativeVideoPlayerPlaybackStatus={({ nativeEvent }) =>
        onPlaybackStatus?.(
          nativeEvent.state,
          nativeEvent.positionMs,
          nativeEvent.durationMs
        )
      }
    />
  )
}
import NativeLivePhotoView from '../specs/OneNativeLivePhotoViewNativeComponent'
export function LivePhotoView({
  onPlaybackState,
  assetIdentifier,
  autoplay = false,
  command = '',
  commandRevision = 0,
  swiftStyle,
  style,
  ...props
}: Types.LivePhotoViewProps) {
  if (typeof assetIdentifier !== 'string' || !assetIdentifier.trim())
    throw new Error('LivePhotoView assetIdentifier must be a non-empty string')
  if (!['', 'play', 'stop'].includes(command))
    throw new Error('Unknown LivePhotoView command: ' + command)
  if (!Number.isSafeInteger(commandRevision) || commandRevision < 0)
    throw new Error('LivePhotoView commandRevision must be a nonnegative safe integer')
  if (command && commandRevision === 0)
    throw new Error('LivePhotoView command requires a positive commandRevision')
  if (!command && commandRevision > 0)
    throw new Error('LivePhotoView commandRevision requires a command')

  return (
    <NativeLivePhotoView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      assetIdentifier={assetIdentifier}
      autoplay={autoplay}
      command={command}
      commandRevision={commandRevision}
      onNativeLivePhotoViewPlaybackState={({ nativeEvent }) =>
        onPlaybackState?.(nativeEvent.state, nativeEvent.errorCode)
      }
    />
  )
}
import NativePhotosPicker from '../specs/OneNativePhotosPickerNativeComponent'
export function PhotosPicker({
  onPick,
  onPickItemIdentifier,
  onPickError,
  label = '',
  disabled = false,
  systemImage = '',
  maxSelectionCount = 1,
  selectionBehavior = 'default',
  filter = 'any',
  preferredItemEncoding = 'automatic',
  swiftStyle,
  style,
  ...props
}: Types.PhotosPickerProps) {
  if (typeof label !== 'string' || !label)
    throw new Error('PhotosPicker label must be a non-empty string')
  if (!Number.isInteger(maxSelectionCount) || maxSelectionCount < 0)
    throw new Error(
      'PhotosPicker maxSelectionCount must be a nonnegative integer; 0 is unlimited'
    )
  if (
    ![
      'any',
      'images',
      'videos',
      'livePhotos',
      'screenshots',
      'screenRecordings',
      'slomoVideos',
      'timelapseVideos',
      'cinematicVideos',
      'depthEffectPhotos',
      'bursts',
      'panoramas',
    ].includes(filter)
  )
    throw new Error('Unknown PhotosPicker filter: ' + filter)
  assertSwiftUIValue(
    'PhotosPickerSelectionBehavior',
    selectionBehavior,
    Number.parseFloat(String(Platform.Version))
  )
  assertSwiftUIValue(
    'EncodingDisambiguationPolicy',
    preferredItemEncoding,
    Number.parseFloat(String(Platform.Version))
  )
  return (
    <NativePhotosPicker
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      label={label}
      disabled={disabled}
      systemImage={systemImage}
      maxSelectionCount={maxSelectionCount}
      selectionBehavior={selectionBehavior}
      filter={filter}
      preferredItemEncoding={preferredItemEncoding}
      onNativePhotosPickerPick={({ nativeEvent }) =>
        onPick?.(nativeEvent.url, nativeEvent.index, nativeEvent.count)
      }
      onNativePhotosPickerPickItemIdentifier={({ nativeEvent }) =>
        onPickItemIdentifier?.(
          nativeEvent.itemIdentifier,
          nativeEvent.index,
          nativeEvent.count
        )
      }
      onNativePhotosPickerPickError={({ nativeEvent }) =>
        onPickError?.(nativeEvent.message)
      }
    />
  )
}
import NativeWebView from '../specs/OneNativeWebViewNativeComponent'
export function WebView({
  onNavigate,
  onTitleChange,
  onLoadingChange,
  onLoadStart,
  onLoadEnd,
  onError,
  onHttpError,
  onMessage,
  onHistoryChange,
  onProcessTerminate,
  url = '',
  html = '',
  script = '',
  command = '',
  commandRevision = 0,
  commandValue = '',
  limitsNavigationsToAppBoundDomains = false,
  inlineMedia = false,
  inspectable = false,
  bounces = true,
  backForwardNavigationGestures = '',
  magnificationGestures = '',
  linkPreviews = '',
  elementFullscreen = '',
  contentBackground = '',
  swiftStyle,
  style,
  ...props
}: Types.WebViewProps) {
  if (!url === !html) throw new Error('WebView takes exactly one of url and html')
  if (!['', 'reload', 'goBack', 'goForward', 'evaluate', 'postMessage'].includes(command))
    throw new Error('Unknown WebView command: ' + command)
  if (!Number.isSafeInteger(commandRevision) || commandRevision < 0)
    throw new Error('WebView commandRevision must be a nonnegative safe integer')
  if (command && commandRevision === 0)
    throw new Error('WebView command requires a positive commandRevision')
  if (!command && commandRevision > 0)
    throw new Error('WebView commandRevision requires a command')
  if (typeof commandValue !== 'string')
    throw new Error('WebView commandValue must be a string')
  if ((command === 'evaluate' || command === 'postMessage') && !commandValue)
    throw new Error('WebView ' + command + ' requires commandValue')
  if (typeof script !== 'string') throw new Error('WebView script must be a string')
  if (backForwardNavigationGestures)
    assertSwiftUIValue(
      'BackForwardNavigationGesturesBehavior',
      backForwardNavigationGestures,
      Number.parseFloat(String(Platform.Version))
    )
  if (magnificationGestures)
    assertSwiftUIValue(
      'MagnificationGesturesBehavior',
      magnificationGestures,
      Number.parseFloat(String(Platform.Version))
    )
  if (linkPreviews)
    assertSwiftUIValue(
      'LinkPreviewBehavior',
      linkPreviews,
      Number.parseFloat(String(Platform.Version))
    )
  if (elementFullscreen)
    assertSwiftUIValue(
      'ElementFullscreenBehavior',
      elementFullscreen,
      Number.parseFloat(String(Platform.Version))
    )
  if (contentBackground)
    assertSwiftUIValue(
      'Visibility',
      contentBackground,
      Number.parseFloat(String(Platform.Version))
    )
  return (
    <NativeWebView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      url={url}
      html={html}
      script={script}
      command={command}
      commandRevision={commandRevision}
      commandValue={commandValue}
      limitsNavigationsToAppBoundDomains={limitsNavigationsToAppBoundDomains}
      inlineMedia={inlineMedia}
      inspectable={inspectable}
      bounces={bounces}
      backForwardNavigationGestures={backForwardNavigationGestures}
      magnificationGestures={magnificationGestures}
      linkPreviews={linkPreviews}
      elementFullscreen={elementFullscreen}
      contentBackground={contentBackground}
      onNativeWebViewNavigate={({ nativeEvent }) => onNavigate?.(nativeEvent.url)}
      onNativeWebViewTitleChange={({ nativeEvent }) => onTitleChange?.(nativeEvent.title)}
      onNativeWebViewLoadingChange={({ nativeEvent }) =>
        onLoadingChange?.(nativeEvent.loading, nativeEvent.progress)
      }
      onNativeWebViewLoadStart={({ nativeEvent }) => onLoadStart?.()}
      onNativeWebViewLoadEnd={({ nativeEvent }) => onLoadEnd?.()}
      onNativeWebViewError={({ nativeEvent }) => onError?.(nativeEvent.message)}
      onNativeWebViewHttpError={({ nativeEvent }) =>
        onHttpError?.(nativeEvent.statusCode)
      }
      onNativeWebViewMessage={({ nativeEvent }) => onMessage?.(nativeEvent.data)}
      onNativeWebViewHistoryChange={({ nativeEvent }) =>
        onHistoryChange?.(nativeEvent.canGoBack, nativeEvent.canGoForward)
      }
      onNativeWebViewProcessTerminate={({ nativeEvent }) => onProcessTerminate?.()}
    />
  )
}
import NativeSignInWithAppleButton from '../specs/OneNativeSignInWithAppleButtonNativeComponent'
export function SignInWithAppleButton({
  onCompletion,
  requestedScopes = [],
  nonce = '',
  label = 'signIn',
  swiftStyle,
  style,
  ...props
}: Types.SignInWithAppleButtonProps) {
  if (!Array.isArray(requestedScopes))
    throw new Error('SignInWithAppleButton requestedScopes must be an array')
  for (const scope of requestedScopes) {
    if (scope !== 'fullName' && scope !== 'email')
      throw new Error("SignInWithAppleButton scope must be 'fullName' or 'email'")
  }
  if (typeof nonce !== 'string')
    throw new Error('SignInWithAppleButton nonce must be a string')
  if (label !== 'signIn' && label !== 'continue' && label !== 'signUp')
    throw new Error(
      "SignInWithAppleButton label must be 'signIn', 'continue' or 'signUp'"
    )

  return (
    <NativeSignInWithAppleButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      requestedScopes={requestedScopes}
      nonce={nonce}
      label={label}
      onNativeSignInWithAppleButtonCompletion={({ nativeEvent }) =>
        onCompletion?.(
          nativeEvent.type === 'success'
            ? {
                type: 'success',
                user: nativeEvent.user,
                email: nativeEvent.email,
                givenName: nativeEvent.givenName,
                familyName: nativeEvent.familyName,
                identityToken: nativeEvent.identityToken,
                authorizationCode: nativeEvent.authorizationCode,
              }
            : nativeEvent.type === 'failed'
              ? { type: 'failed', message: nativeEvent.message }
              : { type: 'cancelled' }
        )
      }
    />
  )
}
import NativePayWithApplePayButton from '../specs/OneNativePayWithApplePayButtonNativeComponent'
export function PayWithApplePayButton({
  onPress,
  label = 'plain',
  payWithApplePayButtonStyle = 'black',
  disabled = false,
  swiftStyle,
  style,
  ...props
}: Types.PayWithApplePayButtonProps) {
  if (typeof label !== 'string')
    throw new Error('PayWithApplePayButton label must be a string')
  assertSwiftUIValue(
    'PayWithApplePayButtonLabel',
    label,
    Number.parseFloat(String(Platform.Version))
  )
  assertSwiftUIValue(
    'PayWithApplePayButtonStyle',
    payWithApplePayButtonStyle,
    Number.parseFloat(String(Platform.Version))
  )
  return (
    <NativePayWithApplePayButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      label={label}
      payWithApplePayButtonStyle={payWithApplePayButtonStyle}
      disabled={disabled}
      onNativePayWithApplePayButtonPress={({ nativeEvent }) => onPress?.()}
    />
  )
}
import NativeAddPassToWalletButton from '../specs/OneNativeAddPassToWalletButtonNativeComponent'
export function AddPassToWalletButton({
  onPress,
  addPassToWalletButtonStyle = 'black',
  disabled = false,
  swiftStyle,
  style,
  ...props
}: Types.AddPassToWalletButtonProps) {
  if (typeof disabled !== 'boolean')
    throw new Error('AddPassToWalletButton disabled must be a boolean')
  assertSwiftUIValue(
    'AddPassToWalletButtonStyle',
    addPassToWalletButtonStyle,
    Number.parseFloat(String(Platform.Version))
  )
  return (
    <NativeAddPassToWalletButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      addPassToWalletButtonStyle={addPassToWalletButtonStyle}
      disabled={disabled}
      onNativeAddPassToWalletButtonPress={({ nativeEvent }) => onPress?.()}
    />
  )
}
import NativeMap from '../specs/OneNativeMapNativeComponent'
export function Map({
  onRegionChange,
  latitude = 37.7749,
  longitude = -122.4194,
  distance = 5000,
  markers,
  swiftStyle,
  style,
  ...props
}: Types.MapProps) {
  if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90)
    throw new Error('Map latitude must be between -90 and 90')
  if (!Number.isFinite(longitude) || longitude < -180 || longitude > 180)
    throw new Error('Map longitude must be between -180 and 180')
  if (!Number.isFinite(distance) || distance <= 0)
    throw new Error('Map distance must be a positive number of metres')
  if (
    !Array.isArray(markers) ||
    markers.some(
      (marker) =>
        typeof marker?.id !== 'string' ||
        typeof marker?.label !== 'string' ||
        !Number.isFinite(marker?.latitude) ||
        !Number.isFinite(marker?.longitude)
    )
  )
    throw new Error(
      'Map markers must contain string id and label fields and finite latitude and longitude'
    )
  if (new Set(markers.map((marker) => marker.id)).size !== markers.length)
    throw new Error('Map marker ids must be unique')

  return (
    <NativeMap
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      latitude={latitude}
      longitude={longitude}
      distance={distance}
      markers={markers}
      onNativeMapRegionChange={({ nativeEvent }) =>
        onRegionChange?.(
          nativeEvent.latitude,
          nativeEvent.longitude,
          nativeEvent.distance
        )
      }
    />
  )
}
import NativeMapCompass from '../specs/OneNativeMapCompassNativeComponent'
export function MapCompass({ swiftStyle, style, ...props }: Types.MapCompassProps) {
  return (
    <NativeMapCompass
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
    />
  )
}
import NativeMapPitchToggle from '../specs/OneNativeMapPitchToggleNativeComponent'
export function MapPitchToggle({
  swiftStyle,
  style,
  ...props
}: Types.MapPitchToggleProps) {
  return (
    <NativeMapPitchToggle
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
    />
  )
}
import NativeMapUserLocationButton from '../specs/OneNativeMapUserLocationButtonNativeComponent'
export function MapUserLocationButton({
  swiftStyle,
  style,
  ...props
}: Types.MapUserLocationButtonProps) {
  return (
    <NativeMapUserLocationButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
    />
  )
}
import NativeTextField from '../specs/OneNativeTextFieldNativeComponent'
export function TextField({
  text,
  onTextChange,
  revision = 0,
  focused,
  onFocusChange,
  focusRevision = 0,
  onSubmit,
  label = '',
  disabled = false,
  prompt = '',
  textFieldStyle = 'automatic',
  submitLabel = '',
  textInputAutocapitalization = '',
  autocorrectionDisabled = false,
  keyboardType = '',
  textContentType = '',
  axis = 'horizontal',
  swiftStyle,
  style,
  ...props
}: Types.TextFieldProps) {
  const syncHandle = syncHandleOf<string>(text)
  const syncedText = useSyncValue<string>(text)
  {
    const text = syncedText
    if (typeof text !== 'string' && !isSyncState(text))
      throw new Error('TextField text must be a string or NativeState handle')
    assertTextInputOptions('TextField', keyboardType, textContentType)
  }
  assertSwiftUIValue(
    'TextFieldStyle',
    textFieldStyle,
    Number.parseFloat(String(Platform.Version))
  )
  if (submitLabel)
    assertSwiftUIValue(
      'SubmitLabel',
      submitLabel,
      Number.parseFloat(String(Platform.Version))
    )
  if (textInputAutocapitalization)
    assertSwiftUIValue(
      'TextInputAutocapitalization',
      textInputAutocapitalization,
      Number.parseFloat(String(Platform.Version))
    )
  assertSwiftUIValue('Axis', axis, Number.parseFloat(String(Platform.Version)))
  const controlled = useControlled<{
    value: string
    eventCount: number
    revision: number
  }>((event) => {
    syncHandle?.set(event.value)
    onTextChange(event.value)
  }, revision)
  if (focused !== undefined && swiftStyle?.focused !== undefined)
    throw new Error(
      'TextField focus is controlled by both focused and swiftStyle.focused'
    )
  const sdkFocused = swiftStyle?.focused
  const nativeSwiftStyle = sdkFocused ? { ...swiftStyle, focused: undefined } : swiftStyle
  const controlledFocus = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => {
    onFocusChange?.(event.value)
    sdkFocused?.onChange(event.value)
  }, focusRevision)
  return (
    <NativeTextField
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(nativeSwiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={syncedText}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      syncStateId={syncHandle ? (getSyncStateId(syncHandle) ?? 0) : 0}
      focused={focused ?? sdkFocused?.value ?? false}
      acknowledgedFocusEvent={
        focused !== undefined || sdkFocused !== undefined
          ? controlledFocus.acknowledgedEvent
          : 0
      }
      focusRevision={focusRevision}
      label={label}
      disabled={disabled}
      prompt={prompt}
      textFieldStyle={textFieldStyle}
      submitLabel={submitLabel}
      textInputAutocapitalization={textInputAutocapitalization}
      autocorrectionDisabled={autocorrectionDisabled}
      keyboardType={keyboardType}
      textContentType={textContentType}
      axis={axis}
      onNativeTextFieldValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
      onNativeTextFieldFocusChange={({ nativeEvent }) =>
        controlledFocus.onNativeChange(nativeEvent)
      }
      onNativeTextFieldSubmit={({ nativeEvent }) => onSubmit?.()}
    />
  )
}
import NativeSecureField from '../specs/OneNativeSecureFieldNativeComponent'
export function SecureField({
  text,
  onTextChange,
  revision = 0,
  focused,
  onFocusChange,
  focusRevision = 0,
  onSubmit,
  label = '',
  disabled = false,
  prompt = '',
  textFieldStyle = 'automatic',
  submitLabel = '',
  textInputAutocapitalization = '',
  autocorrectionDisabled = false,
  keyboardType = '',
  textContentType = '',
  swiftStyle,
  style,
  ...props
}: Types.SecureFieldProps) {
  const syncHandle = syncHandleOf<string>(text)
  const syncedText = useSyncValue<string>(text)
  {
    const text = syncedText
    if (typeof text !== 'string' && !isSyncState(text))
      throw new Error('SecureField text must be a string or NativeState handle')
    assertTextInputOptions('SecureField', keyboardType, textContentType)
  }
  assertSwiftUIValue(
    'TextFieldStyle',
    textFieldStyle,
    Number.parseFloat(String(Platform.Version))
  )
  if (submitLabel)
    assertSwiftUIValue(
      'SubmitLabel',
      submitLabel,
      Number.parseFloat(String(Platform.Version))
    )
  if (textInputAutocapitalization)
    assertSwiftUIValue(
      'TextInputAutocapitalization',
      textInputAutocapitalization,
      Number.parseFloat(String(Platform.Version))
    )
  const controlled = useControlled<{
    value: string
    eventCount: number
    revision: number
  }>((event) => {
    syncHandle?.set(event.value)
    onTextChange(event.value)
  }, revision)
  if (focused !== undefined && swiftStyle?.focused !== undefined)
    throw new Error(
      'SecureField focus is controlled by both focused and swiftStyle.focused'
    )
  const sdkFocused = swiftStyle?.focused
  const nativeSwiftStyle = sdkFocused ? { ...swiftStyle, focused: undefined } : swiftStyle
  const controlledFocus = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => {
    onFocusChange?.(event.value)
    sdkFocused?.onChange(event.value)
  }, focusRevision)
  return (
    <NativeSecureField
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(nativeSwiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={syncedText}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      syncStateId={syncHandle ? (getSyncStateId(syncHandle) ?? 0) : 0}
      focused={focused ?? sdkFocused?.value ?? false}
      acknowledgedFocusEvent={
        focused !== undefined || sdkFocused !== undefined
          ? controlledFocus.acknowledgedEvent
          : 0
      }
      focusRevision={focusRevision}
      label={label}
      disabled={disabled}
      prompt={prompt}
      textFieldStyle={textFieldStyle}
      submitLabel={submitLabel}
      textInputAutocapitalization={textInputAutocapitalization}
      autocorrectionDisabled={autocorrectionDisabled}
      keyboardType={keyboardType}
      textContentType={textContentType}
      onNativeSecureFieldValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
      onNativeSecureFieldFocusChange={({ nativeEvent }) =>
        controlledFocus.onNativeChange(nativeEvent)
      }
      onNativeSecureFieldSubmit={({ nativeEvent }) => onSubmit?.()}
    />
  )
}
import NativeTextEditor from '../specs/OneNativeTextEditorNativeComponent'
export function TextEditor({
  text,
  onTextChange,
  revision = 0,
  focused,
  onFocusChange,
  focusRevision = 0,
  disabled = false,
  textInputAutocapitalization = '',
  autocorrectionDisabled = false,
  keyboardType = '',
  textContentType = '',
  swiftStyle,
  style,
  ...props
}: Types.TextEditorProps) {
  const syncHandle = syncHandleOf<string>(text)
  const syncedText = useSyncValue<string>(text)
  {
    const text = syncedText
    if (typeof text !== 'string' && !isSyncState(text))
      throw new Error('TextEditor text must be a string or NativeState handle')
    assertTextInputOptions('TextEditor', keyboardType, textContentType)
  }
  if (textInputAutocapitalization)
    assertSwiftUIValue(
      'TextInputAutocapitalization',
      textInputAutocapitalization,
      Number.parseFloat(String(Platform.Version))
    )
  const controlled = useControlled<{
    value: string
    eventCount: number
    revision: number
  }>((event) => {
    syncHandle?.set(event.value)
    onTextChange(event.value)
  }, revision)
  if (focused !== undefined && swiftStyle?.focused !== undefined)
    throw new Error(
      'TextEditor focus is controlled by both focused and swiftStyle.focused'
    )
  const sdkFocused = swiftStyle?.focused
  const nativeSwiftStyle = sdkFocused ? { ...swiftStyle, focused: undefined } : swiftStyle
  const controlledFocus = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => {
    onFocusChange?.(event.value)
    sdkFocused?.onChange(event.value)
  }, focusRevision)
  return (
    <NativeTextEditor
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(nativeSwiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={syncedText}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      syncStateId={syncHandle ? (getSyncStateId(syncHandle) ?? 0) : 0}
      focused={focused ?? sdkFocused?.value ?? false}
      acknowledgedFocusEvent={
        focused !== undefined || sdkFocused !== undefined
          ? controlledFocus.acknowledgedEvent
          : 0
      }
      focusRevision={focusRevision}
      disabled={disabled}
      textInputAutocapitalization={textInputAutocapitalization}
      autocorrectionDisabled={autocorrectionDisabled}
      keyboardType={keyboardType}
      textContentType={textContentType}
      onNativeTextEditorValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
      onNativeTextEditorFocusChange={({ nativeEvent }) =>
        controlledFocus.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeAlert from '../specs/OneNativeAlertNativeComponent'
export function Alert({
  isPresented,
  onIsPresentedChange,
  revision = 0,
  onAction,
  title = '',
  message = '',
  presenting = undefined,
  actions,
  swiftStyle,
  style,
  ...props
}: Types.AlertProps) {
  for (const action of actions) {
    if (typeof action?.id !== 'string' || typeof action?.label !== 'string')
      throw new Error('Alert actions must contain string id and label fields')
    if (action.role)
      assertSwiftUIValue(
        'ButtonRole',
        action.role,
        Number.parseFloat(String(Platform.Version))
      )
  }
  if (new Set(actions.map((action) => action.id)).size !== actions.length)
    throw new Error('Alert action ids must be unique')
  if (presenting !== undefined && typeof presenting !== 'string')
    throw new Error('Alert presenting must be a string')
  if (!actions.length) throw new Error('Alert must have at least one action')

  const controlled = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => onIsPresentedChange(event.value), revision)
  return (
    <NativeAlert
      {...props}
      style={[{ position: 'absolute', width: 0, height: 0 }, style]}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={isPresented}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      title={title}
      message={message}
      presenting={presenting ?? ''}
      hasPresenting={presenting !== undefined}
      actions={actions}
      onNativeAlertValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
      onNativeAlertAction={({ nativeEvent }) =>
        onAction?.(nativeEvent.id, nativeEvent.presenting)
      }
    />
  )
}
import NativeConfirmationDialog from '../specs/OneNativeConfirmationDialogNativeComponent'
export function ConfirmationDialog({
  isPresented,
  onIsPresentedChange,
  revision = 0,
  onAction,
  title = '',
  message = '',
  presenting = undefined,
  actions,
  titleVisibility = 'automatic',
  swiftStyle,
  style,
  ...props
}: Types.ConfirmationDialogProps) {
  for (const action of actions) {
    if (typeof action?.id !== 'string' || typeof action?.label !== 'string')
      throw new Error(
        'ConfirmationDialog actions must contain string id and label fields'
      )
    if (action.role)
      assertSwiftUIValue(
        'ButtonRole',
        action.role,
        Number.parseFloat(String(Platform.Version))
      )
  }
  if (new Set(actions.map((action) => action.id)).size !== actions.length)
    throw new Error('ConfirmationDialog action ids must be unique')
  if (presenting !== undefined && typeof presenting !== 'string')
    throw new Error('ConfirmationDialog presenting must be a string')
  if (!actions.length) throw new Error('ConfirmationDialog must have at least one action')
  assertSwiftUIValue(
    'Visibility',
    titleVisibility,
    Number.parseFloat(String(Platform.Version))
  )
  const controlled = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => onIsPresentedChange(event.value), revision)
  return (
    <NativeConfirmationDialog
      {...props}
      style={[{ position: 'absolute', width: 0, height: 0 }, style]}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={isPresented}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      title={title}
      message={message}
      presenting={presenting ?? ''}
      hasPresenting={presenting !== undefined}
      actions={actions}
      titleVisibility={titleVisibility}
      onNativeConfirmationDialogValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
      onNativeConfirmationDialogAction={({ nativeEvent }) =>
        onAction?.(nativeEvent.id, nativeEvent.presenting)
      }
    />
  )
}
import NativeQuickLook from '../specs/OneNativeQuickLookNativeComponent'
export function QuickLook({
  isPresented,
  onIsPresentedChange,
  revision = 0,
  url = '',
  swiftStyle,
  style,
  ...props
}: Types.QuickLookProps) {
  if (typeof url !== 'string' || !url)
    throw new Error('QuickLook url must be a non-empty string')
  if (
    !url.startsWith('file://') &&
    !url.startsWith('http://') &&
    !url.startsWith('https://')
  )
    throw new Error('QuickLook url must use file, http, or https')

  const controlled = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => onIsPresentedChange(event.value), revision)
  return (
    <NativeQuickLook
      {...props}
      style={[{ position: 'absolute', width: 0, height: 0 }, style]}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={isPresented}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      url={url}
      onNativeQuickLookValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
    />
  )
}
import NativeFileImporter from '../specs/OneNativeFileImporterNativeComponent'
export function FileImporter({
  isPresented,
  onIsPresentedChange,
  revision = 0,
  onCompletion,
  allowedContentTypes = [],
  allowsMultipleSelection = false,
  swiftStyle,
  style,
  ...props
}: Types.FileImporterProps) {
  if (!Array.isArray(allowedContentTypes))
    throw new Error('FileImporter allowedContentTypes must be an array')
  for (const identifier of allowedContentTypes) {
    if (typeof identifier !== 'string' || !identifier)
      throw new Error(
        'FileImporter content types must be non-empty UTType identifier strings'
      )
  }
  if (typeof allowsMultipleSelection !== 'boolean')
    throw new Error('FileImporter allowsMultipleSelection must be a boolean')

  const controlled = useControlled<{
    value: boolean
    eventCount: number
    revision: number
  }>((event) => onIsPresentedChange(event.value), revision)
  return (
    <NativeFileImporter
      {...props}
      style={[{ position: 'absolute', width: 0, height: 0 }, style]}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      value={isPresented}
      acknowledgedEvent={controlled.acknowledgedEvent}
      revision={revision}
      allowedContentTypes={allowedContentTypes}
      allowsMultipleSelection={allowsMultipleSelection}
      onNativeFileImporterValueChange={({ nativeEvent }) =>
        controlled.onNativeChange(nativeEvent)
      }
      onNativeFileImporterCompletion={({ nativeEvent }) =>
        onCompletion?.(
          nativeEvent.type === 'success'
            ? {
                type: 'success',
                url: nativeEvent.url,
                index: nativeEvent.index,
                count: nativeEvent.count,
              }
            : nativeEvent.type === 'failed'
              ? { type: 'failed', message: nativeEvent.message }
              : { type: 'cancelled' }
        )
      }
    />
  )
}
import NativeChart from '../specs/OneNativeChartNativeComponent'
export function Chart({
  data,
  type = 'line',
  showGrid = true,
  animate = true,
  showLegend = false,
  referenceLines = [],
  lineStyle = undefined,
  pointStyle = undefined,
  areaStyle = undefined,
  barStyle = undefined,
  pieStyle = undefined,
  rectangleStyle = undefined,
  ruleStyle = undefined,
  swiftStyle,
  style,
  ...props
}: Types.ChartProps) {
  const chartTypes = ['line', 'point', 'bar', 'area', 'pie', 'rectangle']
  if (!chartTypes.includes(type))
    throw new Error('Swift.Chart type must be one of ' + chartTypes.join(', '))
  for (const [key, flag] of [
    ['showGrid', showGrid],
    ['animate', animate],
    ['showLegend', showLegend],
  ] as const)
    if (typeof flag !== 'boolean')
      throw new Error('Swift.Chart ' + key + ' must be a boolean')

  return (
    <NativeChart
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      data={chartPointsNative('data', data)}
      type={type}
      showGrid={showGrid}
      animate={animate}
      showLegend={showLegend}
      referenceLines={chartPointsNative('referenceLines', referenceLines)}
      lineStyle={chartStyleNative('lineStyle', lineStyle, [
        'dashArray',
        'width',
        'pointStyle',
        'pointSize',
        'color',
      ])}
      pointStyle={chartStyleNative('pointStyle', pointStyle, ['pointStyle', 'pointSize'])}
      areaStyle={chartStyleNative('areaStyle', areaStyle, ['color'])}
      barStyle={chartStyleNative('barStyle', barStyle, ['cornerRadius', 'width'])}
      pieStyle={chartStyleNative('pieStyle', pieStyle, ['innerRadius', 'angularInset'])}
      rectangleStyle={chartStyleNative('rectangleStyle', rectangleStyle, [
        'color',
        'cornerRadius',
      ])}
      ruleStyle={chartStyleNative('ruleStyle', ruleStyle, [
        'color',
        'lineWidth',
        'dashArray',
      ])}
    />
  )
}
import NativeAsyncImage from '../specs/OneNativeAsyncImageNativeComponent'
export function AsyncImage({
  url,
  scale = 1,
  swiftStyle,
  style,
  ...props
}: Types.AsyncImageProps) {
  if (typeof url !== 'string') throw new Error('AsyncImage url must be a string')
  if (typeof scale !== 'number') throw new Error('AsyncImage scale must be a number')

  return (
    <NativeAsyncImage
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      url={url}
      scale={scale}
    />
  )
}
import NativeEditButton from '../specs/OneNativeEditButtonNativeComponent'
export function EditButton({ swiftStyle, style, ...props }: Types.EditButtonProps) {
  return (
    <NativeEditButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
    />
  )
}
import NativeEmptyView from '../specs/OneNativeEmptyViewNativeComponent'
export function EmptyView({ swiftStyle, style, ...props }: Types.EmptyViewProps) {
  return (
    <NativeEmptyView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
    />
  )
}
import NativeLocationButton from '../specs/OneNativeLocationButtonNativeComponent'
export function LocationButton({
  onAction,
  title = 'currentLocation',
  swiftStyle,
  style,
  ...props
}: Types.LocationButtonProps) {
  if (typeof title !== 'string') throw new Error('LocationButton title must be a string')
  if (
    title !== undefined &&
    title !== '' &&
    ![
      'currentLocation',
      'sendCurrentLocation',
      'sendMyCurrentLocation',
      'shareCurrentLocation',
      'shareMyCurrentLocation',
    ].includes(title)
  )
    throw new Error(
      'LocationButton title must be one of currentLocation, sendCurrentLocation, sendMyCurrentLocation, shareCurrentLocation, shareMyCurrentLocation'
    )

  return (
    <NativeLocationButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      title={title}
      onNativeLocationButtonAction={({ nativeEvent }) => onAction?.()}
    />
  )
}
import NativeProductView from '../specs/OneNativeProductViewNativeComponent'
export function ProductView({
  id,
  prefersPromotionalIcon = false,
  swiftStyle,
  style,
  ...props
}: Types.ProductViewProps) {
  if (typeof id !== 'string') throw new Error('ProductView id must be a string')
  if (!id) throw new Error('ProductView id is required')
  if (typeof prefersPromotionalIcon !== 'boolean')
    throw new Error('ProductView prefersPromotionalIcon must be a boolean')

  return (
    <NativeProductView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      id={id}
      prefersPromotionalIcon={prefersPromotionalIcon}
    />
  )
}
import NativeRenameButton from '../specs/OneNativeRenameButtonNativeComponent'
export function RenameButton({ swiftStyle, style, ...props }: Types.RenameButtonProps) {
  return (
    <NativeRenameButton
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
    />
  )
}
import NativeShortcutsLink from '../specs/OneNativeShortcutsLinkNativeComponent'
export function ShortcutsLink({
  onAction,
  swiftStyle,
  style,
  ...props
}: Types.ShortcutsLinkProps) {
  return (
    <NativeShortcutsLink
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      onNativeShortcutsLinkAction={({ nativeEvent }) => onAction?.()}
    />
  )
}
import NativeStoreView from '../specs/OneNativeStoreViewNativeComponent'
export function StoreView({
  ids,
  prefersPromotionalIcon = false,
  swiftStyle,
  style,
  ...props
}: Types.StoreViewProps) {
  if (!Array.isArray(ids) || ids.some((item) => typeof item !== 'string'))
    throw new Error('StoreView ids must be an array of strings')
  if (typeof prefersPromotionalIcon !== 'boolean')
    throw new Error('StoreView prefersPromotionalIcon must be a boolean')

  return (
    <NativeStoreView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      ids={ids}
      prefersPromotionalIcon={prefersPromotionalIcon}
    />
  )
}
import NativeSubscriptionStoreView from '../specs/OneNativeSubscriptionStoreViewNativeComponent'
export function SubscriptionStoreView({
  groupID = undefined,
  visibleRelationships = undefined,
  productIDs = undefined,
  swiftStyle,
  style,
  ...props
}: Types.SubscriptionStoreViewProps) {
  if ([groupID, productIDs].filter((value) => value !== undefined).length !== 1)
    throw new Error('SubscriptionStoreView takes exactly one of groupID, productIDs')
  if (groupID !== undefined && typeof groupID !== 'string')
    throw new Error('SubscriptionStoreView groupID must be a string')
  if (visibleRelationships !== undefined && typeof visibleRelationships !== 'string')
    throw new Error('SubscriptionStoreView visibleRelationships must be a string')
  if (
    visibleRelationships !== undefined &&
    !['current', 'downgrade', 'crossgrade', 'upgrade', 'all'].includes(
      visibleRelationships
    )
  )
    throw new Error(
      'SubscriptionStoreView visibleRelationships must be one of current, downgrade, crossgrade, upgrade, all'
    )
  if (
    productIDs !== undefined &&
    (!Array.isArray(productIDs) || productIDs.some((item) => typeof item !== 'string'))
  )
    throw new Error('SubscriptionStoreView productIDs must be an array of strings')
  if (productIDs !== undefined && visibleRelationships !== undefined)
    throw new Error(
      'SubscriptionStoreView visibleRelationships does not apply with productIDs'
    )

  return (
    <NativeSubscriptionStoreView
      {...props}
      style={style}
      swiftStyle={swiftStyleNative(swiftStyle)}
      onNativeSDKEvent={({ nativeEvent }) =>
        dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value)
      }
      groupID={groupID ?? ''}
      visibleRelationships={visibleRelationships ?? 'all'}
      productIDs={productIDs ?? []}
      initializer={groupID !== undefined ? 0 : productIDs !== undefined ? 1 : -1}
    />
  )
}
