import {ButtonContext as $7705c033048f6da7$export$24d547caef80ccd1} from "./Button.mjs";
import {CheckboxContext as $ed8ccb2e23e76301$export$b085522c77523c51} from "./Checkbox.mjs";
import {DEFAULT_SLOT as $7230ffa83bc0c2cf$export$c62b8e45d58ddad9, dom as $7230ffa83bc0c2cf$export$df3a06d6289f983e, Provider as $7230ffa83bc0c2cf$export$2881499e37b75b9a, useContextProps as $7230ffa83bc0c2cf$export$29f1550f4b0d4415, useRenderProps as $7230ffa83bc0c2cf$export$4d86445c2cf5e3} from "./utils.mjs";
import {CollectionRendererContext as $263ab7fc0f95ccdb$export$4feb769f8ddf26c5, DefaultCollectionRenderer as $263ab7fc0f95ccdb$export$a164736487e3f0ae} from "./Collection.mjs";
import {DragAndDropContext as $f9554a667e4f0374$export$d188a835a7bc5783, DropIndicatorContext as $f9554a667e4f0374$export$f55761759794cf55, useDndPersistedKeys as $f9554a667e4f0374$export$d1e8e3fbb7461f6, useRenderDropIndicator as $f9554a667e4f0374$export$971707d8a129a1f7} from "./DragAndDrop.mjs";
import {FieldInputContext as $4b38b5b75ecc6208$export$698f465ec27e93df, SelectableCollectionContext as $4b38b5b75ecc6208$export$b0d3ecf7112093a7} from "./Autocomplete.mjs";
import $8WNJc$intlStringsmjs from "./intlStrings.mjs";
import {SelectionIndicatorContext as $91fe5e721c7f36c1$export$c9549807523555e0} from "./SelectionIndicator.mjs";
import {SharedElementTransition as $792f28e438b9ad5f$export$758399f318e6385a} from "./SharedElementTransition.mjs";
import {TreeDropTargetDelegate as $808d92ba0ee34db1$export$82c13862611c034e} from "./TreeDropTargetDelegate.mjs";
import {TableLayout as $117bf84ed4596724$export$62444c3c724b1b20} from "./TableLayout.mjs";
import {BaseCollection as $8WNJc$BaseCollection, CollectionNode as $8WNJc$CollectionNode, FilterableNode as $8WNJc$FilterableNode, LoaderNode as $8WNJc$LoaderNode} from "react-aria/private/collections/BaseCollection";
import {buildHeaderRows as $8WNJc$buildHeaderRows} from "react-stately/private/table/TableCollection";
import {Collection as $8WNJc$Collection} from "react-aria/Collection";
import {CollectionBuilder as $8WNJc$CollectionBuilder, createBranchComponent as $8WNJc$createBranchComponent, createLeafComponent as $8WNJc$createLeafComponent} from "react-aria/CollectionBuilder";
import {filterDOMProps as $8WNJc$filterDOMProps} from "react-aria/filterDOMProps";
import {FocusScope as $8WNJc$FocusScope} from "react-aria/FocusScope";
import {inertValue as $8WNJc$inertValue} from "react-aria/private/utils/inertValue";
import {isScrollable as $8WNJc$isScrollable} from "react-aria/private/utils/isScrollable";
import {ListKeyboardDelegate as $8WNJc$ListKeyboardDelegate} from "react-aria/ListKeyboardDelegate";
import {useLoadMoreSentinel as $8WNJc$useLoadMoreSentinel} from "react-aria/private/utils/useLoadMoreSentinel";
import {mergeProps as $8WNJc$mergeProps} from "react-aria/mergeProps";
import {mergeRefs as $8WNJc$mergeRefs} from "react-aria/mergeRefs";
import $8WNJc$react, {createContext as $8WNJc$createContext, forwardRef as $8WNJc$forwardRef, useRef as $8WNJc$useRef, useState as $8WNJc$useState, useMemo as $8WNJc$useMemo, useContext as $8WNJc$useContext, useEffect as $8WNJc$useEffect, useCallback as $8WNJc$useCallback} from "react";
import $8WNJc$reactdom from "react-dom";
import {useTableColumnResizeState as $8WNJc$useTableColumnResizeState, useTableState as $8WNJc$useTableState, UNSTABLE_useFilteredTableState as $8WNJc$UNSTABLE_useFilteredTableState} from "react-stately/useTableState";
import {useCachedChildren as $8WNJc$useCachedChildren} from "react-aria/private/collections/useCachedChildren";
import {useControlledState as $8WNJc$useControlledState} from "react-stately/useControlledState";
import {useFocusRing as $8WNJc$useFocusRing} from "react-aria/useFocusRing";
import {useHover as $8WNJc$useHover} from "react-aria/useHover";
import {useLayoutEffect as $8WNJc$useLayoutEffect} from "react-aria/private/utils/useLayoutEffect";
import {useLocale as $8WNJc$useLocale} from "react-aria/I18nProvider";
import {useLocalizedStringFormatter as $8WNJc$useLocalizedStringFormatter} from "react-aria/useLocalizedStringFormatter";
import {useMultipleSelectionState as $8WNJc$useMultipleSelectionState} from "react-stately/useMultipleSelectionState";
import {useObjectRef as $8WNJc$useObjectRef} from "react-aria/useObjectRef";
import {useResizeObserver as $8WNJc$useResizeObserver} from "react-aria/private/utils/useResizeObserver";
import {useTable as $8WNJc$useTable, useTableRowGroup as $8WNJc$useTableRowGroup, useTableHeaderRow as $8WNJc$useTableHeaderRow, useTableSelectAllCheckbox as $8WNJc$useTableSelectAllCheckbox, useTableColumnHeader as $8WNJc$useTableColumnHeader, useTableColumnResize as $8WNJc$useTableColumnResize, useTableRow as $8WNJc$useTableRow, useTableSelectionCheckbox as $8WNJc$useTableSelectionCheckbox, useTableCell as $8WNJc$useTableCell} from "react-aria/useTable";
import {useVisuallyHidden as $8WNJc$useVisuallyHidden} from "react-aria/VisuallyHidden";


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}






































class $76d00c5a4edb230a$var$TableCollection extends (0, $8WNJc$BaseCollection) {
    withExpandedKeys(expandedKeys) {
        let collection = this.clone();
        collection.expandedKeys = expandedKeys;
        collection.frozen = this.frozen;
        collection.rows = Array.from(collection.getChildren(collection.body.key));
        return collection;
    }
    addNode(node) {
        super.addNode(node);
        this.columnsDirty ||= node.type === 'column';
        if (node.type === 'tableheader') this.head = node;
        if (node.type === 'tablebody') this.body = node;
    }
    commit(firstKey, lastKey, isSSR = false) {
        this.updateColumns(isSSR);
        this.rows = [];
        for (let row of this.getChildren(this.body.key)){
            let lastChildKey = row.lastChildKey;
            if (lastChildKey != null) {
                let lastCell = this.getItem(lastChildKey);
                while(lastCell && lastCell.type !== 'cell')lastCell = lastCell.prevKey ? this.getItem(lastCell.prevKey) : null;
                if (lastCell) {
                    let numberOfCellsInRow = (lastCell.colIndex ?? lastCell.index) + (lastCell.colSpan ?? 1);
                    if (numberOfCellsInRow !== this.columns.length && !isSSR) throw new Error(`Cell count must match column count. Found ${numberOfCellsInRow} cells and ${this.columns.length} columns.`);
                }
            }
            this.rows.push(row);
        }
        super.commit(firstKey, lastKey, isSSR);
    }
    updateColumns(isSSR) {
        if (!this.columnsDirty) return;
        this.rowHeaderColumnKeys = new Set();
        this.columns = [];
        let columnKeyMap = new Map();
        let visit = (node)=>{
            switch(node.type){
                case 'column':
                    columnKeyMap.set(node.key, node);
                    if (!node.hasChildNodes) {
                        node.index = this.columns.length;
                        this.columns.push(node);
                        if (node.props.isRowHeader) this.rowHeaderColumnKeys.add(node.key);
                    }
                    break;
            }
            for (let child of this.getChildren(node.key))visit(child);
        };
        for (let node of this.getChildren(this.head.key))visit(node);
        this.headerRows = (0, $8WNJc$buildHeaderRows)(columnKeyMap, this.columns);
        this.columnsDirty = false;
        if (this.rowHeaderColumnKeys.size === 0 && this.columns.length > 0 && !isSSR) throw new Error('A table must have at least one Column with the isRowHeader prop set to true');
    }
    get columnCount() {
        return this.columns.length;
    }
    *[Symbol.iterator]() {
        // Wait until the collection is initialized.
        if (this.head.key === -1) return;
        yield this.head;
        yield this.body;
    }
    getFirstKey() {
        return this.body.firstChildKey;
    }
    getLastKey() {
        let key = this.body.lastChildKey;
        if (key == null) return null;
        let node = this.getItem(key);
        while(node?.lastChildKey != null && (node.type !== 'item' || this.expandedKeys.has(node.key)))node = this.getItem(node.lastChildKey);
        return node?.key;
    }
    getKeyAfter(key) {
        let node = this.getItem(key);
        if (node?.type === 'column') return node.nextKey ?? null;
        if (!node) return null;
        // If this is an expanded item, return the first child item if any.
        if (node.type === 'item' && node.firstChildKey != null && this.expandedKeys.has(node.key)) {
            let child = this.getItem(node.firstChildKey);
            while(child){
                if (child.type === 'item') return child.key;
                child = child.nextKey != null ? this.getItem(child.nextKey) : null;
            }
        }
        return super.getKeyAfter(key);
    }
    getKeyBefore(key) {
        let node = this.getItem(key);
        if (node?.type === 'column') return node.prevKey ?? null;
        if (!node) return null;
        let k = null;
        if (node.prevKey != null) {
            node = this.getItem(node.prevKey);
            // Traverse to the deepest expanded child.
            while(node && (node.type !== 'item' || this.expandedKeys.has(node.key)) && node.lastChildKey != null)node = this.getItem(node.lastChildKey);
            k = node?.key ?? null;
        }
        if (k == null) k = node.parentKey;
        if (k != null && this.getItem(k)?.type === 'tablebody') return null;
        return k;
    }
    getChildren(key) {
        if (!this.getItem(key)) for (let row of this.headerRows){
            if (row.key === key) return row.childNodes;
        }
        // Flatten all rows into the body.
        let self = this;
        if (key === this.body.key) return {
            *[Symbol.iterator] () {
                let firstKey = self.getFirstKey();
                let node = firstKey != null ? self.getItem(firstKey) : null;
                while(node){
                    yield node;
                    let key = self.getKeyAfter(node.key);
                    node = key ? self.getItem(key) : null;
                }
            }
        };
        return {
            *[Symbol.iterator] () {
                let parent = self.getItem(key);
                let node = parent?.firstChildKey != null ? self.getItem(parent.firstChildKey) : null;
                while(node){
                    yield node;
                    node = node.nextKey != null ? self.getItem(node.nextKey) : null;
                    // Return only cells as children of rows (nested rows are flattened into the body).
                    if (parent?.type === 'item' && node?.type !== 'cell') break;
                }
            }
        };
    }
    clone() {
        let collection = super.clone();
        collection.headerRows = this.headerRows;
        collection.columns = this.columns;
        collection.rows = this.rows;
        collection.rowHeaderColumnKeys = this.rowHeaderColumnKeys;
        collection.head = this.head;
        collection.body = this.body;
        return collection;
    }
    getTextValue(key) {
        let row = this.getItem(key);
        if (!row) return '';
        // If the row has a textValue, use that.
        if (row.textValue) return row.textValue;
        // Otherwise combine the text of each of the row header columns.
        let rowHeaderColumnKeys = this.rowHeaderColumnKeys;
        let text = [];
        for (let cell of this.getChildren(key)){
            let column = this.columns[cell.index];
            if (rowHeaderColumnKeys.has(column.key) && cell.textValue) text.push(cell.textValue);
            if (text.length === rowHeaderColumnKeys.size) break;
        }
        return text.join(' ');
    }
    constructor(...args){
        super(...args), this.headerRows = [], this.columns = [], this.rows = [], this.rowHeaderColumnKeys = new Set(), this.head = new $76d00c5a4edb230a$var$TableHeaderNode(-1), this.body = new $76d00c5a4edb230a$var$TableBodyNode(-2), this.columnsDirty = true, this.expandedKeys = new Set();
    }
}
const $76d00c5a4edb230a$var$ResizableTableContainerContext = /*#__PURE__*/ (0, $8WNJc$createContext)(null);
const $76d00c5a4edb230a$export$7063e69b8a954175 = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function ResizableTableContainer(props, ref) {
    let containerRef = (0, $8WNJc$useObjectRef)(ref);
    let tableRef = (0, $8WNJc$useRef)(null);
    let scrollRef = (0, $8WNJc$useRef)(null);
    let [width, setWidth] = (0, $8WNJc$useState)(0);
    (0, $8WNJc$useLayoutEffect)(()=>{
        // Walk up the DOM from the Table to the ResizableTableContainer and stop
        // when we reach the first scrollable element. This is what we'll measure
        // to determine column widths (important due to width of scrollbars).
        // This will usually be the ResizableTableContainer for native tables, and
        // the Table itself for virtualized tables.
        let table = tableRef.current;
        while(table && table !== containerRef.current && !(0, $8WNJc$isScrollable)(table))table = table.parentElement;
        scrollRef.current = table;
    }, [
        containerRef
    ]);
    (0, $8WNJc$useResizeObserver)({
        ref: scrollRef,
        box: 'border-box',
        onResize () {
            setWidth(scrollRef.current?.clientWidth ?? 0);
        }
    });
    (0, $8WNJc$useLayoutEffect)(()=>{
        setWidth(scrollRef.current?.clientWidth ?? 0);
    }, []);
    let ctx = (0, $8WNJc$useMemo)(()=>({
            tableRef: tableRef,
            scrollRef: scrollRef,
            tableWidth: width,
            useTableColumnResizeState: $8WNJc$useTableColumnResizeState,
            onResizeStart: props.onResizeStart,
            onResize: props.onResize,
            onResizeEnd: props.onResizeEnd
        }), [
        tableRef,
        width,
        props.onResizeStart,
        props.onResize,
        props.onResizeEnd
    ]);
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        render: props.render,
        ...(0, $8WNJc$filterDOMProps)(props, {
            global: true
        }),
        ref: containerRef,
        className: props.className || 'react-aria-ResizableTableContainer',
        style: props.style,
        onScroll: props.onScroll
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$ResizableTableContainerContext.Provider, {
        value: ctx
    }, props.children));
});
const $76d00c5a4edb230a$export$93e4b0b2cc49b648 = /*#__PURE__*/ (0, $8WNJc$createContext)(null);
const $76d00c5a4edb230a$export$38de1cb0526c21fb = /*#__PURE__*/ (0, $8WNJc$createContext)(null);
const $76d00c5a4edb230a$export$a2680a798823803c = /*#__PURE__*/ (0, $8WNJc$createContext)(null);
const $76d00c5a4edb230a$export$54ec01a60f47d33d = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function Table(props, ref) {
    [props, ref] = (0, $7230ffa83bc0c2cf$export$29f1550f4b0d4415)(props, ref, $76d00c5a4edb230a$export$93e4b0b2cc49b648);
    // Separate selection state so we have access to it from collection components via useTableOptions.
    let selectionState = (0, $8WNJc$useMultipleSelectionState)(props);
    let { selectionBehavior: selectionBehavior, selectionMode: selectionMode, disallowEmptySelection: disallowEmptySelection } = selectionState;
    let hasDragHooks = !!props.dragAndDropHooks?.useDraggableCollectionState;
    let ctx = (0, $8WNJc$useMemo)(()=>({
            selectionBehavior: selectionMode === 'none' ? null : selectionBehavior,
            selectionMode: selectionMode,
            disallowEmptySelection: disallowEmptySelection,
            allowsDragging: hasDragHooks
        }), [
        selectionBehavior,
        selectionMode,
        disallowEmptySelection,
        hasDragHooks
    ]);
    let content = /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableOptionsContext.Provider, {
        value: ctx
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $8WNJc$Collection), props));
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $8WNJc$CollectionBuilder), {
        content: content,
        createCollection: ()=>new $76d00c5a4edb230a$var$TableCollection()
    }, (collection)=>/*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableInner, {
            props: props,
            forwardedRef: ref,
            selectionState: selectionState,
            collection: collection
        }));
});
let $76d00c5a4edb230a$var$TableElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function TableElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).table, {
        ...props,
        ref: ref
    });
});
const $76d00c5a4edb230a$var$EXPANSION_KEYS = {
    'expand': {
        ltr: 'ArrowRight',
        rtl: 'ArrowLeft'
    },
    'collapse': {
        ltr: 'ArrowLeft',
        rtl: 'ArrowRight'
    }
};
function $76d00c5a4edb230a$var$TableInner({ props: props, forwardedRef: ref, selectionState: selectionState, collection: collection }) {
    [props, ref] = (0, $7230ffa83bc0c2cf$export$29f1550f4b0d4415)(props, ref, (0, $4b38b5b75ecc6208$export$b0d3ecf7112093a7));
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    let { shouldUseVirtualFocus: shouldUseVirtualFocus, disallowTypeAhead: disallowTypeAhead, filter: filter, ...DOMCollectionProps } = props;
    let tableContainerContext = (0, $8WNJc$useContext)($76d00c5a4edb230a$var$ResizableTableContainerContext);
    ref = (0, $8WNJc$useObjectRef)((0, $8WNJc$useMemo)(()=>(0, $8WNJc$mergeRefs)(ref, tableContainerContext?.tableRef), [
        ref,
        tableContainerContext?.tableRef
    ]));
    let [expandedKeys, setExpandedKeys] = (0, $8WNJc$useControlledState)(props.expandedKeys ? new Set(props.expandedKeys) : undefined, props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : new Set(), props.onExpandedChange);
    collection = (0, $8WNJc$useMemo)(()=>collection.withExpandedKeys(expandedKeys), [
        collection,
        expandedKeys
    ]);
    let tableState = (0, $8WNJc$useTableState)({
        ...DOMCollectionProps,
        collection: collection,
        children: undefined,
        UNSAFE_selectionState: selectionState,
        expandedKeys: expandedKeys,
        onExpandedChange: setExpandedKeys
    });
    let filteredState = (0, $8WNJc$UNSTABLE_useFilteredTableState)(tableState, filter);
    let { isVirtualized: isVirtualized, layoutDelegate: layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate, CollectionRoot: CollectionRoot } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    let { dragAndDropHooks: dragAndDropHooks } = props;
    let { gridProps: gridProps } = (0, $8WNJc$useTable)({
        ...DOMCollectionProps,
        layoutDelegate: layoutDelegate,
        isVirtualized: isVirtualized
    }, filteredState, ref);
    let selectionManager = filteredState.selectionManager;
    let hasDragHooks = !!dragAndDropHooks?.useDraggableCollectionState;
    let hasDropHooks = !!dragAndDropHooks?.useDroppableCollectionState;
    let dragHooksProvided = (0, $8WNJc$useRef)(hasDragHooks);
    let dropHooksProvided = (0, $8WNJc$useRef)(hasDropHooks);
    (0, $8WNJc$useEffect)(()=>{
        if (process.env.NODE_ENV === 'production') return;
        if (dragHooksProvided.current !== hasDragHooks) console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');
        if (dropHooksProvided.current !== hasDropHooks) console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');
    }, [
        hasDragHooks,
        hasDropHooks
    ]);
    let dragState = undefined;
    let dropState = undefined;
    let droppableCollection = undefined;
    let isRootDropTarget = false;
    let dragPreview = null;
    let preview = (0, $8WNJc$useRef)(null);
    let { direction: direction } = (0, $8WNJc$useLocale)();
    let [treeDropTargetDelegate] = (0, $8WNJc$useState)(()=>new (0, $808d92ba0ee34db1$export$82c13862611c034e)());
    if (hasDragHooks && dragAndDropHooks) {
        dragState = dragAndDropHooks.useDraggableCollectionState({
            collection: filteredState.collection,
            selectionManager: selectionManager,
            preview: dragAndDropHooks.renderDragPreview ? preview : undefined
        });
        dragAndDropHooks.useDraggableCollection({}, dragState, ref);
        let DragPreview = dragAndDropHooks.DragPreview;
        dragPreview = dragAndDropHooks.renderDragPreview ? /*#__PURE__*/ (0, $8WNJc$react).createElement(DragPreview, {
            ref: preview
        }, dragAndDropHooks.renderDragPreview) : null;
    }
    if (hasDropHooks && dragAndDropHooks) {
        dropState = dragAndDropHooks.useDroppableCollectionState({
            collection: filteredState.collection,
            selectionManager: selectionManager
        });
        let keyboardDelegate = new (0, $8WNJc$ListKeyboardDelegate)({
            collection: filteredState.collection,
            disabledKeys: selectionManager.disabledKeys,
            disabledBehavior: selectionManager.disabledBehavior,
            ref: ref,
            layoutDelegate: layoutDelegate
        });
        let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(collection.rows, ref);
        treeDropTargetDelegate.setup(dropTargetDelegate, tableState, direction);
        droppableCollection = dragAndDropHooks.useDroppableCollection({
            keyboardDelegate: keyboardDelegate,
            dropTargetDelegate: treeDropTargetDelegate,
            onDropActivate: (e)=>{
                // Expand collapsed item when dragging over. For keyboard, allow collapsing.
                if (e.target.type === 'item') {
                    let key = e.target.key;
                    let item = tableState.collection.getItem(key);
                    let isExpanded = expandedKeys.has(key);
                    if (item && item.hasChildNodes && (!isExpanded || dragAndDropHooks?.isVirtualDragging?.())) tableState.toggleKey(key);
                }
            },
            onKeyDown: (e)=>{
                let target = dropState?.target;
                if (target && target.type === 'item' && target.dropPosition === 'on') {
                    let item = tableState.collection.getItem(target.key);
                    if (e.key === $76d00c5a4edb230a$var$EXPANSION_KEYS['expand'][direction] && item?.hasChildNodes && !tableState.expandedKeys.has(target.key)) tableState.toggleKey(target.key);
                    else if (e.key === $76d00c5a4edb230a$var$EXPANSION_KEYS['collapse'][direction] && item?.hasChildNodes && tableState.expandedKeys.has(target.key)) tableState.toggleKey(target.key);
                }
            }
        }, dropState, ref);
        isRootDropTarget = dropState.isDropTarget({
            type: 'root'
        });
    }
    let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $8WNJc$useFocusRing)();
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...props,
        children: undefined,
        defaultClassName: 'react-aria-Table',
        values: {
            isDropTarget: isRootDropTarget,
            isFocused: isFocused,
            isFocusVisible: isFocusVisible,
            state: filteredState
        }
    });
    let isListDraggable = !!(hasDragHooks && !dragState?.isDisabled);
    let style = renderProps.style;
    let layoutState = null;
    if (tableContainerContext) {
        layoutState = tableContainerContext.useTableColumnResizeState({
            tableWidth: tableContainerContext.tableWidth
        }, filteredState);
        if (!isVirtualized) style = {
            ...style,
            tableLayout: 'fixed',
            width: 'fit-content'
        };
    }
    let DOMProps = (0, $8WNJc$filterDOMProps)(props, {
        global: true
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
        values: [
            [
                $76d00c5a4edb230a$export$38de1cb0526c21fb,
                filteredState
            ],
            [
                $76d00c5a4edb230a$export$a2680a798823803c,
                layoutState
            ],
            [
                (0, $f9554a667e4f0374$export$d188a835a7bc5783),
                {
                    dragAndDropHooks: dragAndDropHooks,
                    dragState: dragState,
                    dropState: dropState
                }
            ],
            [
                (0, $f9554a667e4f0374$export$f55761759794cf55),
                {
                    render: $76d00c5a4edb230a$var$TableDropIndicatorWrapper
                }
            ],
            [
                (0, $4b38b5b75ecc6208$export$b0d3ecf7112093a7),
                null
            ],
            [
                (0, $4b38b5b75ecc6208$export$698f465ec27e93df),
                null
            ]
        ]
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $8WNJc$FocusScope), null, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableElementType, {
        ...(0, $8WNJc$mergeProps)(DOMProps, renderProps, gridProps, focusProps, droppableCollection?.collectionProps),
        style: style,
        ref: ref,
        slot: props.slot || undefined,
        onScroll: props.onScroll,
        "data-allows-dragging": isListDraggable || undefined,
        "data-drop-target": isRootDropTarget || undefined,
        "data-focused": isFocused || undefined,
        "data-focus-visible": isFocusVisible || undefined
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $792f28e438b9ad5f$export$758399f318e6385a), null, /*#__PURE__*/ (0, $8WNJc$react).createElement(CollectionRoot, {
        collection: filteredState.collection,
        scrollRef: tableContainerContext?.scrollRef ?? ref,
        persistedKeys: (0, $f9554a667e4f0374$export$d1e8e3fbb7461f6)(selectionManager, dragAndDropHooks, dropState)
    })))), dragPreview);
}
const $76d00c5a4edb230a$var$TableOptionsContext = /*#__PURE__*/ (0, $8WNJc$createContext)(null);
function $76d00c5a4edb230a$export$fddc468cd8cb4db9() {
    return (0, $8WNJc$useContext)($76d00c5a4edb230a$var$TableOptionsContext);
}
class $76d00c5a4edb230a$var$TableHeaderNode extends (0, $8WNJc$CollectionNode) {
    static{
        this.type = 'tableheader';
    }
}
let $76d00c5a4edb230a$var$THeadElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function THeadElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).thead, {
        ...props,
        ref: ref
    });
});
const $76d00c5a4edb230a$export$f850895b287ef28e = /*#__PURE__*/ (0, $8WNJc$createBranchComponent)($76d00c5a4edb230a$var$TableHeaderNode, (props, ref)=>{
    let collection = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb).collection;
    let headerRows = (0, $8WNJc$useCachedChildren)({
        items: collection.headerRows,
        children: (0, $8WNJc$useCallback)((item)=>{
            switch(item.type){
                case 'headerrow':
                    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableHeaderRow, {
                        item: item
                    });
                default:
                    throw new Error('Unsupported node type in TableHeader: ' + item.type);
            }
        }, [])
    });
    let { rowGroupProps: rowGroupProps } = (0, $8WNJc$useTableRowGroup)();
    let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8WNJc$useHover)({
        onHoverStart: props.onHoverStart,
        onHoverChange: props.onHoverChange,
        onHoverEnd: props.onHoverEnd
    });
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...props,
        children: undefined,
        defaultClassName: 'react-aria-TableHeader',
        values: {
            isHovered: isHovered
        }
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$THeadElementType, {
        ...(0, $8WNJc$mergeProps)((0, $8WNJc$filterDOMProps)(props, {
            global: true
        }), rowGroupProps, hoverProps),
        ...renderProps,
        ref: ref,
        "data-hovered": isHovered || undefined
    }, headerRows);
}, (props)=>/*#__PURE__*/ (0, $8WNJc$react).createElement((0, $8WNJc$Collection), {
        dependencies: props.dependencies,
        items: props.columns
    }, props.children));
let $76d00c5a4edb230a$var$TableHeaderRowElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function TableHeaderRowElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement("div", {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement("tr", {
        ...props,
        ref: ref
    });
});
function $76d00c5a4edb230a$var$TableHeaderRow({ item: item }) {
    let ref = (0, $8WNJc$useRef)(null);
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { isVirtualized: isVirtualized, CollectionBranch: CollectionBranch } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    let { rowProps: rowProps } = (0, $8WNJc$useTableHeaderRow)({
        node: item,
        isVirtualized: isVirtualized
    }, state, ref);
    let { checkboxProps: checkboxProps } = (0, $8WNJc$useTableSelectAllCheckbox)(state);
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableHeaderRowElementType, {
        ...rowProps,
        ref: ref
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
        values: [
            [
                (0, $ed8ccb2e23e76301$export$b085522c77523c51),
                {
                    slots: {
                        selection: checkboxProps
                    }
                }
            ]
        ]
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement(CollectionBranch, {
        collection: state.collection,
        parent: item
    })));
}
class $76d00c5a4edb230a$var$TableColumnNode extends (0, $8WNJc$CollectionNode) {
    static{
        this.type = 'column';
    }
}
let $76d00c5a4edb230a$var$ColumnElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function ColumnElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).th, {
        ...props,
        ref: ref
    });
});
const $76d00c5a4edb230a$export$816b5d811295e6bc = /*#__PURE__*/ (0, $8WNJc$createLeafComponent)($76d00c5a4edb230a$var$TableColumnNode, (props, forwardedRef, column)=>{
    let ref = (0, $8WNJc$useObjectRef)(forwardedRef);
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    let { columnHeaderProps: columnHeaderProps, isPressed: isPressed } = (0, $8WNJc$useTableColumnHeader)({
        node: column,
        isVirtualized: isVirtualized
    }, state, ref);
    let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $8WNJc$useFocusRing)();
    let layoutState = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$a2680a798823803c);
    let isResizing = false;
    if (layoutState) isResizing = layoutState.resizingColumn === column.key;
    else if (process.env.NODE_ENV !== 'production') {
        for(let prop in [
            'width',
            'defaultWidth',
            'minWidth',
            'maxWidth'
        ])if (prop in column.props) console.warn(`The ${prop} prop on a <Column> only applies when a <Table> is wrapped in a <ResizableTableContainer>. If you aren't using column resizing, you can set the width of a column with CSS.`);
    }
    let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8WNJc$useHover)({
        isDisabled: !props.allowsSorting
    });
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...props,
        id: undefined,
        children: column.rendered,
        defaultClassName: 'react-aria-Column',
        values: {
            isHovered: isHovered,
            isPressed: isPressed,
            isFocused: isFocused,
            isFocusVisible: isFocusVisible,
            allowsSorting: column.props.allowsSorting,
            sortDirection: state.sortDescriptor?.column === column.key ? state.sortDescriptor.direction : undefined,
            isResizing: isResizing,
            startResize: ()=>{
                if (layoutState) {
                    layoutState.startResize(column.key);
                    state.setKeyboardNavigationDisabled(true);
                } else throw new Error('Wrap your <Table> in a <ResizableTableContainer> to enable column resizing');
            },
            sort: (direction)=>{
                state.sort(column.key, direction);
            }
        }
    });
    let style = renderProps.style;
    if (layoutState) style = {
        ...style,
        width: layoutState.getColumnWidth(column.key)
    };
    let DOMProps = (0, $8WNJc$filterDOMProps)(props, {
        global: true
    });
    delete DOMProps.id;
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$ColumnElementType, {
        ...(0, $8WNJc$mergeProps)(DOMProps, columnHeaderProps, focusProps, hoverProps),
        ...renderProps,
        style: style,
        ref: ref,
        "data-hovered": isHovered || undefined,
        "data-pressed": isPressed || undefined,
        "data-focused": isFocused || undefined,
        "data-focus-visible": isFocusVisible || undefined,
        "data-resizing": isResizing || undefined,
        "data-allows-sorting": column.props.allowsSorting || undefined,
        "data-sort-direction": state.sortDescriptor?.column === column.key ? state.sortDescriptor.direction : undefined
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
        values: [
            [
                $76d00c5a4edb230a$var$ColumnResizerContext,
                {
                    column: column,
                    triggerRef: ref
                }
            ],
            [
                (0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5),
                (0, $263ab7fc0f95ccdb$export$a164736487e3f0ae)
            ]
        ]
    }, renderProps.children));
});
const $76d00c5a4edb230a$var$ColumnResizerContext = /*#__PURE__*/ (0, $8WNJc$createContext)(null);
const $76d00c5a4edb230a$export$ee689e97a7664bfd = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function ColumnResizer(props, ref) {
    let layoutState = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$a2680a798823803c);
    if (!layoutState) throw new Error('Wrap your <Table> in a <ResizableTableContainer> to enable column resizing');
    let stringFormatter = (0, $8WNJc$useLocalizedStringFormatter)((0, ($parcel$interopDefault($8WNJc$intlStringsmjs))), 'react-aria-components');
    let { onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd } = (0, $8WNJc$useContext)($76d00c5a4edb230a$var$ResizableTableContainerContext);
    let { column: column, triggerRef: triggerRef } = (0, $8WNJc$useContext)($76d00c5a4edb230a$var$ColumnResizerContext);
    let inputRef = (0, $8WNJc$useRef)(null);
    let { resizerProps: resizerProps, inputProps: inputProps, isResizing: isResizing } = (0, $8WNJc$useTableColumnResize)({
        column: column,
        'aria-label': props['aria-label'] || stringFormatter.format('tableResizer'),
        onResizeStart: onResizeStart,
        onResize: onResize,
        onResizeEnd: onResizeEnd,
        triggerRef: triggerRef
    }, layoutState, inputRef);
    let { focusProps: focusProps, isFocused: isFocused, isFocusVisible: isFocusVisible } = (0, $8WNJc$useFocusRing)();
    let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8WNJc$useHover)(props);
    let isEResizable = layoutState.getColumnMinWidth(column.key) >= layoutState.getColumnWidth(column.key);
    let isWResizable = layoutState.getColumnMaxWidth(column.key) <= layoutState.getColumnWidth(column.key);
    let { direction: direction } = (0, $8WNJc$useLocale)();
    let resizableDirection = 'both';
    if (isEResizable) resizableDirection = direction === 'rtl' ? 'right' : 'left';
    else if (isWResizable) resizableDirection = direction === 'rtl' ? 'left' : 'right';
    else resizableDirection = 'both';
    let objectRef = (0, $8WNJc$useObjectRef)(ref);
    let [cursor, setCursor] = (0, $8WNJc$useState)('');
    (0, $8WNJc$useEffect)(()=>{
        if (!objectRef.current) return;
        let style = window.getComputedStyle(objectRef.current);
        setCursor(style.cursor);
    }, [
        objectRef,
        resizableDirection
    ]);
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...props,
        defaultClassName: 'react-aria-ColumnResizer',
        values: {
            isFocused: isFocused,
            isFocusVisible: isFocusVisible,
            isResizing: isResizing,
            isHovered: isHovered,
            resizableDirection: resizableDirection
        }
    });
    let [isMouseDown, setMouseDown] = (0, $8WNJc$useState)(false);
    let onPointerDown = (e)=>{
        if (e.pointerType === 'mouse') setMouseDown(true);
    };
    if (!isResizing && isMouseDown) setMouseDown(false);
    let DOMProps = (0, $8WNJc$filterDOMProps)(props, {
        global: true
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ref: objectRef,
        role: "presentation",
        ...(0, $8WNJc$mergeProps)(DOMProps, renderProps, resizerProps, {
            onPointerDown: onPointerDown
        }, hoverProps),
        "data-hovered": isHovered || undefined,
        "data-focused": isFocused || undefined,
        "data-focus-visible": isFocusVisible || undefined,
        "data-resizing": isResizing || undefined,
        "data-resizable-direction": resizableDirection
    }, renderProps.children, /*#__PURE__*/ (0, $8WNJc$react).createElement("input", {
        ref: inputRef,
        ...(0, $8WNJc$mergeProps)(inputProps, focusProps)
    }), isResizing && isMouseDown && /*#__PURE__*/ (0, $8WNJc$reactdom).createPortal(/*#__PURE__*/ (0, $8WNJc$react).createElement("div", {
        style: {
            position: 'fixed',
            top: 0,
            left: 0,
            bottom: 0,
            right: 0,
            cursor: cursor
        }
    }), document.body));
});
class $76d00c5a4edb230a$var$TableBodyNode extends (0, $8WNJc$FilterableNode) {
    static{
        this.type = 'tablebody';
    }
}
let $76d00c5a4edb230a$var$TableBodyElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function TableBodyElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).tbody, {
        ...props,
        ref: ref
    });
});
const $76d00c5a4edb230a$export$76ccd210b9029917 = /*#__PURE__*/ (0, $8WNJc$createBranchComponent)($76d00c5a4edb230a$var$TableBodyNode, (props, ref)=>{
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    let collection = state.collection;
    let { CollectionBranch: CollectionBranch } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    let { dragAndDropHooks: dragAndDropHooks, dropState: dropState } = (0, $8WNJc$useContext)((0, $f9554a667e4f0374$export$d188a835a7bc5783));
    let isDroppable = !!dragAndDropHooks?.useDroppableCollectionState && !dropState?.isDisabled;
    let isRootDropTarget = isDroppable && !!dropState && (dropState.isDropTarget({
        type: 'root'
    }) ?? false);
    let isEmpty = collection.size === 0;
    let renderValues = {
        isDropTarget: isRootDropTarget,
        isEmpty: isEmpty
    };
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...props,
        id: undefined,
        children: undefined,
        defaultClassName: 'react-aria-TableBody',
        values: renderValues
    });
    let emptyState;
    let numColumns = collection.columnCount;
    if (isEmpty && props.renderEmptyState && state) {
        let rowProps = {};
        let rowHeaderProps = {};
        let style = {};
        if (isVirtualized) {
            rowHeaderProps['aria-colspan'] = numColumns;
            style = {
                display: 'contents'
            };
        } else rowHeaderProps['colSpan'] = numColumns;
        emptyState = /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableRowElementType, {
            role: "row",
            ...rowProps,
            style: style
        }, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableCellElementType, {
            role: "rowheader",
            ...rowHeaderProps,
            style: style
        }, props.renderEmptyState(renderValues)));
    }
    let { rowGroupProps: rowGroupProps } = (0, $8WNJc$useTableRowGroup)();
    let DOMProps = (0, $8WNJc$filterDOMProps)(props, {
        global: true
    });
    // TODO: TableBody doesn't support being the scrollable body of the table yet, to revisit if needed. Would need to
    // call useLoadMore here and walk up the DOM to the nearest scrollable element to set scrollRef
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableBodyElementType, {
        ...(0, $8WNJc$mergeProps)(DOMProps, renderProps, rowGroupProps),
        ref: ref,
        "data-empty": isEmpty || undefined
    }, isDroppable && /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$RootDropIndicator, null), /*#__PURE__*/ (0, $8WNJc$react).createElement(CollectionBranch, {
        collection: collection,
        parent: collection.body,
        renderDropIndicator: (0, $f9554a667e4f0374$export$971707d8a129a1f7)(dragAndDropHooks, dropState)
    }), emptyState);
});
class $76d00c5a4edb230a$var$TableRowNode extends (0, $8WNJc$CollectionNode) {
    static{
        this.type = 'item';
    }
    filter(collection, newCollection, filterFn) {
        let cells = collection.getChildren(this.key);
        for (let cell of cells)if (filterFn(cell.textValue, cell)) {
            let clone = this.clone();
            newCollection.addDescendants(clone, collection);
            return clone;
        }
        return null;
    }
}
let $76d00c5a4edb230a$var$TableRowElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function TableRowElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).tr, {
        ...props,
        ref: ref
    });
});
const $76d00c5a4edb230a$export$b59bdbef9ce70de2 = /*#__PURE__*/ (0, $8WNJc$createBranchComponent)($76d00c5a4edb230a$var$TableRowNode, (props, forwardedRef, item)=>{
    let ref = (0, $8WNJc$useObjectRef)(forwardedRef);
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { dragAndDropHooks: dragAndDropHooks, dragState: dragState, dropState: dropState } = (0, $8WNJc$useContext)((0, $f9554a667e4f0374$export$d188a835a7bc5783));
    let { isVirtualized: isVirtualized, CollectionBranch: CollectionBranch } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    let { rowProps: rowProps, expandButtonProps: expandButtonProps, ...states } = (0, $8WNJc$useTableRow)({
        node: item,
        shouldSelectOnPressUp: !!dragState,
        isVirtualized: isVirtualized
    }, state, ref);
    let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $8WNJc$useFocusRing)();
    let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = (0, $8WNJc$useFocusRing)({
        within: true
    });
    let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8WNJc$useHover)({
        isDisabled: !states.allowsSelection && !states.hasAction,
        onHoverStart: props.onHoverStart,
        onHoverChange: props.onHoverChange,
        onHoverEnd: props.onHoverEnd
    });
    let { checkboxProps: checkboxProps } = (0, $8WNJc$useTableSelectionCheckbox)({
        key: item.key
    }, state);
    let draggableItem = undefined;
    if (dragState && dragAndDropHooks) draggableItem = dragAndDropHooks.useDraggableItem({
        key: item.key,
        hasDragButton: true
    }, dragState);
    let dropIndicator = undefined;
    let dropIndicatorRef = (0, $8WNJc$useRef)(null);
    let { visuallyHiddenProps: visuallyHiddenProps } = (0, $8WNJc$useVisuallyHidden)();
    if (dropState && dragAndDropHooks) dropIndicator = dragAndDropHooks.useDropIndicator({
        target: {
            type: 'item',
            key: item.key,
            dropPosition: 'on'
        }
    }, dropState, dropIndicatorRef);
    let dragButtonRef = (0, $8WNJc$useRef)(null);
    (0, $8WNJc$useEffect)(()=>{
        if (dragState && !dragButtonRef.current && process.env.NODE_ENV !== 'production') console.warn('Draggable items in a Table must contain a <Button slot="drag"> element so that keyboard and screen reader users can drag them.');
    // eslint-disable-next-line
    }, []);
    let isDragging = dragState && dragState.isDragging(item.key);
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    let { children: _, ...restProps } = props;
    let hasChildItems = props.hasChildItems || state.collection.getItem(item.lastChildKey)?.type !== 'cell';
    let isExpanded = hasChildItems && state.expandedKeys.has(item.key);
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...restProps,
        id: undefined,
        defaultClassName: 'react-aria-Row',
        defaultStyle: {
            // @ts-ignore
            '--table-row-level': item.level + 1
        },
        values: {
            ...states,
            isHovered: isHovered,
            isFocused: isFocused,
            isFocusVisible: isFocusVisible,
            selectionMode: state.selectionManager.selectionMode,
            selectionBehavior: state.selectionManager.selectionBehavior,
            isDragging: isDragging,
            isDropTarget: dropIndicator?.isDropTarget,
            isFocusVisibleWithin: isFocusVisibleWithin,
            id: item.key,
            hasChildItems: hasChildItems,
            isExpanded: isExpanded,
            level: item.level + 1
        }
    });
    let DOMProps = (0, $8WNJc$filterDOMProps)(props, {
        global: true
    });
    delete DOMProps.id;
    delete DOMProps.onClick;
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $8WNJc$react).Fragment, null, dropIndicator && !dropIndicator.isHidden && /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableRowElementType, {
        role: "row",
        style: {
            height: 0
        }
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableCellElementType, {
        role: "gridcell",
        colSpan: state.collection.columnCount,
        style: {
            padding: 0
        }
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement("div", {
        role: "button",
        ...visuallyHiddenProps,
        ...dropIndicator.dropIndicatorProps,
        ref: dropIndicatorRef
    }))), /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableRowElementType, {
        ...(0, $8WNJc$mergeProps)(DOMProps, renderProps, rowProps, focusProps, hoverProps, draggableItem?.dragProps, focusWithinProps),
        ref: ref,
        "data-disabled": states.isDisabled || undefined,
        "data-selected": states.isSelected || undefined,
        "data-hovered": isHovered || undefined,
        "data-focused": states.isFocused || undefined,
        "data-focus-visible": isFocusVisible || undefined,
        "data-pressed": states.isPressed || undefined,
        "data-dragging": isDragging || undefined,
        "data-drop-target": dropIndicator?.isDropTarget || undefined,
        "data-selection-mode": state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode,
        "data-focus-visible-within": isFocusVisibleWithin || undefined,
        "data-expanded": isExpanded || undefined,
        "data-has-child-items": hasChildItems || undefined,
        "data-level": item.level + 1
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
        values: [
            [
                (0, $ed8ccb2e23e76301$export$b085522c77523c51),
                {
                    slots: {
                        [(0, $7230ffa83bc0c2cf$export$c62b8e45d58ddad9)]: {},
                        selection: checkboxProps
                    }
                }
            ],
            [
                (0, $7705c033048f6da7$export$24d547caef80ccd1),
                {
                    slots: {
                        [(0, $7230ffa83bc0c2cf$export$c62b8e45d58ddad9)]: {},
                        chevron: expandButtonProps,
                        drag: {
                            ...draggableItem?.dragButtonProps,
                            ref: dragButtonRef,
                            style: {
                                pointerEvents: 'none'
                            }
                        }
                    }
                }
            ],
            [
                (0, $91fe5e721c7f36c1$export$c9549807523555e0),
                {
                    isSelected: states.isSelected
                }
            ]
        ]
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement(CollectionBranch, {
        collection: state.collection,
        parent: item
    }))));
}, (props)=>{
    if (props.id == null && typeof props.children === 'function') throw new Error('No id detected for the Row element. The Row element requires a id to be provided to it when the cells are rendered dynamically.');
    let dependencies = [
        props.value
    ].concat(props.dependencies);
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $8WNJc$Collection), {
        dependencies: dependencies,
        items: props.columns,
        idScope: props.id
    }, props.children);
});
class $76d00c5a4edb230a$var$TableCellNode extends (0, $8WNJc$CollectionNode) {
    static{
        this.type = 'cell';
    }
}
let $76d00c5a4edb230a$var$TableCellElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function TableCellElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).td, {
        ...props,
        ref: ref
    });
});
const $76d00c5a4edb230a$export$f6f0c3fe4ec306ea = /*#__PURE__*/ (0, $8WNJc$createLeafComponent)($76d00c5a4edb230a$var$TableCellNode, (props, forwardedRef, cell)=>{
    let ref = (0, $8WNJc$useObjectRef)(forwardedRef);
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { dragState: dragState } = (0, $8WNJc$useContext)((0, $f9554a667e4f0374$export$d188a835a7bc5783));
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    cell.column = state.collection.columns[cell.index];
    let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $8WNJc$useTableCell)({
        node: cell,
        shouldSelectOnPressUp: !!dragState,
        isVirtualized: isVirtualized
    }, state, ref);
    let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $8WNJc$useFocusRing)();
    let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8WNJc$useHover)({});
    let isSelected = cell.parentKey != null ? state.selectionManager.isSelected(cell.parentKey) : false;
    // colIndex is null, when there is so span, falling back to using the index
    let columnIndex = cell.colIndex || cell.index;
    let row = state.collection.getItem(cell.parentKey);
    let hasChildItems = row.props.hasChildItems || state.collection.getItem(row.lastChildKey)?.type !== 'cell';
    let isExpanded = hasChildItems && state.expandedKeys.has(cell.parentKey);
    let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...props,
        id: undefined,
        defaultClassName: 'react-aria-Cell',
        values: {
            isFocused: isFocused,
            isFocusVisible: isFocusVisible,
            isPressed: isPressed,
            isHovered: isHovered,
            isSelected: isSelected,
            id: cell.key,
            columnIndex: columnIndex,
            hasChildItems: hasChildItems,
            isExpanded: isExpanded,
            isDisabled: isDisabled,
            level: row.level + 1,
            isTreeColumn: cell.column.key === state.treeColumn
        }
    });
    let DOMProps = (0, $8WNJc$filterDOMProps)(props, {
        global: true
    });
    delete DOMProps.id;
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableCellElementType, {
        ...(0, $8WNJc$mergeProps)(DOMProps, renderProps, gridCellProps, focusProps, hoverProps),
        ref: ref,
        "data-focused": isFocused || undefined,
        "data-focus-visible": isFocusVisible || undefined,
        "data-pressed": isPressed || undefined,
        "data-selected": isSelected || undefined,
        "data-column-index": columnIndex,
        "data-expanded": isExpanded || undefined,
        "data-has-child-items": hasChildItems || undefined,
        "data-level": row.level + 1,
        "data-tree-column": cell.column.key === state.treeColumn || undefined,
        "data-disabled": isDisabled || undefined
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5).Provider, {
        value: (0, $263ab7fc0f95ccdb$export$a164736487e3f0ae)
    }, renderProps.children));
});
function $76d00c5a4edb230a$var$TableDropIndicatorWrapper(props, ref) {
    ref = (0, $8WNJc$useObjectRef)(ref);
    let { dragAndDropHooks: dragAndDropHooks, dropState: dropState } = (0, $8WNJc$useContext)((0, $f9554a667e4f0374$export$d188a835a7bc5783));
    let buttonRef = (0, $8WNJc$useRef)(null);
    let { dropIndicatorProps: dropIndicatorProps, isHidden: isHidden, isDropTarget: isDropTarget } = dragAndDropHooks.useDropIndicator(props, dropState, buttonRef);
    if (isHidden) return null;
    let level = dropState && props.target.type === 'item' ? (dropState.collection.getItem(props.target.key)?.level || 0) + 1 : 1;
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableDropIndicatorForwardRef, {
        ...props,
        dropIndicatorProps: dropIndicatorProps,
        isDropTarget: isDropTarget,
        buttonRef: buttonRef,
        level: level,
        ref: ref
    });
}
let $76d00c5a4edb230a$var$TableDropIndicatorRowElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function TableDropIndicatorRowElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).tr, {
        ...props,
        ref: ref
    });
});
let $76d00c5a4edb230a$var$TableDropIndicatorTDElementType = /*#__PURE__*/ (0, $8WNJc$forwardRef)(function TableDropIndicatorTDElementType(props, ref) {
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    if (isVirtualized) return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
        ...props,
        ref: ref
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).td, {
        ...props,
        ref: ref
    });
});
function $76d00c5a4edb230a$var$TableDropIndicator(props, ref) {
    let { dropIndicatorProps: dropIndicatorProps, isDropTarget: isDropTarget, buttonRef: buttonRef, level: level, ...otherProps } = props;
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { visuallyHiddenProps: visuallyHiddenProps } = (0, $8WNJc$useVisuallyHidden)();
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...otherProps,
        defaultClassName: 'react-aria-DropIndicator',
        defaultStyle: {
            // @ts-ignore
            '--table-row-level': level + 1
        },
        values: {
            isDropTarget: isDropTarget
        }
    });
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableDropIndicatorRowElementType, {
        ...(0, $8WNJc$filterDOMProps)(props, {
            global: true
        }),
        ...renderProps,
        role: "row",
        ref: ref,
        "data-drop-target": isDropTarget || undefined,
        "aria-level": level
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableDropIndicatorTDElementType, {
        role: "gridcell",
        colSpan: state.collection.columnCount,
        style: {
            padding: 0
        }
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement("div", {
        ...visuallyHiddenProps,
        role: "button",
        ...dropIndicatorProps,
        ref: buttonRef
    }), renderProps.children));
}
const $76d00c5a4edb230a$var$TableDropIndicatorForwardRef = /*#__PURE__*/ (0, $8WNJc$forwardRef)($76d00c5a4edb230a$var$TableDropIndicator);
function $76d00c5a4edb230a$var$RootDropIndicator() {
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { dragAndDropHooks: dragAndDropHooks, dropState: dropState } = (0, $8WNJc$useContext)((0, $f9554a667e4f0374$export$d188a835a7bc5783));
    let ref = (0, $8WNJc$useRef)(null);
    let { dropIndicatorProps: dropIndicatorProps } = dragAndDropHooks.useDropIndicator({
        target: {
            type: 'root'
        }
    }, dropState, ref);
    let isDropTarget = dropState.isDropTarget({
        type: 'root'
    });
    let { visuallyHiddenProps: visuallyHiddenProps } = (0, $8WNJc$useVisuallyHidden)();
    if (!isDropTarget && dropIndicatorProps['aria-hidden']) return null;
    return /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableRowElementType, {
        role: "row",
        "aria-hidden": dropIndicatorProps['aria-hidden'],
        style: {
            height: 0
        }
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableCellElementType, {
        role: "gridcell",
        colSpan: state.collection.columnCount,
        style: {
            padding: 0
        }
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement("div", {
        role: "button",
        ...visuallyHiddenProps,
        ...dropIndicatorProps,
        ref: ref
    })));
}
const $76d00c5a4edb230a$export$8f5bea0338ed243c = (0, $8WNJc$createLeafComponent)((0, $8WNJc$LoaderNode), function TableLoadingIndicator(props, ref, item) {
    let state = (0, $8WNJc$useContext)($76d00c5a4edb230a$export$38de1cb0526c21fb);
    let { isVirtualized: isVirtualized } = (0, $8WNJc$useContext)((0, $263ab7fc0f95ccdb$export$4feb769f8ddf26c5));
    let { isLoading: isLoading, onLoadMore: onLoadMore, scrollOffset: scrollOffset, ...otherProps } = props;
    let numColumns = state.collection.columns.length;
    let sentinelRef = (0, $8WNJc$useRef)(null);
    let memoedLoadMoreProps = (0, $8WNJc$useMemo)(()=>({
            onLoadMore: onLoadMore,
            collection: state?.collection,
            sentinelRef: sentinelRef,
            scrollOffset: scrollOffset
        }), [
        onLoadMore,
        scrollOffset,
        state?.collection
    ]);
    (0, $8WNJc$useLoadMoreSentinel)(memoedLoadMoreProps, sentinelRef);
    let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
        ...otherProps,
        id: undefined,
        children: item.rendered,
        defaultClassName: 'react-aria-TableLoadingIndicator',
        defaultStyle: {
            // @ts-ignore
            '--table-row-level': item.level + 1
        },
        values: undefined
    });
    let rowProps = {};
    let rowHeaderProps = {};
    let style = {};
    if (isVirtualized) {
        // For now don't include aria-rowindex on loader since they aren't keyboard focusable
        // Arguably shouldn't include them ever since it might be confusing to the user to include the loaders as part of the
        // row count
        rowHeaderProps['aria-colspan'] = numColumns;
        style = {
            display: 'contents'
        };
    } else rowHeaderProps['colSpan'] = numColumns;
    return /*#__PURE__*/ (0, $8WNJc$react).createElement((0, $8WNJc$react).Fragment, null, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableRowElementType, {
        style: {
            height: 0
        },
        inert: (0, $8WNJc$inertValue)(true)
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableCellElementType, {
        style: {
            padding: 0,
            border: 0
        }
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement("div", {
        "data-testid": "loadMoreSentinel",
        ref: sentinelRef,
        style: {
            position: 'relative',
            height: 1,
            width: 1
        }
    }))), isLoading && renderProps.children && /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableRowElementType, {
        ...(0, $8WNJc$mergeProps)((0, $8WNJc$filterDOMProps)(props, {
            global: true
        }), rowProps),
        ...renderProps,
        role: "row",
        ref: ref,
        "aria-level": item.level + 1,
        "data-level": item.level + 1
    }, /*#__PURE__*/ (0, $8WNJc$react).createElement($76d00c5a4edb230a$var$TableCellElementType, {
        role: "rowheader",
        ...rowHeaderProps,
        style: style
    }, renderProps.children)));
});


export {$76d00c5a4edb230a$export$7063e69b8a954175 as ResizableTableContainer, $76d00c5a4edb230a$export$93e4b0b2cc49b648 as TableContext, $76d00c5a4edb230a$export$38de1cb0526c21fb as TableStateContext, $76d00c5a4edb230a$export$a2680a798823803c as TableColumnResizeStateContext, $76d00c5a4edb230a$export$54ec01a60f47d33d as Table, $76d00c5a4edb230a$export$fddc468cd8cb4db9 as useTableOptions, $76d00c5a4edb230a$export$f850895b287ef28e as TableHeader, $76d00c5a4edb230a$export$816b5d811295e6bc as Column, $76d00c5a4edb230a$export$ee689e97a7664bfd as ColumnResizer, $76d00c5a4edb230a$export$76ccd210b9029917 as TableBody, $76d00c5a4edb230a$export$b59bdbef9ce70de2 as Row, $76d00c5a4edb230a$export$f6f0c3fe4ec306ea as Cell, $76d00c5a4edb230a$export$8f5bea0338ed243c as TableLoadMoreItem, $117bf84ed4596724$export$62444c3c724b1b20 as TableLayout};
//# sourceMappingURL=Table.mjs.map
