react-virtualized
Version:
React components for efficiently rendering large, scrollable lists and tabular data
1 lines • 396 kB
Source Map (JSON)
{"version":3,"file":"react-virtualized.cjs","sources":["../lib/utils/useIsomorphicLayoutEffect.ts","../lib/components/ArrowKeyStepper/defaultArrowKeyStepperProps.ts","../lib/components/ArrowKeyStepper/ArrowKeyStepper.tsx","../lib/components/CellMeasurer/CellMeasurer.tsx","../lib/components/CellMeasurer/CellMeasurerCache.ts","../lib/components/ColumnSizer/ColumnSizer.tsx","../lib/components/Grid/accessibilityOverscanIndicesGetter.ts","../lib/components/Grid/defaultCellRangeRenderer.ts","../lib/components/Grid/constants.ts","../lib/components/Grid/defaultOverscanIndicesGetter.ts","../lib/components/Grid/defaultGridProps.ts","../lib/utils/createCallbackMemoizer.ts","../lib/utils/getUpdatedOffsetForIndex.ts","../lib/utils/animationFrame.ts","../lib/utils/requestAnimationTimeout.ts","../lib/utils/scrollElement/useMissingHeightWarning.ts","../lib/utils/scrollElement/dimensions.ts","../lib/utils/scrollElement/scrollListeners.ts","../lib/utils/scrollElement/useScrollElementLink.ts","../lib/components/Grid/utils/CellSizeAndPositionManager.ts","../lib/components/Grid/utils/maxElementSize.ts","../lib/components/Grid/utils/ScalingCellSizeAndPositionManager.ts","../lib/components/Grid/utils/updateScrollIndexHelper.ts","../lib/components/Grid/Grid.tsx","../lib/components/InfiniteLoader/defaultInfiniteLoaderProps.ts","../lib/components/InfiniteLoader/utils.ts","../lib/components/InfiniteLoader/InfiniteLoader.tsx","../lib/components/List/defaultListProps.ts","../lib/utils/createInnerGridRef.ts","../lib/components/List/List.tsx","../lib/components/Masonry/constants.ts","../lib/components/Masonry/defaultMasonryProps.ts","../lib/components/Masonry/createCellPositioner.ts","../lib/vendor/binarySearchBounds.ts","../lib/vendor/intervalTree.ts","../lib/components/Masonry/PositionCache.ts","../lib/components/Masonry/Masonry.tsx","../lib/components/MultiGrid/defaultMultiGridProps.ts","../lib/components/MultiGrid/CellMeasurerCacheDecorator.ts","../lib/components/MultiGrid/MultiGrid.tsx","../lib/components/ScrollSync/ScrollSync.tsx","../lib/components/Table/Column.tsx","../lib/components/Table/createMultiSort.ts","../lib/components/Table/defaultCellDataGetter.ts","../lib/components/Table/defaultCellRenderer.ts","../lib/components/Table/SortDirection.ts","../lib/components/Table/SortIndicator.tsx","../lib/components/Table/defaultHeaderRenderer.tsx","../lib/components/Table/defaultColumnProps.ts","../lib/components/Table/defaultHeaderRowRenderer.tsx","../lib/components/Table/defaultRowRenderer.tsx","../lib/components/Table/defaultTableProps.ts","../lib/components/Table/Table.tsx"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * `useLayoutEffect` in the browser; `useEffect` during server rendering (where layout effects warn and never run).\n */\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","import type { ArrowKeyStepperProps } from \"./types\";\n\ntype DefaultedPropKeys =\n | \"disabled\"\n | \"isControlled\"\n | \"mode\"\n | \"scrollToColumn\"\n | \"scrollToRow\";\n\n/**\n * Default values for `ArrowKeyStepper`'s optional props.\n */\nexport const defaultArrowKeyStepperProps: Readonly<\n Required<Pick<ArrowKeyStepperProps, DefaultedPropKeys>>\n> = /* @__PURE__ */ Object.freeze({\n disabled: false,\n isControlled: false,\n mode: \"edges\",\n scrollToColumn: 0,\n scrollToRow: 0\n});\n","import {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useRef,\n useState,\n type KeyboardEvent\n} from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../../utils/useIsomorphicLayoutEffect\";\nimport { defaultArrowKeyStepperProps } from \"./defaultArrowKeyStepperProps\";\nimport type {\n ArrowKeyStepperChild,\n ArrowKeyStepperImperativeAPI,\n ArrowKeyStepperProps,\n ArrowKeyStepperRenderedSection,\n ScrollIndices\n} from \"./types\";\n\ntype ArrowKeyStepperState = ScrollIndices & {\n prevScrollToColumn: number;\n prevScrollToRow: number;\n};\n\nconst initialState: ArrowKeyStepperState = {\n scrollToColumn: 0,\n scrollToRow: 0,\n prevScrollToColumn: 0,\n prevScrollToRow: 0\n};\n\n// Equivalent of the 9.x getDerivedStateFromProps():\n// an uncontrolled stepper resets its active cell whenever the scrollToColumn/scrollToRow props change.\nfunction deriveState(\n isControlled: boolean,\n scrollToColumn: number,\n scrollToRow: number,\n prevState: ArrowKeyStepperState\n): ArrowKeyStepperState {\n if (\n !isControlled &&\n (scrollToColumn !== prevState.prevScrollToColumn ||\n scrollToRow !== prevState.prevScrollToRow)\n ) {\n return {\n scrollToColumn,\n scrollToRow,\n prevScrollToColumn: scrollToColumn,\n prevScrollToRow: scrollToRow\n };\n }\n\n return prevState;\n}\n\n/**\n * This HOC decorates a virtualized component and responds to arrow-key events by scrolling one row or column at a time.\n * This provides a snap-to behavior rather than the default browser scrolling behavior.\n *\n * Note that unlike the other HOCs in react-virtualized, `ArrowKeyStepper` adds a `<div>` element around its children in order to attach a key-down event handler.\n * The appearance of this wrapper element can be customized using the `className` property.\n */\nexport const ArrowKeyStepper = /* @__PURE__ */ memo(\n /* @__PURE__ */ forwardRef<\n ArrowKeyStepperImperativeAPI,\n ArrowKeyStepperProps\n >(function ArrowKeyStepper(\n {\n children,\n className,\n columnCount,\n disabled = defaultArrowKeyStepperProps.disabled,\n isControlled = defaultArrowKeyStepperProps.isControlled,\n mode = defaultArrowKeyStepperProps.mode,\n onScrollToChange,\n rowCount,\n scrollToColumn:\n scrollToColumnProp = defaultArrowKeyStepperProps.scrollToColumn,\n scrollToRow: scrollToRowProp = defaultArrowKeyStepperProps.scrollToRow\n },\n ref\n ) {\n const [storedState, setState] = useState<ArrowKeyStepperState>(() =>\n deriveState(\n isControlled,\n scrollToColumnProp,\n scrollToRowProp,\n initialState\n )\n );\n\n // Apply prop changes during render (the documented replacement for getDerivedStateFromProps)\n const state = deriveState(\n isControlled,\n scrollToColumnProp,\n scrollToRowProp,\n storedState\n );\n if (state !== storedState) {\n setState(state);\n }\n\n const scrollToColumn = isControlled\n ? scrollToColumnProp\n : state.scrollToColumn;\n const scrollToRow = isControlled ? scrollToRowProp : state.scrollToRow;\n\n // Range of cells most recently rendered by the child (see onSectionRendered)\n const renderedSectionRef = useRef<ArrowKeyStepperRenderedSection>({\n columnStartIndex: 0,\n columnStopIndex: 0,\n rowStartIndex: 0,\n rowStopIndex: 0\n });\n\n const childRef = useRef<ArrowKeyStepperChild | null>(null);\n\n // Active cell as of the most recent commit; initialized for the first commit\n // (child refs are attached before this component's layout effects run)\n const activeCellRef = useRef<ScrollIndices>({\n scrollToColumn,\n scrollToRow\n });\n\n // The child and cell most recently scrolled into view; avoids redundant scrollToCell() calls\n // (e.g. when the same child is re-registered in StrictMode)\n const lastScrolledRef = useRef<{\n child: ArrowKeyStepperChild;\n scrollToColumn: number;\n scrollToRow: number;\n } | null>(null);\n\n const scrollChildToActiveCell = useCallback(() => {\n const child = childRef.current;\n const { scrollToColumn, scrollToRow } = activeCellRef.current;\n const lastScrolled = lastScrolledRef.current;\n\n if (\n child === null ||\n (lastScrolled !== null &&\n lastScrolled.child === child &&\n lastScrolled.scrollToColumn === scrollToColumn &&\n lastScrolled.scrollToRow === scrollToRow)\n ) {\n return;\n }\n\n lastScrolledRef.current = { child, scrollToColumn, scrollToRow };\n\n child.scrollToCell({\n columnIndex: scrollToColumn,\n rowIndex: scrollToRow\n });\n }, []);\n\n const registerChild = useCallback(\n (child: ArrowKeyStepperChild | null) => {\n childRef.current = child;\n if (child !== null) {\n scrollChildToActiveCell();\n }\n },\n [scrollChildToActiveCell]\n );\n\n useIsomorphicLayoutEffect(() => {\n activeCellRef.current = { scrollToColumn, scrollToRow };\n scrollChildToActiveCell();\n }, [scrollChildToActiveCell, scrollToColumn, scrollToRow]);\n\n const onSectionRendered = useCallback(\n ({\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n }: ArrowKeyStepperRenderedSection) => {\n renderedSectionRef.current = {\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n };\n },\n []\n );\n\n useImperativeHandle(\n ref,\n () => ({\n setScrollIndexes({ scrollToColumn, scrollToRow }: ScrollIndices) {\n setState((prevState) => ({\n ...prevState,\n scrollToColumn,\n scrollToRow\n }));\n }\n }),\n []\n );\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (disabled) {\n return;\n }\n\n const { columnStartIndex, columnStopIndex, rowStartIndex, rowStopIndex } =\n renderedSectionRef.current;\n\n let nextScrollToColumn = scrollToColumn;\n let nextScrollToRow = scrollToRow;\n\n // The above cases all prevent default event event behavior.\n // This is to keep the grid from scrolling after the snap-to update.\n switch (event.key) {\n case \"ArrowDown\":\n nextScrollToRow =\n mode === \"cells\"\n ? Math.min(scrollToRow + 1, rowCount - 1)\n : Math.min(rowStopIndex + 1, rowCount - 1);\n break;\n case \"ArrowLeft\":\n nextScrollToColumn =\n mode === \"cells\"\n ? Math.max(scrollToColumn - 1, 0)\n : Math.max(columnStartIndex - 1, 0);\n break;\n case \"ArrowRight\":\n nextScrollToColumn =\n mode === \"cells\"\n ? Math.min(scrollToColumn + 1, columnCount - 1)\n : Math.min(columnStopIndex + 1, columnCount - 1);\n break;\n case \"ArrowUp\":\n nextScrollToRow =\n mode === \"cells\"\n ? Math.max(scrollToRow - 1, 0)\n : Math.max(rowStartIndex - 1, 0);\n break;\n }\n\n if (\n nextScrollToColumn !== scrollToColumn ||\n nextScrollToRow !== scrollToRow\n ) {\n event.preventDefault();\n\n if (typeof onScrollToChange === \"function\") {\n onScrollToChange({\n scrollToColumn: nextScrollToColumn,\n scrollToRow: nextScrollToRow\n });\n }\n\n if (!isControlled) {\n setState((prevState) => ({\n ...prevState,\n scrollToColumn: nextScrollToColumn,\n scrollToRow: nextScrollToRow\n }));\n }\n }\n };\n\n return (\n <div className={className} onKeyDown={onKeyDown}>\n {children({\n onSectionRendered,\n registerChild,\n scrollToColumn,\n scrollToRow\n })}\n </div>\n );\n })\n);\n","import {\n cloneElement,\n Fragment,\n isValidElement,\n memo,\n useCallback,\n useInsertionEffect,\n useRef,\n useState,\n version,\n type ReactElement,\n type ReactNode,\n type Ref\n} from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../../utils/useIsomorphicLayoutEffect\";\nimport type { CellMeasureCache, CellMeasurerProps } from \"./types\";\n\n/**\n * Wraps a cell and measures its rendered content.\n * Measurements are stored in a per-cell cache.\n * Cached-content is not be re-measured.\n *\n * The child must be a DOM element (e.g. `<div>`) or a component that passes its `ref` along to one;\n * otherwise use a function child and pass `registerChild` as the `ref` of the element to be measured.\n */\nexport const CellMeasurer = /* @__PURE__ */ Object.assign(\n /* @__PURE__ */ memo(function CellMeasurer(props: CellMeasurerProps) {\n const { children } = props;\n\n // Mutable values shared by the stable callbacks below\n const [internals] = useState(createInternals);\n\n // Latest props, for the stable callbacks (updated before child refs and layout effects run)\n const latestPropsRef = useRef(props);\n useInsertionEffect(() => {\n latestPropsRef.current = props;\n });\n\n const maybeMeasureCell = useCallback(() => {\n const { cache, columnIndex = 0, index, parent } = latestPropsRef.current;\n const rowIndex = latestPropsRef.current.rowIndex ?? index ?? 0;\n\n if (!cache.has(rowIndex, columnIndex)) {\n const measurements = getCellMeasurements(\n cache,\n getMeasurableNode(internals)\n );\n if (measurements === null) {\n // Leave the cache alone (the cell keeps its default size) rather than storing 0x0\n if (process.env.NODE_ENV !== \"production\") {\n warnAboutMissingNode(cache, internals);\n }\n return;\n }\n\n cache.set(\n rowIndex,\n columnIndex,\n measurements.width,\n measurements.height\n );\n\n // If size has changed, let Grid know to re-render.\n if (\n parent &&\n typeof parent.invalidateCellSizeAfterRender === \"function\"\n ) {\n parent.invalidateCellSizeAfterRender({\n columnIndex,\n rowIndex\n });\n }\n }\n }, [internals]);\n\n const measure = useCallback(() => {\n const { cache, columnIndex = 0, index, parent } = latestPropsRef.current;\n const rowIndex = latestPropsRef.current.rowIndex ?? index ?? 0;\n\n if (!internals.isMounted) {\n // E.g. called from a timeout or a load event after the cell scrolled out of view;\n // there is nothing to measure (and storing 0x0 would collapse the cell once it's rendered again)\n return;\n }\n\n const measurements = getCellMeasurements(\n cache,\n getMeasurableNode(internals)\n );\n if (measurements === null) {\n if (process.env.NODE_ENV !== \"production\") {\n warnAboutMissingNode(cache, internals);\n }\n return;\n }\n\n const { height, width } = measurements;\n if (\n height !== cache.getHeight(rowIndex, columnIndex) ||\n width !== cache.getWidth(rowIndex, columnIndex)\n ) {\n cache.set(rowIndex, columnIndex, width, height);\n\n if (parent && typeof parent.recomputeGridSize === \"function\") {\n parent.recomputeGridSize({\n columnIndex,\n rowIndex\n });\n }\n }\n }, [internals]);\n\n const registerChild = useCallback(\n (element: Element | null | undefined) => {\n if (element && !(element instanceof Element)) {\n console.warn(\n \"CellMeasurer registerChild expects to be passed Element or null\"\n );\n }\n\n internals.registeredNode = element ?? null;\n if (element) {\n maybeMeasureCell();\n }\n },\n [internals, maybeMeasureCell]\n );\n\n useIsomorphicLayoutEffect(() => {\n internals.isMounted = true;\n return () => {\n internals.isMounted = false;\n };\n }, [internals]);\n\n // Equivalent of componentDidMount() + componentDidUpdate()\n useIsomorphicLayoutEffect(() => {\n maybeMeasureCell();\n });\n\n const resolvedChildren: ReactNode =\n typeof children === \"function\"\n ? children({ measure, registerChild })\n : children;\n\n const element = getMeasurableElement(resolvedChildren);\n const hasMeasurableElement = element !== null;\n useInsertionEffect(() => {\n internals.hasMeasurableElement = hasMeasurableElement;\n });\n\n // The child's own ref (if any) is composed with the ref CellMeasurer attaches to it\n const childRef = element !== null ? getElementRef(element) : null;\n const composedRef = useCallback(\n (node: unknown) => {\n if (node === null) {\n if (typeof internals.childRefCleanup === \"function\") {\n internals.childRefCleanup();\n } else {\n assignRef(childRef, null);\n }\n internals.childRefCleanup = undefined;\n internals.clonedNode = null;\n } else {\n internals.childRefCleanup = assignRef(childRef, node);\n internals.clonedNode = node;\n }\n },\n [childRef, internals]\n );\n\n if (element === null) {\n // Strings, arrays, fragments etc. can't be given a ref; render them as-is\n return resolvedChildren === undefined ? null : resolvedChildren;\n }\n\n return cloneElement(element, { ref: composedRef } as Partial<unknown>);\n }),\n {\n // Lets Grid's DEV warning about a missing \"style\" check the CellMeasurer's child instead (see issue #611)\n __internalCellMeasurerFlag: process.env.NODE_ENV !== \"production\"\n }\n);\n\ntype Internals = {\n childRefCleanup: (() => void) | undefined | void;\n clonedNode: unknown;\n hasMeasurableElement: boolean;\n isMounted: boolean;\n registeredNode: unknown;\n};\n\nfunction createInternals(): Internals {\n return {\n childRefCleanup: undefined,\n clonedNode: null,\n hasMeasurableElement: false,\n isMounted: false,\n registeredNode: null\n };\n}\n\nfunction isHTMLElement(node: unknown): node is HTMLElement {\n if (node == null || typeof node !== \"object\") {\n return false;\n }\n\n // Supports nodes from other frames (which have their own HTMLElement class)\n const view = (node as Partial<Node>).ownerDocument?.defaultView;\n return view != null && node instanceof view.HTMLElement;\n}\n\n// An element registered with registerChild takes precedence over the element CellMeasurer attached its ref to\nfunction getMeasurableNode(internals: Internals): HTMLElement | null {\n if (isHTMLElement(internals.registeredNode)) {\n return internals.registeredNode;\n } else if (isHTMLElement(internals.clonedNode)) {\n return internals.clonedNode;\n }\n return null;\n}\n\nfunction getCellMeasurements(\n cache: CellMeasureCache,\n node: HTMLElement | null\n): { height: number; width: number } | null {\n // TODO Check for a bad combination of fixedWidth and missing numeric width or vice versa with height\n\n if (node === null) {\n return null;\n }\n\n const styleWidth = node.style.width;\n const styleHeight = node.style.height;\n\n // If we are re-measuring a cell that has already been measured,\n // It will have a hard-coded width/height from the previous measurement.\n // The fact that we are measuring indicates this measurement is probably stale,\n // So explicitly clear it out (eg set to \"auto\") so we can recalculate.\n // See issue #593 for more info.\n // Even if we are measuring initially- if we're inside of a MultiGrid component,\n // Explicitly clear width/height before measuring to avoid being tainted by another Grid.\n // eg top/left Grid renders before bottom/right Grid\n // Since the CellMeasurerCache is shared between them this taints derived cell size values.\n if (!cache.hasFixedWidth()) {\n node.style.width = \"auto\";\n }\n if (!cache.hasFixedHeight()) {\n node.style.height = \"auto\";\n }\n\n const height = Math.ceil(node.offsetHeight);\n const width = Math.ceil(node.offsetWidth);\n\n // Reset after measuring to avoid breaking styles; see #660\n if (styleWidth) {\n node.style.width = styleWidth;\n }\n if (styleHeight) {\n node.style.height = styleHeight;\n }\n\n return { height, width };\n}\n\n// Returns the child element CellMeasurer can attach a ref to (or null for strings, arrays, fragments, etc.)\nfunction getMeasurableElement(children: ReactNode): ReactElement | null {\n if (!isValidElement(children) || children.type === Fragment) {\n return null;\n }\n\n // React 18 only passes refs to class components, host components and forwardRef() components;\n // attaching one to a plain function component logs an error (and the ref is never set).\n // React 19 passes the ref as a regular prop, so a function component can pass it along to a DOM element.\n if (!isReact19OrNewer() && isPlainFunctionComponent(children.type)) {\n return null;\n }\n\n return children;\n}\n\nconst MEMO_TYPE = /* @__PURE__ */ Symbol.for(\"react.memo\");\n\nfunction isPlainFunctionComponent(type: unknown): boolean {\n if (typeof type === \"function\") {\n return !(type.prototype && type.prototype.isReactComponent);\n } else if (\n type != null &&\n typeof type === \"object\" &&\n (type as { $$typeof?: symbol }).$$typeof === MEMO_TYPE\n ) {\n return isPlainFunctionComponent((type as { type: unknown }).type);\n }\n return false;\n}\n\nfunction isReact19OrNewer(): boolean {\n return parseInt(version, 10) >= 19;\n}\n\n// React 19 stores an element's ref in props.ref (reading element.ref logs a deprecation error);\n// React 18 stores it in element.ref (and never in props).\n// React 19 elements without a ref define element.ref as null (without logging an error).\nfunction getElementRef(element: ReactElement): Ref<unknown> | null {\n const props = element.props as { ref?: Ref<unknown> } | null;\n if (props != null && \"ref\" in props) {\n return props.ref ?? null;\n }\n return (element as { ref?: Ref<unknown> | null }).ref ?? null;\n}\n\nfunction assignRef(\n ref: Ref<unknown> | null,\n value: unknown\n): (() => void) | undefined | void {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref) {\n (ref as { current: unknown }).current = value;\n }\n}\n\n// Warn at most once per cache, to avoid flooding the console (one message per rendered cell)\nconst warnedCaches = /* @__PURE__ */ new WeakSet<object>();\n\nfunction warnAboutMissingNode(cache: CellMeasureCache, internals: Internals) {\n if (warnedCaches.has(cache)) {\n return;\n }\n warnedCaches.add(cache);\n\n console.warn(\n internals.hasMeasurableElement\n ? \"CellMeasurer could not find a DOM element to measure. \" +\n \"Its child should be a DOM element (e.g. <div>) or a component that passes its ref along to one \" +\n \"(in React 18, function components must use forwardRef). \" +\n \"Otherwise, use a function child and pass registerChild as the ref of the element to be measured.\"\n : \"CellMeasurer could not find a DOM element to measure. \" +\n \"Its child should be a single DOM element (e.g. <div>), not text, an array or a fragment \" +\n \"(or, in React 18, a function component that doesn't use forwardRef). \" +\n \"Otherwise, use a function child and pass registerChild as the ref of the element to be measured.\"\n );\n}\n","import type {\n CellMeasureCache,\n CellMeasurerCacheAPI,\n CellMeasurerCacheParams\n} from \"./types\";\n\nexport const DEFAULT_HEIGHT = 30;\nexport const DEFAULT_WIDTH = 100;\n\n// Keys are produced by the (possibly user-supplied) key mapper and are coerced to strings when used as object keys.\ntype KeyMapper = (rowIndex: number, columnIndex: number) => string;\n\ntype Cache = Record<string, number>;\n\ntype IndexParam = {\n index: number;\n};\n\n/**\n * Caches measurements for a given cell.\n */\nexport class CellMeasurerCache\n implements CellMeasureCache, CellMeasurerCacheAPI\n{\n _cellHeightCache: Cache = {};\n _cellWidthCache: Cache = {};\n _columnWidthCache: Cache = {};\n _rowHeightCache: Cache = {};\n // The number of rows (or columns) that each derived column width (or row height) was computed over,\n // so that it can be updated incrementally when a cell is measured (#1747)\n _columnWidthRowCount: Cache = {};\n _rowHeightColumnCount: Cache = {};\n _defaultHeight: number;\n _defaultWidth: number;\n _minHeight: number;\n _minWidth: number;\n _keyMapper: KeyMapper;\n _hasFixedHeight: boolean;\n _hasFixedWidth: boolean;\n _columnCount = 0;\n _rowCount = 0;\n\n constructor(params: CellMeasurerCacheParams = {}) {\n const {\n defaultHeight,\n defaultWidth,\n fixedHeight,\n fixedWidth,\n keyMapper,\n minHeight,\n minWidth\n } = params;\n\n this._hasFixedHeight = fixedHeight === true;\n this._hasFixedWidth = fixedWidth === true;\n this._minHeight = minHeight || 0;\n this._minWidth = minWidth || 0;\n this._keyMapper = (keyMapper || defaultKeyMapper) as KeyMapper;\n\n this._defaultHeight = Math.max(\n this._minHeight,\n typeof defaultHeight === \"number\" ? defaultHeight : DEFAULT_HEIGHT\n );\n this._defaultWidth = Math.max(\n this._minWidth,\n typeof defaultWidth === \"number\" ? defaultWidth : DEFAULT_WIDTH\n );\n\n if (process.env.NODE_ENV !== \"production\") {\n if (this._hasFixedHeight === false && this._hasFixedWidth === false) {\n console.warn(\n \"CellMeasurerCache should only measure a cell's width or height. \" +\n \"You have configured CellMeasurerCache to measure both. \" +\n \"This will result in poor performance.\"\n );\n }\n\n if (this._hasFixedHeight === false && this._defaultHeight === 0) {\n console.warn(\n \"Fixed height CellMeasurerCache should specify a :defaultHeight greater than 0. \" +\n \"Failing to do so will lead to unnecessary layout and poor performance.\"\n );\n }\n\n if (this._hasFixedWidth === false && this._defaultWidth === 0) {\n console.warn(\n \"Fixed width CellMeasurerCache should specify a :defaultWidth greater than 0. \" +\n \"Failing to do so will lead to unnecessary layout and poor performance.\"\n );\n }\n }\n }\n\n /**\n * Reset cached measurements for a specific cell.\n *\n * This should be called when a cell needs to be re-measured to handle dynamic content\n * (eg. replacing a loading indicator with loaded content or reacting to state-changes for stateful cells).\n */\n clear(rowIndex: number, columnIndex: number = 0) {\n const key = this._keyMapper(rowIndex, columnIndex);\n\n delete this._cellHeightCache[key];\n delete this._cellWidthCache[key];\n\n this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);\n }\n\n /**\n * Reset cached measurements for all cells.\n *\n * This method should be called when a `Grid`, `List` or `Table` needs to reflow content due to a resizing event\n * for a responsive layout (eg. a window width resize may have an impact on the height of cells).\n */\n clearAll() {\n this._cellHeightCache = {};\n this._cellWidthCache = {};\n this._columnWidthCache = {};\n this._rowHeightCache = {};\n this._columnWidthRowCount = {};\n this._rowHeightColumnCount = {};\n this._rowCount = 0;\n this._columnCount = 0;\n }\n\n /**\n * Returns the derived width of a column (the widest measured cell in that column) or the default width.\n * Compatible with the `columnWidth` prop of `Grid`.\n */\n columnWidth = ({ index }: IndexParam) => {\n const key = this._keyMapper(0, index);\n\n return this._columnWidthCache[key] !== undefined\n ? this._columnWidthCache[key]\n : this._defaultWidth;\n };\n\n /** Height reported for unmeasured cells. */\n get defaultHeight(): number {\n return this._defaultHeight;\n }\n\n /** Width reported for unmeasured cells. */\n get defaultWidth(): number {\n return this._defaultWidth;\n }\n\n /** Returns true if cells have a fixed height (and a dynamic, measured width). */\n hasFixedHeight(): boolean {\n return this._hasFixedHeight;\n }\n\n /** Returns true if cells have a fixed width (and a dynamic, measured height). */\n hasFixedWidth(): boolean {\n return this._hasFixedWidth;\n }\n\n /** Returns the (measured or default) height of the specified cell. */\n getHeight(rowIndex: number, columnIndex: number = 0): number {\n if (this._hasFixedHeight) {\n return this._defaultHeight;\n } else {\n const key = this._keyMapper(rowIndex, columnIndex);\n\n return this._cellHeightCache[key] !== undefined\n ? Math.max(this._minHeight, this._cellHeightCache[key])\n : this._defaultHeight;\n }\n }\n\n /** Returns the (measured or default) width of the specified cell. */\n getWidth(rowIndex: number, columnIndex: number = 0): number {\n if (this._hasFixedWidth) {\n return this._defaultWidth;\n } else {\n const key = this._keyMapper(rowIndex, columnIndex);\n\n return this._cellWidthCache[key] !== undefined\n ? Math.max(this._minWidth, this._cellWidthCache[key])\n : this._defaultWidth;\n }\n }\n\n /** Returns true if the specified cell has already been measured. */\n has(rowIndex: number, columnIndex: number = 0): boolean {\n const key = this._keyMapper(rowIndex, columnIndex);\n\n return this._cellHeightCache[key] !== undefined;\n }\n\n /**\n * Returns the derived height of a row (the tallest measured cell in that row) or the default height.\n * Compatible with the `rowHeight` prop of `Grid`.\n */\n rowHeight = ({ index }: IndexParam) => {\n const key = this._keyMapper(index, 0);\n\n return this._rowHeightCache[key] !== undefined\n ? this._rowHeightCache[key]\n : this._defaultHeight;\n };\n\n /** Stores the measured size of the specified cell. */\n set(\n rowIndex: number,\n columnIndex: number,\n width: number,\n height: number\n ): void {\n const key = this._keyMapper(rowIndex, columnIndex);\n const previousCachedWidth = this._cellWidthCache[key];\n const previousCachedHeight = this._cellHeightCache[key];\n\n if (columnIndex >= this._columnCount) {\n this._columnCount = columnIndex + 1;\n }\n if (rowIndex >= this._rowCount) {\n this._rowCount = rowIndex + 1;\n }\n\n // Size is cached per cell so we don't have to re-measure if cells are re-ordered.\n this._cellHeightCache[key] = height;\n this._cellWidthCache[key] = width;\n\n // The derived sizes are updated incrementally when possible, rather than recomputed from every cell in the column/row (#1747).\n this._updateCachedColumnAndRowSizes(rowIndex, columnIndex, {\n height: this._canUpdateIncrementally(\n this._rowHeightCache[this._keyMapper(rowIndex, 0)],\n this._rowHeightColumnCount[this._keyMapper(rowIndex, 0)],\n columnIndex,\n this.getHeight(rowIndex, columnIndex),\n previousCachedHeight === undefined\n ? undefined\n : Math.max(this._minHeight, previousCachedHeight)\n ),\n width: this._canUpdateIncrementally(\n this._columnWidthCache[this._keyMapper(0, columnIndex)],\n this._columnWidthRowCount[this._keyMapper(0, columnIndex)],\n rowIndex,\n this.getWidth(rowIndex, columnIndex),\n previousCachedWidth === undefined\n ? undefined\n : Math.max(this._minWidth, previousCachedWidth)\n )\n });\n }\n\n /**\n * Whether a derived column width (or row height) can be updated incrementally after a cell is measured:\n * i.e. whether the previous derived size is still a lower bound of the new one.\n * The maximum can only decrease if the cell's previous size was the maximum and it got smaller.\n *\n * @param derivedSize The current derived size (the maximum of the measured cells counted so far, if any)\n * @param countedCells The number of cells (rows of a column, or columns of a row) that the derived size was computed over\n * @param cellIndex The index of the measured cell within the column (or row)\n * @param size The cell's new (effective) size\n * @param previousSize The cell's previous (effective) size, or undefined if it wasn't measured (so it wasn't part of the maximum)\n */\n _canUpdateIncrementally(\n derivedSize: number | undefined,\n countedCells: number | undefined,\n cellIndex: number,\n size: number,\n previousSize: number | undefined\n ): boolean {\n if (countedCells === undefined) {\n return false;\n }\n\n // With the default keyMapper, a cell beyond the counted range wasn't part of the maximum.\n // (Other keyMappers may map it to the key of a counted cell, so it is treated as counted.)\n if (this._keyMapper === defaultKeyMapper && cellIndex >= countedCells) {\n return true;\n }\n\n return (\n previousSize === undefined ||\n size >= previousSize ||\n (derivedSize !== undefined && previousSize < derivedSize)\n );\n }\n\n _updateCachedColumnAndRowSizes(\n rowIndex: number,\n columnIndex: number,\n incremental: { height: boolean; width: boolean } = {\n height: false,\n width: false\n }\n ) {\n // :columnWidth and :rowHeight are derived from the measured cells in a column/row (the default size is only used if none are).\n // Unmeasured cells aren't counted, so a column measured past its first rows can be narrower than the default width.\n // Pre-cache these derived values for faster lookup later.\n // Reads are expected to occur more frequently than writes in this case.\n // Only update non-fixed dimensions though to avoid doing unnecessary work.\n if (!this._hasFixedWidth) {\n const columnKey = this._keyMapper(0, columnIndex);\n const cachedWidth = this._columnWidthCache[columnKey];\n const countedRows = this._columnWidthRowCount[columnKey];\n\n // Incrementally: the previous width, the measured cell, and any rows added since it was computed\n let columnWidth: number | undefined;\n let firstRow: number;\n if (incremental.width && countedRows !== undefined) {\n columnWidth = Math.max(\n cachedWidth ?? 0,\n this.getWidth(rowIndex, columnIndex)\n );\n firstRow = countedRows;\n } else {\n columnWidth = undefined;\n firstRow = 0;\n }\n for (let i = firstRow; i < this._rowCount; i++) {\n if (this.has(i, columnIndex)) {\n columnWidth = Math.max(\n columnWidth ?? 0,\n this.getWidth(i, columnIndex)\n );\n }\n }\n if (columnWidth === undefined) {\n delete this._columnWidthCache[columnKey];\n } else {\n this._columnWidthCache[columnKey] = columnWidth;\n }\n this._columnWidthRowCount[columnKey] = this._rowCount;\n }\n if (!this._hasFixedHeight) {\n const rowKey = this._keyMapper(rowIndex, 0);\n const cachedHeight = this._rowHeightCache[rowKey];\n const countedColumns = this._rowHeightColumnCount[rowKey];\n\n let rowHeight: number | undefined;\n let firstColumn: number;\n if (incremental.height && countedColumns !== undefined) {\n rowHeight = Math.max(\n cachedHeight ?? 0,\n this.getHeight(rowIndex, columnIndex)\n );\n firstColumn = countedColumns;\n } else {\n rowHeight = undefined;\n firstColumn = 0;\n }\n for (let i = firstColumn; i < this._columnCount; i++) {\n if (this.has(rowIndex, i)) {\n rowHeight = Math.max(rowHeight ?? 0, this.getHeight(rowIndex, i));\n }\n }\n if (rowHeight === undefined) {\n delete this._rowHeightCache[rowKey];\n } else {\n this._rowHeightCache[rowKey] = rowHeight;\n }\n this._rowHeightColumnCount[rowKey] = this._columnCount;\n }\n }\n}\n\nfunction defaultKeyMapper(rowIndex: number, columnIndex: number) {\n return `${rowIndex}-${columnIndex}`;\n}\n","import { memo, useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../../utils/useIsomorphicLayoutEffect\";\nimport type { ColumnSizerProps, ColumnSizerRegisteredChild } from \"./types\";\n\n/**\n * High-order component that auto-calculates column-widths for `Grid` cells.\n */\nexport const ColumnSizer = /* @__PURE__ */ memo(function ColumnSizer({\n children,\n columnMaxWidth,\n columnMinWidth,\n columnCount,\n width\n}: ColumnSizerProps) {\n const registeredChildRef = useRef<ColumnSizerRegisteredChild | null>(null);\n\n const registerChild = useCallback(\n (child: ColumnSizerRegisteredChild | null) => {\n if (child && typeof child.recomputeGridSize !== \"function\") {\n throw Error(\n \"Unexpected child type registered; only Grid/MultiGrid children are supported.\"\n );\n }\n\n registeredChildRef.current = child;\n\n if (child) {\n child.recomputeGridSize();\n }\n },\n []\n );\n\n // Recompute the registered child's sizes when the sizing inputs change (but not on mount;\n // registering the child already does that). Comparing against the previously committed values\n // (rather than skipping the first effect run) keeps this correct when StrictMode re-runs effects.\n const committedInputsRef = useRef<{\n columnCount: number;\n columnMaxWidth: number | undefined;\n columnMinWidth: number | undefined;\n width: number;\n } | null>(null);\n useIsomorphicLayoutEffect(() => {\n const prev = committedInputsRef.current;\n committedInputsRef.current = {\n columnCount,\n columnMaxWidth,\n columnMinWidth,\n width\n };\n\n if (\n prev !== null &&\n (columnMaxWidth !== prev.columnMaxWidth ||\n columnMinWidth !== prev.columnMinWidth ||\n columnCount !== prev.columnCount ||\n width !== prev.width)\n ) {\n registeredChildRef.current?.recomputeGridSize();\n }\n }, [columnCount, columnMaxWidth, columnMinWidth, width]);\n\n const safeColumnMinWidth = columnMinWidth || 1;\n\n const safeColumnMaxWidth = columnMaxWidth\n ? Math.min(columnMaxWidth, width)\n : width;\n\n let columnWidth = width / columnCount;\n columnWidth = Math.max(safeColumnMinWidth, columnWidth);\n columnWidth = Math.min(safeColumnMaxWidth, columnWidth);\n columnWidth = Math.floor(columnWidth);\n\n const adjustedWidth = Math.min(width, columnWidth * columnCount);\n\n return children({\n adjustedWidth,\n columnWidth,\n getColumnWidth: () => columnWidth,\n registerChild\n });\n});\n","import type { OverscanIndices, OverscanIndicesGetterParams } from \"./types\";\n\nexport const SCROLL_DIRECTION_BACKWARD = -1;\nexport const SCROLL_DIRECTION_FORWARD = 1;\n\nexport const SCROLL_DIRECTION_HORIZONTAL = \"horizontal\";\nexport const SCROLL_DIRECTION_VERTICAL = \"vertical\";\n\n/**\n * Calculates the number of cells to overscan before and after a specified range.\n * This function ensures that overscanning doesn't exceed the available cells.\n */\n\nexport function accessibilityOverscanIndicesGetter({\n cellCount,\n overscanCellsCount,\n scrollDirection,\n startIndex,\n stopIndex\n}: OverscanIndicesGetterParams): OverscanIndices {\n // Make sure we render at least 1 cell extra before and after (except near boundaries)\n // This is necessary in order to support keyboard navigation (TAB/SHIFT+TAB) in some cases\n // For more info see issues #625\n overscanCellsCount = Math.max(1, overscanCellsCount);\n\n if (scrollDirection === SCROLL_DIRECTION_FORWARD) {\n return {\n overscanStartIndex: Math.max(0, startIndex - 1),\n overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)\n };\n } else {\n return {\n overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),\n overscanStopIndex: Math.min(cellCount - 1, stopIndex + 1)\n };\n }\n}\n","import { cloneElement, type CSSProperties, type ReactElement } from \"react\";\nimport type { CellMeasurerParent } from \"../CellMeasurer/types\";\nimport type {\n CellRangeRendererParams,\n CellRendererParams,\n CellRenderer\n} from \"./types\";\n\n/**\n * Default implementation of cellRangeRenderer used by Grid.\n * This renderer supports cell-caching while the user is scrolling.\n */\n\nexport function defaultCellRangeRenderer({\n cellCache,\n cellRenderer,\n columnSizeAndPositionManager,\n columnStartIndex,\n columnStopIndex,\n deferredMeasurementCache,\n horizontalOffsetAdjustment,\n isScrolling,\n isScrollingOptOut,\n parent, // Grid (or List or Table)\n rowSizeAndPositionManager,\n rowStartIndex,\n rowStopIndex,\n styleCache,\n verticalOffsetAdjustment,\n visibleColumnIndices,\n visibleRowIndices\n}: CellRangeRendererParams): ReactElement[] {\n const renderedCells: ReactElement[] = [];\n\n // Browsers have native size limits for elements (eg Chrome 33M pixels, IE 1.5M pixes).\n // User cannot scroll beyond these size limitations.\n // In order to work around this, ScalingCellSizeAndPositionManager compresses offsets.\n // We should never cache styles for compressed offsets though as this can lead to bugs.\n // See issue #576 for more.\n const areOffsetsAdjusted =\n columnSizeAndPositionManager.areOffsetsAdjusted() ||\n rowSizeAndPositionManager.areOffsetsAdjusted();\n\n const canCacheStyle = !isScrolling && !areOffsetsAdjusted;\n\n for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {\n const rowDatum =\n rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex);\n\n for (\n let columnIndex = columnStartIndex;\n columnIndex <= columnStopIndex;\n columnIndex++\n ) {\n const columnDatum =\n columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex);\n // Note that start/stop may be undefined (in which case the comparisons below are false)\n const isVisible =\n columnIndex >= visibleColumnIndices.start! &&\n columnIndex <= visibleColumnIndices.stop! &&\n rowIndex >= visibleRowIndices.start! &&\n rowIndex <= visibleRowIndices.stop!;\n const key = `${rowIndex}-${columnIndex}`;\n let style: CSSProperties;\n\n // Cache style objects so shallow-compare doesn't re-render unnecessarily.\n if (canCacheStyle && styleCache[key]) {\n style = styleCache[key];\n } else {\n // In deferred mode, cells will be initially rendered before we know their size.\n // Don't interfere with CellMeasurer's measurements by setting an invalid size.\n if (\n deferredMeasurementCache &&\n !deferredMeasurementCache.has(rowIndex, columnIndex)\n ) {\n // Position not-yet-measured cells at top/left 0,0,\n // And give them width/height of 'auto' so they can grow larger than the parent Grid if necessary.\n // Positioning them further to the right/bottom influences their measured size.\n style = {\n height: \"auto\",\n left: 0,\n position: \"absolute\",\n top: 0,\n width: \"auto\"\n };\n } else {\n style = {\n height: rowDatum.size,\n left: columnDatum.offset + horizontalOffsetAdjustment,\n position: \"absolute\",\n top: rowDatum.offset + verticalOffsetAdjustment,\n width: columnDatum.size\n };\n\n styleCache[key] = style;\n }\n }\n\n const cellRendererParams: CellRendererParams = {\n columnIndex,\n isScrolling,\n isVisible,\n key,\n parent,\n rowIndex,\n style\n };\n\n let renderedCell: ReturnType<CellRenderer>;\n\n // Avoid re-creating cells while scrolling.\n // This can lead to the same cell being created many times and can cause performance issues for \"heavy\" cells.\n // If a scroll is in progress- cache and reuse cells.\n // This cache will be thrown away once scrolling completes.\n // However if we are scaling scroll positions and sizes, we should also avoid caching.\n // This is because the offset changes slightly as scroll position changes and caching leads to stale values.\n // For more info refer to issue #395\n //\n // If isScrollingOptOut is specified, we always cache cells.\n // For more info refer to issue #1028\n if (\n (isScrollingOptOut || isScrolling) &&\n !horizontalOffsetAdjustment &&\n !verticalOffsetAdjustment\n ) {\n if (!cellCache[key]) {\n cellCache[key] = cellRenderer(cellRendererParams);\n }\n\n renderedCell = cellCache[key];\n\n // If the user is no longer scrolling, don't cache cells.\n // This makes dynamic cell content difficult for users and would also lead to a heavier memory footprint.\n } else {\n renderedCell = cellRenderer(cellRendererParams);\n }\n\n if (renderedCell == null || renderedCell === false) {\n continue;\n }\n\n const cellElement = renderedCell as ReactElement<CellElementProps>;\n\n if (process.env.NODE_ENV !== \"production\") {\n warnAboutMissingStyle(parent, cellElement);\n }\n\n if (!cellElement.props.role) {\n renderedCell = cloneElement(cellElement, { role: \"gridcell\" });\n }\n\n renderedCells.push(renderedCell);\n }\n }\n\n return renderedCells;\n}\n\n// Props that Grid reads from rendered cells (React 19's types default element props to unknown)\ntype CellElementProps = {\n children?: unknown;\n role?: string;\n style?: CSSProperties;\n};\n\nfunction warnAboutMissingStyle(\n parent: CellMeasurerParent & { __warnedAboutMissingStyle?: boolean },\n renderedCell: ReactElement<CellElementProps>\n) {\n if (process.env.NODE_ENV !== \"production\") {\n if (renderedCell) {\n // If the direct child is a CellMeasurer, then we should check its child\n // See issue #611\n if (\n renderedCell.type &&\n (renderedCell.type as { __internalCellMeasurerFlag?: boolean })\n .__internalCellMeasurerFlag\n ) {\n renderedCell = renderedCell.props\n .children as ReactElement<CellElementProps>;\n }\n\n if (\n renderedCell &&\n renderedCell.props &&\n renderedCell.props.style === undefined &&\n parent.__warnedAboutMissingStyle !== true\n ) {\n parent.__warnedAboutMissingStyle = true;\n\n console.warn(\n \"Rendered cell should include style property for positioning.\"\n );\n }\n }\n }\n}\n","/**\n * Specifies the number of milliseconds during which to disable pointer events while a scroll is in progress.\n * This improves performance and makes scrolling smoother.\n */\nexport const DEFAULT_SCROLLING_RESET_TIME_INTERVAL = 150;\n","import type { OverscanIndices, OverscanIndicesGetterParams } from \"./types\";\n\nexport const SCROLL_DIRECTION_BACKWARD = -1;\nexport const SCROLL_DIRECTION_FORWARD = 1;\n\nexport const SCROLL_DIRECTION_HORIZONTAL = \"horizontal\";\nexport const SCROLL_DIRECTION_VERTICAL = \"vertical\";\n\n/**\n * Calculates the number of cells to overscan before and after a specified range.\n * This function ensures that overscanning doesn't exceed the available cells.\n */\n\nexport function defaultOverscanIndicesGetter({\n cellCount,\n overscanCellsCount,\n scrollDirection,\n startIndex,\n stopIndex\n}: OverscanIndicesGetterParams): OverscanIndices {\n if (scrollDirection === SCROLL_DIRECTION_FORWARD) {\n return {\n overscanStartIndex: Math.max(0, startIndex),\n overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)\n };\n } else {\n return {\n overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),\n overscanStopIndex: Math.min(cellCount - 1, stopIndex)\n };\n }\n}\n","import scrollbarSize from \"dom-helpers/scrollbarSize\";\nimport { DEFAULT_SCROLLING_RESET_TIME_INTERVAL } from \"./constants\";\nimport { defaultCellRangeRenderer } from \"./defaultCellRangeRenderer\";\nimport { defaultOverscanIndicesGetter } from \"./defaultOverscanIndicesGetter\";\nimport type { GridProps } from \"./types\";\n\ntype DefaultedPropKeys =\n | \"aria-label\"\n | \"aria-readonly\"\n | \"autoContainerWidth\"\n | \"cellRangeRenderer\"\n | \"containerRole\"\n | \"containerStyle\"\n | \"estimatedColumnSize\"\n | \"estimatedRowSize\"\n | \"getScrollbarSize\"\n | \"isScrollingOptOut\"\n | \"noContentRenderer\"\n | \"onScroll\"\n | \"onScrollbarPresenceChange\"\n | \"onSectionRendered\"\n | \"overscanColumnCount\"\n | \"overscanIndicesGetter\"\n | \"overscanRowCount\"\n | \"role\"\n | \"scrollingResetTimeInterval\"\n | \"style\"\n | \"tabIndex\";\n\nconst noop = () => {};\n\n/**\n * Default values for `Grid`'s optional props.\n * (The PURE annotations let bundlers drop this object if it isn't used.)\n */\nexport const defaultGridProps: Readonly<\n Required<Pick<GridProps, DefaultedPropKeys>>\n> = /* @__PURE__ */ Object.freeze({\n \"aria-label\": \"grid\",\n \"aria-readonly\": true,\n autoContainerWidth: false,\n cellRangeRenderer: defaultCellRangeRenderer,\n containerRole: \"row\",\n containerStyle: /* @__PURE__ */ Object.freeze({}),\n estimatedColumnSize: 100,\n estimatedRowSize: 30,\n getScrollbarSize: scrollbarSize,\n isScrollingOptOut: false,\n noContentRenderer: () => null,\n onScroll: noop,\n onScrollbarPresenceChange: noop,\n onSectionRendered: noop,\n overscanColumnCount: 0,\n overscanIndicesGetter: defaultOverscanIndicesGetter,\n overscanRowCount: 10,\n role: \"grid\",\n scrollingResetTimeInterval: DEFAULT_SCROLLING_RESET_TIME_INTERVAL,\n style: /* @__PURE__ */ Object.freeze({}),\n tabIndex: 0\n});\n","/**\n * Helper utility that updates the specified callback whenever any of the specified indices have changed.\n */\nexport function createCallbackMemoizer(requireAllKeys = true) {\n let cachedIndices: Record<string, unknown> = {};\n\n return <Indices extends object>({\n callback,\n indices\n }: {\n callback: (indices: Indices) => void;\n indices: Indices;\n }) => {\n const indicesMap = indices as Record<string, unknown>;\n const keys = Object.keys(indices);\n const allInitialized =\n !requireAllKeys ||\n keys.every((key) => {\n const value = indicesMap[key];\n return Array.isArray(value) ? value.length > 0 : (value as number) >= 0;\n });\n const indexChanged =\n keys.length !== Object.keys(cachedIndices).length ||\n keys.some((key) => {\n const cachedValue = cachedIndices[key];\n const value = indicesMap[key];\n\n return Array.isArray(value)\n ? (cachedValue as unknown[]).join(\",\") !== value.join(\",\")\n : cachedValue !== value;\n });\n\n cachedIndices = indicesMap;\n\n if (allInitialized && indexChanged) {\n callback(indices);\n }\n };\n}\n","/**\n * Determines a new offset that ensures a certain cell is visible, given the current offset.\n * If the cell is already visible then the current offset will be returned.\n * If the current offset is too great or small, it will be adjusted just enough to ensure the specified index is visible.\n *\n * @param align Desired alignment within container; one of \"auto\" (default), \"start\", \"end\", or \"center\".\n * With \"auto\", a cell that is larger than the container is aligned to its start.\n * @param cellOffset Offset (x or y) position for cell\n * @param cellSize Size (width or height) of cell\n * @param containerSize Total size (width or height) of the container\n * @param currentOffset Container's current (x or y) offset\n * @return Offset to use to ensure the specified cell is visible\n */\nexport function getUpdatedOffsetForIndex({\n align = \"auto\",\n cellOffset,\n cellSize,\n containerSize,\n currentOffset\n}: {\n align?: \"auto\" | \"end\" | \"start\" | \"center\";\n cellOffset: number;\n cellSize: number;\n containerSize: number;\n currentOffset: number;\n}): number {\n const maxOffset = cellOffset;\n const minOffset = maxOffset - containerSize + cellSize;\n\n switch (align) {\n case \"start\":\n return maxOffset;\n case \"end\":\n return minOffset;\n case \"center\":\n return maxOffset - (containerSize - cellSize) / 2;\n default:\n // A cell that doesn't fit within the container is aligned to its start, so that its start is visible (#1264)\n if (cellSize >= containerSize) {\n return maxOffset;\n }\n return Math.max(minOffset, Math.min(maxOffset, currentOffset));\n }\n}\n","type Callback = (timestamp: number) => void;\ntype CancelAnimationFrame = (requestId: number) => void;\ntype RequestAnimationFrame = (callback: Callback) => number;\n\ntype AnimationFrameHost = {\n requestAnimationFrame?: RequestAnimationFrame;\n webkitRequestAnimationFrame?: RequestAnimationFrame;\n mozRequestAnimationFrame?: RequestAnimationFrame;\n oRequestAnimationFrame?: RequestAnimationFrame;\n msRequestAnimationFrame?: RequestAnimationFrame;\n cancelAnimationFrame?: CancelAnimationFrame;\n webkitCancelAnimationFrame?: CancelAnimationFrame;\n mozCancelAnimationFrame?: CancelAnimationFrame;\n oCancelAnimationFrame?: CancelAnimationFrame;\n msCancelAnimationFrame?: CancelAnimationFrame;\n setTimeout: (callback: Callback, delay: number) => number;\n clearTimeout: (id: number) => void;\n};\n\n// Properly handle server-side rendering.\nlet win: AnimationFrameHost;\nif (typeof window !== \"undefined\") {\n win = window as unknown as AnimationFrameHost;\n} else if (typeof self !== \"undefined\") {\n win = self as unknown as AnimationFrameHost;\n} else {\n win = {} as AnimationFrameHost;\n}\n\n// requestAnimationFrame() shim by Paul Irish\n// http://paulirish.com/2011/requestanimationframe-for-smart-animating/\nconst request: RequestAnimationFrame =\n win.requestAnimationFrame ||\n win.webkitRequestAnimationFrame ||\n win.mozRequestAnimationFrame ||\n win.oRequestAnimationFrame ||\n win.msRequestAnimationFrame ||\n function (callback: Callback): number {\n return win.setTimeout(callback, 1000 / 60);\n };\n\nconst cancel: CancelAnimationFrame =\n win.cancelAnimationFrame ||\n win.webkitCancelAnimationFrame ||\n win.mozCancelAnimationFrame ||\n win.oCancelAnimationFrame ||\n win.msCancelAnimationFrame ||\n function (id: number) {\n win.clearTimeout(id);\n };\n\nexport const raf: RequestAnimationFrame = request;\nexport const caf: CancelAnimationFrame = cancel;\n","import { caf, raf } from \"./animationFrame\";\n\nexport type AnimationTimeoutId = {\n id: number;\n};\n\nexport const cancelAnimationTimeout = (frame: AnimationTimeoutId) =>\n caf(frame.id);\n\n/**\n * Recursively calls requestAnimationFrame until a specified delay has been met or exceeded.\n * When the delay time has been reached the function you're timing out will be called.\n *\n * Credit: Joe Lambert (https://gist.github.com/joelambert/1002116#file-requesttimeout-js)\n */\nexport const requestAnimationTimeout = (\n callback: () => void,\n delay: number\n): AnimationTimeoutId => {\n let start: number;\n // wait for end of processing current event handler, because event handler may be long\n Promise.resolve().then(() => {\n start = Date.now();\n });\n\n const timeout = () => {\n if (Date.now() - start >= delay) {\n callback.call(undefined);\n } else {\n frame.id = raf(timeout);\n }\n };\n\n const frame: AnimationTimeoutId = {\n id: raf(timeout)\n };\n\n return frame;\n};\n","import { useEffect } from \"react\";\nimport type { ScrollElement } from \"./types\";\n\n/** Warns (in DEV) if a component has neither a `height` nor a `scrollElement` (it then renders nothing). */\nexport function useMissingHeightWarning(\n componentName: string,\n height: number | undefined,\n scrollElement: ScrollElement | null | undefined\n) {\n const heightMissing = height === undefined && scrollElement === undefined;\n useEffect(() => {\n if (process.env.NODE_ENV !== \"production\" && heightMissing) {\n console.warn(\n `${componentName} requires a height prop (unless a scrollElement is specified)`\n );\n }\n }, [componentName, heightMissing]);\n}\n","import type { ResolvedScrollElement } from \"./types\";\n\n/**\n * Gets the dimensions of the element, accounting for API differences between\n * `window` and other DOM elements.\n */\n\ntype Dimensions = {\n height: number;\n width: number;\n};\n\ntype Offset = {\n top: number;\n left: number;\n};\n\nconst isWindow = (element: ResolvedScrollElement): element is Window =>\n element === window;\n\nconst getBoundingBox = (element: Element) => element.getBoundingClientRect();\n\nexport function getDimensions(\n scrollElement: ResolvedScrollElement\n): Dimensions {\n if (isWindow(scrollElement)) {\n const { innerHeight, innerWidth } = window;\n return {\n height: typeof innerHeight === \"number\" ? innerHeight : 0,\n width: typeof innerWidth === \"number\" ? innerWidth : 0\n };\n } else {\n // Read the fields explicitly; DOMRect fields are prototype getters,\n // so spreading a DOMRect (e.g. into state) would copy nothing\n const { height, width } = getBoundingBox(scrollElement);\n return { height, width };\n }\n}\n\n/**\n * Gets the vertical and horizontal position of an element within its scroll container.\n * Elements that have been “scrolled past” return negative values.\n * Handles edge-case where a user is navigating back (history) from an already-scrolled page.\n * In this case the body’s top or left position will be a negative number and this element’s top or left will be increased (by that amount).\n */\nexport function getPositionOffset(\n element: Element,\n container: ResolvedScrollElement\n): Offset {\n if (isWindow(container) && document.documentElement) {\n const containerElement = document.documentElement;\n const elementRect = getBoundingBox(element);\n const containerRect = getBoundingBox(containerElement);\n return {\n top: elementRect.top - containerRect.top,\n left: elementRect.left - containerRect.left\n };\n } else {\n const scrollOffset = getScrollOffset(container);\n const elementRect = getBoundingBox(element);\n const containerRect = getBoundingBox(container as Element);\n return {\n top: elementRect.top + scrollOffset.top - containerRect.top,\n left: elementRect.left + scrollOffset.left - containerRect.left\n };\n }\n}\n\n/**\n * Gets the vertical and horizontal scroll amount of the element, accounting for IE compatibility\n * and API differences between `window` and other DOM elements.\n */\nexport function getScrollOffset(element: ResolvedScrollElement): Offset {\n if (isWindow(element) && document.documentElement) {\n return {\n top:\n \"scrollY\" in window\n ? window.scrollY\n : document.documentElement.scrollTop,\n left:\n \"scrollX\" in window\n ? window.scrollX\n : document.documentElement.scrollLeft\n };\n } else {\n return {\n top: (element as Element).scrollTop,\n left: (element as Element).scrollLeft\n };\n }\n}\n","import {\n requestAnimationTimeout,\n cancelAnimationTimeout,\n type AnimationTimeoutId\n} from \"../requestAnimationTimeout\";\nimport type { ResolvedScrollElement } from \"./types\";\n\n/**\n * Stable, per-instance object that a component registers to receive the (shared) scroll events of its scroll element.\n * Its methods read the instance's latest props/state, so the object itself never changes.\n */\nexport type ScrollElementListener = {\n /** Wait time (in milliseconds) after the last scroll event before `resetIsScrolling()` is called. */\n getScrollingResetTimeInterval(): number;\n\n /** Called when the element the listener is registered for scrolls. */\n handleScrollEvent(): void;\n\n /** Called once scrolling has stopped (for the longest interval of all registered listeners). */\n resetIsScrolling(): void;\n};\n\ntype Registration = {\n listener: ScrollElementListener;\n element: ResolvedScrollElement;\n};\n\nlet registrations: Registration[] = [];\nlet originalBodyPointerEvents: string | null = null;\nlet disablePointerEventsTimeoutId: AnimationTimeoutId | null = null;\n\nfunction enablePointerEventsIfDisabled() {\n if (disablePointerEventsTimeoutId) {\n disablePointerEventsTimeoutId = null;\n\n if (document.body && originalBodyPointerEvents != null) {\n document.body.style.pointerEvents = originalBodyPointerEvents;\n }\n\n originalBodyPointerEvents = null;\n }\n}\n\nfunction enablePointerEventsAfterDelayCallback() {\n enablePointerEventsIfDisabled();\n registrations.forEach(({ listener }) => listener.resetIsScrolling());\n}\n\nfunction enablePointerEventsAfterDelay() {\n if (disablePointerEventsTimeoutId) {\n cancelAnimationTimeout(disablePointerEventsTimeoutId);\n }\n\n let maximumTimeout = 0;\n registrations.forEach(({ listener }) => {\n maximumTimeout = Math.max(\n maximumTimeout,\n listener.getScrollingResetTimeInterval()\n );\n });\n\n disablePointerEventsTimeoutId = requestAnimationTimeout(\n enablePointerEventsAfterDelayCallback,\n maximumTimeout\n );\n}\n\nfunction onScroll(event: Event) {\n if (\n event.currentTarget === window &&\n originalBodyPointerEvents == null &&\n document.body\n ) {\n originalBodyPointerEvents = document.body.style.pointerEvents;\n\n document.body.style.pointerEvents = \"none\";\n }\n enablePointerEventsAfterDelay();\n registrations.forEach(({ listener, element }) => {\n if (element === event.currentTarget) {\n listener.handleScrollEvent();\n }\n });\n}\n\nexport function registerScrollListener(\n listener: ScrollElementListener,\n element: ResolvedScrollElement\n) {\n if (\n registrations.some(\n (registration) =>\n registration.listener === listener && registration.element === element\n )\n ) {\n return;\n }\n\n if (!registrations.some((registration) => registration.element === element)) {\n element.addEventListener(\"scroll\", onScroll);\n }\n registrations.push({ listener, element });\n}\n\nexport function unregisterScrollListener(\n listener: ScrollElementListener,\n element: ResolvedScrollElement\n) {\n registrations = registrations.filter(\n (registration) =>\n registration.listener !== listener || registration.element !== element\n );\n\n // Remove the listener once no instance is listening to this element anymore,\n // even if other instances are still listening to other elements\n if (!registrations.some((registration) => registration.element === element)) {\n element.removeEventListener(\"scroll\", onScroll);\n }\n\n if (!registrations.length) {\n if (disablePointerEventsTimeoutId) {\n cancelAnimationTimeout(disablePointerEventsTimeoutId);\n enablePointerEventsIfDisabled();\n }\n }\n}\n","import { useInsertionEffect, useState } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect\";\nimport {\n getDimensions,\n getPositionOffset,\n getScrollOffset\n} from \"./dimensions\";\nimport {\n registerScrollListener,\n unregisterScrollListener,\n type ScrollElementListener\n} from \"./scrollListeners\";\nimport type {\n ResolvedScrollElement,\n ScrollElement,\n ScrollElementLinkSource,\n ScrollElementLinkTarget,\n ScrollElementViewport\n} from \"./types\";\n\ntype Instance = ScrollElementListener & {\n element: ResolvedScrollElement | null;\n scrollingResetTimeInterval: number;\n source: ScrollElementLinkSource;\n target: ScrollElementLinkTarget;\n // Most recently provided to the target\n viewport: ScrollElementViewport;\n\n // Measures the scroll element and the target's position within it, and provides the target with the resulting viewport (if it changed)\n update(isScrolling: boolean): void;\n};\n\n/** Resolves the `scrollElement` prop to the object that is listened to (null during server rendering, or if not specified). */\nexport function resolveScrollElement(\n scrollElement: ScrollElement | null | undefined\n): ResolvedScrollElement | null {\n if (scrollElement === \"window\") {\n return typeof window !== \"undefined\" ? window : null;\n }\n return scrollElement ?? null;\n}\n\nfunction measureViewport(\n element: ResolvedScrollElement,\n target: ScrollElementLinkTarget,\n isScrolling: boolean\n): ScrollElementViewport {\n const targetElement = target.getElement();\n const positionFromTop = targetElement\n ? getPositionOffset(targetElement, element).top\n : 0;\n\n return {\n height: getDimensions(element).height,\n isScrolling,\n scrollTop: getScrollOffset(element).top - positionFromTop\n };\n}\n\nfunction createInstance(\n target: ScrollElementLinkTarget,\n scrollingResetTimeInterval: number\n): Instance {\n const instance: Instance = {\n element: null,\n scrollingResetTimeInterval,\n target,\n viewport: { height: 0, isScrolling: false, scrollTop: 0 },\n\n source: {\n scrollTo(scrollTop) {\n const { element } = instance;\n if (element === null) {\n return false;\n }\n\n // Measure the position again, in case content above the component has changed size since it was last measured\n const targetElement = instance.target.getElement();\n const positionFromTop = targetElement\n ? getPositionOffset(targetElement, element).top\n : 0;\n\n const scrollOffset = getScrollOffset(element);\n const top = scrollTop + positionFromTop;\n if (Math.abs(scrollOffset.top - top) < 1) {\n return false;\n }\n\n if (typeof element.scrollTo === \"function\") {\n // Preserve the current horizontal scroll position\n element.scrollTo(scrollOffset.left, top);\n } else {\n (element as Element).scrollTop = top;\n }\n return true;\n }\n },\n\n update(isScrolling) {\n const { element } = instance;\n if (element === null) {\n return;\n }\n\n const viewport = measureViewport(element, instance.target, isScrolling);\n const prevViewport = instance.viewport;\n if (\n viewport.height !== prevViewport.height ||\n viewport.isScrolling !== prevViewport.isScrolling ||\n viewport.scrollTop !== prevViewport.scrollTop\n ) {\n instance.viewport = viewport;\n instance.target.setViewport(viewport);\n }\n },\n\n // ScrollElementListener (called by scrollListeners.ts)\n getScrollingResetTimeInterval() {\n return instance.scrollingResetTimeInterval;\n },\n\n handleScrollEvent() {\n instance.update(true);\n },\n\n resetIsScrolling() {\n instance.update(false);\n }\n };\n\n return instance;\n}\n\n// Calls `onResize` when the scroll element is resized: the window (resize event) or an element (ResizeObserver).\n// Returns a function that stops observing it.\nfunction observeResize(element: ResolvedScrollElement, onResize: () => void) {\n if (element === window) {\n window.addEventListener(\"resize\", onResize, false);\n return () => window.removeEventListener(\"resize\", onResize, false);\n }\n\n const ResizeObserverImpl =\n (element as Element).ownerDocument?.defaultView?.ResizeObserver ??\n (typeof ResizeObserver !== \"undefined\" ? ResizeObserver : undefined);\n if (!ResizeObserverImpl) {\n return () => {};\n }\n\n const resizeObserver = new ResizeObserverImpl(onResize);\n resizeObserver.observe(element as Element, { box: \"border-box\" });\n return () => resizeObserver.disconnect();\n}\n\n/**\n * Links a component (the target) to the element that scrolls it (its `scrollElement` prop): the window or a scrollable element.\n *\n * While the scroll element is available, the target is linked to it (see `ScrollElementLinkTarget`):\n * it is provided with the part of the scroll element that is visible to it (its viewport),\n * which is measured again whenever the scroll element scrolls or is resized, and after every commit of the component\n * (so that its position within the scroll element is current, e.g. if content above it has changed size).\n * The target scrolls the scroll element through the link source it is provided with.\n *\n * The target is unlinked when the scroll element is removed (or changes) and when the component unmounts.\n * (During server rendering, effects don't run, so the target is never linked.)\n */\nexport function useScrollElementLink(\n scrollElement: ScrollElement | null | undefined,\n target: ScrollElementLinkTarget,\n scrollingResetTimeInterval: number\n) {\n const [instance] = useState(() =>\n createInstance(target, scrollingResetTimeInterval)\n );\n\n useInsertionEffect(() => {\n instance.scrollingResetTimeInterval = scrollingResetTimeInterval;\n });\n\n const element = resolveScrollElement(scrollElement);\n\n useIsomorphicLayoutEffect(() => {\n if (element === null) {\n return;\n }\n\n instance.element = element;\n instance.viewport = measureViewport(element, instance.target, false);\n instance.target.link(instance.source, instance.viewport);\n\n registerScrollListener(instance, element);\n const stopObservingResize = observeResize(element, () =>\n instance.update(instance.viewport.isScrolling)\n );\n\n return () => {\n unregisterScrollListener(instance, element);\n stopObservingResize();\n\n instance.element = null;\n instance.target.link(null, instance.viewport);\n };\n }, [element, instance]);\n\n // The component's position within the scroll element may have changed (e.g. if content above it has changed size)\n useIsomorphicLayoutEffect(() => {\n instance.update(instance.viewport.isScrolling);\n });\n}\n","import type { Alignment, CellSizeGetter, VisibleCellRange } from \"../types\";\n\ntype CellSizeAndPositionManagerParams = {\n cellCount: number;\n cellSizeGetter: CellSizeGetter;\n estimatedCellSize: number;\n};\n\ntype ConfigureParams = {\n cellCount: number;\n estimatedCellSize: number;\n cellSizeGetter: CellSizeGetter;\n};\n\ntype GetUpdatedOffsetForIndex = {\n align?: Alignment;\n containerSize: number;\n currentOffset: number;\n targetIndex: number;\n};\n\ntype GetVisibleCellRangeParams = {\n containerSize: number;\n offset: number;\n};\n\nexport type SizeAndPositionData = {\n offset: number;\n size: number;\n};\n\n/**\n * Just-in-time calculates and caches size and position information for a collection of cells.\n */\n\nexport class CellSizeAndPositionManager {\n // Cache of size and position data for cells, mapped by cell index.\n // Note that invalid values may exist in this map so only rely on cells up to this._lastMeasuredIndex\n _cellSizeAndPositionData: { [index: number]: SizeAndPositionData } = {};\n\n // Measurements for cells up to this index can be trusted; cells afterward should be estimated.\n _lastMeasuredIndex = -1;\n\n // Used in deferred mode to track which cells have been queued for measurement.\n _lastBatchedIndex = -1;\n\n _cellCount: number;\n _cellSizeGetter: CellSizeGetter;\n _estimatedCellSize: number;\n\n constructor({\n cellCount,\n cellSizeGetter,\n estimatedCellSize\n }: CellSizeAndPositionManagerParams) {\n this._cellSizeGetter = cellSizeGetter;\n this._cellCount = cellCount;\n this._estimatedCellSize = estimatedCellSize;\n }\n\n areOffsetsAdjusted() {\n return false;\n }\n\n configure({ cellCount, estimatedCellSize, cellSizeGetter }: ConfigureParams) {\n this._cellCount = cellCount;\n // Cells beyond the new count are no longer measured\n // (otherwise the total size, which estimates the size of the unmeasured cells, could even be negative; see #1351)\n this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, cellCount - 1);\n this._estimatedCellSize = estimatedCellSize;\n this._cellSizeGetter = cellSizeGetter;\n }\n\n getCellCount(): number {\n return this._cellCount;\n }\n\n getEstimatedCellSize(): number {\n return this._estimatedCellSize;\n }\n\n getLastMeasuredIndex(): number {\n return this._lastMeasuredIndex;\n }\n\n getOffsetAdjustment() {\n return 0;\n }\n\n /**\n * This method returns the size and position for the cell at the specified index.\n * It just-in-time calculates (or used cached values) for cells leading up to the index.\n */\n getSizeAndPositionOfCell(index: number): SizeAndPositionData {\n if (index < 0 || index >= this._cellCount) {\n throw Error(\n `Requested index ${index} is outside of range 0..${this._cellCount}`\n );\n }\n\n if (index > this._lastMeasuredIndex) {\n const lastMeasuredCellSizeAndPosition =\n this.getSizeAndPositionOfLastMeasuredCell();\n let offset =\n lastMeasuredCellSizeAndPosition.offset +\n lastMeasuredCellSizeAndPosition.size;\n\n for (let i = this._lastMeasuredIndex + 1; i <= index; i++) {\n const size = this._cellSizeGetter({ index: i });\n\n // undefined or NaN probably means a logic error in the size getter.\n // null means we're using CellMeasurer and haven't yet measured a given index.\n if (size === undefined || isNaN(size)) {\n throw Error(`Invalid size returned for cell ${i} of value ${size}`);\n } else if (size === null) {\n this._cellSizeAndPositionData[i] = {\n offset,\n size: 0\n };\n\n this._lastBatchedIndex = index;\n } else {\n this._cellSizeAndPositionData[i] = {\n offset,\n size\n };\n\n offset += size;\n\n this._lastMeasuredIndex = i;\n }\n }\n }\n\n return this._cellSizeAndPositionData[index];\n }\n\n getSizeAndPositionOfLastMeasuredCell(): SizeAndPositionData {\n return this._lastMeasuredIndex >= 0\n ? this._cellSizeAndPositionData[this._lastMeasuredIndex]\n : {\n offset: 0,\n size: 0\n };\n }\n\n /**\n * Total size of all cells being measured.\n * This value will be completely estimated initially.\n * As cells are measured, the estimate will be updated.\n */\n getTotalSize(): number {\n const lastMeasuredCellSizeAndPosition =\n this.getSizeAndPositionOfLastMeasuredCell();\n const totalSizeOfMeasuredCells =\n lastMeasuredCellSizeAndPosition.offset +\n lastMeasuredCellSizeAndPosition.size;\n const numUnmeasuredCells = this._cellCount - this._lastMeasuredIndex - 1;\n const totalSizeOfUnmeasuredCells =\n numUnmeasuredCells * this._estimatedCellSize;\n return totalSizeOfMeasuredCells + totalSizeOfUnmeasuredCells;\n }\n\n /**\n * Determines a new offset that ensures a certain cell is visible, given the current offset.\n * If the cell is already visible then the current offset will be returned.\n * If the current offset is too great or small, it will be adjusted just enough to ensure the specified index is visible.\n *\n * @param align Desired alignment within container; one of \"auto\" (default), \"start\", or \"end\"\n * @param containerSize Size (width or height) of the container viewport\n * @param currentOffset Container's current (x or y) offset\n * @param totalSize Total size (width or height) of all cells\n * @return Offset to use to ensure the specified cell is visible\n */\n getUpdatedOffsetForIndex({\n align = \"auto\",\n containerSize,\n currentOffset,\n targetIndex\n }: GetUpdatedOffsetForIndex): number {\n if (containerSize <= 0) {\n return 0;\n }\n\n const datum = this.getSizeAndPositionOfCell(targetIndex);\n const maxOffset = datum.offset;\n const minOffset = maxOffset - containerSize + datum.size;\n\n let idealOffset: number;\n\n switch (align) {\n case \"start\":\n idealOffset = maxOffset;\n break;\n case \"end\":\n idealOffset = minOffset;\n break;\n case \"center\":\n idealOffset = maxOffset - (containerSize - datum.size) / 2;\n break;\n default:\n // A cell that doesn't fit within the container is aligned to its start, so that its start is visible (#1264)\n idealOffset =\n datum.size >= containerSize\n ? maxOffset\n : Math.max(minOffset, Math.min(maxOffset, currentOffset));\n break;\n }\n\n const totalSize = this.getTotalSize();\n\n return Math.max(0, Math.min(totalSize - containerSize, idealOffset));\n }\n\n getVisibleCellRange(params: GetVisibleCellRangeParams): VisibleCellRange {\n const { containerSize } = params;\n let { offset } = params;\n\n const totalSize = this.getTotalSize();\n\n if (totalSize === 0) {\n return {};\n }\n\n const maxOffset = offset + containerSize;\n const start = this._findNearestCell(offset);\n\n const datum = this.getSizeAndPositionOfCell(start);\n offset = datum.offset + datum.size;\n\n let stop = start;\n\n while (offset < maxOffset && stop < this._cellCount - 1) {\n stop++;\n\n offset += this.getSizeAndPositionOfCell(stop).size;\n }\n\n return {\n start,\n stop\n };\n }\n\n /**\n * Clear all cached values for cells after the specified index.\n * This method should be called for any cell that has changed its size.\n * It will not immediately perform any calculations; they'll be performed the next time getSizeAndPositionOfCell() is called.\n */\n resetCell(index: number): void {\n this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index - 1);\n }\n\n _binarySearch(high: number, low: number, offset: number): number {\n while (low <= high) {\n const middle = low + Math.floor((high - low) / 2);\n const currentOffset = this.getSizeAndPositionOfCell(middle).offset;\n\n if (currentOffset === offset) {\n return middle;\n } else if (currentOffset < offset) {\n low = middle + 1;\n } else if (currentOffset > offset) {\n high = middle - 1;\n }\n }\n\n if (low > 0) {\n return low - 1;\n } else {\n return 0;\n }\n }\n\n _exponentialSearch(index: number, offset: number): number {\n let interval = 1;\n\n while (\n index < this._cellCount &&\n this.getSizeAndPositionOfCell(index).offset < offset\n ) {\n index += interval;\n interval *= 2;\n }\n\n return this._binarySearch(\n Math.min(index, this._cellCount - 1),\n Math.floor(index / 2),\n offset\n );\n }\n\n /**\n * Searches for the cell (index) nearest the specified offset.\n *\n * If no exact match is found the next lowest cell index will be returned.\n * This allows partially visible cells (with offsets just before/above the fold) to be visible.\n */\n _findNearestCell(offset: number): number {\n if (isNaN(offset)) {\n throw Error(`Invalid offset ${offset} specified`);\n }\n\n // Our search algorithms find the nearest match at or below the specified offset.\n // So make sure the offset is at least 0 or no match will be found.\n offset = Math.max(0, offset);\n\n const lastMeasuredCellSizeAndPosition =\n this.getSizeAndPositionOfLastMeasuredCell();\n const lastMeasuredIndex = Math.max(0, this._lastMeasuredIndex);\n\n if (lastMeasuredCellSizeAndPosition.offset >= offset) {\n // If we've already measured cells within this range just use a binary search as it's faster.\n return this._binarySearch(lastMeasuredIndex, 0, offset);\n } else {\n // If we haven't yet measured this high, fallback to an exponential search with an inner binary search.\n // The exponential search avoids pre-computing sizes for the full set of cells as a binary search would.\n // The overall complexity for this approach is O(log n).\n return this._exponentialSearch(lastMeasuredIndex, offset);\n }\n }\n}\n","// The largest size (in pixels) of the scrollable content; beyond it, scroll offsets are scaled (see ScalingCellSizeAndPositionManager).\n// Modern browsers support at least this size: Chromium and WebKit support taller elements, and Firefox about 17.9M px.\n// (Version 9 used a much smaller 1.5M px limit, required by Internet Explorer, in every browser other than Chrome;\n// React 18+ doesn't support Internet Explorer.)\nconst MAX_ELEMENT_SIZE = 1.67771e7;\n\nexport const getMaxElementSize = (): number => MAX_ELEMENT_SIZE;\n","import type { Alignment, CellSizeGetter, VisibleCellRange } from \"../types\";\n\nimport {\n CellSizeAndPositionManager,\n type SizeAndPositionData\n} from \"./CellSizeAndPositionManager\";\nimport { getMaxElementSize } from \"./maxElementSize\";\n\ntype ContainerSizeAndOffset = {\n containerSize: number;\n offset: number;\n};\n\n/**\n * Browsers have scroll offset limitations (eg Chrome stops scrolling at ~33.5M pixels where as Edge tops out at ~1.5M pixels).\n * After a certain position, the browser won't allow the user to scroll further (even via JavaScript scroll offset adjustments).\n * This util picks a lower ceiling for max size and artificially adjusts positions within to make it transparent for users.\n */\n\ntype Params = {\n maxScrollSize?: number;\n cellCount: number;\n cellSizeGetter: CellSizeGetter;\n estimatedCellSize: number;\n};\n\n/**\n * Extends CellSizeAndPositionManager and adds scaling behavior for lists that are too large to fit within a browser's native limits.\n */\nexport class ScalingCellSizeAndPositionManager {\n _cellSizeAndPositionManager: CellSizeAndPositionManager;\n _maxScrollSize: number;\n\n constructor({ maxScrollSize = getMaxElementSize(), ...params }: Params) {\n // Favor composition over inheritance to simplify IE10 support\n this._cellSizeAndPositionManager = new CellSizeAndPositionManager(params);\n this._maxScrollSize = maxScrollSize;\n }\n\n areOffsetsAdjusted(): boolean {\n return (\n this._cellSizeAndPositionManager.getTotalSize() > this._maxScrollSize\n );\n }\n\n configure(params: {\n cellCount: number;\n estimatedCellSize: number;\n cellSizeGetter: CellSizeGetter;\n }): void {\n this._cellSizeAndPositionManager.configure(params);\n }\n\n getCellCount(): number {\n return this._cellSizeAndPositionManager.getCellCount();\n }\n\n getEstimatedCellSize(): number {\n return this._cellSizeAndPositionManager.getEstimatedCellSize();\n }\n\n getLastMeasuredIndex(): number {\n return this._cellSizeAndPositionManager.getLastMeasuredIndex();\n }\n\n /**\n * Number of pixels a cell at the given position (offset) should be shifted in order to fit within the scaled container.\n * The offset passed to this function is scaled (safe) as well.\n */\n getOffsetAdjustment({\n containerSize,\n offset // safe\n }: ContainerSizeAndOffset): number {\n const totalSize = this._cellSizeAndPositionManager.getTotalSize();\n const safeTotalSize = this.getTotalSize();\n const offsetPercentage = this._getOffsetPercentage({\n containerSize,\n offset,\n totalSize: safeTotalSize\n });\n\n return Math.round(offsetPercentage * (safeTotalSize - totalSize));\n }\n\n getSizeAndPositionOfCell(index: number): SizeAndPositionData {\n return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index);\n }\n\n getSizeAndPositionOfLastMeasuredCell(): SizeAndPositionData {\n return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell();\n }\n\n /** See CellSizeAndPositionManager#getTotalSize */\n getTotalSize(): number {\n return Math.min(\n this._maxScrollSize,\n this._cellSizeAndPositionManager.getTotalSize()\n );\n }\n\n /** See CellSizeAndPositionManager#getUpdatedOffsetForIndex */\n getUpdatedOffsetForIndex({\n align = \"auto\",\n containerSize,\n currentOffset, // safe\n targetIndex\n }: {\n align?: Alignment;\n containerSize: number;\n currentOffset: number;\n targetIndex: number;\n }): number {\n currentOffset = this._safeOffsetToOffset({\n containerSize,\n offset: currentOffset\n });\n\n const offset = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({\n align,\n containerSize,\n currentOffset,\n targetIndex\n });\n\n return this._offsetToSafeOffset({\n containerSize,\n offset\n });\n }\n\n /** See CellSizeAndPositionManager#getVisibleCellRange */\n getVisibleCellRange({\n containerSize,\n offset // safe\n }: ContainerSizeAndOffset): VisibleCellRange {\n offset = this._safeOffsetToOffset({\n containerSize,\n offset\n });\n\n return this._cellSizeAndPositionManager.getVisibleCellRange({\n containerSize,\n offset\n });\n }\n\n resetCell(index: number): void {\n this._cellSizeAndPositionManager.resetCell(index);\n }\n\n _getOffsetPercentage({\n containerSize,\n offset, // safe\n totalSize\n }: {\n containerSize: number;\n offset: number;\n totalSize: number;\n }): number {\n return totalSize <= containerSize\n ? 0\n : offset / (totalSize - containerSize);\n }\n\n _offsetToSafeOffset({\n containerSize,\n offset // unsafe\n }: ContainerSizeAndOffset): number {\n const totalSize = this._cellSizeAndPositionManager.getTotalSize();\n const safeTotalSize = this.getTotalSize();\n\n if (totalSize === safeTotalSize) {\n return offset;\n } else {\n const offsetPercentage = this._getOffsetPercentage({\n containerSize,\n offset,\n totalSize\n });\n\n return Math.round(offsetPercentage * (safeTotalSize - containerSize));\n }\n }\n\n _safeOffsetToOffset({\n containerSize,\n offset // safe\n }: ContainerSizeAndOffset): number {\n const totalSize = this._cellSizeAndPositionManager.getTotalSize();\n const safeTotalSize = this.getTotalSize();\n\n if (totalSize === safeTotalSize) {\n return offset;\n } else {\n const offsetPercentage = this._getOffsetPercentage({\n containerSize,\n offset,\n totalSize: safeTotalSize\n });\n\n return Math.round(offsetPercentage * (totalSize - containerSize));\n }\n }\n}\n","import type { ScalingCellSizeAndPositionManager } from \"./ScalingCellSizeAndPositionManager\";\n\n/**\n * Helper function that ensures that the scroll offset isn't past the last column/row of cells\n * after the size of the Grid (or its number of columns/rows) has decreased.\n */\n\ntype Params = {\n // Manages size and position metadata of cells\n cellSizeAndPositionManager: Pick<\n ScalingCellSizeAndPositionManager,\n \"getCellCount\" | \"getTotalSize\"\n >;\n\n // Previous number of rows or columns\n previousCellsCount: number;\n\n // Previous width or height of the virtualized container\n previousSize: number;\n\n // Current scrollLeft or scrollTop\n scrollOffset: number;\n\n // Width or height of the virtualized container\n size: number;\n\n // Callback to invoke with the index of the last cell\n updateScrollIndexCallback: (index: number) => void;\n};\n\nexport function updateScrollIndexHelper({\n cellSizeAndPositionManager,\n previousCellsCount,\n previousSize,\n scrollOffset,\n size,\n updateScrollIndexCallback\n}: Params) {\n const cellCount = cellSizeAndPositionManager.getCellCount();\n\n // If the size or number of children have decreased,\n // make sure we aren't scrolled too far past the current content.\n if (\n cellCount > 0 &&\n (size < previousSize || cellCount < previousCellsCount)\n ) {\n // We need to ensure that the current scroll offset is still within the collection's range.\n // To do this, we don't need to measure everything; CellMeasurer would perform poorly.\n // Just check to make sure we're still okay.\n // Only adjust the scroll position if we've scrolled below the last set of rows.\n if (scrollOffset > cellSizeAndPositionManager.getTotalSize() - size) {\n updateScrollIndexCallback(cellCount - 1);\n }\n }\n}\n","import clsx from \"clsx\";\nimport {\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useImperativeHandle,\n useInsertionEffect,\n useReducer,\n useState,\n useSyncExternalStore,\n type CSSProperties,\n type Dispatch,\n type MutableRefObject,\n type ReactNode,\n type UIEvent\n} from \"react\";\nimport { createCallbackMemoizer } from \"../../utils/createCallbackMemoizer\";\nimport { getUpdatedOffsetForIndex } from \"../../utils/getUpdatedOffsetForIndex\";\nimport {\n cancelAnimationTimeout,\n requestAnimationTimeout,\n type AnimationTimeoutId\n} from \"../../utils/requestAnimationTimeout\";\nimport { useIsomorphicLayoutEffect } from \"../../utils/useIsomorphicLayoutEffect\";\nimport type {\n ScrollElementLinkSource,\n ScrollElementLinkTarget,\n ScrollElementViewport\n} from \"../../utils/scrollElement/types\";\nimport { useMissingHeightWarning } from \"../../utils/scrollElement/useMissingHeightWarning\";\nimport { useScrollElementLink } from \"../../utils/scrollElement/useScrollElementLink\";\nimport { defaultGridProps } from \"./defaultGridProps\";\nimport {\n SCROLL_DIRECTION_BACKWARD,\n SCROLL_DIRECTION_FORWARD\n} from \"./defaultOverscanIndicesGetter\";\nimport type {\n Alignment,\n CellCache,\n CellSize,\n CellSizeGetter,\n GridImperativeAPI,\n GridProps,\n RenderedSection,\n Scroll,\n ScrollbarPresenceChange,\n StyleCache\n} from \"./types\";\nimport { ScalingCellSizeAndPositionManager } from \"./utils/ScalingCellSizeAndPositionManager\";\nimport { updateScrollIndexHelper } from \"./utils/updateScrollIndexHelper\";\n\n/**\n * Controls whether the Grid updates the DOM element's scrollLeft/scrollTop based on the current state or just observes it.\n * This prevents Grid from interrupting mouse-wheel animations (see issue #2).\n */\nconst SCROLL_POSITION_CHANGE_REASONS = {\n OBSERVED: \"observed\",\n REQUESTED: \"requested\"\n} as const;\n\ntype ScrollDirection = -1 | 1;\n\ntype ScrollState = {\n isScrolling: boolean;\n scrollDirectionHorizontal: ScrollDirection;\n scrollDirectionVertical: ScrollDirection;\n scrollLeft: number;\n scrollTop: number;\n scrollPositionChangeReason: \"observed\" | \"requested\" | null;\n};\n\nconst INITIAL_SCROLL_STATE: ScrollState = {\n isScrolling: false,\n scrollDirectionHorizontal: SCROLL_DIRECTION_FORWARD,\n scrollDirectionVertical: SCROLL_DIRECTION_FORWARD,\n scrollLeft: 0,\n scrollTop: 0,\n scrollPositionChangeReason: null\n};\n\n// Props read by the imperative methods.\n// They are updated in an insertion effect, so they are current when the methods are called during the commit phase\n// (e.g. by a CellMeasurer cell that mounts before the Grid's own layout effects run).\ntype LatestValues = {\n columnCount: number;\n height: number;\n onScroll: (params: Scroll) => void;\n rowCount: number;\n scrollbarSize: number;\n scrollbarSizeMeasured: boolean;\n scrollingResetTimeInterval: number;\n width: number;\n};\n\n// The props that the size managers (and the style/cell caches) were last updated for.\n// This is a render-time cache: it is updated while rendering, alongside the managers it describes,\n// so it is always consistent with them (even if a render is repeated or discarded).\ntype SizeInputs = {\n columnCount: number;\n columnSizeGetter: CellSizeGetter;\n columnWidth: CellSize;\n estimatedColumnSize: number;\n estimatedRowSize: number;\n rowCount: number;\n rowHeight: CellSize;\n rowSizeGetter: CellSizeGetter;\n};\n\n// Range of cells (including overscan) rendered by the most recent render; used to retain their cached styles\ntype RenderedRange = {\n columnStartIndex: number;\n columnStopIndex: number;\n rowStartIndex: number;\n rowStopIndex: number;\n};\n\n// Values of the most recently committed render, compared by the layout effect to detect changes\n// (the equivalent of the \"prevProps\"/\"prevState\" of the 9.x componentDidUpdate).\ntype CommittedValues = {\n columnCount: number;\n columnWidth: CellSize;\n height: number;\n rowCount: number;\n rowHeight: CellSize;\n scrollLeft: number;\n scrollTop: number;\n width: number;\n};\n\n// The viewport of the scroll element the Grid is linked to (its scrollElement prop; see useScrollElementLink),\n// and the direction its offset last moved in (for overscanning).\n// While linked, the Grid renders at its full height and is scrolled vertically by the scroll element.\ntype LinkState = {\n direction: ScrollDirection;\n viewport: ScrollElementViewport;\n};\n\ntype GridLink = LinkState & {\n source: ScrollElementLinkSource;\n};\n\n// Mutable, per-instance values (the equivalent of the instance fields of the 9.x class component).\n// Except for the render-time caches (see below), they are only modified by the imperative methods, event handlers and effects.\ntype GridInternals = {\n // Render-time caches (see SizeInputs); styles and (while scrolling) cells are cached by `${rowIndex}-${columnIndex}`\n cellCache: CellCache;\n cellCacheForceUpdateCount: number;\n cellCacheProps: GridProps | null;\n columnSizeAndPositionManager: ScalingCellSizeAndPositionManager;\n renderedRange: RenderedRange | null;\n rowSizeAndPositionManager: ScalingCellSizeAndPositionManager;\n sizeInputs: SizeInputs;\n styleCache: StyleCache;\n\n committed: CommittedValues | null;\n deferredInvalidateColumnIndex: number | null;\n deferredInvalidateRowIndex: number | null;\n disablePointerEventsTimeoutId: AnimationTimeoutId | null;\n element: HTMLDivElement | null;\n latest: LatestValues;\n\n // The scroll element the Grid is linked to (if any); updated by the link target methods (during commit or event handlers)\n link: GridLink | null;\n\n onGridRenderedMemoizer: ReturnType<typeof createCallbackMemoizer>;\n onScrollMemoizer: ReturnType<typeof createCallbackMemoizer>;\n scrollbarPresence: { horizontal: number; vertical: number };\n\n // The most recently requested scroll state (including updates that have not been rendered yet)\n scrollState: ScrollState;\n // Dispatches scroll state updates (the setter of the scrollState state); set once the Grid has been committed\n scrollStateDispatch: Dispatch<ScrollState> | null;\n\n // The scroll offsets rendered (as a shift of the inner container) during server rendering and hydration\n // still have to be applied to the scrolling element (see the layout effect)\n scrollOffsetsPendingHydration: boolean;\n};\n\ntype GridInstance = {\n handle: GridImperativeAPI;\n internals: GridInternals;\n invokeOnScrollMemoizer: (\n scrollLeft: number,\n scrollTop: number,\n totalColumnsWidth: number,\n totalRowsHeight: number\n ) => void;\n onScroll: (event: UIEvent<HTMLDivElement>) => void;\n setScrollState: (update: Partial<ScrollState>) => void;\n updateScrollLeftForColumn: (\n alignment: Alignment,\n columnIndex: number\n ) => void;\n updateScrollTopForRow: (alignment: Alignment, rowIndex: number) => void;\n linkTarget: ScrollElementLinkTarget;\n};\n\nconst increment = (value: number) => value + 1;\n\nconst subscribeToNothing = () => () => {};\n\n// The scrollbar size can't be measured during server rendering (or hydration)\nconst getServerScrollbarSize = () => undefined;\n\n// Whether the Grid is rendered on the client (true) or is being server-rendered or hydrated (false)\nconst getClientRendered = () => true;\nconst getServerRendered = () => false;\n\nfunction wrapSizeGetter(value: CellSize): CellSizeGetter {\n return typeof value === \"function\" ? value : () => value;\n}\n\nfunction isNumericSizeChange(prevSize: CellSize, nextSize: CellSize) {\n // Don't compare cell sizes if they are functions because inline functions would cause infinite loops.\n // In that event users should use the manual recompute methods to inform of changes.\n return (\n (typeof prevSize === \"number\" || typeof nextSize === \"number\") &&\n prevSize !== nextSize\n );\n}\n\nfunction createGridInstance(\n initialProps: Pick<\n GridProps,\n | \"columnCount\"\n | \"columnWidth\"\n | \"estimatedColumnSize\"\n | \"estimatedRowSize\"\n | \"initialScrollLeft\"\n | \"initialScrollTop\"\n | \"onScroll\"\n | \"rowCount\"\n | \"rowHeight\"\n | \"scrollingResetTimeInterval\"\n | \"width\"\n > &\n Required<\n Pick<\n GridProps,\n | \"estimatedColumnSize\"\n | \"estimatedRowSize\"\n | \"onScroll\"\n | \"scrollingResetTimeInterval\"\n >\n > & {\n // The height of the Grid (or, for a Grid with a scrollElement, of the scroll element's viewport)\n height: number;\n },\n setLinkState: Dispatch<LinkState | null>,\n forceUpdate: () => void\n): GridInstance {\n const {\n columnCount,\n columnWidth,\n estimatedColumnSize,\n estimatedRowSize,\n rowCount,\n rowHeight\n } = initialProps;\n\n const columnSizeGetter = wrapSizeGetter(columnWidth);\n const rowSizeGetter = wrapSizeGetter(rowHeight);\n\n const internals: GridInternals = {\n cellCache: {},\n cellCacheForceUpdateCount: 0,\n cellCacheProps: null,\n columnSizeAndPositionManager: new ScalingCellSizeAndPositionManager({\n cellCount: columnCount,\n cellSizeGetter: columnSizeGetter,\n estimatedCellSize:\n typeof columnWidth === \"number\" ? columnWidth : estimatedColumnSize\n }),\n renderedRange: null,\n rowSizeAndPositionManager: new ScalingCellSizeAndPositionManager({\n cellCount: rowCount,\n cellSizeGetter: rowSizeGetter,\n estimatedCellSize:\n typeof rowHeight === \"number\" ? rowHeight : estimatedRowSize\n }),\n sizeInputs: {\n columnCount,\n columnSizeGetter,\n columnWidth,\n estimatedColumnSize,\n estimatedRowSize,\n rowCount,\n rowHeight,\n rowSizeGetter\n },\n styleCache: {},\n\n committed: null,\n deferredInvalidateColumnIndex: null,\n deferredInvalidateRowIndex: null,\n disablePointerEventsTimeoutId: null,\n element: null,\n latest: {\n columnCount,\n height: initialProps.height,\n onScroll: initialProps.onScroll,\n rowCount,\n scrollbarSize: 0,\n scrollbarSizeMeasured: false,\n scrollingResetTimeInterval: initialProps.scrollingResetTimeInterval,\n width: initialProps.width\n },\n link: null,\n // Invokes onSectionRendered callback only when start/stop row or column indices change\n onGridRenderedMemoizer: createCallbackMemoizer(),\n onScrollMemoizer: createCallbackMemoizer(false),\n scrollbarPresence: { horizontal: 0, vertical: 0 },\n scrollState: INITIAL_SCROLL_STATE,\n scrollStateDispatch: null,\n scrollOffsetsPendingHydration: false\n };\n\n // The initial scroll offsets (e.g. for server rendering) are clamped to the scrollable range,\n // using the estimated sizes of the cells that haven't been measured yet.\n // (They are applied to the scrolling element when the Grid mounts; see the layout effect.)\n const { initialScrollLeft = 0, initialScrollTop = 0 } = initialProps;\n internals.scrollState = {\n ...INITIAL_SCROLL_STATE,\n scrollLeft: Math.max(\n 0,\n Math.min(\n initialScrollLeft,\n internals.columnSizeAndPositionManager.getTotalSize() -\n initialProps.width\n )\n ),\n scrollTop: Math.max(\n 0,\n Math.min(\n initialScrollTop,\n internals.rowSizeAndPositionManager.getTotalSize() - initialProps.height\n )\n )\n };\n\n const setScrollState = (update: Partial<ScrollState>) => {\n const prevState = internals.scrollState;\n let changed = false;\n for (const key in update) {\n if (\n update[key as keyof ScrollState] !== prevState[key as keyof ScrollState]\n ) {\n changed = true;\n break;\n }\n }\n if (changed) {\n const nextState = { ...prevState, ...update };\n internals.scrollState = nextState;\n internals.scrollStateDispatch?.(nextState);\n }\n };\n\n const getCalculatedScrollLeft = (\n alignment: Alignment,\n scrollToColumn: number,\n currentScrollLeft: number\n ): number => {\n const { columnCount, height, scrollbarSize, scrollbarSizeMeasured, width } =\n internals.latest;\n\n if (columnCount > 0) {\n const finalColumn = columnCount - 1;\n const targetIndex =\n scrollToColumn < 0\n ? finalColumn\n : Math.min(finalColumn, scrollToColumn);\n const totalRowsHeight =\n internals.rowSizeAndPositionManager.getTotalSize();\n const scrollBarSize =\n scrollbarSizeMeasured && totalRowsHeight > height ? scrollbarSize : 0;\n\n return internals.columnSizeAndPositionManager.getUpdatedOffsetForIndex({\n align: alignment,\n containerSize: width - scrollBarSize,\n currentOffset: currentScrollLeft,\n targetIndex\n });\n }\n return 0;\n };\n\n const getCalculatedScrollTop = (\n alignment: Alignment,\n scrollToRow: number,\n currentScrollTop: number\n ): number => {\n const { height, rowCount, scrollbarSize, scrollbarSizeMeasured, width } =\n internals.latest;\n\n if (rowCount > 0) {\n const finalRow = rowCount - 1;\n const targetIndex =\n scrollToRow < 0 ? finalRow : Math.min(finalRow, scrollToRow);\n const totalColumnsWidth =\n internals.columnSizeAndPositionManager.getTotalSize();\n const scrollBarSize =\n scrollbarSizeMeasured && totalColumnsWidth > width ? scrollbarSize : 0;\n const containerSize = height - scrollBarSize;\n const rowSizeAndPositionManager = internals.rowSizeAndPositionManager;\n\n // The viewport of a linked Grid (e.g. the window) may extend beyond the Grid itself (e.g. above or below it),\n // so its offset may be outside of the Grid's scrollable range (e.g. negative).\n // The offset isn't limited to the end of the Grid (e.g. so that the last rows can be scrolled to the top of the\n // viewport when there is content below the Grid); the scroll element limits it to its own scrollable range (#1895).\n // With \"auto\" alignment, a row that is already visible within the viewport is not scrolled to.\n if (\n internals.link !== null &&\n containerSize > 0 &&\n !rowSizeAndPositionManager.areOffsetsAdjusted()\n ) {\n const { offset, size } =\n rowSizeAndPositionManager.getSizeAndPositionOfCell(targetIndex);\n if (\n alignment === \"auto\" &&\n offset >= currentScrollTop &&\n offset + size <= currentScrollTop + containerSize\n ) {\n return currentScrollTop;\n }\n\n return getUpdatedOffsetForIndex({\n align: alignment,\n cellOffset: offset,\n cellSize: size,\n containerSize,\n currentOffset: currentScrollTop\n });\n }\n\n return rowSizeAndPositionManager.getUpdatedOffsetForIndex({\n align: alignment,\n containerSize,\n currentOffset: currentScrollTop,\n targetIndex\n });\n }\n return 0;\n };\n\n // The current vertical scroll offset: the Grid's own, or (if linked) the offset of the scroll element's viewport\n // (which may be negative; see ScrollElementViewport)\n const getCurrentScrollTop = () =>\n internals.link !== null\n ? internals.link.viewport.scrollTop\n : internals.scrollState.scrollTop;\n\n // Scrolls a linked Grid (i.e. its scroll element)\n const scrollLinkTo = (link: GridLink, scrollTop: number) => {\n link.source.scrollTo(scrollTop);\n };\n\n // Scrolls to the specified column (or to the last column, if the index is negative)\n const updateScrollLeftForColumn = (\n alignment: Alignment,\n columnIndex: number\n ) => {\n const { scrollLeft } = internals.scrollState;\n const calculatedScrollLeft = getCalculatedScrollLeft(\n alignment,\n columnIndex,\n scrollLeft\n );\n\n if (calculatedScrollLeft >= 0 && calculatedScrollLeft !== scrollLeft) {\n setScrollState({\n scrollDirectionHorizontal:\n calculatedScrollLeft > scrollLeft\n ? SCROLL_DIRECTION_FORWARD\n : SCROLL_DIRECTION_BACKWARD,\n scrollLeft: calculatedScrollLeft,\n scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED\n });\n }\n };\n\n // Scrolls to the specified row (or to the last row, if the index is negative)\n const updateScrollTopForRow = (alignment: Alignment, rowIndex: number) => {\n const scrollTop = getCurrentScrollTop();\n const calculatedScrollTop = getCalculatedScrollTop(\n alignment,\n rowIndex,\n scrollTop\n );\n\n const link = internals.link;\n if (link !== null) {\n if (calculatedScrollTop !== scrollTop) {\n scrollLinkTo(link, calculatedScrollTop);\n }\n return;\n }\n\n if (calculatedScrollTop >= 0 && calculatedScrollTop !== scrollTop) {\n setScrollState({\n scrollDirectionVertical:\n calculatedScrollTop > scrollTop\n ? SCROLL_DIRECTION_FORWARD\n : SCROLL_DIRECTION_BACKWARD,\n scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED,\n scrollTop: calculatedScrollTop\n });\n }\n };\n\n const invokeOnScrollMemoizer = (\n scrollLeft: number,\n scrollTop: number,\n totalColumnsWidth: number,\n totalRowsHeight: number\n ) => {\n internals.onScrollMemoizer({\n callback: ({ scrollLeft, scrollTop }) => {\n const { height, onScroll, width } = internals.latest;\n\n onScroll({\n clientHeight: height,\n clientWidth: width,\n scrollHeight: totalRowsHeight,\n scrollLeft,\n scrollTop,\n scrollWidth: totalColumnsWidth\n });\n },\n indices: {\n scrollLeft,\n scrollTop\n }\n });\n };\n\n const debounceScrollEndedCallback = () => {\n internals.disablePointerEventsTimeoutId = null;\n // isScrolling is used to determine if we reset styleCache\n setScrollState({ isScrolling: false });\n };\n\n /**\n * Sets an :isScrolling flag for a small window of time.\n * This flag is used to disable pointer events on the scrollable portion of the Grid.\n * This prevents jerky/stuttery mouse-wheel scrolling.\n */\n const debounceScrollEnded = () => {\n if (internals.disablePointerEventsTimeoutId) {\n cancelAnimationTimeout(internals.disablePointerEventsTimeoutId);\n }\n\n internals.disablePointerEventsTimeoutId = requestAnimationTimeout(\n debounceScrollEndedCallback,\n internals.latest.scrollingResetTimeInterval\n );\n };\n\n const handle: GridImperativeAPI = {\n forceUpdate() {\n forceUpdate();\n },\n\n getOffsetForCell({\n alignment = \"auto\",\n columnIndex = -1,\n rowIndex = -1\n } = {}) {\n const { scrollLeft } = internals.scrollState;\n\n return {\n scrollLeft: getCalculatedScrollLeft(alignment, columnIndex, scrollLeft),\n scrollTop: getCalculatedScrollTop(\n alignment,\n rowIndex,\n getCurrentScrollTop()\n )\n };\n },\n\n getTotalRowsHeight() {\n return internals.rowSizeAndPositionManager.getTotalSize();\n },\n\n getTotalColumnsWidth() {\n return internals.columnSizeAndPositionManager.getTotalSize();\n },\n\n handleScrollEvent({\n scrollLeft: scrollLeftParam = 0,\n scrollTop: scrollTopParam = 0\n }) {\n // On iOS, we can arrive at negative offsets by swiping past the start.\n // To prevent flicker here, we make playing in the negative offset zone cause nothing to happen.\n if (scrollTopParam < 0) {\n return;\n }\n\n // Prevent pointer events from interrupting a smooth scroll\n debounceScrollEnded();\n\n const { height, scrollbarSize, width } = internals.latest;\n const link = internals.link;\n\n // When this component is shrunk drastically, React dispatches a series of back-to-back scroll events,\n // Gradually converging on a scrollTop that is within the bounds of the new, smaller height.\n // This causes a series of rapid renders that is slow for long lists.\n // We can avoid that by doing some simple bounds checking to ensure that scroll offsets never exceed their bounds.\n const totalRowsHeight =\n internals.rowSizeAndPositionManager.getTotalSize();\n const totalColumnsWidth =\n internals.columnSizeAndPositionManager.getTotalSize();\n const scrollLeft = Math.min(\n Math.max(0, totalColumnsWidth - width + scrollbarSize),\n scrollLeftParam\n );\n const scrollTop = Math.min(\n Math.max(0, totalRowsHeight - height + scrollbarSize),\n scrollTopParam\n );\n\n // Certain devices (like Apple touchpad) rapid-fire duplicate events.\n // Don't force a re-render if this is the case.\n // The mouse may move faster then the animation frame does.\n // Use requestAnimationFrame to avoid over-updating.\n const prevState = internals.scrollState;\n if (\n prevState.scrollLeft !== scrollLeft ||\n prevState.scrollTop !== scrollTop\n ) {\n // Track scrolling direction so we can more efficiently overscan rows to reduce empty space around the edges while scrolling.\n // Don't change direction for an axis unless scroll offset has changed.\n const scrollDirectionHorizontal =\n scrollLeft !== prevState.scrollLeft\n ? scrollLeft > prevState.scrollLeft\n ? SCROLL_DIRECTION_FORWARD\n : SCROLL_DIRECTION_BACKWARD\n : prevState.scrollDirectionHorizontal;\n const scrollDirectionVertical =\n scrollTop !== prevState.scrollTop\n ? scrollTop > prevState.scrollTop\n ? SCROLL_DIRECTION_FORWARD\n : SCROLL_DIRECTION_BACKWARD\n : prevState.scrollDirectionVertical;\n\n const update: Partial<ScrollState> = {\n isScrolling: true,\n scrollDirectionHorizontal,\n scrollDirectionVertical,\n scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.OBSERVED\n };\n\n // A linked Grid is scrolled vertically by its scroll element (see setViewport), so the vertical offset is ignored.\n if (link === null) {\n update.scrollTop = scrollTop;\n }\n update.scrollLeft = scrollLeft;\n\n setScrollState(update);\n }\n\n invokeOnScrollMemoizer(\n scrollLeft,\n link !== null ? Math.max(0, link.viewport.scrollTop) : scrollTop,\n totalColumnsWidth,\n totalRowsHeight\n );\n },\n\n invalidateCellSizeAfterRender({ columnIndex, rowIndex }) {\n internals.deferredInvalidateColumnIndex =\n typeof internals.deferredInvalidateColumnIndex === \"number\"\n ? Math.min(internals.deferredInvalidateColumnIndex, columnIndex)\n : columnIndex;\n internals.deferredInvalidateRowIndex =\n typeof internals.deferredInvalidateRowIndex === \"number\"\n ? Math.min(internals.deferredInvalidateRowIndex, rowIndex)\n : rowIndex;\n },\n\n measureAllCells() {\n const { columnCount, rowCount } = internals.latest;\n if (columnCount > 0) {\n internals.columnSizeAndPositionManager.getSizeAndPositionOfCell(\n columnCount - 1\n );\n }\n if (rowCount > 0) {\n internals.rowSizeAndPositionManager.getSizeAndPositionOfCell(\n rowCount - 1\n );\n }\n },\n\n recomputeGridSize({ columnIndex = 0, rowIndex = 0 } = {}) {\n internals.columnSizeAndPositionManager.resetCell(columnIndex);\n internals.rowSizeAndPositionManager.resetCell(rowIndex);\n\n // Clear cell cache in case we are scrolling;\n // Invalid row heights likely mean invalid cached content as well.\n internals.styleCache = {};\n internals.cellCache = {};\n\n forceUpdate();\n },\n\n scrollToCell({ align = \"auto\", columnIndex, rowIndex }) {\n const { columnCount, height, width } = internals.latest;\n\n // This is a one-time scroll: the cell isn't kept in view afterwards (e.g. if cell sizes change).\n // Nothing is scrolled if the size is 0, since no cells are rendered in that case.\n if (height <= 0 || width <= 0) {\n return;\n }\n\n // Don't adjust scroll offset for single-column grids (eg List, Table).\n // This can cause a funky scroll offset because of the vertical scrollbar width.\n if (columnCount > 1 && columnIndex !== undefined && columnIndex >= 0) {\n updateScrollLeftForColumn(align, columnIndex);\n }\n\n if (rowIndex !== undefined && rowIndex >= 0) {\n updateScrollTopForRow(align, rowIndex);\n }\n },\n\n scrollToPosition({ scrollLeft, scrollTop }) {\n const { height, scrollbarSize, width } = internals.latest;\n const prevState = internals.scrollState;\n const update: Partial<ScrollState> = {};\n\n // Offsets are clamped the same way handleScrollEvent() clamps observed offsets,\n // so that an offset reported by this Grid (e.g. via onScroll) is never changed by passing it back.\n // (If the browser can't scroll quite as far, the offset is corrected after it has been applied; see the layout effect.)\n const totalRowsHeight =\n internals.rowSizeAndPositionManager.getTotalSize();\n const totalColumnsWidth =\n internals.columnSizeAndPositionManager.getTotalSize();\n\n if (typeof scrollLeft === \"number\" && !isNaN(scrollLeft)) {\n const clampedScrollLeft = Math.max(\n 0,\n Math.min(scrollLeft, totalColumnsWidth - width + scrollbarSize)\n );\n if (clampedScrollLeft !== prevState.scrollLeft) {\n update.scrollDirectionHorizontal =\n clampedScrollLeft > prevState.scrollLeft\n ? SCROLL_DIRECTION_FORWARD\n : SCROLL_DIRECTION_BACKWARD;\n update.scrollLeft = clampedScrollLeft;\n }\n }\n\n const link = internals.link;\n if (typeof scrollTop === \"number\" && !isNaN(scrollTop) && link !== null) {\n // A linked Grid scrolls its scroll element instead.\n // The current offset is clamped as well (it is reported that way by onScroll),\n // so that passing back a reported offset doesn't scroll (e.g. while the Grid is below the top of the viewport).\n const maxScrollTop = Math.max(0, totalRowsHeight - height);\n const clampedScrollTop = Math.max(0, Math.min(scrollTop, maxScrollTop));\n const currentScrollTop = Math.max(\n 0,\n Math.min(link.viewport.scrollTop, maxScrollTop)\n );\n if (clampedScrollTop !== currentScrollTop) {\n scrollLinkTo(link, clampedScrollTop);\n }\n } else if (typeof scrollTop === \"number\" && !isNaN(scrollTop)) {\n const clampedScrollTop = Math.max(\n 0,\n Math.min(scrollTop, totalRowsHeight - height + scrollbarSize)\n );\n if (clampedScrollTop !== prevState.scrollTop) {\n update.scrollDirectionVertical =\n clampedScrollTop > prevState.scrollTop\n ? SCROLL_DIRECTION_FORWARD\n : SCROLL_DIRECTION_BACKWARD;\n update.scrollTop = clampedScrollTop;\n }\n }\n\n // No-op (no state update or render) if the offsets haven't changed\n if (update.scrollLeft !== undefined || update.scrollTop !== undefined) {\n update.scrollPositionChangeReason =\n SCROLL_POSITION_CHANGE_REASONS.REQUESTED;\n setScrollState(update);\n }\n }\n };\n\n // Linked to the Grid's scroll element (if it has one) by useScrollElementLink\n const linkTarget: ScrollElementLinkTarget = {\n getElement() {\n return internals.element;\n },\n\n link(source, viewport) {\n if (source === null) {\n if (internals.link !== null) {\n internals.link = null;\n setLinkState(null);\n }\n return;\n }\n\n const direction = internals.link?.direction ?? SCROLL_DIRECTION_FORWARD;\n internals.link = { direction, source, viewport };\n setLinkState({ direction, viewport });\n },\n\n setViewport(viewport) {\n const link = internals.link;\n if (link === null) {\n return;\n }\n\n const prevViewport = link.viewport;\n if (\n prevViewport.height === viewport.height &&\n prevViewport.isScrolling === viewport.isScrolling &&\n prevViewport.scrollTop === viewport.scrollTop\n ) {\n return;\n }\n\n if (viewport.scrollTop !== prevViewport.scrollTop) {\n // Track the scrolling direction (for overscanning)\n link.direction =\n viewport.scrollTop > prevViewport.scrollTop\n ? SCROLL_DIRECTION_FORWARD\n : SCROLL_DIRECTION_BACKWARD;\n }\n\n link.viewport = viewport;\n setLinkState({ direction: link.direction, viewport });\n }\n };\n\n const onScroll = (event: UIEvent<HTMLDivElement>) => {\n // In certain edge-cases React dispatches an onScroll event with an invalid target.scrollLeft / target.scrollTop.\n // This invalid event can be detected by comparing event.target to this component's scrollable DOM element.\n // See issue #404 for more information.\n if (event.target === internals.element) {\n handle.handleScrollEvent(event.target as HTMLDivElement);\n }\n };\n\n return {\n handle,\n internals,\n linkTarget,\n invokeOnScrollMemoizer,\n onScroll,\n setScrollState,\n updateScrollLeftForColumn,\n updateScrollTopForRow\n };\n}\n\n/**\n * Updates the size managers (and invalidates the style and cell caches) after a size-related prop has changed.\n * This is the render-time part of the 9.x getDerivedStateFromProps.\n */\nfunction updateSizeInputs(internals: GridInternals, next: SizeInputs) {\n const prev = internals.sizeInputs;\n\n // Cached styles (and the cells rendered with them) are stale once cell sizes or counts change.\n // Counts matter too: a size getter may return different values for an index after rows are added or removed (bug #16).\n if (\n next.columnWidth !== prev.columnWidth ||\n next.rowHeight !== prev.rowHeight ||\n next.columnCount !== prev.columnCount ||\n next.rowCount !== prev.rowCount\n ) {\n internals.styleCache = {};\n internals.cellCache = {};\n }\n\n internals.columnSizeAndPositionManager.configure({\n cellCount: next.columnCount,\n estimatedCellSize:\n typeof next.columnWidth === \"number\"\n ? next.columnWidth\n : next.estimatedColumnSize,\n cellSizeGetter: next.columnSizeGetter\n });\n internals.rowSizeAndPositionManager.configure({\n cellCount: next.rowCount,\n estimatedCellSize:\n typeof next.rowHeight === \"number\"\n ? next.rowHeight\n : next.estimatedRowSize,\n cellSizeGetter: next.rowSizeGetter\n });\n\n // Cells are (re)measured along an axis whose count (or numeric cell size) has changed;\n // if either count was 0, along both axes.\n // (Cells along one axis may have been measured while the other count was 0, e.g. the columns of a MultiGrid quadrant without rows;\n // so they are also reset if the count stays 0. See #1351.)\n const eitherCountWasZero = prev.columnCount === 0 || prev.rowCount === 0;\n if (\n eitherCountWasZero ||\n prev.columnCount !== next.columnCount ||\n isNumericSizeChange(prev.columnWidth, next.columnWidth)\n ) {\n internals.columnSizeAndPositionManager.resetCell(0);\n }\n if (\n eitherCountWasZero ||\n prev.rowCount !== next.rowCount ||\n isNumericSizeChange(prev.rowHeight, next.rowHeight)\n ) {\n internals.rowSizeAndPositionManager.resetCell(0);\n }\n\n internals.sizeInputs = next;\n}\n\n// Shallowly compares props\nfunction areCellPropsEqual(prevProps: GridProps, nextProps: GridProps) {\n if (prevProps === nextProps) {\n return true;\n }\n\n const prev = prevProps as { [key: string]: unknown };\n const next = nextProps as { [key: string]: unknown };\n for (const key in prev) {\n if (prev[key] !== next[key]) {\n return false;\n }\n }\n for (const key in next) {\n if (!(key in prev)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Drops the cached styles (and cells) of cells that were not rendered by the previous render.\n * This keeps the caches from growing too large, while avoiding unnecessary re-renders of the visible cells.\n */\nfunction resetStyleCache(internals: GridInternals, keepCells: boolean) {\n const { cellCache, renderedRange, styleCache } = internals;\n\n // Reset cell and style caches once scrolling stops.\n // This makes Grid simpler to use (since cells commonly change).\n // And it keeps the caches from growing too large.\n // Performance is most sensitive when a user is scrolling.\n // Don't clear visible cells from cellCache if isScrollingOptOut is specified (and the cells are still current).\n // This keeps the cellCache to a resonable size.\n const nextCellCache: CellCache = {};\n const nextStyleCache: StyleCache = {};\n\n // Copy over the visible cell styles so avoid unnecessary re-render.\n if (renderedRange !== null) {\n for (\n let rowIndex = renderedRange.rowStartIndex;\n rowIndex <= renderedRange.rowStopIndex;\n rowIndex++\n ) {\n for (\n let columnIndex = renderedRange.columnStartIndex;\n columnIndex <= renderedRange.columnStopIndex;\n columnIndex++\n ) {\n const key = `${rowIndex}-${columnIndex}`;\n const style = styleCache[key];\n if (style !== undefined) {\n nextStyleCache[key] = style;\n }\n\n if (keepCells) {\n const cell = cellCache[key];\n if (cell !== undefined) {\n nextCellCache[key] = cell;\n }\n }\n }\n }\n }\n\n internals.cellCache = nextCellCache;\n internals.styleCache = nextStyleCache;\n}\n\n/**\n * Renders tabular data with virtualization along the vertical and horizontal axes.\n * Row heights and column widths must be known ahead of time and specified as properties.\n *\n * Scrolling is done through the imperative handle (`ref`): see `scrollToCell` and `scrollToPosition`.\n */\nexport const Grid = /* @__PURE__ */ memo(\n /* @__PURE__ */ forwardRef<GridImperativeAPI, GridProps>(\n function Grid(props, ref) {\n // (The props object itself is needed as well, to detect prop changes for isScrollingOptOut; see below.)\n const {\n \"aria-label\": ariaLabel = defaultGridProps[\"aria-label\"],\n \"aria-readonly\": ariaReadonly = defaultGridProps[\"aria-readonly\"],\n autoContainerWidth = defaultGridProps.autoContainerWidth,\n cellRangeRenderer = defaultGridProps.cellRangeRenderer,\n cellRenderer,\n className,\n columnCount,\n columnWidth,\n containerProps,\n containerRole = defaultGridProps.containerRole,\n containerStyle = defaultGridProps.containerStyle,\n deferredMeasurementCache,\n elementRef,\n estimatedColumnSize = defaultGridProps.estimatedColumnSize,\n estimatedRowSize = defaultGridProps.estimatedRowSize,\n getScrollbarSize = defaultGridProps.getScrollbarSize,\n height: heightProp,\n id,\n initialScrollLeft,\n initialScrollTop,\n isScrollingOptOut = defaultGridProps.isScrollingOptOut,\n noContentRenderer = defaultGridProps.noContentRenderer,\n onScroll = defaultGridProps.onScroll,\n onScrollbarPresenceChange = defaultGridProps.onScrollbarPresenceChange,\n onSectionRendered = defaultGridProps.onSectionRendered,\n overscanColumnCount = defaultGridProps.overscanColumnCount,\n overscanIndicesGetter = defaultGridProps.overscanIndicesGetter,\n overscanRowCount = defaultGridProps.overscanRowCount,\n role = defaultGridProps.role,\n rowCount,\n rowHeight,\n scrollElement,\n scrollingResetTimeInterval = defaultGridProps.scrollingResetTimeInterval,\n style = defaultGridProps.style,\n tabIndex = defaultGridProps.tabIndex,\n width\n } = props;\n\n const [linkState, setLinkState] = useState<LinkState | null>(null);\n const [forceUpdateCount, forceUpdate] = useReducer(increment, 0);\n\n // A Grid with a scrollElement is scrolled vertically by that element (e.g. the window) rather than scrolling itself:\n // it renders at its full height, and renders the rows within the scroll element's viewport.\n // (It may still scroll horizontally itself.)\n // Until the scroll element has been measured (e.g. during server rendering), the height prop is used as the viewport height.\n const linked = scrollElement !== undefined;\n const height =\n linkState !== null ? linkState.viewport.height : (heightProp ?? 0);\n\n useMissingHeightWarning(\"Grid\", heightProp, scrollElement);\n\n // The instance (and its stable imperative handle) is created once\n const [\n {\n handle,\n internals,\n invokeOnScrollMemoizer,\n onScroll: onScrollEvent,\n setScrollState,\n updateScrollLeftForColumn,\n updateScrollTopForRow,\n linkTarget\n }\n ] = useState(() =>\n createGridInstance(\n {\n columnCount,\n columnWidth,\n estimatedColumnSize,\n estimatedRowSize,\n height,\n initialScrollLeft,\n // The vertical offset of a Grid with a scrollElement is determined by the scroll element\n initialScrollTop: linked ? undefined : initialScrollTop,\n onScroll,\n rowCount,\n rowHeight,\n scrollingResetTimeInterval,\n width\n },\n setLinkState,\n forceUpdate\n )\n );\n\n // (Initialized with the initial scroll offsets; see createGridInstance)\n const [scrollState, setScrollStateDispatch] = useState<ScrollState>(\n () => internals.scrollState\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n\n useScrollElementLink(\n scrollElement,\n linkTarget,\n scrollingResetTimeInterval\n );\n\n // If this component is server-rendered (or hydrated), the scrollbar size is measured after hydration.\n const measuredScrollbarSize = useSyncExternalStore<number | undefined>(\n subscribeToNothing,\n getScrollbarSize,\n getServerScrollbarSize\n );\n const scrollbarSizeMeasured = measuredScrollbarSize !== undefined;\n const scrollbarSize = measuredScrollbarSize ?? 0;\n\n const latest: LatestValues = {\n columnCount,\n height,\n onScroll,\n rowCount,\n scrollbarSize,\n scrollbarSizeMeasured,\n scrollingResetTimeInterval,\n width\n };\n useInsertionEffect(() => {\n internals.latest = latest;\n internals.scrollStateDispatch = setScrollStateDispatch;\n });\n\n // The browser can't apply a scroll offset before the page has been hydrated.\n // So if the Grid is server-rendered (or hydrated) with initial scroll offsets,\n // its inner container is shifted by those offsets instead (so that the rendered cells are visible),\n // until the offsets have been applied to the scrolling element after hydration (see the layout effect).\n const clientRendered = useSyncExternalStore(\n subscribeToNothing,\n getClientRendered,\n getServerRendered\n );\n const [hydrationShift, setHydrationShift] = useState<{\n left: number;\n top: number;\n } | null>(() =>\n clientRendered ||\n (internals.scrollState.scrollLeft === 0 &&\n internals.scrollState.scrollTop === 0)\n ? null\n : {\n left: internals.scrollState.scrollLeft,\n top: internals.scrollState.scrollTop\n }\n );\n\n const setScrollingContainerRef = useCallback(\n (element: HTMLDivElement | null) => {\n internals.element = element;\n\n if (typeof elementRef === \"function\") {\n elementRef(element);\n } else if (elementRef) {\n (elementRef as MutableRefObject<HTMLDivElement | null>).current =\n element;\n }\n },\n [elementRef, internals]\n );\n\n // Update cell metadata (and invalidate cached styles) if cell counts or sizes have changed\n const sizeInputs = internals.sizeInputs;\n if (\n columnCount !== sizeInputs.columnCount ||\n columnWidth !== sizeInputs.columnWidth ||\n estimatedColumnSize !== sizeInputs.estimatedColumnSize ||\n rowCount !== sizeInputs.rowCount ||\n rowHeight !== sizeInputs.rowHeight ||\n estimatedRowSize !== sizeInputs.estimatedRowSize\n ) {\n updateSizeInputs(internals, {\n columnCount,\n columnSizeGetter:\n columnWidth === sizeInputs.columnWidth\n ? sizeInputs.columnSizeGetter\n : wrapSizeGetter(columnWidth),\n columnWidth,\n estimatedColumnSize,\n estimatedRowSize,\n rowCount,\n rowHeight,\n rowSizeGetter:\n rowHeight === sizeInputs.rowHeight\n ? sizeInputs.rowSizeGetter\n : wrapSizeGetter(rowHeight)\n });\n }\n\n const { columnSizeAndPositionManager, rowSizeAndPositionManager } =\n internals;\n\n const isScrolling =\n scrollState.isScrolling ||\n (linkState !== null && linkState.viewport.isScrolling);\n const scrollLeft = scrollState.scrollLeft;\n const scrollTop = linked\n ? Math.max(0, linkState?.viewport.scrollTop ?? 0)\n : scrollState.scrollTop;\n const scrollDirectionHorizontal = scrollState.scrollDirectionHorizontal;\n const scrollDirectionVertical =\n linkState !== null\n ? linkState.direction\n : scrollState.scrollDirectionVertical;\n\n // Reset the style cache (keeping the styles of the cells rendered last time) once scrolling has stopped.\n // (For a linked Grid, this includes the scrolling of its scroll element.)\n if (!isScrolling) {\n // With isScrollingOptOut, cached cells are kept as well; but only if they are still current (bug #13):\n // i.e. the props haven't changed (and forceUpdate() hasn't been called) since the cells were cached.\n const keepCells =\n isScrollingOptOut &&\n internals.cellCacheForceUpdateCount === forceUpdateCount &&\n internals.cellCacheProps !== null &&\n areCellPropsEqual(internals.cellCacheProps, props);\n\n resetStyleCache(internals, keepCells);\n\n internals.cellCacheProps = props;\n internals.cellCacheForceUpdateCount = forceUpdateCount;\n }\n\n let childrenToDisplay: ReactNode[] = [];\n let renderedSection: Partial<RenderedSection> | null = null;\n\n // Render only enough columns and rows to cover the visible area of the grid.\n if (height > 0 && width > 0) {\n const visibleColumnIndices =\n columnSizeAndPositionManager.getVisibleCellRange({\n containerSize: width,\n offset: scrollLeft\n });\n const visibleRowIndices = rowSizeAndPositionManager.getVisibleCellRange(\n {\n containerSize: height,\n offset: scrollTop\n }\n );\n\n const horizontalOffsetAdjustment =\n columnSizeAndPositionManager.getOffsetAdjustment({\n containerSize: width,\n offset: scrollLeft\n });\n const verticalOffsetAdjustment =\n rowSizeAndPositionManager.getOffsetAdjustment({\n containerSize: height,\n offset: scrollTop\n });\n\n const overscanColumnIndices = overscanIndicesGetter({\n direction: \"horizontal\",\n cellCount: columnCount,\n overscanCellsCount: overscanColumnCount,\n scrollDirection: scrollDirectionHorizontal,\n startIndex:\n typeof visibleColumnIndices.start === \"number\"\n ? visibleColumnIndices.start\n : 0,\n stopIndex:\n typeof visibleColumnIndices.stop === \"number\"\n ? visibleColumnIndices.stop\n : -1\n });\n\n const overscanRowIndices = overscanIndicesGetter({\n direction: \"vertical\",\n cellCount: rowCount,\n overscanCellsCount: overscanRowCount,\n scrollDirection: scrollDirectionVertical,\n startIndex:\n typeof visibleRowIndices.start === \"number\"\n ? visibleRowIndices.start\n : 0,\n stopIndex:\n typeof visibleRowIndices.stop === \"number\"\n ? visibleRowIndices.stop\n : -1\n });\n\n let columnStartIndex = overscanColumnIndices.overscanStartIndex;\n let columnStopIndex = overscanColumnIndices.overscanStopIndex;\n let rowStartIndex = overscanRowIndices.overscanStartIndex;\n let rowStopIndex = overscanRowIndices.overscanStopIndex;\n\n // Advanced use-cases (eg CellMeasurer) require batched measurements to determine accurate sizes.\n if (deferredMeasurementCache) {\n // If rows have a dynamic height, scan the rows we are about to render.\n // If any have not yet been measured, then we need to render all columns initially,\n // Because the height of the row is equal to the tallest cell within that row,\n // (And so we can't know the height without measuring all column-cells first).\n if (!deferredMeasurementCache.hasFixedHeight()) {\n for (\n let rowIndex = rowStartIndex;\n rowIndex <= rowStopIndex;\n rowIndex++\n ) {\n if (!deferredMeasurementCache.has(rowIndex, 0)) {\n columnStartIndex = 0;\n columnStopIndex = columnCount - 1;\n break;\n }\n }\n }\n\n // If columns have a dynamic width, scan the columns we are about to render.\n // If any have not yet been measured, then we need to render all rows initially,\n // Because the width of the column is equal to the widest cell within that column,\n // (And so we can't know the width without measuring all row-cells first).\n if (!deferredMeasurementCache.hasFixedWidth()) {\n for (\n let columnIndex = columnStartIndex;\n columnIndex <= columnStopIndex;\n columnIndex++\n ) {\n if (!deferredMeasurementCache.has(0, columnIndex)) {\n rowStartIndex = 0;\n rowStopIndex = rowCount - 1;\n break;\n }\n }\n }\n }\n\n childrenToDisplay = cellRangeRenderer({\n cellCache: internals.cellCache,\n cellRenderer,\n columnSizeAndPositionManager,\n columnStartIndex,\n columnStopIndex,\n deferredMeasurementCache,\n horizontalOffsetAdjustment,\n isScrolling,\n isScrollingOptOut,\n parent: handle,\n rowSizeAndPositionManager,\n rowStartIndex,\n rowStopIndex,\n scrollLeft,\n scrollTop,\n styleCache: internals.styleCache,\n verticalOffsetAdjustment,\n visibleColumnIndices,\n visibleRowIndices\n });\n\n // Retained by the next resetStyleCache()\n internals.renderedRange = {\n columnStartIndex,\n columnStopIndex,\n rowStartIndex,\n rowStopIndex\n };\n\n // Reported by onSectionRendered once committed.\n // Indices may be undefined (if no cells are visible); the memoizer skips the callback in that case.\n renderedSection = {\n columnOverscanStartIndex: columnStartIndex,\n columnOverscanStopIndex: columnStopIndex,\n columnStartIndex: visibleColumnIndices.start,\n columnStopIndex: visibleColumnIndices.stop,\n rowOverscanStartIndex: rowStartIndex,\n rowOverscanStopIndex: rowStopIndex,\n rowStartIndex: visibleRowIndices.start,\n rowStopIndex: visibleRowIndices.stop\n };\n }\n\n const totalColumnsWidth = columnSizeAndPositionManager.getTotalSize();\n const totalRowsHeight = rowSizeAndPositionManager.getTotalSize();\n\n // Force browser to hide scrollbars when we know they aren't necessary.\n // Otherwise once scrollbars appear they may not disappear again.\n // For more info see issue #116\n const verticalScrollBarSize =\n totalRowsHeight > height ? scrollbarSize : 0;\n const horizontalScrollBarSize =\n totalColumnsWidth > width ? scrollbarSize : 0;\n\n // Equivalent of the 9.x componentDidMount/componentDidUpdate\n useIsomorphicLayoutEffect(() => {\n const committed = internals.committed;\n const element = internals.element;\n\n // If cell sizes have been invalidated (eg we are using CellMeasurer) then reset cached positions.\n // We must do this at the start of the method as we may calculate and update scroll position below.\n if (\n typeof internals.deferredInvalidateColumnIndex === \"number\" &&\n typeof internals.deferredInvalidateRowIndex === \"number\"\n ) {\n const columnIndex = internals.deferredInvalidateColumnIndex;\n const rowIndex = internals.deferredInvalidateRowIndex;\n\n internals.deferredInvalidateColumnIndex = null;\n internals.deferredInvalidateRowIndex = null;\n\n handle.recomputeGridSize({ columnIndex, rowIndex });\n }\n\n if (committed === null && hydrationShift !== null) {\n // Hydrated with initial scroll offsets (rendered as a shift of the inner container; see above):\n // remove the shift, then apply the offsets to the scrolling element (on the next commit, before the browser paints).\n // If the user scrolled before the page was hydrated, the content they see is kept in place.\n internals.scrollOffsetsPendingHydration = true;\n setHydrationShift(null);\n if (element && (element.scrollLeft > 0 || element.scrollTop > 0)) {\n setScrollState({\n scrollLeft: hydrationShift.left + element.scrollLeft,\n scrollTop: hydrationShift.top + element.scrollTop\n });\n }\n } else if (committed === null) {\n // Mount\n if (element) {\n if (element.scrollLeft !== scrollState.scrollLeft) {\n element.scrollLeft = scrollState.scrollLeft;\n }\n if (element.scrollTop !== scrollState.scrollTop) {\n element.scrollTop = scrollState.scrollTop;\n }\n }\n } else {\n if (\n internals.scrollOffsetsPendingHydration &&\n hydrationShift === null\n ) {\n internals.scrollOffsetsPendingHydration = false;\n if (element) {\n element.scrollLeft = scrollState.scrollLeft;\n if (!linked) {\n element.scrollTop = scrollState.scrollTop;\n }\n }\n }\n\n // Handle edge case where column or row count has only just increased over 0.\n // In this case we may have to restore a previously-specified scroll offset.\n // For more info see bvaughn/react-virtualized/issues/218\n const columnOrRowCountJustIncreasedFromZero =\n (columnCount > 0 && committed.columnCount === 0) ||\n (rowCount > 0 && committed.rowCount === 0);\n\n // Make sure requested changes to :scrollLeft or :scrollTop get applied.\n // Assigning to scrollLeft/scrollTop tells the browser to interrupt any running scroll animations,\n // And to discard any pending async changes to the scroll position that may have happened in the meantime (e.g. on a separate scrolling thread).\n // So we only set these when we require an adjustment of the scroll position.\n // See issue #2 for more information.\n if (\n element &&\n scrollState.scrollPositionChangeReason ===\n SCROLL_POSITION_CHANGE_REASONS.REQUESTED\n ) {\n // @TRICKY A linked Grid leaves its vertical scroll offset to its scroll element.\n // In this case we should avoid checking scrollingContainer.scrollTop since it forces layout/flow.\n const update: Partial<ScrollState> = {};\n if (\n scrollState.scrollLeft >= 0 &&\n (scrollState.scrollLeft !== element.scrollLeft ||\n columnOrRowCountJustIncreasedFromZero)\n ) {\n element.scrollLeft = scrollState.scrollLeft;\n\n // If the browser couldn't scroll that far (e.g. its overflow is hidden by a custom style),\n // no scroll event is dispatched; so update the offset to match.\n if (Math.abs(element.scrollLeft - scrollState.scrollLeft) >= 1) {\n update.scrollLeft = element.scrollLeft;\n }\n }\n if (\n !linked &&\n scrollState.scrollTop >= 0 &&\n (scrollState.scrollTop !== element.scrollTop ||\n columnOrRowCountJustIncreasedFromZero)\n ) {\n element.scrollTop = scrollState.scrollTop;\n\n if (Math.abs(element.scrollTop - scrollState.scrollTop) >= 1) {\n update.scrollTop = element.scrollTop;\n }\n }\n if (\n update.scrollLeft !== undefined ||\n update.scrollTop !== undefined\n ) {\n update.scrollPositionChangeReason =\n SCROLL_POSITION_CHANGE_REASONS.OBSERVED;\n setScrollState(update);\n }\n }\n\n // If the Grid (or its number of cells) has shrunk, make sure it isn't scrolled past its last cell\n updateScrollIndexHelper({\n cellSizeAndPositionManager: columnSizeAndPositionManager,\n previousCellsCount: committed.columnCount,\n previousSize: committed.width,\n scrollOffset: scrollState.scrollLeft,\n size: width,\n updateScrollIndexCallback: (columnIndex) =>\n updateScrollLeftForColumn(\"auto\", columnIndex)\n });\n updateScrollIndexHelper({\n cellSizeAndPositionManager: rowSizeAndPositionManager,\n previousCellsCount: committed.rowCount,\n previousSize: committed.height,\n // The viewport of a linked Grid may extend past its end (e.g. the window may be scrolled past it),\n // so its offset doesn't need to be corrected when rows are removed\n scrollOffset: linked ? 0 : scrollState.scrollTop,\n size: height,\n updateScrollIndexCallback: (rowIndex) =>\n updateScrollTopForRow(\"auto\", rowIndex)\n });\n }\n\n // An empty Grid is scrolled back to the start\n if (\n (columnCount === 0 && scrollState.scrollLeft !== 0) ||\n (rowCount === 0 && scrollState.scrollTop !== 0)\n ) {\n setScrollState({ scrollLeft: 0, scrollTop: 0 });\n }\n\n // Update onSectionRendered callback if start/stop indices have changed\n if (renderedSection !== null) {\n internals.onGridRenderedMemoizer({\n callback: onSectionRendered,\n indices: renderedSection as RenderedSection\n });\n }\n\n // Initialize onScroll callback (on mount); changes to the scroll offsets should also notify onScroll listeners\n if (\n committed === null ||\n scrollLeft !== committed.scrollLeft ||\n scrollTop !== committed.scrollTop\n ) {\n invokeOnScrollMemoizer(\n scrollLeft,\n scrollTop,\n totalColumnsWidth,\n totalRowsHeight\n );\n }\n\n const { scrollbarPresence } = internals;\n if (\n horizontalScrollBarSize !== scrollbarPresence.horizontal ||\n verticalScrollBarSize !== scrollbarPresence.vertical\n ) {\n internals.scrollbarPresence = {\n horizontal: horizontalScrollBarSize,\n vertical: verticalScrollBarSize\n };\n\n const params: ScrollbarPresenceChange = {\n horizontal: horizontalScrollBarSize > 0,\n size: scrollbarSize,\n vertical: verticalScrollBarSize > 0\n };\n onScrollbarPresenceChange(params);\n }\n\n internals.committed = {\n columnCount,\n columnWidth,\n height,\n rowCount,\n rowHeight,\n scrollLeft,\n scrollTop,\n width\n };\n });\n\n useEffect(\n () => () => {\n if (internals.disablePointerEventsTimeoutId) {\n cancelAnimationTimeout(internals.disablePointerEventsTimeoutId);\n internals.disablePointerEventsTimeoutId = null;\n }\n },\n [internals]\n );\n\n const gridStyle: CSSProperties = {\n boxSizing: \"border-box\",\n direction: \"ltr\",\n // A linked Grid renders at its full height (it doesn't scroll vertically itself)\n height: linked ? \"auto\" : height,\n position: \"relative\",\n width,\n WebkitOverflowScrolling: \"touch\",\n willChange: \"transform\"\n };\n\n // Also explicitly init styles to 'auto' if scrollbars are required.\n // This works around an obscure edge case where external CSS styles have not yet been loaded,\n // But an initial scroll index of offset is set as an external prop.\n // Without this style, Grid would render the correct range of cells but would NOT update its internal offset.\n // This was originally reported via clauderic/react-infinite-calendar/issues/23\n gridStyle.overflowX =\n totalColumnsWidth + verticalScrollBarSize <= width ? \"hidden\" : \"auto\";\n gridStyle.overflowY =\n totalRowsHeight + horizontalScrollBarSize <= height ? \"hidden\" : \"auto\";\n\n const showNoContentRenderer =\n childrenToDisplay.length === 0 && height > 0 && width > 0;\n\n return (\n <div\n ref={setScrollingContainerRef}\n {...containerProps}\n aria-label={ariaLabel}\n aria-readonly={ariaReadonly}\n className={clsx(\"ReactVirtualized__Grid\", className)}\n id={id}\n onScroll={onScrollEvent}\n role={role}\n style={{\n ...gridStyle,\n ...style\n }}\n tabIndex={tabIndex as number | undefined}\n >\n {childrenToDisplay.length > 0 && (\n <div\n className=\"ReactVirtualized__Grid__innerScrollContainer\"\n role={containerRole}\n style={{\n width: autoContainerWidth ? \"auto\" : totalColumnsWidth,\n height: totalRowsHeight,\n maxWidth: totalColumnsWidth,\n maxHeight: totalRowsHeight,\n overflow: \"hidden\",\n pointerEvents: (isScrolling\n ? \"none\"\n : \"\") as CSSProperties[\"pointerEvents\"],\n position: \"relative\",\n ...(hydrationShift !== null && {\n marginLeft: -hydrationShift.left,\n marginTop: -hydrationShift.top\n }),\n ...containerStyle\n }}\n >\n {childrenToDisplay}\n </div>\n )}\n {showNoContentRenderer && noContentRenderer()}\n </div>\n );\n }\n )\n);\n","import type { InfiniteLoaderProps } from \"./types\";\n\n/**\n * Default values for `InfiniteLoader`'s optional props.\n */\nexport const defaultInfiniteLoaderProps = /* @__PURE__ */ Object.freeze({\n minimumBatchSize: 10,\n rowCount: 0,\n threshold: 15\n} as const satisfies Partial<InfiniteLoaderProps>);\n","import type {\n IndexRange,\n InfiniteLoaderChildInstance,\n InfiniteLoaderProps\n} from \"./types\";\n\n/**\n * Determines if the specified start/stop range is visible based on the most recently rendered range.\n */\nexport function isRangeVisible({\n lastRenderedStartIndex,\n lastRenderedStopIndex,\n startIndex,\n stopIndex\n}: {\n lastRenderedStartIndex: number;\n lastRenderedStopIndex: number;\n startIndex: number;\n stopIndex: number;\n}): boolean {\n return !(\n startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex\n );\n}\n\n/**\n * Returns all of the ranges within a larger range that contain unloaded rows.\n */\nexport function scanForUnloadedRanges({\n isRowLoaded,\n minimumBatchSize,\n rowCount,\n startIndex,\n stopIndex\n}: {\n isRowLoaded: InfiniteLoaderProps[\"isRowLoaded\"];\n minimumBatchSize: number;\n rowCount: number;\n startIndex: number;\n stopIndex: number;\n}): IndexRange[] {\n const unloadedRanges: IndexRange[] = [];\n\n let rangeStartIndex: number | null = null;\n let rangeStopIndex: number | null = null;\n\n for (let index = startIndex; index <= stopIndex; index++) {\n const loaded = isRowLoaded({ index });\n\n if (!loaded) {\n rangeStopIndex = index;\n if (rangeStartIndex === null) {\n rangeStartIndex = index;\n }\n } else if (rangeStopIndex !== null) {\n unloadedRanges.push({\n startIndex: rangeStartIndex!,\n stopIndex: rangeStopIndex\n });\n\n rangeStartIndex = rangeStopIndex = null;\n }\n }\n\n // If :rangeStopIndex is not null it means we haven't ran out of unloaded rows.\n // Scan forward to try filling our :minimumBatchSize.\n if (rangeStopIndex !== null) {\n const potentialStopIndex = Math.min(\n Math.max(rangeStopIndex, rangeStartIndex! + minimumBatchSize - 1),\n rowCount - 1\n );\n\n for (let index = rangeStopIndex + 1; index <= potentialStopIndex; index++) {\n if (!isRowLoaded({ index })) {\n rangeStopIndex = index;\n } else {\n break;\n }\n }\n\n unloadedRanges.push({\n startIndex: rangeStartIndex!,\n stopIndex: rangeStopIndex\n });\n }\n\n // Check to see if our first range ended prematurely.\n // In this case we should scan backwards to try filling our :minimumBatchSize.\n if (unloadedRanges.length) {\n const firstUnloadedRange = unloadedRanges[0];\n\n while (\n firstUnloadedRange.stopIndex - firstUnloadedRange.startIndex + 1 <\n minimumBatchSize &&\n firstUnloadedRange.startIndex > 0\n ) {\n const index = firstUnloadedRange.startIndex - 1;\n\n if (!isRowLoaded({ index })) {\n firstUnloadedRange.startIndex = index;\n } else {\n break;\n }\n }\n }\n\n return unloadedRanges;\n}\n\n/**\n * Since RV components skip re-rendering when their props haven't changed (`PureComponent`/`memo`),\n * a render must be forced once rows have loaded (even though props haven't changed).\n * The registered child may be a class instance (e.g. a 9.x-style component) or a function component's imperative handle,\n * and function components have no `forceUpdate()` method; so the first available method below is used:\n *\n * 1. `recomputeGridSize({ rowIndex })` (e.g. `Grid`, `List`, `Table`, `MultiGrid`)\n * 2. `recomputeRowHeights(index)` (e.g. `List`, `Table`)\n * 3. `forceUpdateGrid()` (e.g. `List`, `Table`)\n * 4. `forceUpdate()` (any class component)\n *\n * The recompute methods are preferred because, while a Grid is scrolling, its cells may be cached;\n * so it's important to invalidate that cache by recalculating sizes before forcing a re-render.\n * (Calling `forceUpdate()` on a `List` or `Table` would not re-render the inner `Grid`.)\n */\nexport function forceUpdateReactVirtualizedComponent(\n component: InfiniteLoaderChildInstance,\n currentIndex: number = 0\n) {\n if (typeof component.recomputeGridSize === \"function\") {\n component.recomputeGridSize({ rowIndex: currentIndex });\n } else if (typeof component.recomputeRowHeights === \"function\") {\n component.recomputeRowHeights(currentIndex);\n } else if (typeof component.forceUpdateGrid === \"function\") {\n component.forceUpdateGrid();\n } else if (typeof component.forceUpdate === \"function\") {\n component.forceUpdate();\n } else if (process.env.NODE_ENV !== \"production\") {\n console.warn(\n \"InfiniteLoader: the registered child does not implement recomputeGridSize(), recomputeRowHeights(), forceUpdateGrid() or forceUpdate(); it can't be re-rendered after rows have loaded.\"\n );\n }\n}\n","import {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useInsertionEffect,\n useMemo,\n useRef\n} from \"react\";\nimport { createCallbackMemoizer } from \"../../utils/createCallbackMemoizer\";\nimport type {\n IndexRange,\n InfiniteLoaderChildInstance,\n InfiniteLoaderImperativeAPI,\n InfiniteLoaderProps\n} from \"./types\";\nimport { defaultInfiniteLoaderProps } from \"./defaultInfiniteLoaderProps\";\nimport {\n forceUpdateReactVirtualizedComponent,\n isRangeVisible,\n scanForUnloadedRanges\n} from \"./utils\";\n\ntype LatestProps = Pick<InfiniteLoaderProps, \"isRowLoaded\" | \"loadMoreRows\"> & {\n minimumBatchSize: number;\n rowCount: number;\n threshold: number;\n};\n\n/**\n * Higher-order component that manages lazy-loading for \"infinite\" data.\n * This component decorates a virtual component and just-in-time prefetches rows as a user scrolls.\n * It is intended as a convenience component; fork it if you'd like finer-grained control over data-loading.\n */\nexport const InfiniteLoader = /* @__PURE__ */ memo(\n /* @__PURE__ */ forwardRef<InfiniteLoaderImperativeAPI, InfiniteLoaderProps>(\n function InfiniteLoader(\n {\n children,\n isRowLoaded,\n loadMoreRows,\n minimumBatchSize = defaultInfiniteLoaderProps.minimumBatchSize,\n rowCount = defaultInfiniteLoaderProps.rowCount,\n threshold = defaultInfiniteLoaderProps.threshold\n },\n ref\n ) {\n // The registered child calls onRowsRendered from its own commit phase (e.g. componentDidMount/componentDidUpdate),\n // which runs before this component's layout effects; so the latest props are stored in an insertion effect,\n // which runs before any layout effects (without mutating anything during render).\n const latestPropsRef = useRef<LatestProps>({\n isRowLoaded,\n loadMoreRows,\n minimumBatchSize,\n rowCount,\n threshold\n });\n useInsertionEffect(() => {\n latestPropsRef.current = {\n isRowLoaded,\n loadMoreRows,\n minimumBatchSize,\n rowCount,\n threshold\n };\n });\n\n const lastRenderedRangeRef = useRef<{\n startIndex: number | undefined;\n stopIndex: number | undefined;\n }>({ startIndex: undefined, stopIndex: undefined });\n const loadMoreRowsMemoizerRef = useRef<ReturnType<\n typeof createCallbackMemoizer\n > | null>(null);\n const registeredChildRef = useRef<InfiniteLoaderChildInstance | null>(\n null\n );\n\n const getLoadMoreRowsMemoizer = useCallback(() => {\n if (loadMoreRowsMemoizerRef.current === null) {\n loadMoreRowsMemoizerRef.current = createCallbackMemoizer();\n }\n return loadMoreRowsMemoizerRef.current;\n }, []);\n\n const loadUnloadedRanges = useCallback((unloadedRanges: IndexRange[]) => {\n const { loadMoreRows } = latestPropsRef.current;\n\n unloadedRanges.forEach((unloadedRange) => {\n const promise = loadMoreRows(unloadedRange);\n if (promise) {\n promise.then(() => {\n // Refresh the visible rows if any of them have just been loaded.\n // Otherwise they will remain in their unloaded visual state.\n // (If the child has been unmounted, it is no longer registered and nothing is updated.)\n const { startIndex, stopIndex } = lastRenderedRangeRef.current;\n if (\n isRangeVisible({\n lastRenderedStartIndex: startIndex as number,\n lastRenderedStopIndex: stopIndex as number,\n startIndex: unloadedRange.startIndex,\n stopIndex: unloadedRange.stopIndex\n })\n ) {\n const registeredChild = registeredChildRef.current;\n if (registeredChild) {\n forceUpdateReactVirtualizedComponent(\n registeredChild,\n startIndex\n );\n }\n }\n });\n }\n });\n }, []);\n\n const loadRange = useCallback(\n (startIndex: number, stopIndex: number) => {\n const { isRowLoaded, minimumBatchSize, rowCount, threshold } =\n latestPropsRef.current;\n\n const unloadedRanges = scanForUnloadedRanges({\n isRowLoaded,\n minimumBatchSize,\n rowCount,\n startIndex: Math.max(0, startIndex - threshold),\n stopIndex: Math.min(rowCount - 1, stopIndex + threshold)\n });\n\n // For memoize comparison\n const squashedUnloadedRanges = ([] as number[]).concat(\n ...unloadedRanges.map(({ startIndex, stopIndex }) => [\n startIndex,\n stopIndex\n ])\n );\n\n getLoadMoreRowsMemoizer()({\n callback: () => {\n loadUnloadedRanges(unloadedRanges);\n },\n indices: { squashedUnloadedRanges }\n });\n },\n [getLoadMoreRowsMemoizer, loadUnloadedRanges]\n );\n\n const onRowsRendered = useCallback(\n ({ startIndex, stopIndex }: IndexRange) => {\n lastRenderedRangeRef.current = { startIndex, stopIndex };\n\n loadRange(startIndex, stopIndex);\n },\n [loadRange]\n );\n\n const registerChild = useCallback(\n (registeredChild: InfiniteLoaderChildInstance | null) => {\n registeredChildRef.current = registeredChild;\n },\n []\n );\n\n // The handle object is created once, so it stays stable even if the ref itself changes.\n const imperativeHandle = useMemo<InfiniteLoaderImperativeAPI>(\n () => ({\n resetLoadMoreRowsCache(autoReload?: boolean) {\n loadMoreRowsMemoizerRef.current = createCallbackMemoizer();\n\n if (autoReload) {\n const { startIndex, stopIndex } = lastRenderedRangeRef.current;\n loadRange(startIndex as number, stopIndex as number);\n }\n }\n }),\n [loadRange]\n );\n useImperativeHandle(ref, () => imperativeHandle, [imperativeHandle]);\n\n return children({\n onRowsRendered,\n registerChild\n });\n }\n )\n);\n","import { accessibilityOverscanIndicesGetter } from \"../Grid/accessibilityOverscanIndicesGetter\";\nimport type { ListProps } from \"./types\";\n\ntype DefaultedPropKeys =\n | \"estimatedRowSize\"\n | \"noRowsRenderer\"\n | \"onRowsRendered\"\n | \"onScroll\"\n | \"overscanIndicesGetter\"\n | \"overscanRowCount\"\n | \"role\"\n | \"style\"\n | \"tabIndex\";\n\nconst noop = () => {};\n\n/**\n * Default values for `List`'s optional props.\n * (The PURE annotations let bundlers drop this object if it isn't used.)\n */\nexport const defaultListProps: Readonly<\n Required<Pick<ListProps, DefaultedPropKeys>>\n> = /* @__PURE__ */ Object.freeze({\n estimatedRowSize: 30,\n noRowsRenderer: () => null,\n onRowsRendered: noop,\n onScroll: noop,\n overscanIndicesGetter: accessibilityOverscanIndicesGetter,\n overscanRowCount: 10,\n role: \"list\",\n style: /* @__PURE__ */ Object.freeze({}),\n tabIndex: 0\n});\n","import type { CellPosition, GridImperativeAPI } from \"../components/Grid/types\";\n\nexport type InnerGridRef = {\n /** The inner Grid's handle (once its ref has been attached). */\n getGrid: () => GridImperativeAPI | null;\n\n /** Ref callback for the inner Grid. */\n setGridRef: (grid: GridImperativeAPI | null) => void;\n\n /** Calls the Grid's `invalidateCellSizeAfterRender`, or keeps the call until the Grid's ref has been attached. */\n invalidateCellSizeAfterRender: (cell: CellPosition) => void;\n\n /** Calls the Grid's `recomputeGridSize`, or keeps the call until the Grid's ref has been attached. */\n recomputeGridSize: (cell: CellPosition) => void;\n};\n\n// Merges two cell positions into the one that covers both (i.e. the smallest indices)\nconst mergeCellPositions = (\n prev: CellPosition | null,\n next: CellPosition\n): CellPosition =>\n prev === null\n ? next\n : {\n columnIndex: Math.min(prev.columnIndex, next.columnIndex),\n rowIndex: Math.min(prev.rowIndex, next.rowIndex)\n };\n\n/**\n * Tracks the inner Grid of a component that wraps one (e.g. List or Table, whose handles delegate to the Grid).\n *\n * When the wrapper mounts, its cells (e.g. CellMeasurer) run their layout effects before the inner Grid's handle\n * is attached to the wrapper's ref (the refs of parents are attached after the effects of their children run).\n * Cell size invalidations and recomputations requested in the meantime are kept (merged to the smallest indices)\n * and passed on to the Grid once its ref has been attached.\n * (The Grid attaches its handle before running its own layout effect, which then processes the invalidations.)\n */\nexport function createInnerGridRef(): InnerGridRef {\n let grid: GridImperativeAPI | null = null;\n let pendingInvalidation: CellPosition | null = null;\n let pendingRecomputation: CellPosition | null = null;\n\n return {\n getGrid: () => grid,\n\n setGridRef(value) {\n grid = value;\n if (grid === null) {\n return;\n }\n\n if (pendingRecomputation !== null) {\n const cell = pendingRecomputation;\n pendingRecomputation = null;\n grid.recomputeGridSize(cell);\n }\n if (pendingInvalidation !== null) {\n const cell = pendingInvalidation;\n pendingInvalidation = null;\n grid.invalidateCellSizeAfterRender(cell);\n }\n },\n\n invalidateCellSizeAfterRender(cell) {\n if (grid !== null) {\n grid.invalidateCellSizeAfterRender(cell);\n } else {\n pendingInvalidation = mergeCellPositions(pendingInvalidation, cell);\n }\n },\n\n recomputeGridSize(cell) {\n if (grid !== null) {\n grid.recomputeGridSize(cell);\n } else {\n pendingRecomputation = mergeCellPositions(pendingRecomputation, cell);\n }\n }\n };\n}\n","import clsx from \"clsx\";\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n memo,\n useCallback,\n useImperativeHandle,\n useState,\n type ReactElement\n} from \"react\";\nimport { createInnerGridRef } from \"../../utils/createInnerGridRef\";\nimport { useMissingHeightWarning } from \"../../utils/scrollElement/useMissingHeightWarning\";\nimport { Grid } from \"../Grid/Grid\";\nimport type {\n CellRendererParams,\n GridImperativeAPI,\n Scroll as GridScroll,\n RenderedSection\n} from \"../Grid/types\";\nimport { defaultListProps } from \"./defaultListProps\";\nimport type { ListImperativeAPI, ListProps } from \"./types\";\n\n/**\n * It is inefficient to create and manage a large list of DOM elements within a scrolling container\n * if only a few of those elements are visible. The primary purpose of this component is to improve\n * performance by only rendering the DOM nodes that a user is able to see based on their current\n * scroll position.\n *\n * This component renders a virtualized list of elements with either fixed or dynamic heights.\n */\nexport const List = /* @__PURE__ */ memo(\n /* @__PURE__ */ forwardRef<ListImperativeAPI, ListProps>(\n function List(props, ref) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-readonly\": ariaReadonly,\n className,\n containerRole,\n estimatedRowSize = defaultListProps.estimatedRowSize,\n noRowsRenderer = defaultListProps.noRowsRenderer,\n onRowsRendered = defaultListProps.onRowsRendered,\n onScroll = defaultListProps.onScroll,\n overscanIndicesGetter = defaultListProps.overscanIndicesGetter,\n overscanRowCount = defaultListProps.overscanRowCount,\n role = defaultListProps.role,\n rowRenderer,\n style = defaultListProps.style,\n tabIndex = defaultListProps.tabIndex,\n height,\n scrollElement,\n width,\n ...rest\n } = props;\n\n // The imperative handle is created once (it reads the inner Grid through a ref)\n const [{ handle, setGridRef }] = useState(createListInstance);\n\n useImperativeHandle(ref, () => handle, [handle]);\n\n useMissingHeightWarning(\"List\", height, scrollElement);\n\n // With role=\"list\" (the default), the rows are list items within the list (#1657);\n // otherwise (e.g. role=\"grid\"), the Grid's roles and ARIA defaults apply.\n const isList = role === \"list\";\n\n const cellRenderer = useCallback(\n ({\n isScrolling,\n isVisible,\n key,\n rowIndex,\n style: cellStyle\n }: CellRendererParams) => {\n // TRICKY The style object is sometimes cached by Grid.\n // This prevents new style objects from bypassing shallowCompare().\n // However as of React 16, style props are auto-frozen (at least in dev mode)\n // Check to make sure we can still modify the style before proceeding.\n // https://github.com/facebook/react/commit/977357765b44af8ff0cfea327866861073095c12#commitcomment-20648713\n const widthDescriptor = Object.getOwnPropertyDescriptor(\n cellStyle,\n \"width\"\n );\n if (widthDescriptor && widthDescriptor.writable) {\n // By default, List cells should be 100% width.\n // This prevents them from flowing under a scrollbar (if present).\n cellStyle.width = \"100%\";\n }\n\n const row = rowRenderer({\n index: rowIndex,\n isScrolling,\n isVisible,\n key,\n parent: handle,\n style: cellStyle\n });\n\n // (Grid gives a row without a role the \"gridcell\" role)\n if (\n isList &&\n isValidElement<{ role?: string }>(row) &&\n !row.props.role\n ) {\n return cloneElement(row as ReactElement<{ role?: string }>, {\n role: \"listitem\"\n });\n }\n return row;\n },\n [handle, isList, rowRenderer]\n );\n\n const onGridScroll = useCallback(\n ({ clientHeight, scrollHeight, scrollTop }: GridScroll) => {\n onScroll({ clientHeight, scrollHeight, scrollTop });\n },\n [onScroll]\n );\n\n const onSectionRendered = useCallback(\n ({\n rowOverscanStartIndex,\n rowOverscanStopIndex,\n rowStartIndex,\n rowStopIndex\n }: RenderedSection) => {\n onRowsRendered({\n overscanStartIndex: rowOverscanStartIndex,\n overscanStopIndex: rowOverscanStopIndex,\n startIndex: rowStartIndex,\n stopIndex: rowStopIndex\n });\n },\n [onRowsRendered]\n );\n\n return (\n <Grid\n {...rest}\n // null (rather than undefined) so that the Grid's defaults for a grid are not used\n aria-label={\n ariaLabel ?? (isList ? (null as unknown as string) : undefined)\n }\n aria-readonly={\n ariaReadonly ?? (isList ? (null as unknown as boolean) : undefined)\n }\n autoContainerWidth\n cellRenderer={cellRenderer}\n className={clsx(\"ReactVirtualized__List\", className)}\n columnCount={1}\n columnWidth={width}\n containerRole={containerRole ?? (isList ? \"presentation\" : undefined)}\n estimatedRowSize={estimatedRowSize}\n // (A missing height is reported by the List itself; see above)\n height={height ?? (scrollElement === undefined ? 0 : undefined)}\n noContentRenderer={noRowsRenderer}\n onScroll={onGridScroll}\n onSectionRendered={onSectionRendered}\n overscanIndicesGetter={overscanIndicesGetter}\n overscanRowCount={overscanRowCount}\n ref={setGridRef}\n role={role}\n scrollElement={scrollElement}\n style={style}\n tabIndex={tabIndex}\n width={width}\n />\n );\n }\n )\n);\n\ntype ListInstance = {\n handle: ListImperativeAPI;\n setGridRef: (grid: GridImperativeAPI | null) => void;\n};\n\n// Creates the (stable) imperative handle of a List (every method delegates to the inner Grid)\n// and the ref callback for the inner Grid.\nfunction createListInstance(): ListInstance {\n // (Keeps cell size invalidations requested by rows while the List is mounting; see createInnerGridRef)\n const innerGrid = createInnerGridRef();\n const { getGrid } = innerGrid;\n\n const handle: ListImperativeAPI = {\n forceUpdateGrid() {\n getGrid()?.forceUpdate();\n },\n\n getOffsetForRow({ align, alignment, index } = {}) {\n const grid = getGrid();\n if (grid) {\n const { scrollTop } = grid.getOffsetForCell({\n alignment: align ?? alignment,\n columnIndex: 0,\n rowIndex: index\n });\n\n return scrollTop;\n }\n return 0;\n },\n\n invalidateCellSizeAfterRender({ columnIndex, rowIndex }) {\n innerGrid.invalidateCellSizeAfterRender({ columnIndex, rowIndex });\n },\n\n measureAllRows() {\n getGrid()?.measureAllCells();\n },\n\n recomputeGridSize({ columnIndex = 0, rowIndex = 0 } = {}) {\n innerGrid.recomputeGridSize({ columnIndex, rowIndex });\n },\n\n recomputeRowHeights(index = 0) {\n innerGrid.recomputeGridSize({ columnIndex: 0, rowIndex: index });\n },\n\n scrollToCell({ align, columnIndex, rowIndex }) {\n getGrid()?.scrollToCell({ align, columnIndex, rowIndex });\n },\n\n scrollToPosition({ scrollTop }) {\n getGrid()?.scrollToPosition({ scrollTop });\n },\n\n scrollToRow({ align, index }) {\n getGrid()?.scrollToCell({ align, columnIndex: 0, rowIndex: index });\n }\n };\n\n return { handle, setGridRef: innerGrid.setGridRef };\n}\n","/**\n * Specifies the number of milliseconds during which to disable pointer events while a scroll is in progress.\n * This improves performance and makes scrolling smoother.\n */\nexport const DEFAULT_SCROLLING_RESET_TIME_INTERVAL = 150;\n","import { DEFAULT_SCROLLING_RESET_TIME_INTERVAL } from \"./constants\";\nimport type { MasonryProps } from \"./types\";\n\ntype DefaultedPropKeys =\n | \"keyMapper\"\n | \"onCellsRendered\"\n | \"onScroll\"\n | \"overscanByPixels\"\n | \"role\"\n | \"rowDirection\"\n | \"scrollingResetTimeInterval\"\n | \"style\"\n | \"tabIndex\";\n\nconst noop = () => {};\n\n/**\n * Default values for `Masonry`'s optional props.\n * (The PURE annotations let bundlers drop this object if it isn't used.)\n */\nexport const defaultMasonryProps: Readonly<{\n [Key in DefaultedPropKeys]-?: NonNullable<MasonryProps[Key]>;\n}> = /* @__PURE__ */ Object.freeze({\n keyMapper: (index: number) => index,\n onCellsRendered: noop,\n onScroll: noop,\n overscanByPixels: 20,\n role: \"grid\",\n rowDirection: \"ltr\",\n scrollingResetTimeInterval: DEFAULT_SCROLLING_RESET_TIME_INTERVAL,\n style: /* @__PURE__ */ Object.freeze({}),\n tabIndex: 0\n});\n","import type {\n CellPositioner,\n CellPositionerResetParams,\n CreateCellPositionerParams,\n Position\n} from \"./types\";\n\n/**\n * Creates a simple `Masonry` cell positioner that always inserts a cell into the shortest column.\n */\nexport function createCellPositioner({\n cellMeasurerCache,\n columnCount,\n columnWidth,\n spacer = 0\n}: CreateCellPositionerParams): CellPositioner {\n let columnHeights: number[];\n\n initOrResetDerivedValues();\n\n function cellPositioner(index: number): Position {\n // Find the shortest column and use it.\n let columnIndex = 0;\n for (let i = 1; i < columnHeights.length; i++) {\n if (columnHeights[i] < columnHeights[columnIndex]) {\n columnIndex = i;\n }\n }\n\n const left = columnIndex * (columnWidth + spacer);\n const top = columnHeights[columnIndex] || 0;\n\n columnHeights[columnIndex] =\n top + cellMeasurerCache.getHeight(index) + spacer;\n\n return {\n left,\n top\n };\n }\n\n function initOrResetDerivedValues(): void {\n // Track the height of each column.\n // Layout algorithm below always inserts into the shortest column.\n columnHeights = [];\n for (let i = 0; i < columnCount; i++) {\n columnHeights[i] = 0;\n }\n }\n\n function reset(params: CellPositionerResetParams): void {\n columnCount = params.columnCount;\n columnWidth = params.columnWidth;\n spacer = params.spacer ?? 0;\n\n initOrResetDerivedValues();\n }\n\n cellPositioner.reset = reset;\n\n return cellPositioner;\n}\n","/**\n * Binary Search Bounds\n * https://github.com/mikolalysenko/binary-search-bounds\n * Mikola Lysenko\n *\n * Inlined because of Content Security Policy issue caused by the use of `new Function(...)` syntax.\n * Issue reported here: https://github.com/mikolalysenko/binary-search-bounds/issues/5\n **/\n\ntype Compare<T, Y> = (a: T, b: Y) => number;\n\n/**\n * Searches a sorted array, optionally within the inclusive [lo, hi] index range.\n * Either uses the natural ordering of the values, or the specified comparator.\n */\nexport type BoundsSearch = {\n <T>(array: ArrayLike<T>, value: T, lo?: number, hi?: number): number;\n <T, Y>(\n array: ArrayLike<T>,\n value: Y,\n compare: Compare<T, Y>,\n lo?: number,\n hi?: number\n ): number;\n};\n\nfunction _GEA<T>(a: ArrayLike<T>, l: number, h: number, y: T): number {\n let i = h + 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (x >= y) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n}\nfunction _GEP<T, Y>(\n a: ArrayLike<T>,\n l: number,\n h: number,\n y: Y,\n c: Compare<T, Y>\n): number {\n let i = h + 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (c(x, y) >= 0) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n}\nfunction dispatchBsearchGE<T, Y>(\n a: ArrayLike<T>,\n y: T | Y,\n c?: Compare<T, Y> | number,\n l?: number,\n h?: number\n): number {\n if (typeof c === \"function\") {\n return _GEP(\n a,\n l === void 0 ? 0 : l | 0,\n h === void 0 ? a.length - 1 : h | 0,\n y as Y,\n c\n );\n } else {\n return _GEA(\n a,\n c === void 0 ? 0 : c | 0,\n l === void 0 ? a.length - 1 : l | 0,\n y as T\n );\n }\n}\n\nfunction _GTA<T>(a: ArrayLike<T>, l: number, h: number, y: T): number {\n let i = h + 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (x > y) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n}\nfunction _GTP<T, Y>(\n a: ArrayLike<T>,\n l: number,\n h: number,\n y: Y,\n c: Compare<T, Y>\n): number {\n let i = h + 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (c(x, y) > 0) {\n i = m;\n h = m - 1;\n } else {\n l = m + 1;\n }\n }\n return i;\n}\nfunction dispatchBsearchGT<T, Y>(\n a: ArrayLike<T>,\n y: T | Y,\n c?: Compare<T, Y> | number,\n l?: number,\n h?: number\n): number {\n if (typeof c === \"function\") {\n return _GTP(\n a,\n l === void 0 ? 0 : l | 0,\n h === void 0 ? a.length - 1 : h | 0,\n y as Y,\n c\n );\n } else {\n return _GTA(\n a,\n c === void 0 ? 0 : c | 0,\n l === void 0 ? a.length - 1 : l | 0,\n y as T\n );\n }\n}\n\nfunction _LTA<T>(a: ArrayLike<T>, l: number, h: number, y: T): number {\n let i = l - 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (x < y) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n}\nfunction _LTP<T, Y>(\n a: ArrayLike<T>,\n l: number,\n h: number,\n y: Y,\n c: Compare<T, Y>\n): number {\n let i = l - 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (c(x, y) < 0) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n}\nfunction dispatchBsearchLT<T, Y>(\n a: ArrayLike<T>,\n y: T | Y,\n c?: Compare<T, Y> | number,\n l?: number,\n h?: number\n): number {\n if (typeof c === \"function\") {\n return _LTP(\n a,\n l === void 0 ? 0 : l | 0,\n h === void 0 ? a.length - 1 : h | 0,\n y as Y,\n c\n );\n } else {\n return _LTA(\n a,\n c === void 0 ? 0 : c | 0,\n l === void 0 ? a.length - 1 : l | 0,\n y as T\n );\n }\n}\n\nfunction _LEA<T>(a: ArrayLike<T>, l: number, h: number, y: T): number {\n let i = l - 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (x <= y) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n}\nfunction _LEP<T, Y>(\n a: ArrayLike<T>,\n l: number,\n h: number,\n y: Y,\n c: Compare<T, Y>\n): number {\n let i = l - 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (c(x, y) <= 0) {\n i = m;\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return i;\n}\nfunction dispatchBsearchLE<T, Y>(\n a: ArrayLike<T>,\n y: T | Y,\n c?: Compare<T, Y> | number,\n l?: number,\n h?: number\n): number {\n if (typeof c === \"function\") {\n return _LEP(\n a,\n l === void 0 ? 0 : l | 0,\n h === void 0 ? a.length - 1 : h | 0,\n y as Y,\n c\n );\n } else {\n return _LEA(\n a,\n c === void 0 ? 0 : c | 0,\n l === void 0 ? a.length - 1 : l | 0,\n y as T\n );\n }\n}\n\nfunction _EQA<T>(a: ArrayLike<T>, l: number, h: number, y: T): number {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n l - 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n if (x === y) {\n return m;\n } else if (x <= y) {\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return -1;\n}\nfunction _EQP<T, Y>(\n a: ArrayLike<T>,\n l: number,\n h: number,\n y: Y,\n c: Compare<T, Y>\n): number {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n l - 1;\n while (l <= h) {\n const m = (l + h) >>> 1,\n x = a[m];\n const p = c(x, y);\n if (p === 0) {\n return m;\n } else if (p <= 0) {\n l = m + 1;\n } else {\n h = m - 1;\n }\n }\n return -1;\n}\nfunction dispatchBsearchEQ<T, Y>(\n a: ArrayLike<T>,\n y: T | Y,\n c?: Compare<T, Y> | number,\n l?: number,\n h?: number\n): number {\n if (typeof c === \"function\") {\n return _EQP(\n a,\n l === void 0 ? 0 : l | 0,\n h === void 0 ? a.length - 1 : h | 0,\n y as Y,\n c\n );\n } else {\n return _EQA(\n a,\n c === void 0 ? 0 : c | 0,\n l === void 0 ? a.length - 1 : l | 0,\n y as T\n );\n }\n}\n\nexport const binarySearchBounds: {\n ge: BoundsSearch;\n gt: BoundsSearch;\n lt: BoundsSearch;\n le: BoundsSearch;\n eq: BoundsSearch;\n} = {\n ge: dispatchBsearchGE,\n gt: dispatchBsearchGT,\n lt: dispatchBsearchLT,\n le: dispatchBsearchLE,\n eq: dispatchBsearchEQ\n};\n","/**\n * Binary Search Bounds\n * https://github.com/mikolalysenko/interval-tree-1d\n * Mikola Lysenko\n *\n * Inlined because of Content Security Policy issue caused by the use of `new Function(...)` syntax in an upstream dependency.\n * Issue reported here: https://github.com/mikolalysenko/binary-search-bounds/issues/5\n **/\n\nimport { binarySearchBounds as bounds } from \"./binarySearchBounds\";\n\n/** An interval [low, high], optionally followed by additional data (e.g. an index). */\nexport type Interval = [number, number, ...number[]];\n\ntype ResultCode = 0 | 1 | 2;\n\nconst NOT_FOUND: ResultCode = 0;\nconst SUCCESS: ResultCode = 1;\nconst EMPTY: ResultCode = 2;\n\nclass IntervalTreeNode {\n mid: number;\n left: IntervalTreeNode | null;\n right: IntervalTreeNode | null;\n leftPoints: Interval[];\n rightPoints: Interval[];\n count: number;\n\n constructor(\n mid: number,\n left: IntervalTreeNode | null,\n right: IntervalTreeNode | null,\n leftPoints: Interval[],\n rightPoints: Interval[]\n ) {\n this.mid = mid;\n this.left = left;\n this.right = right;\n this.leftPoints = leftPoints;\n this.rightPoints = rightPoints;\n this.count =\n (left ? left.count : 0) + (right ? right.count : 0) + leftPoints.length;\n }\n\n intervals(result: Interval[]): Interval[] {\n // eslint-disable-next-line prefer-spread\n result.push.apply(result, this.leftPoints);\n if (this.left) {\n this.left.intervals(result);\n }\n if (this.right) {\n this.right.intervals(result);\n }\n return result;\n }\n\n insert(interval: Interval): void {\n const weight = this.count - this.leftPoints.length;\n this.count += 1;\n if (interval[1] < this.mid) {\n if (this.left) {\n if (4 * (this.left.count + 1) > 3 * (weight + 1)) {\n rebuildWithInterval(this, interval);\n } else {\n this.left.insert(interval);\n }\n } else {\n this.left = createIntervalTreeNode([interval]);\n }\n } else if (interval[0] > this.mid) {\n if (this.right) {\n if (4 * (this.right.count + 1) > 3 * (weight + 1)) {\n rebuildWithInterval(this, interval);\n } else {\n this.right.insert(interval);\n }\n } else {\n this.right = createIntervalTreeNode([interval]);\n }\n } else {\n const l = bounds.ge(this.leftPoints, interval, compareBegin);\n const r = bounds.ge(this.rightPoints, interval, compareEnd);\n this.leftPoints.splice(l, 0, interval);\n this.rightPoints.splice(r, 0, interval);\n }\n }\n\n remove(interval: Interval): ResultCode {\n // (Upstream subtracted the leftPoints array itself, which yields NaN and disabled rebalancing)\n const weight = this.count - this.leftPoints.length;\n if (interval[1] < this.mid) {\n if (!this.left) {\n return NOT_FOUND;\n }\n const rw = this.right ? this.right.count : 0;\n if (4 * rw > 3 * (weight - 1)) {\n return rebuildWithoutInterval(this, interval);\n }\n const r = this.left.remove(interval);\n if (r === EMPTY) {\n this.left = null;\n this.count -= 1;\n return SUCCESS;\n } else if (r === SUCCESS) {\n this.count -= 1;\n }\n return r;\n } else if (interval[0] > this.mid) {\n if (!this.right) {\n return NOT_FOUND;\n }\n const lw = this.left ? this.left.count : 0;\n if (4 * lw > 3 * (weight - 1)) {\n return rebuildWithoutInterval(this, interval);\n }\n const r = this.right.remove(interval);\n if (r === EMPTY) {\n this.right = null;\n this.count -= 1;\n return SUCCESS;\n } else if (r === SUCCESS) {\n this.count -= 1;\n }\n return r;\n } else {\n if (this.count === 1) {\n if (this.leftPoints[0] === interval) {\n return EMPTY;\n } else {\n return NOT_FOUND;\n }\n }\n if (this.leftPoints.length === 1 && this.leftPoints[0] === interval) {\n if (this.left && this.right) {\n // Upstream promoted the rightmost node of the left subtree into this node, which only adjusted the count\n // of that node's parent, and could leave intervals of the left subtree that span the promoted node's mid point\n // on the wrong side of it (where searches for them no longer reach); rebuild this subtree instead\n return rebuildWithoutInterval(this, interval);\n } else if (this.left) {\n copy(this, this.left);\n } else {\n copy(this, this.right!);\n }\n return SUCCESS;\n }\n for (\n let l = bounds.ge(this.leftPoints, interval, compareBegin);\n l < this.leftPoints.length;\n ++l\n ) {\n if (this.leftPoints[l][0] !== interval[0]) {\n break;\n }\n if (this.leftPoints[l] === interval) {\n this.count -= 1;\n this.leftPoints.splice(l, 1);\n for (\n let r = bounds.ge(this.rightPoints, interval, compareEnd);\n r < this.rightPoints.length;\n ++r\n ) {\n if (this.rightPoints[r][1] !== interval[1]) {\n break;\n } else if (this.rightPoints[r] === interval) {\n this.rightPoints.splice(r, 1);\n return SUCCESS;\n }\n }\n }\n }\n return NOT_FOUND;\n }\n }\n\n queryPoint<T>(x: number, cb: (interval: Interval) => T): T | undefined {\n if (x < this.mid) {\n if (this.left) {\n const r = this.left.queryPoint(x, cb);\n if (r) {\n return r;\n }\n }\n return reportLeftRange(this.leftPoints, x, cb);\n } else if (x > this.mid) {\n if (this.right) {\n const r = this.right.queryPoint(x, cb);\n if (r) {\n return r;\n }\n }\n return reportRightRange(this.rightPoints, x, cb);\n } else {\n return reportRange(this.leftPoints, cb);\n }\n }\n\n queryInterval<T>(\n lo: number,\n hi: number,\n cb: (interval: Interval) => T\n ): T | undefined {\n if (lo < this.mid && this.left) {\n const r = this.left.queryInterval(lo, hi, cb);\n if (r) {\n return r;\n }\n }\n if (hi > this.mid && this.right) {\n const r = this.right.queryInterval(lo, hi, cb);\n if (r) {\n return r;\n }\n }\n if (hi < this.mid) {\n return reportLeftRange(this.leftPoints, hi, cb);\n } else if (lo > this.mid) {\n return reportRightRange(this.rightPoints, lo, cb);\n } else {\n return reportRange(this.leftPoints, cb);\n }\n }\n}\n\nfunction copy(a: IntervalTreeNode, b: IntervalTreeNode) {\n a.mid = b.mid;\n a.left = b.left;\n a.right = b.right;\n a.leftPoints = b.leftPoints;\n a.rightPoints = b.rightPoints;\n a.count = b.count;\n}\n\nfunction rebuild(node: IntervalTreeNode, intervals: Interval[]) {\n // Note: an empty list of intervals results in a null tree (and a TypeError); preserved as-is.\n const ntree = createIntervalTreeNode(intervals)!;\n node.mid = ntree.mid;\n node.left = ntree.left;\n node.right = ntree.right;\n node.leftPoints = ntree.leftPoints;\n node.rightPoints = ntree.rightPoints;\n node.count = ntree.count;\n}\n\nfunction rebuildWithInterval(node: IntervalTreeNode, interval: Interval) {\n const intervals = node.intervals([]);\n intervals.push(interval);\n rebuild(node, intervals);\n}\n\nfunction rebuildWithoutInterval(\n node: IntervalTreeNode,\n interval: Interval\n): ResultCode {\n const intervals = node.intervals([]);\n const idx = intervals.indexOf(interval);\n if (idx < 0) {\n return NOT_FOUND;\n }\n intervals.splice(idx, 1);\n if (intervals.length === 0) {\n return EMPTY;\n }\n rebuild(node, intervals);\n return SUCCESS;\n}\n\nfunction reportLeftRange<T>(\n arr: Interval[],\n hi: number,\n cb: (interval: Interval) => T\n): T | undefined {\n for (let i = 0; i < arr.length && arr[i][0] <= hi; ++i) {\n const r = cb(arr[i]);\n if (r) {\n return r;\n }\n }\n}\n\nfunction reportRightRange<T>(\n arr: Interval[],\n lo: number,\n cb: (interval: Interval) => T\n): T | undefined {\n for (let i = arr.length - 1; i >= 0 && arr[i][1] >= lo; --i) {\n const r = cb(arr[i]);\n if (r) {\n return r;\n }\n }\n}\n\nfunction reportRange<T>(\n arr: Interval[],\n cb: (interval: Interval) => T\n): T | undefined {\n for (let i = 0; i < arr.length; ++i) {\n const r = cb(arr[i]);\n if (r) {\n return r;\n }\n }\n}\n\nfunction compareNumbers(a: number, b: number) {\n return a - b;\n}\n\nfunction compareBegin(a: Interval, b: Interval) {\n const d = a[0] - b[0];\n if (d) {\n return d;\n }\n return a[1] - b[1];\n}\n\nfunction compareEnd(a: Interval, b: Interval) {\n const d = a[1] - b[1];\n if (d) {\n return d;\n }\n return a[0] - b[0];\n}\n\nfunction createIntervalTreeNode(\n intervals: Interval[]\n): IntervalTreeNode | null {\n if (intervals.length === 0) {\n return null;\n }\n const pts: number[] = [];\n for (let i = 0; i < intervals.length; ++i) {\n pts.push(intervals[i][0], intervals[i][1]);\n }\n pts.sort(compareNumbers);\n\n const mid = pts[pts.length >> 1];\n\n const leftIntervals: Interval[] = [];\n const rightIntervals: Interval[] = [];\n const centerIntervals: Interval[] = [];\n for (let i = 0; i < intervals.length; ++i) {\n const s = intervals[i];\n if (s[1] < mid) {\n leftIntervals.push(s);\n } else if (mid < s[0]) {\n rightIntervals.push(s);\n } else {\n centerIntervals.push(s);\n }\n }\n\n //Split center intervals\n const leftPoints = centerIntervals;\n const rightPoints = centerIntervals.slice();\n leftPoints.sort(compareBegin);\n rightPoints.sort(compareEnd);\n\n return new IntervalTreeNode(\n mid,\n createIntervalTreeNode(leftIntervals),\n createIntervalTreeNode(rightIntervals),\n leftPoints,\n rightPoints\n );\n}\n\nexport type IntervalTree = {\n /** Inserts an interval into the tree. */\n insert(interval: Interval): void;\n\n /**\n * Removes an interval (by reference) from the tree.\n * Returns true if the interval was found and removed.\n */\n remove(interval: Interval): boolean;\n\n /**\n * Visits every interval containing the point; stops early (and returns the value)\n * if the callback returns a truthy value.\n */\n queryPoint<T>(p: number, cb: (interval: Interval) => T): T | undefined;\n\n /**\n * Visits every interval overlapping [lo, hi]; stops early (and returns the value)\n * if the callback returns a truthy value.\n */\n queryInterval<T>(\n lo: number,\n hi: number,\n cb: (interval: Interval) => T\n ): T | undefined;\n\n /** Number of intervals in the tree. */\n readonly count: number;\n\n /** A (new) list of every interval in the tree. */\n readonly intervals: Interval[];\n};\n\n//User friendly wrapper that makes it possible to support empty trees\nclass IntervalTreeWrapper implements IntervalTree {\n root: IntervalTreeNode | null;\n\n constructor(root: IntervalTreeNode | null) {\n this.root = root;\n }\n\n insert(interval: Interval): void {\n if (this.root) {\n this.root.insert(interval);\n } else {\n this.root = new IntervalTreeNode(\n interval[0],\n null,\n null,\n [interval],\n [interval]\n );\n }\n }\n\n remove(interval: Interval): boolean {\n if (this.root) {\n const r = this.root.remove(interval);\n if (r === EMPTY) {\n this.root = null;\n }\n return r !== NOT_FOUND;\n }\n return false;\n }\n\n queryPoint<T>(p: number, cb: (interval: Interval) => T): T | undefined {\n if (this.root) {\n return this.root.queryPoint(p, cb);\n }\n }\n\n queryInterval<T>(\n lo: number,\n hi: number,\n cb: (interval: Interval) => T\n ): T | undefined {\n if (lo <= hi && this.root) {\n return this.root.queryInterval(lo, hi, cb);\n }\n }\n\n get count(): number {\n if (this.root) {\n return this.root.count;\n }\n return 0;\n }\n\n get intervals(): Interval[] {\n if (this.root) {\n return this.root.intervals([]);\n }\n return [];\n }\n}\n\nexport function createIntervalTree(intervals?: Interval[]): IntervalTree {\n if (!intervals || intervals.length === 0) {\n return new IntervalTreeWrapper(null);\n }\n return new IntervalTreeWrapper(createIntervalTreeNode(intervals));\n}\n","import { createIntervalTree } from \"../../vendor/intervalTree\";\n\ntype RenderCallback = (index: number, left: number, top: number) => void;\n\n// Position cache requirements:\n// O(log(n)) lookup of cells to render for a given viewport size\n// O(1) lookup of shortest measured column (so we know when to enter phase 1)\nexport class PositionCache {\n // Tracks the height of each column\n _columnSizeMap: { [x: number]: number } = {};\n\n // Store tops and bottoms of each cell for fast intersection lookup.\n _intervalTree = createIntervalTree();\n\n // Maps cell index to x coordinates for quick lookup.\n _leftMap: { [index: number]: number } = {};\n\n // Maps cell index to the y coordinate of its bottom edge.\n _bottomMap: { [index: number]: number } = {};\n\n estimateTotalHeight(\n cellCount: number,\n columnCount: number,\n defaultCellHeight: number\n ): number {\n const unmeasuredCellCount = cellCount - this.count;\n if (unmeasuredCellCount < 0) {\n // Some of the cached cells have since been removed (cellCount shrank);\n // only the remaining cells (all of which have been positioned) contribute to the height.\n let size = 0;\n for (let index = 0; index < cellCount; index++) {\n const bottom = this._bottomMap[index];\n if (bottom !== undefined && bottom > size) {\n size = bottom;\n }\n }\n return size;\n }\n\n return (\n this.tallestColumnSize +\n Math.ceil(unmeasuredCellCount / columnCount) * defaultCellHeight\n );\n }\n\n // Render all cells visible within the viewport range defined.\n range(\n scrollTop: number,\n clientHeight: number,\n renderCallback: RenderCallback\n ): void {\n this._intervalTree.queryInterval(\n scrollTop,\n scrollTop + clientHeight,\n ([top, , index]) =>\n renderCallback(index as number, this._leftMap[index as number], top)\n );\n }\n\n setPosition(index: number, left: number, top: number, height: number): void {\n this._intervalTree.insert([top, top + height, index]);\n this._leftMap[index] = left;\n this._bottomMap[index] = top + height;\n\n const columnSizeMap = this._columnSizeMap;\n const columnHeight = columnSizeMap[left];\n if (columnHeight === undefined) {\n columnSizeMap[left] = top + height;\n } else {\n columnSizeMap[left] = Math.max(columnHeight, top + height);\n }\n }\n\n get count(): number {\n return this._intervalTree.count;\n }\n\n get shortestColumnSize(): number {\n const columnSizeMap = this._columnSizeMap;\n\n let size = Infinity;\n\n for (const i in columnSizeMap) {\n const height = columnSizeMap[i as unknown as number];\n size = Math.min(size, height);\n }\n\n return size === Infinity ? 0 : size;\n }\n\n get tallestColumnSize(): number {\n const columnSizeMap = this._columnSizeMap;\n\n let size = 0;\n\n for (const i in columnSizeMap) {\n const height = columnSizeMap[i as unknown as number];\n size = Math.max(size, height);\n }\n\n return size;\n }\n}\n","import clsx from \"clsx\";\nimport {\n forwardRef,\n memo,\n useEffect,\n useImperativeHandle,\n useInsertionEffect,\n useReducer,\n useState,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n type UIEvent\n} from \"react\";\nimport {\n cancelAnimationTimeout,\n requestAnimationTimeout,\n type AnimationTimeoutId\n} from \"../../utils/requestAnimationTimeout\";\nimport { useIsomorphicLayoutEffect } from \"../../utils/useIsomorphicLayoutEffect\";\nimport type { ScrollElementLinkTarget } from \"../../utils/scrollElement/types\";\nimport { useMissingHeightWarning } from \"../../utils/scrollElement/useMissingHeightWarning\";\nimport { useScrollElementLink } from \"../../utils/scrollElement/useScrollElementLink\";\nimport { defaultMasonryProps } from \"./defaultMasonryProps\";\nimport { PositionCache } from \"./PositionCache\";\nimport type {\n MasonryCellMeasurerCache,\n MasonryImperativeAPI,\n MasonryProps,\n Positioner\n} from \"./types\";\n\ntype State = {\n isScrolling: boolean;\n\n // Scroll offset of the Masonry's own scrolling container\n scrollTop: number;\n\n // The viewport of the scroll element the Masonry is linked to (its scrollElement prop; see useScrollElementLink), or null if not linked.\n // While linked, the Masonry renders at its full height and is scrolled by the scroll element.\n linkedViewport: LinkedViewport | null;\n};\n\ntype LinkedViewport = {\n // Height of the scroll element's viewport\n height: number;\n // Scroll offset of the scroll element, relative to the top of the Masonry (and at least 0)\n scrollTop: number;\n};\n\n// Values from the most recently committed render, used by the (stable) imperative handle and event handlers\ntype LatestValues = {\n cellCount: number;\n cellMeasurerCache: MasonryCellMeasurerCache;\n cellPositioner: Positioner;\n height: number;\n scrollingResetTimeInterval: number;\n width: number;\n};\n\ntype MasonryInternals = {\n debounceResetIsScrollingId: AnimationTimeoutId | null;\n element: HTMLDivElement | null;\n invalidateOnUpdateStartIndex: number | null;\n invalidateOnUpdateStopIndex: number | null;\n latest: LatestValues;\n // Mirrors State.linkedViewport (updated by the link target methods, during commit or event handlers)\n linkedViewport: LinkedViewport | null;\n onScrollMemoized: number | undefined;\n positionCache: PositionCache;\n startIndexMemoized: number | null;\n stopIndexMemoized: number | null | undefined;\n};\n\ntype MasonryInstance = {\n handle: MasonryImperativeAPI;\n linkTarget: ScrollElementLinkTarget;\n internals: MasonryInternals;\n onScroll: (event: UIEvent<HTMLDivElement>) => void;\n setElementRef: (element: HTMLDivElement | null) => void;\n};\n\nconst increment = (value: number) => value + 1;\n\n/**\n * This component efficiently displays arbitrarily positioned cells using windowing techniques.\n * Cell position is determined by an injected `cellPositioner` property.\n * Windowing is vertical; this component does not support horizontal scrolling.\n *\n * Rendering occurs in two phases:\n * 1) First pass uses estimated cell sizes (provided by the cache) to determine how many cells to measure in a batch.\n * Batch size is chosen using a fast, naive layout algorithm that stacks images in order until the viewport has been filled.\n * After measurement is complete (once the render has been committed) this component evaluates positioned cells\n * in order to determine if another measurement pass is required (eg if actual cell sizes were less than estimated sizes).\n * All measurements are permanently cached (keyed by `keyMapper`) for performance purposes.\n * 2) Second pass uses the external `cellPositioner` to layout cells.\n * At this time the positioner has access to cached size measurements for all cells.\n * The positions it returns are cached by Masonry for fast access later.\n * Phase one is repeated if the user scrolls beyond the current layout's bounds.\n * If the layout is invalidated due to eg a resize, cached positions can be cleared using `recomputeCellPositions()`.\n *\n * Animation constraints:\n * Simple animations are supported (eg translate/slide into place on initial reveal).\n * More complex animations are not (eg flying from one position to another on resize).\n *\n * Layout constraints:\n * This component supports multi-column layout.\n * The height of each item may vary.\n * The width of each item must not exceed the width of the column it is \"in\".\n * The left position of all items within a column must align.\n * (Items may not span multiple columns.)\n */\nexport const Masonry = /* @__PURE__ */ memo(\n /* @__PURE__ */ forwardRef<MasonryImperativeAPI, MasonryProps>(\n function Masonry(props, ref) {\n const {\n \"aria-label\": ariaLabel,\n cellCount,\n cellMeasurerCache,\n cellPositioner,\n cellRenderer,\n className,\n height: heightProp,\n id,\n keyMapper = defaultMasonryProps.keyMapper,\n onCellsRendered = defaultMasonryProps.onCellsRendered,\n onScroll = defaultMasonryProps.onScroll,\n overscanByPixels = defaultMasonryProps.overscanByPixels,\n role = defaultMasonryProps.role,\n rowDirection = defaultMasonryProps.rowDirection,\n scrollElement,\n scrollingResetTimeInterval = defaultMasonryProps.scrollingResetTimeInterval,\n style = defaultMasonryProps.style,\n tabIndex = defaultMasonryProps.tabIndex,\n width\n } = props;\n\n const [state, setState] = useState<State>(() => ({\n isScrolling: false,\n linkedViewport: null,\n scrollTop: 0\n }));\n const [, forceUpdate] = useReducer(increment, 0);\n\n // A Masonry with a scrollElement is scrolled by that element (e.g. the window) rather than scrolling itself:\n // it renders at its full height, and renders the cells within the scroll element's viewport.\n // Until the scroll element has been measured (e.g. during server rendering), the height prop is used as the viewport height.\n const linked = scrollElement !== undefined;\n const { linkedViewport } = state;\n const height =\n linkedViewport !== null ? linkedViewport.height : (heightProp ?? 0);\n\n // The instance (and its stable imperative handle) is created once\n const [\n {\n handle,\n internals,\n linkTarget,\n onScroll: onScrollEvent,\n setElementRef\n }\n ] = useState(() =>\n createMasonryInstance(\n {\n cellCount,\n cellMeasurerCache,\n cellPositioner,\n height,\n scrollingResetTimeInterval,\n width\n },\n setState,\n forceUpdate\n )\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n\n useMissingHeightWarning(\"Masonry\", heightProp, scrollElement);\n\n useScrollElementLink(\n scrollElement,\n linkTarget,\n scrollingResetTimeInterval\n );\n\n const latest: LatestValues = {\n cellCount,\n cellMeasurerCache,\n cellPositioner,\n height,\n scrollingResetTimeInterval,\n width\n };\n useInsertionEffect(() => {\n internals.latest = latest;\n });\n\n const { isScrolling } = state;\n const scrollTop = linked\n ? (linkedViewport?.scrollTop ?? 0)\n : state.scrollTop;\n\n const positionCache = internals.positionCache;\n\n const children: ReactNode[] = [];\n\n const estimatedTotalHeight = getEstimatedTotalHeight(\n positionCache,\n cellCount,\n cellMeasurerCache,\n width\n );\n\n const shortestColumnSize = positionCache.shortestColumnSize;\n const measuredCellCount = positionCache.count;\n\n let startIndex = 0;\n let stopIndex: number | undefined;\n\n positionCache.range(\n Math.max(0, scrollTop - overscanByPixels),\n height + overscanByPixels * 2,\n (index: number, left: number, top: number) => {\n // The position cache may contain cells that have since been removed (cellCount shrank)\n if (index >= cellCount) {\n return;\n }\n\n if (typeof stopIndex === \"undefined\") {\n startIndex = index;\n stopIndex = index;\n } else {\n startIndex = Math.min(startIndex, index);\n stopIndex = Math.max(stopIndex, index);\n }\n\n children.push(\n cellRenderer({\n index,\n isScrolling,\n key: keyMapper(index),\n parent: handle,\n style: {\n height: cellMeasurerCache.getHeight(index),\n [rowDirection === \"ltr\" ? \"left\" : \"right\"]: left,\n position: \"absolute\",\n top,\n width: cellMeasurerCache.getWidth(index)\n }\n })\n );\n }\n );\n\n // We need to measure additional cells for this layout\n if (\n shortestColumnSize < scrollTop + height + overscanByPixels &&\n measuredCellCount < cellCount\n ) {\n const batchSize = Math.min(\n cellCount - measuredCellCount,\n Math.ceil(\n (((scrollTop + height + overscanByPixels - shortestColumnSize) /\n cellMeasurerCache.defaultHeight) *\n width) /\n cellMeasurerCache.defaultWidth\n )\n );\n\n for (\n let index = measuredCellCount;\n index < measuredCellCount + batchSize;\n index++\n ) {\n stopIndex = index;\n\n children.push(\n cellRenderer({\n index: index,\n isScrolling,\n key: keyMapper(index),\n parent: handle,\n style: {\n width: cellMeasurerCache.getWidth(index)\n }\n })\n );\n }\n }\n\n // Equivalent of the 9.x componentDidMount/componentDidUpdate\n useIsomorphicLayoutEffect(() => {\n // Query external layout logic for position of newly-measured cells\n if (typeof internals.invalidateOnUpdateStartIndex === \"number\") {\n const invalidateStartIndex = internals.invalidateOnUpdateStartIndex;\n const invalidateStopIndex = internals.invalidateOnUpdateStopIndex!;\n\n internals.invalidateOnUpdateStartIndex = null;\n internals.invalidateOnUpdateStopIndex = null;\n\n populatePositionCache(\n internals.positionCache,\n cellMeasurerCache,\n cellPositioner,\n invalidateStartIndex,\n invalidateStopIndex\n );\n\n forceUpdate();\n }\n\n if (internals.onScrollMemoized !== scrollTop) {\n internals.onScrollMemoized = scrollTop;\n\n if (onScroll) {\n onScroll({\n clientHeight: height,\n scrollHeight: getEstimatedTotalHeight(\n internals.positionCache,\n cellCount,\n cellMeasurerCache,\n width\n ),\n scrollTop\n });\n }\n }\n\n if (\n internals.startIndexMemoized !== startIndex ||\n internals.stopIndexMemoized !== stopIndex\n ) {\n internals.startIndexMemoized = startIndex;\n internals.stopIndexMemoized = stopIndex;\n\n if (onCellsRendered) {\n onCellsRendered({ startIndex, stopIndex });\n }\n }\n });\n\n useEffect(\n () => () => {\n if (internals.debounceResetIsScrollingId) {\n cancelAnimationTimeout(internals.debounceResetIsScrollingId);\n internals.debounceResetIsScrollingId = null;\n }\n },\n [internals]\n );\n\n return (\n <div\n aria-label={ariaLabel}\n className={clsx(\"ReactVirtualized__Masonry\", className)}\n id={id ?? undefined}\n onScroll={onScrollEvent}\n ref={setElementRef}\n role={role}\n style={{\n boxSizing: \"border-box\",\n direction: \"ltr\",\n // A linked Masonry renders at its full height (it doesn't scroll itself)\n height: linked ? \"auto\" : height,\n overflowX: \"hidden\",\n overflowY: estimatedTotalHeight < height ? \"hidden\" : \"auto\",\n position: \"relative\",\n width,\n WebkitOverflowScrolling: \"touch\",\n willChange: \"transform\",\n ...style\n }}\n tabIndex={tabIndex}\n >\n <div\n className=\"ReactVirtualized__Masonry__innerScrollContainer\"\n style={{\n width: \"100%\",\n height: estimatedTotalHeight,\n maxWidth: \"100%\",\n maxHeight: estimatedTotalHeight,\n overflow: \"hidden\",\n pointerEvents: isScrolling ? \"none\" : (\"\" as \"auto\"),\n position: \"relative\"\n }}\n >\n {children}\n </div>\n </div>\n );\n }\n )\n);\n\nfunction getEstimatedTotalHeight(\n positionCache: PositionCache,\n cellCount: number,\n cellMeasurerCache: MasonryCellMeasurerCache,\n width: number\n) {\n const estimatedColumnCount = Math.max(\n 1,\n Math.floor(width / cellMeasurerCache.defaultWidth)\n );\n\n return positionCache.estimateTotalHeight(\n cellCount,\n estimatedColumnCount,\n cellMeasurerCache.defaultHeight\n );\n}\n\nfunction populatePositionCache(\n positionCache: PositionCache,\n cellMeasurerCache: MasonryCellMeasurerCache,\n cellPositioner: Positioner,\n startIndex: number,\n stopIndex: number\n) {\n for (let index = startIndex; index <= stopIndex; index++) {\n const { left, top } = cellPositioner(index);\n\n positionCache.setPosition(\n index,\n left,\n top,\n cellMeasurerCache.getHeight(index)\n );\n }\n}\n\n// Creates the (stable) imperative handle of a Masonry, its scroll event handler and its mutable internals.\nfunction createMasonryInstance(\n initialValues: LatestValues,\n setState: Dispatch<SetStateAction<State>>,\n forceUpdate: () => void\n): MasonryInstance {\n const internals: MasonryInternals = {\n debounceResetIsScrollingId: null,\n element: null,\n invalidateOnUpdateStartIndex: null,\n invalidateOnUpdateStopIndex: null,\n latest: initialValues,\n linkedViewport: null,\n onScrollMemoized: undefined,\n positionCache: new PositionCache(),\n startIndexMemoized: null,\n stopIndexMemoized: null\n };\n\n const debounceResetIsScrollingCallback = () => {\n internals.debounceResetIsScrollingId = null;\n\n setState((prevState) =>\n prevState.isScrolling ? { ...prevState, isScrolling: false } : prevState\n );\n };\n\n const debounceResetIsScrolling = () => {\n if (internals.debounceResetIsScrollingId) {\n cancelAnimationTimeout(internals.debounceResetIsScrollingId);\n }\n\n internals.debounceResetIsScrollingId = requestAnimationTimeout(\n debounceResetIsScrollingCallback,\n internals.latest.scrollingResetTimeInterval\n );\n };\n\n const onScroll = (event: UIEvent<HTMLDivElement>) => {\n const { cellCount, cellMeasurerCache, height, width } = internals.latest;\n\n const eventScrollTop = event.currentTarget.scrollTop;\n\n // When this component is shrunk drastically, React dispatches a series of back-to-back scroll events,\n // Gradually converging on a scrollTop that is within the bounds of the new, smaller height.\n // This causes a series of rapid renders that is slow for long lists.\n // We can avoid that by doing some simple bounds checking to ensure that scroll offsets never exceed their bounds.\n const scrollTop = Math.min(\n Math.max(\n 0,\n getEstimatedTotalHeight(\n internals.positionCache,\n cellCount,\n cellMeasurerCache,\n width\n ) - height\n ),\n eventScrollTop\n );\n\n // On iOS, we can arrive at negative offsets by swiping past the start or end.\n // Avoid re-rendering in this case as it can cause problems; see #532 for more.\n if (eventScrollTop !== scrollTop) {\n return;\n }\n\n // Prevent pointer events from interrupting a smooth scroll\n debounceResetIsScrolling();\n\n // Certain devices (like Apple touchpad) rapid-fire duplicate events.\n // Don't force a re-render if this is the case.\n setState((prevState) =>\n prevState.scrollTop !== scrollTop\n ? { ...prevState, isScrolling: true, scrollTop }\n : prevState\n );\n };\n\n // Linked to the Masonry's scroll element (if it has one) by useScrollElementLink.\n // (A Masonry has no scroll methods, so the link source isn't used.)\n const linkTarget: ScrollElementLinkTarget = {\n getElement() {\n return internals.element;\n },\n\n link(source, viewport) {\n const linkedViewport =\n source !== null\n ? {\n height: viewport.height,\n scrollTop: Math.max(0, viewport.scrollTop)\n }\n : null;\n internals.linkedViewport = linkedViewport;\n setState((prevState) => ({ ...prevState, linkedViewport }));\n },\n\n setViewport(viewport) {\n const prevViewport = internals.linkedViewport;\n if (prevViewport === null) {\n return;\n }\n\n const linkedViewport = {\n height: viewport.height,\n scrollTop: Math.max(0, viewport.scrollTop)\n };\n if (\n linkedViewport.height === prevViewport.height &&\n linkedViewport.scrollTop === prevViewport.scrollTop\n ) {\n return;\n }\n internals.linkedViewport = linkedViewport;\n\n // A change of the scroll offset marks the Masonry as scrolling (like a scroll event of its own container would)\n const scrolled = linkedViewport.scrollTop !== prevViewport.scrollTop;\n if (scrolled) {\n debounceResetIsScrolling();\n }\n setState((prevState) => ({\n ...prevState,\n isScrolling: prevState.isScrolling || scrolled,\n linkedViewport\n }));\n }\n };\n\n const handle: MasonryImperativeAPI = {\n clearCellPositions() {\n internals.positionCache = new PositionCache();\n forceUpdate();\n },\n\n forceUpdate() {\n forceUpdate();\n },\n\n // HACK This method signature was intended for Grid\n invalidateCellSizeAfterRender({ rowIndex: index }) {\n if (internals.invalidateOnUpdateStartIndex === null) {\n internals.invalidateOnUpdateStartIndex = index;\n internals.invalidateOnUpdateStopIndex = index;\n } else {\n internals.invalidateOnUpdateStartIndex = Math.min(\n internals.invalidateOnUpdateStartIndex,\n index\n );\n internals.invalidateOnUpdateStopIndex = Math.max(\n internals.invalidateOnUpdateStopIndex!,\n index\n );\n }\n\n // The invalidated cells are positioned once the (next) render has been committed.\n // (Within a commit this re-render is batched with the one the layout effect schedules.)\n forceUpdate();\n },\n\n recomputeCellPositions() {\n const { cellCount, cellMeasurerCache, cellPositioner } = internals.latest;\n\n // Don't re-populate positions for cells that have been removed (cellCount shrank)\n const stopIndex = Math.min(internals.positionCache.count, cellCount) - 1;\n\n const positionCache = new PositionCache();\n populatePositionCache(\n positionCache,\n cellMeasurerCache,\n cellPositioner,\n 0,\n stopIndex\n );\n internals.positionCache = positionCache;\n\n forceUpdate();\n },\n\n recomputeGridSize() {\n forceUpdate();\n }\n };\n\n const setElementRef = (element: HTMLDivElement | null) => {\n internals.element = element;\n };\n\n return { handle, internals, linkTarget, onScroll, setElementRef };\n}\n","import type { MultiGridProps } from \"./types\";\n\ntype DefaultedPropKeys =\n | \"classNameBottomLeftGrid\"\n | \"classNameBottomRightGrid\"\n | \"classNameTopLeftGrid\"\n | \"classNameTopRightGrid\"\n | \"enableFixedColumnScroll\"\n | \"enableFixedRowScroll\"\n | \"fixedColumnCount\"\n | \"fixedRowCount\"\n | \"hideBottomLeftGridScrollbar\"\n | \"hideTopRightGridScrollbar\"\n | \"style\"\n | \"styleBottomLeftGrid\"\n | \"styleBottomRightGrid\"\n | \"styleTopLeftGrid\"\n | \"styleTopRightGrid\";\n\n/**\n * Default values for `MultiGrid`'s optional props.\n * (Props that are relayed to the inner `Grid`s default to the values in `defaultGridProps`.)\n */\nexport const defaultMultiGridProps: Readonly<\n Required<Pick<MultiGridProps, DefaultedPropKeys>>\n> = /* @__PURE__ */ Object.freeze({\n classNameBottomLeftGrid: \"\",\n classNameBottomRightGrid: \"\",\n classNameTopLeftGrid: \"\",\n classNameTopRightGrid: \"\",\n enableFixedColumnScroll: false,\n enableFixedRowScroll: false,\n fixedColumnCount: 0,\n fixedRowCount: 0,\n hideBottomLeftGridScrollbar: false,\n hideTopRightGridScrollbar: false,\n style: /* @__PURE__ */ Object.freeze({}),\n styleBottomLeftGrid: /* @__PURE__ */ Object.freeze({}),\n styleBottomRightGrid: /* @__PURE__ */ Object.freeze({}),\n styleTopLeftGrid: /* @__PURE__ */ Object.freeze({}),\n styleTopRightGrid: /* @__PURE__ */ Object.freeze({})\n});\n","import type { CellMeasurerCache } from \"../CellMeasurer/CellMeasurerCache\";\nimport type { CellMeasureCache } from \"../CellMeasurer/types\";\n\ntype CellMeasurerCacheDecoratorParams = {\n cellMeasurerCache: CellMeasurerCache;\n columnIndexOffset?: number;\n rowIndexOffset?: number;\n};\n\ntype IndexParam = {\n index: number;\n};\n\n/**\n * Caches measurements for a given cell.\n */\nexport class CellMeasurerCacheDecorator implements CellMeasureCache {\n _cellMeasurerCache: CellMeasurerCache;\n _columnIndexOffset: number;\n _rowIndexOffset: number;\n\n constructor(\n params: CellMeasurerCacheDecoratorParams = {} as CellMeasurerCacheDecoratorParams\n ) {\n const {\n cellMeasurerCache,\n columnIndexOffset = 0,\n rowIndexOffset = 0\n } = params;\n\n this._cellMeasurerCache = cellMeasurerCache;\n this._columnIndexOffset = columnIndexOffset;\n this._rowIndexOffset = rowIndexOffset;\n }\n\n clear(rowIndex: number, columnIndex: number): void {\n this._cellMeasurerCache.clear(\n rowIndex + this._rowIndexOffset,\n columnIndex + this._columnIndexOffset\n );\n }\n\n clearAll(): void {\n this._cellMeasurerCache.clearAll();\n }\n\n columnWidth = ({ index }: IndexParam): number => {\n return this._cellMeasurerCache.columnWidth({\n index: index + this._columnIndexOffset\n });\n };\n\n get defaultHeight(): number {\n return this._cellMeasurerCache.defaultHeight;\n }\n\n get defaultWidth(): number {\n return this._cellMeasurerCache.defaultWidth;\n }\n\n hasFixedHeight(): boolean {\n return this._cellMeasurerCache.hasFixedHeight();\n }\n\n hasFixedWidth(): boolean {\n return this._cellMeasurerCache.hasFixedWidth();\n }\n\n getHeight(rowIndex: number, columnIndex: number = 0): number {\n return this._cellMeasurerCache.getHeight(\n rowIndex + this._rowIndexOffset,\n columnIndex + this._columnIndexOffset\n );\n }\n\n getWidth(rowIndex: number, columnIndex: number = 0): number {\n return this._cellMeasurerCache.getWidth(\n rowIndex + this._rowIndexOffset,\n columnIndex + this._columnIndexOffset\n );\n }\n\n has(rowIndex: number, columnIndex: number = 0): boolean {\n return this._cellMeasurerCache.has(\n rowIndex + this._rowIndexOffset,\n columnIndex + this._columnIndexOffset\n );\n }\n\n rowHeight = ({ index }: IndexParam): number => {\n return this._cellMeasurerCache.rowHeight({\n index: index + this._rowIndexOffset\n });\n };\n\n set(\n rowIndex: number,\n columnIndex: number,\n width: number,\n height: number\n ): void {\n this._cellMeasurerCache.set(\n rowIndex + this._rowIndexOffset,\n columnIndex + this._columnIndexOffset,\n width,\n height\n );\n }\n}\n","import {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useInsertionEffect,\n useMemo,\n useReducer,\n useState,\n type CSSProperties,\n type Dispatch,\n type SetStateAction\n} from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../../utils/useIsomorphicLayoutEffect\";\nimport type { CellMeasurerCache } from \"../CellMeasurer/CellMeasurerCache\";\nimport type { CellMeasureCache } from \"../CellMeasurer/types\";\nimport { Grid } from \"../Grid/Grid\";\nimport type {\n CellRendererParams,\n CellSize,\n GridImperativeAPI,\n Scroll,\n ScrollbarPresenceChange\n} from \"../Grid/types\";\nimport { CellMeasurerCacheDecorator } from \"./CellMeasurerCacheDecorator\";\nimport { defaultMultiGridProps } from \"./defaultMultiGridProps\";\nimport type { MultiGridImperativeAPI, MultiGridProps } from \"./types\";\n\nconst SCROLLBAR_SIZE_BUFFER = 20;\n\ntype ScrollInfo = Pick<Scroll, \"scrollLeft\" | \"scrollTop\">;\n\n// Scrollbars of the bottom-right Grid (as reported by its onScrollbarPresenceChange)\ntype ScrollbarState = {\n scrollbarSize: number;\n showHorizontalScrollbar: boolean;\n showVerticalScrollbar: boolean;\n};\n\nconst INITIAL_SCROLLBAR_STATE: ScrollbarState = {\n scrollbarSize: 0,\n showHorizontalScrollbar: false,\n showVerticalScrollbar: false\n};\n\n// Props read by the imperative methods and the inner Grids' callbacks.\n// They are updated in an insertion effect, so they are current when these are called during the commit phase\n// (e.g. by a CellMeasurer cell or an inner Grid, whose effects run before the MultiGrid's own layout effects).\ntype LatestValues = Pick<\n MultiGridProps,\n \"onScroll\" | \"onScrollbarPresenceChange\"\n> & {\n fixedColumnCount: number;\n fixedRowCount: number;\n};\n\n// Mutable, per-instance values (the equivalent of the instance fields of the 9.x class component).\n// They are only modified by the imperative methods, the inner Grids' callbacks and effects (never during render).\ntype MultiGridInternals = {\n bottomLeftGrid: GridImperativeAPI | null;\n bottomRightGrid: GridImperativeAPI | null;\n topLeftGrid: GridImperativeAPI | null;\n topRightGrid: GridImperativeAPI | null;\n\n // Cell sizes of the most recently committed render (to detect numeric size changes)\n committedSizes: { columnWidth: CellSize; rowHeight: CellSize } | null;\n\n deferredInvalidateColumnIndex: number | null;\n deferredInvalidateRowIndex: number | null;\n\n latest: LatestValues;\n\n // The most recently requested scrollbar state (including an update that has not been rendered yet)\n scrollbarState: ScrollbarState;\n\n // The scroll offsets the quadrants are kept in sync with: the bottom-right Grid's offsets\n // (or the top-right/bottom-left Grid's, if those are scrolled by the user; see enableFixedRowScroll/enableFixedColumnScroll).\n // These are updated by scroll events, so they aren't state: changing them doesn't re-render MultiGrid itself;\n // the quadrants are scrolled through their imperative handles instead.\n scrollLeft: number;\n scrollTop: number;\n};\n\ntype MultiGridInstance = {\n handle: MultiGridImperativeAPI;\n internals: MultiGridInternals;\n onCommit: (columnWidth: CellSize, rowHeight: CellSize) => void;\n onScroll: (scrollInfo: ScrollInfo) => void;\n onScrollbarPresenceChange: (params: ScrollbarPresenceChange) => void;\n onScrollLeft: (scrollInfo: ScrollInfo) => void;\n onScrollTop: (scrollInfo: ScrollInfo) => void;\n setBottomLeftGrid: (grid: GridImperativeAPI | null) => void;\n setBottomRightGrid: (grid: GridImperativeAPI | null) => void;\n setTopLeftGrid: (grid: GridImperativeAPI | null) => void;\n setTopRightGrid: (grid: GridImperativeAPI | null) => void;\n};\n\nconst increment = (value: number) => value + 1;\n\nfunction isNumericSizeChange(prevSize: CellSize, nextSize: CellSize) {\n // Function sizes aren't compared (inline functions would cause infinite loops);\n // in that case the recompute methods should be used to inform of changes (as with Grid).\n return (\n (typeof prevSize === \"number\" || typeof nextSize === \"number\") &&\n prevSize !== nextSize\n );\n}\n\n// Total size of the first `count` columns (or rows)\nfunction getFixedCellsSize(size: CellSize, count: number): number {\n if (typeof size === \"function\") {\n let total = 0;\n for (let index = 0; index < count; index++) {\n total += size({ index });\n }\n return total;\n }\n return size * count;\n}\n\nfunction createMultiGridInstance(\n initialLatest: LatestValues,\n setScrollbarState: Dispatch<SetStateAction<ScrollbarState>>,\n forceUpdate: () => void\n): MultiGridInstance {\n const internals: MultiGridInternals = {\n bottomLeftGrid: null,\n bottomRightGrid: null,\n topLeftGrid: null,\n topRightGrid: null,\n committedSizes: null,\n deferredInvalidateColumnIndex: null,\n deferredInvalidateRowIndex: null,\n latest: initialLatest,\n scrollbarState: INITIAL_SCROLLBAR_STATE,\n scrollLeft: 0,\n scrollTop: 0\n };\n\n // Calls recomputeGridSize() on all child Grids (adjusting the indices for the fixed rows and columns)\n const recomputeGrids = (columnIndex: number, rowIndex: number) => {\n const { fixedColumnCount, fixedRowCount } = internals.latest;\n\n const adjustedColumnIndex = Math.max(0, columnIndex - fixedColumnCount);\n const adjustedRowIndex = Math.max(0, rowIndex - fixedRowCount);\n\n internals.bottomLeftGrid?.recomputeGridSize({\n columnIndex,\n rowIndex: adjustedRowIndex\n });\n internals.bottomRightGrid?.recomputeGridSize({\n columnIndex: adjustedColumnIndex,\n rowIndex: adjustedRowIndex\n });\n internals.topLeftGrid?.recomputeGridSize({\n columnIndex,\n rowIndex\n });\n internals.topRightGrid?.recomputeGridSize({\n columnIndex: adjustedColumnIndex,\n rowIndex\n });\n };\n\n // Scrolls the fixed Grids to the current scroll offsets (horizontally for the top-right Grid, vertically for the bottom-left Grid).\n // Grid's scrollToPosition() is a no-op for a Grid that is already there.\n // (The bottom-right Grid is not scrolled here: it reports its own offsets, and may have a pending scroll, e.g. to keep a cell in view.)\n const syncFixedGridScrollPositions = () => {\n const { scrollLeft, scrollTop } = internals;\n\n internals.topRightGrid?.scrollToPosition({ scrollLeft });\n internals.bottomLeftGrid?.scrollToPosition({ scrollTop });\n };\n\n const handle: MultiGridImperativeAPI = {\n forceUpdateGrids() {\n internals.bottomLeftGrid?.forceUpdate();\n internals.bottomRightGrid?.forceUpdate();\n internals.topLeftGrid?.forceUpdate();\n internals.topRightGrid?.forceUpdate();\n },\n\n invalidateCellSizeAfterRender({ columnIndex = 0, rowIndex = 0 } = {}) {\n internals.deferredInvalidateColumnIndex =\n typeof internals.deferredInvalidateColumnIndex === \"number\"\n ? Math.min(internals.deferredInvalidateColumnIndex, columnIndex)\n : columnIndex;\n internals.deferredInvalidateRowIndex =\n typeof internals.deferredInvalidateRowIndex === \"number\"\n ? Math.min(internals.deferredInvalidateRowIndex, rowIndex)\n : rowIndex;\n\n // The invalidated sizes are recomputed after the MultiGrid's next commit (see onCommit).\n // The cell may have been rendered by an inner Grid alone (e.g. while scrolling), so schedule a MultiGrid update.\n // (This is called during the commit phase, so the update is applied before the browser paints.)\n forceUpdate();\n },\n\n measureAllCells() {\n internals.bottomLeftGrid?.measureAllCells();\n internals.bottomRightGrid?.measureAllCells();\n internals.topLeftGrid?.measureAllCells();\n internals.topRightGrid?.measureAllCells();\n },\n\n recomputeGridSize({ columnIndex = 0, rowIndex = 0 } = {}) {\n recomputeGrids(columnIndex, rowIndex);\n\n // Re-render the MultiGrid itself, recomputing the size of the fixed rows and columns (bug #7)\n forceUpdate();\n },\n\n scrollToCell({ align, columnIndex, rowIndex }) {\n const { fixedColumnCount, fixedRowCount } = internals.latest;\n\n // Fixed cells are always visible (in the corresponding axis)\n const adjustedColumnIndex =\n columnIndex !== undefined && columnIndex >= fixedColumnCount\n ? columnIndex - fixedColumnCount\n : undefined;\n const adjustedRowIndex =\n rowIndex !== undefined && rowIndex >= fixedRowCount\n ? rowIndex - fixedRowCount\n : undefined;\n\n // The other quadrants are synced when the bottom-right Grid reports its new offsets (via onScroll)\n internals.bottomRightGrid?.scrollToCell({\n align,\n columnIndex: adjustedColumnIndex,\n rowIndex: adjustedRowIndex\n });\n },\n\n scrollToPosition({ scrollLeft, scrollTop }) {\n internals.bottomRightGrid?.scrollToPosition({ scrollLeft, scrollTop });\n }\n };\n\n // Called after every commit of the MultiGrid (the equivalent of the 9.x componentDidMount/componentDidUpdate)\n const onCommit = (columnWidth: CellSize, rowHeight: CellSize) => {\n // Most of the inner Grids receive wrapped (function) cell sizes, which Grid can't compare;\n // so a change of a numeric size is passed on by recomputing them (as Grid does for its own numeric sizes).\n const committedSizes = internals.committedSizes;\n internals.committedSizes = { columnWidth, rowHeight };\n if (\n committedSizes !== null &&\n (isNumericSizeChange(committedSizes.columnWidth, columnWidth) ||\n isNumericSizeChange(committedSizes.rowHeight, rowHeight))\n ) {\n recomputeGrids(0, 0);\n }\n\n // Cell sizes invalidated by CellMeasurer (see invalidateCellSizeAfterRender)\n if (typeof internals.deferredInvalidateColumnIndex === \"number\") {\n const columnIndex = internals.deferredInvalidateColumnIndex;\n // Always set alongside the column index (by invalidateCellSizeAfterRender)\n const rowIndex = internals.deferredInvalidateRowIndex as number;\n\n internals.deferredInvalidateColumnIndex = null;\n internals.deferredInvalidateRowIndex = null;\n\n handle.recomputeGridSize({ columnIndex, rowIndex });\n }\n\n // E.g. a fixed Grid that has just been added (because the fixed row or column count changed)\n syncFixedGridScrollPositions();\n };\n\n // The bottom-right Grid has been scrolled\n const onScroll = (scrollInfo: ScrollInfo) => {\n const { scrollLeft, scrollTop } = scrollInfo;\n\n internals.scrollLeft = scrollLeft;\n internals.scrollTop = scrollTop;\n\n // Scroll the fixed Grids in the same batch of updates as the one that scrolled (so they don't lag behind).\n // (This is a no-op for a Grid that reported the new offsets.)\n syncFixedGridScrollPositions();\n\n const { onScroll } = internals.latest;\n if (onScroll) {\n // The full Scroll object is passed when invoked by the bottom-right Grid;\n // only scrollLeft and scrollTop are passed when invoked via onScrollLeft or onScrollTop\n onScroll(scrollInfo as Scroll);\n }\n };\n\n const onScrollbarPresenceChange = ({\n horizontal,\n size,\n vertical\n }: ScrollbarPresenceChange) => {\n const { showHorizontalScrollbar, showVerticalScrollbar } =\n internals.scrollbarState;\n\n if (\n horizontal !== showHorizontalScrollbar ||\n vertical !== showVerticalScrollbar\n ) {\n const scrollbarState: ScrollbarState = {\n scrollbarSize: size,\n showHorizontalScrollbar: horizontal,\n showVerticalScrollbar: vertical\n };\n internals.scrollbarState = scrollbarState;\n setScrollbarState(scrollbarState);\n\n const { onScrollbarPresenceChange } = internals.latest;\n if (typeof onScrollbarPresenceChange === \"function\") {\n onScrollbarPresenceChange({\n horizontal,\n size,\n vertical\n });\n }\n }\n };\n\n // The top-right Grid has been scrolled by the user (enableFixedRowScroll)\n const onScrollLeft = ({ scrollLeft }: ScrollInfo) => {\n internals.bottomRightGrid?.scrollToPosition({ scrollLeft });\n onScroll({\n scrollLeft,\n scrollTop: internals.scrollTop\n });\n };\n\n // The bottom-left Grid has been scrolled by the user (enableFixedColumnScroll)\n const onScrollTop = ({ scrollTop }: ScrollInfo) => {\n internals.bottomRightGrid?.scrollToPosition({ scrollTop });\n onScroll({\n scrollLeft: internals.scrollLeft,\n scrollTop\n });\n };\n\n return {\n handle,\n internals,\n onCommit,\n onScroll,\n onScrollbarPresenceChange,\n onScrollLeft,\n onScrollTop,\n setBottomLeftGrid: (grid) => {\n internals.bottomLeftGrid = grid;\n },\n setBottomRightGrid: (grid) => {\n internals.bottomRightGrid = grid;\n },\n setTopLeftGrid: (grid) => {\n internals.topLeftGrid = grid;\n },\n setTopRightGrid: (grid) => {\n internals.topRightGrid = grid;\n }\n };\n}\n\n// The CellMeasurerCache (wrapper) used by each of the inner Grids that don't start at the first row and column.\n// (The wrappers translate the inner Grids' indices to indices of the full grid.)\nfunction createDeferredMeasurementCaches(\n deferredMeasurementCache: CellMeasureCache | undefined,\n fixedColumnCount: number,\n fixedRowCount: number\n) {\n if (!deferredMeasurementCache) {\n return {\n bottomLeftGrid: undefined,\n bottomRightGrid: undefined,\n topRightGrid: undefined\n };\n }\n\n // CellMeasurerCacheDecorator relies on CellMeasurerCache-specific methods (eg clearAll)\n const cellMeasurerCache = deferredMeasurementCache as CellMeasurerCache;\n\n return {\n bottomLeftGrid:\n fixedRowCount > 0\n ? new CellMeasurerCacheDecorator({\n cellMeasurerCache,\n columnIndexOffset: 0,\n rowIndexOffset: fixedRowCount\n })\n : deferredMeasurementCache,\n bottomRightGrid:\n fixedColumnCount > 0 || fixedRowCount > 0\n ? new CellMeasurerCacheDecorator({\n cellMeasurerCache,\n columnIndexOffset: fixedColumnCount,\n rowIndexOffset: fixedRowCount\n })\n : deferredMeasurementCache,\n topRightGrid:\n fixedColumnCount > 0\n ? new CellMeasurerCacheDecorator({\n cellMeasurerCache,\n columnIndexOffset: fixedColumnCount,\n rowIndexOffset: 0\n })\n : deferredMeasurementCache\n };\n}\n\n/**\n * Renders 1, 2, or 4 Grids depending on configuration.\n * A main (body) Grid will always be rendered.\n * Optionally, 1-2 Grids for sticky header rows will also be rendered.\n * If no sticky columns, only 1 sticky header Grid will be rendered.\n * If sticky columns, 2 sticky header Grids will be rendered.\n *\n * Scrolling is done through the imperative handle (`ref`): see `scrollToCell` and `scrollToPosition`.\n */\nexport const MultiGrid = /* @__PURE__ */ memo(\n /* @__PURE__ */ forwardRef<MultiGridImperativeAPI, MultiGridProps>(\n function MultiGrid(props, ref) {\n const {\n cellRenderer,\n classNameBottomLeftGrid = defaultMultiGridProps.classNameBottomLeftGrid,\n classNameBottomRightGrid = defaultMultiGridProps.classNameBottomRightGrid,\n classNameTopLeftGrid = defaultMultiGridProps.classNameTopLeftGrid,\n classNameTopRightGrid = defaultMultiGridProps.classNameTopRightGrid,\n columnCount,\n columnWidth,\n deferredMeasurementCache,\n enableFixedColumnScroll = defaultMultiGridProps.enableFixedColumnScroll,\n enableFixedRowScroll = defaultMultiGridProps.enableFixedRowScroll,\n fixedColumnCount = defaultMultiGridProps.fixedColumnCount,\n fixedRowCount = defaultMultiGridProps.fixedRowCount,\n height,\n hideBottomLeftGridScrollbar = defaultMultiGridProps.hideBottomLeftGridScrollbar,\n hideTopRightGridScrollbar = defaultMultiGridProps.hideTopRightGridScrollbar,\n // The initial offsets only apply to the quadrants that scroll along the corresponding axis\n initialScrollLeft,\n initialScrollTop,\n onScroll,\n onScrollbarPresenceChange,\n onSectionRendered,\n rowCount,\n rowHeight,\n style = defaultMultiGridProps.style,\n styleBottomLeftGrid = defaultMultiGridProps.styleBottomLeftGrid,\n styleBottomRightGrid = defaultMultiGridProps.styleBottomRightGrid,\n styleTopLeftGrid = defaultMultiGridProps.styleTopLeftGrid,\n styleTopRightGrid = defaultMultiGridProps.styleTopRightGrid,\n width,\n // The remaining (Grid) props are relayed to all of the inner Grids\n ...gridProps\n } = props;\n\n // Incremented to re-render the MultiGrid and recompute the size of its fixed rows and columns (see recomputeGridSize)\n const [layoutVersion, forceUpdate] = useReducer(increment, 0);\n const [scrollbarState, setScrollbarState] = useState<ScrollbarState>(\n INITIAL_SCROLLBAR_STATE\n );\n\n const latest: LatestValues = {\n fixedColumnCount,\n fixedRowCount,\n onScroll,\n onScrollbarPresenceChange\n };\n\n // The instance (and its stable imperative handle) is created once\n const [\n {\n handle,\n internals,\n onCommit,\n onScroll: onScrollBottomRightGrid,\n onScrollbarPresenceChange: onScrollbarPresenceChangeBottomRightGrid,\n onScrollLeft,\n onScrollTop,\n setBottomLeftGrid,\n setBottomRightGrid,\n setTopLeftGrid,\n setTopRightGrid\n }\n ] = useState(() =>\n createMultiGridInstance(latest, setScrollbarState, forceUpdate)\n );\n\n useImperativeHandle(ref, () => handle, [handle]);\n\n useInsertionEffect(() => {\n internals.latest = latest;\n });\n\n const { scrollbarSize, showHorizontalScrollbar, showVerticalScrollbar } =\n scrollbarState;\n\n // The size of the fixed columns and rows.\n // Function sizes are (only) re-read when they change or when recomputeGridSize() is called (see layoutVersion).\n const leftGridWidth = useMemo(\n () => getFixedCellsSize(columnWidth, fixedColumnCount),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [columnWidth, fixedColumnCount, layoutVersion]\n );\n const topGridHeight = useMemo(\n () => getFixedCellsSize(rowHeight, fixedRowCount),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [rowHeight, fixedRowCount, layoutVersion]\n );\n const bottomGridHeight = height - topGridHeight;\n const rightGridWidth = width - leftGridWidth;\n\n // The fixed Grids need some extra room to scroll as far as the bottom-right Grid (which may have scrollbars):\n // the bottom-left Grid gets an extra row (as tall as the bottom-right Grid's horizontal scrollbar),\n // and the top-right Grid gets an extra column (as wide as the bottom-right Grid's vertical scrollbar).\n // (The bottom-right Grid's horizontal scrollbar shortens its scrollable height, and vice versa; bug #29.)\n // If the bottom-right Grid has no scrollbar, the extra space is overflow:hidden anyway.\n const additionalRowCount = showHorizontalScrollbar ? 1 : 0;\n const additionalColumnCount = showVerticalScrollbar ? 1 : 0;\n\n // Inline styles are memoized so that they don't defeat the inner Grids' memo().\n const containerOuterStyle = useMemo<CSSProperties>(\n () => ({\n height,\n overflow: \"visible\", // Let :focus outline show through\n width,\n ...style\n }),\n [height, style, width]\n );\n const containerTopStyle = useMemo<CSSProperties>(\n () => ({\n height: topGridHeight,\n position: \"relative\",\n width\n }),\n [topGridHeight, width]\n );\n const containerBottomStyle = useMemo<CSSProperties>(\n () => ({\n height: bottomGridHeight,\n overflow: \"visible\", // Let :focus outline show through\n position: \"relative\",\n width\n }),\n [bottomGridHeight, width]\n );\n // (Bug #8: these follow changes to enableFixedColumnScroll and enableFixedRowScroll)\n const bottomLeftGridStyle = useMemo<CSSProperties>(\n () => ({\n left: 0,\n overflowX: \"hidden\",\n overflowY: enableFixedColumnScroll ? \"auto\" : \"hidden\",\n position: \"absolute\",\n ...styleBottomLeftGrid\n }),\n [enableFixedColumnScroll, styleBottomLeftGrid]\n );\n const bottomRightGridStyle = useMemo<CSSProperties>(\n () => ({\n left: leftGridWidth,\n position: \"absolute\",\n ...styleBottomRightGrid\n }),\n [leftGridWidth, styleBottomRightGrid]\n );\n const topLeftGridStyle = useMemo<CSSProperties>(\n () => ({\n left: 0,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n position: \"absolute\",\n top: 0,\n ...styleTopLeftGrid\n }),\n [styleTopLeftGrid]\n );\n const topRightGridStyle = useMemo<CSSProperties>(\n () => ({\n left: leftGridWidth,\n overflowX: enableFixedRowScroll ? \"auto\" : \"hidden\",\n overflowY: \"hidden\",\n position: \"absolute\",\n top: 0,\n ...styleTopRightGrid\n }),\n [enableFixedRowScroll, leftGridWidth, styleTopRightGrid]\n );\n const topRightGridInnerStyle = useMemo<CSSProperties>(\n () =>\n hideTopRightGridScrollbar\n ? { ...topRightGridStyle, left: 0 }\n : topRightGridStyle,\n [hideTopRightGridScrollbar, topRightGridStyle]\n );\n\n // Bug #20: the wrappers (and their index offsets) follow changes to the cache and the fixed row and column counts\n const deferredMeasurementCaches = useMemo(\n () =>\n createDeferredMeasurementCaches(\n deferredMeasurementCache,\n fixedColumnCount,\n fixedRowCount\n ),\n [deferredMeasurementCache, fixedColumnCount, fixedRowCount]\n );\n\n // Cell sizes of the right and bottom Grids (whose indices are offset by the fixed columns and rows)\n const columnWidthRightGrid = useCallback(\n ({ index }: { index: number }): number => {\n // The extra column (see additionalColumnCount)\n if (\n showVerticalScrollbar &&\n index === columnCount - fixedColumnCount\n ) {\n return scrollbarSize;\n }\n\n return typeof columnWidth === \"function\"\n ? columnWidth({ index: index + fixedColumnCount })\n : columnWidth;\n },\n [\n columnCount,\n columnWidth,\n fixedColumnCount,\n scrollbarSize,\n showVerticalScrollbar\n ]\n );\n const rowHeightBottomGrid = useCallback(\n ({ index }: { index: number }): number => {\n // The extra row (see additionalRowCount)\n if (showHorizontalScrollbar && index === rowCount - fixedRowCount) {\n return scrollbarSize;\n }\n\n return typeof rowHeight === \"function\"\n ? rowHeight({ index: index + fixedRowCount })\n : rowHeight;\n },\n [\n fixedRowCount,\n rowCount,\n rowHeight,\n scrollbarSize,\n showHorizontalScrollbar\n ]\n );\n\n // Cell renderers of the inner Grids.\n // Indices are translated to indices of the full grid, and the MultiGrid's handle is passed as the parent (for CellMeasurer).\n const cellRendererTopLeftGrid = useCallback(\n (params: CellRendererParams) =>\n cellRenderer({\n ...params,\n // Bug #21: like the other quadrants (rather than the inner Grid)\n parent: handle\n }),\n [cellRenderer, handle]\n );\n const cellRendererTopRightGrid = useCallback(\n ({ columnIndex, ...rest }: CellRendererParams) => {\n if (columnIndex === columnCount - fixedColumnCount) {\n return (\n <div\n key={rest.key}\n style={{\n ...rest.style,\n width: SCROLLBAR_SIZE_BUFFER\n }}\n />\n );\n } else {\n return cellRenderer({\n ...rest,\n columnIndex: columnIndex + fixedColumnCount,\n parent: handle\n });\n }\n },\n [cellRenderer, columnCount, fixedColumnCount, handle]\n );\n const cellRendererBottomLeftGrid = useCallback(\n ({ rowIndex, ...rest }: CellRendererParams) => {\n if (rowIndex === rowCount - fixedRowCount) {\n return (\n <div\n key={rest.key}\n style={{\n ...rest.style,\n height: SCROLLBAR_SIZE_BUFFER\n }}\n />\n );\n } else {\n return cellRenderer({\n ...rest,\n parent: handle,\n rowIndex: rowIndex + fixedRowCount\n });\n }\n },\n [cellRenderer, fixedRowCount, handle, rowCount]\n );\n const cellRendererBottomRightGrid = useCallback(\n ({ columnIndex, rowIndex, ...rest }: CellRendererParams) =>\n cellRenderer({\n ...rest,\n columnIndex: columnIndex + fixedColumnCount,\n parent: handle,\n rowIndex: rowIndex + fixedRowCount\n }),\n [cellRenderer, fixedColumnCount, fixedRowCount, handle]\n );\n\n // Equivalent of the 9.x componentDidMount/componentDidUpdate\n useIsomorphicLayoutEffect(() => {\n onCommit(columnWidth, rowHeight);\n });\n\n // Don't render any of our Grids if there are no cells.\n // This mirrors what Grid does,\n // And prevents us from recording inaccurate measurements when used with CellMeasurer.\n if (width === 0 || height === 0) {\n return null;\n }\n\n let topLeftGrid = null;\n if (fixedColumnCount && fixedRowCount) {\n topLeftGrid = (\n <Grid\n {...gridProps}\n cellRenderer={cellRendererTopLeftGrid}\n className={classNameTopLeftGrid}\n columnCount={fixedColumnCount}\n columnWidth={columnWidth}\n deferredMeasurementCache={deferredMeasurementCache}\n height={topGridHeight}\n ref={setTopLeftGrid}\n rowCount={fixedRowCount}\n rowHeight={rowHeight}\n style={topLeftGridStyle}\n tabIndex={null}\n width={leftGridWidth}\n />\n );\n }\n\n let topRightGrid = null;\n if (fixedRowCount) {\n const additionalHeight = showHorizontalScrollbar ? scrollbarSize : 0;\n\n topRightGrid = (\n <Grid\n {...gridProps}\n cellRenderer={cellRendererTopRightGrid}\n className={classNameTopRightGrid}\n columnCount={\n Math.max(0, columnCount - fixedColumnCount) +\n additionalColumnCount\n }\n columnWidth={columnWidthRightGrid}\n deferredMeasurementCache={deferredMeasurementCaches.topRightGrid}\n height={\n hideTopRightGridScrollbar\n ? topGridHeight + additionalHeight\n : topGridHeight\n }\n initialScrollLeft={initialScrollLeft}\n onScroll={enableFixedRowScroll ? onScrollLeft : undefined}\n ref={setTopRightGrid}\n rowCount={fixedRowCount}\n rowHeight={rowHeight}\n style={topRightGridInnerStyle}\n tabIndex={null}\n width={rightGridWidth}\n />\n );\n\n if (hideTopRightGridScrollbar) {\n topRightGrid = (\n <div\n className=\"TopRightGrid_ScrollWrapper\"\n style={{\n ...topRightGridStyle,\n height: topGridHeight,\n width: rightGridWidth,\n overflowX: \"hidden\"\n }}\n >\n {topRightGrid}\n </div>\n );\n }\n }\n\n let bottomLeftGrid = null;\n if (fixedColumnCount) {\n // The bottom-left Grid's own vertical scrollbar (see enableFixedColumnScroll)\n const additionalWidth = showVerticalScrollbar ? scrollbarSize : 0;\n\n bottomLeftGrid = (\n <Grid\n {...gridProps}\n cellRenderer={cellRendererBottomLeftGrid}\n className={classNameBottomLeftGrid}\n columnCount={fixedColumnCount}\n columnWidth={columnWidth}\n deferredMeasurementCache={deferredMeasurementCaches.bottomLeftGrid}\n height={bottomGridHeight}\n initialScrollTop={initialScrollTop}\n onScroll={enableFixedColumnScroll ? onScrollTop : undefined}\n ref={setBottomLeftGrid}\n rowCount={\n Math.max(0, rowCount - fixedRowCount) + additionalRowCount\n }\n rowHeight={rowHeightBottomGrid}\n style={bottomLeftGridStyle}\n tabIndex={null}\n width={\n hideBottomLeftGridScrollbar\n ? leftGridWidth + additionalWidth\n : leftGridWidth\n }\n />\n );\n\n if (hideBottomLeftGridScrollbar) {\n bottomLeftGrid = (\n <div\n className=\"BottomLeftGrid_ScrollWrapper\"\n style={{\n ...bottomLeftGridStyle,\n height: bottomGridHeight,\n width: leftGridWidth,\n overflowY: \"hidden\"\n }}\n >\n {bottomLeftGrid}\n </div>\n );\n }\n }\n\n const bottomRightGrid = (\n <Grid\n {...gridProps}\n cellRenderer={cellRendererBottomRightGrid}\n className={classNameBottomRightGrid}\n columnCount={Math.max(0, columnCount - fixedColumnCount)}\n columnWidth={columnWidthRightGrid}\n deferredMeasurementCache={deferredMeasurementCaches.bottomRightGrid}\n height={bottomGridHeight}\n initialScrollLeft={initialScrollLeft}\n initialScrollTop={initialScrollTop}\n onScroll={onScrollBottomRightGrid}\n onScrollbarPresenceChange={onScrollbarPresenceChangeBottomRightGrid}\n onSectionRendered={onSectionRendered}\n ref={setBottomRightGrid}\n rowCount={Math.max(0, rowCount - fixedRowCount)}\n rowHeight={rowHeightBottomGrid}\n style={bottomRightGridStyle}\n width={rightGridWidth}\n />\n );\n\n return (\n <div style={containerOuterStyle}>\n <div style={containerTopStyle}>\n {topLeftGrid}\n {topRightGrid}\n </div>\n <div style={containerBottomStyle}>\n {bottomLeftGrid}\n {bottomRightGrid}\n </div>\n </div>\n );\n }\n )\n);\n","import { memo, useCallback, useMemo, useRef, useState } from \"react\";\nimport type {\n ScrollSyncChild,\n ScrollSyncProps,\n ScrollSyncScrollParams\n} from \"./types\";\n\ntype ScrollSyncRefCallback = (\n child: ScrollSyncChild | null\n) => void | (() => void);\n\ntype ScrollOffsets = { scrollLeft: number; scrollTop: number };\n\nconst INITIAL_STATE: ScrollSyncScrollParams = {\n clientHeight: 0,\n clientWidth: 0,\n scrollHeight: 0,\n scrollLeft: 0,\n scrollTop: 0,\n scrollWidth: 0\n};\n\n/**\n * HOC that simplifies the process of synchronizing scrolling between two or more virtualized components.\n */\nexport const ScrollSync = /* @__PURE__ */ memo(function ScrollSync({\n children\n}: ScrollSyncProps) {\n const [state, setState] = useState<ScrollSyncScrollParams>(INITIAL_STATE);\n\n // Registered children, by key\n const childrenRef = useRef<Map<string, ScrollSyncChild>>(new Map());\n\n // Stable ref callbacks, by key\n const refCallbacksRef = useRef<Map<string, ScrollSyncRefCallback>>(new Map());\n\n // The child most recently registered under each key (not cleared when it is detached)\n const lastRegisteredRef = useRef<Map<string, ScrollSyncChild>>(new Map());\n\n // The offsets the registered children have been synced to\n const syncedRef = useRef<ScrollOffsets>({ scrollLeft: 0, scrollTop: 0 });\n\n // Whether any registered child has been scrolled by ScrollSync yet\n const hasSyncedRef = useRef(false);\n\n const onScroll = useCallback((params: ScrollSyncScrollParams) => {\n const synced = syncedRef.current;\n const hasSynced = hasSyncedRef.current;\n\n // Once children have been synced, a reported offset that matches the synced one is a child echoing the\n // offset ScrollSync just scrolled it to; ignore it so that its size values don't replace the scrolled child's.\n if (\n hasSynced &&\n params.scrollLeft === synced.scrollLeft &&\n params.scrollTop === synced.scrollTop\n ) {\n return;\n }\n\n // A synced child that can't scroll as far as the synced offset (e.g. a header row that only scrolls horizontally)\n // reports its clamped offset (its maximum) the next time it scrolls; don't propagate that back to the other children.\n const isClamped = (\n offset: number,\n syncedOffset: number,\n scrollSize: number,\n clientSize: number\n ) =>\n hasSynced && offset < syncedOffset && offset >= scrollSize - clientSize;\n\n // (List and Table only report a scrollTop)\n const leftChanged =\n typeof params.scrollLeft === \"number\" &&\n params.scrollLeft !== synced.scrollLeft &&\n !isClamped(\n params.scrollLeft,\n synced.scrollLeft,\n params.scrollWidth,\n params.clientWidth\n );\n const topChanged =\n typeof params.scrollTop === \"number\" &&\n params.scrollTop !== synced.scrollTop &&\n !isClamped(\n params.scrollTop,\n synced.scrollTop,\n params.scrollHeight,\n params.clientHeight\n );\n\n if (hasSynced && !leftChanged && !topChanged) {\n return;\n }\n\n const scrollLeft = leftChanged ? params.scrollLeft : synced.scrollLeft;\n const scrollTop = topChanged ? params.scrollTop : synced.scrollTop;\n\n syncedRef.current = { scrollLeft, scrollTop };\n\n setState({\n clientHeight: params.clientHeight,\n clientWidth: params.clientWidth,\n scrollHeight: params.scrollHeight,\n scrollLeft,\n scrollTop,\n scrollWidth: params.scrollWidth\n });\n\n if (leftChanged || topChanged) {\n const position: { scrollLeft?: number; scrollTop?: number } = {};\n if (leftChanged) {\n position.scrollLeft = scrollLeft;\n }\n if (topChanged) {\n position.scrollTop = scrollTop;\n }\n\n childrenRef.current.forEach((child) => {\n hasSyncedRef.current = true;\n\n // The child that reported this offset is already there, so this is a no-op for it\n child.scrollToPosition(position);\n });\n }\n }, []);\n\n const registerChild = useCallback((key: string) => {\n let refCallback = refCallbacksRef.current.get(key);\n if (!refCallback) {\n refCallback = (child: ScrollSyncChild | null) => {\n const map = childrenRef.current;\n if (child) {\n if (typeof child.scrollToPosition !== \"function\") {\n throw Error(\n \"Unexpected child type registered; only components with a scrollToPosition() method (e.g. Grid) are supported.\"\n );\n }\n\n map.set(key, child);\n\n // Bring a child registered after scrolling has happened in line with the others\n // (unless it's the same child being re-attached, e.g. because of an inline ref callback or StrictMode).\n const isNewChild = lastRegisteredRef.current.get(key) !== child;\n lastRegisteredRef.current.set(key, child);\n\n const { scrollLeft, scrollTop } = syncedRef.current;\n if (isNewChild && (scrollLeft !== 0 || scrollTop !== 0)) {\n hasSyncedRef.current = true;\n child.scrollToPosition({ scrollLeft, scrollTop });\n }\n\n // React 19 calls this cleanup function (instead of calling the ref with null) when the child unmounts;\n // only unregister the child if it hasn't been replaced by another one registered under the same key.\n return () => {\n if (map.get(key) === child) {\n map.delete(key);\n }\n };\n } else {\n // React 18\n map.delete(key);\n }\n };\n refCallbacksRef.current.set(key, refCallback);\n }\n return refCallback;\n }, []);\n\n const childProps = useMemo(\n () => ({ ...state, onScroll, registerChild }),\n [onScroll, registerChild, state]\n );\n\n return children(childProps);\n});\n","import type { ColumnProps } from \"./types\";\n\n/**\n * Describes the header and cell contents of a table column.\n *\n * This component does not render anything itself;\n * `Table` reads the props of its children to render headers and cells\n * (applying `defaultColumnProps` to each child's props).\n * Components that render a `Column` (e.g. `const MyColumn = (props) => <Column {...props} />`) can be used as `Table` children too;\n * their props are read the same way (the wrapper component itself is never rendered).\n */\nexport function Column(props: ColumnProps): null {\n void props;\n return null;\n}\n","import type {\n MultiSortCallback,\n MultiSortOptions,\n MultiSortParams,\n MultiSortReturn,\n SortDirectionMap\n} from \"./types\";\n\n/**\n * Creates sort state (and a `sort` function compatible with the `Table` `sort` prop)\n * for sorting a `Table` by multiple fields.\n *\n * - Click sorts by a single field (toggling its direction if it was already sorted).\n * - SHIFT + click appends a field to the existing sort criteria (or toggles its direction).\n * - CONTROL/META + click removes a field from the sort criteria.\n *\n * Whenever the sort criteria change, new `sortBy` and `sortDirection` values are created (previous values are never mutated),\n * so they can be stored in React state (e.g. with `useState`) as passed to `sortCallback`.\n *\n * @param sortCallback Notified (with the updated `sortBy` and `sortDirection` values) whenever the sort criteria change.\n * @param options Optional default sort-by values.\n */\nexport function createMultiSort(\n sortCallback: MultiSortCallback,\n { defaultSortBy, defaultSortDirection = {} }: MultiSortOptions = {}\n): MultiSortReturn {\n if (!sortCallback) {\n throw Error(`Required parameter \"sortCallback\" not specified`);\n }\n\n // The sort criteria are replaced (never mutated) when they change,\n // so that they can be stored in React state (e.g. with useState) and compared by reference.\n // (This also leaves the caller's defaultSortBy array unchanged.)\n let sortBy: string[] = defaultSortBy ? [...defaultSortBy] : [];\n let sortDirection: SortDirectionMap = {};\n sortBy.forEach((dataKey) => {\n sortDirection[dataKey] =\n defaultSortDirection[dataKey] !== undefined\n ? defaultSortDirection[dataKey]\n : \"ASC\";\n });\n\n const toggle = (direction: SortDirectionMap[string]) =>\n direction === \"ASC\" ? \"DESC\" : \"ASC\";\n\n function sort({\n defaultSortDirection,\n event,\n sortBy: dataKey\n }: MultiSortParams): void {\n if (event.shiftKey) {\n // Shift + click appends a column to existing criteria (or toggles its direction)\n if (sortDirection[dataKey] !== undefined) {\n sortDirection = {\n ...sortDirection,\n [dataKey]: toggle(sortDirection[dataKey])\n };\n } else {\n sortBy = [...sortBy, dataKey];\n sortDirection = { ...sortDirection, [dataKey]: defaultSortDirection };\n }\n } else if (event.ctrlKey || event.metaKey) {\n // Control + click removes column from sort (if present)\n if (sortBy.includes(dataKey)) {\n sortBy = sortBy.filter((key) => key !== dataKey);\n sortDirection = { ...sortDirection };\n delete sortDirection[dataKey];\n }\n } else {\n // Sort by the selected key only.\n // If it is already selected, reverse its sort direction; else, use the default direction.\n sortDirection = {\n [dataKey]:\n sortDirection[dataKey] !== undefined\n ? toggle(sortDirection[dataKey])\n : defaultSortDirection\n };\n sortBy = [dataKey];\n }\n\n // Notify application code\n sortCallback({\n sortBy,\n sortDirection\n });\n }\n\n return {\n sort,\n // (Getters, since the sort criteria are replaced when they change)\n get sortBy() {\n return sortBy;\n },\n get sortDirection() {\n return sortDirection;\n }\n };\n}\n","import type { TableCellDataGetterParams } from \"./types\";\n\n/**\n * Default accessor for returning a cell value for a given attribute.\n * This function expects to operate on either a vanilla Object or an Immutable Map.\n * You should override the column's cellDataGetter if your data is some other type of object.\n */\nexport function defaultCellDataGetter({\n dataKey,\n rowData\n}: Pick<TableCellDataGetterParams, \"dataKey\" | \"rowData\">) {\n if (typeof rowData.get === \"function\") {\n return rowData.get(dataKey);\n } else {\n return rowData[dataKey];\n }\n}\n","import type { TableCellProps } from \"./types\";\n\n/**\n * Default cell renderer that displays an attribute as a simple string\n * You should override the column's cellRenderer if your data is some other type of object.\n */\nexport function defaultCellRenderer({\n cellData\n}: Pick<TableCellProps, \"cellData\">): string {\n if (cellData == null) {\n return \"\";\n } else {\n return String(cellData);\n }\n}\n","export type { SortDirectionType } from \"./types\";\n\n/**\n * Specifies which direction `Table` data is currently sorted in.\n */\nexport const SortDirection = {\n /**\n * Sort items in ascending order.\n * This means arranging from the lowest value to the highest (e.g. a-z, 0-9).\n */\n ASC: \"ASC\",\n\n /**\n * Sort items in descending order.\n * This means arranging from the highest value to the lowest (e.g. z-a, 9-0).\n */\n DESC: \"DESC\"\n} as const;\n","import clsx from \"clsx\";\nimport { SortDirection } from \"./SortDirection\";\nimport type { SortIndicatorProps } from \"./types\";\n\n/**\n * Displayed beside a header to indicate that a Table is currently sorted by this column.\n */\nexport function SortIndicator({ sortDirection }: SortIndicatorProps) {\n const classNames = clsx(\"ReactVirtualized__Table__sortableHeaderIcon\", {\n \"ReactVirtualized__Table__sortableHeaderIcon--ASC\":\n sortDirection === SortDirection.ASC,\n \"ReactVirtualized__Table__sortableHeaderIcon--DESC\":\n sortDirection === SortDirection.DESC\n });\n\n return (\n <svg className={classNames} width={18} height={18} viewBox=\"0 0 24 24\">\n {sortDirection === SortDirection.ASC ? (\n <path d=\"M7 14l5-5 5 5z\" />\n ) : (\n <path d=\"M7 10l5 5 5-5z\" />\n )}\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n </svg>\n );\n}\n","import type { ReactElement } from \"react\";\nimport { SortIndicator } from \"./SortIndicator\";\nimport type { TableHeaderProps } from \"./types\";\n\n/**\n * Default table header renderer.\n */\nexport function defaultHeaderRenderer({\n dataKey,\n label,\n sortBy,\n sortDirection\n}: Pick<\n TableHeaderProps,\n \"dataKey\" | \"label\" | \"sortBy\" | \"sortDirection\"\n>): ReactElement[] {\n const showSortIndicator = sortBy === dataKey;\n const children = [\n <span\n className=\"ReactVirtualized__Table__headerTruncatedText\"\n key=\"label\"\n // null (rather than undefined) is intentional; it matches the original implementation\n title={(typeof label === \"string\" ? label : null) as string | undefined}\n >\n {label}\n </span>\n ];\n\n if (showSortIndicator) {\n children.push(\n <SortIndicator key=\"SortIndicator\" sortDirection={sortDirection} />\n );\n }\n\n return children;\n}\n","import { defaultCellDataGetter } from \"./defaultCellDataGetter\";\nimport { defaultCellRenderer } from \"./defaultCellRenderer\";\nimport { defaultHeaderRenderer } from \"./defaultHeaderRenderer\";\nimport { SortDirection } from \"./SortDirection\";\nimport type { ColumnProps } from \"./types\";\n\ntype DefaultedPropKeys =\n | \"cellDataGetter\"\n | \"cellRenderer\"\n | \"defaultSortDirection\"\n | \"flexGrow\"\n | \"flexShrink\"\n | \"headerRenderer\"\n | \"style\";\n\n/** Column props, with the props that have default values marked as required. */\nexport type ColumnPropsWithDefaults = ColumnProps &\n Required<Pick<ColumnProps, DefaultedPropKeys>>;\n\n/**\n * Default values for `Column`'s optional props.\n * `Table` applies these to the props of each of its child elements (so wrapper components work as columns too).\n * (The PURE annotations let bundlers drop this object if it isn't used.)\n */\nexport const defaultColumnProps: Readonly<\n Required<Pick<ColumnProps, DefaultedPropKeys>>\n> = /* @__PURE__ */ Object.freeze({\n cellDataGetter: defaultCellDataGetter,\n cellRenderer: defaultCellRenderer,\n defaultSortDirection: SortDirection.ASC,\n flexGrow: 0,\n flexShrink: 1,\n headerRenderer: defaultHeaderRenderer,\n style: /* @__PURE__ */ Object.freeze({})\n});\n","import type { TableHeaderRowProps } from \"./types\";\n\n/**\n * Default table header row renderer.\n */\nexport function defaultHeaderRowRenderer({\n className,\n columns,\n style\n}: TableHeaderRowProps) {\n return (\n <div className={className} role=\"row\" style={style}>\n {columns}\n </div>\n );\n}\n","import type { HTMLAttributes } from \"react\";\nimport type { TableRowProps } from \"./types\";\n\n/**\n * Default row renderer for Table.\n */\nexport function defaultRowRenderer({\n className,\n columns,\n index,\n key,\n onRowClick,\n onRowDoubleClick,\n onRowMouseOut,\n onRowMouseOver,\n onRowRightClick,\n rowData,\n style\n}: TableRowProps) {\n const a11yProps: HTMLAttributes<HTMLDivElement> = {\n \"aria-rowindex\": index + 1\n };\n\n if (\n onRowClick ||\n onRowDoubleClick ||\n onRowMouseOut ||\n onRowMouseOver ||\n onRowRightClick\n ) {\n a11yProps[\"aria-label\"] = \"row\";\n a11yProps.tabIndex = 0;\n\n if (onRowClick) {\n a11yProps.onClick = (event) => onRowClick({ event, index, rowData });\n }\n if (onRowDoubleClick) {\n a11yProps.onDoubleClick = (event) =>\n onRowDoubleClick({ event, index, rowData });\n }\n if (onRowMouseOut) {\n a11yProps.onMouseOut = (event) =>\n onRowMouseOut({ event, index, rowData });\n }\n if (onRowMouseOver) {\n a11yProps.onMouseOver = (event) =>\n onRowMouseOver({ event, index, rowData });\n }\n if (onRowRightClick) {\n a11yProps.onContextMenu = (event) =>\n onRowRightClick({ event, index, rowData });\n }\n }\n\n return (\n <div\n {...a11yProps}\n className={className}\n key={key}\n role=\"row\"\n style={style}\n >\n {columns}\n </div>\n );\n}\n","import { accessibilityOverscanIndicesGetter } from \"../Grid/accessibilityOverscanIndicesGetter\";\nimport { defaultHeaderRowRenderer } from \"./defaultHeaderRowRenderer\";\nimport { defaultRowRenderer } from \"./defaultRowRenderer\";\nimport type { TableProps } from \"./types\";\n\ntype DefaultedPropKeys =\n | \"disableHeader\"\n | \"estimatedRowSize\"\n | \"headerHeight\"\n | \"headerRowRenderer\"\n | \"headerStyle\"\n | \"noRowsRenderer\"\n | \"onRowsRendered\"\n | \"onScroll\"\n | \"overscanIndicesGetter\"\n | \"overscanRowCount\"\n | \"rowRenderer\"\n | \"rowStyle\"\n | \"style\";\n\n/**\n * Default values for `Table`'s optional props.\n * (The PURE annotations let bundlers drop this object if it isn't used.)\n */\nexport const defaultTableProps: Readonly<\n Required<Pick<TableProps, DefaultedPropKeys>>\n> = /* @__PURE__ */ Object.freeze({\n disableHeader: false,\n estimatedRowSize: 30,\n headerHeight: 0,\n headerRowRenderer: defaultHeaderRowRenderer,\n headerStyle: /* @__PURE__ */ Object.freeze({}),\n noRowsRenderer: () => null,\n onRowsRendered: () => null,\n onScroll: () => null,\n overscanIndicesGetter: accessibilityOverscanIndicesGetter,\n overscanRowCount: 10,\n rowRenderer: defaultRowRenderer,\n rowStyle: /* @__PURE__ */ Object.freeze({}),\n style: /* @__PURE__ */ Object.freeze({})\n});\n","import clsx from \"clsx\";\nimport {\n Children,\n forwardRef,\n isValidElement,\n memo,\n useCallback,\n useImperativeHandle,\n useInsertionEffect,\n useMemo,\n useState,\n type AriaAttributes,\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode\n} from \"react\";\nimport {\n createInnerGridRef,\n type InnerGridRef\n} from \"../../utils/createInnerGridRef\";\nimport { useMissingHeightWarning } from \"../../utils/scrollElement/useMissingHeightWarning\";\nimport { useIsomorphicLayoutEffect } from \"../../utils/useIsomorphicLayoutEffect\";\nimport { Grid } from \"../Grid/Grid\";\nimport type {\n CellRenderer,\n CellRendererParams,\n GridProps,\n RenderedSection,\n Scroll\n} from \"../Grid/types\";\nimport {\n defaultColumnProps,\n type ColumnPropsWithDefaults\n} from \"./defaultColumnProps\";\nimport { defaultTableProps } from \"./defaultTableProps\";\nimport { SortDirection } from \"./SortDirection\";\nimport type {\n TableImperativeAPI,\n TableProps,\n TableRowsRenderedParams,\n TableScrollParams\n} from \"./types\";\n\n/**\n * Returns a child element's props with `defaultColumnProps` applied (to the props that are undefined).\n *\n * `Table` reads the props of its children without rendering them,\n * so the defaults are applied to any child element (not only `Column` elements);\n * this allows components that wrap `Column` to be used as columns as well.\n */\nfunction getColumnProps(child: ReactNode): ColumnPropsWithDefaults {\n const props = (\n isValidElement(child) ? child.props : {}\n ) as ColumnPropsWithDefaults;\n\n const resolved: Record<string, unknown> = { ...props };\n for (const key in defaultColumnProps) {\n if (resolved[key] === undefined) {\n resolved[key] =\n defaultColumnProps[key as keyof typeof defaultColumnProps];\n }\n }\n\n return resolved as ColumnPropsWithDefaults;\n}\n\n/** Determines the flex-shrink, flex-grow, and width values for a cell (header or column). */\nfunction getFlexStyleForColumn(\n column: ColumnPropsWithDefaults,\n customStyle: CSSProperties = {}\n): CSSProperties {\n const flexValue = `${column.flexGrow} ${column.flexShrink} ${column.width}px`;\n\n const style: CSSProperties = {\n ...customStyle,\n flex: flexValue,\n msFlex: flexValue,\n WebkitFlex: flexValue\n };\n\n if (column.maxWidth) {\n style.maxWidth = column.maxWidth;\n }\n\n if (column.minWidth) {\n style.minWidth = column.minWidth;\n }\n\n return style;\n}\n\n// Callbacks read by the (stable) Grid event handlers.\n// They are updated in an insertion effect, so they are current when the Grid calls them during its commit phase.\ntype LatestCallbacks = {\n onRowsRendered: (params: TableRowsRenderedParams) => void;\n onScroll: (params: TableScrollParams) => void;\n};\n\n// Mutable, per-instance values; only modified by effects, ref callbacks, and the Grid's cell renderer (see below).\ntype TableInternals = {\n // The inner Grid (keeps cell size invalidations requested by cells while the Table is mounting; see createInnerGridRef)\n innerGrid: InnerGridRef;\n\n // The inner Grid's scrolling container element\n gridElement: HTMLDivElement | null;\n\n latest: LatestCallbacks;\n};\n\nfunction createTableInstance(latest: LatestCallbacks) {\n const internals: TableInternals = {\n gridElement: null,\n innerGrid: createInnerGridRef(),\n latest\n };\n\n const { getGrid } = internals.innerGrid;\n\n const handle: TableImperativeAPI = {\n forceUpdateGrid() {\n getGrid()?.forceUpdate();\n },\n\n getOffsetForRow({ align, alignment, index } = {}) {\n const grid = getGrid();\n if (grid) {\n const { scrollTop } = grid.getOffsetForCell({\n alignment: align ?? alignment,\n rowIndex: index\n });\n\n return scrollTop;\n }\n return 0;\n },\n\n getScrollbarWidth() {\n const element = internals.gridElement;\n if (element) {\n const clientWidth = element.clientWidth || 0;\n const offsetWidth = element.offsetWidth || 0;\n return offsetWidth - clientWidth;\n }\n\n return 0;\n },\n\n invalidateCellSizeAfterRender({ columnIndex, rowIndex }) {\n internals.innerGrid.invalidateCellSizeAfterRender({\n columnIndex,\n rowIndex\n });\n },\n\n measureAllRows() {\n getGrid()?.measureAllCells();\n },\n\n recomputeGridSize({ columnIndex = 0, rowIndex = 0 } = {}) {\n internals.innerGrid.recomputeGridSize({ columnIndex, rowIndex });\n },\n\n recomputeRowHeights(index = 0) {\n internals.innerGrid.recomputeGridSize({\n columnIndex: 0,\n rowIndex: index\n });\n },\n\n scrollToCell({ align, columnIndex, rowIndex }) {\n getGrid()?.scrollToCell({ align, columnIndex, rowIndex });\n },\n\n scrollToPosition({ scrollTop }) {\n getGrid()?.scrollToPosition({ scrollTop });\n },\n\n scrollToRow({ align, index }) {\n getGrid()?.scrollToCell({ align, columnIndex: 0, rowIndex: index });\n }\n };\n\n const onScroll = ({ clientHeight, scrollHeight, scrollTop }: Scroll) => {\n internals.latest.onScroll({ clientHeight, scrollHeight, scrollTop });\n };\n\n const onSectionRendered = ({\n rowOverscanStartIndex,\n rowOverscanStopIndex,\n rowStartIndex,\n rowStopIndex\n }: RenderedSection) => {\n internals.latest.onRowsRendered({\n overscanStartIndex: rowOverscanStartIndex,\n overscanStopIndex: rowOverscanStopIndex,\n startIndex: rowStartIndex,\n stopIndex: rowStopIndex\n });\n };\n\n const setGridRef = internals.innerGrid.setGridRef;\n\n const setGridElementRef = (element: HTMLDivElement | null) => {\n internals.gridElement = element;\n };\n\n return {\n handle,\n internals,\n onScroll,\n onSectionRendered,\n setGridElementRef,\n setGridRef\n };\n}\n\n/**\n * Table component with fixed headers and virtualized rows for improved performance with large data sets.\n * This component expects explicit width, height, and padding parameters.\n *\n * Columns are described by `Column` children (or components that render a `Column`).\n * Scrolling is done through the imperative handle (`ref`): see `scrollToRow`, `scrollToCell`, and `scrollToPosition`.\n */\nexport const Table = /* @__PURE__ */ memo(\n /* @__PURE__ */ forwardRef<TableImperativeAPI, TableProps>(\n function Table(props, ref) {\n const {\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n children,\n className,\n disableHeader = defaultTableProps.disableHeader,\n estimatedRowSize = defaultTableProps.estimatedRowSize,\n gridClassName,\n gridStyle,\n headerClassName,\n headerHeight = defaultTableProps.headerHeight,\n headerRowRenderer = defaultTableProps.headerRowRenderer,\n headerStyle = defaultTableProps.headerStyle,\n height,\n id,\n noRowsRenderer = defaultTableProps.noRowsRenderer,\n onColumnClick,\n onHeaderClick,\n onRowClick,\n onRowDoubleClick,\n onRowMouseOut,\n onRowMouseOver,\n onRowRightClick,\n onRowsRendered = defaultTableProps.onRowsRendered,\n onScroll = defaultTableProps.onScroll,\n overscanIndicesGetter = defaultTableProps.overscanIndicesGetter,\n overscanRowCount = defaultTableProps.overscanRowCount,\n rowClassName,\n rowCount,\n rowGetter,\n rowHeight,\n rowRenderer = defaultTableProps.rowRenderer,\n rowStyle = defaultTableProps.rowStyle,\n scrollElement,\n sort,\n sortBy,\n sortDirection,\n style = defaultTableProps.style,\n width\n } = props;\n\n const [scrollbarWidth, setScrollbarWidth] = useState(0);\n\n // The instance (and its stable imperative handle) is created once\n const [\n {\n handle,\n internals,\n onScroll: onGridScroll,\n onSectionRendered,\n setGridElementRef,\n setGridRef\n }\n ] = useState(() => createTableInstance({ onRowsRendered, onScroll }));\n\n useImperativeHandle(ref, () => handle, [handle]);\n\n useMissingHeightWarning(\"Table\", height, scrollElement);\n\n useInsertionEffect(() => {\n internals.latest = { onRowsRendered, onScroll };\n });\n\n // Equivalent of the 9.x componentDidMount/componentDidUpdate:\n // the header row is padded by the width of the inner Grid's vertical scrollbar (if any).\n // (Setting the same value again does not re-render.)\n useIsomorphicLayoutEffect(() => {\n setScrollbarWidth(handle.getScrollbarWidth());\n });\n\n // Column props (with defaults applied) and the cached column flex styles (shared by all rows);\n // these are recomputed only when the children change.\n // Header and row cells are keyed by their Column's key (Children.toArray provides a unique key for every child,\n // based on its own key if it has one), so that the cells of a column move with it when columns are reordered (#1725).\n const [columns, columnKeys] = useMemo(() => {\n const columnElements = Children.toArray(children);\n return [\n columnElements.map(getColumnProps),\n columnElements.map((child, index) =>\n isValidElement(child) && child.key !== null\n ? String(child.key)\n : String(index)\n )\n ];\n }, [children]);\n const cachedColumnStyles = useMemo(\n () =>\n columns.map(\n (column): CSSProperties => ({\n overflow: \"hidden\",\n ...getFlexStyleForColumn(\n column,\n column.style || defaultColumnProps.style\n )\n })\n ),\n [columns]\n );\n\n const createRow = useCallback(\n ({\n rowIndex: index,\n isScrolling,\n key,\n style: cellStyle\n }: CellRendererParams): ReturnType<CellRenderer> => {\n const rowClass =\n typeof rowClassName === \"function\"\n ? rowClassName({ index })\n : rowClassName;\n const rowStyleObject =\n typeof rowStyle === \"function\" ? rowStyle({ index }) : rowStyle;\n const rowData = rowGetter({ index });\n\n const renderedColumns = columns.map((column, columnIndex) => {\n const {\n cellDataGetter,\n cellRenderer,\n className: columnClassName,\n columnData,\n dataKey,\n id: columnId\n } = column;\n\n const cellData = cellDataGetter({ columnData, dataKey, rowData });\n const renderedCell = cellRenderer({\n cellData,\n columnData,\n columnIndex,\n dataKey,\n isScrolling,\n // CellMeasurer interop: the Table handle delegates to the inner Grid\n parent: handle,\n rowData,\n rowIndex: index\n });\n\n const onClick = (event: MouseEvent<HTMLDivElement>) => {\n if (onColumnClick) {\n onColumnClick({ columnData, dataKey, event });\n }\n };\n\n const title =\n typeof renderedCell === \"string\" ? renderedCell : null;\n\n return (\n <div\n aria-colindex={columnIndex + 1}\n aria-describedby={columnId}\n className={clsx(\n \"ReactVirtualized__Table__rowColumn\",\n columnClassName\n )}\n key={\"Row\" + index + \"-Col\" + columnKeys[columnIndex]}\n onClick={onClick}\n role=\"gridcell\"\n style={cachedColumnStyles[columnIndex]}\n title={title as string | undefined}\n >\n {renderedCell}\n </div>\n );\n });\n\n const flattenedStyle = {\n ...cellStyle,\n height:\n typeof rowHeight === \"function\"\n ? rowHeight({ index })\n : rowHeight,\n overflow: \"hidden\",\n paddingRight: scrollbarWidth,\n ...rowStyleObject\n };\n\n return rowRenderer({\n className: clsx(\"ReactVirtualized__Table__row\", rowClass),\n columns: renderedColumns,\n index,\n isScrolling,\n key,\n onRowClick,\n onRowDoubleClick,\n onRowRightClick,\n onRowMouseOver,\n onRowMouseOut,\n rowData,\n style: flattenedStyle\n }) as ReturnType<CellRenderer>;\n },\n [\n cachedColumnStyles,\n columnKeys,\n columns,\n handle,\n onColumnClick,\n onRowClick,\n onRowDoubleClick,\n onRowMouseOut,\n onRowMouseOver,\n onRowRightClick,\n rowClassName,\n rowGetter,\n rowHeight,\n rowRenderer,\n rowStyle,\n scrollbarWidth\n ]\n );\n\n const createHeader = (column: ColumnPropsWithDefaults, index: number) => {\n const {\n columnData,\n dataKey,\n defaultSortDirection,\n disableSort,\n headerRenderer,\n id: columnId,\n label\n } = column;\n const sortEnabled = !disableSort && sort;\n\n const classNames = clsx(\n \"ReactVirtualized__Table__headerColumn\",\n headerClassName,\n column.headerClassName,\n {\n ReactVirtualized__Table__sortableHeaderColumn: sortEnabled\n }\n );\n const headerColumnStyle = getFlexStyleForColumn(column, {\n ...headerStyle,\n ...column.headerStyle\n });\n\n const renderedHeader = headerRenderer({\n columnData,\n dataKey,\n disableSort,\n label,\n sortBy,\n sortDirection\n });\n\n let headerOnClick:\n | ((\n event:\n | MouseEvent<HTMLDivElement>\n | KeyboardEvent<HTMLDivElement>\n ) => void)\n | undefined,\n headerOnKeyDown:\n | ((event: KeyboardEvent<HTMLDivElement>) => void)\n | undefined,\n headerTabIndex: number | undefined,\n headerAriaSort: AriaAttributes[\"aria-sort\"],\n headerAriaLabel: string | undefined;\n\n if (sortEnabled || onHeaderClick) {\n // If this is a sortable header, clicking it should update the table data's sorting.\n const isFirstTimeSort = sortBy !== dataKey;\n\n // If this is the firstTime sort of this column, use the column default sort order.\n // Otherwise, invert the direction of the sort.\n const newSortDirection = isFirstTimeSort\n ? defaultSortDirection\n : sortDirection === SortDirection.DESC\n ? SortDirection.ASC\n : SortDirection.DESC;\n\n const onClick = (\n event: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>\n ) => {\n if (sortEnabled) {\n sort({\n defaultSortDirection,\n event,\n sortBy: dataKey,\n sortDirection: newSortDirection\n });\n }\n if (onHeaderClick) {\n onHeaderClick({ columnData, dataKey, event });\n }\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n onClick(event);\n }\n };\n\n // Label may be a non-string node; this matches the original implementation.\n headerAriaLabel = (column[\"aria-label\"] || label || dataKey) as\n | string\n | undefined;\n // Only sortable columns are announced as sortable (\"none\" = sortable, but not sorted) (#1291)\n if (sortEnabled) {\n headerAriaSort = \"none\";\n }\n headerTabIndex = 0;\n headerOnClick = onClick;\n headerOnKeyDown = onKeyDown;\n }\n\n // (The data may be sorted by a column even if the user can't change the sort order)\n if (sortBy === dataKey) {\n headerAriaSort =\n sortDirection === SortDirection.ASC ? \"ascending\" : \"descending\";\n }\n\n return (\n <div\n aria-label={headerAriaLabel}\n aria-sort={headerAriaSort}\n className={classNames}\n id={columnId}\n key={\"Header-Col\" + columnKeys[index]}\n onClick={headerOnClick}\n onKeyDown={headerOnKeyDown}\n role=\"columnheader\"\n style={headerColumnStyle}\n tabIndex={headerTabIndex}\n >\n {renderedHeader}\n </div>\n );\n };\n\n // A Table with a scrollElement is scrolled by the scroll element (e.g. the window), along with its header;\n // so the rows may fill the whole viewport (whose height is measured by the inner Grid, which receives the scrollElement).\n const availableRowsHeight =\n scrollElement !== undefined\n ? height\n : disableHeader\n ? (height ?? 0)\n : (height ?? 0) - headerHeight;\n\n const rowClass =\n typeof rowClassName === \"function\"\n ? rowClassName({ index: -1 })\n : rowClassName;\n const rowStyleObject =\n typeof rowStyle === \"function\" ? rowStyle({ index: -1 }) : rowStyle;\n\n // All Table props are passed through to the inner Grid (as in 9.x), including props that have nothing to do with Grid\n // (e.g. sortBy and sortDirection): Grid is memoized and won't re-render unless its props change,\n // so any prop that should trigger a re-render of the rows must be specified here to avoid a stale display.\n // The same goes for scrollbarWidth (which is not a Grid prop).\n // \"aria-readonly\" is null (not undefined) so that Grid's default value is not used.\n const gridProps = {\n ...props,\n \"aria-readonly\": null,\n estimatedRowSize,\n overscanIndicesGetter,\n overscanRowCount,\n scrollbarWidth\n } as unknown as GridProps;\n\n return (\n <div\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-colcount={columns.length}\n aria-rowcount={rowCount}\n className={clsx(\"ReactVirtualized__Table\", className)}\n id={id}\n role=\"grid\"\n style={style}\n >\n {!disableHeader &&\n headerRowRenderer({\n className: clsx(\"ReactVirtualized__Table__headerRow\", rowClass),\n columns: columns.map(createHeader),\n style: {\n height: headerHeight,\n overflow: \"hidden\",\n paddingRight: scrollbarWidth,\n width: width,\n ...rowStyleObject\n }\n })}\n\n <Grid\n {...gridProps}\n elementRef={setGridElementRef}\n autoContainerWidth\n className={clsx(\"ReactVirtualized__Table__Grid\", gridClassName)}\n cellRenderer={createRow}\n columnWidth={width}\n columnCount={1}\n height={availableRowsHeight}\n id={undefined}\n noContentRenderer={noRowsRenderer}\n onScroll={onGridScroll}\n onSectionRendered={onSectionRendered}\n ref={setGridRef}\n role=\"rowgroup\"\n style={{\n ...gridStyle,\n overflowX: \"hidden\"\n }}\n />\n </div>\n );\n }\n )\n);\n"],"names":["useLayoutEffect","useEffect","memo","forwardRef","ArrowKeyStepper","useState","useRef","useCallback","scrollToColumn","scrollToRow","useImperativeHandle","jsx","CellMeasurer","useInsertionEffect","element","cloneElement","isValidElement","Fragment","version","ColumnSizer","SCROLL_DIRECTION_FORWARD","DEFAULT_SCROLLING_RESET_TIME_INTERVAL","noop","increment","isNumericSizeChange","columnCount","scrollbarSize","rowCount","scrollLeft","scrollTop","onScroll","Grid","useReducer","useSyncExternalStore","jsxs","InfiniteLoader","loadMoreRows","isRowLoaded","minimumBatchSize","threshold","startIndex","stopIndex","useMemo","List","bounds","Masonry","onScrollbarPresenceChange","MultiGrid","ScrollSync","defaultSortDirection","createElement","Table","Children","rowClass","rowStyleObject"],"mappings":";;;;;;AAKO,MAAM,4BACX,OAAO,WAAW,cAAcA,MAAAA,kBAAkBC,MAAAA;ACM7C,MAAM,qDAEc,OAAO;AAAA,EAChC,UAAU;AAAA,EACV,cAAc;AAAA,EACd,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,aAAa;AACf,CAAC;ACID,MAAM,eAAqC;AAAA,EACzC,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,iBAAiB;AACnB;AAIA,SAAS,YACP,cACA,gBACA,aACA,WACsB;AACtB,M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