{"version":3,"file":"basicComponents.mjs","names":[],"sources":["../../../../src/plugins/A2UI/basicComponents.tsx"],"sourcesContent":["// The basic catalog's components a person sees most, in Stream's look: the ones Stream has a\n// component for are Stream's, rather than the A2UI elements themed. The rest of the catalog,\n// its layouts and media, stays A2UI's own.\nimport React, {\n  type ComponentPropsWithoutRef,\n  createContext,\n  type CSSProperties,\n  type KeyboardEvent,\n  type ReactNode,\n  useCallback,\n  useContext,\n  useEffect,\n  useRef,\n  useState,\n} from 'react';\nimport clsx from 'clsx';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport type { ReactA2uiComponentProps } from '@a2ui/react';\nimport type { ComponentContext } from '@a2ui/web_core';\n\nimport { Button } from '../../components/Button';\nimport { Checkbox, FieldError, TextInput } from '../../components/Form';\nimport type { IconSlots } from '../../components/Icons/slots';\nimport { useStableId } from '../../components/UtilityComponents/useStableId';\nimport { useComponentContextIcons } from '../../context/useComponentContextIcons';\nimport { useTranslationContext } from '../../context/TranslationContext';\nimport { AIMarkdown } from '../AIComponents/AIMarkdown';\nimport { aiUILinkOpener, isRecord } from '../AIComponents/GenerativeUI/AIUIHelpers';\nimport { useAIUIEntrance } from '../AIComponents/GenerativeUI/AIUIEntrance';\nimport { aiUIMediaSource } from '../AIComponents/GenerativeUI/AIUIMedia';\nimport type { A2UIEngine } from './A2UIRenderer';\n\n/** The engine of the surfaces below, for what in them reaches the host, such as links. */\nexport const A2UIEngineContext = createContext<A2UIEngine | undefined>(undefined);\n\n// Whether a Text is the label of a Button, where it shows as words rather than as Markdown.\nconst A2UILabelContext = createContext(false);\n\ntype Weighted = { accessibility?: unknown; weight?: unknown };\n\n// A part's flex weight in its Row or Column, as the A2UI elements apply theirs.\nconst weightOf = ({ weight }: Weighted): CSSProperties | undefined =>\n  typeof weight === 'number' ? { flex: weight } : undefined;\n\ntype Accessibility = {\n  'aria-description'?: string;\n  'aria-hidden'?: boolean;\n  'aria-label'?: string;\n  'aria-live'?: 'assertive' | 'polite';\n};\n\nconst said = (value: unknown) =>\n  value === undefined || value === null || value === '' ? undefined : String(value);\n\n// What the agent tells assistive technology about a part, with its `accessibility`, as the A2UI\n// elements tell it: what to call it, what more to say about it, whether to announce its changes,\n// and whether to leave it out.\nconst accessibilityOf = ({ accessibility }: Weighted): Accessibility => {\n  if (!isRecord(accessibility)) return {};\n  const { description, hidden, label, live } = accessibility;\n  const named = said(label);\n  const described = said(description);\n  return {\n    ...(named ? { 'aria-label': named } : {}),\n    ...(described ? { 'aria-description': described } : {}),\n    ...(live === 'polite' || live === 'assertive' ? { 'aria-live': live } : {}),\n    ...(hidden === true ? { 'aria-hidden': true } : {}),\n  };\n};\n\n// A part that comes in when it shows, carrying its weight and what the agent tells assistive\n// technology about it: the props of its element, and the scope of what shows with it.\nconst usePart = (props: Weighted) => {\n  const { props: entrance, scope } = useAIUIEntrance();\n  return {\n    part: {\n      ...entrance,\n      ...accessibilityOf(props),\n      style: { ...entrance.style, ...weightOf(props) },\n    },\n    scope,\n  };\n};\n\nconst textOf = (value: unknown) =>\n  typeof value === 'string' ? value : value == null ? '' : String(value);\n\nconst errorsOf = ({ isValid, validationErrors }: Checked) =>\n  isValid === false && Array.isArray(validationErrors)\n    ? validationErrors.filter((error): error is string => typeof error === 'string')\n    : [];\n\ntype Checked = { isValid?: unknown; validationErrors?: unknown };\n\n// What a part's checks found, under it.\nconst Problems = ({ errors, id }: { errors: string[]; id: string }) =>\n  errors.length ? (\n    <FieldError\n      className='str-chat__a2ui-problems'\n      id={id}\n      role='alert'\n      text={errors.join(' ')}\n    />\n  ) : null;\n\ntype ButtonProps = Checked &\n  Weighted & {\n    action?: unknown;\n    child?: unknown;\n    variant?: unknown;\n  };\n\nconst isBorderlessButton = (context: ComponentContext, id: unknown) => {\n  if (typeof id !== 'string') return false;\n  const component = context.surfaceComponents.get(id);\n  return component?.type === 'Button' && component.properties.variant === 'borderless';\n};\n\n/**\n * Where a borderless Button is among the follow-ups of a Column: `first`, or `after` another\n * borderless Button, which a hairline then parts it from. A borderless Button anywhere else, such\n * as in a Row, is not a follow-up, and reads as a link.\n */\nconst followUpPlaceOf = (\n  context: ComponentContext | undefined,\n): 'first' | 'after' | undefined => {\n  if (!context) return undefined;\n  const { id } = context.componentModel;\n  for (const parent of context.surfaceComponents.values) {\n    const { children } = parent.properties;\n    if (parent.type !== 'Column' || !Array.isArray(children)) continue;\n    const index = children.indexOf(id);\n    if (index < 0) continue;\n    return index > 0 && isBorderlessButton(context, children[index - 1])\n      ? 'after'\n      : 'first';\n  }\n  return undefined;\n};\n\n/**\n * A2UI's Button as Stream's: primary for the main call to action, and borderless as a ghost\n * button in the accent colour, which the spec means to read as a link, as it does on iOS.\n */\nexport const A2UIButton = ({\n  buildChild,\n  context,\n  props,\n}: ReactA2uiComponentProps<ButtonProps>) => {\n  const { part, scope } = usePart(props);\n  const isDisabled = props.isValid === false;\n  const followUp = props.variant === 'borderless' ? followUpPlaceOf(context) : undefined;\n  const look =\n    props.variant === 'primary'\n      ? ({ appearance: 'solid', variant: 'primary' } as const)\n      : props.variant === 'borderless'\n        ? ({ appearance: 'ghost', variant: 'primary' } as const)\n        : ({ appearance: 'outline', variant: 'secondary' } as const);\n  return (\n    <Button\n      {...look}\n      {...part}\n      className={clsx(\n        'str-chat__a2ui-button',\n        `str-chat__a2ui-button--${\n          props.variant === 'primary' || props.variant === 'borderless'\n            ? props.variant\n            : 'default'\n        }`,\n        {\n          'str-chat__a2ui-button--follow-up': followUp,\n          'str-chat__a2ui-button--follow-up-after': followUp === 'after',\n        },\n        part.className,\n      )}\n      disabled={isDisabled}\n      onClick={() => {\n        if (!isDisabled && typeof props.action === 'function') props.action();\n      }}\n      size='md'\n    >\n      <A2UILabelContext.Provider value>\n        {scope(typeof props.child === 'string' ? buildChild(props.child) : null)}\n      </A2UILabelContext.Provider>\n    </Button>\n  );\n};\n\ntype CardProps = Weighted & { child?: unknown };\n\n/** A2UI's Card: a box of its own in the reply, as Stream's cards are. */\nexport const A2UICard = ({ buildChild, props }: ReactA2uiComponentProps<CardProps>) => {\n  const { part, scope } = usePart(props);\n  return (\n    <div\n      {...part}\n      className={clsx('str-chat__a2ui-card', part.className)}\n      role={part['aria-label'] ? 'group' : undefined}\n    >\n      {scope(typeof props.child === 'string' ? buildChild(props.child) : null)}\n    </div>\n  );\n};\n\ntype TextProps = Weighted & { text?: unknown; variant?: unknown };\n\n/**\n * A2UI's Text: Markdown rendered as replies' is, or a caption. Its links open the\n * way the host allows, since the agent writes them, rather than wherever they point. As a\n * Button's label it is the button's words.\n */\nexport const A2UIText = ({ props }: ReactA2uiComponentProps<TextProps>) =>\n  useContext(A2UILabelContext) ? (\n    <span className='str-chat__a2ui-text str-chat__a2ui-text--label'>\n      {textOf(props.text)}\n    </span>\n  ) : (\n    <A2UITextPart {...props} />\n  );\n\n// A Text that is a part of its own, coming in when it shows.\nconst A2UITextPart = (props: TextProps) => {\n  const engine = useContext(A2UIEngineContext);\n  const { part } = usePart(props);\n  const text = textOf(props.text);\n  const variant = typeof props.variant === 'string' ? props.variant : 'body';\n  const classes = clsx(\n    'str-chat__a2ui-text',\n    `str-chat__a2ui-text--${variant}`,\n    part.className,\n  );\n  // A generic element can't be named, so a Text the agent names is a group.\n  const role = part['aria-label'] ? 'group' : undefined;\n  if (variant === 'caption') {\n    return (\n      <p {...part} className={classes} role={role}>\n        {text}\n      </p>\n    );\n  }\n  const follow = aiUILinkOpener(engine?.host);\n  return (\n    <div\n      {...part}\n      className={classes}\n      onAuxClickCapture={follow}\n      onClickCapture={follow}\n      role={role}\n    >\n      <AIMarkdown>{text}</AIMarkdown>\n    </div>\n  );\n};\n\ntype TextFieldProps = Checked &\n  Weighted & {\n    label?: unknown;\n    placeholder?: unknown;\n    setValue?: unknown;\n    value?: unknown;\n    variant?: unknown;\n  };\n\n/** A2UI's TextField as Stream's text input, or a text area for long text. */\nexport const A2UITextField = ({ props }: ReactA2uiComponentProps<TextFieldProps>) => {\n  // What names and describes the field goes on its input; the rest on the part.\n  const {\n    part: { 'aria-description': description, 'aria-label': name, ...part },\n  } = usePart(props);\n  const named = { 'aria-description': description, 'aria-label': name };\n  const id = useStableId();\n  const problemsId = `${id}-problems`;\n  const errors = errorsOf(props);\n  const label = textOf(props.label);\n  const placeholder = textOf(props.placeholder) || undefined;\n  const value = textOf(props.value);\n  const change = (next: string) => {\n    if (typeof props.setValue === 'function') props.setValue(next);\n  };\n  const field =\n    props.variant === 'longText' ? (\n      <div\n        className={clsx(\n          'str-chat__form-text-input',\n          errors.length > 0 && 'str-chat__form-text-input--error',\n        )}\n      >\n        {label && (\n          <label className='str-chat__form-text-input__label' htmlFor={id}>\n            {label}\n          </label>\n        )}\n        <div className='str-chat__form-text-input__wrapper str-chat__form-text-input__wrapper--outline'>\n          <div className='str-chat__form-text-input__control-row'>\n            <textarea\n              {...named}\n              aria-describedby={errors.length ? problemsId : undefined}\n              aria-invalid={errors.length > 0}\n              className='str-chat__form-text-input__input str-chat__a2ui-text-field__long'\n              id={id}\n              onChange={(event) => change(event.target.value)}\n              placeholder={placeholder}\n              rows={3}\n              value={value}\n            />\n          </div>\n        </div>\n      </div>\n    ) : (\n      <TextInput\n        {...named}\n        aria-describedby={errors.length ? problemsId : undefined}\n        error={errors.length > 0}\n        id={id}\n        label={label || undefined}\n        onChange={(event) => change(event.target.value)}\n        placeholder={placeholder}\n        type={\n          props.variant === 'number'\n            ? 'number'\n            : props.variant === 'obscured'\n              ? 'password'\n              : 'text'\n        }\n        value={value}\n      />\n    );\n  return (\n    <div {...part} className={clsx('str-chat__a2ui-text-field', part.className)}>\n      {field}\n      <Problems errors={errors} id={problemsId} />\n    </div>\n  );\n};\n\ntype ChoicePickerProps = Checked &\n  Weighted & {\n    displayStyle?: unknown;\n    filterable?: unknown;\n    label?: unknown;\n    options?: unknown;\n    setValue?: unknown;\n    value?: unknown;\n    variant?: unknown;\n  };\n\ntype Option = { label: string; value: string };\n\nconst optionsOf = (options: unknown): Option[] =>\n  Array.isArray(options)\n    ? options.flatMap((option: unknown) => {\n        if (typeof option !== 'object' || option === null) return [];\n        const { label, value } = option as Record<string, unknown>;\n        return typeof value === 'string'\n          ? [{ label: textOf(label) || value, value }]\n          : [];\n      })\n    : [];\n\n/**\n * A2UI's ChoicePicker: Stream's check marks, or chips as Stream's buttons, choosing one option\n * or several. A filterable one has a search field above its options.\n */\nexport const A2UIChoicePicker = ({\n  props,\n}: ReactA2uiComponentProps<ChoicePickerProps>) => {\n  const { t } = useTranslationContext();\n  const { part } = usePart(props);\n  const id = useStableId();\n  const [filter, setFilter] = useState('');\n  const errors = errorsOf(props);\n  const label = textOf(props.label);\n  const isMultiple = props.variant === 'multipleSelection';\n  const isChips = props.displayStyle === 'chips';\n  const selected = Array.isArray(props.value)\n    ? props.value.filter((value): value is string => typeof value === 'string')\n    : typeof props.value === 'string'\n      ? [props.value]\n      : [];\n  const toggle = (value: string) => {\n    if (typeof props.setValue !== 'function') return;\n    if (!isMultiple) props.setValue([value]);\n    else if (selected.includes(value))\n      props.setValue(selected.filter((chosen) => chosen !== value));\n    else props.setValue([...selected, value]);\n  };\n  const needle = filter.trim().toLowerCase();\n  const options = optionsOf(props.options).filter(\n    (option) =>\n      props.filterable !== true ||\n      needle === '' ||\n      option.label.toLowerCase().includes(needle),\n  );\n  return (\n    <div\n      {...part}\n      aria-describedby={errors.length ? `${id}-problems` : undefined}\n      aria-labelledby={label && !part['aria-label'] ? `${id}-label` : undefined}\n      className={clsx('str-chat__a2ui-choice-picker', part.className)}\n      role={isMultiple || isChips ? 'group' : 'radiogroup'}\n    >\n      {label && (\n        <div className='str-chat__a2ui-choice-picker__label' id={`${id}-label`}>\n          {label}\n        </div>\n      )}\n      {props.filterable === true && (\n        <TextInput\n          aria-label={t('common.search.ariaLabel', 'Search')}\n          className='str-chat__a2ui-choice-picker__filter'\n          onChange={(event) => setFilter(event.target.value)}\n          placeholder={t('aiComponents.a2ui.choicePickerFilter.placeholder', 'Search')}\n          type='search'\n          value={filter}\n        />\n      )}\n      {isChips ? (\n        <div className='str-chat__a2ui-choice-picker__chips'>\n          {options.map((option) => {\n            const isSelected = selected.includes(option.value);\n            return (\n              <Button\n                appearance='ghost'\n                aria-pressed={isSelected}\n                className={clsx('str-chat__a2ui-chip', {\n                  'str-chat__a2ui-chip--selected': isSelected,\n                })}\n                key={option.value}\n                onClick={() => toggle(option.value)}\n                size='sm'\n                variant='secondary'\n              >\n                {option.label}\n              </Button>\n            );\n          })}\n        </div>\n      ) : (\n        <div className='str-chat__a2ui-choice-picker__options'>\n          {options.map((option) => {\n            const isSelected = selected.includes(option.value);\n            return (\n              <label className='str-chat__a2ui-choice-picker__option' key={option.value}>\n                <input\n                  checked={isSelected}\n                  className='str-chat__a2ui-choice-picker__input'\n                  name={isMultiple ? undefined : id}\n                  onChange={() => toggle(option.value)}\n                  type={isMultiple ? 'checkbox' : 'radio'}\n                  value={option.value}\n                />\n                <Checkbox aria-hidden checked={isSelected} />\n                <span>{option.label}</span>\n              </label>\n            );\n          })}\n        </div>\n      )}\n      <Problems errors={errors} id={`${id}-problems`} />\n    </div>\n  );\n};\n\n// The A2UI icons Stream has one for, by the slot an app restyles it with.\nconst STREAM_ICONS: Record<string, keyof IconSlots> = {\n  accountCircle: 'IconUser',\n  add: 'IconPlus',\n  arrowBack: 'IconArrowLeft',\n  attachFile: 'IconAttachment',\n  camera: 'IconCamera',\n  check: 'IconCheckmark',\n  close: 'IconXmark',\n  delete: 'IconDelete',\n  download: 'IconDownload',\n  edit: 'IconEdit',\n  error: 'IconExclamationCircleFill',\n  folder: 'IconFolder',\n  info: 'IconInfo',\n  locationOn: 'IconLocation',\n  menu: 'IconMenu',\n  moreHoriz: 'IconMore',\n  notifications: 'IconBell',\n  notificationsOff: 'IconBellOff',\n  pause: 'IconPauseFill',\n  person: 'IconUser',\n  photo: 'IconImage',\n  play: 'IconPlayFill',\n  refresh: 'IconRefresh',\n  search: 'IconSearch',\n  send: 'IconSend',\n  upload: 'IconUpload',\n  visibility: 'IconEyeFill',\n  volumeMute: 'IconMute',\n  volumeOff: 'IconMute',\n  warning: 'IconExclamationTriangleFill',\n};\n\n// The names A2UI's own Icon gives these in the Material icon fonts.\nconst FONT_NAMES: Record<string, string> = {\n  favoriteOff: 'favorite_border',\n  play: 'play_arrow',\n  rewind: 'fast_rewind',\n  starOff: 'star_border',\n};\n\nconst fontNameOf = (name: string) =>\n  FONT_NAMES[name] ?? name.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);\n\n// What a screen reader says for an icon, from its name: `shoppingCart` is \"shopping cart\".\nconst wordsOf = (name: string) => name.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase();\n\ntype IconProps = Weighted & { name?: unknown };\n\n/**\n * A2UI's Icon: the app's own for its name, else Stream's, else the icon font the app loads, if\n * it said which. An icon none of them draws takes its place but shows nothing, rather than its\n * name as words. An icon the agent draws as an SVG path shows as it.\n */\nexport const A2UIIcon = ({ props }: ReactA2uiComponentProps<IconProps>) => {\n  const engine = useContext(A2UIEngineContext);\n  const streamIcons = useComponentContextIcons();\n  const { part } = usePart(props);\n  const classes = clsx('str-chat__a2ui-icon', part.className);\n  const { name } = props;\n  if (typeof name === 'object' && name !== null && 'svgPath' in name) {\n    const { svgPath } = name as { svgPath?: unknown };\n    // A drawn icon says nothing unless the agent named it.\n    const spoken = part['aria-label']\n      ? { role: 'img' }\n      : { 'aria-hidden': part['aria-hidden'] ?? true };\n    return (\n      <svg\n        {...part}\n        {...spoken}\n        className={classes}\n        focusable={false}\n        viewBox='0 0 24 24'\n      >\n        <path d={textOf(svgPath)} />\n      </svg>\n    );\n  }\n  const iconName = textOf(name);\n  const slot = STREAM_ICONS[iconName];\n  const Drawn: React.ComponentType<ComponentPropsWithoutRef<'svg'>> | undefined =\n    engine?.icons?.[iconName] ?? (slot ? streamIcons[slot] : undefined);\n  // Called what the agent named it, else its name in words.\n  const label = { 'aria-label': part['aria-label'] ?? wordsOf(iconName), role: 'img' };\n  if (Drawn) {\n    return (\n      <span {...part} {...label} className={classes}>\n        <Drawn aria-hidden />\n      </span>\n    );\n  }\n  return (\n    <span {...part} {...label} className={classes}>\n      {engine?.iconFont && (\n        <span\n          aria-hidden\n          className='str-chat__a2ui-icon__glyph'\n          style={{ fontFamily: engine.iconFont }}\n        >\n          {fontNameOf(iconName)}\n        </span>\n      )}\n    </span>\n  );\n};\n\ntype ModalProps = Weighted & { content: string; trigger: string };\n\n// The type of a component of the surface, following it: an agent may write a component after\n// the one that names it.\nconst useComponentType = (context: ComponentContext, id: string) => {\n  const components = context.surfaceComponents;\n  const subscribe = useCallback(\n    (onChange: () => void) => {\n      const created = components.onCreated.subscribe(onChange);\n      const deleted = components.onDeleted.subscribe(onChange);\n      return () => {\n        created.unsubscribe();\n        deleted.unsubscribe();\n      };\n    },\n    [components],\n  );\n  return useSyncExternalStore(subscribe, () => components.get(id)?.type);\n};\n\n/**\n * A Modal that opens as a dialog: focus moves into it and stays there while it is open, Escape\n * and the backdrop close it, focus goes back to what opened it, and it shows above everything,\n * whatever the reply's layout. A tap on its trigger opens it, and a Button's own action still\n * runs; another trigger opens from the keyboard too.\n */\nexport const A2UIModal = ({\n  buildChild,\n  context,\n  props,\n}: ReactA2uiComponentProps<ModalProps>) => {\n  const { t } = useTranslationContext();\n  const dialog = useRef<HTMLDialogElement>(null);\n  const [isOpen, setOpen] = useState(false);\n  useEffect(() => {\n    const element = dialog.current;\n    if (!element || isOpen === element.open) return;\n    if (isOpen) {\n      if (typeof element.showModal === 'function') element.showModal();\n      else element.setAttribute('open', '');\n    } else if (typeof element.close === 'function') element.close();\n    else element.removeAttribute('open');\n  }, [isOpen]);\n  // The trigger as the agent named it: `props` has it as the node it rendered.\n  const { trigger } = context.componentModel.properties;\n  const opensItself =\n    useComponentType(context, typeof trigger === 'string' ? trigger : '') === 'Button';\n  const open = () => setOpen(true);\n  return (\n    <>\n      <div\n        className='str-chat__a2ui-modal__trigger'\n        onClickCapture={open}\n        {...(opensItself\n          ? {}\n          : {\n              onKeyDown: (event: KeyboardEvent) => {\n                if (event.key !== 'Enter' && event.key !== ' ') return;\n                event.preventDefault();\n                open();\n              },\n              role: 'button',\n              tabIndex: 0,\n            })}\n      >\n        {buildChild(props.trigger)}\n      </div>\n      <dialog\n        {...accessibilityOf(props)}\n        className='str-chat__a2ui-modal'\n        onCancel={(event) => {\n          event.preventDefault();\n          setOpen(false);\n        }}\n        onClick={(event) => {\n          if (event.target === event.currentTarget) setOpen(false);\n        }}\n        onClose={() => setOpen(false)}\n        ref={dialog}\n      >\n        <div className='str-chat__a2ui-modal__content'>\n          <button\n            aria-label={t('common.close.ariaLabel', 'Close')}\n            className='str-chat__a2ui-modal__close'\n            onClick={() => setOpen(false)}\n            type='button'\n          >\n            ×\n          </button>\n          {isOpen && buildChild(props.content)}\n        </div>\n      </dialog>\n    </>\n  );\n};\n\n/** The basic catalog's components drawn here, by their A2UI type. */\ntype ImageProps = Weighted & {\n  description?: unknown;\n  fit?: unknown;\n  url?: unknown;\n  variant?: unknown;\n};\n\nconst FITS: Record<string, string> = { scaleDown: 'scale-down' };\n\n/**\n * A2UI's Image, loading only what the renderer's `mediaUrl` allows, before it draws, so an\n * image the agent links to never reaches what the app doesn't want it to.\n */\nexport const A2UIImage = ({ props }: ReactA2uiComponentProps<ImageProps>) => {\n  const { part } = usePart(props);\n  const engine = useContext(A2UIEngineContext);\n  const src = aiUIMediaSource(props.url, engine?.mediaURL);\n  const variant = typeof props.variant === 'string' ? props.variant : 'default';\n  const fit = typeof props.fit === 'string' ? (FITS[props.fit] ?? props.fit) : 'cover';\n  if (!src) return null;\n  return (\n    <img\n      {...part}\n      alt={textOf(props.description)}\n      className={clsx('str-chat__a2ui-image', `str-chat__a2ui-image--${variant}`)}\n      src={src}\n      style={{ ...part.style, objectFit: fit as CSSProperties['objectFit'] }}\n    />\n  );\n};\n\ntype VideoProps = Weighted & { posterUrl?: unknown; url?: unknown };\n\n/** A2UI's Video, loading only what the renderer's `mediaUrl` allows. */\nexport const A2UIVideo = ({ props }: ReactA2uiComponentProps<VideoProps>) => {\n  const { part } = usePart(props);\n  const engine = useContext(A2UIEngineContext);\n  const src = aiUIMediaSource(props.url, engine?.mediaURL);\n  const poster = aiUIMediaSource(props.posterUrl, engine?.mediaURL);\n  if (!src) return null;\n  return (\n    <video\n      {...part}\n      className='str-chat__a2ui-video'\n      controls\n      poster={poster}\n      preload='metadata'\n      src={src}\n    />\n  );\n};\n\ntype AudioPlayerProps = Weighted & { description?: unknown; url?: unknown };\n\n/** A2UI's AudioPlayer, loading only what the renderer's `mediaUrl` allows. */\nexport const A2UIAudioPlayer = ({ props }: ReactA2uiComponentProps<AudioPlayerProps>) => {\n  const { part } = usePart(props);\n  const engine = useContext(A2UIEngineContext);\n  const src = aiUIMediaSource(props.url, engine?.mediaURL);\n  if (!src) return null;\n  const description = textOf(props.description);\n  return (\n    <div {...part} className='str-chat__a2ui-audio-player'>\n      {description && (\n        <div className='str-chat__a2ui-audio-player__description'>{description}</div>\n      )}\n      <audio\n        aria-label={description || undefined}\n        controls\n        preload='metadata'\n        src={src}\n      />\n    </div>\n  );\n};\n\nexport const STREAM_BASIC_COMPONENTS: Record<\n  string,\n  (props: ReactA2uiComponentProps<never>) => ReactNode\n> = {\n  AudioPlayer: A2UIAudioPlayer,\n  Button: A2UIButton,\n  Card: A2UICard,\n  ChoicePicker: A2UIChoicePicker,\n  Icon: A2UIIcon,\n  Image: A2UIImage,\n  Modal: A2UIModal,\n  Text: A2UIText,\n  TextField: A2UITextField,\n  Video: A2UIVideo,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,IAAa,oBAAoB,cAAsC,KAAA,CAAS;AAGhF,IAAM,mBAAmB,cAAc,KAAK;AAK5C,IAAM,YAAY,EAAE,aAClB,OAAO,WAAW,WAAW,EAAE,MAAM,OAAO,IAAI,KAAA;AASlD,IAAM,QAAQ,UACZ,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,KAAK,KAAA,IAAY,OAAO,KAAK;AAKlF,IAAM,mBAAmB,EAAE,oBAA6C;CACtE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