react-window 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-window.cjs +1 -1
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.d.ts +4 -4
- package/dist/react-window.js +664 -638
- package/dist/react-window.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-window.cjs","sources":["../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/utils/isRtl.ts","../lib/core/useIsRtl.ts","../lib/hooks/useIsHydrating.ts","../lib/utils/getOwnerWindow.ts","../lib/utils/getResizeObserverClass.ts","../lib/utils/parseNumericStyleValue.ts","../lib/hooks/useResizeObserver.ts","../lib/hooks/useStableCallback.ts","../lib/utils/getRTLOffsetType.ts","../lib/utils/adjustScrollOffsetForRtl.ts","../lib/utils/observePrecedingContent.ts","../lib/utils/scrollElement.ts","../lib/utils/assert.ts","../lib/utils/shallowCompare.ts","../lib/core/getEstimatedSize.ts","../lib/core/getOffsetForIndex.ts","../lib/core/getStartStopIndices.ts","../lib/core/createCachedBounds.ts","../lib/core/useCachedBounds.ts","../lib/core/useItemSize.ts","../lib/core/useVirtualizer.ts","../lib/hooks/useMemoizedObject.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/core/itemIndex.ts","../lib/core/useScrollToIndex.ts","../lib/hooks/useAfterResizeObserverNotifications.ts","../lib/components/list/isDynamicRowHeight.ts","../lib/components/list/List.tsx","../lib/components/list/useDynamicRowHeight.ts","../lib/components/list/useListCallbackRef.ts","../lib/components/list/useListRef.ts","../lib/components/virtualizer/useVirtualizer.ts","../lib/hooks/useIsScrolling.ts","../lib/utils/getScrollbarSize.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","export function isRtl(element: HTMLElement) {\n let currentElement: HTMLElement | null = element;\n while (currentElement) {\n if (currentElement.dir) {\n return currentElement.dir === \"rtl\";\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return false;\n}\n","import { useState, type HTMLAttributes } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { isRtl } from \"../utils/isRtl\";\n\nexport function useIsRtl(\n element: HTMLElement | null,\n dir: HTMLAttributes<HTMLElement>[\"dir\"]\n) {\n const [value, setValue] = useState(dir === \"rtl\");\n\n useIsomorphicLayoutEffect(() => {\n if (dir) {\n setValue(dir === \"rtl\");\n } else if (element) {\n setValue(isRtl(element));\n }\n }, [dir, element]);\n\n return value;\n}\n","import { useSyncExternalStore } from \"react\";\n\nfunction subscribe() {\n return () => {};\n}\n\n/**\n * Returns true when rendering on the server or while hydrating server-rendered HTML.\n * Returns false for client-only renders and for any render after hydration has completed.\n */\nexport function useIsHydrating(): boolean {\n return useSyncExternalStore(\n subscribe,\n () => false,\n () => true\n );\n}\n","export function getOwnerWindow(\n element: Element | null | undefined\n): Window & typeof globalThis {\n return element?.ownerDocument.defaultView ?? window;\n}\n","import { getOwnerWindow } from \"./getOwnerWindow\";\n\nexport function getResizeObserverClass(\n element: Element\n): typeof ResizeObserver | undefined {\n return (\n getOwnerWindow(element).ResizeObserver ??\n (typeof ResizeObserver !== \"undefined\" ? ResizeObserver : undefined)\n );\n}\n","import type { CSSProperties } from \"react\";\n\nexport function parseNumericStyleValue(\n value: CSSProperties[\"height\"]\n): number | undefined {\n if (value !== undefined) {\n switch (typeof value) {\n case \"number\": {\n return value;\n }\n case \"string\": {\n if (value.endsWith(\"px\")) {\n return parseFloat(value);\n }\n break;\n }\n }\n }\n}\n","import { useMemo, useState, type CSSProperties } from \"react\";\nimport { getResizeObserverClass } from \"../utils/getResizeObserverClass\";\nimport { parseNumericStyleValue } from \"../utils/parseNumericStyleValue\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\nexport function useResizeObserver({\n box,\n defaultHeight,\n defaultWidth,\n disabled: disabledProp,\n element,\n mode,\n style\n}: {\n box?: ResizeObserverBoxOptions;\n defaultHeight?: number;\n defaultWidth?: number;\n disabled?: boolean;\n element: HTMLElement | null;\n mode?: \"only-height\" | \"only-width\";\n style: CSSProperties | undefined;\n}) {\n const { styleHeight, styleWidth } = useMemo(\n () => ({\n styleHeight: parseNumericStyleValue(style?.height),\n styleWidth: parseNumericStyleValue(style?.width)\n }),\n [style?.height, style?.width]\n );\n\n const [state, setState] = useState<{\n height: number | undefined;\n width: number | undefined;\n }>({\n height: defaultHeight,\n width: defaultWidth\n });\n\n const disabled =\n disabledProp ||\n (mode === \"only-height\" && styleHeight !== undefined) ||\n (mode === \"only-width\" && styleWidth !== undefined) ||\n (styleHeight !== undefined && styleWidth !== undefined);\n\n useIsomorphicLayoutEffect(() => {\n if (element === null || disabled) {\n return;\n }\n\n const ResizeObserverClass = getResizeObserverClass(element);\n if (!ResizeObserverClass) {\n return;\n }\n\n const resizeObserver = new ResizeObserverClass((entries) => {\n for (const entry of entries) {\n const { contentRect, target } = entry;\n if (element === target) {\n setState((prevState) => {\n if (\n prevState.height === contentRect.height &&\n prevState.width === contentRect.width\n ) {\n return prevState;\n }\n\n return {\n height: contentRect.height,\n width: contentRect.width\n };\n });\n }\n }\n });\n resizeObserver.observe(element, { box });\n\n return () => {\n resizeObserver?.unobserve(element);\n };\n }, [box, disabled, element, styleHeight, styleWidth]);\n\n return useMemo(\n () => ({\n height: styleHeight ?? state.height,\n width: styleWidth ?? state.width\n }),\n [state, styleHeight, styleWidth]\n );\n}\n","import { useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n// Forked from useEventCallback (usehooks-ts)\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: (...args: Args) => Return\n): (...args: Args) => Return;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined {\n const ref = useRef<typeof fn>(() => {\n // This error ensures components don't render with previous/stale function\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((...args: Args) => ref.current?.(...args), [ref]) as (\n ...args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\n// Cache per document, since each window is probed separately\nconst cache = new WeakMap<Document, RTLOffsetType>();\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(\n recalculate: boolean = false,\n ownerDocument: Document = document\n): RTLOffsetType {\n let cachedRTLResult = cache.get(ownerDocument);\n if (cachedRTLResult === undefined || recalculate) {\n const outerDiv = ownerDocument.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = ownerDocument.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n ownerDocument.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n ownerDocument.body.removeChild(outerDiv);\n\n cache.set(ownerDocument, cachedRTLResult);\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (\n getRTLOffsetType(false, containerElement?.ownerDocument ?? document)\n ) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollOffset;\n }\n break;\n }\n }\n }\n }\n return scrollOffset;\n}\n","import { getOwnerWindow } from \"./getOwnerWindow\";\nimport { getResizeObserverClass } from \"./getResizeObserverClass\";\n\n/**\n * Notifies when content that precedes an element within a scroll container may have moved it\n * (without the element itself being rendered, scrolled, or resized), e.g.\n * - an image or font loading above the element\n * - a section above the element expanding or collapsing\n * - content being inserted before (or removed from before) the element\n *\n * Only content that precedes the element (or one of its ancestors) can push it, so that's all that is observed:\n * - a ResizeObserver watches the earlier siblings of the element and of each ancestor up to the container\n * - a MutationObserver watches each of those ancestors (and the container) for inserted or removed children\n *\n * ⚠️ Changes that don't resize an element (e.g. margins or transforms) and layouts where later content moves the element\n * (e.g. flex or grid alignment) are not observed.\n *\n * @returns a function that stops observing\n */\nexport function observePrecedingContent({\n container,\n element,\n onChange\n}: {\n container: Element;\n element: Element;\n onChange: () => void;\n}): () => void {\n const ownerWindow = getOwnerWindow(element);\n const ResizeObserverClass = getResizeObserverClass(element);\n const MutationObserverClass =\n ownerWindow.MutationObserver ??\n (typeof MutationObserver !== \"undefined\" ? MutationObserver : undefined);\n\n const resizeObserver = ResizeObserverClass\n ? new ResizeObserverClass(onChange)\n : undefined;\n\n // Whether a node comes before the element (or contains it);\n // nodes that are no longer connected can't be compared, so assume that they did\n const precedesElement = (node: Node) =>\n !node.isConnected ||\n (node.compareDocumentPosition(element) &\n Node.DOCUMENT_POSITION_FOLLOWING) !==\n 0;\n\n const mutationObserver = MutationObserverClass\n ? new MutationObserverClass((records) => {\n // Only content inserted or removed before the element can move it;\n // e.g. portals (tooltips, modals) are usually inserted at the end of the <body>\n const affectsElement = records.some(\n (record) =>\n Array.from(record.addedNodes).some(precedesElement) ||\n // Removed nodes preceded the element if the node after them still does (or contains the element)\n (record.removedNodes.length > 0 &&\n record.nextSibling !== null &&\n precedesElement(record.nextSibling))\n );\n if (affectsElement) {\n // Inserted or removed elements change which siblings precede the element\n observe();\n onChange();\n }\n })\n : undefined;\n\n const observedElements = new Set<Element>();\n\n const observe = () => {\n // Unobserve elements individually (rather than disconnecting) so the ResizeObserver can be reused\n for (const sibling of observedElements) {\n resizeObserver?.unobserve(sibling);\n }\n observedElements.clear();\n mutationObserver?.disconnect();\n\n let current: Element = element;\n while (current !== container) {\n const parent: Element | null = current.parentElement;\n if (parent === null) {\n // The element isn't within the container (e.g. it has been removed)\n break;\n }\n\n if (resizeObserver) {\n for (\n let sibling = current.previousElementSibling;\n sibling !== null;\n sibling = sibling.previousElementSibling\n ) {\n observedElements.add(sibling);\n resizeObserver.observe(sibling);\n }\n }\n\n mutationObserver?.observe(parent, { childList: true });\n\n current = parent;\n }\n };\n\n observe();\n\n return () => {\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n };\n}\n","import type { Direction } from \"../core/types\";\nimport { adjustScrollOffsetForRtl } from \"./adjustScrollOffsetForRtl\";\nimport { getOwnerWindow } from \"./getOwnerWindow\";\n\n/**\n * Element that scrolls a list or grid, if not the list or grid itself:\n * - \"window\" to scroll with the page\n * - an ancestor element that scrolls (or null until it has mounted)\n */\nexport type ScrollElement = \"window\" | HTMLElement | null;\n\nexport type ScrollTarget = HTMLElement | Window;\n\nexport function isWindow(target: ScrollTarget): target is Window {\n return (target as Window).window === target;\n}\n\nexport function getScrollTarget(\n containerElement: HTMLElement | null,\n scrollElement: ScrollElement | undefined\n): ScrollTarget | null {\n if (scrollElement === \"window\") {\n // Use the container's own window (e.g. a popup rendered into via a portal)\n return containerElement ? getOwnerWindow(containerElement) : null;\n }\n\n return scrollElement ?? null;\n}\n\nexport function getScrollPosition(\n target: ScrollTarget,\n direction: Direction\n): number {\n if (isWindow(target)) {\n return direction === \"vertical\" ? target.scrollY : target.scrollX;\n }\n\n return direction === \"vertical\" ? target.scrollTop : target.scrollLeft;\n}\n\nexport function getMaxScrollPosition(\n target: ScrollTarget,\n direction: Direction\n): number {\n const element = isWindow(target)\n ? (target.document.scrollingElement ?? target.document.documentElement)\n : target;\n\n return direction === \"vertical\"\n ? element.scrollHeight - element.clientHeight\n : element.scrollWidth - element.clientWidth;\n}\n\nexport function scrollTargetTo(\n target: ScrollTarget | null,\n options: ScrollToOptions\n) {\n if (target && typeof target.scrollTo === \"function\") {\n target.scrollTo(options);\n }\n}\n\n/**\n * Whether the container scrolls its own content along this axis\n * (e.g. a grid that scrolls its columns while rows scroll with the page).\n */\nexport function isSelfScrolling(\n containerElement: HTMLElement,\n direction: Direction\n): boolean {\n const { overflowX, overflowY } =\n getOwnerWindow(containerElement).getComputedStyle(containerElement);\n const overflow = direction === \"vertical\" ? overflowY : overflowX;\n if (overflow === \"visible\" || overflow === \"clip\") {\n // Rows that overflow their estimated size can't be scrolled to\n return false;\n }\n\n // Allow for rounding (scroll and client sizes are rounded separately, e.g. for fractional item sizes)\n return direction === \"vertical\"\n ? containerElement.scrollHeight - containerElement.clientHeight > 1\n : containerElement.scrollWidth - containerElement.clientWidth > 1;\n}\n\n/**\n * Measures the region of the container that is visible within the scroll element's viewport.\n *\n * Offsets are relative to the start of the container's content (the right edge for horizontal RTL content):\n * - offset and size describe the visible region (size is 0 if the container is outside of the viewport)\n * - viewportOffset is the position of the viewport's start (negative if the container starts after it)\n * - viewportSize is the size of the scroll element's viewport\n */\nexport function measureScrollElementViewport({\n containerElement,\n direction,\n isRtl,\n scrollTarget\n}: {\n containerElement: HTMLElement;\n direction: Direction;\n isRtl: boolean;\n scrollTarget: ScrollTarget;\n}): {\n offset: number;\n size: number;\n viewportOffset: number;\n viewportSize: number;\n} {\n const isVertical = direction === \"vertical\";\n\n let viewStart: number;\n let viewportSize: number;\n if (isWindow(scrollTarget)) {\n const { documentElement } = scrollTarget.document;\n viewStart = 0;\n viewportSize = isVertical\n ? documentElement.clientHeight\n : documentElement.clientWidth;\n } else {\n const rect = scrollTarget.getBoundingClientRect();\n viewStart = isVertical\n ? rect.top + scrollTarget.clientTop\n : rect.left + scrollTarget.clientLeft;\n viewportSize = isVertical\n ? scrollTarget.clientHeight\n : scrollTarget.clientWidth;\n }\n const viewEnd = viewStart + viewportSize;\n\n // Positions are measured in client (physical) coordinates, so they don't depend on RTL scroll offset types\n const rect = containerElement.getBoundingClientRect();\n const elementStart = isVertical\n ? rect.top + containerElement.clientTop\n : rect.left + containerElement.clientLeft;\n const elementSize = isVertical\n ? containerElement.clientHeight\n : containerElement.clientWidth;\n const elementEnd = elementStart + elementSize;\n\n // The container may also scroll its own content (e.g. a grid's columns)\n const ownScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: isVertical\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n });\n\n const isReversed = !isVertical && isRtl;\n const viewportStartWithinElement = isReversed\n ? elementEnd - viewEnd\n : viewStart - elementStart;\n const viewportEndWithinElement = viewportStartWithinElement + viewportSize;\n\n const visibleStart = Math.max(0, viewportStartWithinElement);\n const visibleEnd = Math.min(elementSize, viewportEndWithinElement);\n\n return {\n offset: ownScrollOffset + visibleStart,\n size: Math.max(0, visibleEnd - visibleStart),\n viewportOffset: ownScrollOffset + viewportStartWithinElement,\n viewportSize\n };\n}\n\n/**\n * CSS scroll-padding of the element (or window) being scrolled, along one axis;\n * like the browser's own scrollIntoView, scrolling to an item aligns it within the padded viewport\n * (e.g. so it isn't hidden under a sticky header).\n *\n * Percentages are relative to the viewport size; other values (e.g. \"auto\") are treated as 0.\n */\nexport function getScrollPadding({\n direction,\n isRtl,\n scrollTarget,\n viewportSize\n}: {\n direction: Direction;\n isRtl: boolean;\n scrollTarget: ScrollTarget;\n viewportSize: number;\n}): { end: number; start: number } {\n // The window's scroll padding is specified on the root element\n const element = isWindow(scrollTarget)\n ? scrollTarget.document.documentElement\n : scrollTarget;\n const style = getOwnerWindow(element).getComputedStyle(element);\n\n const parse = (value: string | undefined) => {\n const number = parseFloat(value ?? \"\");\n if (!Number.isFinite(number) || number < 0) {\n return 0;\n } else if (value!.endsWith(\"px\")) {\n return number;\n } else if (value!.endsWith(\"%\")) {\n return (number * viewportSize) / 100;\n }\n return 0;\n };\n\n if (direction === \"vertical\") {\n return {\n end: parse(style.scrollPaddingBottom),\n start: parse(style.scrollPaddingTop)\n };\n }\n\n // Horizontal RTL content starts at the right edge\n const left = parse(style.scrollPaddingLeft);\n const right = parse(style.scrollPaddingRight);\n return isRtl ? { end: left, start: right } : { end: right, start: left };\n}\n","export function assert(\n expectedCondition: unknown,\n message: string = \"Assertion error\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","import { assert } from \"./assert\";\n\nexport function shallowCompare<Type extends object>(\n a: Type | undefined,\n b: Type | undefined\n) {\n if (a === b) {\n return true;\n }\n\n if (!!a !== !!b) {\n return false;\n }\n\n assert(a !== undefined);\n assert(b !== undefined);\n\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const key in a) {\n if (!Object.hasOwn(b, key) || !Object.is(b[key], a[key])) {\n return false;\n }\n }\n\n return true;\n}\n","import type { CachedBounds, SizeFunction } from \"./types\";\nimport { assert } from \"../utils/assert\";\n\nexport function getEstimatedSize<Props extends object>({\n cachedBounds,\n itemCount,\n itemSize\n}: {\n cachedBounds: CachedBounds;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n}) {\n if (itemCount === 0) {\n return 0;\n } else if (typeof itemSize === \"number\") {\n return itemCount * itemSize;\n } else {\n const bounds = cachedBounds.get(\n cachedBounds.size === 0 ? 0 : cachedBounds.size - 1\n );\n assert(bounds !== undefined, \"Unexpected bounds cache miss\");\n\n const averageItemSize =\n (bounds.scrollOffset + bounds.size) / cachedBounds.size;\n\n return itemCount * averageItemSize;\n }\n}\n","import type { Align } from \"../types\";\nimport { getEstimatedSize } from \"./getEstimatedSize\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function getOffsetForIndex<Props extends object>({\n align,\n cachedBounds,\n clamp = true,\n index,\n itemCount,\n itemSize,\n containerScrollOffset,\n containerSize\n}: {\n align: Align;\n cachedBounds: CachedBounds;\n /**\n * Clamp the offset to the list's own scrollable range.\n * Lists that scroll with an outer element can scroll beyond their own bounds (e.g. to show content above the list);\n * the outer element's scrollable range is enforced by the browser instead.\n */\n clamp?: boolean;\n index: number;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n containerScrollOffset: number;\n containerSize: number;\n}) {\n if (index < 0 || index >= itemCount) {\n throw RangeError(`Invalid index specified: ${index}`, {\n cause: `Index ${index} is not within the range of 0 - ${itemCount - 1}`\n });\n }\n\n // Populate the target bounds before estimating the total from cached sizes.\n const bounds = cachedBounds.get(index);\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const clampOffset = (offset: number) =>\n clamp\n ? Math.max(0, Math.min(estimatedTotalSize - containerSize, offset))\n : offset;\n\n const maxOffset = clampOffset(bounds.scrollOffset);\n const minOffset = clamp\n ? Math.max(0, bounds.scrollOffset - containerSize + bounds.size)\n : bounds.scrollOffset - containerSize + bounds.size;\n\n // Visibility depends on the row itself, not the estimated scroll extent.\n // For oversized rows, leave the offset alone when the row fills the viewport.\n const isVisible =\n bounds.size > containerSize\n ? containerScrollOffset >= bounds.scrollOffset &&\n containerScrollOffset <= minOffset\n : containerScrollOffset >= minOffset &&\n containerScrollOffset <= bounds.scrollOffset;\n\n if (align === \"smart\") {\n align = isVisible ? \"auto\" : \"center\";\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n return clampOffset(\n bounds.scrollOffset + bounds.size / 2 - containerSize / 2\n );\n }\n case \"auto\":\n default: {\n if (isVisible) {\n return containerScrollOffset;\n } else if (containerScrollOffset < minOffset) {\n return minOffset;\n } else {\n return maxOffset;\n }\n }\n }\n}\n","import type { CachedBounds } from \"./types\";\n\nexport function getStartStopIndices({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n}: {\n cachedBounds: CachedBounds;\n containerScrollOffset: number;\n containerSize: number;\n itemCount: number;\n overscanCount: number;\n}): {\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n} {\n const maxIndex = itemCount - 1;\n\n if (itemCount === 0) {\n return {\n startIndexVisible: 0,\n stopIndexVisible: -1,\n startIndexOverscan: 0,\n stopIndexOverscan: -1\n };\n }\n\n let startIndexVisible: number;\n let stopIndexVisible: number;\n const { itemSize } = cachedBounds;\n\n if (itemSize !== undefined) {\n if (itemSize > 0) {\n startIndexVisible = Math.max(\n 0,\n Math.min(maxIndex, Math.floor(containerScrollOffset / itemSize))\n );\n stopIndexVisible = Math.max(\n startIndexVisible,\n Math.min(\n maxIndex,\n Math.ceil((containerScrollOffset + containerSize) / itemSize) - 1\n )\n );\n } else {\n // Size is zero, negative or NaN (e.g. a percentage size before the container is measured)\n startIndexVisible = 0;\n stopIndexVisible = 0;\n }\n } else {\n // Binary search the measured prefix\n let low = 0;\n let high = Math.min(maxIndex, Math.max(0, cachedBounds.size - 1));\n\n while (low < high) {\n const middle = Math.floor((low + high) / 2);\n const bounds = cachedBounds.get(middle);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n high = middle;\n } else {\n low = middle + 1;\n }\n }\n\n // Extend sequentially beyond the measured prefix to avoid evaluating item sizes past the viewport\n while (low < maxIndex) {\n const bounds = cachedBounds.get(low);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) break;\n low++;\n }\n\n startIndexVisible = low;\n stopIndexVisible = low;\n while (stopIndexVisible < maxIndex) {\n const bounds = cachedBounds.get(stopIndexVisible);\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n )\n break;\n stopIndexVisible++;\n }\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan: Math.max(0, startIndexVisible - overscanCount),\n stopIndexOverscan: Math.min(maxIndex, stopIndexVisible + overscanCount)\n };\n}\n","import { assert } from \"../utils/assert\";\nimport type { Bounds, CachedBounds, SizeFunction } from \"./types\";\n\nexport function createCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n const cache = new Map<number, Bounds>();\n\n return {\n itemSize: typeof itemSize === \"number\" ? itemSize : undefined,\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n if (typeof itemSize === \"number\") {\n assert(index >= 0, `Invalid index ${index}`);\n return { size: itemSize, scrollOffset: index * itemSize };\n }\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n const size = itemSize(currentIndex, itemProps);\n\n if (currentIndex === 0) {\n cache.set(currentIndex, {\n size,\n scrollOffset: 0\n });\n } else {\n const previousRowBounds = cache.get(currentIndex - 1);\n assert(\n previousRowBounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n cache.set(currentIndex, {\n scrollOffset:\n previousRowBounds.scrollOffset + previousRowBounds.size,\n size\n });\n }\n }\n\n const bounds = cache.get(index);\n assert(\n bounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n return bounds;\n },\n set(index: number, bounds: Bounds) {\n cache.set(index, bounds);\n },\n get size() {\n return cache.size;\n }\n };\n}\n","import { useMemo } from \"react\";\nimport { createCachedBounds } from \"./createCachedBounds\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function useCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n return useMemo(\n () =>\n createCachedBounds({\n itemCount,\n itemProps,\n itemSize\n }),\n [itemCount, itemProps, itemSize]\n );\n}\n","import { assert } from \"../utils/assert\";\nimport type { SizeFunction } from \"./types\";\n\nexport function useItemSize<Props extends object>({\n containerSize,\n itemSize: itemSizeProp\n}: {\n containerSize: number;\n itemSize: number | string | SizeFunction<Props>;\n}) {\n let itemSize: number | SizeFunction<Props>;\n switch (typeof itemSizeProp) {\n case \"string\": {\n assert(\n itemSizeProp.endsWith(\"%\"),\n `Invalid item size: \"${itemSizeProp}\"; string values must be percentages (e.g. \"100%\")`\n );\n assert(\n containerSize !== undefined,\n \"Container size must be defined if a percentage item size is specified\"\n );\n\n itemSize = (containerSize * parseFloat(itemSizeProp)) / 100;\n break;\n }\n default: {\n itemSize = itemSizeProp;\n break;\n }\n }\n\n // Normalize invalid sizes (e.g. NaN from a malformed percentage) so they don't produce NaN offsets\n if (\n typeof itemSize === \"number\" &&\n !(Number.isFinite(itemSize) && itemSize > 0)\n ) {\n itemSize = 0;\n }\n\n return itemSize;\n}\n","import { useCallback, useRef, useState, type CSSProperties } from \"react\";\nimport { useIsHydrating } from \"../hooks/useIsHydrating\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { adjustScrollOffsetForRtl } from \"../utils/adjustScrollOffsetForRtl\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport { getResizeObserverClass } from \"../utils/getResizeObserverClass\";\nimport { isRtl as isRtlUtil } from \"../utils/isRtl\";\nimport { observePrecedingContent } from \"../utils/observePrecedingContent\";\nimport {\n getScrollPadding,\n getScrollPosition,\n getScrollTarget,\n isSelfScrolling,\n isWindow,\n measureScrollElementViewport,\n type ScrollElement,\n type ScrollTarget\n} from \"../utils/scrollElement\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\nimport { getEstimatedSize as getEstimatedSizeUtil } from \"./getEstimatedSize\";\nimport { getOffsetForIndex } from \"./getOffsetForIndex\";\nimport { getStartStopIndices as getStartStopIndicesUtil } from \"./getStartStopIndices\";\nimport type { Direction, SizeFunction } from \"./types\";\nimport { useCachedBounds } from \"./useCachedBounds\";\nimport { useItemSize } from \"./useItemSize\";\n\nexport function useVirtualizer<Props extends object>({\n containerElement,\n containerStyle,\n defaultContainerSize = 0,\n defaultScrollOffset = 0,\n direction,\n isRtl = false,\n itemCount,\n itemProps,\n itemSize: itemSizeProp,\n onResize,\n overscanCount,\n scrollElement\n}: {\n containerElement: HTMLElement | null;\n containerStyle?: CSSProperties;\n defaultContainerSize?: number;\n defaultScrollOffset?: number;\n direction: Direction;\n isRtl?: boolean;\n itemCount: number;\n itemProps: Props;\n itemSize: number | string | SizeFunction<Props>;\n onResize:\n | ((\n size: { height: number; width: number },\n prevSize: { height: number; width: number }\n ) => void)\n | undefined;\n overscanCount: number;\n scrollElement?: ScrollElement | undefined;\n}) {\n // Lists that scroll with an outer element (e.g. the page) render at their full size;\n // the visible region is measured relative to the outer element's viewport.\n const isScrollElementMode = scrollElement !== undefined;\n const scrollTarget = isScrollElementMode\n ? getScrollTarget(containerElement, scrollElement)\n : containerElement;\n\n const { height = defaultContainerSize, width = defaultContainerSize } =\n useResizeObserver({\n defaultHeight:\n direction === \"vertical\" ? defaultContainerSize : undefined,\n defaultWidth:\n direction === \"horizontal\" ? defaultContainerSize : undefined,\n element: containerElement,\n mode: direction === \"vertical\" ? \"only-height\" : \"only-width\",\n style: containerStyle\n });\n\n const prevSizeRef = useRef<{ height: number; width: number }>({\n height: 0,\n width: 0\n });\n\n // Percentage item sizes are relative to the scroll element's viewport in scroll element mode\n const [viewportSize, setViewportSize] = useState(defaultContainerSize);\n\n const containerSize = isScrollElementMode\n ? viewportSize\n : direction === \"vertical\"\n ? height\n : width;\n\n const itemSize = useItemSize({ containerSize, itemSize: itemSizeProp });\n\n useIsomorphicLayoutEffect(() => {\n if (typeof onResize === \"function\") {\n const prevSize = prevSizeRef.current;\n\n if (prevSize.height !== height || prevSize.width !== width) {\n onResize({ height, width }, { ...prevSize });\n\n prevSize.height = height;\n prevSize.width = width;\n }\n }\n }, [height, onResize, width]);\n\n const cachedBounds = useCachedBounds({\n itemCount,\n itemProps,\n itemSize\n });\n\n // Server-rendered HTML can't be scrolled, so the server (and hydration) render always starts at offset 0;\n // the default scroll offset is applied after mount (see below)\n const isHydrating = useIsHydrating();\n // Lists that scroll with an outer element don't control its initial scroll position\n const [initialScrollOffset] = useState(() =>\n isHydrating || isScrollElementMode ? 0 : defaultScrollOffset\n );\n\n const getCellBounds = useCallback(\n (index: number) => cachedBounds.get(index),\n [cachedBounds]\n );\n\n const [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>(() =>\n getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: initialScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n })\n );\n\n // Guard against temporarily invalid indices that may occur when item count decreases\n // Cached bounds object will be re-created and a second render will restore things\n const {\n startIndexVisible,\n startIndexOverscan,\n stopIndexVisible,\n stopIndexOverscan\n } = {\n startIndexVisible: Math.min(itemCount - 1, indices.startIndexVisible),\n startIndexOverscan: Math.min(itemCount - 1, indices.startIndexOverscan),\n stopIndexVisible: Math.min(itemCount - 1, indices.stopIndexVisible),\n stopIndexOverscan: Math.min(itemCount - 1, indices.stopIndexOverscan)\n };\n\n const getEstimatedSize = useCallback(\n () =>\n getEstimatedSizeUtil({\n cachedBounds,\n itemCount,\n itemSize\n }),\n [cachedBounds, itemCount, itemSize]\n );\n\n const getStartStopIndices = useCallback(\n (scrollOffset: number) => {\n const containerScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n return getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n },\n [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]\n );\n\n // Apply the default scroll offset once, when the container first mounts with items to scroll to\n // (content can't be scrolled before then, e.g. while data is loading).\n // This effect must run before the one below that syncs indices with the current scroll offset.\n const hasAppliedDefaultScrollOffsetRef = useRef(false);\n useIsomorphicLayoutEffect(() => {\n if (\n !containerElement ||\n itemCount === 0 ||\n isScrollElementMode ||\n hasAppliedDefaultScrollOffsetRef.current\n ) {\n return;\n }\n\n hasAppliedDefaultScrollOffsetRef.current = true;\n\n if (defaultScrollOffset <= 0) {\n return;\n }\n\n // The isRtl prop may not have been updated yet if the direction is inherited from an ancestor\n const isRtlContainer =\n direction === \"horizontal\" && isRtlUtil(containerElement);\n\n const currentScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl: isRtlContainer,\n scrollOffset:\n direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n });\n if (currentScrollOffset !== 0) {\n // Don't override a scroll position restored by the browser (or by the user before hydration)\n return;\n }\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl: isRtlContainer,\n scrollOffset: defaultScrollOffset\n });\n\n if (typeof containerElement.scrollTo === \"function\") {\n containerElement.scrollTo({\n behavior: \"instant\",\n [direction === \"vertical\" ? \"top\" : \"left\"]: scrollOffset\n });\n } else if (direction === \"vertical\") {\n containerElement.scrollTop = scrollOffset;\n } else {\n containerElement.scrollLeft = scrollOffset;\n }\n // Intentionally only run when the container element mounts or items first become available\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [containerElement, itemCount]);\n\n useIsomorphicLayoutEffect(() => {\n if (isScrollElementMode && containerElement && scrollTarget) {\n // Measured after every render (see below)\n return;\n }\n\n const next =\n containerElement && !isScrollElementMode\n ? getStartStopIndices(\n direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n )\n : getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: initialScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n setIndices((prev) => (shallowCompare(next, prev) ? prev : next));\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n getStartStopIndices,\n initialScrollOffset,\n isScrollElementMode,\n itemCount,\n overscanCount,\n scrollTarget\n ]);\n\n useIsomorphicLayoutEffect(() => {\n if (!containerElement || isScrollElementMode) {\n return;\n }\n\n const onScroll = () => {\n setIndices((prev) => {\n const { scrollLeft, scrollTop } = containerElement;\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: direction === \"vertical\" ? scrollTop : scrollLeft\n });\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: scrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n if (shallowCompare(next, prev)) {\n return prev;\n }\n\n return next;\n });\n };\n\n containerElement.addEventListener(\"scroll\", onScroll);\n\n return () => {\n containerElement.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n isScrollElementMode,\n itemCount,\n overscanCount\n ]);\n\n const updateIndicesFromScrollElement = useStableCallback(() => {\n if (!containerElement || !scrollTarget) {\n return;\n }\n\n const { offset, size, viewportSize } = measureScrollElementViewport({\n containerElement,\n direction,\n isRtl,\n scrollTarget\n });\n\n setViewportSize(viewportSize);\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: offset,\n containerSize: size,\n itemCount,\n overscanCount\n });\n\n setIndices((prev) => (shallowCompare(next, prev) ? prev : next));\n });\n\n // The container's position within the scroll element can change whenever anything renders,\n // so measure it after every render (state updates are skipped if nothing has changed)\n useIsomorphicLayoutEffect(() => {\n if (isScrollElementMode) {\n updateIndicesFromScrollElement();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n if (!isScrollElementMode || !containerElement || !scrollTarget) {\n return;\n }\n\n const ownerWindow = getOwnerWindow(containerElement);\n const onChange = () => updateIndicesFromScrollElement();\n\n scrollTarget.addEventListener(\"scroll\", onChange, { passive: true });\n // The container may also scroll its own content (e.g. a grid's columns)\n containerElement.addEventListener(\"scroll\", onChange, { passive: true });\n ownerWindow.addEventListener(\"resize\", onChange);\n\n // The scroll element's viewport may resize without the window resizing\n let resizeObserver: ResizeObserver | undefined = undefined;\n const ResizeObserverClass = getResizeObserverClass(containerElement);\n if (ResizeObserverClass && !isWindow(scrollTarget)) {\n resizeObserver = new ResizeObserverClass(onChange);\n resizeObserver.observe(scrollTarget);\n }\n\n // Content before the container may move it without a scroll or render (e.g. an image loading above it)\n const stopObservingPrecedingContent = observePrecedingContent({\n container: isWindow(scrollTarget)\n ? scrollTarget.document.documentElement\n : scrollTarget,\n element: containerElement,\n onChange\n });\n\n return () => {\n scrollTarget.removeEventListener(\"scroll\", onChange);\n containerElement.removeEventListener(\"scroll\", onChange);\n ownerWindow.removeEventListener(\"resize\", onChange);\n resizeObserver?.disconnect();\n stopObservingPrecedingContent();\n };\n }, [\n containerElement,\n isScrollElementMode,\n scrollTarget,\n updateIndicesFromScrollElement\n ]);\n\n /**\n * Determines the scroll position that brings an item into view, and which element must be scrolled to reach it:\n * the container itself or (in scroll element mode) the scroll element.\n *\n * @throws RangeError if an invalid index is provided\n */\n const getScrollPositionForIndex = useStableCallback(\n ({\n align = \"auto\",\n index\n }: {\n align?: Align;\n index: number;\n }): { scrollOffset: number; scrollTarget: ScrollTarget } | undefined => {\n // Like the browser's scrollIntoView, respect the scrolled element's CSS scroll-padding\n // (e.g. so that items aren't aligned underneath a sticky header)\n const getOffset = ({\n clamp,\n containerScrollOffset,\n containerSize,\n padding\n }: {\n clamp: boolean;\n containerScrollOffset: number;\n containerSize: number;\n padding: { end: number; start: number };\n }) => {\n if (padding.start === 0 && padding.end === 0) {\n return getOffsetForIndex({\n align,\n cachedBounds,\n clamp,\n containerScrollOffset,\n containerSize,\n index,\n itemCount,\n itemSize\n });\n }\n\n // Align the item within the padded region of the viewport, then convert back to a scroll offset\n const offset =\n getOffsetForIndex({\n align,\n cachedBounds,\n clamp: false,\n containerScrollOffset: containerScrollOffset + padding.start,\n containerSize: Math.max(\n 0,\n containerSize - padding.start - padding.end\n ),\n index,\n itemCount,\n itemSize\n }) - padding.start;\n\n return clamp\n ? Math.max(0, Math.min(getEstimatedSize() - containerSize, offset))\n : offset;\n };\n\n if (\n isScrollElementMode &&\n containerElement &&\n scrollTarget &&\n !isSelfScrolling(containerElement, direction)\n ) {\n const { viewportOffset, viewportSize } = measureScrollElementViewport({\n containerElement,\n direction,\n isRtl,\n scrollTarget\n });\n\n // The viewport can show content before or after the container,\n // so the browser (rather than the container's own size) limits how far it scrolls\n const offset = getOffset({\n clamp: false,\n containerScrollOffset: viewportOffset,\n containerSize: viewportSize,\n padding: getScrollPadding({\n direction,\n isRtl,\n scrollTarget,\n viewportSize\n })\n });\n\n // Horizontal RTL offsets increase leftward, but scroll positions increase rightward (in modern browsers)\n const delta = offset - viewportOffset;\n const scrollDelta =\n direction === \"horizontal\" && isRtl ? -delta : delta;\n\n return {\n scrollOffset:\n getScrollPosition(scrollTarget, direction) + scrollDelta,\n scrollTarget\n };\n }\n\n const containerScrollOffset = containerElement\n ? direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n : 0;\n\n const ownContainerSize =\n isScrollElementMode && containerElement\n ? direction === \"vertical\"\n ? containerElement.clientHeight\n : containerElement.clientWidth\n : containerSize;\n\n let scrollOffset = getOffset({\n clamp: true,\n containerScrollOffset: adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: containerScrollOffset\n }),\n containerSize: ownContainerSize,\n padding: containerElement\n ? getScrollPadding({\n direction,\n isRtl,\n scrollTarget: containerElement,\n viewportSize: ownContainerSize\n })\n : { end: 0, start: 0 }\n });\n\n if (containerElement && (!isScrollElementMode || scrollTarget)) {\n scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n if (\n !isScrollElementMode &&\n typeof containerElement.scrollTo !== \"function\"\n ) {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (!shallowCompare(indices, next)) {\n setIndices(next);\n }\n }\n\n return { scrollOffset, scrollTarget: containerElement };\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n getScrollPositionForIndex,\n scrollTarget,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n };\n}\n","import { useState } from \"react\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n const [memoizedObject, setMemoizedObject] = useState(unstableObject);\n\n if (!shallowCompare(memoizedObject, unstableObject)) {\n setMemoizedObject(unstableObject);\n\n return unstableObject;\n }\n\n return memoizedObject;\n}\n","import type { CSSProperties } from \"react\";\nimport { shallowCompare } from \"./shallowCompare\";\n\n// Custom comparison function for React.memo()\n// It knows to compare individual style props and ignore the wrapper object.\n// See https://react.dev/reference/react/memo#memo\nexport function arePropsEqual(\n prevProps: { ariaAttributes: object; style: CSSProperties },\n nextProps: { ariaAttributes: object; style: CSSProperties }\n): boolean {\n const {\n ariaAttributes: prevAriaAttributes,\n style: prevStyle,\n ...prevRest\n } = prevProps;\n const {\n ariaAttributes: nextAriaAttributes,\n style: nextStyle,\n ...nextRest\n } = nextProps;\n\n return (\n shallowCompare(prevAriaAttributes, nextAriaAttributes) &&\n shallowCompare(prevStyle, nextStyle) &&\n shallowCompare(prevRest, nextRest)\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { scrollTargetTo } from \"../../utils/scrollElement\";\nimport type { GridProps } from \"./types\";\n\n/**\n * Renders data with many rows and columns.\n *\n * ℹ️ Unlike `List` rows, `Grid` cell sizes must be known ahead of time.\n * Either static sizes or something that can be derived (from the data in `CellProps`) without rendering.\n */\nexport function Grid<\n CellProps extends object,\n TagName extends TagNames = \"div\"\n>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n children,\n className,\n columnCount,\n columnKey,\n columnWidth,\n defaultHeight = 0,\n defaultScrollLeft = 0,\n defaultScrollTop = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n rowKey,\n scrollElement,\n style,\n tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>): ReactElement {\n const cellProps = useMemoizedObject(cellPropsUnstable);\n const CellComponent = useMemo(\n () => memo(CellComponentProp, arePropsEqual),\n [CellComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isRtl = useIsRtl(element, dir);\n\n // TODO With a scrollElement, each virtualizer (one per axis) separately adds scroll/resize listeners,\n // observes preceding content, and measures the grid and scroll element after every render and scroll event.\n // Measure once (e.g. in Grid) and share the result with both axes.\n const {\n getCellBounds: getColumnBounds,\n getEstimatedSize: getEstimatedWidth,\n startIndexOverscan: columnStartIndexOverscan,\n startIndexVisible: columnStartIndexVisible,\n getScrollPositionForIndex: getColumnScrollPosition,\n stopIndexOverscan: columnStopIndexOverscan,\n stopIndexVisible: columnStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultWidth,\n defaultScrollOffset: defaultScrollLeft,\n direction: \"horizontal\",\n isRtl,\n itemCount: columnCount,\n itemProps: cellProps,\n itemSize: columnWidth,\n onResize,\n overscanCount,\n scrollElement\n });\n\n const {\n getCellBounds: getRowBounds,\n getEstimatedSize: getEstimatedHeight,\n startIndexOverscan: rowStartIndexOverscan,\n startIndexVisible: rowStartIndexVisible,\n getScrollPositionForIndex: getRowScrollPosition,\n stopIndexOverscan: rowStopIndexOverscan,\n stopIndexVisible: rowStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n defaultScrollOffset: defaultScrollTop,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: cellProps,\n itemSize: rowHeight,\n onResize,\n overscanCount,\n scrollElement\n });\n\n useImperativeHandle(\n gridRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToCell({\n behavior = \"auto\",\n columnAlign = \"auto\",\n columnIndex,\n rowAlign = \"auto\",\n rowIndex\n }: {\n behavior?: ScrollBehavior;\n columnAlign?: Align;\n columnIndex: number;\n rowAlign?: Align;\n rowIndex: number;\n }) {\n const column = getColumnScrollPosition({\n align: columnAlign,\n index: columnIndex\n });\n const row = getRowScrollPosition({\n align: rowAlign,\n index: rowIndex\n });\n\n // Columns and rows may scroll different elements (e.g. columns scroll within the grid and rows scroll with the page)\n if (column && row && column.scrollTarget === row.scrollTarget) {\n scrollTargetTo(row.scrollTarget, {\n behavior,\n left: column.scrollOffset,\n top: row.scrollOffset\n });\n } else {\n if (column) {\n scrollTargetTo(column.scrollTarget, {\n behavior,\n left: column.scrollOffset\n });\n }\n if (row) {\n scrollTargetTo(row.scrollTarget, {\n behavior,\n top: row.scrollOffset\n });\n }\n }\n },\n\n scrollToColumn({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const column = getColumnScrollPosition({ align, index });\n if (column) {\n scrollTargetTo(column.scrollTarget, {\n behavior,\n left: column.scrollOffset\n });\n }\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const row = getRowScrollPosition({ align, index });\n if (row) {\n scrollTargetTo(row.scrollTarget, {\n behavior,\n top: row.scrollOffset\n });\n }\n }\n }),\n [element, getColumnScrollPosition, getRowScrollPosition]\n );\n\n useEffect(() => {\n if (\n columnStartIndexOverscan >= 0 &&\n columnStopIndexOverscan >= 0 &&\n rowStartIndexOverscan >= 0 &&\n rowStopIndexOverscan >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered(\n {\n columnStartIndex: columnStartIndexVisible,\n columnStopIndex: columnStopIndexVisible,\n rowStartIndex: rowStartIndexVisible,\n rowStopIndex: rowStopIndexVisible\n },\n {\n columnStartIndex: columnStartIndexOverscan,\n columnStopIndex: columnStopIndexOverscan,\n rowStartIndex: rowStartIndexOverscan,\n rowStopIndex: rowStopIndexOverscan\n }\n );\n }\n }, [\n onCellsRendered,\n columnStartIndexOverscan,\n columnStartIndexVisible,\n columnStopIndexOverscan,\n columnStopIndexVisible,\n rowStartIndexOverscan,\n rowStartIndexVisible,\n rowStopIndexOverscan,\n rowStopIndexVisible\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (\n let rowIndex = rowStartIndexOverscan;\n rowIndex <= rowStopIndexOverscan;\n rowIndex++\n ) {\n const rowBounds = getRowBounds(rowIndex);\n\n const columns: ReactNode[] = [];\n\n for (\n let columnIndex = columnStartIndexOverscan;\n columnIndex <= columnStopIndexOverscan;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n columns.push(\n <CellComponent\n {...(cellProps as CellProps)}\n ariaAttributes={{\n \"aria-colindex\": columnIndex + 1,\n role: \"gridcell\"\n }}\n columnIndex={columnIndex}\n key={\n columnKey\n ? columnKey({\n columnIndex,\n data: cellProps,\n rowIndex\n })\n : columnIndex\n }\n rowIndex={rowIndex}\n style={{\n position: \"absolute\",\n left: isRtl ? undefined : 0,\n right: isRtl ? 0 : undefined,\n transform: `translate(${isRtl ? -columnBounds.scrollOffset : columnBounds.scrollOffset}px, ${rowBounds.scrollOffset}px)`,\n height: rowBounds.size,\n width: columnBounds.size\n }}\n />\n );\n }\n\n children.push(\n <div\n key={\n rowKey\n ? rowKey({\n data: cellProps,\n rowIndex\n })\n : rowIndex\n }\n role=\"row\"\n aria-rowindex={rowIndex + 1}\n >\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnKey,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowKey,\n rowStartIndexOverscan,\n rowStopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedHeight(),\n width: getEstimatedWidth(),\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n \"aria-colcount\": columnCount,\n \"aria-rowcount\": rowCount,\n role: \"grid\",\n ...rest,\n className,\n dir,\n ref: setElement,\n style: {\n position: \"relative\",\n // Grids that scroll with an outer element render at their full height,\n // and at their full width unless constrained by their parent (in which case columns scroll within the grid)\n ...(scrollElement === undefined && {\n maxHeight: \"100%\",\n maxWidth: \"100%\"\n }),\n flexGrow: 1,\n overflow: \"auto\",\n ...style\n }\n },\n cells,\n children,\n sizingElement\n );\n}\n","import { useState } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Grid component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useGridCallbackRef =\n useState as typeof useState<GridImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Grid component.\n */\nexport const useGridRef = useRef as typeof useRef<GridImperativeAPI>;\n","/**\n * Attribute that List sets on each rendered row.\n */\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\n\n/**\n * Attribute that items rendered with the `useVirtualizer` hook set themselves.\n */\nexport const DATA_ATTRIBUTE_INDEX = \"data-index\";\n\n/**\n * Index of a rendered item (row), or undefined if the element doesn't specify a valid one\n * (e.g. a data-index attribute used for something else, like \"row-5\").\n */\nexport function getItemIndex(element: Element): number | undefined {\n const attribute =\n element.getAttribute(DATA_ATTRIBUTE_LIST_INDEX) ??\n element.getAttribute(DATA_ATTRIBUTE_INDEX);\n\n // Only non-negative integers (note that Number(\"\") would be 0)\n return attribute !== null && /^\\d+$/.test(attribute)\n ? Number(attribute)\n : undefined;\n}\n","import { useCallback, useRef, type RefObject } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport {\n getMaxScrollPosition,\n getScrollPosition,\n type ScrollTarget\n} from \"../utils/scrollElement\";\nimport { getItemIndex } from \"./itemIndex\";\nimport type { Bounds, Direction } from \"./types\";\n\n/**\n * Scrolls an item into view.\n *\n * Items with dynamic sizes are positioned using estimated sizes until they have been measured,\n * so scrolling to one is corrected over several frames as items around it are rendered and measured.\n * Corrections stop once the item's position is stable, after a deadline, or when the user scrolls.\n *\n * ℹ️ Dynamic sizes are only supported for vertical lists.\n */\nexport function useScrollToIndex({\n direction,\n element,\n getCellBounds,\n isDynamicSize,\n itemCount,\n itemElements,\n scrollTarget,\n getScrollPositionForIndex\n}: {\n direction: Direction;\n element: HTMLElement | null;\n getCellBounds: (index: number) => Bounds;\n isDynamicSize: boolean;\n itemCount: number;\n itemElements: RefObject<Element[]>;\n scrollTarget: ScrollTarget | null;\n getScrollPositionForIndex: (options: {\n align?: Align;\n index: number;\n }) => { scrollOffset: number; scrollTarget: ScrollTarget } | undefined;\n}): (options: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n}) => void {\n const isVertical = direction === \"vertical\";\n const pendingScroll = useRef<{\n align: Align;\n index: number;\n deadline: number;\n stableFrames: number;\n } | null>(null);\n\n // Track the window that scheduled the frame so it can be cancelled there.\n const scrollFrame = useRef<{ id: number; view: Window } | undefined>(\n undefined\n );\n\n const cancelScroll = useStableCallback(() => {\n pendingScroll.current = null;\n if (scrollFrame.current !== undefined) {\n scrollFrame.current.view.cancelAnimationFrame(scrollFrame.current.id);\n scrollFrame.current = undefined;\n }\n });\n\n // Use the list's own window (e.g. a popup rendered into via a portal),\n // since another window's frames may be throttled while it's in the background.\n const scheduleCorrectScroll = useStableCallback(() => {\n const view = getOwnerWindow(element);\n scrollFrame.current = {\n id: view.requestAnimationFrame(correctScroll),\n view\n };\n });\n\n const correctScroll = useStableCallback(() => {\n scrollFrame.current = undefined;\n const request = pendingScroll.current;\n if (!request) return;\n\n if (\n !element ||\n !isDynamicSize ||\n request.index >= itemCount ||\n performance.now() >= request.deadline\n ) {\n cancelScroll();\n return;\n }\n\n const result = getScrollPositionForIndex({\n align: request.align,\n index: request.index\n });\n if (result !== undefined) {\n const { scrollOffset, scrollTarget } = result;\n // Use the committed DOM extent: the browser clamps offsets near the end.\n const offset = Math.max(\n 0,\n Math.min(scrollOffset, getMaxScrollPosition(scrollTarget, direction))\n );\n if (Math.abs(offset - getScrollPosition(scrollTarget, direction)) > 1) {\n request.stableFrames = 0;\n scrollTarget.scrollTo({\n behavior: \"instant\",\n [isVertical ? \"top\" : \"left\"]: offset\n });\n } else {\n // An unchanged estimated offset is not enough:\n // React may not have committed the destination items or their ResizeObserver updates yet.\n const items = itemElements.current;\n const targetIsRendered = items.some(\n (item) => getItemIndex(item) === request.index\n );\n const measurementsCommitted =\n targetIsRendered &&\n items.every((item) => {\n // Items without a valid index (or left over from a larger item count) can't be checked\n const index = getItemIndex(item);\n if (index === undefined || index >= itemCount) {\n return true;\n }\n\n // ResizeObserver reports untransformed border-box sizes.\n // offsetHeight uses the same coordinate space; allow for its integer rounding.\n const size = isVertical\n ? (item as HTMLElement).offsetHeight\n : (item as HTMLElement).offsetWidth;\n return Math.abs(getCellBounds(index).size - size) <= 1;\n });\n if (!measurementsCommitted) {\n request.stableFrames = 0;\n } else if (++request.stableFrames >= 2) {\n cancelScroll();\n return;\n }\n }\n }\n scheduleCorrectScroll();\n });\n\n // User input cancels pending corrections;\n // lists that scroll with an outer element (e.g. the page) can be scrolled from outside of the list\n useIsomorphicLayoutEffect(() => {\n const target = scrollTarget ?? element;\n if (!target) return;\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n case \" \": {\n cancelScroll();\n }\n }\n };\n\n target.addEventListener(\"wheel\", cancelScroll, { passive: true });\n target.addEventListener(\"touchstart\", cancelScroll, { passive: true });\n target.addEventListener(\"pointerdown\", cancelScroll);\n target.addEventListener(\"keydown\", onKeyDown as EventListener);\n\n return () => {\n cancelScroll();\n\n target.removeEventListener(\"wheel\", cancelScroll);\n target.removeEventListener(\"touchstart\", cancelScroll);\n target.removeEventListener(\"pointerdown\", cancelScroll);\n target.removeEventListener(\"keydown\", onKeyDown as EventListener);\n };\n }, [cancelScroll, element, scrollTarget]);\n\n return useCallback(\n ({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) => {\n // Resolve smart alignment once, before measurements move the target.\n if (isDynamicSize && align === \"smart\") {\n const auto = getScrollPositionForIndex({ align: \"auto\", index });\n align =\n auto === undefined ||\n auto.scrollOffset === getScrollPosition(auto.scrollTarget, direction)\n ? \"auto\"\n : \"center\";\n }\n\n const result = getScrollPositionForIndex({ align, index });\n\n cancelScroll();\n\n if (result && typeof result.scrollTarget.scrollTo === \"function\") {\n const { scrollOffset, scrollTarget } = result;\n if (isDynamicSize) {\n pendingScroll.current = {\n align,\n index,\n deadline: performance.now() + 1000,\n stableFrames: 0\n };\n scheduleCorrectScroll();\n }\n scrollTarget.scrollTo({\n behavior: isDynamicSize ? \"instant\" : behavior,\n [isVertical ? \"top\" : \"left\"]: scrollOffset\n });\n }\n },\n [\n cancelScroll,\n direction,\n isDynamicSize,\n isVertical,\n scheduleCorrectScroll,\n getScrollPositionForIndex\n ]\n );\n}\n","import { useEffect } from \"react\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport { useStableCallback } from \"./useStableCallback\";\n\n/**\n * Calls the callback once the initial ResizeObserver notifications for elements rendered within the specified element\n * have been delivered (or would have been, if ResizeObserver is unsupported).\n *\n * ResizeObserver notifications are delivered between layout and paint, so waiting two animation frames ensures\n * that a frame has been rendered since the elements were first observed.\n */\nexport function useAfterResizeObserverNotifications({\n callback,\n element,\n enabled = true\n}: {\n callback: () => void;\n element: HTMLElement | null;\n enabled?: boolean;\n}) {\n const stableCallback = useStableCallback(callback);\n\n useEffect(() => {\n if (!enabled || !element) {\n return;\n }\n\n const ownerWindow = getOwnerWindow(element);\n let id = ownerWindow.requestAnimationFrame(() => {\n id = ownerWindow.requestAnimationFrame(stableCallback);\n });\n\n return () => {\n ownerWindow.cancelAnimationFrame(id);\n };\n }, [element, enabled, stableCallback]);\n}\n","import type { DynamicRowHeight } from \"./types\";\n\nexport function isDynamicRowHeight(value: unknown): value is DynamicRowHeight {\n return (\n value != null &&\n typeof value === \"object\" &&\n \"getAverageRowHeight\" in value &&\n typeof value.getAverageRowHeight === \"function\"\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n Fragment,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"../../core/itemIndex\";\nimport { useScrollToIndex } from \"../../core/useScrollToIndex\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useAfterResizeObserverNotifications } from \"../../hooks/useAfterResizeObserverNotifications\";\nimport { useIsHydrating } from \"../../hooks/useIsHydrating\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\n\nexport const DATA_ATTRIBUTE_SIZER = \"data-react-window-sizer\";\n\n/**\n * Renders data with many rows.\n */\nexport function List<\n RowProps extends object,\n TagName extends TagNames = \"div\"\n>({\n children,\n className,\n defaultHeight = 0,\n defaultScrollOffset = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight: rowHeightProp,\n rowKey,\n rowProps: rowPropsUnstable,\n scrollElement,\n tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>): ReactElement {\n const rowProps = useMemoizedObject(rowPropsUnstable);\n const RowComponent = useMemo(\n () => memo(RowComponentProp, arePropsEqual),\n [RowComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isDynamicRowHeight = isDynamicRowHeightUtil(rowHeightProp);\n\n const rowHeight = useMemo(() => {\n if (isDynamicRowHeight) {\n return (index: number) => {\n return (\n rowHeightProp.getRowHeight(index) ??\n rowHeightProp.getAverageRowHeight()\n );\n };\n }\n\n return rowHeightProp;\n }, [isDynamicRowHeight, rowHeightProp]);\n\n // Server-rendered rows with dynamic heights haven't been measured yet, so absolutely positioning them\n // (based on estimated heights) would cause them to overlap or leave gaps until after hydration.\n // Instead, render them in normal document flow until the first measurements are available.\n const isHydrating = useIsHydrating();\n const [isFlowLayout, setIsFlowLayout] = useState(\n () => isHydrating && isDynamicRowHeight\n );\n const flowLayoutRowHeightRef = useRef(rowHeightProp);\n useIsomorphicLayoutEffect(() => {\n if (isFlowLayout && flowLayoutRowHeightRef.current !== rowHeightProp) {\n setIsFlowLayout(false);\n }\n }, [isFlowLayout, rowHeightProp]);\n // Measurements may never arrive (e.g. if ResizeObserver is unsupported or rows have no height yet),\n // or may exactly match initialRowHeights (in which case rowHeightProp's identity doesn't change)\n useAfterResizeObserverNotifications({\n callback: () => setIsFlowLayout(false),\n element,\n enabled: isFlowLayout\n });\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollTarget,\n getScrollPositionForIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n defaultScrollOffset,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount,\n scrollElement\n });\n\n const rowElements = useRef<Element[]>([]);\n const scrollToRow = useScrollToIndex({\n direction: \"vertical\",\n element,\n getCellBounds,\n isDynamicSize: isDynamicRowHeight,\n itemCount: rowCount,\n itemElements: rowElements,\n scrollTarget,\n getScrollPositionForIndex\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n scrollToRow\n }),\n [element, scrollToRow]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n // Additional children (e.g. overlays) are not rows and must not be measured.\n const rows = Array.from(element.children)\n .slice(\n 0,\n startIndexOverscan < 0 ? 0 : stopIndexOverscan - startIndexOverscan + 1\n )\n .filter((item, index) => {\n if (item.hasAttribute(DATA_ATTRIBUTE_SIZER)) {\n // Ignore sizing element\n return false;\n }\n\n const attribute = `${startIndexOverscan + index}`;\n item.setAttribute(DATA_ATTRIBUTE_LIST_INDEX, attribute);\n\n return true;\n });\n\n rowElements.current = rows;\n\n if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n RowComponent,\n element,\n isDynamicRowHeight,\n rowCount,\n rowHeightProp,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n useEffect(() => {\n if (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onRowsRendered) {\n onRowsRendered(\n {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n },\n {\n startIndex: startIndexOverscan,\n stopIndex: stopIndexOverscan\n }\n );\n }\n }, [\n onRowsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n // Flow layout only matches the absolute layout if rendering starts at the first row\n const isFlowLayoutActive =\n isFlowLayout && isDynamicRowHeight && startIndexOverscan === 0;\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n ariaAttributes={{\n \"aria-posinset\": index + 1,\n \"aria-setsize\": rowCount,\n role: \"listitem\"\n }}\n key={rowKey ? rowKey(index, rowProps) : index}\n index={index}\n style={\n isFlowLayoutActive\n ? { width: \"100%\" }\n : {\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n // In case of dynamic row heights, don't specify a height style\n // otherwise a default/estimated height would mask the actual height\n height: isDynamicRowHeight ? undefined : bounds.size,\n width: \"100%\"\n }\n }\n />\n );\n }\n }\n return children;\n }, [\n RowComponent,\n getCellBounds,\n isDynamicRowHeight,\n isFlowLayoutActive,\n rowCount,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n key=\"sizer\"\n {...{ [DATA_ATTRIBUTE_SIZER]: \"\" }}\n style={{\n // Rows rendered in flow layout already take up space\n position: isFlowLayoutActive ? \"absolute\" : undefined,\n top: isFlowLayoutActive ? 0 : undefined,\n height: getEstimatedSize(),\n width: \"100%\",\n zIndex: -1\n }}\n ></div>\n );\n\n const childrenElement = <Fragment key=\"children\">{children}</Fragment>;\n const rowsElement = <Fragment key=\"rows\">{rows}</Fragment>;\n\n return createElement(\n tagName,\n {\n role: \"list\",\n ...rest,\n className,\n ref: setElement,\n style: {\n position: \"relative\",\n flexGrow: 1,\n // Lists that scroll with an outer element render at their full height (and must not clip sticky rows)\n ...(scrollElement === undefined && {\n maxHeight: \"100%\",\n overflowY: \"auto\"\n }),\n ...style\n }\n },\n // Rows rendered in flow layout would push children (e.g. sticky rows) below them, so render children first.\n // Keys let React move children (rather than remounting them) once rows switch to absolute layout.\n ...(isFlowLayoutActive\n ? [childrenElement, rowsElement]\n : [rowsElement, childrenElement]),\n sizingElement\n );\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { getOwnerWindow } from \"../../utils/getOwnerWindow\";\nimport { getResizeObserverClass } from \"../../utils/getResizeObserverClass\";\nimport { getItemIndex } from \"../../core/itemIndex\";\nimport type { DynamicRowHeight } from \"./types\";\n\nfunction createInitialMap(\n initialRowHeights: ReadonlyMap<number, number> | readonly number[] | undefined\n): Map<number, number> {\n const map = new Map<number, number>();\n if (initialRowHeights !== undefined) {\n // Invalid heights would corrupt cached row positions; treat them as unmeasured\n initialRowHeights.forEach((height: number, index: number) => {\n if (Number.isFinite(height) && height > 0) {\n map.set(index, height);\n }\n });\n }\n return map;\n}\n\nexport function useDynamicRowHeight({\n defaultRowHeight,\n initialRowHeights,\n key\n}: {\n /**\n * Estimated height (in pixels) of rows that have not yet been measured.\n */\n defaultRowHeight: number;\n\n /**\n * Row heights (in pixels) that are known or can be estimated ahead of time, e.g. estimated from each row's content.\n * This can be either an array (where each item is the height of the row at that index) or a Map of row index to height.\n *\n * These values are used in place of `defaultRowHeight` until rows are rendered and measured,\n * so providing them can make server-rendered lists and initial scroll positions more accurate.\n *\n * ℹ️ This value is only read when the hook first mounts and when the `key` changes.\n */\n initialRowHeights?: ReadonlyMap<number, number> | readonly number[];\n\n /**\n * Changing this value clears all measured row heights,\n * e.g. when the list renders a different set of data.\n */\n key?: string | number;\n}) {\n const [state, setState] = useState<{\n key: string | number | undefined;\n map: Map<number, number>;\n }>(() => ({\n key,\n map: createInitialMap(initialRowHeights)\n }));\n\n if (state.key !== key) {\n setState({\n key,\n map: createInitialMap(initialRowHeights)\n });\n }\n\n const { map } = state;\n\n const getAverageRowHeight = useCallback(() => {\n let totalHeight = 0;\n\n map.forEach((height) => {\n totalHeight += height;\n });\n\n if (totalHeight === 0) {\n return defaultRowHeight;\n }\n\n return totalHeight / map.size;\n }, [defaultRowHeight, map]);\n\n const getRowHeight = useCallback(\n (index: number) => {\n const measuredHeight = map.get(index);\n if (measuredHeight !== undefined) {\n return measuredHeight;\n }\n\n // Keep estimates stable when rowProps change (see issue #863), but do not\n // store them as measurements or include them in the measured average.\n return defaultRowHeight;\n },\n [defaultRowHeight, map]\n );\n\n const setRowHeight = useCallback((index: number, size: number) => {\n setState((prevState) => {\n if (prevState.map.get(index) === size) {\n return prevState;\n }\n\n const clonedMap = new Map(prevState.map);\n clonedMap.set(index, size);\n\n return {\n ...prevState,\n map: clonedMap\n };\n });\n }, []);\n\n const resizeObserverCallback = useStableCallback(\n (entries: ResizeObserverEntry[]) => {\n if (entries.length === 0) {\n return;\n }\n\n entries.forEach((entry) => {\n const { borderBoxSize, target } = entry;\n\n // Elements without a valid index can't be associated with a row\n // (useVirtualizer warns about these when they're registered)\n const index = getItemIndex(target);\n if (index === undefined) {\n return;\n }\n\n const { blockSize: height } = borderBoxSize[0];\n if (!height) {\n // Ignore heights that have not yet been measured (e.g. <img> elements that have not yet loaded)\n return;\n }\n\n setRowHeight(index, height);\n });\n }\n );\n\n // Rows may be rendered into another window (e.g. a popup rendered into via a portal),\n // and observers only report on elements in documents they belong to\n const resizeObserverRef = useRef<{\n resizeObserver: ResizeObserver;\n view: Window;\n } | null>(null);\n\n useEffect(\n () => () => {\n resizeObserverRef.current?.resizeObserver.disconnect();\n resizeObserverRef.current = null;\n },\n []\n );\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n const observed: [Element, ResizeObserver][] = [];\n\n elements.forEach((element) => {\n const view = getOwnerWindow(element);\n\n // Rows from one list share a window, so this only happens if the list moves to another window\n if (resizeObserverRef.current?.view !== view) {\n resizeObserverRef.current?.resizeObserver.disconnect();\n\n const ResizeObserverClass = getResizeObserverClass(element);\n resizeObserverRef.current = ResizeObserverClass\n ? {\n resizeObserver: new ResizeObserverClass(resizeObserverCallback),\n view\n }\n : null;\n }\n\n const resizeObserver = resizeObserverRef.current?.resizeObserver;\n if (resizeObserver) {\n resizeObserver.observe(element);\n observed.push([element, resizeObserver]);\n }\n });\n\n return () => {\n observed.forEach(([element, resizeObserver]) =>\n resizeObserver.unobserve(element)\n );\n };\n },\n [resizeObserverCallback]\n );\n\n return useMemo<DynamicRowHeight>(\n () => ({\n getAverageRowHeight,\n getRowHeight,\n setRowHeight,\n observeRowElements\n }),\n [getAverageRowHeight, getRowHeight, setRowHeight, observeRowElements]\n );\n}\n","import { useState } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the List component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useListCallbackRef =\n useState as typeof useState<ListImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the List component.\n */\nexport const useListRef = useRef as typeof useRef<ListImperativeAPI>;\n","import { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { getItemIndex } from \"../../core/itemIndex\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useScrollToIndex } from \"../../core/useScrollToIndex\";\nimport { useVirtualizer as useVirtualizerCore } from \"../../core/useVirtualizer\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { assert } from \"../../utils/assert\";\nimport { isDynamicRowHeight } from \"../list/isDynamicRowHeight\";\nimport type { DynamicRowHeight } from \"../list/types\";\nimport type { VirtualItem, Virtualizer, VirtualizerOptions } from \"./types\";\n\n// Sizes are cached based on the identity of the itemSize option\nconst ITEM_PROPS = {};\n\n/**\n * Calculates which items to render, and where, for custom (headless) virtualized content\n * (e.g. a `<table>` or a custom layout).\n *\n * The returned items are positioned relative to the start of the element's content;\n * how they are rendered (e.g. absolute positioning or spacer elements) is up to the caller.\n */\nexport function useVirtualizer({\n count,\n defaultScrollOffset = 0,\n defaultSize = 0,\n dir,\n direction = \"vertical\",\n element,\n itemSize: itemSizeOption,\n onItemsRendered,\n overscanCount = 3,\n scrollElement\n}: VirtualizerOptions): Virtualizer {\n const isDynamicSize = isDynamicRowHeight(itemSizeOption);\n assert(\n !isDynamicSize || direction === \"vertical\",\n \"Dynamic item sizes are only supported for vertical content\"\n );\n\n const itemSize = useMemo(() => {\n if (isDynamicRowHeight(itemSizeOption)) {\n return (index: number) =>\n itemSizeOption.getRowHeight(index) ??\n itemSizeOption.getAverageRowHeight();\n }\n\n return itemSizeOption;\n }, [itemSizeOption]);\n\n const isRtl = useIsRtl(element, dir);\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollTarget,\n getScrollPositionForIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizerCore({\n containerElement: element,\n defaultContainerSize: defaultSize,\n defaultScrollOffset,\n direction,\n isRtl: direction === \"horizontal\" && isRtl,\n itemCount: count,\n itemProps: ITEM_PROPS,\n itemSize,\n onResize: undefined,\n overscanCount,\n scrollElement\n });\n\n // Elements passed to measureElement; React 18 doesn't say which element unmounted (it passes null),\n // so disconnected elements are pruned after each render instead\n const measuredElementsRef = useRef(new Set<Element>());\n const warnedElementsRef = useRef(new WeakSet<Element>());\n const itemElementsRef = useRef<Element[]>([]);\n const observedRef = useRef<{\n dynamicRowHeight: DynamicRowHeight | null;\n unobserve: Map<Element, () => void>;\n }>({ dynamicRowHeight: null, unobserve: new Map() });\n\n const measureElement = useCallback((element: Element | null) => {\n if (element !== null) {\n measuredElementsRef.current.add(element);\n }\n }, []);\n\n const container = element;\n useIsomorphicLayoutEffect(() => {\n const elements = measuredElementsRef.current;\n const observed = observedRef.current;\n\n const dynamicRowHeight = isDynamicRowHeight(itemSizeOption)\n ? itemSizeOption\n : null;\n if (\n observed.dynamicRowHeight?.observeRowElements !==\n dynamicRowHeight?.observeRowElements\n ) {\n // A different cache (or none) is being used\n observed.unobserve.forEach((unobserve) => unobserve());\n observed.unobserve.clear();\n }\n observed.dynamicRowHeight = dynamicRowHeight;\n\n elements.forEach((element) => {\n if (!element.isConnected) {\n elements.delete(element);\n observed.unobserve.get(element)?.();\n observed.unobserve.delete(element);\n } else if (\n dynamicRowHeight &&\n // Like List, measure items once the element has mounted\n // (e.g. so the dynamic row height cache has finished mounting too)\n container !== null &&\n !observed.unobserve.has(element)\n ) {\n if (getItemIndex(element) === undefined) {\n // Measurements can't be associated with an item without its index\n if (!warnedElementsRef.current.has(element)) {\n warnedElementsRef.current.add(element);\n console.warn(\n \"useVirtualizer: Items passed to measureElement must specify their index with a data-index attribute\",\n element\n );\n }\n return;\n }\n\n observed.unobserve.set(\n element,\n dynamicRowHeight.observeRowElements([element])\n );\n }\n });\n\n itemElementsRef.current = Array.from(elements);\n });\n\n useEffect(() => {\n const observed = observedRef.current;\n return () => {\n observed.unobserve.forEach((unobserve) => unobserve());\n observed.unobserve.clear();\n observed.dynamicRowHeight = null;\n };\n }, []);\n\n const scrollToIndex = useScrollToIndex({\n direction,\n element,\n getCellBounds,\n isDynamicSize,\n itemCount: count,\n itemElements: itemElementsRef,\n scrollTarget,\n getScrollPositionForIndex\n });\n\n useEffect(() => {\n if (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onItemsRendered) {\n onItemsRendered(\n { startIndex: startIndexVisible, stopIndex: stopIndexVisible },\n { startIndex: startIndexOverscan, stopIndex: stopIndexOverscan }\n );\n }\n }, [\n onItemsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n const items = useMemo(() => {\n const items: VirtualItem[] = [];\n if (count > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const { scrollOffset, size } = getCellBounds(index);\n items.push({ index, offset: scrollOffset, size });\n }\n }\n return items;\n }, [count, getCellBounds, startIndexOverscan, stopIndexOverscan]);\n\n const totalSize = getEstimatedSize();\n\n return useMemo(\n () => ({\n items,\n measureElement,\n scrollToIndex,\n totalSize,\n visibleRange: {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n }\n }),\n [\n items,\n measureElement,\n scrollToIndex,\n startIndexVisible,\n stopIndexVisible,\n totalSize\n ]\n );\n}\n","import { useState } from \"react\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n/**\n * Tracks whether an element (or the window) is currently scrolling,\n * e.g. to render simplified content in place of rows that are expensive to render.\n *\n * Pass the element that scrolls:\n * - a list or grid's own element (e.g. from `useListCallbackRef`)\n * - \"window\" or the scroll element, for lists and grids that use the `scrollElement` prop\n *\n * Scrolling ends when the browser fires a \"scrollend\" event or,\n * in browsers that don't support that event, after no scroll events have been received for `delay` milliseconds.\n *\n * ℹ️ Scrolling that starts and ends before React renders (e.g. an instant scroll) may not change this value.\n *\n * ⚠️ Changing this value re-renders any rows it is passed to (e.g. via `rowProps`) when scrolling starts and when it ends.\n */\nexport function useIsScrolling(\n target: \"window\" | HTMLElement | null | undefined,\n {\n delay = 150\n }: {\n /**\n * Milliseconds without scroll events after which scrolling is considered to have ended\n * (only used by browsers that don't support the \"scrollend\" event); defaults to 150.\n */\n delay?: number;\n } = {}\n): boolean {\n const [isScrolling, setIsScrolling] = useState(false);\n\n useIsomorphicLayoutEffect(() => {\n if (!target) {\n return;\n }\n\n const ownerWindow =\n target === \"window\" ? window : getOwnerWindow(target as HTMLElement);\n const eventTarget = target === \"window\" ? ownerWindow : target;\n\n // Checked against a plain object, since TypeScript assumes all windows support the event\n const supportsScrollEnd = \"onscrollend\" in (ownerWindow as object);\n\n let animationFrameId: number | undefined = undefined;\n let lastScrollTime = 0;\n\n // Timeouts can be starved while scrolling (see issue #106), so check the elapsed time each frame instead\n const checkForScrollEnd = () => {\n if (performance.now() - lastScrollTime >= delay) {\n animationFrameId = undefined;\n setIsScrolling(false);\n } else {\n animationFrameId = ownerWindow.requestAnimationFrame(checkForScrollEnd);\n }\n };\n\n const onScroll = () => {\n setIsScrolling(true);\n\n if (!supportsScrollEnd) {\n lastScrollTime = performance.now();\n if (animationFrameId === undefined) {\n animationFrameId =\n ownerWindow.requestAnimationFrame(checkForScrollEnd);\n }\n }\n };\n\n const onScrollEnd = () => {\n setIsScrolling(false);\n };\n\n eventTarget.addEventListener(\"scroll\", onScroll, { passive: true });\n if (supportsScrollEnd) {\n eventTarget.addEventListener(\"scrollend\", onScrollEnd);\n }\n\n return () => {\n eventTarget.removeEventListener(\"scroll\", onScroll);\n eventTarget.removeEventListener(\"scrollend\", onScrollEnd);\n if (animationFrameId !== undefined) {\n ownerWindow.cancelAnimationFrame(animationFrameId);\n }\n\n // A different target (or none) isn't scrolling yet\n setIsScrolling(false);\n };\n }, [delay, target]);\n\n return isScrolling;\n}\n","// Cache per document, since windows may differ (e.g. custom scrollbar styles in a popup)\nconst cache = new WeakMap<Document, number>();\n\nexport function getScrollbarSize(\n recalculate: boolean = false,\n ownerDocument: Document | undefined = typeof document !== \"undefined\"\n ? document\n : undefined\n): number {\n if (ownerDocument === undefined) {\n // Scrollbar size can't be measured during server rendering\n return 0;\n }\n\n let size = cache.get(ownerDocument);\n if (size === undefined || recalculate) {\n const div = ownerDocument.createElement(\"div\");\n const style = div.style;\n style.width = \"50px\";\n style.height = \"50px\";\n style.overflow = \"scroll\";\n\n ownerDocument.body.appendChild(div);\n\n size = div.offsetWidth - div.clientWidth;\n\n ownerDocument.body.removeChild(div);\n\n cache.set(ownerDocument, size);\n }\n\n return size;\n}\n\nexport function setScrollbarSizeForTests(\n value: number,\n ownerDocument: Document = document\n) {\n cache.set(ownerDocument, value);\n}\n"],"names":["useIsomorphicLayoutEffect","useLayoutEffect","useEffect","isRtl","element","currentElement","useIsRtl","dir","value","setValue","useState","subscribe","useIsHydrating","useSyncExternalStore","getOwnerWindow","getResizeObserverClass","parseNumericStyleValue","useResizeObserver","box","defaultHeight","defaultWidth","disabledProp","mode","style","styleHeight","styleWidth","useMemo","state","setState","disabled","ResizeObserverClass","resizeObserver","entries","entry","contentRect","target","prevState","useStableCallback","fn","ref","useRef","useCallback","args","cache","getRTLOffsetType","recalculate","ownerDocument","cachedRTLResult","outerDiv","outerStyle","innerDiv","innerStyle","adjustScrollOffsetForRtl","containerElement","direction","scrollOffset","clientWidth","scrollWidth","observePrecedingContent","container","onChange","ownerWindow","MutationObserverClass","precedesElement","node","mutationObserver","records","record","observe","observedElements","sibling","current","parent","isWindow","getScrollTarget","scrollElement","getScrollPosition","getMaxScrollPosition","scrollTargetTo","options","isSelfScrolling","overflowX","overflowY","overflow","measureScrollElementViewport","scrollTarget","isVertical","viewStart","viewportSize","documentElement","rect","viewEnd","elementStart","elementSize","elementEnd","ownScrollOffset","viewportStartWithinElement","viewportEndWithinElement","visibleStart","visibleEnd","getScrollPadding","parse","number","left","right","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","clamp","index","containerScrollOffset","containerSize","estimatedTotalSize","clampOffset","offset","maxOffset","minOffset","isVisible","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","low","high","middle","createCachedBounds","itemProps","currentIndex","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","defaultScrollOffset","onResize","isScrollElementMode","height","width","prevSizeRef","setViewportSize","prevSize","isHydrating","initialScrollOffset","getCellBounds","indices","setIndices","getStartStopIndicesUtil","startIndexOverscan","stopIndexOverscan","getEstimatedSizeUtil","hasAppliedDefaultScrollOffsetRef","isRtlContainer","isRtlUtil","next","prev","onScroll","scrollLeft","scrollTop","updateIndicesFromScrollElement","stopObservingPrecedingContent","getScrollPositionForIndex","getOffset","padding","viewportOffset","delta","scrollDelta","ownContainerSize","useMemoizedObject","unstableObject","memoizedObject","setMemoizedObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnKey","columnWidth","defaultScrollLeft","defaultScrollTop","gridRef","onCellsRendered","rowCount","rowHeight","rowKey","tagName","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndexOverscan","columnStartIndexVisible","getColumnScrollPosition","columnStopIndexOverscan","columnStopIndexVisible","getRowBounds","getEstimatedHeight","rowStartIndexOverscan","rowStartIndexVisible","getRowScrollPosition","rowStopIndexOverscan","rowStopIndexVisible","useImperativeHandle","behavior","columnAlign","columnIndex","rowAlign","rowIndex","column","row","cells","rowBounds","columns","columnBounds","createElement","jsx","sizingElement","useGridCallbackRef","useGridRef","DATA_ATTRIBUTE_LIST_INDEX","DATA_ATTRIBUTE_INDEX","getItemIndex","attribute","useScrollToIndex","isDynamicSize","itemElements","pendingScroll","scrollFrame","cancelScroll","scheduleCorrectScroll","view","correctScroll","request","result","items","item","onKeyDown","event","auto","useAfterResizeObserverNotifications","callback","enabled","stableCallback","id","isDynamicRowHeight","DATA_ATTRIBUTE_SIZER","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","isFlowLayout","setIsFlowLayout","flowLayoutRowHeightRef","rowElements","scrollToRow","rows","isFlowLayoutActive","childrenElement","Fragment","rowsElement","createInitialMap","initialRowHeights","map","useDynamicRowHeight","defaultRowHeight","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","resizeObserverRef","observeRowElements","elements","observed","useListCallbackRef","useListRef","ITEM_PROPS","count","defaultSize","itemSizeOption","onItemsRendered","useVirtualizerCore","measuredElementsRef","warnedElementsRef","itemElementsRef","observedRef","measureElement","dynamicRowHeight","unobserve","scrollToIndex","totalSize","useIsScrolling","delay","isScrolling","setIsScrolling","eventTarget","supportsScrollEnd","animationFrameId","lastScrollTime","checkForScrollEnd","onScrollEnd","getScrollbarSize","div"],"mappings":"sJAEaA,EACX,OAAO,OAAW,IAAcC,EAAAA,gBAAkBC,EAAAA,UCH7C,SAASC,GAAMC,EAAsB,CAC1C,IAAIC,EAAqCD,EACzC,KAAOC,GAAgB,CACrB,GAAIA,EAAe,IACjB,OAAOA,EAAe,MAAQ,MAGhCA,EAAiBA,EAAe,aAClC,CAEA,MAAO,EACT,CCPO,SAASC,GACdF,EACAG,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAASH,IAAQ,KAAK,EAEhD,OAAAP,EAA0B,IAAM,CAC1BO,EACFE,EAASF,IAAQ,KAAK,EACbH,GACTK,EAASN,GAAMC,CAAO,CAAC,CAE3B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CCjBA,SAASG,IAAY,CACnB,MAAO,IAAM,CAAC,CAChB,CAMO,SAASC,IAA0B,CACxC,OAAOC,EAAAA,qBACLF,GACA,IAAM,GACN,IAAM,EAAA,CAEV,CChBO,SAASG,EACdV,EAC4B,CAC5B,OAAOA,GAAS,cAAc,aAAe,MAC/C,CCFO,SAASW,GACdX,EACmC,CACnC,OACEU,EAAeV,CAAO,EAAE,iBACvB,OAAO,eAAmB,IAAc,eAAiB,OAE9D,CCPO,SAASY,GACdR,EACoB,CACpB,GAAIA,IAAU,OACZ,OAAQ,OAAOA,EAAA,CACb,IAAK,SACH,OAAOA,EAET,IAAK,SAAU,CACb,GAA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,EAAOlG,GAAM,IAAIG,CAAa,EAClC,GAAI+F,IAAS,QAAahG,EAAa,CACrC,MAAMsS,EAAMrS,EAAc,cAAc,KAAK,EACvCvB,EAAQ4T,EAAI,MAClB5T,EAAM,MAAQ,OACdA,EAAM,OAAS,OACfA,EAAM,SAAW,SAEjBuB,EAAc,KAAK,YAAYqS,CAAG,EAElCtM,EAAOsM,EAAI,YAAcA,EAAI,YAE7BrS,EAAc,KAAK,YAAYqS,CAAG,EAElCxS,GAAM,IAAIG,EAAe+F,CAAI,CAC/B,CAEA,OAAOA,CACT"}
|
|
1
|
+
{"version":3,"file":"react-window.cjs","sources":["../lib/hooks/useIsomorphicLayoutEffect.ts","../lib/utils/isRtl.ts","../lib/core/useIsRtl.ts","../lib/hooks/useIsHydrating.ts","../lib/utils/getOwnerWindow.ts","../lib/utils/getResizeObserverClass.ts","../lib/utils/parseNumericStyleValue.ts","../lib/hooks/useResizeObserver.ts","../lib/hooks/useStableCallback.ts","../lib/utils/getRTLOffsetType.ts","../lib/utils/adjustScrollOffsetForRtl.ts","../lib/utils/observePrecedingContent.ts","../lib/utils/scrollElement.ts","../lib/utils/assert.ts","../lib/utils/shallowCompare.ts","../lib/core/getEstimatedSize.ts","../lib/core/getOffsetForIndex.ts","../lib/core/getStartStopIndices.ts","../lib/core/createCachedBounds.ts","../lib/core/useCachedBounds.ts","../lib/core/useItemSize.ts","../lib/core/useVirtualizer.ts","../lib/hooks/useMemoizedObject.ts","../lib/utils/arePropsEqual.ts","../lib/components/grid/Grid.tsx","../lib/components/grid/useGridCallbackRef.ts","../lib/components/grid/useGridRef.ts","../lib/core/itemIndex.ts","../lib/core/useScrollToIndex.ts","../lib/hooks/useAfterResizeObserverNotifications.ts","../lib/components/list/isDynamicRowHeight.ts","../lib/components/list/List.tsx","../lib/components/list/useDynamicRowHeight.ts","../lib/components/list/useListCallbackRef.ts","../lib/components/list/useListRef.ts","../lib/components/virtualizer/useVirtualizer.ts","../lib/hooks/useIsScrolling.ts","../lib/utils/getScrollbarSize.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","export function isRtl(element: HTMLElement) {\n let currentElement: HTMLElement | null = element;\n while (currentElement) {\n if (currentElement.dir) {\n return currentElement.dir === \"rtl\";\n }\n\n currentElement = currentElement.parentElement;\n }\n\n return false;\n}\n","import { useState, type HTMLAttributes } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { isRtl } from \"../utils/isRtl\";\n\nexport function useIsRtl(\n element: HTMLElement | null,\n dir: HTMLAttributes<HTMLElement>[\"dir\"]\n) {\n const [value, setValue] = useState(dir === \"rtl\");\n\n useIsomorphicLayoutEffect(() => {\n if (dir) {\n setValue(dir === \"rtl\");\n } else if (element) {\n setValue(isRtl(element));\n }\n }, [dir, element]);\n\n return value;\n}\n","import { useSyncExternalStore } from \"react\";\n\nfunction subscribe() {\n return () => {};\n}\n\n/**\n * Returns true when rendering on the server or while hydrating server-rendered HTML.\n * Returns false for client-only renders and for any render after hydration has completed.\n */\nexport function useIsHydrating(): boolean {\n return useSyncExternalStore(\n subscribe,\n () => false,\n () => true\n );\n}\n","export function getOwnerWindow(\n element: Element | null | undefined\n): Window & typeof globalThis {\n return element?.ownerDocument.defaultView ?? window;\n}\n","import { getOwnerWindow } from \"./getOwnerWindow\";\n\nexport function getResizeObserverClass(\n element: Element\n): typeof ResizeObserver | undefined {\n return (\n getOwnerWindow(element).ResizeObserver ??\n (typeof ResizeObserver !== \"undefined\" ? ResizeObserver : undefined)\n );\n}\n","import type { CSSProperties } from \"react\";\n\nexport function parseNumericStyleValue(\n value: CSSProperties[\"height\"]\n): number | undefined {\n if (value !== undefined) {\n switch (typeof value) {\n case \"number\": {\n return value;\n }\n case \"string\": {\n if (value.endsWith(\"px\")) {\n return parseFloat(value);\n }\n break;\n }\n }\n }\n}\n","import { useMemo, useState, type CSSProperties } from \"react\";\nimport { getResizeObserverClass } from \"../utils/getResizeObserverClass\";\nimport { parseNumericStyleValue } from \"../utils/parseNumericStyleValue\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\nexport function useResizeObserver({\n box,\n defaultHeight,\n defaultWidth,\n disabled: disabledProp,\n element,\n mode,\n style\n}: {\n box?: ResizeObserverBoxOptions;\n defaultHeight?: number;\n defaultWidth?: number;\n disabled?: boolean;\n element: HTMLElement | null;\n mode?: \"only-height\" | \"only-width\";\n style: CSSProperties | undefined;\n}) {\n const { styleHeight, styleWidth } = useMemo(\n () => ({\n styleHeight: parseNumericStyleValue(style?.height),\n styleWidth: parseNumericStyleValue(style?.width)\n }),\n [style?.height, style?.width]\n );\n\n const [state, setState] = useState<{\n height: number | undefined;\n width: number | undefined;\n }>({\n height: defaultHeight,\n width: defaultWidth\n });\n\n const disabled =\n disabledProp ||\n (mode === \"only-height\" && styleHeight !== undefined) ||\n (mode === \"only-width\" && styleWidth !== undefined) ||\n (styleHeight !== undefined && styleWidth !== undefined);\n\n useIsomorphicLayoutEffect(() => {\n if (element === null || disabled) {\n return;\n }\n\n const ResizeObserverClass = getResizeObserverClass(element);\n if (!ResizeObserverClass) {\n return;\n }\n\n const resizeObserver = new ResizeObserverClass((entries) => {\n for (const entry of entries) {\n const { contentRect, target } = entry;\n if (element === target) {\n setState((prevState) => {\n if (\n prevState.height === contentRect.height &&\n prevState.width === contentRect.width\n ) {\n return prevState;\n }\n\n return {\n height: contentRect.height,\n width: contentRect.width\n };\n });\n }\n }\n });\n resizeObserver.observe(element, { box });\n\n return () => {\n resizeObserver?.unobserve(element);\n };\n }, [box, disabled, element, styleHeight, styleWidth]);\n\n return useMemo(\n () => ({\n height: styleHeight ?? state.height,\n width: styleWidth ?? state.width\n }),\n [state, styleHeight, styleWidth]\n );\n}\n","import { useCallback, useRef } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n// Forked from useEventCallback (usehooks-ts)\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: (...args: Args) => Return\n): (...args: Args) => Return;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined;\nexport function useStableCallback<Args extends unknown[], Return>(\n fn: ((...args: Args) => Return) | undefined\n): ((...args: Args) => Return) | undefined {\n const ref = useRef<typeof fn>(() => {\n // This error ensures components don't render with previous/stale function\n throw new Error(\"Cannot call an event handler while rendering.\");\n });\n\n useIsomorphicLayoutEffect(() => {\n ref.current = fn;\n }, [fn]);\n\n return useCallback((...args: Args) => ref.current?.(...args), [ref]) as (\n ...args: Args\n ) => Return;\n}\n","export type RTLOffsetType =\n | \"negative\"\n | \"positive-descending\"\n | \"positive-ascending\";\n\n// Cache per document, since each window is probed separately\nconst cache = new WeakMap<Document, RTLOffsetType>();\n\n// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(\n recalculate: boolean = false,\n ownerDocument: Document = document\n): RTLOffsetType {\n let cachedRTLResult = cache.get(ownerDocument);\n if (cachedRTLResult === undefined || recalculate) {\n const outerDiv = ownerDocument.createElement(\"div\");\n const outerStyle = outerDiv.style;\n outerStyle.width = \"50px\";\n outerStyle.height = \"50px\";\n outerStyle.overflow = \"scroll\";\n outerStyle.direction = \"rtl\";\n\n const innerDiv = ownerDocument.createElement(\"div\");\n const innerStyle = innerDiv.style;\n innerStyle.width = \"100px\";\n innerStyle.height = \"100px\";\n\n outerDiv.appendChild(innerDiv);\n\n ownerDocument.body.appendChild(outerDiv);\n\n if (outerDiv.scrollLeft > 0) {\n cachedRTLResult = \"positive-descending\";\n } else {\n outerDiv.scrollLeft = 1;\n if (outerDiv.scrollLeft === 0) {\n cachedRTLResult = \"negative\";\n } else {\n cachedRTLResult = \"positive-ascending\";\n }\n }\n\n ownerDocument.body.removeChild(outerDiv);\n\n cache.set(ownerDocument, cachedRTLResult);\n }\n\n return cachedRTLResult;\n}\n","import type { Direction } from \"../core/types\";\nimport { getRTLOffsetType } from \"./getRTLOffsetType\";\n\nexport function adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n}: {\n containerElement: HTMLElement | null;\n direction: Direction;\n isRtl: boolean;\n scrollOffset: number;\n}) {\n // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.\n // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).\n // So we need to determine which browser behavior we're dealing with, and mimic it.\n if (direction === \"horizontal\") {\n if (isRtl) {\n switch (\n getRTLOffsetType(false, containerElement?.ownerDocument ?? document)\n ) {\n case \"negative\": {\n return -scrollOffset;\n }\n case \"positive-descending\": {\n if (containerElement) {\n const { clientWidth, scrollWidth } = containerElement;\n return scrollWidth - clientWidth - scrollOffset;\n }\n break;\n }\n }\n }\n }\n return scrollOffset;\n}\n","import { getOwnerWindow } from \"./getOwnerWindow\";\nimport { getResizeObserverClass } from \"./getResizeObserverClass\";\n\n/**\n * Notifies when content that precedes an element within a scroll container may have moved it\n * (without the element itself being rendered, scrolled, or resized), e.g.\n * - an image or font loading above the element\n * - a section above the element expanding or collapsing\n * - content being inserted before (or removed from before) the element\n *\n * Only content that precedes the element (or one of its ancestors) can push it, so that's all that is observed:\n * - a ResizeObserver watches the earlier siblings of the element and of each ancestor up to the container\n * - a MutationObserver watches each of those ancestors (and the container) for inserted or removed children\n *\n * ⚠️ Changes that don't resize an element (e.g. margins or transforms) and layouts where later content moves the element\n * (e.g. flex or grid alignment) are not observed.\n *\n * @returns a function that stops observing\n */\nexport function observePrecedingContent({\n container,\n element,\n onChange\n}: {\n container: Element;\n element: Element;\n onChange: () => void;\n}): () => void {\n const ownerWindow = getOwnerWindow(element);\n const ResizeObserverClass = getResizeObserverClass(element);\n const MutationObserverClass =\n ownerWindow.MutationObserver ??\n (typeof MutationObserver !== \"undefined\" ? MutationObserver : undefined);\n\n const resizeObserver = ResizeObserverClass\n ? new ResizeObserverClass(onChange)\n : undefined;\n\n // Whether a node comes before the element (or contains it);\n // nodes that are no longer connected can't be compared, so assume that they did\n const precedesElement = (node: Node) =>\n !node.isConnected ||\n (node.compareDocumentPosition(element) &\n Node.DOCUMENT_POSITION_FOLLOWING) !==\n 0;\n\n const mutationObserver = MutationObserverClass\n ? new MutationObserverClass((records) => {\n // Only content inserted or removed before the element can move it;\n // e.g. portals (tooltips, modals) are usually inserted at the end of the <body>\n const affectsElement = records.some(\n (record) =>\n Array.from(record.addedNodes).some(precedesElement) ||\n // Removed nodes preceded the element if the node after them still does (or contains the element)\n (record.removedNodes.length > 0 &&\n record.nextSibling !== null &&\n precedesElement(record.nextSibling))\n );\n if (affectsElement) {\n // Inserted or removed elements change which siblings precede the element\n observe();\n onChange();\n }\n })\n : undefined;\n\n const observedElements = new Set<Element>();\n\n const observe = () => {\n // Unobserve elements individually (rather than disconnecting) so the ResizeObserver can be reused\n for (const sibling of observedElements) {\n resizeObserver?.unobserve(sibling);\n }\n observedElements.clear();\n mutationObserver?.disconnect();\n\n let current: Element = element;\n while (current !== container) {\n const parent: Element | null = current.parentElement;\n if (parent === null) {\n // The element isn't within the container (e.g. it has been removed)\n break;\n }\n\n if (resizeObserver) {\n for (\n let sibling = current.previousElementSibling;\n sibling !== null;\n sibling = sibling.previousElementSibling\n ) {\n observedElements.add(sibling);\n resizeObserver.observe(sibling);\n }\n }\n\n mutationObserver?.observe(parent, { childList: true });\n\n current = parent;\n }\n };\n\n observe();\n\n return () => {\n resizeObserver?.disconnect();\n mutationObserver?.disconnect();\n };\n}\n","import type { Direction } from \"../core/types\";\nimport { adjustScrollOffsetForRtl } from \"./adjustScrollOffsetForRtl\";\nimport { getOwnerWindow } from \"./getOwnerWindow\";\n\n/**\n * Element that scrolls a list or grid, if not the list or grid itself:\n * - \"window\" to scroll with the page\n * - an ancestor element that scrolls (or null until it has mounted)\n */\nexport type ScrollElement = \"window\" | HTMLElement | null;\n\nexport type ScrollTarget = HTMLElement | Window;\n\nexport function isWindow(target: ScrollTarget): target is Window {\n return (target as Window).window === target;\n}\n\nexport function getScrollTarget(\n containerElement: HTMLElement | null,\n scrollElement: ScrollElement | undefined\n): ScrollTarget | null {\n if (scrollElement === \"window\") {\n // Use the container's own window (e.g. a popup rendered into via a portal)\n return containerElement ? getOwnerWindow(containerElement) : null;\n }\n\n return scrollElement ?? null;\n}\n\nexport function getScrollPosition(\n target: ScrollTarget,\n direction: Direction\n): number {\n if (isWindow(target)) {\n return direction === \"vertical\" ? target.scrollY : target.scrollX;\n }\n\n return direction === \"vertical\" ? target.scrollTop : target.scrollLeft;\n}\n\nexport function getMaxScrollPosition(\n target: ScrollTarget,\n direction: Direction\n): number {\n const element = isWindow(target)\n ? (target.document.scrollingElement ?? target.document.documentElement)\n : target;\n\n return direction === \"vertical\"\n ? element.scrollHeight - element.clientHeight\n : element.scrollWidth - element.clientWidth;\n}\n\nexport function scrollTargetTo(\n target: ScrollTarget | null,\n options: ScrollToOptions\n) {\n if (target && typeof target.scrollTo === \"function\") {\n target.scrollTo(options);\n }\n}\n\n/**\n * Whether the container scrolls its own content along this axis\n * (e.g. a grid that scrolls its columns while rows scroll with the page).\n */\nexport function isSelfScrolling(\n containerElement: HTMLElement,\n direction: Direction\n): boolean {\n const { overflowX, overflowY } =\n getOwnerWindow(containerElement).getComputedStyle(containerElement);\n const overflow = direction === \"vertical\" ? overflowY : overflowX;\n if (overflow === \"visible\" || overflow === \"clip\") {\n // Rows that overflow their estimated size can't be scrolled to\n return false;\n }\n\n // Allow for rounding (scroll and client sizes are rounded separately, e.g. for fractional item sizes)\n return direction === \"vertical\"\n ? containerElement.scrollHeight - containerElement.clientHeight > 1\n : containerElement.scrollWidth - containerElement.clientWidth > 1;\n}\n\n/**\n * Measures the region of the container that is visible within the scroll element's viewport.\n *\n * Offsets are relative to the start of the container's content (the right edge for horizontal RTL content):\n * - offset and size describe the visible region (size is 0 if the container is outside of the viewport)\n * - viewportOffset is the position of the viewport's start (negative if the container starts after it)\n * - viewportSize is the size of the scroll element's viewport\n */\nexport function measureScrollElementViewport({\n containerElement,\n direction,\n isRtl,\n scrollTarget\n}: {\n containerElement: HTMLElement;\n direction: Direction;\n isRtl: boolean;\n scrollTarget: ScrollTarget;\n}): {\n offset: number;\n size: number;\n viewportOffset: number;\n viewportSize: number;\n} {\n const isVertical = direction === \"vertical\";\n\n let viewStart: number;\n let viewportSize: number;\n if (isWindow(scrollTarget)) {\n const { documentElement } = scrollTarget.document;\n viewStart = 0;\n viewportSize = isVertical\n ? documentElement.clientHeight\n : documentElement.clientWidth;\n } else {\n const rect = scrollTarget.getBoundingClientRect();\n viewStart = isVertical\n ? rect.top + scrollTarget.clientTop\n : rect.left + scrollTarget.clientLeft;\n viewportSize = isVertical\n ? scrollTarget.clientHeight\n : scrollTarget.clientWidth;\n }\n const viewEnd = viewStart + viewportSize;\n\n // Positions are measured in client (physical) coordinates, so they don't depend on RTL scroll offset types\n const rect = containerElement.getBoundingClientRect();\n const elementStart = isVertical\n ? rect.top + containerElement.clientTop\n : rect.left + containerElement.clientLeft;\n const elementSize = isVertical\n ? containerElement.clientHeight\n : containerElement.clientWidth;\n const elementEnd = elementStart + elementSize;\n\n // The container may also scroll its own content (e.g. a grid's columns)\n const ownScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: isVertical\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n });\n\n const isReversed = !isVertical && isRtl;\n const viewportStartWithinElement = isReversed\n ? elementEnd - viewEnd\n : viewStart - elementStart;\n const viewportEndWithinElement = viewportStartWithinElement + viewportSize;\n\n const visibleStart = Math.max(0, viewportStartWithinElement);\n const visibleEnd = Math.min(elementSize, viewportEndWithinElement);\n\n return {\n offset: ownScrollOffset + visibleStart,\n size: Math.max(0, visibleEnd - visibleStart),\n viewportOffset: ownScrollOffset + viewportStartWithinElement,\n viewportSize\n };\n}\n\n/**\n * CSS scroll-padding of the element (or window) being scrolled, along one axis;\n * like the browser's own scrollIntoView, scrolling to an item aligns it within the padded viewport\n * (e.g. so it isn't hidden under a sticky header).\n *\n * Percentages are relative to the viewport size; other values (e.g. \"auto\") are treated as 0.\n */\nexport function getScrollPadding({\n direction,\n isRtl,\n scrollTarget,\n viewportSize\n}: {\n direction: Direction;\n isRtl: boolean;\n scrollTarget: ScrollTarget;\n viewportSize: number;\n}): { end: number; start: number } {\n // The window's scroll padding is specified on the root element\n const element = isWindow(scrollTarget)\n ? scrollTarget.document.documentElement\n : scrollTarget;\n const style = getOwnerWindow(element).getComputedStyle(element);\n\n const parse = (value: string | undefined) => {\n const number = parseFloat(value ?? \"\");\n if (!Number.isFinite(number) || number < 0) {\n return 0;\n } else if (value!.endsWith(\"px\")) {\n return number;\n } else if (value!.endsWith(\"%\")) {\n return (number * viewportSize) / 100;\n }\n return 0;\n };\n\n if (direction === \"vertical\") {\n return {\n end: parse(style.scrollPaddingBottom),\n start: parse(style.scrollPaddingTop)\n };\n }\n\n // Horizontal RTL content starts at the right edge\n const left = parse(style.scrollPaddingLeft);\n const right = parse(style.scrollPaddingRight);\n return isRtl ? { end: left, start: right } : { end: right, start: left };\n}\n","export function assert(\n expectedCondition: unknown,\n message: string = \"Assertion error\"\n): asserts expectedCondition {\n if (!expectedCondition) {\n console.error(message);\n\n throw Error(message);\n }\n}\n","import { assert } from \"./assert\";\n\nexport function shallowCompare<Type extends object>(\n a: Type | undefined,\n b: Type | undefined\n) {\n if (a === b) {\n return true;\n }\n\n if (!!a !== !!b) {\n return false;\n }\n\n assert(a !== undefined);\n assert(b !== undefined);\n\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n\n for (const key in a) {\n if (!Object.hasOwn(b, key) || !Object.is(b[key], a[key])) {\n return false;\n }\n }\n\n return true;\n}\n","import type { CachedBounds, SizeFunction } from \"./types\";\nimport { assert } from \"../utils/assert\";\n\nexport function getEstimatedSize<Props extends object>({\n cachedBounds,\n itemCount,\n itemSize\n}: {\n cachedBounds: CachedBounds;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n}) {\n if (itemCount === 0) {\n return 0;\n } else if (typeof itemSize === \"number\") {\n return itemCount * itemSize;\n } else {\n const bounds = cachedBounds.get(\n cachedBounds.size === 0 ? 0 : cachedBounds.size - 1\n );\n assert(bounds !== undefined, \"Unexpected bounds cache miss\");\n\n const averageItemSize =\n (bounds.scrollOffset + bounds.size) / cachedBounds.size;\n\n return itemCount * averageItemSize;\n }\n}\n","import type { Align } from \"../types\";\nimport { getEstimatedSize } from \"./getEstimatedSize\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function getOffsetForIndex<Props extends object>({\n align,\n cachedBounds,\n clamp = true,\n index,\n itemCount,\n itemSize,\n containerScrollOffset,\n containerSize\n}: {\n align: Align;\n cachedBounds: CachedBounds;\n /**\n * Clamp the offset to the list's own scrollable range.\n * Lists that scroll with an outer element can scroll beyond their own bounds (e.g. to show content above the list);\n * the outer element's scrollable range is enforced by the browser instead.\n */\n clamp?: boolean;\n index: number;\n itemCount: number;\n itemSize: number | SizeFunction<Props>;\n containerScrollOffset: number;\n containerSize: number;\n}) {\n if (index < 0 || index >= itemCount) {\n throw RangeError(`Invalid index specified: ${index}`, {\n cause: `Index ${index} is not within the range of 0 - ${itemCount - 1}`\n });\n }\n\n // Populate the target bounds before estimating the total from cached sizes.\n const bounds = cachedBounds.get(index);\n const estimatedTotalSize = getEstimatedSize({\n cachedBounds,\n itemCount,\n itemSize\n });\n\n const clampOffset = (offset: number) =>\n clamp\n ? Math.max(0, Math.min(estimatedTotalSize - containerSize, offset))\n : offset;\n\n const maxOffset = clampOffset(bounds.scrollOffset);\n const minOffset = clamp\n ? Math.max(0, bounds.scrollOffset - containerSize + bounds.size)\n : bounds.scrollOffset - containerSize + bounds.size;\n\n // Visibility depends on the row itself, not the estimated scroll extent.\n // For oversized rows, leave the offset alone when the row fills the viewport.\n const isVisible =\n bounds.size > containerSize\n ? containerScrollOffset >= bounds.scrollOffset &&\n containerScrollOffset <= minOffset\n : containerScrollOffset >= minOffset &&\n containerScrollOffset <= bounds.scrollOffset;\n\n if (align === \"smart\") {\n align = isVisible ? \"auto\" : \"center\";\n }\n\n switch (align) {\n case \"start\": {\n return maxOffset;\n }\n case \"end\": {\n return minOffset;\n }\n case \"center\": {\n return clampOffset(\n bounds.scrollOffset + bounds.size / 2 - containerSize / 2\n );\n }\n case \"auto\":\n default: {\n if (isVisible) {\n return containerScrollOffset;\n } else if (containerScrollOffset < minOffset) {\n return minOffset;\n } else {\n return maxOffset;\n }\n }\n }\n}\n","import type { CachedBounds } from \"./types\";\n\nexport function getStartStopIndices({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n}: {\n cachedBounds: CachedBounds;\n containerScrollOffset: number;\n containerSize: number;\n itemCount: number;\n overscanCount: number;\n}): {\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n} {\n const maxIndex = itemCount - 1;\n\n if (itemCount === 0) {\n return {\n startIndexVisible: 0,\n stopIndexVisible: -1,\n startIndexOverscan: 0,\n stopIndexOverscan: -1\n };\n }\n\n let startIndexVisible: number;\n let stopIndexVisible: number;\n const { itemSize } = cachedBounds;\n\n if (itemSize !== undefined) {\n if (itemSize > 0) {\n startIndexVisible = Math.max(\n 0,\n Math.min(maxIndex, Math.floor(containerScrollOffset / itemSize))\n );\n stopIndexVisible = Math.max(\n startIndexVisible,\n Math.min(\n maxIndex,\n Math.ceil((containerScrollOffset + containerSize) / itemSize) - 1\n )\n );\n } else {\n // Size is zero, negative or NaN (e.g. a percentage size before the container is measured)\n startIndexVisible = 0;\n stopIndexVisible = 0;\n }\n } else {\n // Binary search the measured prefix\n let low = 0;\n let high = Math.min(maxIndex, Math.max(0, cachedBounds.size - 1));\n\n while (low < high) {\n const middle = Math.floor((low + high) / 2);\n const bounds = cachedBounds.get(middle);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) {\n high = middle;\n } else {\n low = middle + 1;\n }\n }\n\n // Extend sequentially beyond the measured prefix to avoid evaluating item sizes past the viewport\n while (low < maxIndex) {\n const bounds = cachedBounds.get(low);\n if (bounds.scrollOffset + bounds.size > containerScrollOffset) break;\n low++;\n }\n\n startIndexVisible = low;\n stopIndexVisible = low;\n while (stopIndexVisible < maxIndex) {\n const bounds = cachedBounds.get(stopIndexVisible);\n if (\n bounds.scrollOffset + bounds.size >=\n containerScrollOffset + containerSize\n )\n break;\n stopIndexVisible++;\n }\n }\n\n return {\n startIndexVisible,\n stopIndexVisible,\n startIndexOverscan: Math.max(0, startIndexVisible - overscanCount),\n stopIndexOverscan: Math.min(maxIndex, stopIndexVisible + overscanCount)\n };\n}\n","import { assert } from \"../utils/assert\";\nimport type { Bounds, CachedBounds, SizeFunction } from \"./types\";\n\nexport function createCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n const cache = new Map<number, Bounds>();\n\n return {\n itemSize: typeof itemSize === \"number\" ? itemSize : undefined,\n get(index: number) {\n assert(index < itemCount, `Invalid index ${index}`);\n\n if (typeof itemSize === \"number\") {\n assert(index >= 0, `Invalid index ${index}`);\n return { size: itemSize, scrollOffset: index * itemSize };\n }\n\n while (cache.size - 1 < index) {\n const currentIndex = cache.size;\n\n const size = itemSize(currentIndex, itemProps);\n\n if (currentIndex === 0) {\n cache.set(currentIndex, {\n size,\n scrollOffset: 0\n });\n } else {\n const previousRowBounds = cache.get(currentIndex - 1);\n assert(\n previousRowBounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n cache.set(currentIndex, {\n scrollOffset:\n previousRowBounds.scrollOffset + previousRowBounds.size,\n size\n });\n }\n }\n\n const bounds = cache.get(index);\n assert(\n bounds !== undefined,\n `Unexpected bounds cache miss for index ${index}`\n );\n\n return bounds;\n },\n set(index: number, bounds: Bounds) {\n cache.set(index, bounds);\n },\n get size() {\n return cache.size;\n }\n };\n}\n","import { useMemo } from \"react\";\nimport { createCachedBounds } from \"./createCachedBounds\";\nimport type { CachedBounds, SizeFunction } from \"./types\";\n\nexport function useCachedBounds<Props extends object>({\n itemCount,\n itemProps,\n itemSize\n}: {\n itemCount: number;\n itemProps: Props;\n itemSize: number | SizeFunction<Props>;\n}): CachedBounds {\n return useMemo(\n () =>\n createCachedBounds({\n itemCount,\n itemProps,\n itemSize\n }),\n [itemCount, itemProps, itemSize]\n );\n}\n","import { assert } from \"../utils/assert\";\nimport type { SizeFunction } from \"./types\";\n\nexport function useItemSize<Props extends object>({\n containerSize,\n itemSize: itemSizeProp\n}: {\n containerSize: number;\n itemSize: number | string | SizeFunction<Props>;\n}) {\n let itemSize: number | SizeFunction<Props>;\n switch (typeof itemSizeProp) {\n case \"string\": {\n assert(\n itemSizeProp.endsWith(\"%\"),\n `Invalid item size: \"${itemSizeProp}\"; string values must be percentages (e.g. \"100%\")`\n );\n assert(\n containerSize !== undefined,\n \"Container size must be defined if a percentage item size is specified\"\n );\n\n itemSize = (containerSize * parseFloat(itemSizeProp)) / 100;\n break;\n }\n default: {\n itemSize = itemSizeProp;\n break;\n }\n }\n\n // Normalize invalid sizes (e.g. NaN from a malformed percentage) so they don't produce NaN offsets\n if (\n typeof itemSize === \"number\" &&\n !(Number.isFinite(itemSize) && itemSize > 0)\n ) {\n itemSize = 0;\n }\n\n return itemSize;\n}\n","import { useCallback, useRef, useState, type CSSProperties } from \"react\";\nimport { useIsHydrating } from \"../hooks/useIsHydrating\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useResizeObserver } from \"../hooks/useResizeObserver\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { adjustScrollOffsetForRtl } from \"../utils/adjustScrollOffsetForRtl\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport { getResizeObserverClass } from \"../utils/getResizeObserverClass\";\nimport { isRtl as isRtlUtil } from \"../utils/isRtl\";\nimport { observePrecedingContent } from \"../utils/observePrecedingContent\";\nimport {\n getScrollPadding,\n getScrollPosition,\n getScrollTarget,\n isSelfScrolling,\n isWindow,\n measureScrollElementViewport,\n type ScrollElement,\n type ScrollTarget\n} from \"../utils/scrollElement\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\nimport { getEstimatedSize as getEstimatedSizeUtil } from \"./getEstimatedSize\";\nimport { getOffsetForIndex } from \"./getOffsetForIndex\";\nimport { getStartStopIndices as getStartStopIndicesUtil } from \"./getStartStopIndices\";\nimport type { Direction, SizeFunction } from \"./types\";\nimport { useCachedBounds } from \"./useCachedBounds\";\nimport { useItemSize } from \"./useItemSize\";\n\nexport function useVirtualizer<Props extends object>({\n containerElement,\n containerStyle,\n defaultContainerSize = 0,\n defaultScrollOffset = 0,\n direction,\n isRtl = false,\n itemCount,\n itemProps,\n itemSize: itemSizeProp,\n onResize,\n overscanCount,\n scrollElement\n}: {\n containerElement: HTMLElement | null;\n containerStyle?: CSSProperties;\n defaultContainerSize?: number;\n defaultScrollOffset?: number;\n direction: Direction;\n isRtl?: boolean;\n itemCount: number;\n itemProps: Props;\n itemSize: number | string | SizeFunction<Props>;\n onResize:\n | ((\n size: { height: number; width: number },\n prevSize: { height: number; width: number }\n ) => void)\n | undefined;\n overscanCount: number;\n scrollElement?: ScrollElement | undefined;\n}) {\n // Lists that scroll with an outer element (e.g. the page) render at their full size;\n // the visible region is measured relative to the outer element's viewport.\n const isScrollElementMode = scrollElement !== undefined;\n const scrollTarget = isScrollElementMode\n ? getScrollTarget(containerElement, scrollElement)\n : containerElement;\n\n const { height = defaultContainerSize, width = defaultContainerSize } =\n useResizeObserver({\n defaultHeight:\n direction === \"vertical\" ? defaultContainerSize : undefined,\n defaultWidth:\n direction === \"horizontal\" ? defaultContainerSize : undefined,\n element: containerElement,\n mode: direction === \"vertical\" ? \"only-height\" : \"only-width\",\n style: containerStyle\n });\n\n const prevSizeRef = useRef<{ height: number; width: number }>({\n height: 0,\n width: 0\n });\n\n // Percentage item sizes are relative to the scroll element's viewport in scroll element mode\n const [viewportSize, setViewportSize] = useState(defaultContainerSize);\n\n const containerSize = isScrollElementMode\n ? viewportSize\n : direction === \"vertical\"\n ? height\n : width;\n\n const itemSize = useItemSize({ containerSize, itemSize: itemSizeProp });\n\n useIsomorphicLayoutEffect(() => {\n if (typeof onResize === \"function\") {\n const prevSize = prevSizeRef.current;\n\n if (prevSize.height !== height || prevSize.width !== width) {\n onResize({ height, width }, { ...prevSize });\n\n prevSize.height = height;\n prevSize.width = width;\n }\n }\n }, [height, onResize, width]);\n\n const cachedBounds = useCachedBounds({\n itemCount,\n itemProps,\n itemSize\n });\n\n // Server-rendered HTML can't be scrolled, so the server (and hydration) render always starts at offset 0;\n // the default scroll offset is applied after mount (see below)\n const isHydrating = useIsHydrating();\n // Lists that scroll with an outer element don't control its initial scroll position\n const [initialScrollOffset] = useState(() =>\n isHydrating || isScrollElementMode ? 0 : defaultScrollOffset\n );\n\n const getCellBounds = useCallback(\n (index: number) => cachedBounds.get(index),\n [cachedBounds]\n );\n\n const [indices, setIndices] = useState<{\n startIndexVisible: number;\n stopIndexVisible: number;\n startIndexOverscan: number;\n stopIndexOverscan: number;\n }>(() =>\n getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: initialScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n })\n );\n\n // Guard against temporarily invalid indices that may occur when item count decreases\n // Cached bounds object will be re-created and a second render will restore things\n const {\n startIndexVisible,\n startIndexOverscan,\n stopIndexVisible,\n stopIndexOverscan\n } = {\n startIndexVisible: Math.min(itemCount - 1, indices.startIndexVisible),\n startIndexOverscan: Math.min(itemCount - 1, indices.startIndexOverscan),\n stopIndexVisible: Math.min(itemCount - 1, indices.stopIndexVisible),\n stopIndexOverscan: Math.min(itemCount - 1, indices.stopIndexOverscan)\n };\n\n const getEstimatedSize = useCallback(\n () =>\n getEstimatedSizeUtil({\n cachedBounds,\n itemCount,\n itemSize\n }),\n [cachedBounds, itemCount, itemSize]\n );\n\n const getStartStopIndices = useCallback(\n (scrollOffset: number) => {\n const containerScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n return getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n },\n [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n itemCount,\n overscanCount\n ]\n );\n\n // Apply the default scroll offset once, when the container first mounts with items to scroll to\n // (content can't be scrolled before then, e.g. while data is loading).\n // This effect must run before the one below that syncs indices with the current scroll offset.\n const hasAppliedDefaultScrollOffsetRef = useRef(false);\n useIsomorphicLayoutEffect(() => {\n if (\n !containerElement ||\n itemCount === 0 ||\n isScrollElementMode ||\n hasAppliedDefaultScrollOffsetRef.current\n ) {\n return;\n }\n\n hasAppliedDefaultScrollOffsetRef.current = true;\n\n if (defaultScrollOffset <= 0) {\n return;\n }\n\n // The isRtl prop may not have been updated yet if the direction is inherited from an ancestor\n const isRtlContainer =\n direction === \"horizontal\" && isRtlUtil(containerElement);\n\n const currentScrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl: isRtlContainer,\n scrollOffset:\n direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n });\n if (currentScrollOffset !== 0) {\n // Don't override a scroll position restored by the browser (or by the user before hydration)\n return;\n }\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl: isRtlContainer,\n scrollOffset: defaultScrollOffset\n });\n\n if (typeof containerElement.scrollTo === \"function\") {\n containerElement.scrollTo({\n behavior: \"instant\",\n [direction === \"vertical\" ? \"top\" : \"left\"]: scrollOffset\n });\n } else if (direction === \"vertical\") {\n containerElement.scrollTop = scrollOffset;\n } else {\n containerElement.scrollLeft = scrollOffset;\n }\n // Intentionally only run when the container element mounts or items first become available\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [containerElement, itemCount]);\n\n useIsomorphicLayoutEffect(() => {\n if (isScrollElementMode && containerElement && scrollTarget) {\n // Measured after every render (see below)\n return;\n }\n\n const next =\n containerElement && !isScrollElementMode\n ? getStartStopIndices(\n direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n )\n : getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: initialScrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n setIndices((prev) => (shallowCompare(next, prev) ? prev : next));\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n getStartStopIndices,\n initialScrollOffset,\n isScrollElementMode,\n itemCount,\n overscanCount,\n scrollTarget\n ]);\n\n useIsomorphicLayoutEffect(() => {\n if (!containerElement || isScrollElementMode) {\n return;\n }\n\n const onScroll = () => {\n setIndices((prev) => {\n const { scrollLeft, scrollTop } = containerElement;\n\n const scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: direction === \"vertical\" ? scrollTop : scrollLeft\n });\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: scrollOffset,\n containerSize,\n itemCount,\n overscanCount\n });\n\n if (shallowCompare(next, prev)) {\n return prev;\n }\n\n return next;\n });\n };\n\n containerElement.addEventListener(\"scroll\", onScroll);\n\n return () => {\n containerElement.removeEventListener(\"scroll\", onScroll);\n };\n }, [\n cachedBounds,\n containerElement,\n containerSize,\n direction,\n isRtl,\n isScrollElementMode,\n itemCount,\n overscanCount\n ]);\n\n const updateIndicesFromScrollElement = useStableCallback(() => {\n if (!containerElement || !scrollTarget) {\n return;\n }\n\n const { offset, size, viewportSize } = measureScrollElementViewport({\n containerElement,\n direction,\n isRtl,\n scrollTarget\n });\n\n setViewportSize(viewportSize);\n\n const next = getStartStopIndicesUtil({\n cachedBounds,\n containerScrollOffset: offset,\n containerSize: size,\n itemCount,\n overscanCount\n });\n\n setIndices((prev) => (shallowCompare(next, prev) ? prev : next));\n });\n\n // The container's position within the scroll element can change whenever anything renders,\n // so measure it after every render (state updates are skipped if nothing has changed)\n useIsomorphicLayoutEffect(() => {\n if (isScrollElementMode) {\n updateIndicesFromScrollElement();\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n if (!isScrollElementMode || !containerElement || !scrollTarget) {\n return;\n }\n\n const ownerWindow = getOwnerWindow(containerElement);\n const onChange = () => updateIndicesFromScrollElement();\n\n scrollTarget.addEventListener(\"scroll\", onChange, { passive: true });\n // The container may also scroll its own content (e.g. a grid's columns)\n containerElement.addEventListener(\"scroll\", onChange, { passive: true });\n ownerWindow.addEventListener(\"resize\", onChange);\n\n // The scroll element's viewport may resize without the window resizing\n let resizeObserver: ResizeObserver | undefined = undefined;\n const ResizeObserverClass = getResizeObserverClass(containerElement);\n if (ResizeObserverClass && !isWindow(scrollTarget)) {\n resizeObserver = new ResizeObserverClass(onChange);\n resizeObserver.observe(scrollTarget);\n }\n\n // Content before the container may move it without a scroll or render (e.g. an image loading above it)\n const stopObservingPrecedingContent = observePrecedingContent({\n container: isWindow(scrollTarget)\n ? scrollTarget.document.documentElement\n : scrollTarget,\n element: containerElement,\n onChange\n });\n\n return () => {\n scrollTarget.removeEventListener(\"scroll\", onChange);\n containerElement.removeEventListener(\"scroll\", onChange);\n ownerWindow.removeEventListener(\"resize\", onChange);\n resizeObserver?.disconnect();\n stopObservingPrecedingContent();\n };\n }, [\n containerElement,\n isScrollElementMode,\n scrollTarget,\n updateIndicesFromScrollElement\n ]);\n\n /**\n * Determines the scroll position that brings an item into view, and which element must be scrolled to reach it:\n * the container itself or (in scroll element mode) the scroll element.\n *\n * @throws RangeError if an invalid index is provided\n */\n const getScrollPositionForIndex = useStableCallback(\n ({\n align = \"auto\",\n index\n }: {\n align?: Align;\n index: number;\n }): { scrollOffset: number; scrollTarget: ScrollTarget } | undefined => {\n // Like the browser's scrollIntoView, respect the scrolled element's CSS scroll-padding\n // (e.g. so that items aren't aligned underneath a sticky header)\n const getOffset = ({\n clamp,\n containerScrollOffset,\n containerSize,\n padding\n }: {\n clamp: boolean;\n containerScrollOffset: number;\n containerSize: number;\n padding: { end: number; start: number };\n }) => {\n if (padding.start === 0 && padding.end === 0) {\n return getOffsetForIndex({\n align,\n cachedBounds,\n clamp,\n containerScrollOffset,\n containerSize,\n index,\n itemCount,\n itemSize\n });\n }\n\n // Align the item within the padded region of the viewport, then convert back to a scroll offset\n const offset =\n getOffsetForIndex({\n align,\n cachedBounds,\n clamp: false,\n containerScrollOffset: containerScrollOffset + padding.start,\n containerSize: Math.max(\n 0,\n containerSize - padding.start - padding.end\n ),\n index,\n itemCount,\n itemSize\n }) - padding.start;\n\n return clamp\n ? Math.max(0, Math.min(getEstimatedSize() - containerSize, offset))\n : offset;\n };\n\n if (\n isScrollElementMode &&\n containerElement &&\n scrollTarget &&\n !isSelfScrolling(containerElement, direction)\n ) {\n const { viewportOffset, viewportSize } = measureScrollElementViewport({\n containerElement,\n direction,\n isRtl,\n scrollTarget\n });\n\n // The viewport can show content before or after the container,\n // so the browser (rather than the container's own size) limits how far it scrolls\n const offset = getOffset({\n clamp: false,\n containerScrollOffset: viewportOffset,\n containerSize: viewportSize,\n padding: getScrollPadding({\n direction,\n isRtl,\n scrollTarget,\n viewportSize\n })\n });\n\n // Horizontal RTL offsets increase leftward, but scroll positions increase rightward (in modern browsers)\n const delta = offset - viewportOffset;\n const scrollDelta =\n direction === \"horizontal\" && isRtl ? -delta : delta;\n\n return {\n scrollOffset:\n getScrollPosition(scrollTarget, direction) + scrollDelta,\n scrollTarget\n };\n }\n\n const containerScrollOffset = containerElement\n ? direction === \"vertical\"\n ? containerElement.scrollTop\n : containerElement.scrollLeft\n : 0;\n\n const ownContainerSize =\n isScrollElementMode && containerElement\n ? direction === \"vertical\"\n ? containerElement.clientHeight\n : containerElement.clientWidth\n : containerSize;\n\n let scrollOffset = getOffset({\n clamp: true,\n containerScrollOffset: adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset: containerScrollOffset\n }),\n containerSize: ownContainerSize,\n padding: containerElement\n ? getScrollPadding({\n direction,\n isRtl,\n scrollTarget: containerElement,\n viewportSize: ownContainerSize\n })\n : { end: 0, start: 0 }\n });\n\n if (containerElement && (!isScrollElementMode || scrollTarget)) {\n scrollOffset = adjustScrollOffsetForRtl({\n containerElement,\n direction,\n isRtl,\n scrollOffset\n });\n\n if (\n !isScrollElementMode &&\n typeof containerElement.scrollTo !== \"function\"\n ) {\n // Special case for environments like jsdom that don't implement scrollTo\n const next = getStartStopIndices(scrollOffset);\n if (!shallowCompare(indices, next)) {\n setIndices(next);\n }\n }\n\n return { scrollOffset, scrollTarget: containerElement };\n }\n }\n );\n\n return {\n getCellBounds,\n getEstimatedSize,\n getScrollPositionForIndex,\n scrollTarget,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n };\n}\n","import { useState } from \"react\";\nimport { shallowCompare } from \"../utils/shallowCompare\";\n\nexport function useMemoizedObject<Type extends object>(\n unstableObject: Type\n): Type {\n const [memoizedObject, setMemoizedObject] = useState(unstableObject);\n\n if (!shallowCompare(memoizedObject, unstableObject)) {\n setMemoizedObject(unstableObject);\n\n return unstableObject;\n }\n\n return memoizedObject;\n}\n","import type { CSSProperties } from \"react\";\nimport { shallowCompare } from \"./shallowCompare\";\n\n// Custom comparison function for React.memo()\n// It knows to compare individual style props and ignore the wrapper object.\n// See https://react.dev/reference/react/memo#memo\nexport function arePropsEqual(\n prevProps: { ariaAttributes: object; style: CSSProperties },\n nextProps: { ariaAttributes: object; style: CSSProperties }\n): boolean {\n const {\n ariaAttributes: prevAriaAttributes,\n style: prevStyle,\n ...prevRest\n } = prevProps;\n const {\n ariaAttributes: nextAriaAttributes,\n style: nextStyle,\n ...nextRest\n } = nextProps;\n\n return (\n shallowCompare(prevAriaAttributes, nextAriaAttributes) &&\n shallowCompare(prevStyle, nextStyle) &&\n shallowCompare(prevRest, nextRest)\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { Align, TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { scrollTargetTo } from \"../../utils/scrollElement\";\nimport type { GridProps } from \"./types\";\n\n/**\n * Renders data with many rows and columns.\n *\n * ℹ️ Unlike `List` rows, `Grid` cell sizes must be known ahead of time.\n * Either static sizes or something that can be derived (from the data in `CellProps`) without rendering.\n */\nexport function Grid<\n CellProps extends object,\n TagName extends TagNames = \"div\"\n>({\n cellComponent: CellComponentProp,\n cellProps: cellPropsUnstable,\n children,\n className,\n columnCount,\n columnKey,\n columnWidth,\n defaultHeight = 0,\n defaultScrollLeft = 0,\n defaultScrollTop = 0,\n defaultWidth = 0,\n dir,\n gridRef,\n onCellsRendered,\n onResize,\n overscanCount = 3,\n rowCount,\n rowHeight,\n rowKey,\n scrollElement,\n style,\n tagName = \"div\" as TagName,\n ...rest\n}: GridProps<CellProps, TagName>): ReactElement {\n const cellProps = useMemoizedObject(cellPropsUnstable);\n const CellComponent = useMemo(\n () => memo(CellComponentProp, arePropsEqual),\n [CellComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isRtl = useIsRtl(element, dir);\n\n // TODO With a scrollElement, each virtualizer (one per axis) separately adds scroll/resize listeners,\n // observes preceding content, and measures the grid and scroll element after every render and scroll event.\n // Measure once (e.g. in Grid) and share the result with both axes.\n const {\n getCellBounds: getColumnBounds,\n getEstimatedSize: getEstimatedWidth,\n startIndexOverscan: columnStartIndexOverscan,\n startIndexVisible: columnStartIndexVisible,\n getScrollPositionForIndex: getColumnScrollPosition,\n stopIndexOverscan: columnStopIndexOverscan,\n stopIndexVisible: columnStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultWidth,\n defaultScrollOffset: defaultScrollLeft,\n direction: \"horizontal\",\n isRtl,\n itemCount: columnCount,\n itemProps: cellProps,\n itemSize: columnWidth,\n onResize,\n overscanCount,\n scrollElement\n });\n\n const {\n getCellBounds: getRowBounds,\n getEstimatedSize: getEstimatedHeight,\n startIndexOverscan: rowStartIndexOverscan,\n startIndexVisible: rowStartIndexVisible,\n getScrollPositionForIndex: getRowScrollPosition,\n stopIndexOverscan: rowStopIndexOverscan,\n stopIndexVisible: rowStopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n defaultScrollOffset: defaultScrollTop,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: cellProps,\n itemSize: rowHeight,\n onResize,\n overscanCount,\n scrollElement\n });\n\n useImperativeHandle(\n gridRef,\n () => ({\n get element() {\n return element;\n },\n\n scrollToCell({\n behavior = \"auto\",\n columnAlign = \"auto\",\n columnIndex,\n rowAlign = \"auto\",\n rowIndex\n }: {\n behavior?: ScrollBehavior;\n columnAlign?: Align;\n columnIndex: number;\n rowAlign?: Align;\n rowIndex: number;\n }) {\n const column = getColumnScrollPosition({\n align: columnAlign,\n index: columnIndex\n });\n const row = getRowScrollPosition({\n align: rowAlign,\n index: rowIndex\n });\n\n // Columns and rows may scroll different elements (e.g. columns scroll within the grid and rows scroll with the page)\n if (column && row && column.scrollTarget === row.scrollTarget) {\n scrollTargetTo(row.scrollTarget, {\n behavior,\n left: column.scrollOffset,\n top: row.scrollOffset\n });\n } else {\n if (column) {\n scrollTargetTo(column.scrollTarget, {\n behavior,\n left: column.scrollOffset\n });\n }\n if (row) {\n scrollTargetTo(row.scrollTarget, {\n behavior,\n top: row.scrollOffset\n });\n }\n }\n },\n\n scrollToColumn({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const column = getColumnScrollPosition({ align, index });\n if (column) {\n scrollTargetTo(column.scrollTarget, {\n behavior,\n left: column.scrollOffset\n });\n }\n },\n\n scrollToRow({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) {\n const row = getRowScrollPosition({ align, index });\n if (row) {\n scrollTargetTo(row.scrollTarget, {\n behavior,\n top: row.scrollOffset\n });\n }\n }\n }),\n [element, getColumnScrollPosition, getRowScrollPosition]\n );\n\n useEffect(() => {\n if (\n columnStartIndexOverscan >= 0 &&\n columnStopIndexOverscan >= 0 &&\n rowStartIndexOverscan >= 0 &&\n rowStopIndexOverscan >= 0 &&\n onCellsRendered\n ) {\n onCellsRendered(\n {\n columnStartIndex: columnStartIndexVisible,\n columnStopIndex: columnStopIndexVisible,\n rowStartIndex: rowStartIndexVisible,\n rowStopIndex: rowStopIndexVisible\n },\n {\n columnStartIndex: columnStartIndexOverscan,\n columnStopIndex: columnStopIndexOverscan,\n rowStartIndex: rowStartIndexOverscan,\n rowStopIndex: rowStopIndexOverscan\n }\n );\n }\n }, [\n onCellsRendered,\n columnStartIndexOverscan,\n columnStartIndexVisible,\n columnStopIndexOverscan,\n columnStopIndexVisible,\n rowStartIndexOverscan,\n rowStartIndexVisible,\n rowStopIndexOverscan,\n rowStopIndexVisible\n ]);\n\n const cells = useMemo(() => {\n const children: ReactNode[] = [];\n if (columnCount > 0 && rowCount > 0) {\n for (\n let rowIndex = rowStartIndexOverscan;\n rowIndex <= rowStopIndexOverscan;\n rowIndex++\n ) {\n const rowBounds = getRowBounds(rowIndex);\n\n const columns: ReactNode[] = [];\n\n for (\n let columnIndex = columnStartIndexOverscan;\n columnIndex <= columnStopIndexOverscan;\n columnIndex++\n ) {\n const columnBounds = getColumnBounds(columnIndex);\n\n columns.push(\n <CellComponent\n {...(cellProps as CellProps)}\n ariaAttributes={{\n \"aria-colindex\": columnIndex + 1,\n role: \"gridcell\"\n }}\n columnIndex={columnIndex}\n key={\n columnKey\n ? columnKey({\n columnIndex,\n data: cellProps,\n rowIndex\n })\n : columnIndex\n }\n rowIndex={rowIndex}\n style={{\n position: \"absolute\",\n left: isRtl ? undefined : 0,\n right: isRtl ? 0 : undefined,\n transform: `translate(${isRtl ? -columnBounds.scrollOffset : columnBounds.scrollOffset}px, ${rowBounds.scrollOffset}px)`,\n height: rowBounds.size,\n width: columnBounds.size\n }}\n />\n );\n }\n\n children.push(\n <div\n key={\n rowKey\n ? rowKey({\n data: cellProps,\n rowIndex\n })\n : rowIndex\n }\n role=\"row\"\n aria-rowindex={rowIndex + 1}\n >\n {columns}\n </div>\n );\n }\n }\n return children;\n }, [\n CellComponent,\n cellProps,\n columnCount,\n columnKey,\n columnStartIndexOverscan,\n columnStopIndexOverscan,\n getColumnBounds,\n getRowBounds,\n isRtl,\n rowCount,\n rowKey,\n rowStartIndexOverscan,\n rowStopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n style={{\n height: getEstimatedHeight(),\n width: getEstimatedWidth(),\n zIndex: -1\n }}\n ></div>\n );\n\n return createElement(\n tagName,\n {\n \"aria-colcount\": columnCount,\n \"aria-rowcount\": rowCount,\n role: \"grid\",\n ...rest,\n className,\n dir,\n ref: setElement,\n style: {\n position: \"relative\",\n // Grids that scroll with an outer element render at their full height,\n // and at their full width unless constrained by their parent (in which case columns scroll within the grid)\n ...(scrollElement === undefined && {\n maxHeight: \"100%\",\n maxWidth: \"100%\"\n }),\n flexGrow: 1,\n overflow: \"auto\",\n ...style\n }\n },\n cells,\n children,\n sizingElement\n );\n}\n","import { useState } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the Grid component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useGridCallbackRef =\n useState as typeof useState<GridImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { GridImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the Grid component.\n */\nexport const useGridRef = useRef as typeof useRef<GridImperativeAPI>;\n","/**\n * Attribute that List sets on each rendered row.\n */\nexport const DATA_ATTRIBUTE_LIST_INDEX = \"data-react-window-index\";\n\n/**\n * Attribute that items rendered with the `useVirtualizer` hook set themselves.\n */\nexport const DATA_ATTRIBUTE_INDEX = \"data-index\";\n\n/**\n * Index of a rendered item (row), or undefined if the element doesn't specify a valid one\n * (e.g. a data-index attribute used for something else, like \"row-5\").\n */\nexport function getItemIndex(element: Element): number | undefined {\n const attribute =\n element.getAttribute(DATA_ATTRIBUTE_LIST_INDEX) ??\n element.getAttribute(DATA_ATTRIBUTE_INDEX);\n\n // Only non-negative integers (note that Number(\"\") would be 0)\n return attribute !== null && /^\\d+$/.test(attribute)\n ? Number(attribute)\n : undefined;\n}\n","import { useCallback, useRef, type RefObject } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"../hooks/useIsomorphicLayoutEffect\";\nimport { useStableCallback } from \"../hooks/useStableCallback\";\nimport type { Align } from \"../types\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport {\n getMaxScrollPosition,\n getScrollPosition,\n type ScrollTarget\n} from \"../utils/scrollElement\";\nimport { getItemIndex } from \"./itemIndex\";\nimport type { Bounds, Direction } from \"./types\";\n\nconst CORRECTION_DURATION = 1000;\nconst SMOOTH_SCROLL_DURATION = 500;\n\n// Starting at full speed keeps back-to-back scrolls (e.g. as new rows are appended) from stalling\nfunction easeOutCubic(t: number) {\n return 1 - Math.pow(1 - t, 3);\n}\n\n/**\n * Scrolls an item into view.\n *\n * Items with dynamic sizes are positioned using estimated sizes until they have been measured,\n * so scrolling to one is corrected over several frames as items around it are rendered and measured.\n * Corrections stop once the item's position is stable, after a deadline, or when the user scrolls.\n * Smooth scrolling is animated frame by frame (rather than by the browser) so that the destination can move as items are measured.\n *\n * ℹ️ Dynamic sizes are only supported for vertical lists.\n */\nexport function useScrollToIndex({\n direction,\n element,\n getCellBounds,\n isDynamicSize,\n itemCount,\n itemElements,\n scrollTarget,\n getScrollPositionForIndex\n}: {\n direction: Direction;\n element: HTMLElement | null;\n getCellBounds: (index: number) => Bounds;\n isDynamicSize: boolean;\n itemCount: number;\n itemElements: RefObject<Element[]>;\n scrollTarget: ScrollTarget | null;\n getScrollPositionForIndex: (options: {\n align?: Align;\n index: number;\n }) => { scrollOffset: number; scrollTarget: ScrollTarget } | undefined;\n}): (options: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n}) => void {\n const isVertical = direction === \"vertical\";\n const pendingScroll = useRef<{\n align: Align;\n index: number;\n smooth: boolean;\n stableFrames: number;\n // Set on the first frame, since frames are paused while the page is hidden\n animation?: {\n deadline: number;\n startOffset: number;\n startTime: number;\n };\n } | null>(null);\n\n // Track the window that scheduled the frame so it can be cancelled there.\n const scrollFrame = useRef<{ id: number; view: Window } | undefined>(\n undefined\n );\n\n const cancelScroll = useStableCallback(() => {\n pendingScroll.current = null;\n if (scrollFrame.current !== undefined) {\n scrollFrame.current.view.cancelAnimationFrame(scrollFrame.current.id);\n scrollFrame.current = undefined;\n }\n });\n\n // Use the list's own window (e.g. a popup rendered into via a portal),\n // since another window's frames may be throttled while it's in the background.\n const scheduleCorrectScroll = useStableCallback(() => {\n const view = getOwnerWindow(element);\n scrollFrame.current = {\n id: view.requestAnimationFrame(correctScroll),\n view\n };\n });\n\n const correctScroll = useStableCallback(() => {\n scrollFrame.current = undefined;\n const request = pendingScroll.current;\n if (!request) return;\n\n const now = performance.now();\n if (\n !element ||\n !isDynamicSize ||\n request.index >= itemCount ||\n (request.animation !== undefined && now >= request.animation.deadline)\n ) {\n cancelScroll();\n return;\n }\n\n const result = getScrollPositionForIndex({\n align: request.align,\n index: request.index\n });\n if (result !== undefined) {\n const { scrollOffset, scrollTarget } = result;\n // Use the committed DOM extent: the browser clamps offsets near the end.\n const offset = Math.max(\n 0,\n Math.min(scrollOffset, getMaxScrollPosition(scrollTarget, direction))\n );\n\n if (request.animation === undefined) {\n const duration = request.smooth ? SMOOTH_SCROLL_DURATION : 0;\n request.animation = {\n deadline: now + duration + CORRECTION_DURATION,\n startOffset: getScrollPosition(scrollTarget, direction),\n startTime: now\n };\n }\n\n // Ease towards the latest estimate of the destination, which moves as items are measured\n const progress = request.smooth\n ? (now - request.animation.startTime) / SMOOTH_SCROLL_DURATION\n : 1;\n if (progress < 1) {\n const { startOffset } = request.animation;\n request.stableFrames = 0;\n scrollTarget.scrollTo({\n behavior: \"instant\",\n [isVertical ? \"top\" : \"left\"]:\n startOffset + (offset - startOffset) * easeOutCubic(progress)\n });\n } else if (\n Math.abs(offset - getScrollPosition(scrollTarget, direction)) > 1\n ) {\n request.stableFrames = 0;\n scrollTarget.scrollTo({\n behavior: \"instant\",\n [isVertical ? \"top\" : \"left\"]: offset\n });\n } else {\n // An unchanged estimated offset is not enough:\n // React may not have committed the destination items or their ResizeObserver updates yet.\n const items = itemElements.current;\n const targetIsRendered = items.some(\n (item) => getItemIndex(item) === request.index\n );\n const measurementsCommitted =\n targetIsRendered &&\n items.every((item) => {\n // Items without a valid index (or left over from a larger item count) can't be checked\n const index = getItemIndex(item);\n if (index === undefined || index >= itemCount) {\n return true;\n }\n\n // ResizeObserver reports untransformed border-box sizes.\n // offsetHeight uses the same coordinate space; allow for its integer rounding.\n const size = isVertical\n ? (item as HTMLElement).offsetHeight\n : (item as HTMLElement).offsetWidth;\n return Math.abs(getCellBounds(index).size - size) <= 1;\n });\n if (!measurementsCommitted) {\n request.stableFrames = 0;\n } else if (++request.stableFrames >= 2) {\n cancelScroll();\n return;\n }\n }\n }\n scheduleCorrectScroll();\n });\n\n // User input cancels pending corrections;\n // lists that scroll with an outer element (e.g. the page) can be scrolled from outside of the list\n useIsomorphicLayoutEffect(() => {\n const target = scrollTarget ?? element;\n if (!target) return;\n\n const onKeyDown = (event: KeyboardEvent) => {\n switch (event.key) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"PageUp\":\n case \"PageDown\":\n case \"Home\":\n case \"End\":\n case \" \": {\n cancelScroll();\n }\n }\n };\n\n target.addEventListener(\"wheel\", cancelScroll, { passive: true });\n target.addEventListener(\"touchstart\", cancelScroll, { passive: true });\n target.addEventListener(\"pointerdown\", cancelScroll);\n target.addEventListener(\"keydown\", onKeyDown as EventListener);\n\n return () => {\n cancelScroll();\n\n target.removeEventListener(\"wheel\", cancelScroll);\n target.removeEventListener(\"touchstart\", cancelScroll);\n target.removeEventListener(\"pointerdown\", cancelScroll);\n target.removeEventListener(\"keydown\", onKeyDown as EventListener);\n };\n }, [cancelScroll, element, scrollTarget]);\n\n return useCallback(\n ({\n align = \"auto\",\n behavior = \"auto\",\n index\n }: {\n align?: Align;\n behavior?: ScrollBehavior;\n index: number;\n }) => {\n // Resolve smart alignment once, before measurements move the target.\n if (isDynamicSize && align === \"smart\") {\n const auto = getScrollPositionForIndex({ align: \"auto\", index });\n align =\n auto === undefined ||\n auto.scrollOffset === getScrollPosition(auto.scrollTarget, direction)\n ? \"auto\"\n : \"center\";\n }\n\n const result = getScrollPositionForIndex({ align, index });\n\n cancelScroll();\n\n if (result && typeof result.scrollTarget.scrollTo === \"function\") {\n const { scrollOffset, scrollTarget } = result;\n if (isDynamicSize) {\n // There's no point in animating a scroll that can't be seen\n const smooth =\n behavior === \"smooth\" &&\n element?.ownerDocument.visibilityState !== \"hidden\";\n\n pendingScroll.current = {\n align,\n index,\n smooth,\n stableFrames: 0\n };\n scheduleCorrectScroll();\n\n // Smooth scrolling starts on the next frame\n if (smooth) {\n return;\n }\n }\n scrollTarget.scrollTo({\n behavior: isDynamicSize ? \"instant\" : behavior,\n [isVertical ? \"top\" : \"left\"]: scrollOffset\n });\n }\n },\n [\n cancelScroll,\n direction,\n element,\n isDynamicSize,\n isVertical,\n scheduleCorrectScroll,\n getScrollPositionForIndex\n ]\n );\n}\n","import { useEffect } from \"react\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport { useStableCallback } from \"./useStableCallback\";\n\n/**\n * Calls the callback once the initial ResizeObserver notifications for elements rendered within the specified element\n * have been delivered (or would have been, if ResizeObserver is unsupported).\n *\n * ResizeObserver notifications are delivered between layout and paint, so waiting two animation frames ensures\n * that a frame has been rendered since the elements were first observed.\n */\nexport function useAfterResizeObserverNotifications({\n callback,\n element,\n enabled = true\n}: {\n callback: () => void;\n element: HTMLElement | null;\n enabled?: boolean;\n}) {\n const stableCallback = useStableCallback(callback);\n\n useEffect(() => {\n if (!enabled || !element) {\n return;\n }\n\n const ownerWindow = getOwnerWindow(element);\n let id = ownerWindow.requestAnimationFrame(() => {\n id = ownerWindow.requestAnimationFrame(stableCallback);\n });\n\n return () => {\n ownerWindow.cancelAnimationFrame(id);\n };\n }, [element, enabled, stableCallback]);\n}\n","import type { DynamicRowHeight } from \"./types\";\n\nexport function isDynamicRowHeight(value: unknown): value is DynamicRowHeight {\n return (\n value != null &&\n typeof value === \"object\" &&\n \"getAverageRowHeight\" in value &&\n typeof value.getAverageRowHeight === \"function\"\n );\n}\n","\"use client\";\n\nimport {\n createElement,\n Fragment,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode\n} from \"react\";\nimport { DATA_ATTRIBUTE_LIST_INDEX } from \"../../core/itemIndex\";\nimport { useScrollToIndex } from \"../../core/useScrollToIndex\";\nimport { useVirtualizer } from \"../../core/useVirtualizer\";\nimport { useAfterResizeObserverNotifications } from \"../../hooks/useAfterResizeObserverNotifications\";\nimport { useIsHydrating } from \"../../hooks/useIsHydrating\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { useMemoizedObject } from \"../../hooks/useMemoizedObject\";\nimport type { TagNames } from \"../../types\";\nimport { arePropsEqual } from \"../../utils/arePropsEqual\";\nimport { isDynamicRowHeight as isDynamicRowHeightUtil } from \"./isDynamicRowHeight\";\nimport type { ListProps } from \"./types\";\n\nexport const DATA_ATTRIBUTE_SIZER = \"data-react-window-sizer\";\n\n/**\n * Renders data with many rows.\n */\nexport function List<\n RowProps extends object,\n TagName extends TagNames = \"div\"\n>({\n children,\n className,\n defaultHeight = 0,\n defaultScrollOffset = 0,\n listRef,\n onResize,\n onRowsRendered,\n overscanCount = 3,\n rowComponent: RowComponentProp,\n rowCount,\n rowHeight: rowHeightProp,\n rowKey,\n rowProps: rowPropsUnstable,\n scrollElement,\n tagName = \"div\" as TagName,\n style,\n ...rest\n}: ListProps<RowProps, TagName>): ReactElement {\n const rowProps = useMemoizedObject(rowPropsUnstable);\n const RowComponent = useMemo(\n () => memo(RowComponentProp, arePropsEqual),\n [RowComponentProp]\n );\n\n const [element, setElement] = useState<HTMLDivElement | null>(null);\n\n const isDynamicRowHeight = isDynamicRowHeightUtil(rowHeightProp);\n\n const rowHeight = useMemo(() => {\n if (isDynamicRowHeight) {\n return (index: number) => {\n return (\n rowHeightProp.getRowHeight(index) ??\n rowHeightProp.getAverageRowHeight()\n );\n };\n }\n\n return rowHeightProp;\n }, [isDynamicRowHeight, rowHeightProp]);\n\n // Server-rendered rows with dynamic heights haven't been measured yet, so absolutely positioning them\n // (based on estimated heights) would cause them to overlap or leave gaps until after hydration.\n // Instead, render them in normal document flow until the first measurements are available.\n const isHydrating = useIsHydrating();\n const [isFlowLayout, setIsFlowLayout] = useState(\n () => isHydrating && isDynamicRowHeight\n );\n const flowLayoutRowHeightRef = useRef(rowHeightProp);\n useIsomorphicLayoutEffect(() => {\n if (isFlowLayout && flowLayoutRowHeightRef.current !== rowHeightProp) {\n setIsFlowLayout(false);\n }\n }, [isFlowLayout, rowHeightProp]);\n // Measurements may never arrive (e.g. if ResizeObserver is unsupported or rows have no height yet),\n // or may exactly match initialRowHeights (in which case rowHeightProp's identity doesn't change)\n useAfterResizeObserverNotifications({\n callback: () => setIsFlowLayout(false),\n element,\n enabled: isFlowLayout\n });\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollTarget,\n getScrollPositionForIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizer({\n containerElement: element,\n containerStyle: style,\n defaultContainerSize: defaultHeight,\n defaultScrollOffset,\n direction: \"vertical\",\n itemCount: rowCount,\n itemProps: rowProps,\n itemSize: rowHeight,\n onResize,\n overscanCount,\n scrollElement\n });\n\n const rowElements = useRef<Element[]>([]);\n const scrollToRow = useScrollToIndex({\n direction: \"vertical\",\n element,\n getCellBounds,\n isDynamicSize: isDynamicRowHeight,\n itemCount: rowCount,\n itemElements: rowElements,\n scrollTarget,\n getScrollPositionForIndex\n });\n\n useImperativeHandle(\n listRef,\n () => ({\n get element() {\n return element;\n },\n scrollToRow\n }),\n [element, scrollToRow]\n );\n\n useIsomorphicLayoutEffect(() => {\n if (!element) {\n return;\n }\n\n // Additional children (e.g. overlays) are not rows and must not be measured.\n const rows = Array.from(element.children)\n .slice(\n 0,\n startIndexOverscan < 0 ? 0 : stopIndexOverscan - startIndexOverscan + 1\n )\n .filter((item, index) => {\n if (item.hasAttribute(DATA_ATTRIBUTE_SIZER)) {\n // Ignore sizing element\n return false;\n }\n\n const attribute = `${startIndexOverscan + index}`;\n item.setAttribute(DATA_ATTRIBUTE_LIST_INDEX, attribute);\n\n return true;\n });\n\n rowElements.current = rows;\n\n if (isDynamicRowHeight) {\n return rowHeightProp.observeRowElements(rows);\n }\n }, [\n RowComponent,\n element,\n isDynamicRowHeight,\n rowCount,\n rowHeightProp,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n useEffect(() => {\n if (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onRowsRendered) {\n onRowsRendered(\n {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n },\n {\n startIndex: startIndexOverscan,\n stopIndex: stopIndexOverscan\n }\n );\n }\n }, [\n onRowsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n // Flow layout only matches the absolute layout if rendering starts at the first row\n const isFlowLayoutActive =\n isFlowLayout && isDynamicRowHeight && startIndexOverscan === 0;\n\n const rows = useMemo(() => {\n const children: ReactNode[] = [];\n if (rowCount > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const bounds = getCellBounds(index);\n\n children.push(\n <RowComponent\n {...(rowProps as RowProps)}\n ariaAttributes={{\n \"aria-posinset\": index + 1,\n \"aria-setsize\": rowCount,\n role: \"listitem\"\n }}\n key={rowKey ? rowKey(index, rowProps) : index}\n index={index}\n style={\n isFlowLayoutActive\n ? { width: \"100%\" }\n : {\n position: \"absolute\",\n left: 0,\n transform: `translateY(${bounds.scrollOffset}px)`,\n // In case of dynamic row heights, don't specify a height style\n // otherwise a default/estimated height would mask the actual height\n height: isDynamicRowHeight ? undefined : bounds.size,\n width: \"100%\"\n }\n }\n />\n );\n }\n }\n return children;\n }, [\n RowComponent,\n getCellBounds,\n isDynamicRowHeight,\n isFlowLayoutActive,\n rowCount,\n rowKey,\n rowProps,\n startIndexOverscan,\n stopIndexOverscan\n ]);\n\n const sizingElement = (\n <div\n aria-hidden\n key=\"sizer\"\n {...{ [DATA_ATTRIBUTE_SIZER]: \"\" }}\n style={{\n // Rows rendered in flow layout already take up space\n position: isFlowLayoutActive ? \"absolute\" : undefined,\n top: isFlowLayoutActive ? 0 : undefined,\n height: getEstimatedSize(),\n width: \"100%\",\n zIndex: -1\n }}\n ></div>\n );\n\n const childrenElement = <Fragment key=\"children\">{children}</Fragment>;\n const rowsElement = <Fragment key=\"rows\">{rows}</Fragment>;\n\n return createElement(\n tagName,\n {\n role: \"list\",\n ...rest,\n className,\n ref: setElement,\n style: {\n position: \"relative\",\n flexGrow: 1,\n // Lists that scroll with an outer element render at their full height (and must not clip sticky rows)\n ...(scrollElement === undefined && {\n maxHeight: \"100%\",\n overflowY: \"auto\"\n }),\n ...style\n }\n },\n // Rows rendered in flow layout would push children (e.g. sticky rows) below them, so render children first.\n // Keys let React move children (rather than remounting them) once rows switch to absolute layout.\n ...(isFlowLayoutActive\n ? [childrenElement, rowsElement]\n : [rowsElement, childrenElement]),\n sizingElement\n );\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useStableCallback } from \"../../hooks/useStableCallback\";\nimport { getOwnerWindow } from \"../../utils/getOwnerWindow\";\nimport { getResizeObserverClass } from \"../../utils/getResizeObserverClass\";\nimport { getItemIndex } from \"../../core/itemIndex\";\nimport type { DynamicRowHeight } from \"./types\";\n\nfunction createInitialMap(\n initialRowHeights: ReadonlyMap<number, number> | readonly number[] | undefined\n): Map<number, number> {\n const map = new Map<number, number>();\n if (initialRowHeights !== undefined) {\n // Invalid heights would corrupt cached row positions; treat them as unmeasured\n initialRowHeights.forEach((height: number, index: number) => {\n if (Number.isFinite(height) && height > 0) {\n map.set(index, height);\n }\n });\n }\n return map;\n}\n\nexport function useDynamicRowHeight({\n defaultRowHeight,\n initialRowHeights,\n key\n}: {\n /**\n * Estimated height (in pixels) of rows that have not yet been measured.\n */\n defaultRowHeight: number;\n\n /**\n * Row heights (in pixels) that are known or can be estimated ahead of time, e.g. estimated from each row's content.\n * This can be either an array (where each item is the height of the row at that index) or a Map of row index to height.\n *\n * These values are used in place of `defaultRowHeight` until rows are rendered and measured,\n * so providing them can make server-rendered lists and initial scroll positions more accurate.\n *\n * ℹ️ This value is only read when the hook first mounts and when the `key` changes.\n */\n initialRowHeights?: ReadonlyMap<number, number> | readonly number[];\n\n /**\n * Changing this value clears all measured row heights,\n * e.g. when the list renders a different set of data.\n */\n key?: string | number;\n}) {\n const [state, setState] = useState<{\n key: string | number | undefined;\n map: Map<number, number>;\n }>(() => ({\n key,\n map: createInitialMap(initialRowHeights)\n }));\n\n if (state.key !== key) {\n setState({\n key,\n map: createInitialMap(initialRowHeights)\n });\n }\n\n const { map } = state;\n\n const getAverageRowHeight = useCallback(() => {\n let totalHeight = 0;\n\n map.forEach((height) => {\n totalHeight += height;\n });\n\n if (totalHeight === 0) {\n return defaultRowHeight;\n }\n\n return totalHeight / map.size;\n }, [defaultRowHeight, map]);\n\n const getRowHeight = useCallback(\n (index: number) => {\n const measuredHeight = map.get(index);\n if (measuredHeight !== undefined) {\n return measuredHeight;\n }\n\n // Keep estimates stable when rowProps change (see issue #863), but do not\n // store them as measurements or include them in the measured average.\n return defaultRowHeight;\n },\n [defaultRowHeight, map]\n );\n\n const setRowHeight = useCallback((index: number, size: number) => {\n setState((prevState) => {\n if (prevState.map.get(index) === size) {\n return prevState;\n }\n\n const clonedMap = new Map(prevState.map);\n clonedMap.set(index, size);\n\n return {\n ...prevState,\n map: clonedMap\n };\n });\n }, []);\n\n const resizeObserverCallback = useStableCallback(\n (entries: ResizeObserverEntry[]) => {\n if (entries.length === 0) {\n return;\n }\n\n entries.forEach((entry) => {\n const { borderBoxSize, target } = entry;\n\n // Elements without a valid index can't be associated with a row\n // (useVirtualizer warns about these when they're registered)\n const index = getItemIndex(target);\n if (index === undefined) {\n return;\n }\n\n const { blockSize: height } = borderBoxSize[0];\n if (!height) {\n // Ignore heights that have not yet been measured (e.g. <img> elements that have not yet loaded)\n return;\n }\n\n setRowHeight(index, height);\n });\n }\n );\n\n // Rows may be rendered into another window (e.g. a popup rendered into via a portal),\n // and observers only report on elements in documents they belong to\n const resizeObserverRef = useRef<{\n resizeObserver: ResizeObserver;\n view: Window;\n } | null>(null);\n\n useEffect(\n () => () => {\n resizeObserverRef.current?.resizeObserver.disconnect();\n resizeObserverRef.current = null;\n },\n []\n );\n\n const observeRowElements = useCallback(\n (elements: Element[] | NodeListOf<Element>) => {\n const observed: [Element, ResizeObserver][] = [];\n\n elements.forEach((element) => {\n const view = getOwnerWindow(element);\n\n // Rows from one list share a window, so this only happens if the list moves to another window\n if (resizeObserverRef.current?.view !== view) {\n resizeObserverRef.current?.resizeObserver.disconnect();\n\n const ResizeObserverClass = getResizeObserverClass(element);\n resizeObserverRef.current = ResizeObserverClass\n ? {\n resizeObserver: new ResizeObserverClass(resizeObserverCallback),\n view\n }\n : null;\n }\n\n const resizeObserver = resizeObserverRef.current?.resizeObserver;\n if (resizeObserver) {\n resizeObserver.observe(element);\n observed.push([element, resizeObserver]);\n }\n });\n\n return () => {\n observed.forEach(([element, resizeObserver]) =>\n resizeObserver.unobserve(element)\n );\n };\n },\n [resizeObserverCallback]\n );\n\n return useMemo<DynamicRowHeight>(\n () => ({\n getAverageRowHeight,\n getRowHeight,\n setRowHeight,\n observeRowElements\n }),\n [getAverageRowHeight, getRowHeight, setRowHeight, observeRowElements]\n );\n}\n","import { useState } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref callback for the List component.\n *\n * Use this hook when you need to share the ref with another component or hook.\n */\nexport const useListCallbackRef =\n useState as typeof useState<ListImperativeAPI | null>;\n","import { useRef } from \"react\";\nimport type { ListImperativeAPI } from \"./types\";\n\n/**\n * Convenience hook to return a properly typed ref for the List component.\n */\nexport const useListRef = useRef as typeof useRef<ListImperativeAPI>;\n","import { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { getItemIndex } from \"../../core/itemIndex\";\nimport { useIsRtl } from \"../../core/useIsRtl\";\nimport { useScrollToIndex } from \"../../core/useScrollToIndex\";\nimport { useVirtualizer as useVirtualizerCore } from \"../../core/useVirtualizer\";\nimport { useIsomorphicLayoutEffect } from \"../../hooks/useIsomorphicLayoutEffect\";\nimport { assert } from \"../../utils/assert\";\nimport { isDynamicRowHeight } from \"../list/isDynamicRowHeight\";\nimport type { DynamicRowHeight } from \"../list/types\";\nimport type { VirtualItem, Virtualizer, VirtualizerOptions } from \"./types\";\n\n// Sizes are cached based on the identity of the itemSize option\nconst ITEM_PROPS = {};\n\n/**\n * Calculates which items to render, and where, for custom (headless) virtualized content\n * (e.g. a `<table>` or a custom layout).\n *\n * The returned items are positioned relative to the start of the element's content;\n * how they are rendered (e.g. absolute positioning or spacer elements) is up to the caller.\n */\nexport function useVirtualizer({\n count,\n defaultScrollOffset = 0,\n defaultSize = 0,\n dir,\n direction = \"vertical\",\n element,\n itemSize: itemSizeOption,\n onItemsRendered,\n overscanCount = 3,\n scrollElement\n}: VirtualizerOptions): Virtualizer {\n const isDynamicSize = isDynamicRowHeight(itemSizeOption);\n assert(\n !isDynamicSize || direction === \"vertical\",\n \"Dynamic item sizes are only supported for vertical content\"\n );\n\n const itemSize = useMemo(() => {\n if (isDynamicRowHeight(itemSizeOption)) {\n return (index: number) =>\n itemSizeOption.getRowHeight(index) ??\n itemSizeOption.getAverageRowHeight();\n }\n\n return itemSizeOption;\n }, [itemSizeOption]);\n\n const isRtl = useIsRtl(element, dir);\n\n const {\n getCellBounds,\n getEstimatedSize,\n scrollTarget,\n getScrollPositionForIndex,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n } = useVirtualizerCore({\n containerElement: element,\n defaultContainerSize: defaultSize,\n defaultScrollOffset,\n direction,\n isRtl: direction === \"horizontal\" && isRtl,\n itemCount: count,\n itemProps: ITEM_PROPS,\n itemSize,\n onResize: undefined,\n overscanCount,\n scrollElement\n });\n\n // Elements passed to measureElement; React 18 doesn't say which element unmounted (it passes null),\n // so disconnected elements are pruned after each render instead\n const measuredElementsRef = useRef(new Set<Element>());\n const warnedElementsRef = useRef(new WeakSet<Element>());\n const itemElementsRef = useRef<Element[]>([]);\n const observedRef = useRef<{\n dynamicRowHeight: DynamicRowHeight | null;\n unobserve: Map<Element, () => void>;\n }>({ dynamicRowHeight: null, unobserve: new Map() });\n\n const measureElement = useCallback((element: Element | null) => {\n if (element !== null) {\n measuredElementsRef.current.add(element);\n }\n }, []);\n\n const container = element;\n useIsomorphicLayoutEffect(() => {\n const elements = measuredElementsRef.current;\n const observed = observedRef.current;\n\n const dynamicRowHeight = isDynamicRowHeight(itemSizeOption)\n ? itemSizeOption\n : null;\n if (\n observed.dynamicRowHeight?.observeRowElements !==\n dynamicRowHeight?.observeRowElements\n ) {\n // A different cache (or none) is being used\n observed.unobserve.forEach((unobserve) => unobserve());\n observed.unobserve.clear();\n }\n observed.dynamicRowHeight = dynamicRowHeight;\n\n elements.forEach((element) => {\n if (!element.isConnected) {\n elements.delete(element);\n observed.unobserve.get(element)?.();\n observed.unobserve.delete(element);\n } else if (\n dynamicRowHeight &&\n // Like List, measure items once the element has mounted\n // (e.g. so the dynamic row height cache has finished mounting too)\n container !== null &&\n !observed.unobserve.has(element)\n ) {\n if (getItemIndex(element) === undefined) {\n // Measurements can't be associated with an item without its index\n if (!warnedElementsRef.current.has(element)) {\n warnedElementsRef.current.add(element);\n console.warn(\n \"useVirtualizer: Items passed to measureElement must specify their index with a data-index attribute\",\n element\n );\n }\n return;\n }\n\n observed.unobserve.set(\n element,\n dynamicRowHeight.observeRowElements([element])\n );\n }\n });\n\n itemElementsRef.current = Array.from(elements);\n });\n\n useEffect(() => {\n const observed = observedRef.current;\n return () => {\n observed.unobserve.forEach((unobserve) => unobserve());\n observed.unobserve.clear();\n observed.dynamicRowHeight = null;\n };\n }, []);\n\n const scrollToIndex = useScrollToIndex({\n direction,\n element,\n getCellBounds,\n isDynamicSize,\n itemCount: count,\n itemElements: itemElementsRef,\n scrollTarget,\n getScrollPositionForIndex\n });\n\n useEffect(() => {\n if (startIndexOverscan >= 0 && stopIndexOverscan >= 0 && onItemsRendered) {\n onItemsRendered(\n { startIndex: startIndexVisible, stopIndex: stopIndexVisible },\n { startIndex: startIndexOverscan, stopIndex: stopIndexOverscan }\n );\n }\n }, [\n onItemsRendered,\n startIndexOverscan,\n startIndexVisible,\n stopIndexOverscan,\n stopIndexVisible\n ]);\n\n const items = useMemo(() => {\n const items: VirtualItem[] = [];\n if (count > 0) {\n for (\n let index = startIndexOverscan;\n index <= stopIndexOverscan;\n index++\n ) {\n const { scrollOffset, size } = getCellBounds(index);\n items.push({ index, offset: scrollOffset, size });\n }\n }\n return items;\n }, [count, getCellBounds, startIndexOverscan, stopIndexOverscan]);\n\n const totalSize = getEstimatedSize();\n\n return useMemo(\n () => ({\n items,\n measureElement,\n scrollToIndex,\n totalSize,\n visibleRange: {\n startIndex: startIndexVisible,\n stopIndex: stopIndexVisible\n }\n }),\n [\n items,\n measureElement,\n scrollToIndex,\n startIndexVisible,\n stopIndexVisible,\n totalSize\n ]\n );\n}\n","import { useState } from \"react\";\nimport { getOwnerWindow } from \"../utils/getOwnerWindow\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect\";\n\n/**\n * Tracks whether an element (or the window) is currently scrolling,\n * e.g. to render simplified content in place of rows that are expensive to render.\n *\n * Pass the element that scrolls:\n * - a list or grid's own element (e.g. from `useListCallbackRef`)\n * - \"window\" or the scroll element, for lists and grids that use the `scrollElement` prop\n *\n * Scrolling ends when the browser fires a \"scrollend\" event or,\n * in browsers that don't support that event, after no scroll events have been received for `delay` milliseconds.\n *\n * ℹ️ Scrolling that starts and ends before React renders (e.g. an instant scroll) may not change this value.\n *\n * ⚠️ Changing this value re-renders any rows it is passed to (e.g. via `rowProps`) when scrolling starts and when it ends.\n */\nexport function useIsScrolling(\n target: \"window\" | HTMLElement | null | undefined,\n {\n delay = 150\n }: {\n /**\n * Milliseconds without scroll events after which scrolling is considered to have ended\n * (only used by browsers that don't support the \"scrollend\" event); defaults to 150.\n */\n delay?: number;\n } = {}\n): boolean {\n const [isScrolling, setIsScrolling] = useState(false);\n\n useIsomorphicLayoutEffect(() => {\n if (!target) {\n return;\n }\n\n const ownerWindow =\n target === \"window\" ? window : getOwnerWindow(target as HTMLElement);\n const eventTarget = target === \"window\" ? ownerWindow : target;\n\n // Checked against a plain object, since TypeScript assumes all windows support the event\n const supportsScrollEnd = \"onscrollend\" in (ownerWindow as object);\n\n let animationFrameId: number | undefined = undefined;\n let lastScrollTime = 0;\n\n // Timeouts can be starved while scrolling (see issue #106), so check the elapsed time each frame instead\n const checkForScrollEnd = () => {\n if (performance.now() - lastScrollTime >= delay) {\n animationFrameId = undefined;\n setIsScrolling(false);\n } else {\n animationFrameId = ownerWindow.requestAnimationFrame(checkForScrollEnd);\n }\n };\n\n const onScroll = () => {\n setIsScrolling(true);\n\n if (!supportsScrollEnd) {\n lastScrollTime = performance.now();\n if (animationFrameId === undefined) {\n animationFrameId =\n ownerWindow.requestAnimationFrame(checkForScrollEnd);\n }\n }\n };\n\n const onScrollEnd = () => {\n setIsScrolling(false);\n };\n\n eventTarget.addEventListener(\"scroll\", onScroll, { passive: true });\n if (supportsScrollEnd) {\n eventTarget.addEventListener(\"scrollend\", onScrollEnd);\n }\n\n return () => {\n eventTarget.removeEventListener(\"scroll\", onScroll);\n eventTarget.removeEventListener(\"scrollend\", onScrollEnd);\n if (animationFrameId !== undefined) {\n ownerWindow.cancelAnimationFrame(animationFrameId);\n }\n\n // A different target (or none) isn't scrolling yet\n setIsScrolling(false);\n };\n }, [delay, target]);\n\n return isScrolling;\n}\n","// Cache per document, since windows may differ (e.g. custom scrollbar styles in a popup)\nconst cache = new WeakMap<Document, number>();\n\nexport function getScrollbarSize(\n recalculate: boolean = false,\n ownerDocument: Document | undefined = typeof document !== \"undefined\"\n ? document\n : undefined\n): number {\n if (ownerDocument === undefined) {\n // Scrollbar size can't be measured during server rendering\n return 0;\n }\n\n let size = cache.get(ownerDocument);\n if (size === undefined || recalculate) {\n const div = ownerDocument.createElement(\"div\");\n const style = div.style;\n style.width = \"50px\";\n style.height = \"50px\";\n style.overflow = \"scroll\";\n\n ownerDocument.body.appendChild(div);\n\n size = div.offsetWidth - div.clientWidth;\n\n ownerDocument.body.removeChild(div);\n\n cache.set(ownerDocument, size);\n }\n\n return size;\n}\n\nexport function setScrollbarSizeForTests(\n value: number,\n ownerDocument: Document = document\n) {\n cache.set(ownerDocument, value);\n}\n"],"names":["useIsomorphicLayoutEffect","useLayoutEffect","useEffect","isRtl","element","currentElement","useIsRtl","dir","value","setValue","useState","subscribe","useIsHydrating","useSyncExternalStore","getOwnerWindow","getResizeObserverClass","parseNumericStyleValue","useResizeObserver","box","defaultHeight","defaultWidth","disabledProp","mode","style","styleHeight","styleWidth","useMemo","state","setState","disabled","ResizeObserverClass","resizeObserver","entries","entry","contentRect","target","prevState","useStableCallback","fn","ref","useRef","useCallback","args","cache","getRTLOffsetType","recalculate","ownerDocument","cachedRTLResult","outerDiv","outerStyle","innerDiv","innerStyle","adjustScrollOffsetForRtl","containerElement","direction","scrollOffset","clientWidth","scrollWidth","observePrecedingContent","container","onChange","ownerWindow","MutationObserverClass","precedesElement","node","mutationObserver","records","record","observe","observedElements","sibling","current","parent","isWindow","getScrollTarget","scrollElement","getScrollPosition","getMaxScrollPosition","scrollTargetTo","options","isSelfScrolling","overflowX","overflowY","overflow","measureScrollElementViewport","scrollTarget","isVertical","viewStart","viewportSize","documentElement","rect","viewEnd","elementStart","elementSize","elementEnd","ownScrollOffset","viewportStartWithinElement","viewportEndWithinElement","visibleStart","visibleEnd","getScrollPadding","parse","number","left","right","assert","expectedCondition","message","shallowCompare","a","b","key","getEstimatedSize","cachedBounds","itemCount","itemSize","bounds","averageItemSize","getOffsetForIndex","align","clamp","index","containerScrollOffset","containerSize","estimatedTotalSize","clampOffset","offset","maxOffset","minOffset","isVisible","getStartStopIndices","overscanCount","maxIndex","startIndexVisible","stopIndexVisible","low","high","middle","createCachedBounds","itemProps","currentIndex","size","previousRowBounds","useCachedBounds","useItemSize","itemSizeProp","useVirtualizer","containerStyle","defaultContainerSize","defaultScrollOffset","onResize","isScrollElementMode","height","width","prevSizeRef","setViewportSize","prevSize","isHydrating","initialScrollOffset","getCellBounds","indices","setIndices","getStartStopIndicesUtil","startIndexOverscan","stopIndexOverscan","getEstimatedSizeUtil","hasAppliedDefaultScrollOffsetRef","isRtlContainer","isRtlUtil","next","prev","onScroll","scrollLeft","scrollTop","updateIndicesFromScrollElement","stopObservingPrecedingContent","getScrollPositionForIndex","getOffset","padding","viewportOffset","delta","scrollDelta","ownContainerSize","useMemoizedObject","unstableObject","memoizedObject","setMemoizedObject","arePropsEqual","prevProps","nextProps","prevAriaAttributes","prevStyle","prevRest","nextAriaAttributes","nextStyle","nextRest","Grid","CellComponentProp","cellPropsUnstable","children","className","columnCount","columnKey","columnWidth","defaultScrollLeft","defaultScrollTop","gridRef","onCellsRendered","rowCount","rowHeight","rowKey","tagName","rest","cellProps","CellComponent","memo","setElement","getColumnBounds","getEstimatedWidth","columnStartIndexOverscan","columnStartIndexVisible","getColumnScrollPosition","columnStopIndexOverscan","columnStopIndexVisible","getRowBounds","getEstimatedHeight","rowStartIndexOverscan","rowStartIndexVisible","getRowScrollPosition","rowStopIndexOverscan","rowStopIndexVisible","useImperativeHandle","behavior","columnAlign","columnIndex","rowAlign","rowIndex","column","row","cells","rowBounds","columns","columnBounds","createElement","jsx","sizingElement","useGridCallbackRef","useGridRef","DATA_ATTRIBUTE_LIST_INDEX","DATA_ATTRIBUTE_INDEX","getItemIndex","attribute","CORRECTION_DURATION","SMOOTH_SCROLL_DURATION","easeOutCubic","t","useScrollToIndex","isDynamicSize","itemElements","pendingScroll","scrollFrame","cancelScroll","scheduleCorrectScroll","view","correctScroll","request","now","result","duration","progress","startOffset","items","item","onKeyDown","event","auto","smooth","useAfterResizeObserverNotifications","callback","enabled","stableCallback","id","isDynamicRowHeight","DATA_ATTRIBUTE_SIZER","List","listRef","onRowsRendered","RowComponentProp","rowHeightProp","rowPropsUnstable","rowProps","RowComponent","isDynamicRowHeightUtil","isFlowLayout","setIsFlowLayout","flowLayoutRowHeightRef","rowElements","scrollToRow","rows","isFlowLayoutActive","childrenElement","Fragment","rowsElement","createInitialMap","initialRowHeights","map","useDynamicRowHeight","defaultRowHeight","getAverageRowHeight","totalHeight","getRowHeight","measuredHeight","setRowHeight","clonedMap","resizeObserverCallback","borderBoxSize","resizeObserverRef","observeRowElements","elements","observed","useListCallbackRef","useListRef","ITEM_PROPS","count","defaultSize","itemSizeOption","onItemsRendered","useVirtualizerCore","measuredElementsRef","warnedElementsRef","itemElementsRef","observedRef","measureElement","dynamicRowHeight","unobserve","scrollToIndex","totalSize","useIsScrolling","delay","isScrolling","setIsScrolling","eventTarget","supportsScrollEnd","animationFrameId","lastScrollTime","checkForScrollEnd","onScrollEnd","getScrollbarSize","div"],"mappings":"sJAEaA,EACX,OAAO,OAAW,IAAcC,EAAAA,gBAAkBC,EAAAA,UCH7C,SAASC,GAAMC,EAAsB,CAC1C,IAAIC,EAAqCD,EACzC,KAAOC,GAAgB,CACrB,GAAIA,EAAe,IACjB,OAAOA,EAAe,MAAQ,MAGhCA,EAAiBA,EAAe,aAClC,CAEA,MAAO,EACT,CCPO,SAASC,GACdF,EACAG,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAASH,IAAQ,KAAK,EAEhD,OAAAP,EAA0B,IAAM,CAC1BO,EACFE,EAASF,IAAQ,KAAK,EACbH,GACTK,EAASN,GAAMC,CAAO,CAAC,CAE3B,EAAG,CAACG,EAAKH,CAAO,CAAC,EAEVI,CACT,CCjBA,SAASG,IAAY,CACnB,MAAO,IAAM,CAAC,CAChB,CAMO,SAASC,IAA0B,CACxC,OAAOC,EAAAA,qBACLF,GACA,IAAM,GACN,IAAM,EAAA,CAEV,CChBO,SAASG,EACdV,EAC4B,CAC5B,OAAOA,GAAS,cAAc,aAAe,MAC/C,CCFO,SAASW,GACdX,EACmC,CACnC,OACEU,EAAeV,CAAO,EAAE,iBACvB,OAAO,eAAmB,IAAc,eAAiB,OAE9D,CCPO,SAASY,GACdR,EACoB,CACpB,GAAIA,IAAU,OACZ,OAAQ,OAAOA,EAAA,CACb,IAAK,SACH,OAAOA,EAET,IAAK,SAAU,CACb,GAAIA,EAAM,SAAS,IAAI,EACrB,OAAO,WAAWA,CAAK,EAEzB,KACF,CAAA,CAGN,CCbO,SAASS,GAAkB,CAChC,IAAAC,EACA,cAAAC,EACA,aAAAC,EACA,SAAUC,EACV,QAAAjB,EACA,KAAAkB,EACA,MAAAC,CACF,EAQG,CACD,KAAM,CAAE,YAAAC,EAAa,WAAAC,CAAA,EAAeC,EAAA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