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AO;KAAW;IACjD,CAAA,GAAA,0BAAkB,EAAE,qBAAqB;IACzC,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,UAAU;QACb,IAAI;QACJ,UAAU,KAAK,QAAQ;QACvB,kBAAkB;QAClB,QAAQ;IACV;IAEA,IAAI,cAAc;QAChB,uBAAuB;QACvB,UAAU;IAIZ;IAEA,qBACE,gFAGE,gCAAC;QAAI,OAAO;YAAC,UAAU;YAAY,OAAO;YAAG,QAAQ;QAAC;QAAG,OAAO,CAAA,GAAA,iBAAS,EAAE;qBACzE,gCAAC;QAAI,eAAY;QAAmB,KAAK;QAAa,OAAO;YAAC,UAAU;YAAY,QAAQ;YAAG,OAAO;QAAC;SAExG,aAAa,YAAY,QAAQ,kBAChC,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,YAAY;QACjE,GAAG,WAAW;QACf,uEAAuE;QACvE,MAAK;QACL,KAAK;OACJ,YAAY,QAAQ;AAK/B","sources":["packages/react-aria-components/src/ListBox.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n  AriaListBoxOptions,\n  AriaListBoxProps,\n  useListBox,\n  useListBoxSection,\n  useOption\n} from 'react-aria/useListBox';\n\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  DEFAULT_SLOT,\n  dom,\n  DOMRenderProps,\n  PossibleLinkDOMRenderProps,\n  Provider,\n  RenderProps,\n  SlotProps,\n  StyleProps,\n  StyleRenderProps,\n  useContextProps,\n  useRenderProps,\n  useSlot\n} from './utils';\nimport {Collection} from 'react-aria/Collection';\nimport {CollectionBuilder, createBranchComponent, createLeafComponent} from 'react-aria/CollectionBuilder';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps} from './Collection';\nimport {DragAndDropContext, DropIndicatorContext, DropIndicatorProps, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport {DraggableItemResult} from 'react-aria/useDraggableCollection';\nimport {DragPreviewRenderer} from '@react-types/shared';\nimport {DroppableCollectionResult, DroppableItemResult} from 'react-aria/useDroppableCollection';\nimport {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusEvents, forwardRefType, GlobalDOMAttributes, HoverEvents, Key, KeyboardEvents, LinkDOMProps, PressEvents, RefObject} from '@react-types/shared';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport {HeaderContext} from './Header';\nimport {inertValue} from 'react-aria/private/utils/inertValue';\nimport {ItemNode, LoaderNode, SectionNode} from 'react-aria/private/collections/BaseCollection';\nimport {ListKeyboardDelegate} from 'react-aria/ListKeyboardDelegate';\nimport {ListState, UNSTABLE_useFilteredListState, useListState} from 'react-stately/useListState';\nimport {LoadMoreSentinelProps, useLoadMoreSentinel} from 'react-aria/private/utils/useLoadMoreSentinel';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {Node, Orientation, SelectionBehavior} from '@react-types/shared';\nimport React, {createContext, ForwardedRef, forwardRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {SelectableCollectionContext, SelectableCollectionContextValue} from './Autocomplete';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SeparatorContext} from './Separator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TextContext} from './Text';\nimport {useCollator} from 'react-aria/useCollator';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useKeyboard} from 'react-aria/useKeyboard';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport interface ListBoxRenderProps {\n  /**\n   * Whether the listbox has no items and should display its empty state.\n   * @selector [data-empty]\n   */\n  isEmpty: boolean,\n  /**\n   * Whether the listbox is currently focused.\n   * @selector [data-focused]\n   */\n  isFocused: boolean,\n  /**\n   * Whether the listbox is currently keyboard focused.\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean,\n  /**\n   * Whether the listbox is currently the active drop target.\n   * @selector [data-drop-target]\n   */\n  isDropTarget: boolean,\n  /**\n   * Whether the items are arranged in a stack or grid.\n   * @selector [data-layout=\"stack | grid\"]\n   */\n  layout: 'stack' | 'grid',\n  /**\n   * The primary orientation of the items.\n   * @selector [data-orientation=\"vertical | horizontal\"]\n   */\n  orientation: Orientation,\n  /**\n   * State of the listbox.\n   */\n  state: ListState<unknown>\n}\n\nexport interface ListBoxProps<T> extends Omit<AriaListBoxProps<T>, 'children' | 'label'>, CollectionProps<T>, StyleRenderProps<ListBoxRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n   * @default 'react-aria-ListBox'\n   */\n  className?: ClassNameOrFunction<ListBoxRenderProps>,\n  /**\n   * How multiple selection should behave in the collection.\n   * @default \"toggle\"\n   */\n  selectionBehavior?: SelectionBehavior,\n  /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the ListBox. */\n  dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>,\n  /** Provides content to display when there are no items in the list. */\n  renderEmptyState?: (props: ListBoxRenderProps) => ReactNode,\n  /**\n   * Whether the items are arranged in a stack or grid.\n   * @default 'stack'\n   */\n  layout?: 'stack' | 'grid',\n  /**\n   * The primary orientation of the items. Usually this is the\n   * direction that the collection scrolls.\n   * @default 'vertical'\n   */\n  orientation?: Orientation\n}\n\nexport const ListBoxContext = createContext<ContextValue<ListBoxProps<any>, HTMLDivElement>>(null);\nexport const ListStateContext = createContext<ListState<any> | null>(null);\n\n/**\n * A listbox displays a list of options and allows a user to select one or more of them.\n */\nexport const ListBox = /*#__PURE__*/ (forwardRef as forwardRefType)(function ListBox<T extends object>(props: ListBoxProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, ListBoxContext);\n  let state = useContext(ListStateContext);\n\n  // The structure of ListBox is a bit strange because it needs to work inside other components like ComboBox and Select.\n  // Those components render two copies of their children so that the collection can be built even when the popover is closed.\n  // The first copy sends a collection document via context which we render the collection portal into.\n  // The second copy sends a ListState object via context which we use to render the ListBox without rebuilding the state.\n  // Otherwise, we have a standalone ListBox, so we need to create a collection and state ourselves.\n  if (state) {\n    return <ListBoxInner state={state} props={props} listBoxRef={ref} />;\n  }\n\n  return (\n    <CollectionBuilder content={<Collection {...props} />}>\n      {collection => <StandaloneListBox props={props} listBoxRef={ref} collection={collection} />}\n    </CollectionBuilder>\n  );\n});\n\nfunction StandaloneListBox({props, listBoxRef, collection}) {\n  props = {...props, collection, children: null, items: null};\n  let {layoutDelegate} = useContext(CollectionRendererContext);\n  let state = useListState({...props, layoutDelegate});\n  return <ListBoxInner state={state} props={props} listBoxRef={listBoxRef} />;\n}\n\ninterface ListBoxInnerProps<T> {\n  state: ListState<T>,\n  props: ListBoxProps<T> & AriaListBoxOptions<T> & {filter?: SelectableCollectionContextValue<T>['filter']},\n  listBoxRef: RefObject<HTMLElement | null>\n}\n\nfunction ListBoxInner<T extends object>({state: inputState, props, listBoxRef}: ListBoxInnerProps<T>) {\n  [props, listBoxRef] = useContextProps(props, listBoxRef, SelectableCollectionContext);\n  let {dragAndDropHooks, layout = 'stack', orientation = 'vertical', filter} = props;\n  let state = UNSTABLE_useFilteredListState(inputState, filter);\n  let {collection, selectionManager} = state;\n  let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n  let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n  let {direction} = useLocale();\n  let {disabledBehavior, disabledKeys} = selectionManager;\n  let collator = useCollator({usage: 'search', sensitivity: 'base'});\n  let {isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate, CollectionRoot} = useContext(CollectionRendererContext);\n  let keyboardDelegate = useMemo(() => (\n    props.keyboardDelegate || new ListKeyboardDelegate({\n      collection,\n      collator,\n      ref: listBoxRef,\n      disabledKeys,\n      disabledBehavior,\n      layout,\n      orientation,\n      direction,\n      layoutDelegate\n    })\n  ), [collection, collator, listBoxRef, disabledBehavior, disabledKeys, orientation, direction, props.keyboardDelegate, layout, layoutDelegate]);\n\n  let {listBoxProps} = useListBox({\n    ...props,\n    shouldSelectOnPressUp: isListDraggable || props.shouldSelectOnPressUp,\n    keyboardDelegate,\n    isVirtualized\n  }, state, listBoxRef);\n\n  let dragHooksProvided = useRef(isListDraggable);\n  let dropHooksProvided = useRef(isListDroppable);\n  useEffect(() => {\n    if (process.env.NODE_ENV === 'production') {\n      return;\n    }\n    if (dragHooksProvided.current !== isListDraggable) {\n      console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n    }\n    if (dropHooksProvided.current !== isListDroppable) {\n      console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n    }\n  }, [isListDraggable, isListDroppable]);\n\n  let dragState: DraggableCollectionState | undefined = undefined;\n  let dropState: DroppableCollectionState | undefined = undefined;\n  let droppableCollection: DroppableCollectionResult | undefined = undefined;\n  let isRootDropTarget = false;\n  let dragPreview: JSX.Element | null = null;\n  let preview = useRef<DragPreviewRenderer>(null);\n\n  if (isListDraggable && dragAndDropHooks) {\n    dragState = dragAndDropHooks.useDraggableCollectionState!({\n      collection,\n      selectionManager,\n      preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n    });\n    dragAndDropHooks.useDraggableCollection!({}, dragState, listBoxRef);\n\n    let DragPreview = dragAndDropHooks.DragPreview!;\n    dragPreview = dragAndDropHooks.renderDragPreview\n      ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n      : null;\n  }\n\n  if (isListDroppable && dragAndDropHooks) {\n    dropState = dragAndDropHooks.useDroppableCollectionState!({\n      collection,\n      selectionManager\n    });\n\n    let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(collection, listBoxRef, {orientation, layout, direction});\n    droppableCollection = dragAndDropHooks.useDroppableCollection!({\n      keyboardDelegate,\n      dropTargetDelegate\n    }, dropState, listBoxRef);\n\n    isRootDropTarget = dropState.isDropTarget({type: 'root'});\n  }\n\n  let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n  let isEmpty = state.collection.size === 0;\n  let renderValues = {\n    isDropTarget: isRootDropTarget,\n    isEmpty,\n    isFocused,\n    isFocusVisible,\n    layout: props.layout || 'stack',\n    orientation,\n    state\n  };\n  let renderProps = useRenderProps({\n    ...props,\n    children: undefined,\n    defaultClassName: 'react-aria-ListBox',\n    values: renderValues\n  });\n\n  let emptyState: JSX.Element | null = null;\n  if (isEmpty && props.renderEmptyState) {\n    emptyState = (\n      <div\n        // eslint-disable-next-line\n        role=\"option\"\n        style={{display: 'contents'}}>\n        {props.renderEmptyState(renderValues)}\n      </div>\n    );\n  }\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  return (\n    <FocusScope>\n      <dom.div\n        {...mergeProps(DOMProps, renderProps, listBoxProps, focusProps, droppableCollection?.collectionProps)}\n        ref={listBoxRef as RefObject<HTMLDivElement>}\n        slot={props.slot || undefined}\n        onScroll={props.onScroll}\n        data-drop-target={isRootDropTarget || undefined}\n        data-empty={isEmpty || undefined}\n        data-focused={isFocused || undefined}\n        data-focus-visible={isFocusVisible || undefined}\n        data-layout={props.layout || 'stack'}\n        data-orientation={orientation}>\n        <Provider\n          values={[\n            [ListBoxContext, props],\n            [ListStateContext, state],\n            [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n            [SeparatorContext, {elementType: 'div'}],\n            [DropIndicatorContext, {render: ListBoxDropIndicatorWrapper}],\n            [SectionContext, {name: 'ListBoxSection', render: ListBoxSectionInner}]\n          ]}>\n          <SharedElementTransition>\n            <CollectionRoot\n              collection={collection}\n              scrollRef={listBoxRef}\n              persistedKeys={useDndPersistedKeys(selectionManager, dragAndDropHooks, dropState)}\n              renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n          </SharedElementTransition>\n        </Provider>\n        {emptyState}\n        {dragPreview}\n      </dom.div>\n    </FocusScope>\n  );\n}\n\nexport interface ListBoxSectionProps<T> extends SectionProps<T>, DOMRenderProps<'section', undefined> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element.\n   * @default 'react-aria-ListBoxSection'\n   */\n  className?: string\n}\n\nfunction ListBoxSectionInner<T extends object>(props: ListBoxSectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>, className = 'react-aria-ListBoxSection') {\n  let state = useContext(ListStateContext)!;\n  let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;\n  let {CollectionBranch} = useContext(CollectionRendererContext);\n  let [headingRef, heading] = useSlot();\n  let {headingProps, groupProps} = useListBoxSection({\n    heading,\n    'aria-label': props['aria-label'] ?? undefined\n  });\n  let renderProps = useRenderProps({\n    ...props,\n    id: undefined,\n    children: undefined,\n    defaultClassName: className,\n    values: undefined\n  });\n\n  let DOMProps = filterDOMProps(props as any, {global: true});\n  delete DOMProps.id;\n\n  return (\n    <dom.section\n      {...mergeProps(DOMProps, renderProps, groupProps)}\n      ref={ref}>\n      <HeaderContext.Provider value={{...headingProps, ref: headingRef}}>\n        <CollectionBranch\n          collection={state.collection}\n          parent={section}\n          renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n      </HeaderContext.Provider>\n    </dom.section>\n  );\n}\n\n/**\n * A ListBoxSection represents a section within a ListBox.\n */\nexport const ListBoxSection = /*#__PURE__*/ createBranchComponent(SectionNode, ListBoxSectionInner);\n\nexport interface ListBoxItemRenderProps extends ItemRenderProps {}\n\nexport interface ListBoxItemProps<T = object> extends Omit<RenderProps<ListBoxItemRenderProps>, 'render'>, PossibleLinkDOMRenderProps<'div', ListBoxItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, KeyboardEvents, FocusEvents<HTMLDivElement>, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n   * @default 'react-aria-ListBoxItem'\n   */\n  className?: ClassNameOrFunction<ListBoxItemRenderProps>,\n  /** The unique id of the item. */\n  id?: Key,\n  /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n  value?: T,\n  /** A string representation of the item's contents, used for features like typeahead. */\n  textValue?: string,\n  /** An accessibility label for this item. */\n  'aria-label'?: string,\n  /** Whether the item is disabled. */\n  isDisabled?: boolean,\n  /**\n   * Handler that is called when a user performs an action on the item. The exact user event depends on\n   * the collection's `selectionBehavior` prop and the interaction modality.\n   */\n  onAction?: () => void\n}\n\n/**\n * A ListBoxItem represents an individual option in a ListBox.\n */\nexport const ListBoxItem = /*#__PURE__*/ createLeafComponent(ItemNode, function ListBoxItem<T extends object>(props: ListBoxItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n  let ref = useObjectRef<any>(forwardedRef);\n  let state = useContext(ListStateContext)!;\n  let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext)!;\n  let {optionProps, labelProps, descriptionProps, ...states} = useOption(\n    {key: item.key, 'aria-label': props?.['aria-label']},\n    state,\n    ref\n  );\n\n  let {hoverProps, isHovered} = useHover({\n    isDisabled: !states.allowsSelection && !states.hasAction,\n    onHoverStart: item.props.onHoverStart,\n    onHoverChange: item.props.onHoverChange,\n    onHoverEnd: item.props.onHoverEnd\n  });\n\n  let {keyboardProps} = useKeyboard(props);\n  let {focusProps} = useFocus(props);\n\n  let draggableItem: DraggableItemResult | null = null;\n  if (dragState && dragAndDropHooks) {\n    draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasAction: states.hasAction}, dragState);\n  }\n\n  let droppableItem: DroppableItemResult | null = null;\n  if (dropState && dragAndDropHooks) {\n    droppableItem = dragAndDropHooks.useDroppableItem!({\n      target: {type: 'item', key: item.key, dropPosition: 'on'}\n    }, dropState, ref);\n  }\n\n  let isDragging = dragState && dragState.isDragging(item.key);\n  let renderProps = useRenderProps<ListBoxItemRenderProps, any>({\n    ...props,\n    id: undefined,\n    children: props.children,\n    defaultClassName: 'react-aria-ListBoxItem',\n    values: {\n      ...states,\n      isHovered,\n      selectionMode: state.selectionManager.selectionMode,\n      selectionBehavior: state.selectionManager.selectionBehavior,\n      allowsDragging: !!dragState,\n      isDragging,\n      isDropTarget: droppableItem?.isDropTarget\n    }\n  });\n\n  useEffect(() => {\n    if (!item.textValue && process.env.NODE_ENV !== 'production') {\n      console.warn('A `textValue` prop is required for <ListBoxItem> elements with non-plain text children in order to support accessibility features such as type to select.');\n    }\n  }, [item.textValue]);\n\n  let ElementType = props.href ? dom.a : dom.div;\n  let DOMProps = filterDOMProps(props as any, {global: true});\n  delete DOMProps.id;\n  delete DOMProps.onClick;\n\n  if (props.href && optionProps.tabIndex == null) {\n    optionProps.tabIndex = -1;\n  }\n\n  return (\n    <ElementType\n      {...mergeProps(DOMProps, renderProps, optionProps, hoverProps, keyboardProps, focusProps, draggableItem?.dragProps, droppableItem?.dropProps)}\n      ref={ref}\n      data-allows-dragging={!!dragState || undefined}\n      data-selected={states.isSelected || undefined}\n      data-disabled={states.isDisabled || undefined}\n      data-hovered={isHovered || undefined}\n      data-focused={states.isFocused || undefined}\n      data-focus-visible={states.isFocusVisible || undefined}\n      data-pressed={states.isPressed || undefined}\n      data-dragging={isDragging || undefined}\n      data-drop-target={droppableItem?.isDropTarget || undefined}\n      data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n      <Provider\n        values={[\n          [TextContext, {\n            slots: {\n              [DEFAULT_SLOT]: labelProps,\n              label: labelProps,\n              description: descriptionProps\n            }\n          }],\n          [SelectionIndicatorContext, {isSelected: states.isSelected}]\n        ]}>\n        {renderProps.children}\n      </Provider>\n    </ElementType>\n  );\n});\n\nfunction ListBoxDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n  ref = useObjectRef(ref);\n  let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;\n  let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n    props,\n    dropState!,\n    ref\n  );\n\n  if (isHidden) {\n    return null;\n  }\n\n  return (\n    <ListBoxDropIndicatorForwardRef {...props} dropIndicatorProps={dropIndicatorProps} isDropTarget={isDropTarget} ref={ref} />\n  );\n}\n\ninterface ListBoxDropIndicatorProps extends DropIndicatorProps {\n  dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n  isDropTarget: boolean\n}\n\nfunction ListBoxDropIndicator(props: ListBoxDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n  let {\n    dropIndicatorProps,\n    isDropTarget,\n    ...otherProps\n  } = props;\n\n  let renderProps = useRenderProps({\n    ...otherProps,\n    defaultClassName: 'react-aria-DropIndicator',\n    values: {\n      isDropTarget\n    }\n  });\n\n  return (\n    <dom.div\n      {...dropIndicatorProps}\n      {...renderProps}\n      role=\"option\"\n      ref={ref as RefObject<HTMLDivElement | null>}\n      data-drop-target={isDropTarget || undefined} />\n  );\n}\n\nconst ListBoxDropIndicatorForwardRef = forwardRef(ListBoxDropIndicator);\n\nexport interface ListBoxLoadMoreItemProps extends Omit<LoadMoreSentinelProps, 'collection'>, StyleProps, DOMRenderProps<'div', undefined>, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element.\n   * @default 'react-aria-ListBoxLoadMoreItem'\n   */\n  className?: string,\n  /**\n   * The load more spinner to render when loading additional items.\n   */\n  children?: ReactNode,\n  /**\n   * Whether or not the loading spinner should be rendered or not.\n   */\n  isLoading?: boolean\n}\n\nexport const ListBoxLoadMoreItem = createLeafComponent(LoaderNode, function ListBoxLoadingIndicator(props: ListBoxLoadMoreItemProps, ref: ForwardedRef<HTMLDivElement>, item: Node<object>) {\n  let state = useContext(ListStateContext)!;\n  let {isLoading, onLoadMore, scrollOffset, ...otherProps} = props;\n\n  let sentinelRef = useRef<HTMLDivElement>(null);\n  let memoedLoadMoreProps = useMemo(() => ({\n    onLoadMore,\n    collection: state?.collection,\n    sentinelRef,\n    scrollOffset\n  }), [onLoadMore, scrollOffset, state?.collection]);\n  useLoadMoreSentinel(memoedLoadMoreProps, sentinelRef);\n  let renderProps = useRenderProps({\n    ...otherProps,\n    id: undefined,\n    children: item.rendered,\n    defaultClassName: 'react-aria-ListBoxLoadingIndicator',\n    values: undefined\n  });\n\n  let optionProps = {\n    // For Android talkback\n    tabIndex: -1\n    // For now don't include aria-posinset and aria-setsize on loader since they aren't keyboard focusable\n    // Arguably shouldn't include them ever since it might be confusing to the user to include the loaders as part of the\n    // item count\n  };\n\n  return (\n    <>\n      {/* Alway render the sentinel. For now onus is on the user for styling when using flex + gap (this would introduce a gap even though it doesn't take room) */}\n      {/* @ts-ignore - compatibility with React < 19 */}\n      <div style={{position: 'relative', width: 0, height: 0}} inert={inertValue(true)} >\n        <div data-testid=\"loadMoreSentinel\" ref={sentinelRef} style={{position: 'absolute', height: 1, width: 1}} />\n      </div>\n      {isLoading && renderProps.children && (\n        <dom.div\n          {...mergeProps(filterDOMProps(props, {global: true}), optionProps)}\n          {...renderProps}\n          // aria-selected isn't needed here since this option is not selectable.\n          role=\"option\"\n          ref={ref as ForwardedRef<HTMLDivElement>}>\n          {renderProps.children}\n        </dom.div>\n      )}\n    </>\n  );\n});\n"],"names":[],"version":3,"file":"ListBox.mjs.map"}