diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml
index 7d7ea7229..5da3226e2 100644
--- a/.github/workflows/pytest.yaml
+++ b/.github/workflows/pytest.yaml
@@ -242,3 +242,19 @@ jobs:
name: "playright-examples-${{ runner.os }}-${{ matrix.python-version }}-results"
path: test-results/
retention-days: 5
+
+ test-narwhals-integration:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Setup py-shiny
+ id: install
+ uses: ./.github/py-shiny/setup
+ - name: Run test commands
+ env:
+ UV_SYSTEM_PYTHON: 1
+ run: |
+ make narwhals-install-shiny
+ make narwhals-test-integration
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a6132e216..19fb40517 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,7 +17,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### New features
-* Added [narwhals](https://posit-dev.github.io/py-narwhals) support for `@render.data_frame`. This allows for any eager data frame supported by narwhals to be returned from a `@render.data_frame` output method. All internal methods and helper methods leverage the `narwhals` API to be data frame agnostic. (#1570)
+* New features for `@render.data_frame`:
+
+ * Added [narwhals](https://posit-dev.github.io/py-narwhals) support for `@render.data_frame`. This allows for any eager data frame supported by narwhals to be returned from a `@render.data_frame` output method. All internal methods and helper methods now leverage the `narwhals` API to be data frame agnostic. (#1570)
+
+ * Added `.data_patched()` reactive calculation that applies all `.cell_patches()` to `.data()`. (#1719)
+
+ * Added `.update_cell_value()` method to programmatically update the contents of a data frame cell. (#1719)
+
+ * Added `.update_data()` method to update the rendered data without resetting any user sort or filter. Note, all user edits will be forgotten. (#1719)
+
+* Added [narwhals](https://posit-dev.github.io/py-narwhals) support for `@render.table`. This allows for any eager data frame supported by narwhals to be returned from a `@render.table` output method. (#1570)
### Other changes
@@ -41,8 +51,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added `.expect_class()` and `.expect_multiple()` for `Accordion` in `shiny.playwright.controllers` (#1710)
-* Added [narwhals](https://posit-dev.github.io/py-narwhals) support for `@render.table`. This allows for any eager data frame supported by narwhals to be returned from a `@render.table` output method. (#1570)
-
### Bug fixes
* A few fixes for `ui.Chat()`, including:
@@ -66,6 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fixed bug in `@render.data_frame` where `bool` or `object` columns were not being rendered. (#1570)
+* Fixed output controller `OutputDataFrame` in `shiny.playwright.controller` to correctly assert the number of rows in `.expect_nrow()` as the total number of virtual rows, not the number of currently displaying rows. (#1719)
+
## [1.1.0] - 2024-09-03
diff --git a/Makefile b/Makefile
index 819c835e7..3988a088b 100644
--- a/Makefile
+++ b/Makefile
@@ -150,6 +150,7 @@ SUB_FILE:=
PYTEST_BROWSERS:= --browser webkit --browser firefox --browser chromium
PYTEST_DEPLOYS_BROWSERS:= --browser chromium
+
# Full test path to playwright tests
TEST_FILE:=tests/playwright/$(SUB_FILE)
# Default `make` values that shouldn't be directly used; (Use `TEST_FILE` instead!)
@@ -247,3 +248,10 @@ upgrade-html-deps: FORCE ## Upgrade Shiny's HTMLDependencies
exit 1; \
fi
@scripts/htmlDependencies.R
+
+narwhals-install-shiny: FORCE
+ @echo "-------- Install py-shiny ----------"
+ $(MAKE) ci-install-deps
+narwhals-test-integration: FORCE
+ @echo "-------- Running py-shiny tests ----------"
+ $(MAKE) test playwright TEST_FILE="tests/playwright/shiny/components/data_frame" PYTEST_BROWSERS="--browser chromium"
diff --git a/docs/_quartodoc-core.yml b/docs/_quartodoc-core.yml
index d3dbea99e..d31b7f989 100644
--- a/docs/_quartodoc-core.yml
+++ b/docs/_quartodoc-core.yml
@@ -9,6 +9,7 @@ quartodoc:
renderer:
style: _renderer.py
show_signature_annotations: false
+ table_style: description-list
sections:
- title: Page containers
desc: Create a user interface page container.
@@ -357,3 +358,4 @@ quartodoc:
contents:
- name: experimental.ui.card_image
dynamic: false
+
diff --git a/docs/_quartodoc-express.yml b/docs/_quartodoc-express.yml
index dbee0b740..2b1f8e50c 100644
--- a/docs/_quartodoc-express.yml
+++ b/docs/_quartodoc-express.yml
@@ -9,6 +9,7 @@ quartodoc:
renderer:
style: _renderer.py
show_signature_annotations: false
+ table_style: description-list
sections:
- title: Input components
desc: Gather user input.
diff --git a/docs/_renderer.py b/docs/_renderer.py
index 4d7299398..d07e721b7 100644
--- a/docs/_renderer.py
+++ b/docs/_renderer.py
@@ -12,8 +12,6 @@
from griffe import (
Alias,
DocstringAttribute,
- DocstringParameter,
- DocstringSectionParameters,
DocstringSectionText,
Expr,
ExprName,
@@ -22,8 +20,8 @@
)
from plum import dispatch
from quartodoc import MdRenderer
-from quartodoc.pandoc.blocks import DefinitionList
from quartodoc.renderers.base import convert_rst_link_to_md, sanitize
+from quartodoc.renderers.md_renderer import ParamRow
# from quartodoc.ast import preview
@@ -101,12 +99,12 @@ def render_annotation(self, el: str):
# TODO-future; Can be removed once we use quartodoc 0.3.5
# Related: https://github.com/machow/quartodoc/pull/205
@dispatch
- def render(self, el: DocstringAttribute):
- row = [
- sanitize(el.name),
- self.render_annotation(el.annotation),
- sanitize(el.description or "", allow_markdown=True),
- ]
+ def render(self, el: DocstringAttribute) -> ParamRow:
+ row = ParamRow(
+ el.name,
+ el.description or "",
+ annotation=self.render_annotation(el.annotation),
+ )
return row
@dispatch
@@ -170,28 +168,6 @@ def summarize(self, obj: Union[Object, Alias]) -> str:
return ""
- # Consolidate the parameter type info into a single column
- @dispatch
- def render(self, el: DocstringParameter):
- param = f'{el.name}'
- annotation = self.render_annotation(el.annotation)
- if annotation:
- param = f'{param}:{annotation}'
- if el.default:
- param = f'{param} ={el.default}'
-
- # Wrap everything in a code block to allow for links
- param = "" + param + ""
-
- return (param, el.description)
-
- @dispatch
- def render(self, el: DocstringSectionParameters):
- rows = list(map(self.render, el.value))
- # rows is a list of tuples of (, )
-
- return str(DefinitionList(rows))
-
@dispatch
def signature(self, el: Function, source: Optional[Alias] = None):
if el.name == "__call__":
@@ -279,7 +255,7 @@ def read_file(file: str | Path, root_dir: str | Path | None = None) -> FileConte
def check_if_missing_expected_example(el, converted):
- if re.search(r"(^|\n)#{2,6} Examples\n", converted):
+ if re.search(r"(^|\n)#{2,6} Examples", converted):
# Manually added examples are fine
return
diff --git a/js/data-frame/cell-edit-map.tsx b/js/data-frame/cell-edit-map.tsx
index d8e7881ce..e2011ee69 100644
--- a/js/data-frame/cell-edit-map.tsx
+++ b/js/data-frame/cell-edit-map.tsx
@@ -48,6 +48,9 @@ export const useCellEditMap = () => {
cellEditMap,
// setCellEditMap,
setCellEditMapAtLoc,
+ resetCellEditMap: () => {
+ setCellEditMap(new Map());
+ },
} as const;
};
diff --git a/js/data-frame/data-update.tsx b/js/data-frame/data-update.tsx
index 6b498a543..a06b3a1fe 100644
--- a/js/data-frame/data-update.tsx
+++ b/js/data-frame/data-update.tsx
@@ -17,6 +17,62 @@ export type CellPatchPy = {
// prev: unknown;
};
+type SetDataFn = (fn: (draft: unknown[][]) => void) => void;
+
+export function addPatchToData({
+ setData,
+ newPatches,
+ setCellEditMapAtLoc,
+}: {
+ setData: SetDataFn;
+ newPatches: CellPatch[];
+ setCellEditMapAtLoc: SetCellEditMapAtLoc;
+}): void {
+ // Update data
+ setData((draft) => {
+ newPatches.forEach(({ rowIndex, columnIndex, value }) => {
+ draft[rowIndex]![columnIndex] = value;
+ });
+ });
+ // Set the new patches in cell edit map info
+ newPatches.forEach(({ rowIndex, columnIndex, value }) => {
+ setCellEditMapAtLoc(rowIndex, columnIndex, (obj_draft) => {
+ obj_draft.value = value;
+ obj_draft.state = CellStateEnum.EditSuccess;
+ // Remove save_error if it exists
+ obj_draft.errorTitle = undefined;
+ });
+ });
+}
+
+export function cellPatchPyArrToCellPatchArr(
+ patchesPy: CellPatchPy[]
+): CellPatch[] {
+ const patches: CellPatch[] = patchesPy.map(
+ (patch: CellPatchPy): CellPatch => {
+ return {
+ rowIndex: patch.row_index,
+ columnIndex: patch.column_index,
+ value: patch.value,
+ };
+ }
+ );
+ return patches;
+}
+
+export function cellPatchArrToCellPatchPyArr(
+ patches: CellPatch[]
+): CellPatchPy[] {
+ const patchesPy: CellPatchPy[] = patches.map((patch) => {
+ return {
+ row_index: patch.rowIndex,
+ column_index: patch.columnIndex,
+ value: patch.value,
+ };
+ });
+ return patchesPy;
+}
+
export function updateCellsData({
patchInfo,
patches,
@@ -31,20 +87,13 @@ export function updateCellsData({
onSuccess: (values: CellPatch[]) => void;
onError: (err: string) => void;
columns: readonly string[];
- setData: (fn: (draft: unknown[][]) => void) => void;
+ setData: SetDataFn;
setCellEditMapAtLoc: SetCellEditMapAtLoc;
}) {
// // Skip page index reset until after next rerender
// skipAutoResetPageIndex();
- const patchesPy: CellPatchPy[] = patches.map((patch) => {
- return {
- row_index: patch.rowIndex,
- column_index: patch.columnIndex,
- value: patch.value,
- // prev: patch.prev,
- };
- });
+ const patchesPy = cellPatchArrToCellPatchPyArr(patches);
makeRequestPromise({
method: patchInfo.key,
@@ -70,21 +119,7 @@ export function updateCellsData({
}
newPatchesPy = newPatchesPy as CellPatchPy[];
- const newPatches: CellPatch[] = newPatchesPy.map(
- (patch: CellPatchPy): CellPatch => {
- return {
- rowIndex: patch.row_index,
- columnIndex: patch.column_index,
- value: patch.value,
- };
- }
- );
-
- setData((draft) => {
- newPatches.forEach(({ rowIndex, columnIndex, value }) => {
- draft[rowIndex]![columnIndex] = value;
- });
- });
+ const newPatches = cellPatchPyArrToCellPatchArr(newPatchesPy);
// Set the old patches locations back to success state
// This may be overkill, but it guarantees that the incoming patches exit the saving state
@@ -99,15 +134,10 @@ export function updateCellsData({
obj_draft.errorTitle = undefined;
});
});
- // Set the new patches
- newPatches.forEach(({ rowIndex, columnIndex, value }) => {
- setCellEditMapAtLoc(rowIndex, columnIndex, (obj_draft) => {
- obj_draft.value = value;
- obj_draft.state = CellStateEnum.EditSuccess;
- // Remove save_error if it exists
- obj_draft.errorTitle = undefined;
- });
- });
+
+ // Update data and cell edit map with new patches
+ addPatchToData({ setData, newPatches, setCellEditMapAtLoc });
+
onSuccess(newPatches);
})
.catch((err: string) => {
diff --git a/js/data-frame/index.tsx b/js/data-frame/index.tsx
index d15009cc0..31d41a8f5 100644
--- a/js/data-frame/index.tsx
+++ b/js/data-frame/index.tsx
@@ -2,6 +2,8 @@
// TODO-barret-future; Try to group all related code into a file and make index.tsx as small as possible. Try to move all logic into files and keep the main full of `useFOO` functions.
+// TODO-barret-future; Instead of deconstructinng all of the use state objects, keep it as a dictionary and shorten the method names. The docs can live on the _useFoo` function return type. Ex: CellEditMapReturnObject 's setCellEditMapAtLoc should contain JSDoc on it's objects. Then we'd have a `cellEditMap.setAtLoc` method.
+
import {
Column,
ColumnDef,
@@ -28,6 +30,11 @@ import { ErrorsMessageValue } from "rstudio-shiny/srcts/types/src/shiny/shinyapp
import { useImmer } from "use-immer";
import { TableBodyCell } from "./cell";
import { getCellEditMapObj, useCellEditMap } from "./cell-edit-map";
+import {
+ addPatchToData,
+ cellPatchPyArrToCellPatchArr,
+ type CellPatchPy,
+} from "./data-update";
import { findFirstItemInView, getStyle } from "./dom-utils";
import { ColumnFiltersState, Filter, FilterValue, useFilters } from "./filter";
import type { CellSelection, SelectionModesProp } from "./selection";
@@ -106,8 +113,8 @@ const ShinyDataGrid: FC> = ({
bgcolor,
}) => {
const {
- columns,
- typeHints,
+ columns: columnsProp,
+ typeHints: typeHintsProp,
data: tableDataProp,
options: payloadOptions = {
width: undefined,
@@ -129,6 +136,9 @@ const ShinyDataGrid: FC> = ({
const theadRef = useRef(null);
const tbodyRef = useRef(null);
+ const [columns, setColumns] = useImmer(columnsProp);
+ const [typeHints, setTypeHints] = useImmer(typeHintsProp);
+
const _useStyleInfo = useStyleInfoMap({
initStyleInfos: initStyleInfos ?? [],
nrow: tableDataProp.length,
@@ -153,6 +163,10 @@ const ShinyDataGrid: FC> = ({
* Set a cell's state or edit value in the `cellEditMap`
*/
const setCellEditMapAtLoc = _cellEditMap.setCellEditMapAtLoc;
+ /**
+ * Reset the `cellEditMap` to an empty state
+ */
+ const resetCellEditMap = _cellEditMap.resetCellEditMap;
/**
* Determines if the user is allowed to edit cells in the table.
@@ -285,6 +299,59 @@ const ShinyDataGrid: FC> = ({
setColumnFilters,
} = useFilters(withFilters);
+ const updateData = useCallback(
+ ({
+ data,
+ columns,
+ typeHints,
+ }: {
+ data: PandasData["data"];
+ columns: readonly string[];
+ typeHints: readonly TypeHint[] | undefined;
+ }) => {
+ setColumns(columns);
+ setTableData(data);
+ setTypeHints(typeHints);
+ resetCellEditMap();
+
+ // Make map for quick lookup of type hints
+ const newTypeHintMap = new Map();
+ typeHints?.forEach((hint, i) => {
+ newTypeHintMap.set(columns[i]!, hint);
+ });
+ // Filter out sorting and column filters that are no longer valid
+ const newSort = sorting.filter((sort) => newTypeHintMap.has(sort.id));
+ const newColumnFilter = columnFilters.filter((filter) => {
+ const typeHint = newTypeHintMap.get(filter.id);
+ if (!typeHint) return false;
+ // Maintain the filter if it's a numeric filter
+ // Drop if it's a string filter
+ if (typeHint.type === "numeric") {
+ return (
+ filter.value === null ||
+ (Array.isArray(filter.value) &&
+ filter.value.every((v) => v !== null))
+ );
+ }
+ // Maintain string filters
+ return typeof filter.value === "string";
+ });
+
+ setColumnFilters(newColumnFilter);
+ setSorting(newSort);
+ },
+ [
+ columnFilters,
+ resetCellEditMap,
+ setColumnFilters,
+ setColumns,
+ setSorting,
+ setTableData,
+ setTypeHints,
+ sorting,
+ ]
+ );
+
const options: TableOptions = {
data: tableData,
columns: coldefs,
@@ -463,6 +530,66 @@ const ShinyDataGrid: FC> = ({
Shiny.renderDependenciesAsync([...htmlDeps]);
}, [htmlDeps]);
+ useEffect(() => {
+ const handleAddPatches = (
+ event: CustomEvent<{
+ patches: CellPatchPy[];
+ }>
+ ) => {
+ const evtPatches = event.detail.patches;
+ const newPatches = cellPatchPyArrToCellPatchArr(evtPatches);
+
+ // Update data with extra patches
+ addPatchToData({
+ setData: setTableData,
+ newPatches,
+ setCellEditMapAtLoc,
+ });
+ };
+
+ if (!id) return;
+
+ const element = document.getElementById(id);
+ if (!element) return;
+
+ element.addEventListener("addPatches", handleAddPatches as EventListener);
+
+ return () => {
+ element.removeEventListener(
+ "addPatches",
+ handleAddPatches as EventListener
+ );
+ };
+ }, [columns, id, setCellEditMapAtLoc, setSorting, setTableData]);
+
+ useEffect(() => {
+ const handleUpdateData = (
+ event: CustomEvent<{
+ data: PandasData["data"];
+ columns: PandasData["columns"];
+ typeHints: PandasData["typeHints"];
+ }>
+ ) => {
+ const evtData = event.detail;
+
+ updateData(evtData);
+ };
+
+ if (!id) return;
+
+ const element = document.getElementById(id);
+ if (!element) return;
+
+ element.addEventListener("updateData", handleUpdateData as EventListener);
+
+ return () => {
+ element.removeEventListener(
+ "updateData",
+ handleUpdateData as EventListener
+ );
+ };
+ }, [columns, id, resetCellEditMap, setTableData, updateData]);
+
useEffect(() => {
const handleColumnSort = (
event: CustomEvent<{ sort: { col: number; desc: boolean }[] }>
@@ -734,7 +861,7 @@ const ShinyDataGrid: FC> = ({
>
=2.7.4",
- "quartodoc>=0.7.6",
- "griffe>=1.1.1",
+ # "quartodoc>=0.8.0",
+ "quartodoc@git+https://github.com/machow/quartodoc@main",
+ "griffe>=1.3.2",
]
[project.urls]
diff --git a/shiny/playwright/controller/_output.py b/shiny/playwright/controller/_output.py
index 6cedebf83..a65896980 100644
--- a/shiny/playwright/controller/_output.py
+++ b/shiny/playwright/controller/_output.py
@@ -673,8 +673,9 @@ def __init__(self, page: Page, id: str) -> None:
loc_container=f"#{id}.html-fill-item",
loc="> div > div.shiny-data-grid",
)
- self.loc_head = self.loc.locator("> table > thead")
- self.loc_body = self.loc.locator("> table > tbody")
+ self.loc_table = self.loc.locator("> table")
+ self.loc_head = self.loc_table.locator("> thead")
+ self.loc_body = self.loc_table.locator("> tbody")
self.loc_column_filter = self.loc_head.locator(
"> tr.filters > th:not(.table-corner)"
)
@@ -723,8 +724,10 @@ def expect_nrow(self, value: int, *, timeout: Timeout = None):
timeout
The maximum time to wait for the expectation to pass. Defaults to `None`.
"""
- playwright_expect(self.loc_body.locator("> tr")).to_have_count(
- value, timeout=timeout
+ playwright_expect(self.loc_table).to_have_attribute(
+ "aria-rowcount",
+ str(value),
+ timeout=timeout,
)
def expect_selected_num_rows(self, value: int, *, timeout: Timeout = None):
diff --git a/shiny/render/_data_frame.py b/shiny/render/_data_frame.py
index fe9949e16..c8085c32e 100644
--- a/shiny/render/_data_frame.py
+++ b/shiny/render/_data_frame.py
@@ -36,7 +36,9 @@
from ._data_frame_utils._tbl_data import (
apply_frame_patches,
as_data_frame,
+ assert_data_is_not_none,
data_frame_to_native,
+ serialize_frame,
subset_frame,
)
from ._data_frame_utils._types import (
@@ -106,21 +108,48 @@ class data_frame(
be able to edit the cells in the table. After a cell has been edited, the edited
value will be sent to the server for processing. The handling methods are set via
`@.set_patch_fn` or `@.set_patches_fn`
- decorators. By default, both decorators will return a string value.
-
- To access the data viewed by the user, use `.data_view()`. This
- method will sort, filter, and apply any patches to the data frame as viewed by the
- user within the browser. This is a shallow copy of the original data frame. It is
- possible that alterations to `data_view` could alter the original `data` data frame.
-
- To access the original data, use `.data()`. This is a quick
- reference to the original pandas or polars data frame that was returned from the
- app's render function. If it is mutated in place, it **will** modify the original
- data.
-
- Note... if the data frame renderer is re-rendered due to reactivity, then
- the user's edits, sorting, and filtering will be lost. We hope to improve upon this
- in the future.
+ decorators. By default, both decorators will return the corresponding value as a
+ string.
+
+ Data methods
+ ------------
+
+ There are several methods available to inspect and update data frame renderer. It is
+ important to know the side effects of each method to know how they interact with
+ each other.
+
+ * Data frame render method:
+ * When this method is reactively executed, the `.data()` data frame is set to
+ the underlying data frame and all `.cell_patches()` are removed.
+ * When this method is reactively executed, **all user state is reset**. This
+ includes the user's edits, sorting, filtering.
+ * `.data()`:
+ * Reactive calculation that returns the render method's underlying data frame or
+ the data frame supplied to `.update_data(data)`, whichever has been most
+ recently set.
+ * `.cell_patches()`:
+ * Reactive calculation that returns a list of user edits (or updated cell
+ values) that will be applied to `.data()` to create the `.data_patched()` data
+ frame.
+ * `.data_patched()`:
+ * Reactive calculation that returns the `.data()` data frame with all
+ `.cell_patches()` patches applied.
+ * `.data_view(*, selected: bool)`:
+ * Reactive function that returns the `.data_patched()` data frame with the
+ user's sorting and filtering applied. It represents the data frame as viewed
+ by the user within the browser.
+ * If `selected=True`, only the selected rows are returned.
+ * `.update_cell_value(value, row, col)`:
+ * Sets a new entry in `.cell_patches()`.
+ * Calling this method will **not** reset the user's sorting or filtering.
+ * `.update_data(data)`:
+ * Updates the `.data()` data frame with new data.
+ * Calling this method will remove all `.cell_patches()`.
+ * Calling this method will **not** reset the user's sorting or filtering.
+
+ Note: All data methods are shallow copies of each other. If they are mutated in
+ place, it **will modify** the underlying data object and possibly alter other data
+ objects.
Narwhals
-------------------
@@ -145,7 +174,6 @@ class data_frame(
it will not insert any tags, but it will cause the column to be interpreted as
`html` where possible. (tl/dr: Use consistent typing in your columns!)
-
Tip
---
This decorator should be applied **before** the ``@output`` decorator (if that
@@ -164,6 +192,10 @@ class data_frame(
"""
Reactive value of the data frame's rendered object.
"""
+ _updated_data: reactive.Value[IntoDataFrameT]
+ """
+ Reactive value of the data frame's updated data value object.
+ """
def _req_value(self):
"""
@@ -182,23 +214,31 @@ def _req_value(self):
raise RuntimeError("req() failed to raise a silent error.")
return value
- # @reactive_calc_method
+ @reactive_calc_method
def data(self) -> IntoDataFrameT:
"""
- Reactive calculation of the data frame's render method.
+ Reactive calculation of the data frame's data.
- This is a quick reference to the original data frame that was returned from the
- app's render function. If it is mutated in place, it **will** modify the original
- data.
+ This reactive calculation returns the render method's underlying data frame or
+ the data frame supplied to `.update_data(data)`, whichever has been most
+ recently set.
- Even if the rendered data value was not of type `pd.DataFrame` or `pl.DataFrame`, this method currently
- converts it to a `pd.DataFrame`.
+ The returned value is a shallow copy of the original data frame. It is possible
+ that alterations to the `.data()` data frame could alter other associated data
+ frame values. Please be cautious when using this value directly.
Returns
-------
:
- The original data frame returned from the render method.
+ This reactive calculation returns the render method's underlying data frame
+ or the data frame supplied to `.update_data(data)`, whichever has been most
+ recently set.
"""
+ # iff updated data exists, return it
+ # Can be unset on a followup render call
+ if self._updated_data.is_set():
+ return self._updated_data()
+
return self._req_value().data
@reactive_calc_method
@@ -276,7 +316,11 @@ def _nw_data_to_original_type(
@reactive_calc_method
def cell_patches(self) -> list[CellPatch]:
"""
- Reactive calculation of the data frame's edits provided by the user.
+ Reactive calculation of the data frame's edits.
+
+ This reactive calculation that returns a list of user edits (or updated cell
+ values) that will be applied to `.data()` to create the `.data_patched()` data
+ frame.
Returns
-------
@@ -286,7 +330,7 @@ def cell_patches(self) -> list[CellPatch]:
return list(self._cell_patch_map().values())
@reactive_calc_method
- def _data_patched(self) -> DataFrame[IntoDataFrameT]:
+ def _nw_data_patched(self) -> DataFrame[IntoDataFrameT]:
"""
Reactive calculation of the data frame's patched data.
@@ -297,6 +341,25 @@ def _data_patched(self) -> DataFrame[IntoDataFrameT]:
"""
return apply_frame_patches(self._nw_data(), self.cell_patches())
+ @reactive_calc_method
+ def data_patched(self) -> IntoDataFrameT:
+ """
+ Reactive calculation of the data frame's patched data.
+
+ This method returns the `.data()` data frame with all `.cell_patches()` patches
+ applied.
+
+ The returned value is a shallow copy of the original data frame. It is possible
+ that alterations to the `.data_patched()` data frame could alter other
+ associated data frame values. Please be cautious when using this value directly.
+
+ Returns
+ -------
+ :
+ The patched data frame.
+ """
+ return self._nw_data_to_original_type(self._nw_data_patched())
+
# Apply filtering and sorting
# https://github.com/posit-dev/py-shiny/issues/1240
def _subset_data_view(self, selected: bool) -> IntoDataFrameT:
@@ -335,7 +398,7 @@ def _subset_data_view(self, selected: bool) -> IntoDataFrameT:
else:
rows = self.data_view_rows()
- nw_data = subset_frame(self._data_patched(), rows=rows)
+ nw_data = subset_frame(self._nw_data_patched(), rows=rows)
patched_subsetted_into_data = self._nw_data_to_original_type(nw_data)
@@ -370,22 +433,24 @@ def data_view(self, *, selected: bool = False) -> IntoDataFrameT:
"""
Reactive function that retrieves the data how it is viewed within the browser.
- This function will sort, filter, and apply any patches to the data frame as
- viewed by the user within the browser.
+ This function will return the `.data_patched()` data frame with the user's
+ sorting and filtering applied. It represents the data frame as viewed by the
+ user within the browser.
- This is a shallow copy of the original data frame. It is possible that
- alterations to `data_view` could alter the original `data` data frame. Please be
- cautious when using this value directly.
+ The returned value is a shallow copy of the original data frame. It is possible
+ that alterations to the `.data_view()` data frame could alter other associated
+ date frame values. Please be cautious when using this value directly.
Parameters
----------
selected
- If `True`, subset the viewed data to the selected area. Defaults to `False` (all rows).
+ If `True`, subset the viewed data to the selected area. Defaults to `False`
+ (all rows).
Returns
-------
:
- A view of the data frame as seen in the browser.
+ A view of the (possibly selected) data frame as seen in the browser.
See Also
--------
@@ -493,14 +558,34 @@ def filter(self) -> tuple[ColumnFilter, ...]:
def _reset_reactives(self) -> None:
self._value.set(None)
self._cell_patch_map.set({})
+ self._updated_data.unset()
def _init_reactives(self) -> None:
# Init
- self._value: reactive.Value[
- None | DataGrid[IntoDataFrameT] | DataTable[IntoDataFrameT]
- ] = reactive.Value(None)
+ self._value = reactive.Value(None)
self._cell_patch_map = reactive.Value({})
+ self._updated_data = reactive.Value() # Create with no value
+
+ # Update the styles any time the cell patch map or new data updates
+ def should_update_styles():
+ return (
+ self._cell_patch_map(),
+ # If the udpated data is unset, use a `None` value which is not allowed.
+ self._updated_data() if self._updated_data.is_set() else None,
+ )
+
+ @reactive.effect
+ @reactive.event(
+ should_update_styles,
+ # Do not run the first time through!
+ # The styles are being sent with the initial blob.
+ ignore_init=True,
+ )
+ async def _():
+ # Be sure this is called within `isolate()` to isolate any reactivity
+ # It currently is, as `@reactive.event()` is being used
+ await self._attempt_update_cell_style()
def _get_session(self) -> Session:
if self._session is None:
@@ -661,40 +746,15 @@ async def _patches_handler(self, patches: tuple[CellPatch, ...]) -> Jsonifiable:
)
# Add (or overwrite) new cell patches by setting each patch into the cell patch map
- self._set_cell_patch_map_patches(patches)
-
- # With the patches applied, any data retrieved while processing cell style
- # will use the new patch values.
- await self._attempt_update_cell_style()
-
- # Upgrade any HTML-like content to `CellHtml` json objects
- # for sending to the client
- processed_patches: list[CellPatchProcessed] = [
- {
- "row_index": patch["row_index"],
- "column_index": patch["column_index"],
- # Only upgrade the value if it is necessary
- "value": maybe_as_cell_html(
- patch["value"],
- session=self._get_session(),
- ),
- }
- for patch in patches
- ]
-
- # Prep the processed patches as dictionaries for sending to the client
- jsonifiable_patches: list[Jsonifiable] = [
- cell_patch_processed_to_jsonifiable(ret_processed_patch)
- for ret_processed_patch in processed_patches
- ]
+ jsonifiable_processed_patches = self._set_cell_patch_map_patches(patches)
# Return the processed patches to the client
- return jsonifiable_patches
+ return jsonifiable_processed_patches
def _set_cell_patch_map_patches(
self,
patches: ListOrTuple[CellPatch],
- ):
+ ) -> list[Jsonifiable]:
"""
Set the patches within the cell patch map.
@@ -702,6 +762,11 @@ def _set_cell_patch_map_patches(
----------
patches
Set of patches to apply to store in the cell patch map.
+
+ Returns
+ -------
+ :
+ A list of processed (by the session) patches to apply to the data frame.
"""
# Use copy to set the new value
cell_patch_map = self._cell_patch_map().copy()
@@ -712,10 +777,10 @@ def _set_cell_patch_map_patches(
assert isinstance(
row_index, int
- ), f"Expected `row_index` to be an `int`, got {type(row_index)}"
+ ), f"Expected `row_index` to be an `int`, received {type(row_index)}"
assert isinstance(
column_index, int
- ), f"Expected `column_index` to be an `int`, got {type(column_index)}"
+ ), f"Expected `column_index` to be an `int`, received {type(column_index)}"
# TODO-render.data_frame; Possibly check for cell type and compare against type hints
# TODO-render.data_frame; The `value` should be coerced by pandas to the correct type
@@ -726,46 +791,155 @@ def _set_cell_patch_map_patches(
# Once all patches are set, update the cell patch map with new version
self._cell_patch_map.set(cell_patch_map)
+ # Upgrade any HTML-like content to `CellHtml` json objects
+ # for sending to the client
+ session = self._get_session()
+ processed_patches: list[CellPatchProcessed] = [
+ {
+ "row_index": patch["row_index"],
+ "column_index": patch["column_index"],
+ # Only upgrade the value if it is necessary
+ "value": maybe_as_cell_html(
+ patch["value"],
+ session=session,
+ ),
+ }
+ for patch in patches
+ ]
+
+ # Prep the processed patches as dictionaries for sending to the client
+ jsonifiable_patches: list[Jsonifiable] = [
+ cell_patch_processed_to_jsonifiable(ret_processed_patch)
+ for ret_processed_patch in processed_patches
+ ]
+
+ return jsonifiable_patches
+
async def _attempt_update_cell_style(self) -> None:
- with session_context(self._get_session()):
- rendered_value = self._value()
- if not isinstance(rendered_value, (DataGrid, DataTable)):
- return
+ rendered_value = self._value()
+ if not isinstance(rendered_value, (DataGrid, DataTable)):
+ return
- styles_fn = rendered_value.styles
- if not callable(styles_fn):
- return
+ styles_fn = rendered_value.styles
+ if not callable(styles_fn):
+ return
- patched_into_data = self._nw_data_to_original_type(self._data_patched())
- new_styles = as_browser_style_infos(styles_fn, into_data=patched_into_data)
+ patched_into_data = self._nw_data_to_original_type(self._nw_data_patched())
+ new_styles = as_browser_style_infos(styles_fn, into_data=patched_into_data)
- await self._send_message_to_browser(
- "updateStyles",
- {"styles": new_styles},
+ await self._send_message_to_browser(
+ "updateStyles",
+ {"styles": new_styles},
+ )
+
+ async def update_cell_value(
+ self,
+ value: CellValue,
+ *,
+ row: int,
+ col: int | str,
+ ) -> None:
+ """
+ Update the value of a cell in the data frame.
+
+ Calling this method will set a new entry in `.cell_patches()`. It will not reset
+ the user's sorting or filtering of their rendered data frame.
+
+ Parameters
+ ----------
+ value
+ The new value to set the cell to.
+ row
+ The row index of the cell to update.
+ column
+ The column index of the cell to update.
+ """
+ # TODO-barret; Test these assertions
+ # Convert column name to index if necessary
+ if isinstance(col, str):
+ with reactive.isolate():
+ column_names = self._nw_data().columns
+ if col not in column_names:
+ raise ValueError(f"Column '{col}' not found in data frame.")
+ column_index = self._nw_data().columns.index(col)
+ else:
+ column_index = col
+ if (not isinstance(col, int)) or isinstance(col, bool):
+ raise TypeError(
+ f"Expected `col` to be an `int` or `str, received {type(column_index)}"
+ )
+ if column_index < 0:
+ raise ValueError(
+ f"Expected `col` to be greater than or equal to 0, received {column_index}"
+ )
+ column_length = self._nw_data().shape[1]
+ if column_index >= column_length:
+ raise ValueError(
+ f"Expected `col` to be less than {column_length}, received {column_index}"
+ )
+
+ if (not isinstance(row, int)) or isinstance(row, bool):
+ raise TypeError(f"Expected `row` to be an `int`, received {type(row)}")
+ if row < 0:
+ raise ValueError(
+ f"Expected `row` to be greater than or equal to 0, received {row}"
)
- # TODO-barret-render.data_frame; Add `update_cell_value()` method
- # def _update_cell_value(
- # self, value: CellValue, *, row_index: int, column_index: int
- # ) -> CellPatch:
- # """
- # Update the value of a cell in the data frame.
- #
- # Parameters
- # ----------
- # value
- # The new value to set the cell to.
- # row_index
- # The row index of the cell to update.
- # column_index
- # The column index of the cell to update.
- # """
- # cell_patch_processed = self._set_cell_patch_map_patches(
- # {value: value, row_index: row_index, column_index: column_index}
- # )
- # # TODO-barret-render.data_frame; Send message to client to update cell value
- # return cell_patch_processed
+ patch: CellPatch = {
+ "value": value,
+ "row_index": row,
+ "column_index": column_index,
+ }
+ processed_patches = self._set_cell_patch_map_patches([patch])
+
+ # TODO-barret-render.data_frame; Send message to client to update cell value
+ await self._send_message_to_browser(
+ "addPatches",
+ {"patches": processed_patches},
+ )
+
+ return
+
+ async def update_data(
+ self,
+ data: IntoDataFrameT,
+ ) -> None:
+ """
+ Update the data frame with new data.
+
+ Calling this method will update the `.data()` data frame with new data and will
+ remove all `.cell_patches()`. It will not reset the user's sorting or filtering
+ of their rendered data frame. Any incompatible sorting or filtering settings
+ will be silently dropped.
+
+ Parameters
+ ----------
+ data
+ The new data to render.
+ """
+ assert_data_is_not_none(data)
+
+ # Serialize the data within the session context,
+ # similar to `.to_payload()` on the `._value()`
+ with session_context(self._get_session()):
+ info = serialize_frame(data)
+
+ # Reset patches & set new data
+ # Perform only after serializing the frame
+ # (which performs sanity checks. E.g. `data is not None`
+ self._cell_patch_map.set({})
+ self._updated_data.set(data)
+
+ await self._send_message_to_browser(
+ "updateData",
+ {
+ "data": info["data"],
+ "columns": info["columns"],
+ "typeHints": info["typeHints"],
+ },
+ )
+ return
def auto_output_ui(self) -> Tag:
return ui.output_data_frame(id=self.output_id)
diff --git a/shiny/render/_data_frame_utils/_datagridtable.py b/shiny/render/_data_frame_utils/_datagridtable.py
index 04bc9c9da..c8f0267d5 100644
--- a/shiny/render/_data_frame_utils/_datagridtable.py
+++ b/shiny/render/_data_frame_utils/_datagridtable.py
@@ -14,7 +14,7 @@
as_selection_modes,
)
from ._styles import StyleFn, StyleInfo, as_browser_style_infos, as_style_infos
-from ._tbl_data import serialize_frame
+from ._tbl_data import assert_data_is_not_none, serialize_frame
from ._types import FrameJson, IntoDataFrameT
@@ -140,6 +140,7 @@ def __init__(
styles: StyleInfo | list[StyleInfo] | StyleFn[IntoDataFrameT] | None = None,
row_selection_mode: RowSelectionModeDeprecated = "deprecated",
):
+ assert_data_is_not_none(data)
self.data = data
self.width = width
@@ -299,6 +300,8 @@ def __init__(
styles: StyleInfo | list[StyleInfo] | StyleFn[IntoDataFrameT] | None = None,
row_selection_mode: Literal["deprecated"] = "deprecated",
):
+ assert_data_is_not_none(data)
+
self.data = data
self.width = width
diff --git a/shiny/render/_data_frame_utils/_tbl_data.py b/shiny/render/_data_frame_utils/_tbl_data.py
index c6c0ad37d..957331965 100644
--- a/shiny/render/_data_frame_utils/_tbl_data.py
+++ b/shiny/render/_data_frame_utils/_tbl_data.py
@@ -9,6 +9,7 @@
from ...types import Jsonifiable, JsonifiableDict
from ._html import as_cell_html, ui_must_be_processed
from ._types import (
+ CellHtml,
CellPatch,
CellValue,
ColsList,
@@ -59,6 +60,11 @@
# as_frame -----------------------------------------------------------------------------
+def assert_data_is_not_none(data: IntoDataFrame) -> None:
+ if data is None: # pyright: ignore[reportUnnecessaryComparison]
+ raise TypeError("`data` cannot be `None`")
+
+
def data_frame_to_native(data: DataFrame[IntoDataFrameT]) -> IntoDataFrameT:
return nw.to_native(data)
@@ -66,6 +72,8 @@ def data_frame_to_native(data: DataFrame[IntoDataFrameT]) -> IntoDataFrameT:
def as_data_frame(
data: IntoDataFrameT | DataFrame[IntoDataFrameT],
) -> DataFrame[IntoDataFrameT]:
+ assert_data_is_not_none(data)
+
if isinstance(data, DataFrame):
return data # pyright: ignore[reportUnknownVariableType]
try:
@@ -109,17 +117,16 @@ def apply_frame_patches(
nw_data: DataFrame[IntoDataFrameT],
patches: List[CellPatch],
) -> DataFrame[IntoDataFrameT]:
- # data = data.clone()
if len(patches) == 0:
return nw_data
# Apply the patches
- # TODO-future-barret; Might be faster to _always_ store the patches as a
- # `cell_patches_by_column` object. Then iff they need the patches would we
- # deconstruct them into a flattened list. Where as this conversion is being
- # performed on every serialization of the data frame payload
+ # Copy the data to make sure the original data is not modified in place.
+ # If https://github.com/narwhals-dev/narwhals/issues/1154 is resolved, this
+ # should be able to be removed.
+ nw_data = nw_data.clone()
# # https://discord.com/channels/1235257048170762310/1235257049626181656/1283415086722977895
# # Using narwhals >= v1.7.0
@@ -243,7 +250,7 @@ def default_orjson_serializer(val: Any) -> Jsonifiable:
# Maintain expected structure so that the JS will attempt to add all
# dependencies for patched cells in the same manner
processed_ui["deps"] = []
- cell_html_obj = as_cell_html(processed_ui)
+ cell_html_obj: CellHtml = as_cell_html(processed_ui)
return cast(JsonifiableDict, cell_html_obj)
# All other values are serialized as strings
@@ -290,8 +297,7 @@ def subset_frame(
if rows is None:
return data
else:
- # List still required https://github.com/narwhals-dev/narwhals/issues/1122
- return data[list(rows), :]
+ return data[rows, :]
else:
# `cols` is not None
col_names = [data.columns[col] if isinstance(col, int) else col for col in cols]
diff --git a/shiny/www/py-shiny/data-frame/data-frame.js b/shiny/www/py-shiny/data-frame/data-frame.js
index e14c97c0b..1c9d87822 100644
--- a/shiny/www/py-shiny/data-frame/data-frame.js
+++ b/shiny/www/py-shiny/data-frame/data-frame.js
@@ -1,10 +1,10 @@
-var qe,M,kn,qo,be,$n,Hn,xt,Pt,Mt,Ft,An,je={},Nn=[],Wo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ot=Array.isArray;function he(e,n){for(var t in n)e[t]=n[t];return e}function zn(e){var n=e.parentNode;n&&n.removeChild(e)}function J(e,n,t){var r,o,i,s={};for(i in n)i=="key"?r=n[i]:i=="ref"?o=n[i]:s[i]=n[i];if(arguments.length>2&&(s.children=arguments.length>3?qe.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return Ke(e,s,r,o,null)}function Ke(e,n,t,r,o){var i={type:e,props:n,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++kn,__i:-1,__u:0};return o==null&&M.vnode!=null&&M.vnode(i),i}function Vt(){return{current:null}}function le(e){return e.children}function te(e,n){this.props=e,this.context=n}function xe(e,n){if(n==null)return e.__?xe(e.__,e.__i+1):null;for(var t;nn&&be.sort(xt));rt.__r=0}function Bn(e,n,t,r,o,i,s,a,l,u,f){var c,g,d,h,p,_=r&&r.__k||Nn,m=n.length;for(t.__d=l,Xo(t,n,_),l=t.__d,c=0;c0?Ke(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,a=Yo(o,t,s,f),o.__i=a,i=null,a!==-1&&(f--,(i=t[a])&&(i.__u|=131072)),i==null||i.__v===null?(a==-1&&c--,typeof o.type!="function"&&(o.__u|=65536)):a!==s&&(a==s-1?c=a-s:a==s+1?c++:a>s?f>l-s?c+=a-s:c--:a(l!=null&&!(131072&l.__u)?1:0))for(;s>=0||a=0){if((l=n[s])&&!(131072&l.__u)&&o==l.key&&i===l.type)return s;s--}if(a2&&(a.children=arguments.length>3?qe.call(arguments,2):t),Ke(e.type,a,r||e.key,o||e.ref,null)}function Lt(e,n){var t={__c:n="__cC"+An++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,i;return this.getChildContext||(o=[],(i={})[n]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&o.some(function(a){a.__e=!0,It(a)})},this.sub=function(s){o.push(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){o&&o.splice(o.indexOf(s),1),a&&a.call(s)}}),r.children}};return t.Provider.__=t.Consumer.contextType=t}qe=Nn.slice,M={__e:function(e,n,t,r){for(var o,i,s;n=n.__;)if((o=n.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},kn=0,qo=function(e){return e!=null&&e.constructor==null},te.prototype.setState=function(e,n){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=he({},this.state),typeof e=="function"&&(e=e(he({},t),this.props)),e&&he(t,e),e!=null&&this.__v&&(n&&this._sb.push(n),It(this))},te.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),It(this))},te.prototype.render=le,be=[],Hn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xt=function(e,n){return e.__v.__b-n.__v.__b},rt.__r=0,Pt=0,Mt=Ln(!1),Ft=Ln(!0),An=0;var Se,O,kt,qn,$e=0,tr=[],k=M,Wn=k.__b,Xn=k.__r,Yn=k.diffed,Jn=k.__c,Qn=k.unmount,Zn=k.__;function Oe(e,n){k.__h&&k.__h(O,e,$e||n),$e=0;var t=O.__H||(O.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function A(e){return $e=1,Me(nr,e)}function Me(e,n,t){var r=Oe(Se++,2);if(r.t=e,!r.__c&&(r.__=[t?t(n):nr(void 0,n),function(a){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,a);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=O,!O.u)){var o=function(a,l,u){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(g){return!!g.__c});if(f.every(function(g){return!g.__N}))return!i||i.call(this,a,l,u);var c=!1;return f.forEach(function(g){if(g.__N){var d=g.__[0];g.__=g.__N,g.__N=void 0,d!==g.__[0]&&(c=!0)}}),!(!c&&r.__c.props===a)&&(!i||i.call(this,a,l,u))};O.u=!0;var i=O.shouldComponentUpdate,s=O.componentWillUpdate;O.componentWillUpdate=function(a,l,u){if(this.__e){var f=i;i=void 0,o(a,l,u),i=f}s&&s.call(this,a,l,u)},O.shouldComponentUpdate=o}return r.__N||r.__}function L(e,n){var t=Oe(Se++,3);!k.__s&&Bt(t.__H,n)&&(t.__=e,t.i=n,O.__H.__h.push(t))}function ne(e,n){var t=Oe(Se++,4);!k.__s&&Bt(t.__H,n)&&(t.__=e,t.i=n,O.__h.push(t))}function X(e){return $e=5,re(function(){return{current:e}},[])}function At(e,n,t){$e=6,ne(function(){return typeof e=="function"?(e(n()),function(){return e(null)}):e?(e.current=n(),function(){return e.current=null}):void 0},t==null?t:t.concat(e))}function re(e,n){var t=Oe(Se++,7);return Bt(t.__H,n)&&(t.__=e(),t.__H=n,t.__h=e),t.__}function Y(e,n){return $e=8,re(function(){return e},n)}function Nt(e){var n=O.context[e.__c],t=Oe(Se++,9);return t.c=e,n?(t.__==null&&(t.__=!0,n.sub(O)),n.props.value):e.__}function zt(e,n){k.useDebugValue&&k.useDebugValue(n?n(e):e)}function Gt(){var e=Oe(Se++,11);if(!e.__){for(var n=O.__v;n!==null&&!n.__m&&n.__!==null;)n=n.__;var t=n.__m||(n.__m=[0,0]);e.__="P"+t[0]+"-"+t[1]++}return e.__}function Zo(){for(var e;e=tr.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(it),e.__H.__h.forEach(Ht),e.__H.__h=[]}catch(n){e.__H.__h=[],k.__e(n,e.__v)}}k.__b=function(e){O=null,Wn&&Wn(e)},k.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Zn&&Zn(e,n)},k.__r=function(e){Xn&&Xn(e),Se=0;var n=(O=e.__c).__H;n&&(kt===O?(n.__h=[],O.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0})):(n.__h.forEach(it),n.__h.forEach(Ht),n.__h=[],Se=0)),kt=O},k.diffed=function(e){Yn&&Yn(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(tr.push(n)!==1&&qn===k.requestAnimationFrame||((qn=k.requestAnimationFrame)||ei)(Zo)),n.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.i=void 0})),kt=O=null},k.__c=function(e,n){n.some(function(t){try{t.__h.forEach(it),t.__h=t.__h.filter(function(r){return!r.__||Ht(r)})}catch(r){n.some(function(o){o.__h&&(o.__h=[])}),n=[],k.__e(r,t.__v)}}),Jn&&Jn(e,n)},k.unmount=function(e){Qn&&Qn(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{it(r)}catch(o){n=o}}),t.__H=void 0,n&&k.__e(n,t.__v))};var er=typeof requestAnimationFrame=="function";function ei(e){var n,t=function(){clearTimeout(r),er&&cancelAnimationFrame(n),setTimeout(e)},r=setTimeout(t,100);er&&(n=requestAnimationFrame(t))}function it(e){var n=O,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),O=n}function Ht(e){var n=O;e.__c=e.__(),O=n}function Bt(e,n){return!e||e.length!==n.length||n.some(function(t,r){return t!==e[r]})}function nr(e,n){return typeof n=="function"?n(e):n}function cr(e,n){for(var t in n)e[t]=n[t];return e}function Kt(e,n){for(var t in e)if(t!=="__source"&&!(t in n))return!0;for(var r in n)if(r!=="__source"&&e[r]!==n[r])return!0;return!1}function jt(e,n){this.props=e,this.context=n}function ti(e,n){function t(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),n?!n(this.props,o)||!s:Kt(this.props,o)}function r(o){return this.shouldComponentUpdate=t,J(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(jt.prototype=new te).isPureReactComponent=!0,jt.prototype.shouldComponentUpdate=function(e,n){return Kt(this.props,e)||Kt(this.state,n)};var rr=M.__b;M.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),rr&&rr(e)};var ni=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function ri(e){function n(t){var r=cr({},t);return delete r.ref,e(r,t.ref||null)}return n.$$typeof=ni,n.render=n,n.prototype.isReactComponent=n.__f=!0,n.displayName="ForwardRef("+(e.displayName||e.name)+")",n}var or=function(e,n){return e==null?null:fe(fe(e).map(n))},oi={map:or,forEach:or,count:function(e){return e?fe(e).length:0},only:function(e){var n=fe(e);if(n.length!==1)throw"Children.only";return n[0]},toArray:fe},ii=M.__e;M.__e=function(e,n,t,r){if(e.then){for(var o,i=n;i=i.__;)if((o=i.__c)&&o.__c)return n.__e==null&&(n.__e=t.__e,n.__k=t.__k),o.__c(e,n)}ii(e,n,t,r)};var ir=M.unmount;function fr(e,n,t){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=cr({},e)).__c!=null&&(e.__c.__P===t&&(e.__c.__P=n),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return fr(r,n,t)})),e}function gr(e,n,t){return e&&t&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return gr(r,n,t)}),e.__c&&e.__c.__P===n&&(e.__e&&t.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=t)),e}function st(){this.__u=0,this.t=null,this.__b=null}function pr(e){var n=e.__.__c;return n&&n.__a&&n.__a(e)}function si(e){var n,t,r;function o(i){if(n||(n=e()).then(function(s){t=s.default||s},function(s){r=s}),r)throw r;if(!t)throw n;return J(t,i)}return o.displayName="Lazy",o.__f=!0,o}function We(){this.u=null,this.o=null}M.unmount=function(e){var n=e.__c;n&&n.__R&&n.__R(),n&&32&e.__u&&(e.type=null),ir&&ir(e)},(st.prototype=new te).__c=function(e,n){var t=n.__c,r=this;r.t==null&&(r.t=[]),r.t.push(t);var o=pr(r.__v),i=!1,s=function(){i||(i=!0,t.__R=null,o?o(a):a())};t.__R=s;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=gr(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.t.pop();)u.forceUpdate()}};r.__u++||32&n.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},st.prototype.componentWillUnmount=function(){this.t=[]},st.prototype.render=function(e,n){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=fr(this.__b,t,r.__O=r.__P)}this.__b=null}var o=n.__a&&J(le,null,e.fallback);return o&&(o.__u&=-33),[J(le,null,n.__a?null:e.children),o]};var sr=function(e,n,t){if(++t[1]===t[0]&&e.o.delete(n),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(t=e.u;t;){for(;t.length>3;)t.pop()();if(t[1]>>1,1),n.i.removeChild(r)}}),De(J(li,{context:n.context},e.__v),n.l)}function ui(e,n){var t=J(ai,{__v:e,i:n});return t.containerInfo=n,t}(We.prototype=new te).__a=function(e){var n=this,t=pr(n.__v),r=n.o.get(e);return r[0]++,function(o){var i=function(){n.props.revealOrder?(r.push(o),sr(n,e,r)):o()};t?t(i):i()}},We.prototype.render=function(e){this.u=null,this.o=new Map;var n=fe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&n.reverse();for(var t=n.length;t--;)this.o.set(n[t],this.u=[1,0,this.u]);return e.children},We.prototype.componentDidUpdate=We.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(n,t){sr(e,t,n)})};var hr=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,di=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,ci=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,fi=/[A-Z0-9]/g,gi=typeof document<"u",pi=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function qt(e,n,t){return n.__k==null&&(n.textContent=""),De(e,n),typeof t=="function"&&t(),e?e.__c:null}function mr(e,n,t){return Ot(e,n),typeof t=="function"&&t(),e?e.__c:null}te.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(te.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(n){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:n})}})});var lr=M.event;function hi(){}function mi(){return this.cancelBubble}function _i(){return this.defaultPrevented}M.event=function(e){return lr&&(e=lr(e)),e.persist=hi,e.isPropagationStopped=mi,e.isDefaultPrevented=_i,e.nativeEvent=e};var Wt,yi={enumerable:!1,configurable:!0,get:function(){return this.class}},ar=M.vnode;M.vnode=function(e){typeof e.type=="string"&&function(n){var t=n.props,r=n.type,o={};for(var i in t){var s=t[i];if(!(i==="value"&&"defaultValue"in t&&s==null||gi&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var a=i.toLowerCase();i==="defaultValue"&&"value"in t&&t.value==null?i="value":i==="download"&&s===!0?s="":a==="translate"&&s==="no"?s=!1:a==="ondoubleclick"?i="ondblclick":a!=="onchange"||r!=="input"&&r!=="textarea"||pi(t.type)?a==="onfocus"?i="onfocusin":a==="onblur"?i="onfocusout":ci.test(i)?i=a:r.indexOf("-")===-1&&di.test(i)?i=i.replace(fi,"-$&").toLowerCase():s===null&&(s=void 0):a=i="oninput",a==="oninput"&&o[i=a]&&(i="oninputCapture"),o[i]=s}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=fe(t.children).forEach(function(l){l.props.selected=o.value.indexOf(l.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=fe(t.children).forEach(function(l){l.props.selected=o.multiple?o.defaultValue.indexOf(l.props.value)!=-1:o.defaultValue==l.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",yi)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),n.props=o}(e),e.$$typeof=hr,ar&&ar(e)};var ur=M.__r;M.__r=function(e){ur&&ur(e),Wt=e.__c};var dr=M.diffed;M.diffed=function(e){dr&&dr(e);var n=e.props,t=e.__e;t!=null&&e.type==="textarea"&&"value"in n&&n.value!==t.value&&(t.value=n.value==null?"":n.value),Wt=null};var vi={ReactCurrentDispatcher:{current:{readContext:function(e){return Wt.__n[e.__c].props.value},useCallback:Y,useContext:Nt,useDebugValue:zt,useDeferredValue:yr,useEffect:L,useId:Gt,useImperativeHandle:At,useInsertionEffect:Sr,useLayoutEffect:ne,useMemo:re,useReducer:Me,useRef:X,useState:A,useSyncExternalStore:wr,useTransition:vr}}};function Si(e){return J.bind(null,e)}function lt(e){return!!e&&e.$$typeof===hr}function wi(e){return lt(e)&&e.type===le}function Ci(e){return!!e&&!!e.displayName&&(typeof e.displayName=="string"||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function Ei(e){return lt(e)?jn.apply(null,arguments):e}function Xt(e){return!!e.__k&&(De(null,e),!0)}function Ri(e){return e&&(e.base||e.nodeType===1&&e)||null}var bi=function(e,n){return e(n)},Yt=function(e,n){return e(n)},Jt=le;function _r(e){e()}function yr(e){return e}function vr(){return[!1,_r]}var Sr=ne,xi=lt;function wr(e,n){var t=n(),r=A({h:{__:t,v:n}}),o=r[0].h,i=r[1];return ne(function(){o.__=t,o.v=n,Ut(o)&&i({h:o})},[e,t,n]),L(function(){return Ut(o)&&i({h:o}),e(function(){Ut(o)&&i({h:o})})},[e]),t}function Ut(e){var n,t,r=e.v,o=e.__;try{var i=r();return!((n=o)===(t=i)&&(n!==0||1/n==1/t)||n!=n&&t!=t)}catch{return!0}}var b={useState:A,useId:Gt,useReducer:Me,useEffect:L,useLayoutEffect:ne,useInsertionEffect:Sr,useTransition:vr,useDeferredValue:yr,useSyncExternalStore:wr,startTransition:_r,useRef:X,useImperativeHandle:At,useMemo:re,useCallback:Y,useContext:Nt,useDebugValue:zt,version:"17.0.2",Children:oi,render:qt,hydrate:mr,unmountComponentAtNode:Xt,createPortal:ui,createElement:J,createContext:Lt,createFactory:Si,cloneElement:Ei,createRef:Vt,Fragment:le,isValidElement:lt,isElement:xi,isFragment:wi,isMemo:Ci,findDOMNode:Ri,Component:te,PureComponent:jt,memo:ti,forwardRef:ri,flushSync:Yt,unstable_batchedUpdates:bi,StrictMode:Jt,Suspense:st,SuspenseList:We,lazy:si,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:vi};function we(e,n){return typeof e=="function"?e(n):e}function Q(e,n){return t=>{n.setState(r=>({...r,[e]:we(t,r[e])}))}}function ct(e){return e instanceof Function}function Mi(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function Fi(e,n){let t=[],r=o=>{o.forEach(i=>{t.push(i);let s=n(i);s!=null&&s.length&&r(s)})};return r(e),t}function w(e,n,t){let r=[],o;return i=>{let s;t.key&&t.debug&&(s=Date.now());let a=e(i);if(!(a.length!==r.length||a.some((f,c)=>r[c]!==f)))return o;r=a;let u;if(t.key&&t.debug&&(u=Date.now()),o=n(...a),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){let f=Math.round((Date.now()-s)*100)/100,c=Math.round((Date.now()-u)*100)/100,g=c/16,d=(h,p)=>{for(h=String(h);h.length
{var o;return(o=e?.debugAll)!=null?o:e[n]},key:!1,onChange:r}}function Ii(e,n,t,r){let o=()=>{var s;return(s=i.getValue())!=null?s:e.options.renderFallbackValue},i={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(r),renderValue:o,getContext:w(()=>[e,t,n,i],(s,a,l,u)=>({table:s,column:a,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),C(e.options,"debugCells","cell.getContext"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(i,t,n,e)},{}),i}function Ti(e,n,t,r){var o,i;let a={...e._getDefaultColumnDef(),...n},l=a.accessorKey,u=(o=(i=a.id)!=null?i:l?l.replace(".","_"):void 0)!=null?o:typeof a.header=="string"?a.header:void 0,f;if(a.accessorFn?f=a.accessorFn:l&&(l.includes(".")?f=g=>{let d=g;for(let p of l.split(".")){var h;d=(h=d)==null?void 0:h[p]}return d}:f=g=>g[a.accessorKey]),!u)throw new Error;let c={id:`${String(u)}`,accessorFn:f,parent:r,depth:t,columnDef:a,columns:[],getFlatColumns:w(()=>[!0],()=>{var g;return[c,...(g=c.columns)==null?void 0:g.flatMap(d=>d.getFlatColumns())]},C(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:w(()=>[e._getOrderColumnsFn()],g=>{var d;if((d=c.columns)!=null&&d.length){let h=c.columns.flatMap(p=>p.getLeafColumns());return g(h)}return[c]},C(e.options,"debugColumns","column.getLeafColumns"))};for(let g of e._features)g.createColumn==null||g.createColumn(c,e);return c}var j="debugHeaders";function Er(e,n,t){var r;let i={id:(r=t.id)!=null?r:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let s=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),s.push(l)};return a(i),s},getContext:()=>({table:e,header:i,column:n})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(i,e)}),i}var Pi={createTable:e=>{e.getHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r,o)=>{var i,s;let a=(i=r?.map(c=>t.find(g=>g.id===c)).filter(Boolean))!=null?i:[],l=(s=o?.map(c=>t.find(g=>g.id===c)).filter(Boolean))!=null?s:[],u=t.filter(c=>!(r!=null&&r.includes(c.id))&&!(o!=null&&o.includes(c.id)));return at(n,[...a,...u,...l],e)},C(e.options,j,"getHeaderGroups")),e.getCenterHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r,o)=>(t=t.filter(i=>!(r!=null&&r.includes(i.id))&&!(o!=null&&o.includes(i.id))),at(n,t,e,"center")),C(e.options,j,"getCenterHeaderGroups")),e.getLeftHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,r)=>{var o;let i=(o=r?.map(s=>t.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return at(n,i,e,"left")},C(e.options,j,"getLeftHeaderGroups")),e.getRightHeaderGroups=w(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,r)=>{var o;let i=(o=r?.map(s=>t.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return at(n,i,e,"right")},C(e.options,j,"getRightHeaderGroups")),e.getFooterGroups=w(()=>[e.getHeaderGroups()],n=>[...n].reverse(),C(e.options,j,"getFooterGroups")),e.getLeftFooterGroups=w(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),C(e.options,j,"getLeftFooterGroups")),e.getCenterFooterGroups=w(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),C(e.options,j,"getCenterFooterGroups")),e.getRightFooterGroups=w(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),C(e.options,j,"getRightFooterGroups")),e.getFlatHeaders=w(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,j,"getFlatHeaders")),e.getLeftFlatHeaders=w(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,j,"getLeftFlatHeaders")),e.getCenterFlatHeaders=w(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,j,"getCenterFlatHeaders")),e.getRightFlatHeaders=w(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),C(e.options,j,"getRightFlatHeaders")),e.getCenterLeafHeaders=w(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),C(e.options,j,"getCenterLeafHeaders")),e.getLeftLeafHeaders=w(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),C(e.options,j,"getLeftLeafHeaders")),e.getRightLeafHeaders=w(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),C(e.options,j,"getRightLeafHeaders")),e.getLeafHeaders=w(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,r)=>{var o,i,s,a,l,u;return[...(o=(i=n[0])==null?void 0:i.headers)!=null?o:[],...(s=(a=t[0])==null?void 0:a.headers)!=null?s:[],...(l=(u=r[0])==null?void 0:u.headers)!=null?l:[]].map(f=>f.getLeafHeaders()).flat()},C(e.options,j,"getLeafHeaders"))}};function at(e,n,t,r){var o,i;let s=0,a=function(g,d){d===void 0&&(d=1),s=Math.max(s,d),g.filter(h=>h.getIsVisible()).forEach(h=>{var p;(p=h.columns)!=null&&p.length&&a(h.columns,d+1)},0)};a(e);let l=[],u=(g,d)=>{let h={depth:d,id:[r,`${d}`].filter(Boolean).join("_"),headers:[]},p=[];g.forEach(_=>{let m=[...p].reverse()[0],y=_.column.depth===h.depth,R,P=!1;if(y&&_.column.parent?R=_.column.parent:(R=_.column,P=!0),m&&m?.column===R)m.subHeaders.push(_);else{let I=Er(t,R,{id:[r,d,R.id,_?.id].filter(Boolean).join("_"),isPlaceholder:P,placeholderId:P?`${p.filter(D=>D.column===R).length}`:void 0,depth:d,index:p.length});I.subHeaders.push(_),p.push(I)}h.headers.push(_),_.headerGroup=h}),l.push(h),d>0&&u(p,d-1)},f=n.map((g,d)=>Er(t,g,{depth:s,index:d}));u(f,s-1),l.reverse();let c=g=>g.filter(h=>h.column.getIsVisible()).map(h=>{let p=0,_=0,m=[0];h.subHeaders&&h.subHeaders.length?(m=[],c(h.subHeaders).forEach(R=>{let{colSpan:P,rowSpan:I}=R;p+=P,m.push(I)})):p=1;let y=Math.min(...m);return _=_+y,h.colSpan=p,h.rowSpan=_,{colSpan:p,rowSpan:_}});return c((o=(i=l[0])==null?void 0:i.headers)!=null?o:[]),l}var cn=(e,n,t,r,o,i,s)=>{let a={id:n,index:r,original:t,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];let u=e.getColumn(l);if(u!=null&&u.accessorFn)return a._valuesCache[l]=u.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];let u=e.getColumn(l);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=a.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>Fi(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],u=a;for(;;){let f=u.getParentRow();if(!f)break;l.push(f),u=f}return l.reverse()},getAllCells:w(()=>[e.getAllLeafColumns()],l=>l.map(u=>Ii(e,a,u,u.id)),C(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:w(()=>[a.getAllCells()],l=>l.reduce((u,f)=>(u[f.column.id]=f,u),{}),C(e.options,"debugRows","getAllCellsByColumnId"))};for(let l=0;l{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},br=(e,n,t)=>{var r;let o=t.toLowerCase();return!!(!((r=e.getValue(n))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(o))};br.autoRemove=e=>ae(e);var xr=(e,n,t)=>{var r;return!!(!((r=e.getValue(n))==null||(r=r.toString())==null)&&r.includes(t))};xr.autoRemove=e=>ae(e);var Mr=(e,n,t)=>{var r;return((r=e.getValue(n))==null||(r=r.toString())==null?void 0:r.toLowerCase())===t?.toLowerCase()};Mr.autoRemove=e=>ae(e);var Fr=(e,n,t)=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(t)};Fr.autoRemove=e=>ae(e)||!(e!=null&&e.length);var Ir=(e,n,t)=>!t.some(r=>{var o;return!((o=e.getValue(n))!=null&&o.includes(r))});Ir.autoRemove=e=>ae(e)||!(e!=null&&e.length);var Tr=(e,n,t)=>t.some(r=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(r)});Tr.autoRemove=e=>ae(e)||!(e!=null&&e.length);var Pr=(e,n,t)=>e.getValue(n)===t;Pr.autoRemove=e=>ae(e);var Vr=(e,n,t)=>e.getValue(n)==t;Vr.autoRemove=e=>ae(e);var fn=(e,n,t)=>{let[r,o]=t,i=e.getValue(n);return i>=r&&i<=o};fn.resolveFilterValue=e=>{let[n,t]=e,r=typeof n!="number"?parseFloat(n):n,o=typeof t!="number"?parseFloat(t):t,i=n===null||Number.isNaN(r)?-1/0:r,s=t===null||Number.isNaN(o)?1/0:o;if(i>s){let a=i;i=s,s=a}return[i,s]};fn.autoRemove=e=>ae(e)||ae(e[0])&&ae(e[1]);var me={includesString:br,includesStringSensitive:xr,equalsString:Mr,arrIncludes:Fr,arrIncludesAll:Ir,arrIncludesSome:Tr,equals:Pr,weakEquals:Vr,inNumberRange:fn};function ae(e){return e==null||e===""}var Di={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Q("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);return typeof r=="string"?me.includesString:typeof r=="number"?me.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?me.equals:Array.isArray(r)?me.arrIncludes:me.weakEquals},e.getFilterFn=()=>{var t,r;return ct(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(r=n.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?t:me[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,r,o;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((r=n.options.enableColumnFilters)!=null?r:!0)&&((o=n.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(r=>r.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,r;return(t=(r=n.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(r=>{let o=e.getFilterFn(),i=r?.find(f=>f.id===e.id),s=we(t,i?i.value:void 0);if(Rr(o,s,e)){var a;return(a=r?.filter(f=>f.id!==e.id))!=null?a:[]}let l={id:e.id,value:s};if(i){var u;return(u=r?.map(f=>f.id===e.id?l:f))!=null?u:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{let t=e.getAllLeafColumns(),r=o=>{var i;return(i=we(n,o))==null?void 0:i.filter(s=>{let a=t.find(l=>l.id===s.id);if(a){let l=a.getFilterFn();if(Rr(l,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=n=>{var t,r;e.setColumnFilters(n?[]:(t=(r=e.initialState)==null?void 0:r.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Rr(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}var $i=(e,n,t)=>t.reduce((r,o)=>{let i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),Oi=(e,n,t)=>{let r;return t.forEach(o=>{let i=o.getValue(e);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},Li=(e,n,t)=>{let r;return t.forEach(o=>{let i=o.getValue(e);i!=null&&(r=i)&&(r=i)}),r},ki=(e,n,t)=>{let r,o;return t.forEach(i=>{let s=i.getValue(e);s!=null&&(r===void 0?s>=s&&(r=o=s):(r>s&&(r=s),o{let t=0,r=0;if(n.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++t,r+=i)}),t)return r/t},Ai=(e,n)=>{if(!n.length)return;let t=n.map(i=>i.getValue(e));if(!Mi(t))return;if(t.length===1)return t[0];let r=Math.floor(t.length/2),o=t.sort((i,s)=>i-s);return t.length%2!==0?o[r]:(o[r-1]+o[r])/2},Ni=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),zi=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,Gi=(e,n)=>n.length,Qt={sum:$i,min:Oi,max:Li,extent:ki,mean:Hi,median:Ai,unique:Ni,uniqueCount:zi,count:Gi},Bi={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Q("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(r=>r!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,r;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((r=n.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);if(typeof r=="number")return Qt.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Qt.extent},e.getAggregationFn=()=>{var t,r;if(!e)throw new Error;return ct(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(r=n.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?t:Qt[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,r;e.setGrouping(n?[]:(t=(r=e.initialState)==null?void 0:r.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];let r=n.getColumn(t);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[t]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,r)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}}};function Ui(e,n,t){if(!(n!=null&&n.length)||!t)return e;let r=e.filter(i=>!n.includes(i.id));return t==="remove"?r:[...n.map(i=>e.find(s=>s.id===i)).filter(Boolean),...r]}var Ki={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Q("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=w(t=>[Ye(n,t)],t=>t.findIndex(r=>r.id===e.id),C(n.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var r;return((r=Ye(n,t)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=t=>{var r;let o=Ye(n,t);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=w(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,r)=>o=>{let i=[];if(!(n!=null&&n.length))i=o;else{let s=[...n],a=[...o];for(;a.length&&s.length;){let l=s.shift(),u=a.findIndex(f=>f.id===l);u>-1&&i.push(a.splice(u,1)[0])}i=[...i,...a]}return Ui(i,t,r)},C(e.options,"debugTable","_getOrderColumnsFn"))}},Zt=()=>({left:[],right:[]}),ji={getInitialState:e=>({columnPinning:Zt(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Q("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{let r=e.getLeafColumns().map(o=>o.id).filter(Boolean);n.setColumnPinning(o=>{var i,s;if(t==="right"){var a,l;return{left:((a=o?.left)!=null?a:[]).filter(c=>!(r!=null&&r.includes(c))),right:[...((l=o?.right)!=null?l:[]).filter(c=>!(r!=null&&r.includes(c))),...r]}}if(t==="left"){var u,f;return{left:[...((u=o?.left)!=null?u:[]).filter(c=>!(r!=null&&r.includes(c))),...r],right:((f=o?.right)!=null?f:[]).filter(c=>!(r!=null&&r.includes(c)))}}return{left:((i=o?.left)!=null?i:[]).filter(c=>!(r!=null&&r.includes(c))),right:((s=o?.right)!=null?s:[]).filter(c=>!(r!=null&&r.includes(c)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,i,s;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=(s=n.options.enableColumnPinning)!=null?s:n.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{let t=e.getLeafColumns().map(a=>a.id),{left:r,right:o}=n.getState().columnPinning,i=t.some(a=>r?.includes(a)),s=t.some(a=>o?.includes(a));return i?"left":s?"right":!1},e.getPinnedIndex=()=>{var t,r;let o=e.getIsPinned();return o?(t=(r=n.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=w(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,r,o)=>{let i=[...r??[],...o??[]];return t.filter(s=>!i.includes(s.column.id))},C(n.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=w(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,r)=>(r??[]).map(i=>t.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),C(n.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=w(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,r)=>(r??[]).map(i=>t.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),C(n.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,r;return e.setColumnPinning(n?Zt():(t=(r=e.initialState)==null?void 0:r.columnPinning)!=null?t:Zt())},e.getIsSomeColumnsPinned=n=>{var t;let r=e.getState().columnPinning;if(!n){var o,i;return!!((o=r.left)!=null&&o.length||(i=r.right)!=null&&i.length)}return!!((t=r[n])!=null&&t.length)},e.getLeftLeafColumns=w(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),C(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=w(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),C(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=w(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r)=>{let o=[...t??[],...r??[]];return n.filter(i=>!o.includes(i.id))},C(e.options,"debugColumns","getCenterLeafColumns"))}},ut={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},en=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),qi={getDefaultColumnDef:()=>ut,getInitialState:e=>({columnSizing:{},columnSizingInfo:en(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Q("columnSizing",e),onColumnSizingInfoChange:Q("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,r,o;let i=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:ut.minSize,(r=i??e.columnDef.size)!=null?r:ut.size),(o=e.columnDef.maxSize)!=null?o:ut.maxSize)},e.getStart=w(t=>[t,Ye(n,t),n.getState().columnSizing],(t,r)=>r.slice(0,e.getIndex(t)).reduce((o,i)=>o+i.getSize(),0),C(n.options,"debugColumns","getStart")),e.getAfter=w(t=>[t,Ye(n,t),n.getState().columnSizing],(t,r)=>r.slice(e.getIndex(t)+1).reduce((o,i)=>o+i.getSize(),0),C(n.options,"debugColumns","getAfter")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:r,...o}=t;return o})},e.getCanResize=()=>{var t,r;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((r=n.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0,r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var i;t+=(i=o.column.getSize())!=null?i:0}};return r(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{let r=n.getColumn(e.column.id),o=r?.getCanResize();return i=>{if(!r||!o||(i.persist==null||i.persist(),tn(i)&&i.touches&&i.touches.length>1))return;let s=e.getSize(),a=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[r.id,r.getSize()]],l=tn(i)?Math.round(i.touches[0].clientX):i.clientX,u={},f=(m,y)=>{typeof y=="number"&&(n.setColumnSizingInfo(R=>{var P,I;let D=n.options.columnResizeDirection==="rtl"?-1:1,K=(y-((P=R?.startOffset)!=null?P:0))*D,B=Math.max(K/((I=R?.startSize)!=null?I:0),-.999999);return R.columnSizingStart.forEach(q=>{let[z,de]=q;u[z]=Math.round(Math.max(de+de*B,0)*100)/100}),{...R,deltaOffset:K,deltaPercentage:B}}),(n.options.columnResizeMode==="onChange"||m==="end")&&n.setColumnSizing(R=>({...R,...u})))},c=m=>f("move",m),g=m=>{f("end",m),n.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},d=t||typeof document<"u"?document:null,h={moveHandler:m=>c(m.clientX),upHandler:m=>{d?.removeEventListener("mousemove",h.moveHandler),d?.removeEventListener("mouseup",h.upHandler),g(m.clientX)}},p={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),c(m.touches[0].clientX),!1),upHandler:m=>{var y;d?.removeEventListener("touchmove",p.moveHandler),d?.removeEventListener("touchend",p.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),g((y=m.touches[0])==null?void 0:y.clientX)}},_=Wi()?{passive:!1}:!1;tn(i)?(d?.addEventListener("touchmove",p.moveHandler,_),d?.addEventListener("touchend",p.upHandler,_)):(d?.addEventListener("mousemove",h.moveHandler,_),d?.addEventListener("mouseup",h.upHandler,_)),n.setColumnSizingInfo(m=>({...m,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?en():(t=e.initialState.columnSizingInfo)!=null?t:en())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0}}},dt=null;function Wi(){if(typeof dt=="boolean")return dt;let e=!1;try{let n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return dt=e,dt}function tn(e){return e.type==="touchstart"}var Xi={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Q("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(r=>({...r,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,r;let o=e.columns;return(t=o.length?o.some(i=>i.getIsVisible()):(r=n.getState().columnVisibility)==null?void 0:r[e.id])!=null?t:!0},e.getCanHide=()=>{var t,r;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((r=n.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=w(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(r=>r.column.getIsVisible()),C(n.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=w(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,r,o)=>[...t,...r,...o],C(n.options,"debugRows","getVisibleCells"))},createTable:e=>{let n=(t,r)=>w(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),C(e.options,"debugColumns",t));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var r;e.setColumnVisibility(t?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=t=>{var r;t=(r=t)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var r;e.toggleAllColumnsVisible((r=t.target)==null?void 0:r.checked)}}};function Ye(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var Yi={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Ji={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Q("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;let r=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,r,o,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((r=n.options.enableGlobalFilter)!=null?r:!0)&&((o=n.options.enableFilters)!=null?o:!0)&&((i=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>me.includesString,e.getGlobalFilterFn=()=>{var n,t;let{globalFilterFn:r}=e.options;return ct(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[r])!=null?n:me[r]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},Qi={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Q("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var r,o;if(!n){e._queue(()=>{n=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{let r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{let s=i.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(r=>{var o;let i=r===!0?!0:!!(r!=null&&r[e.id]),s={};if(r===!0?Object.keys(n.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,t=(o=t)!=null?o:!i,!i&&t)return{...s,[e.id]:!0};if(i&&!t){let{[e.id]:a,...l}=s;return l}return r})},e.getIsExpanded=()=>{var t;let r=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:r===!0||r?.[e.id])},e.getCanExpand=()=>{var t,r,o;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((r=n.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let t=!0,r=e;for(;t&&r.parentId;)r=n.getRow(r.parentId,!0),t=r.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},sn=0,ln=10,nn=()=>({pageIndex:sn,pageSize:ln}),Zi={getInitialState:e=>({...e,pagination:{...nn(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Q("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var r,o;if(!n){e._queue(()=>{n=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=r=>{let o=i=>we(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?nn():(o=e.initialState.pagination)!=null?o:nn())},e.setPageIndex=r=>{e.setPagination(o=>{let i=we(r,o.pageIndex),s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,s)),{...o,pageIndex:i}})},e.resetPageIndex=r=>{var o,i;e.setPageIndex(r?sn:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:sn)},e.resetPageSize=r=>{var o,i;e.setPageSize(r?ln:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:ln)},e.setPageSize=r=>{e.setPagination(o=>{let i=Math.max(1,we(r,o.pageSize)),s=o.pageSize*o.pageIndex,a=Math.floor(s/i);return{...o,pageIndex:a,pageSize:i}})},e.setPageCount=r=>e.setPagination(o=>{var i;let s=we(r,(i=e.options.pageCount)!=null?i:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),e.getPageOptions=w(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,s)=>s)),o},C(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},rn=()=>({top:[],bottom:[]}),es={getInitialState:e=>({rowPinning:rn(),...e}),getDefaultOptions:e=>({onRowPinningChange:Q("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,r,o)=>{let i=r?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],s=o?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],a=new Set([...s,e.id,...i]);n.setRowPinning(l=>{var u,f;if(t==="bottom"){var c,g;return{top:((c=l?.top)!=null?c:[]).filter(p=>!(a!=null&&a.has(p))),bottom:[...((g=l?.bottom)!=null?g:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)]}}if(t==="top"){var d,h;return{top:[...((d=l?.top)!=null?d:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)],bottom:((h=l?.bottom)!=null?h:[]).filter(p=>!(a!=null&&a.has(p)))}}return{top:((u=l?.top)!=null?u:[]).filter(p=>!(a!=null&&a.has(p))),bottom:((f=l?.bottom)!=null?f:[]).filter(p=>!(a!=null&&a.has(p)))}})},e.getCanPin=()=>{var t;let{enableRowPinning:r,enablePinning:o}=n.options;return typeof r=="function"?r(e):(t=r??o)!=null?t:!0},e.getIsPinned=()=>{let t=[e.id],{top:r,bottom:o}=n.getState().rowPinning,i=t.some(a=>r?.includes(a)),s=t.some(a=>o?.includes(a));return i?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var t,r;let o=e.getIsPinned();if(!o)return-1;let i=(t=o==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t.map(s=>{let{id:a}=s;return a});return(r=i?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,r;return e.setRowPinning(n?rn():(t=(r=e.initialState)==null?void 0:r.rowPinning)!=null?t:rn())},e.getIsSomeRowsPinned=n=>{var t;let r=e.getState().rowPinning;if(!n){var o,i;return!!((o=r.top)!=null&&o.length||(i=r.bottom)!=null&&i.length)}return!!((t=r[n])!=null&&t.length)},e._getPinnedRows=(n,t,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(t??[]).map(s=>{let a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(t??[]).map(s=>n.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=w(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),C(e.options,"debugRows","getTopRows")),e.getBottomRows=w(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),C(e.options,"debugRows","getBottomRows")),e.getCenterRows=w(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,r)=>{let o=new Set([...t??[],...r??[]]);return n.filter(i=>!o.has(i.id))},C(e.options,"debugRows","getCenterRows"))}},ts={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Q("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();let r={...t},o=e.getPreGroupedRowModel().flatRows;return n?o.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):o.forEach(i=>{delete r[i.id]}),r})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{let r=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{an(o,i.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=w(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?on(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=w(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?on(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=w(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?on(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState(),r=!!(n.length&&Object.keys(t).length);return r&&n.some(o=>o.getCanSelect()&&!t[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let n=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:t}=e.getState(),r=!!n.length;return r&&n.some(o=>!t[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var n;let t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t{let n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,r)=>{let o=e.getIsSelected();n.setRowSelection(i=>{var s;if(t=typeof t<"u"?t:!o,e.getCanSelect()&&o===t)return i;let a={...i};return an(a,e.id,t,(s=r?.selectChildren)!=null?s:!0,n),a})},e.getIsSelected=()=>{let{rowSelection:t}=n.getState();return gn(e,t)},e.getIsSomeSelected=()=>{let{rowSelection:t}=n.getState();return un(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:t}=n.getState();return un(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return r=>{var o;t&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},an=(e,n,t,r,o)=>{var i;let s=o.getRow(n,!0);t?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[n]=!0)):delete e[n],r&&(i=s.subRows)!=null&&i.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>an(e,a.id,t,r,o))};function on(e,n){let t=e.getState().rowSelection,r=[],o={},i=function(s,a){return s.map(l=>{var u;let f=gn(l,t);if(f&&(r.push(l),o[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:i(l.subRows)}),f)return l}).filter(Boolean)};return{rows:i(n.rows),flatRows:r,rowsById:o}}function gn(e,n){var t;return(t=n[e.id])!=null?t:!1}function un(e,n,t){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,i=!1;return e.subRows.forEach(s=>{if(!(i&&!o)&&(s.getCanSelect()&&(gn(s,n)?i=!0:o=!1),s.subRows&&s.subRows.length)){let a=un(s,n);a==="all"?i=!0:(a==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}var dn=/([0-9]+)/gm,ns=(e,n,t)=>Dr(Ce(e.getValue(t)).toLowerCase(),Ce(n.getValue(t)).toLowerCase()),rs=(e,n,t)=>Dr(Ce(e.getValue(t)),Ce(n.getValue(t))),os=(e,n,t)=>pn(Ce(e.getValue(t)).toLowerCase(),Ce(n.getValue(t)).toLowerCase()),is=(e,n,t)=>pn(Ce(e.getValue(t)),Ce(n.getValue(t))),ss=(e,n,t)=>{let r=e.getValue(t),o=n.getValue(t);return r>o?1:rpn(e.getValue(t),n.getValue(t));function pn(e,n){return e===n?0:e>n?1:-1}function Ce(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Dr(e,n){let t=e.split(dn).filter(Boolean),r=n.split(dn).filter(Boolean);for(;t.length&&r.length;){let o=t.shift(),i=r.shift(),s=parseInt(o,10),a=parseInt(i,10),l=[s,a].sort();if(isNaN(l[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return t.length-r.length}var Xe={alphanumeric:ns,alphanumericCaseSensitive:rs,text:os,textCaseSensitive:is,datetime:ss,basic:ls},as={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Q("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{let t=n.getFilteredRowModel().flatRows.slice(10),r=!1;for(let o of t){let i=o?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return Xe.datetime;if(typeof i=="string"&&(r=!0,i.split(dn).length>1))return Xe.alphanumeric}return r?Xe.text:Xe.basic},e.getAutoSortDir=()=>{let t=n.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,r;if(!e)throw new Error;return ct(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(r=n.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?t:Xe[e.columnDef.sortingFn]},e.toggleSorting=(t,r)=>{let o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;n.setSorting(s=>{let a=s?.find(d=>d.id===e.id),l=s?.findIndex(d=>d.id===e.id),u=[],f,c=i?t:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?f="toggle":f="add":s!=null&&s.length&&l!==s.length-1?f="replace":a?f="toggle":f="replace",f==="toggle"&&(i||o||(f="remove")),f==="add"){var g;u=[...s,{id:e.id,desc:c}],u.splice(0,u.length-((g=n.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else f==="toggle"?u=s.map(d=>d.id===e.id?{...d,desc:c}:d):f==="remove"?u=s.filter(d=>d.id!==e.id):u=[{id:e.id,desc:c}];return u})},e.getFirstSortDir=()=>{var t,r;return((t=(r=e.columnDef.sortDescFirst)!=null?r:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var r,o;let i=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==i&&((r=n.options.enableSortingRemoval)==null||r)&&(!(t&&(o=n.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,r;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((r=n.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,r;return(t=(r=e.columnDef.enableMultiSort)!=null?r:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;let r=(t=n.getState().sorting)==null?void 0:t.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,r;return(t=(r=n.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{let t=e.getCanSort();return r=>{t&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,r;e.setSorting(n?[]:(t=(r=e.initialState)==null?void 0:r.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},us=[Pi,Xi,Ki,ji,Vi,Di,Yi,Ji,as,Bi,Qi,Zi,es,ts,qi];function $r(e){var n,t;let r=[...us,...(n=e._features)!=null?n:[]],o={_features:r},i=o._features.reduce((g,d)=>Object.assign(g,d.getDefaultOptions==null?void 0:d.getDefaultOptions(o)),{}),s=g=>o.options.mergeOptions?o.options.mergeOptions(i,g):{...i,...g},l={...{},...(t=e.initialState)!=null?t:{}};o._features.forEach(g=>{var d;l=(d=g.getInitialState==null?void 0:g.getInitialState(l))!=null?d:l});let u=[],f=!1,c={_features:r,options:{...i,...e},initialState:l,_queue:g=>{u.push(g),f||(f=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();f=!1}).catch(d=>setTimeout(()=>{throw d})))},reset:()=>{o.setState(o.initialState)},setOptions:g=>{let d=we(g,o.options);o.options=s(d)},getState:()=>o.options.state,setState:g=>{o.options.onStateChange==null||o.options.onStateChange(g)},_getRowId:(g,d,h)=>{var p;return(p=o.options.getRowId==null?void 0:o.options.getRowId(g,d,h))!=null?p:`${h?[h.id,d].join("."):d}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(g,d)=>{let h=(d?o.getPrePaginationRowModel():o.getRowModel()).rowsById[g];if(!h&&(h=o.getCoreRowModel().rowsById[g],!h))throw new Error;return h},_getDefaultColumnDef:w(()=>[o.options.defaultColumn],g=>{var d;return g=(d=g)!=null?d:{},{header:h=>{let p=h.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:h=>{var p,_;return(p=(_=h.renderValue())==null||_.toString==null?void 0:_.toString())!=null?p:null},...o._features.reduce((h,p)=>Object.assign(h,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...g}},C(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>o.options.columns,getAllColumns:w(()=>[o._getColumnDefs()],g=>{let d=function(h,p,_){return _===void 0&&(_=0),h.map(m=>{let y=Ti(o,m,_,p),R=m;return y.columns=R.columns?d(R.columns,y,_+1):[],y})};return d(g)},C(e,"debugColumns","getAllColumns")),getAllFlatColumns:w(()=>[o.getAllColumns()],g=>g.flatMap(d=>d.getFlatColumns()),C(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:w(()=>[o.getAllFlatColumns()],g=>g.reduce((d,h)=>(d[h.id]=h,d),{}),C(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:w(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(g,d)=>{let h=g.flatMap(p=>p.getLeafColumns());return d(h)},C(e,"debugColumns","getAllLeafColumns")),getColumn:g=>o._getAllFlatColumnsById()[g]};Object.assign(o,c);for(let g=0;gw(()=>[e.options.data],n=>{let t={rows:[],flatRows:[],rowsById:{}},r=function(o,i,s){i===void 0&&(i=0);let a=[];for(let u=0;ue._autoResetPageIndex()))}function Lr(){return(e,n)=>w(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{var r;if(!t)return;let o=(r=t.flatRows[0])==null?void 0:r.getUniqueValues(n);if(typeof o>"u")return;let i=[o,o];for(let s=0;si[1]&&(i[1]=u)}}return i},C(e.options,"debugTable","getFacetedMinMaxValues"))}function kr(e,n,t){return t.options.filterFromLeafRows?ds(e,n,t):cs(e,n,t)}function ds(e,n,t){var r;let o=[],i={},s=(r=t.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,u){u===void 0&&(u=0);let f=[];for(let g=0;gw(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,r,o)=>{if(!t.rows.length||!(r!=null&&r.length)&&!o)return t;let i=[...r.map(a=>a.id).filter(a=>a!==n),o?"__global__":void 0].filter(Boolean),s=a=>{for(let l=0;lw(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let r=new Map;for(let i=0;iw(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(n,t,r)=>{if(!n.rows.length||!(t!=null&&t.length)&&!r){for(let g=0;g{var d;let h=e.getColumn(g.id);if(!h)return;let p=h.getFilterFn();p&&o.push({id:g.id,filterFn:p,resolvedValue:(d=p.resolveFilterValue==null?void 0:p.resolveFilterValue(g.value))!=null?d:g.value})});let s=(t??[]).map(g=>g.id),a=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());r&&a&&l.length&&(s.push("__global__"),l.forEach(g=>{var d;i.push({id:g.id,filterFn:a,resolvedValue:(d=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?d:r})}));let u,f;for(let g=0;g{d.columnFiltersMeta[p]=_})}if(i.length){for(let h=0;h{d.columnFiltersMeta[p]=_})){d.columnFilters.__global__=!0;break}}d.columnFilters.__global__!==!0&&(d.columnFilters.__global__=!1)}}let c=g=>{for(let d=0;de._autoResetPageIndex()))}function zr(){return e=>w(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;let r=e.getState().sorting,o=[],i=r.filter(l=>{var u;return(u=e.getColumn(l.id))==null?void 0:u.getCanSort()}),s={};i.forEach(l=>{let u=e.getColumn(l.id);u&&(s[l.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});let a=l=>{let u=l.map(f=>({...f}));return u.sort((f,c)=>{for(let d=0;d{var c;o.push(f),(c=f.subRows)!=null&&c.length&&(f.subRows=a(f.subRows))}),u};return{rows:a(t.rows),flatRows:o,rowsById:t.rowsById}},C(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function ft(e,n){return e?fs(e)?J(e,n):e:null}function fs(e){return gs(e)||typeof e=="function"||ps(e)}function gs(e){return typeof e=="function"&&(()=>{let n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function ps(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Gr(e){let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=A(()=>({current:$r(n)})),[r,o]=A(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:s=>{o(s),e.onStateChange==null||e.onStateChange(s)}})),t.current}function Le(e,n,t){let r=t.initialDeps??[],o;return()=>{var i,s,a,l;let u;t.key&&((i=t.debug)!=null&&i.call(t))&&(u=Date.now());let f=e();if(!(f.length!==r.length||f.some((d,h)=>r[h]!==d)))return o;r=f;let g;if(t.key&&((s=t.debug)!=null&&s.call(t))&&(g=Date.now()),o=n(...f),t.key&&((a=t.debug)!=null&&a.call(t))){let d=Math.round((Date.now()-u)*100)/100,h=Math.round((Date.now()-g)*100)/100,p=h/16,_=(m,y)=>{for(m=String(m);m.length{var o;return(o=e?.debugAll)!=null?o:e[n]},key:!1,onChange:r}}function ki(e,n,t,r){let o=()=>{var s;return(s=i.getValue())!=null?s:e.options.renderFallbackValue},i={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(r),renderValue:o,getContext:C(()=>[e,t,n,i],(s,a,l,u)=>({table:s,column:a,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),E(e.options,"debugCells","cell.getContext"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(i,t,n,e)},{}),i}function Hi(e,n,t,r){var o,i;let a={...e._getDefaultColumnDef(),...n},l=a.accessorKey,u=(o=(i=a.id)!=null?i:l?l.replace(".","_"):void 0)!=null?o:typeof a.header=="string"?a.header:void 0,f;if(a.accessorFn?f=a.accessorFn:l&&(l.includes(".")?f=g=>{let d=g;for(let p of l.split(".")){var h;d=(h=d)==null?void 0:h[p]}return d}:f=g=>g[a.accessorKey]),!u)throw new Error;let c={id:`${String(u)}`,accessorFn:f,parent:r,depth:t,columnDef:a,columns:[],getFlatColumns:C(()=>[!0],()=>{var g;return[c,...(g=c.columns)==null?void 0:g.flatMap(d=>d.getFlatColumns())]},E(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:C(()=>[e._getOrderColumnsFn()],g=>{var d;if((d=c.columns)!=null&&d.length){let h=c.columns.flatMap(p=>p.getLeafColumns());return g(h)}return[c]},E(e.options,"debugColumns","column.getLeafColumns"))};for(let g of e._features)g.createColumn==null||g.createColumn(c,e);return c}var Y="debugHeaders";function Pr(e,n,t){var r;let i={id:(r=t.id)!=null?r:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let s=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),s.push(l)};return a(i),s},getContext:()=>({table:e,header:i,column:n})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(i,e)}),i}var Ai={createTable:e=>{e.getHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r,o)=>{var i,s;let a=(i=r?.map(c=>t.find(g=>g.id===c)).filter(Boolean))!=null?i:[],l=(s=o?.map(c=>t.find(g=>g.id===c)).filter(Boolean))!=null?s:[],u=t.filter(c=>!(r!=null&&r.includes(c.id))&&!(o!=null&&o.includes(c.id)));return gt(n,[...a,...u,...l],e)},E(e.options,Y,"getHeaderGroups")),e.getCenterHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r,o)=>(t=t.filter(i=>!(r!=null&&r.includes(i.id))&&!(o!=null&&o.includes(i.id))),gt(n,t,e,"center")),E(e.options,Y,"getCenterHeaderGroups")),e.getLeftHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,r)=>{var o;let i=(o=r?.map(s=>t.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return gt(n,i,e,"left")},E(e.options,Y,"getLeftHeaderGroups")),e.getRightHeaderGroups=C(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,r)=>{var o;let i=(o=r?.map(s=>t.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return gt(n,i,e,"right")},E(e.options,Y,"getRightHeaderGroups")),e.getFooterGroups=C(()=>[e.getHeaderGroups()],n=>[...n].reverse(),E(e.options,Y,"getFooterGroups")),e.getLeftFooterGroups=C(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),E(e.options,Y,"getLeftFooterGroups")),e.getCenterFooterGroups=C(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),E(e.options,Y,"getCenterFooterGroups")),e.getRightFooterGroups=C(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),E(e.options,Y,"getRightFooterGroups")),e.getFlatHeaders=C(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),E(e.options,Y,"getFlatHeaders")),e.getLeftFlatHeaders=C(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),E(e.options,Y,"getLeftFlatHeaders")),e.getCenterFlatHeaders=C(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),E(e.options,Y,"getCenterFlatHeaders")),e.getRightFlatHeaders=C(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),E(e.options,Y,"getRightFlatHeaders")),e.getCenterLeafHeaders=C(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),E(e.options,Y,"getCenterLeafHeaders")),e.getLeftLeafHeaders=C(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),E(e.options,Y,"getLeftLeafHeaders")),e.getRightLeafHeaders=C(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),E(e.options,Y,"getRightLeafHeaders")),e.getLeafHeaders=C(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,r)=>{var o,i,s,a,l,u;return[...(o=(i=n[0])==null?void 0:i.headers)!=null?o:[],...(s=(a=t[0])==null?void 0:a.headers)!=null?s:[],...(l=(u=r[0])==null?void 0:u.headers)!=null?l:[]].map(f=>f.getLeafHeaders()).flat()},E(e.options,Y,"getLeafHeaders"))}};function gt(e,n,t,r){var o,i;let s=0,a=function(g,d){d===void 0&&(d=1),s=Math.max(s,d),g.filter(h=>h.getIsVisible()).forEach(h=>{var p;(p=h.columns)!=null&&p.length&&a(h.columns,d+1)},0)};a(e);let l=[],u=(g,d)=>{let h={depth:d,id:[r,`${d}`].filter(Boolean).join("_"),headers:[]},p=[];g.forEach(_=>{let m=[...p].reverse()[0],y=_.column.depth===h.depth,R,P=!1;if(y&&_.column.parent?R=_.column.parent:(R=_.column,P=!0),m&&m?.column===R)m.subHeaders.push(_);else{let I=Pr(t,R,{id:[r,d,R.id,_?.id].filter(Boolean).join("_"),isPlaceholder:P,placeholderId:P?`${p.filter(D=>D.column===R).length}`:void 0,depth:d,index:p.length});I.subHeaders.push(_),p.push(I)}h.headers.push(_),_.headerGroup=h}),l.push(h),d>0&&u(p,d-1)},f=n.map((g,d)=>Pr(t,g,{depth:s,index:d}));u(f,s-1),l.reverse();let c=g=>g.filter(h=>h.column.getIsVisible()).map(h=>{let p=0,_=0,m=[0];h.subHeaders&&h.subHeaders.length?(m=[],c(h.subHeaders).forEach(R=>{let{colSpan:P,rowSpan:I}=R;p+=P,m.push(I)})):p=1;let y=Math.min(...m);return _=_+y,h.colSpan=p,h.rowSpan=_,{colSpan:p,rowSpan:_}});return c((o=(i=l[0])==null?void 0:i.headers)!=null?o:[]),l}var mn=(e,n,t,r,o,i,s)=>{let a={id:n,index:r,original:t,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];let u=e.getColumn(l);if(u!=null&&u.accessorFn)return a._valuesCache[l]=u.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];let u=e.getColumn(l);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=a.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>Oi(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],u=a;for(;;){let f=u.getParentRow();if(!f)break;l.push(f),u=f}return l.reverse()},getAllCells:C(()=>[e.getAllLeafColumns()],l=>l.map(u=>ki(e,a,u,u.id)),E(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:C(()=>[a.getAllCells()],l=>l.reduce((u,f)=>(u[f.column.id]=f,u),{}),E(e.options,"debugRows","getAllCellsByColumnId"))};for(let l=0;l{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Vr=(e,n,t)=>{var r;let o=t.toLowerCase();return!!(!((r=e.getValue(n))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(o))};Vr.autoRemove=e=>ce(e);var $r=(e,n,t)=>{var r;return!!(!((r=e.getValue(n))==null||(r=r.toString())==null)&&r.includes(t))};$r.autoRemove=e=>ce(e);var Lr=(e,n,t)=>{var r;return((r=e.getValue(n))==null||(r=r.toString())==null?void 0:r.toLowerCase())===t?.toLowerCase()};Lr.autoRemove=e=>ce(e);var Or=(e,n,t)=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(t)};Or.autoRemove=e=>ce(e)||!(e!=null&&e.length);var kr=(e,n,t)=>!t.some(r=>{var o;return!((o=e.getValue(n))!=null&&o.includes(r))});kr.autoRemove=e=>ce(e)||!(e!=null&&e.length);var Hr=(e,n,t)=>t.some(r=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(r)});Hr.autoRemove=e=>ce(e)||!(e!=null&&e.length);var Ar=(e,n,t)=>e.getValue(n)===t;Ar.autoRemove=e=>ce(e);var Nr=(e,n,t)=>e.getValue(n)==t;Nr.autoRemove=e=>ce(e);var _n=(e,n,t)=>{let[r,o]=t,i=e.getValue(n);return i>=r&&i<=o};_n.resolveFilterValue=e=>{let[n,t]=e,r=typeof n!="number"?parseFloat(n):n,o=typeof t!="number"?parseFloat(t):t,i=n===null||Number.isNaN(r)?-1/0:r,s=t===null||Number.isNaN(o)?1/0:o;if(i>s){let a=i;i=s,s=a}return[i,s]};_n.autoRemove=e=>ce(e)||ce(e[0])&&ce(e[1]);var _e={includesString:Vr,includesStringSensitive:$r,equalsString:Lr,arrIncludes:Or,arrIncludesAll:kr,arrIncludesSome:Hr,equals:Ar,weakEquals:Nr,inNumberRange:_n};function ce(e){return e==null||e===""}var zi={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:te("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);return typeof r=="string"?_e.includesString:typeof r=="number"?_e.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?_e.equals:Array.isArray(r)?_e.arrIncludes:_e.weakEquals},e.getFilterFn=()=>{var t,r;return mt(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(r=n.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?t:_e[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,r,o;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((r=n.options.enableColumnFilters)!=null?r:!0)&&((o=n.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(r=>r.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,r;return(t=(r=n.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(r=>{let o=e.getFilterFn(),i=r?.find(f=>f.id===e.id),s=Re(t,i?i.value:void 0);if(Dr(o,s,e)){var a;return(a=r?.filter(f=>f.id!==e.id))!=null?a:[]}let l={id:e.id,value:s};if(i){var u;return(u=r?.map(f=>f.id===e.id?l:f))!=null?u:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{let t=e.getAllLeafColumns(),r=o=>{var i;return(i=Re(n,o))==null?void 0:i.filter(s=>{let a=t.find(l=>l.id===s.id);if(a){let l=a.getFilterFn();if(Dr(l,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=n=>{var t,r;e.setColumnFilters(n?[]:(t=(r=e.initialState)==null?void 0:r.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Dr(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}var Gi=(e,n,t)=>t.reduce((r,o)=>{let i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),Bi=(e,n,t)=>{let r;return t.forEach(o=>{let i=o.getValue(e);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},Ui=(e,n,t)=>{let r;return t.forEach(o=>{let i=o.getValue(e);i!=null&&(r=i)&&(r=i)}),r},Ki=(e,n,t)=>{let r,o;return t.forEach(i=>{let s=i.getValue(e);s!=null&&(r===void 0?s>=s&&(r=o=s):(r>s&&(r=s),o{let t=0,r=0;if(n.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++t,r+=i)}),t)return r/t},qi=(e,n)=>{if(!n.length)return;let t=n.map(i=>i.getValue(e));if(!Li(t))return;if(t.length===1)return t[0];let r=Math.floor(t.length/2),o=t.sort((i,s)=>i-s);return t.length%2!==0?o[r]:(o[r-1]+o[r])/2},Wi=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),Xi=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,Yi=(e,n)=>n.length,rn={sum:Gi,min:Bi,max:Ui,extent:Ki,mean:ji,median:qi,unique:Wi,uniqueCount:Xi,count:Yi},Ji={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:te("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(r=>r!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,r;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((r=n.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);if(typeof r=="number")return rn.sum;if(Object.prototype.toString.call(r)==="[object Date]")return rn.extent},e.getAggregationFn=()=>{var t,r;if(!e)throw new Error;return mt(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(r=n.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?t:rn[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,r;e.setGrouping(n?[]:(t=(r=e.initialState)==null?void 0:r.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];let r=n.getColumn(t);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[t]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,r)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}}};function Qi(e,n,t){if(!(n!=null&&n.length)||!t)return e;let r=e.filter(i=>!n.includes(i.id));return t==="remove"?r:[...n.map(i=>e.find(s=>s.id===i)).filter(Boolean),...r]}var Zi={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:te("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=C(t=>[tt(n,t)],t=>t.findIndex(r=>r.id===e.id),E(n.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var r;return((r=tt(n,t)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=t=>{var r;let o=tt(n,t);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=C(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,r)=>o=>{let i=[];if(!(n!=null&&n.length))i=o;else{let s=[...n],a=[...o];for(;a.length&&s.length;){let l=s.shift(),u=a.findIndex(f=>f.id===l);u>-1&&i.push(a.splice(u,1)[0])}i=[...i,...a]}return Qi(i,t,r)},E(e.options,"debugTable","_getOrderColumnsFn"))}},on=()=>({left:[],right:[]}),es={getInitialState:e=>({columnPinning:on(),...e}),getDefaultOptions:e=>({onColumnPinningChange:te("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{let r=e.getLeafColumns().map(o=>o.id).filter(Boolean);n.setColumnPinning(o=>{var i,s;if(t==="right"){var a,l;return{left:((a=o?.left)!=null?a:[]).filter(c=>!(r!=null&&r.includes(c))),right:[...((l=o?.right)!=null?l:[]).filter(c=>!(r!=null&&r.includes(c))),...r]}}if(t==="left"){var u,f;return{left:[...((u=o?.left)!=null?u:[]).filter(c=>!(r!=null&&r.includes(c))),...r],right:((f=o?.right)!=null?f:[]).filter(c=>!(r!=null&&r.includes(c)))}}return{left:((i=o?.left)!=null?i:[]).filter(c=>!(r!=null&&r.includes(c))),right:((s=o?.right)!=null?s:[]).filter(c=>!(r!=null&&r.includes(c)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,i,s;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=(s=n.options.enableColumnPinning)!=null?s:n.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{let t=e.getLeafColumns().map(a=>a.id),{left:r,right:o}=n.getState().columnPinning,i=t.some(a=>r?.includes(a)),s=t.some(a=>o?.includes(a));return i?"left":s?"right":!1},e.getPinnedIndex=()=>{var t,r;let o=e.getIsPinned();return o?(t=(r=n.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=C(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,r,o)=>{let i=[...r??[],...o??[]];return t.filter(s=>!i.includes(s.column.id))},E(n.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=C(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,r)=>(r??[]).map(i=>t.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),E(n.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=C(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,r)=>(r??[]).map(i=>t.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),E(n.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,r;return e.setColumnPinning(n?on():(t=(r=e.initialState)==null?void 0:r.columnPinning)!=null?t:on())},e.getIsSomeColumnsPinned=n=>{var t;let r=e.getState().columnPinning;if(!n){var o,i;return!!((o=r.left)!=null&&o.length||(i=r.right)!=null&&i.length)}return!!((t=r[n])!=null&&t.length)},e.getLeftLeafColumns=C(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),E(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=C(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),E(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=C(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r)=>{let o=[...t??[],...r??[]];return n.filter(i=>!o.includes(i.id))},E(e.options,"debugColumns","getCenterLeafColumns"))}},pt={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},sn=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),ts={getDefaultColumnDef:()=>pt,getInitialState:e=>({columnSizing:{},columnSizingInfo:sn(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:te("columnSizing",e),onColumnSizingInfoChange:te("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,r,o;let i=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:pt.minSize,(r=i??e.columnDef.size)!=null?r:pt.size),(o=e.columnDef.maxSize)!=null?o:pt.maxSize)},e.getStart=C(t=>[t,tt(n,t),n.getState().columnSizing],(t,r)=>r.slice(0,e.getIndex(t)).reduce((o,i)=>o+i.getSize(),0),E(n.options,"debugColumns","getStart")),e.getAfter=C(t=>[t,tt(n,t),n.getState().columnSizing],(t,r)=>r.slice(e.getIndex(t)+1).reduce((o,i)=>o+i.getSize(),0),E(n.options,"debugColumns","getAfter")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:r,...o}=t;return o})},e.getCanResize=()=>{var t,r;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((r=n.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0,r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var i;t+=(i=o.column.getSize())!=null?i:0}};return r(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{let r=n.getColumn(e.column.id),o=r?.getCanResize();return i=>{if(!r||!o||(i.persist==null||i.persist(),ln(i)&&i.touches&&i.touches.length>1))return;let s=e.getSize(),a=e?e.getLeafHeaders().map(m=>[m.column.id,m.column.getSize()]):[[r.id,r.getSize()]],l=ln(i)?Math.round(i.touches[0].clientX):i.clientX,u={},f=(m,y)=>{typeof y=="number"&&(n.setColumnSizingInfo(R=>{var P,I;let D=n.options.columnResizeDirection==="rtl"?-1:1,q=(y-((P=R?.startOffset)!=null?P:0))*D,U=Math.max(q/((I=R?.startSize)!=null?I:0),-.999999);return R.columnSizingStart.forEach(K=>{let[G,Z]=K;u[G]=Math.round(Math.max(Z+Z*U,0)*100)/100}),{...R,deltaOffset:q,deltaPercentage:U}}),(n.options.columnResizeMode==="onChange"||m==="end")&&n.setColumnSizing(R=>({...R,...u})))},c=m=>f("move",m),g=m=>{f("end",m),n.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},d=t||typeof document<"u"?document:null,h={moveHandler:m=>c(m.clientX),upHandler:m=>{d?.removeEventListener("mousemove",h.moveHandler),d?.removeEventListener("mouseup",h.upHandler),g(m.clientX)}},p={moveHandler:m=>(m.cancelable&&(m.preventDefault(),m.stopPropagation()),c(m.touches[0].clientX),!1),upHandler:m=>{var y;d?.removeEventListener("touchmove",p.moveHandler),d?.removeEventListener("touchend",p.upHandler),m.cancelable&&(m.preventDefault(),m.stopPropagation()),g((y=m.touches[0])==null?void 0:y.clientX)}},_=ns()?{passive:!1}:!1;ln(i)?(d?.addEventListener("touchmove",p.moveHandler,_),d?.addEventListener("touchend",p.upHandler,_)):(d?.addEventListener("mousemove",h.moveHandler,_),d?.addEventListener("mouseup",h.upHandler,_)),n.setColumnSizingInfo(m=>({...m,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?sn():(t=e.initialState.columnSizingInfo)!=null?t:sn())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((r,o)=>r+o.getSize(),0))!=null?n:0}}},ht=null;function ns(){if(typeof ht=="boolean")return ht;let e=!1;try{let n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return ht=e,ht}function ln(e){return e.type==="touchstart"}var rs={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:te("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(r=>({...r,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,r;let o=e.columns;return(t=o.length?o.some(i=>i.getIsVisible()):(r=n.getState().columnVisibility)==null?void 0:r[e.id])!=null?t:!0},e.getCanHide=()=>{var t,r;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((r=n.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=C(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(r=>r.column.getIsVisible()),E(n.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=C(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,r,o)=>[...t,...r,...o],E(n.options,"debugRows","getVisibleCells"))},createTable:e=>{let n=(t,r)=>C(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),E(e.options,"debugColumns",t));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var r;e.setColumnVisibility(t?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=t=>{var r;t=(r=t)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var r;e.toggleAllColumnsVisible((r=t.target)==null?void 0:r.checked)}}};function tt(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var os={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},is={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:te("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;let r=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,r,o,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((r=n.options.enableGlobalFilter)!=null?r:!0)&&((o=n.options.enableFilters)!=null?o:!0)&&((i=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>_e.includesString,e.getGlobalFilterFn=()=>{var n,t;let{globalFilterFn:r}=e.options;return mt(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[r])!=null?n:_e[r]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},ss={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:te("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var r,o;if(!n){e._queue(()=>{n=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{let r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{let s=i.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(r=>{var o;let i=r===!0?!0:!!(r!=null&&r[e.id]),s={};if(r===!0?Object.keys(n.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,t=(o=t)!=null?o:!i,!i&&t)return{...s,[e.id]:!0};if(i&&!t){let{[e.id]:a,...l}=s;return l}return r})},e.getIsExpanded=()=>{var t;let r=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:r===!0||r?.[e.id])},e.getCanExpand=()=>{var t,r,o;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((r=n.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let t=!0,r=e;for(;t&&r.parentId;)r=n.getRow(r.parentId,!0),t=r.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},cn=0,fn=10,an=()=>({pageIndex:cn,pageSize:fn}),ls={getInitialState:e=>({...e,pagination:{...an(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:te("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var r,o;if(!n){e._queue(()=>{n=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=r=>{let o=i=>Re(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?an():(o=e.initialState.pagination)!=null?o:an())},e.setPageIndex=r=>{e.setPagination(o=>{let i=Re(r,o.pageIndex),s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,s)),{...o,pageIndex:i}})},e.resetPageIndex=r=>{var o,i;e.setPageIndex(r?cn:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:cn)},e.resetPageSize=r=>{var o,i;e.setPageSize(r?fn:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:fn)},e.setPageSize=r=>{e.setPagination(o=>{let i=Math.max(1,Re(r,o.pageSize)),s=o.pageSize*o.pageIndex,a=Math.floor(s/i);return{...o,pageIndex:a,pageSize:i}})},e.setPageCount=r=>e.setPagination(o=>{var i;let s=Re(r,(i=e.options.pageCount)!=null?i:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),e.getPageOptions=C(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,s)=>s)),o},E(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},un=()=>({top:[],bottom:[]}),as={getInitialState:e=>({rowPinning:un(),...e}),getDefaultOptions:e=>({onRowPinningChange:te("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,r,o)=>{let i=r?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],s=o?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],a=new Set([...s,e.id,...i]);n.setRowPinning(l=>{var u,f;if(t==="bottom"){var c,g;return{top:((c=l?.top)!=null?c:[]).filter(p=>!(a!=null&&a.has(p))),bottom:[...((g=l?.bottom)!=null?g:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)]}}if(t==="top"){var d,h;return{top:[...((d=l?.top)!=null?d:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)],bottom:((h=l?.bottom)!=null?h:[]).filter(p=>!(a!=null&&a.has(p)))}}return{top:((u=l?.top)!=null?u:[]).filter(p=>!(a!=null&&a.has(p))),bottom:((f=l?.bottom)!=null?f:[]).filter(p=>!(a!=null&&a.has(p)))}})},e.getCanPin=()=>{var t;let{enableRowPinning:r,enablePinning:o}=n.options;return typeof r=="function"?r(e):(t=r??o)!=null?t:!0},e.getIsPinned=()=>{let t=[e.id],{top:r,bottom:o}=n.getState().rowPinning,i=t.some(a=>r?.includes(a)),s=t.some(a=>o?.includes(a));return i?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var t,r;let o=e.getIsPinned();if(!o)return-1;let i=(t=o==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t.map(s=>{let{id:a}=s;return a});return(r=i?.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,r;return e.setRowPinning(n?un():(t=(r=e.initialState)==null?void 0:r.rowPinning)!=null?t:un())},e.getIsSomeRowsPinned=n=>{var t;let r=e.getState().rowPinning;if(!n){var o,i;return!!((o=r.top)!=null&&o.length||(i=r.bottom)!=null&&i.length)}return!!((t=r[n])!=null&&t.length)},e._getPinnedRows=(n,t,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(t??[]).map(s=>{let a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(t??[]).map(s=>n.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=C(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),E(e.options,"debugRows","getTopRows")),e.getBottomRows=C(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),E(e.options,"debugRows","getBottomRows")),e.getCenterRows=C(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,r)=>{let o=new Set([...t??[],...r??[]]);return n.filter(i=>!o.has(i.id))},E(e.options,"debugRows","getCenterRows"))}},us={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:te("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();let r={...t},o=e.getPreGroupedRowModel().flatRows;return n?o.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):o.forEach(i=>{delete r[i.id]}),r})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{let r=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{gn(o,i.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=C(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?dn(e,t):{rows:[],flatRows:[],rowsById:{}},E(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=C(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?dn(e,t):{rows:[],flatRows:[],rowsById:{}},E(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=C(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?dn(e,t):{rows:[],flatRows:[],rowsById:{}},E(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState(),r=!!(n.length&&Object.keys(t).length);return r&&n.some(o=>o.getCanSelect()&&!t[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let n=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:t}=e.getState(),r=!!n.length;return r&&n.some(o=>!t[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var n;let t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t{let n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,r)=>{let o=e.getIsSelected();n.setRowSelection(i=>{var s;if(t=typeof t<"u"?t:!o,e.getCanSelect()&&o===t)return i;let a={...i};return gn(a,e.id,t,(s=r?.selectChildren)!=null?s:!0,n),a})},e.getIsSelected=()=>{let{rowSelection:t}=n.getState();return yn(e,t)},e.getIsSomeSelected=()=>{let{rowSelection:t}=n.getState();return pn(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{let{rowSelection:t}=n.getState();return pn(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return r=>{var o;t&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},gn=(e,n,t,r,o)=>{var i;let s=o.getRow(n,!0);t?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[n]=!0)):delete e[n],r&&(i=s.subRows)!=null&&i.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>gn(e,a.id,t,r,o))};function dn(e,n){let t=e.getState().rowSelection,r=[],o={},i=function(s,a){return s.map(l=>{var u;let f=yn(l,t);if(f&&(r.push(l),o[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:i(l.subRows)}),f)return l}).filter(Boolean)};return{rows:i(n.rows),flatRows:r,rowsById:o}}function yn(e,n){var t;return(t=n[e.id])!=null?t:!1}function pn(e,n,t){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,i=!1;return e.subRows.forEach(s=>{if(!(i&&!o)&&(s.getCanSelect()&&(yn(s,n)?i=!0:o=!1),s.subRows&&s.subRows.length)){let a=pn(s,n);a==="all"?i=!0:(a==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}var hn=/([0-9]+)/gm,ds=(e,n,t)=>zr(be(e.getValue(t)).toLowerCase(),be(n.getValue(t)).toLowerCase()),cs=(e,n,t)=>zr(be(e.getValue(t)),be(n.getValue(t))),fs=(e,n,t)=>vn(be(e.getValue(t)).toLowerCase(),be(n.getValue(t)).toLowerCase()),gs=(e,n,t)=>vn(be(e.getValue(t)),be(n.getValue(t))),ps=(e,n,t)=>{let r=e.getValue(t),o=n.getValue(t);return r>o?1:rvn(e.getValue(t),n.getValue(t));function vn(e,n){return e===n?0:e>n?1:-1}function be(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function zr(e,n){let t=e.split(hn).filter(Boolean),r=n.split(hn).filter(Boolean);for(;t.length&&r.length;){let o=t.shift(),i=r.shift(),s=parseInt(o,10),a=parseInt(i,10),l=[s,a].sort();if(isNaN(l[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return t.length-r.length}var et={alphanumeric:ds,alphanumericCaseSensitive:cs,text:fs,textCaseSensitive:gs,datetime:ps,basic:hs},ms={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:te("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{let t=n.getFilteredRowModel().flatRows.slice(10),r=!1;for(let o of t){let i=o?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return et.datetime;if(typeof i=="string"&&(r=!0,i.split(hn).length>1))return et.alphanumeric}return r?et.text:et.basic},e.getAutoSortDir=()=>{let t=n.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,r;if(!e)throw new Error;return mt(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(r=n.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?t:et[e.columnDef.sortingFn]},e.toggleSorting=(t,r)=>{let o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;n.setSorting(s=>{let a=s?.find(d=>d.id===e.id),l=s?.findIndex(d=>d.id===e.id),u=[],f,c=i?t:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?f="toggle":f="add":s!=null&&s.length&&l!==s.length-1?f="replace":a?f="toggle":f="replace",f==="toggle"&&(i||o||(f="remove")),f==="add"){var g;u=[...s,{id:e.id,desc:c}],u.splice(0,u.length-((g=n.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else f==="toggle"?u=s.map(d=>d.id===e.id?{...d,desc:c}:d):f==="remove"?u=s.filter(d=>d.id!==e.id):u=[{id:e.id,desc:c}];return u})},e.getFirstSortDir=()=>{var t,r;return((t=(r=e.columnDef.sortDescFirst)!=null?r:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var r,o;let i=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==i&&((r=n.options.enableSortingRemoval)==null||r)&&(!(t&&(o=n.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,r;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((r=n.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,r;return(t=(r=e.columnDef.enableMultiSort)!=null?r:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;let r=(t=n.getState().sorting)==null?void 0:t.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,r;return(t=(r=n.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{let t=e.getCanSort();return r=>{t&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,r;e.setSorting(n?[]:(t=(r=e.initialState)==null?void 0:r.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},_s=[Ai,rs,Zi,es,Ni,zi,os,is,ms,Ji,ss,ls,as,us,ts];function Gr(e){var n,t;let r=[..._s,...(n=e._features)!=null?n:[]],o={_features:r},i=o._features.reduce((g,d)=>Object.assign(g,d.getDefaultOptions==null?void 0:d.getDefaultOptions(o)),{}),s=g=>o.options.mergeOptions?o.options.mergeOptions(i,g):{...i,...g},l={...{},...(t=e.initialState)!=null?t:{}};o._features.forEach(g=>{var d;l=(d=g.getInitialState==null?void 0:g.getInitialState(l))!=null?d:l});let u=[],f=!1,c={_features:r,options:{...i,...e},initialState:l,_queue:g=>{u.push(g),f||(f=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();f=!1}).catch(d=>setTimeout(()=>{throw d})))},reset:()=>{o.setState(o.initialState)},setOptions:g=>{let d=Re(g,o.options);o.options=s(d)},getState:()=>o.options.state,setState:g=>{o.options.onStateChange==null||o.options.onStateChange(g)},_getRowId:(g,d,h)=>{var p;return(p=o.options.getRowId==null?void 0:o.options.getRowId(g,d,h))!=null?p:`${h?[h.id,d].join("."):d}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(g,d)=>{let h=(d?o.getPrePaginationRowModel():o.getRowModel()).rowsById[g];if(!h&&(h=o.getCoreRowModel().rowsById[g],!h))throw new Error;return h},_getDefaultColumnDef:C(()=>[o.options.defaultColumn],g=>{var d;return g=(d=g)!=null?d:{},{header:h=>{let p=h.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:h=>{var p,_;return(p=(_=h.renderValue())==null||_.toString==null?void 0:_.toString())!=null?p:null},...o._features.reduce((h,p)=>Object.assign(h,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...g}},E(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>o.options.columns,getAllColumns:C(()=>[o._getColumnDefs()],g=>{let d=function(h,p,_){return _===void 0&&(_=0),h.map(m=>{let y=Hi(o,m,_,p),R=m;return y.columns=R.columns?d(R.columns,y,_+1):[],y})};return d(g)},E(e,"debugColumns","getAllColumns")),getAllFlatColumns:C(()=>[o.getAllColumns()],g=>g.flatMap(d=>d.getFlatColumns()),E(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:C(()=>[o.getAllFlatColumns()],g=>g.reduce((d,h)=>(d[h.id]=h,d),{}),E(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:C(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(g,d)=>{let h=g.flatMap(p=>p.getLeafColumns());return d(h)},E(e,"debugColumns","getAllLeafColumns")),getColumn:g=>o._getAllFlatColumnsById()[g]};Object.assign(o,c);for(let g=0;gC(()=>[e.options.data],n=>{let t={rows:[],flatRows:[],rowsById:{}},r=function(o,i,s){i===void 0&&(i=0);let a=[];for(let u=0;ue._autoResetPageIndex()))}function Ur(){return(e,n)=>C(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{var r;if(!t)return;let o=(r=t.flatRows[0])==null?void 0:r.getUniqueValues(n);if(typeof o>"u")return;let i=[o,o];for(let s=0;si[1]&&(i[1]=u)}}return i},E(e.options,"debugTable","getFacetedMinMaxValues"))}function Kr(e,n,t){return t.options.filterFromLeafRows?ys(e,n,t):vs(e,n,t)}function ys(e,n,t){var r;let o=[],i={},s=(r=t.options.maxLeafRowFilterDepth)!=null?r:100,a=function(l,u){u===void 0&&(u=0);let f=[];for(let g=0;gC(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,r,o)=>{if(!t.rows.length||!(r!=null&&r.length)&&!o)return t;let i=[...r.map(a=>a.id).filter(a=>a!==n),o?"__global__":void 0].filter(Boolean),s=a=>{for(let l=0;lC(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let r=new Map;for(let i=0;iC(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(n,t,r)=>{if(!n.rows.length||!(t!=null&&t.length)&&!r){for(let g=0;g{var d;let h=e.getColumn(g.id);if(!h)return;let p=h.getFilterFn();p&&o.push({id:g.id,filterFn:p,resolvedValue:(d=p.resolveFilterValue==null?void 0:p.resolveFilterValue(g.value))!=null?d:g.value})});let s=(t??[]).map(g=>g.id),a=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());r&&a&&l.length&&(s.push("__global__"),l.forEach(g=>{var d;i.push({id:g.id,filterFn:a,resolvedValue:(d=a.resolveFilterValue==null?void 0:a.resolveFilterValue(r))!=null?d:r})}));let u,f;for(let g=0;g{d.columnFiltersMeta[p]=_})}if(i.length){for(let h=0;h{d.columnFiltersMeta[p]=_})){d.columnFilters.__global__=!0;break}}d.columnFilters.__global__!==!0&&(d.columnFilters.__global__=!1)}}let c=g=>{for(let d=0;de._autoResetPageIndex()))}function Xr(){return e=>C(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;let r=e.getState().sorting,o=[],i=r.filter(l=>{var u;return(u=e.getColumn(l.id))==null?void 0:u.getCanSort()}),s={};i.forEach(l=>{let u=e.getColumn(l.id);u&&(s[l.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});let a=l=>{let u=l.map(f=>({...f}));return u.sort((f,c)=>{for(let d=0;d{var c;o.push(f),(c=f.subRows)!=null&&c.length&&(f.subRows=a(f.subRows))}),u};return{rows:a(t.rows),flatRows:o,rowsById:t.rowsById}},E(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function _t(e,n){return e?Ss(e)?ee(e,n):e:null}function Ss(e){return ws(e)||typeof e=="function"||Cs(e)}function ws(e){return typeof e=="function"&&(()=>{let n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function Cs(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Yr(e){let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=H(()=>({current:Gr(n)})),[r,o]=H(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:s=>{o(s),e.onStateChange==null||e.onStateChange(s)}})),t.current}function ze(e,n,t){let r=t.initialDeps??[],o;return()=>{var i,s,a,l;let u;t.key&&((i=t.debug)!=null&&i.call(t))&&(u=Date.now());let f=e();if(!(f.length!==r.length||f.some((d,h)=>r[h]!==d)))return o;r=f;let g;if(t.key&&((s=t.debug)!=null&&s.call(t))&&(g=Date.now()),o=n(...f),t.key&&((a=t.debug)!=null&&a.call(t))){let d=Math.round((Date.now()-u)*100)/100,h=Math.round((Date.now()-g)*100)/100,p=h/16,_=(m,y)=>{for(m=String(m);m.lengthMath.abs(e-n)<1,Ur=(e,n,t)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,o),t)}};var hs=e=>e,ms=e=>{let n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=n;o<=t;o++)r.push(o);return r},jr=(e,n)=>{let t=e.scrollElement;if(!t)return;let r=e.targetWindow;if(!r)return;let o=s=>{let{width:a,height:l}=s;n({width:Math.round(a),height:Math.round(l)})};if(o(t.getBoundingClientRect()),!r.ResizeObserver)return()=>{};let i=new r.ResizeObserver(s=>{let a=s[0];if(a?.borderBoxSize){let l=a.borderBoxSize[0];if(l){o({width:l.inlineSize,height:l.blockSize});return}}o(t.getBoundingClientRect())});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},Kr={passive:!0};var _s=typeof window>"u"?!0:"onscrollend"in window,qr=(e,n)=>{let t=e.scrollElement;if(!t)return;let r=e.targetWindow;if(!r)return;let o=0,i=_s?()=>{}:Ur(r,()=>{n(o,!1)},e.options.isScrollingResetDelay),s=u=>()=>{o=t[e.options.horizontal?"scrollLeft":"scrollTop"],i(),n(o,u)},a=s(!0),l=s(!1);return l(),t.addEventListener("scroll",a,Kr),t.addEventListener("scrollend",l,Kr),()=>{t.removeEventListener("scroll",a),t.removeEventListener("scrollend",l)}};var ys=(e,n,t)=>{if(n?.borderBoxSize){let r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[t.options.horizontal?"width":"height"])};var Wr=(e,{adjustments:n=0,behavior:t},r)=>{var o,i;let s=e+n;(i=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[r.options.horizontal?"left":"top"]:s,behavior:t})},pt=class{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null,r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{this._measureElement(i.target,i)})}));return{disconnect:()=>{var o;return(o=r())==null?void 0:o.disconnect()},observe:o=>{var i;return(i=r())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=r())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,o])=>{typeof o>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:hs,rangeExtractor:ms,onChange:()=>{},measureElement:ys,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,...t}},this.notify=(t,r)=>{var o,i;let{startIndex:s,endIndex:a}=this.range??{startIndex:void 0,endIndex:void 0},l=this.calculateRange();(t||s!==l?.startIndex||a!==l?.endIndex)&&((i=(o=this.options).onChange)==null||i.call(o,this,r))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.observer.disconnect(),this.elementsCache.clear()},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.notify(!1,!1);return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{let o=new Map,i=new Map;for(let s=r-1;s>=0;s--){let a=t[s];if(o.has(a.lane))continue;let l=i.get(a.lane);if(l==null||a.end>l.end?i.set(a.lane,a):a.ends.end===a.end?s.index-a.index:s.end-a.end)[0]:void 0},this.getMeasurementOptions=Le(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,o,i,s)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s}),{key:!1}),this.getMeasurements=Le(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s},a)=>{var l;if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(c=>{this.itemSizeCache.set(c.key,c.size)}));let u=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let f=this.measurementsCache.slice(0,u);for(let c=u;c{let I=i(c),D=this.elementsCache.get(I);if(!P){D&&(this.observer.unobserve(D),this.elementsCache.delete(I));return}D!==P&&(D&&this.observer.unobserve(D),this.observer.observe(P),this.elementsCache.set(I,P)),P.isConnected&&this.resizeItem(c,this.options.measureElement(P,void 0,this))});let d=i(c),h=this.options.lanes===1?f[c-1]:this.getFurthestMeasurement(f,c),p=h?h.end+this.options.gap:r+o,_=a.get(d),m=typeof _=="number"?_:this.options.estimateSize(c),y=p+m,R=h?h.lane:c%this.options.lanes;f[c]={index:c,start:p,size:m,end:y,key:d,lane:R,measureElement:g}}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Le(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(t,r,o)=>this.range=t.length>0&&r>0?vs({measurements:t,outerSize:r,scrollOffset:o}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=Le(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(t,r,o,i)=>r===null?[]:t({startIndex:r.startIndex,endIndex:r.endIndex,overscan:o,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{let r=this.options.indexAttribute,o=t.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{let o=this.indexFromElement(t),i=this.getMeasurements()[o];if(!i||!t.isConnected){this.elementsCache.forEach((a,l)=>{a===t&&(this.observer.unobserve(t),this.elementsCache.delete(l))});return}let s=this.elementsCache.get(i.key);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(i.key,t)),this.resizeItem(o,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{let o=this.getMeasurements()[t];if(!o)return;let i=this.itemSizeCache.get(o.key)??o.size,s=r-i;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,s,this):o.start{t&&this._measureElement(t,void 0)},this.getVirtualItems=Le(()=>[this.getIndexes(),this.getMeasurements()],(t,r)=>{let o=[];for(let i=0,s=t.length;ithis.options.debug}),this.getVirtualItemForOffset=t=>{let r=this.getMeasurements();if(r.length!==0)return gt(r[Xr(0,r.length-1,o=>gt(r[o]).start,t)])},this.getOffsetForAlignment=(t,r)=>{let o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(t<=i?r="start":t>=i+o?r="end":r="start"),r==="start"?t=t:r==="end"?t=t-o:r==="center"&&(t=t-o/2);let s=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[s]:this.scrollElement[s]:0)-o;return Math.max(Math.min(l,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let o=this.getMeasurements()[t];if(!o)return;let i=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];let a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(t,{align:r="start",behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(t,{align:r="auto",behavior:o}={})=>{t=Math.max(0,Math.min(t,this.options.count-1)),this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let i=this.getOffsetForIndex(t,r);if(!i)return;let[s,a]=i;this._scrollToOffset(s,{adjustments:void 0,behavior:o}),o!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(t))){let[u]=gt(this.getOffsetForIndex(t,a));Br(u,this.getScrollOffset())||this.scrollToIndex(t,{align:a,behavior:o})}else this.scrollToIndex(t,{align:a,behavior:o})}))},this.scrollBy=(t,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;let r=this.getMeasurements(),o;return r.length===0?o=this.options.paddingStart:o=this.options.lanes===1?((t=r[r.length-1])==null?void 0:t.end)??0:Math.max(...r.slice(-this.options.lanes).map(i=>i.end)),o-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(t,{adjustments:r,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:r},this)},this.measure=()=>{var t,r;this.itemSizeCache=new Map,(r=(t=this.options).onChange)==null||r.call(t,this,!1)},this.setOptions(n)}},Xr=(e,n,t,r)=>{for(;e<=n;){let o=(e+n)/2|0,i=t(o);if(ir)n=o-1;else return o}return e>0?e-1:0};function vs({measurements:e,outerSize:n,scrollOffset:t}){let r=e.length-1,i=Xr(0,r,a=>e[a].start,t),s=i;for(;s({}),{})[1],t={...e,onChange:(o,i)=>{var s;i?Yt(n):n(),(s=e.onChange)==null||s.call(e,o,i)}},[r]=A(()=>new pt(t));return r.setOptions(t),L(()=>r._didMount(),[]),Ss(()=>r._willUpdate()),r}function Yr(e){return ws({observeElementRect:jr,observeElementOffset:qr,scrollToFn:Wr,...e})}function Jr(e){return{render:function(n){qt(n,e)},unmount:function(){Xt(e)}}}var ro=Symbol.for("immer-nothing"),Qr=Symbol.for("immer-draftable"),T=Symbol.for("immer-state");function oe(e,...n){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ke=Object.getPrototypeOf;function He(e){return!!e&&!!e[T]}function ye(e){return e?oo(e)||Array.isArray(e)||!!e[Qr]||!!e.constructor?.[Qr]||vt(e)||St(e):!1}var Cs=Object.prototype.constructor.toString();function oo(e){if(!e||typeof e!="object")return!1;let n=ke(e);if(n===null)return!0;let t=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return t===Object?!0:typeof t=="function"&&Function.toString.call(t)===Cs}function Ae(e,n){yt(e)===0?Object.entries(e).forEach(([t,r])=>{n(t,r,e)}):e.forEach((t,r)=>n(r,t,e))}function yt(e){let n=e[T];return n?n.type_:Array.isArray(e)?1:vt(e)?2:St(e)?3:0}function _n(e,n){return yt(e)===2?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function io(e,n,t){let r=yt(e);r===2?e.set(n,t):r===3?e.add(t):e[n]=t}function Es(e,n){return e===n?e!==0||1/e===1/n:e!==e&&n!==n}function vt(e){return e instanceof Map}function St(e){return e instanceof Set}function G(e){return e.copy_||e.base_}function yn(e,n){if(vt(e))return new Map(e);if(St(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!n&&oo(e))return ke(e)?{...e}:Object.assign(Object.create(null),e);let t=Object.getOwnPropertyDescriptors(e);delete t[T];let r=Reflect.ownKeys(t);for(let o=0;o1&&(e.set=e.add=e.clear=e.delete=Rs),Object.freeze(e),n&&Ae(e,(t,r)=>Ne(r,!0),!0)),e}function Rs(){oe(2)}function wt(e){return Object.isFrozen(e)}var vn={};function Fe(e){let n=vn[e];return n||oe(0,e),n}function bs(e,n){vn[e]||(vn[e]=n)}var Je;function ht(){return Je}function xs(e,n){return{drafts_:[],parent_:e,immer_:n,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Zr(e,n){n&&(Fe("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=n)}function Sn(e){wn(e),e.drafts_.forEach(Ms),e.drafts_=null}function wn(e){e===Je&&(Je=e.parent_)}function eo(e){return Je=xs(Je,e)}function Ms(e){let n=e[T];n.type_===0||n.type_===1?n.revoke_():n.revoked_=!0}function to(e,n){n.unfinalizedDrafts_=n.drafts_.length;let t=n.drafts_[0];return e!==void 0&&e!==t?(t[T].modified_&&(Sn(n),oe(4)),ye(e)&&(e=mt(n,e),n.parent_||_t(n,e)),n.patches_&&Fe("Patches").generateReplacementPatches_(t[T].base_,e,n.patches_,n.inversePatches_)):e=mt(n,t,[]),Sn(n),n.patches_&&n.patchListener_(n.patches_,n.inversePatches_),e!==ro?e:void 0}function mt(e,n,t){if(wt(n))return n;let r=n[T];if(!r)return Ae(n,(o,i)=>no(e,r,n,o,i,t),!0),n;if(r.scope_!==e)return n;if(!r.modified_)return _t(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;let o=r.copy_,i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),Ae(i,(a,l)=>no(e,r,o,a,l,t,s)),_t(e,o,!1),t&&e.patches_&&Fe("Patches").generatePatches_(r,t,e.patches_,e.inversePatches_)}return r.copy_}function no(e,n,t,r,o,i,s){if(He(o)){let a=i&&n&&n.type_!==3&&!_n(n.assigned_,r)?i.concat(r):void 0,l=mt(e,o,a);if(io(t,r,l),He(l))e.canAutoFreeze_=!1;else return}else s&&t.add(o);if(ye(o)&&!wt(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;mt(e,o),(!n||!n.scope_.parent_)&&_t(e,o)}}function _t(e,n,t=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ne(n,t)}function Fs(e,n){let t=Array.isArray(e),r={type_:t?1:0,scope_:n?n.scope_:ht(),modified_:!1,finalized_:!1,assigned_:{},parent_:n,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=r,i=Cn;t&&(o=[r],i=Qe);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Cn={get(e,n){if(n===T)return e;let t=G(e);if(!_n(t,n))return Is(e,t,n);let r=t[n];return e.finalized_||!ye(r)?r:r===hn(e.base_,n)?(mn(e),e.copy_[n]=Ze(r,e)):r},has(e,n){return n in G(e)},ownKeys(e){return Reflect.ownKeys(G(e))},set(e,n,t){let r=so(G(e),n);if(r?.set)return r.set.call(e.draft_,t),!0;if(!e.modified_){let o=hn(G(e),n),i=o?.[T];if(i&&i.base_===t)return e.copy_[n]=t,e.assigned_[n]=!1,!0;if(Es(t,o)&&(t!==void 0||_n(e.base_,n)))return!0;mn(e),_e(e)}return e.copy_[n]===t&&(t!==void 0||n in e.copy_)||Number.isNaN(t)&&Number.isNaN(e.copy_[n])||(e.copy_[n]=t,e.assigned_[n]=!0),!0},deleteProperty(e,n){return hn(e.base_,n)!==void 0||n in e.base_?(e.assigned_[n]=!1,mn(e),_e(e)):delete e.assigned_[n],e.copy_&&delete e.copy_[n],!0},getOwnPropertyDescriptor(e,n){let t=G(e),r=Reflect.getOwnPropertyDescriptor(t,n);return r&&{writable:!0,configurable:e.type_!==1||n!=="length",enumerable:r.enumerable,value:t[n]}},defineProperty(){oe(11)},getPrototypeOf(e){return ke(e.base_)},setPrototypeOf(){oe(12)}},Qe={};Ae(Cn,(e,n)=>{Qe[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}});Qe.deleteProperty=function(e,n){return Qe.set.call(this,e,n,void 0)};Qe.set=function(e,n,t){return Cn.set.call(this,e[0],n,t,e[0])};function hn(e,n){let t=e[T];return(t?G(t):e)[n]}function Is(e,n,t){let r=so(n,t);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function so(e,n){if(!(n in e))return;let t=ke(e);for(;t;){let r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;t=ke(t)}}function _e(e){e.modified_||(e.modified_=!0,e.parent_&&_e(e.parent_))}function mn(e){e.copy_||(e.copy_=yn(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ts=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(n,t,r)=>{if(typeof n=="function"&&typeof t!="function"){let i=t;t=n;let s=this;return function(l=i,...u){return s.produce(l,f=>t.call(this,f,...u))}}typeof t!="function"&&oe(6),r!==void 0&&typeof r!="function"&&oe(7);let o;if(ye(n)){let i=eo(this),s=Ze(n,void 0),a=!0;try{o=t(s),a=!1}finally{a?Sn(i):wn(i)}return Zr(i,r),to(o,i)}else if(!n||typeof n!="object"){if(o=t(n),o===void 0&&(o=n),o===ro&&(o=void 0),this.autoFreeze_&&Ne(o,!0),r){let i=[],s=[];Fe("Patches").generateReplacementPatches_(n,o,i,s),r(i,s)}return o}else oe(1,n)},this.produceWithPatches=(n,t)=>{if(typeof n=="function")return(s,...a)=>this.produceWithPatches(s,l=>n(l,...a));let r,o;return[this.produce(n,t,(s,a)=>{r=s,o=a}),r,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ye(e)||oe(8),He(e)&&(e=Ps(e));let n=eo(this),t=Ze(e,void 0);return t[T].isManual_=!0,wn(n),t}finishDraft(e,n){let t=e&&e[T];(!t||!t.isManual_)&&oe(9);let{scope_:r}=t;return Zr(r,n),to(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,n){let t;for(t=n.length-1;t>=0;t--){let o=n[t];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}t>-1&&(n=n.slice(t+1));let r=Fe("Patches").applyPatches_;return He(e)?r(e,n):this.produce(e,o=>r(o,n))}};function Ze(e,n){let t=vt(e)?Fe("MapSet").proxyMap_(e,n):St(e)?Fe("MapSet").proxySet_(e,n):Fs(e,n);return(n?n.scope_:ht()).drafts_.push(t),t}function Ps(e){return He(e)||oe(10,e),lo(e)}function lo(e){if(!ye(e)||wt(e))return e;let n=e[T],t;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,t=yn(e,n.scope_.immer_.useStrictShallowCopy_)}else t=yn(e,!0);return Ae(t,(r,o)=>{io(t,r,lo(o))}),n&&(n.finalized_=!1),t}function Ct(){class e extends Map{constructor(l,u){super(),this[T]={type_:2,parent_:u,scope_:u?u.scope_:ht(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:l,draft_:this,isManual_:!1,revoked_:!1}}get size(){return G(this[T]).size}has(l){return G(this[T]).has(l)}set(l,u){let f=this[T];return s(f),(!G(f).has(l)||G(f).get(l)!==u)&&(t(f),_e(f),f.assigned_.set(l,!0),f.copy_.set(l,u),f.assigned_.set(l,!0)),this}delete(l){if(!this.has(l))return!1;let u=this[T];return s(u),t(u),_e(u),u.base_.has(l)?u.assigned_.set(l,!1):u.assigned_.delete(l),u.copy_.delete(l),!0}clear(){let l=this[T];s(l),G(l).size&&(t(l),_e(l),l.assigned_=new Map,Ae(l.base_,u=>{l.assigned_.set(u,!1)}),l.copy_.clear())}forEach(l,u){let f=this[T];G(f).forEach((c,g,d)=>{l.call(u,this.get(g),g,this)})}get(l){let u=this[T];s(u);let f=G(u).get(l);if(u.finalized_||!ye(f)||f!==u.base_.get(l))return f;let c=Ze(f,u);return t(u),u.copy_.set(l,c),c}keys(){return G(this[T]).keys()}values(){let l=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{let u=l.next();return u.done?u:{done:!1,value:this.get(u.value)}}}}entries(){let l=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{let u=l.next();if(u.done)return u;let f=this.get(u.value);return{done:!1,value:[u.value,f]}}}}[Symbol.iterator](){return this.entries()}}function n(a,l){return new e(a,l)}function t(a){a.copy_||(a.assigned_=new Map,a.copy_=new Map(a.base_))}class r extends Set{constructor(l,u){super(),this[T]={type_:3,parent_:u,scope_:u?u.scope_:ht(),modified_:!1,finalized_:!1,copy_:void 0,base_:l,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return G(this[T]).size}has(l){let u=this[T];return s(u),u.copy_?!!(u.copy_.has(l)||u.drafts_.has(l)&&u.copy_.has(u.drafts_.get(l))):u.base_.has(l)}add(l){let u=this[T];return s(u),this.has(l)||(i(u),_e(u),u.copy_.add(l)),this}delete(l){if(!this.has(l))return!1;let u=this[T];return s(u),i(u),_e(u),u.copy_.delete(l)||(u.drafts_.has(l)?u.copy_.delete(u.drafts_.get(l)):!1)}clear(){let l=this[T];s(l),G(l).size&&(i(l),_e(l),l.copy_.clear())}values(){let l=this[T];return s(l),i(l),l.copy_.values()}entries(){let l=this[T];return s(l),i(l),l.copy_.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(l,u){let f=this.values(),c=f.next();for(;!c.done;)l.call(u,c.value,c.value,this),c=f.next()}}function o(a,l){return new r(a,l)}function i(a){a.copy_||(a.copy_=new Set,a.base_.forEach(l=>{if(ye(l)){let u=Ze(l,a);a.drafts_.set(l,u),a.copy_.add(u)}else a.copy_.add(l)}))}function s(a){a.revoked_&&oe(3,JSON.stringify(G(a)))}bs("MapSet",{proxyMap_:n,proxySet_:o})}var Z=new Ts,ao=Z.produce,Cl=Z.produceWithPatches.bind(Z),El=Z.setAutoFreeze.bind(Z),Rl=Z.setUseStrictShallowCopy.bind(Z),bl=Z.applyPatches.bind(Z),xl=Z.createDraft.bind(Z),Ml=Z.finishDraft.bind(Z);function ze(e){var n=A(function(){return Ne(typeof e=="function"?e():e,!0)}),t=n[1];return[n[0],Y(function(r){t(typeof r=="function"?ao(r):Ne(r))},[])]}function Vs(e,n,t,r,o){window.Shiny.shinyapp.makeRequest(e,n,t,r,o)}function uo({method:e,args:n,blobs:t}){return new Promise((r,o)=>{Vs(e,n,i=>{r(i)},i=>{o(i)},t)})}function co({patchInfo:e,patches:n,onSuccess:t,onError:r,columns:o,setData:i,setCellEditMapAtLoc:s}){let a=n.map(l=>({row_index:l.rowIndex,column_index:l.columnIndex,value:l.value}));uo({method:e.key,args:[a]}).then(l=>{if(!Array.isArray(l))throw new Error("Expected a response of a list of patches");for(let f of l)if(!("row_index"in f&&"column_index"in f&&"value"in f))throw new Error("Expected list of patches containing `row_index`, `column_index`, and `value`");l=l;let u=l.map(f=>({rowIndex:f.row_index,columnIndex:f.column_index,value:f.value}));i(f=>{u.forEach(({rowIndex:c,columnIndex:g,value:d})=>{f[c][g]=d})}),n.forEach(({rowIndex:f,columnIndex:c,value:g})=>{s(f,c,d=>{d.state===ue.EditSaving&&(d.state=ue.Ready,d.value=g,d.errorTitle=void 0)})}),u.forEach(({rowIndex:f,columnIndex:c,value:g})=>{s(f,c,d=>{d.value=g,d.state=ue.EditSuccess,d.errorTitle=void 0})}),t(u)}).catch(l=>{n.forEach(({rowIndex:u,columnIndex:f,value:c})=>{s(u,f,g=>{g.value=String(c),g.state=ue.EditFailure,g.errorTitle=String(l)})}),r(l)})}var ue={EditSaving:"EditSaving",EditSuccess:"EditSuccess",EditFailure:"EditFailure",Editing:"Editing",Ready:"Ready"},bn={EditSaving:"cell-edit-saving",EditSuccess:"cell-edit-success",EditFailure:"cell-edit-failure",Editing:"cell-edit-editing",Ready:void 0},Rn=e=>e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"isShinyHtml")&&e.isShinyHtml===!0,En=e=>e===null?"":Rn(e)?e.obj.html:e,fo=({containerRef:e,rowId:n,cell:t,patchInfo:r,columns:o,coldefs:i,rowIndex:s,columnIndex:a,editCellsIsAllowed:l,getSortedRowModel:u,cellEditInfo:f,cellStyle:c,cellClassName:g,setData:d,setCellEditMapAtLoc:h,selection:p})=>{let _=t.getValue(),m=t.column.columnDef.meta.isHtmlColumn,y=f?.value??_,R=f?.state??ue.Ready,P=f?.errorTitle,I=f?.isEditing??!1,D=f?.editValue??En(y),K=X(null),B=X(null),q=Y(({resetIsEditing:x=!1,resetEditValue:N=!1}={resetIsEditing:!0,resetEditValue:!0})=>{h(s,a,V=>{x&&(V.isEditing=!1),N&&(V.editValue=void 0)})},[s,a,h]),z=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),q(),p.focusOffset(n,0))},de=x=>{if(x.key!=="Tab")return;x.preventDefault(),x.stopPropagation();let N=x.shiftKey,V=a;for(;;){let H=V+(N?-1:1);if(H<0||H>=i.length)return;if(V=H,i[H].meta.isHtmlColumn!==!0)break}Ie(),h(s,V,H=>{H.isEditing=!0})},et=x=>{if(x.key!=="Enter")return;x.preventDefault(),x.stopPropagation();let N=x.shiftKey,V=u(),H=V.rows.findIndex(Ve=>Ve.id===n);if(H<0)return;let Ue=H+(N?-1:1);if(Ue<0||Ue>=V.rows.length)return;Ie();let ge=V.rows[Ue].index;h(ge,a,Ve=>{Ve.isEditing=!0})},Ee=x=>{[z,et,de].forEach(N=>N(x))},Ie=Y(()=>{if(h(s,a,x=>{x.errorTitle=void 0}),`${En(y)}`==`${D}`){q(),h(s,a,x=>{x.state=R});return}q({resetIsEditing:!0}),h(s,a,x=>{x.state=ue.EditSaving}),co({patchInfo:r,patches:[{rowIndex:s,columnIndex:a,value:D}],onSuccess:x=>{q({resetEditValue:!0})},onError:x=>{},columns:o,setData:d,setCellEditMapAtLoc:h})},[h,s,a,y,D,q,r,o,d,R]);L(()=>{I&&B.current&&(B.current.focus(),B.current.select())},[I]),L(()=>{if(!I||!K.current||!B.current)return;let x=H=>{K.current?.contains(H.target)&&H.stopPropagation()},N=K.current;N.addEventListener("mousedown",x);let V=H=>{H.target!==B.current&&(Ie(),q())};return document.body.addEventListener("mousedown",V),()=>{N.removeEventListener("mousedown",x),document.body.removeEventListener("mousedown",V)}},[R,Ie,s,a,I,q]);function In(x){I&&x.target.select()}function Te(x){h(s,a,N=>{N.editValue=x.target.value})}let Pe,Ge,Rt=P,ve=g,Re=x=>{x&&(ve?(ve+=" ",ve+=x):ve=x)};Re(bn[I?ue.Editing:R]);let Be=!1,tt=null;return R===ue.EditSaving?Ge=D:(I?tt=b.createElement("textarea",{value:String(D),onChange:Te,onFocus:In,onKeyDown:Ee,ref:B}):m?Re("cell-html"):l&&(Re("cell-editable"),Pe=x=>{h(s,a,N=>{N.isEditing=!0,N.editValue=En(y)})}),Rn(y)?Be=!0:Ge=ft(t.column.columnDef.cell,t.getContext())),L(()=>{if(!K.current||!Be||!Rn(y))return;let x=JSON.parse(JSON.stringify(y.obj));window.Shiny.renderContentAsync(K.current,x);let N=K.current;return()=>{window.Shiny.unbindAll(N),N.replaceChildren("")}},[K,y,s,a,Be]),b.createElement("td",{ref:K,onDoubleClick:Pe,title:Rt,className:ve,style:{...c}},tt,Ge)};var go=()=>{let[e,n]=ze(new Map);return Ct(),{cellEditMap:e,setCellEditMapAtLoc:(r,o,i)=>{n(s=>{let a=po(r,o),l=s.get(a)??{};i(l),s.set(a,l)})}}},po=(e,n)=>`[${e}, ${n}]`;var ho=(e,n,t)=>{let r=po(n,t);return[e.get(r)??{},r]};function Et(e,n,t){let r=Object.assign({top:0,right:0,bottom:0,left:0},t),o=e,i=o.scrollTop+r.top,s=o.scrollLeft+r.left,a=i+o.clientHeight-r.top-r.bottom,l=s+o.clientWidth-r.left-r.right;for(let u=0;u=i&&c<=a&&g>=s&&g<=l)return f}return null}function xn(e,n){return document?.defaultView?.getComputedStyle(e,null)?.getPropertyValue(n)}var yo=e=>{let[n,t]=A(!1),{range:r,from:o,to:i,onRangeChange:s}=e;return b.createElement(Ds,{range:r,value:[o,i],editing:n,onValueChange:a=>s(...a),onFocus:()=>t(!0),onBlur:()=>t(!1)})};var Ds=e=>{let[n,t]=e.value,{editing:r,onFocus:o}=e,[i,s]=e.range(),a=X(null),l=X(null);return b.createElement("div",{onBlur:u=>{if(!u.currentTarget.contains(u.relatedTarget))return e.onBlur()},onFocus:()=>o(),style:{display:"flex",gap:"0.5rem"}},b.createElement("input",{ref:a,className:`form-control form-control-sm ${a.current?.checkValidity()?"":"is-invalid"}`,style:{flex:"1 1 0",width:"0"},type:"number",placeholder:mo(r,"Min",i),defaultValue:n,step:"any",onChange:u=>{let f=_o(u.target.value);a.current&&(a.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([f,t]))}}),b.createElement("input",{ref:l,className:`form-control form-control-sm ${l.current?.checkValidity()?"":"is-invalid"}`,style:{flex:"1 1 0",width:"0"},type:"number",placeholder:mo(r,"Max",s),defaultValue:t,step:"any",onChange:u=>{let f=_o(u.target.value);l.current&&(l.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([n,f]))}}))};function mo(e,n,t){if(e)return typeof t>"u"?n:`${n} (${t})`}function _o(e){if(e!=="")return+e}function vo(e){let[n,t]=A([]),r=e?{getFilteredRowModel:Nr(),getFacetedRowModel:Hr(),getFacetedUniqueValues:Ar(),getFacetedMinMaxValues:Lr(),filterFns:{substring:(o,i,s,a)=>o.getValue(i)?.toString().includes(s)??!1},onColumnFiltersChange:t}:{};return{columnFilters:n,columnFiltersState:{columnFilters:n},filtersTableOptions:r,setColumnFilters:t}}var So=({header:e,className:n,...t})=>{let r=e.column.columnDef.meta?.typeHint;if(!r||r.type==="html")return null;if(r.type==="numeric"){let[o,i]=e.column.getFilterValue()??[void 0,void 0];return yo({from:o,to:i,range:()=>e.column.getFacetedMinMaxValues()??[void 0,void 0],onRangeChange:(a,l)=>e.column.setFilterValue([a,l])})}return b.createElement("input",{...t,value:e.column.getFilterValue()||"",className:`form-control form-control-sm ${n}`,type:"text",onChange:o=>e.column.setFilterValue(o.target.value)})};var ee=class e{static{this._empty=new e(new Set)}constructor(n){this._set=n}static empty(){return this._empty}static just(...n){return this.empty().add(...n)}has(n){return this._set.has(n)}add(...n){let t=new Set(this._set.keys());for(let r of n)t.add(r);return new e(t)}toggle(n){return this.has(n)?this.delete(n):this.add(n)}delete(n){let t=new Set(this._set.keys());return t.delete(n),new e(t)}clear(){return e.empty()}[Symbol.iterator](){return this._set[Symbol.iterator]()}toList(){return[...this._set.keys()]}};var ie=class e{static{this._NONE="none"}static{this._ROW_SINGLE="single"}static{this._ROW_MULTIPLE="multiple"}static{this._COL_SINGLE="single"}static{this._col_multiple="multiple"}static{this._RECT_CELL="cell"}static{this._RECT_REGION="region"}static{this._rowEnum={NONE:e._NONE,SINGLE:e._ROW_SINGLE,MULTIPLE:e._ROW_MULTIPLE}}static{this._colEnum={NONE:e._NONE,SINGLE:e._COL_SINGLE,MULTIPLE:e._col_multiple}}static{this._rectEnum={NONE:e._NONE,REGION:e._RECT_REGION,CELL:e._RECT_CELL}}constructor({row:n,col:t,rect:r}){if(!Object.values(e._rowEnum).includes(n))throw new Error(`Invalid row selection mode: ${n}`);if(!Object.values(e._colEnum).includes(t))throw new Error(`Invalid col selection mode: ${t}`);if(!Object.values(e._rectEnum).includes(r))throw new Error(`Invalid rect selection mode: ${r}`);this.row=n,this.col=t,this.rect=r}isNone(){return this.row===e._rowEnum.NONE&&this.col===e._colEnum.NONE&&this.rect===e._rectEnum.NONE}};function Co(e){return e||(e={row:"multiple",col:"none",rect:"none"}),new ie({row:e.row,col:e.col,rect:e.rect})}function Eo({isEditingCell:e,editCellsIsAllowed:n,selectionModes:t,keyAccessor:r,focusOffset:o,focusEscape:i,onKeyDownEnter:s,between:a}){let[l,u]=A(ee.empty()),[f,c]=A(null),g=p=>{if(t.isNone())return;let _=p.currentTarget,m=r(_);if(e&&_.classList.contains(bn[ue.Editing]))return;let y=$s(t,a,l,p,m,f);y&&(u(y.selection),y.anchor&&(c(m),_.focus()),p.preventDefault())},d=p=>{if(e||t.isNone())return;let _=p.currentTarget,m=r(_),y=l.has(m);if(p.key==="Escape"){i(_),p.preventDefault();return}if(t.row===ie._rowEnum.SINGLE){if(p.key===" "||p.key==="Enter")p.preventDefault(),n&&p.key==="Enter"?s(_):l.has(m)?u(ee.empty()):u(ee.just(m));else if(p.key==="ArrowUp"||p.key==="ArrowDown"){let R=o(m,p.key==="ArrowUp"?-1:1);R&&(p.preventDefault(),y&&u(ee.just(R)))}}else t.row===ie._rowEnum.MULTIPLE&&(p.key===" "||p.key==="Enter"?(p.preventDefault(),n&&p.key==="Enter"?s(_):u(l.toggle(m))):(p.key==="ArrowUp"||p.key==="ArrowDown")&&o(m,p.key==="ArrowUp"?-1:1)&&p.preventDefault())};return{has(p){return l.has(p)},set(p,_){u(_?l.add(p):l.delete(p))},setMultiple(p){u(ee.just(...p))},clear(){u(l.clear())},keys(){return l},itemHandlers(){return{onMouseDown:g,onKeyDown:d}},focusOffset:o}}var wo=/^mac/i.test(window.navigator.userAgentData?.platform??window.navigator.platform);function $s(e,n,t,r,o,i){let{shiftKey:s,altKey:a}=r,l=wo?r.metaKey:r.ctrlKey;if((wo?r.ctrlKey:r.metaKey)||a||e.row===ie._rowEnum.NONE)return null;if(e.row===ie._rowEnum.SINGLE)return l&&!s?t.has(o)?{selection:ee.empty(),anchor:!0}:{selection:ee.just(o),anchor:!0}:{selection:ee.just(o),anchor:!0};if(e.row===ie._rowEnum.MULTIPLE)if(s&&l){if(i!==null&&n){let f=n(i,o);return{selection:t.add(...f)}}}else{if(l)return{selection:t.toggle(o),anchor:!0};if(s){if(i!==null&&n){let f=n(i,o);return{selection:ee.just(...f)}}}else return{selection:ee.just(o),anchor:!0}}else throw new Error(`Unsupported row selection mode: ${e.row}`);return null}function Ro({getColDefs:e}){let[n,t]=A([]);return{sorting:n,sortTableStateOptions:{sorting:n},sortTableOptions:{onSortingChange:r=>{let o=typeof r=="function"?r(n):r,i=e(),s=new Set(i.filter(l=>l.meta.isHtmlColumn).map(l=>l.header)),a=s.size==0?o:o.filter(l=>!s.has(l.id));t(a)},getSortedRowModel:zr()},setSorting:t}}var bo="sort-arrow",xo={viewBox:[-1,-1,2,2].map(e=>e*1.4).join(" "),width:"100%",height:"100%",style:{paddingLeft:"3px"}},Mo={stroke:"#333333",strokeWidth:"0.6",fill:"transparent"},Os=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...xo,className:`${bo} sort-arrow-up`},b.createElement("path",{d:"M -1 0.5 L 0 -0.5 L 1 0.5",...Mo,strokeLinecap:"round"})),Ls=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...xo,className:`${bo} sort-arrow-down`},b.createElement("path",{d:"M -1 -0.5 L 0 0.5 L 1 -0.5",...Mo,strokeLinecap:"round"})),Fo=({direction:e})=>{if(!e)return null;if(e==="asc")return Os;if(e==="desc")return Ls;throw new Error(`Unexpected sort direction: '${e}'`)};Ct();var Io=({location:e,rowIndex:n,columnIndex:t})=>`[${e}, ${n}, ${t}]`,To=({initStyleInfos:e,nrow:n,ncol:t})=>{let[r,o]=ze(new Map),i=Y(l=>{let{location:u,rows:f,cols:c}=l;o(g=>{let d=f??Array.from({length:n},(p,_)=>_),h=c??Array.from({length:t},(p,_)=>_);for(let p of d)for(let _ of h){let m=Io({location:u,rowIndex:p,columnIndex:_}),y=g.get(m)??{style:{},class:void 0},R;y.class?l.class?R=`${y.class} ${l.class}`:R=y.class:l.class?R=l.class:R=void 0,g.set(m,{location:u,rowIndex:p,columnIndex:_,style:{...y.style,...l.style},class:R})}})},[t,n,o]),s=Y(()=>{o(l=>{l.clear()})},[o]),a=Y(l=>{s();for(let u of l)i(u)},[i,s]);return L(()=>{a(e)},[e,a]),{styleInfoMap:r,setStyleInfo:i,setStyleInfos:a,resetStyleInfos:s}};var Po=(e,n,t,r)=>{let o=Io({location:n,rowIndex:t,columnIndex:r}),i=e.get(o);return{cellStyle:i?.style,cellClassName:i?.class}},$a=document.createElement("cssStringToObj");var Vo=`
+ color: hsl(${Math.max(0,Math.min(120-120*p,120))}deg 100% 31%);`,t?.key)}return(l=t?.onChange)==null||l.call(t,o),o}}function yt(e,n){if(e===void 0)throw new Error(`Unexpected undefined${n?`: ${n}`:""}`);return e}var Jr=(e,n)=>Math.abs(e-n)<1,Qr=(e,n,t)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,o),t)}};var Es=e=>e,Rs=e=>{let n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=n;o<=t;o++)r.push(o);return r},eo=(e,n)=>{let t=e.scrollElement;if(!t)return;let r=e.targetWindow;if(!r)return;let o=s=>{let{width:a,height:l}=s;n({width:Math.round(a),height:Math.round(l)})};if(o(t.getBoundingClientRect()),!r.ResizeObserver)return()=>{};let i=new r.ResizeObserver(s=>{let a=s[0];if(a?.borderBoxSize){let l=a.borderBoxSize[0];if(l){o({width:l.inlineSize,height:l.blockSize});return}}o(t.getBoundingClientRect())});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},Zr={passive:!0};var bs=typeof window>"u"?!0:"onscrollend"in window,to=(e,n)=>{let t=e.scrollElement;if(!t)return;let r=e.targetWindow;if(!r)return;let o=0,i=bs?()=>{}:Qr(r,()=>{n(o,!1)},e.options.isScrollingResetDelay),s=u=>()=>{o=t[e.options.horizontal?"scrollLeft":"scrollTop"],i(),n(o,u)},a=s(!0),l=s(!1);return l(),t.addEventListener("scroll",a,Zr),t.addEventListener("scrollend",l,Zr),()=>{t.removeEventListener("scroll",a),t.removeEventListener("scrollend",l)}};var xs=(e,n,t)=>{if(n?.borderBoxSize){let r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[t.options.horizontal?"width":"height"])};var no=(e,{adjustments:n=0,behavior:t},r)=>{var o,i;let s=e+n;(i=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[r.options.horizontal?"left":"top"]:s,behavior:t})},vt=class{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null,r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{this._measureElement(i.target,i)})}));return{disconnect:()=>{var o;return(o=r())==null?void 0:o.disconnect()},observe:o=>{var i;return(i=r())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=r())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,o])=>{typeof o>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Es,rangeExtractor:Rs,onChange:()=>{},measureElement:xs,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,...t}},this.notify=(t,r)=>{var o,i;let{startIndex:s,endIndex:a}=this.range??{startIndex:void 0,endIndex:void 0},l=this.calculateRange();(t||s!==l?.startIndex||a!==l?.endIndex)&&((i=(o=this.options).onChange)==null||i.call(o,this,r))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.observer.disconnect(),this.elementsCache.clear()},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.notify(!1,!1);return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{let o=new Map,i=new Map;for(let s=r-1;s>=0;s--){let a=t[s];if(o.has(a.lane))continue;let l=i.get(a.lane);if(l==null||a.end>l.end?i.set(a.lane,a):a.ends.end===a.end?s.index-a.index:s.end-a.end)[0]:void 0},this.getMeasurementOptions=ze(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,o,i,s)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s}),{key:!1}),this.getMeasurements=ze(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s},a)=>{var l;if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(c=>{this.itemSizeCache.set(c.key,c.size)}));let u=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let f=this.measurementsCache.slice(0,u);for(let c=u;c{let I=i(c),D=this.elementsCache.get(I);if(!P){D&&(this.observer.unobserve(D),this.elementsCache.delete(I));return}D!==P&&(D&&this.observer.unobserve(D),this.observer.observe(P),this.elementsCache.set(I,P)),P.isConnected&&this.resizeItem(c,this.options.measureElement(P,void 0,this))});let d=i(c),h=this.options.lanes===1?f[c-1]:this.getFurthestMeasurement(f,c),p=h?h.end+this.options.gap:r+o,_=a.get(d),m=typeof _=="number"?_:this.options.estimateSize(c),y=p+m,R=h?h.lane:c%this.options.lanes;f[c]={index:c,start:p,size:m,end:y,key:d,lane:R,measureElement:g}}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ze(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(t,r,o)=>this.range=t.length>0&&r>0?Ms({measurements:t,outerSize:r,scrollOffset:o}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=ze(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(t,r,o,i)=>r===null?[]:t({startIndex:r.startIndex,endIndex:r.endIndex,overscan:o,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{let r=this.options.indexAttribute,o=t.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{let o=this.indexFromElement(t),i=this.getMeasurements()[o];if(!i||!t.isConnected){this.elementsCache.forEach((a,l)=>{a===t&&(this.observer.unobserve(t),this.elementsCache.delete(l))});return}let s=this.elementsCache.get(i.key);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(i.key,t)),this.resizeItem(o,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{let o=this.getMeasurements()[t];if(!o)return;let i=this.itemSizeCache.get(o.key)??o.size,s=r-i;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,s,this):o.start{t&&this._measureElement(t,void 0)},this.getVirtualItems=ze(()=>[this.getIndexes(),this.getMeasurements()],(t,r)=>{let o=[];for(let i=0,s=t.length;ithis.options.debug}),this.getVirtualItemForOffset=t=>{let r=this.getMeasurements();if(r.length!==0)return yt(r[ro(0,r.length-1,o=>yt(r[o]).start,t)])},this.getOffsetForAlignment=(t,r)=>{let o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(t<=i?r="start":t>=i+o?r="end":r="start"),r==="start"?t=t:r==="end"?t=t-o:r==="center"&&(t=t-o/2);let s=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[s]:this.scrollElement[s]:0)-o;return Math.max(Math.min(l,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let o=this.getMeasurements()[t];if(!o)return;let i=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];let a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(t,{align:r="start",behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(t,{align:r="auto",behavior:o}={})=>{t=Math.max(0,Math.min(t,this.options.count-1)),this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");let i=this.getOffsetForIndex(t,r);if(!i)return;let[s,a]=i;this._scrollToOffset(s,{adjustments:void 0,behavior:o}),o!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(t))){let[u]=yt(this.getOffsetForIndex(t,a));Jr(u,this.getScrollOffset())||this.scrollToIndex(t,{align:a,behavior:o})}else this.scrollToIndex(t,{align:a,behavior:o})}))},this.scrollBy=(t,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;let r=this.getMeasurements(),o;return r.length===0?o=this.options.paddingStart:o=this.options.lanes===1?((t=r[r.length-1])==null?void 0:t.end)??0:Math.max(...r.slice(-this.options.lanes).map(i=>i.end)),o-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(t,{adjustments:r,behavior:o})=>{this.options.scrollToFn(t,{behavior:o,adjustments:r},this)},this.measure=()=>{var t,r;this.itemSizeCache=new Map,(r=(t=this.options).onChange)==null||r.call(t,this,!1)},this.setOptions(n)}},ro=(e,n,t,r)=>{for(;e<=n;){let o=(e+n)/2|0,i=t(o);if(ir)n=o-1;else return o}return e>0?e-1:0};function Ms({measurements:e,outerSize:n,scrollOffset:t}){let r=e.length-1,i=ro(0,r,a=>e[a].start,t),s=i;for(;s({}),{})[1],t={...e,onChange:(o,i)=>{var s;i?tn(n):n(),(s=e.onChange)==null||s.call(e,o,i)}},[r]=H(()=>new vt(t));return r.setOptions(t),V(()=>r._didMount(),[]),Fs(()=>r._willUpdate()),r}function oo(e){return Is({observeElementRect:eo,observeElementOffset:to,scrollToFn:no,...e})}function io(e){return{render:function(n){Qt(n,e)},unmount:function(){en(e)}}}var fo=Symbol.for("immer-nothing"),so=Symbol.for("immer-draftable"),T=Symbol.for("immer-state");function le(e,...n){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ge=Object.getPrototypeOf;function Be(e){return!!e&&!!e[T]}function ve(e){return e?go(e)||Array.isArray(e)||!!e[so]||!!e.constructor?.[so]||Rt(e)||bt(e):!1}var Ts=Object.prototype.constructor.toString();function go(e){if(!e||typeof e!="object")return!1;let n=Ge(e);if(n===null)return!0;let t=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return t===Object?!0:typeof t=="function"&&Function.toString.call(t)===Ts}function Ue(e,n){Et(e)===0?Object.entries(e).forEach(([t,r])=>{n(t,r,e)}):e.forEach((t,r)=>n(r,t,e))}function Et(e){let n=e[T];return n?n.type_:Array.isArray(e)?1:Rt(e)?2:bt(e)?3:0}function Cn(e,n){return Et(e)===2?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function po(e,n,t){let r=Et(e);r===2?e.set(n,t):r===3?e.add(t):e[n]=t}function Ps(e,n){return e===n?e!==0||1/e===1/n:e!==e&&n!==n}function Rt(e){return e instanceof Map}function bt(e){return e instanceof Set}function B(e){return e.copy_||e.base_}function En(e,n){if(Rt(e))return new Map(e);if(bt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!n&&go(e))return Ge(e)?{...e}:Object.assign(Object.create(null),e);let t=Object.getOwnPropertyDescriptors(e);delete t[T];let r=Reflect.ownKeys(t);for(let o=0;o1&&(e.set=e.add=e.clear=e.delete=Ds),Object.freeze(e),n&&Ue(e,(t,r)=>Ke(r,!0),!0)),e}function Ds(){le(2)}function xt(e){return Object.isFrozen(e)}var Rn={};function De(e){let n=Rn[e];return n||le(0,e),n}function Vs(e,n){Rn[e]||(Rn[e]=n)}var nt;function St(){return nt}function $s(e,n){return{drafts_:[],parent_:e,immer_:n,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function lo(e,n){n&&(De("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=n)}function bn(e){xn(e),e.drafts_.forEach(Ls),e.drafts_=null}function xn(e){e===nt&&(nt=e.parent_)}function ao(e){return nt=$s(nt,e)}function Ls(e){let n=e[T];n.type_===0||n.type_===1?n.revoke_():n.revoked_=!0}function uo(e,n){n.unfinalizedDrafts_=n.drafts_.length;let t=n.drafts_[0];return e!==void 0&&e!==t?(t[T].modified_&&(bn(n),le(4)),ve(e)&&(e=wt(n,e),n.parent_||Ct(n,e)),n.patches_&&De("Patches").generateReplacementPatches_(t[T].base_,e,n.patches_,n.inversePatches_)):e=wt(n,t,[]),bn(n),n.patches_&&n.patchListener_(n.patches_,n.inversePatches_),e!==fo?e:void 0}function wt(e,n,t){if(xt(n))return n;let r=n[T];if(!r)return Ue(n,(o,i)=>co(e,r,n,o,i,t),!0),n;if(r.scope_!==e)return n;if(!r.modified_)return Ct(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;let o=r.copy_,i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),Ue(i,(a,l)=>co(e,r,o,a,l,t,s)),Ct(e,o,!1),t&&e.patches_&&De("Patches").generatePatches_(r,t,e.patches_,e.inversePatches_)}return r.copy_}function co(e,n,t,r,o,i,s){if(Be(o)){let a=i&&n&&n.type_!==3&&!Cn(n.assigned_,r)?i.concat(r):void 0,l=wt(e,o,a);if(po(t,r,l),Be(l))e.canAutoFreeze_=!1;else return}else s&&t.add(o);if(ve(o)&&!xt(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;wt(e,o),(!n||!n.scope_.parent_)&&Ct(e,o)}}function Ct(e,n,t=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ke(n,t)}function Os(e,n){let t=Array.isArray(e),r={type_:t?1:0,scope_:n?n.scope_:St(),modified_:!1,finalized_:!1,assigned_:{},parent_:n,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=r,i=Mn;t&&(o=[r],i=rt);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Mn={get(e,n){if(n===T)return e;let t=B(e);if(!Cn(t,n))return ks(e,t,n);let r=t[n];return e.finalized_||!ve(r)?r:r===Sn(e.base_,n)?(wn(e),e.copy_[n]=ot(r,e)):r},has(e,n){return n in B(e)},ownKeys(e){return Reflect.ownKeys(B(e))},set(e,n,t){let r=ho(B(e),n);if(r?.set)return r.set.call(e.draft_,t),!0;if(!e.modified_){let o=Sn(B(e),n),i=o?.[T];if(i&&i.base_===t)return e.copy_[n]=t,e.assigned_[n]=!1,!0;if(Ps(t,o)&&(t!==void 0||Cn(e.base_,n)))return!0;wn(e),ye(e)}return e.copy_[n]===t&&(t!==void 0||n in e.copy_)||Number.isNaN(t)&&Number.isNaN(e.copy_[n])||(e.copy_[n]=t,e.assigned_[n]=!0),!0},deleteProperty(e,n){return Sn(e.base_,n)!==void 0||n in e.base_?(e.assigned_[n]=!1,wn(e),ye(e)):delete e.assigned_[n],e.copy_&&delete e.copy_[n],!0},getOwnPropertyDescriptor(e,n){let t=B(e),r=Reflect.getOwnPropertyDescriptor(t,n);return r&&{writable:!0,configurable:e.type_!==1||n!=="length",enumerable:r.enumerable,value:t[n]}},defineProperty(){le(11)},getPrototypeOf(e){return Ge(e.base_)},setPrototypeOf(){le(12)}},rt={};Ue(Mn,(e,n)=>{rt[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}});rt.deleteProperty=function(e,n){return rt.set.call(this,e,n,void 0)};rt.set=function(e,n,t){return Mn.set.call(this,e[0],n,t,e[0])};function Sn(e,n){let t=e[T];return(t?B(t):e)[n]}function ks(e,n,t){let r=ho(n,t);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function ho(e,n){if(!(n in e))return;let t=Ge(e);for(;t;){let r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;t=Ge(t)}}function ye(e){e.modified_||(e.modified_=!0,e.parent_&&ye(e.parent_))}function wn(e){e.copy_||(e.copy_=En(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Hs=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(n,t,r)=>{if(typeof n=="function"&&typeof t!="function"){let i=t;t=n;let s=this;return function(l=i,...u){return s.produce(l,f=>t.call(this,f,...u))}}typeof t!="function"&&le(6),r!==void 0&&typeof r!="function"&&le(7);let o;if(ve(n)){let i=ao(this),s=ot(n,void 0),a=!0;try{o=t(s),a=!1}finally{a?bn(i):xn(i)}return lo(i,r),uo(o,i)}else if(!n||typeof n!="object"){if(o=t(n),o===void 0&&(o=n),o===fo&&(o=void 0),this.autoFreeze_&&Ke(o,!0),r){let i=[],s=[];De("Patches").generateReplacementPatches_(n,o,i,s),r(i,s)}return o}else le(1,n)},this.produceWithPatches=(n,t)=>{if(typeof n=="function")return(s,...a)=>this.produceWithPatches(s,l=>n(l,...a));let r,o;return[this.produce(n,t,(s,a)=>{r=s,o=a}),r,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ve(e)||le(8),Be(e)&&(e=As(e));let n=ao(this),t=ot(e,void 0);return t[T].isManual_=!0,xn(n),t}finishDraft(e,n){let t=e&&e[T];(!t||!t.isManual_)&&le(9);let{scope_:r}=t;return lo(r,n),uo(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,n){let t;for(t=n.length-1;t>=0;t--){let o=n[t];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}t>-1&&(n=n.slice(t+1));let r=De("Patches").applyPatches_;return Be(e)?r(e,n):this.produce(e,o=>r(o,n))}};function ot(e,n){let t=Rt(e)?De("MapSet").proxyMap_(e,n):bt(e)?De("MapSet").proxySet_(e,n):Os(e,n);return(n?n.scope_:St()).drafts_.push(t),t}function As(e){return Be(e)||le(10,e),mo(e)}function mo(e){if(!ve(e)||xt(e))return e;let n=e[T],t;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,t=En(e,n.scope_.immer_.useStrictShallowCopy_)}else t=En(e,!0);return Ue(t,(r,o)=>{po(t,r,mo(o))}),n&&(n.finalized_=!1),t}function Mt(){class e extends Map{constructor(l,u){super(),this[T]={type_:2,parent_:u,scope_:u?u.scope_:St(),modified_:!1,finalized_:!1,copy_:void 0,assigned_:void 0,base_:l,draft_:this,isManual_:!1,revoked_:!1}}get size(){return B(this[T]).size}has(l){return B(this[T]).has(l)}set(l,u){let f=this[T];return s(f),(!B(f).has(l)||B(f).get(l)!==u)&&(t(f),ye(f),f.assigned_.set(l,!0),f.copy_.set(l,u),f.assigned_.set(l,!0)),this}delete(l){if(!this.has(l))return!1;let u=this[T];return s(u),t(u),ye(u),u.base_.has(l)?u.assigned_.set(l,!1):u.assigned_.delete(l),u.copy_.delete(l),!0}clear(){let l=this[T];s(l),B(l).size&&(t(l),ye(l),l.assigned_=new Map,Ue(l.base_,u=>{l.assigned_.set(u,!1)}),l.copy_.clear())}forEach(l,u){let f=this[T];B(f).forEach((c,g,d)=>{l.call(u,this.get(g),g,this)})}get(l){let u=this[T];s(u);let f=B(u).get(l);if(u.finalized_||!ve(f)||f!==u.base_.get(l))return f;let c=ot(f,u);return t(u),u.copy_.set(l,c),c}keys(){return B(this[T]).keys()}values(){let l=this.keys();return{[Symbol.iterator]:()=>this.values(),next:()=>{let u=l.next();return u.done?u:{done:!1,value:this.get(u.value)}}}}entries(){let l=this.keys();return{[Symbol.iterator]:()=>this.entries(),next:()=>{let u=l.next();if(u.done)return u;let f=this.get(u.value);return{done:!1,value:[u.value,f]}}}}[Symbol.iterator](){return this.entries()}}function n(a,l){return new e(a,l)}function t(a){a.copy_||(a.assigned_=new Map,a.copy_=new Map(a.base_))}class r extends Set{constructor(l,u){super(),this[T]={type_:3,parent_:u,scope_:u?u.scope_:St(),modified_:!1,finalized_:!1,copy_:void 0,base_:l,draft_:this,drafts_:new Map,revoked_:!1,isManual_:!1}}get size(){return B(this[T]).size}has(l){let u=this[T];return s(u),u.copy_?!!(u.copy_.has(l)||u.drafts_.has(l)&&u.copy_.has(u.drafts_.get(l))):u.base_.has(l)}add(l){let u=this[T];return s(u),this.has(l)||(i(u),ye(u),u.copy_.add(l)),this}delete(l){if(!this.has(l))return!1;let u=this[T];return s(u),i(u),ye(u),u.copy_.delete(l)||(u.drafts_.has(l)?u.copy_.delete(u.drafts_.get(l)):!1)}clear(){let l=this[T];s(l),B(l).size&&(i(l),ye(l),l.copy_.clear())}values(){let l=this[T];return s(l),i(l),l.copy_.values()}entries(){let l=this[T];return s(l),i(l),l.copy_.entries()}keys(){return this.values()}[Symbol.iterator](){return this.values()}forEach(l,u){let f=this.values(),c=f.next();for(;!c.done;)l.call(u,c.value,c.value,this),c=f.next()}}function o(a,l){return new r(a,l)}function i(a){a.copy_||(a.copy_=new Set,a.base_.forEach(l=>{if(ve(l)){let u=ot(l,a);a.drafts_.set(l,u),a.copy_.add(u)}else a.copy_.add(l)}))}function s(a){a.revoked_&&le(3,JSON.stringify(B(a)))}Vs("MapSet",{proxyMap_:n,proxySet_:o})}var ne=new Hs,_o=ne.produce,Pl=ne.produceWithPatches.bind(ne),Dl=ne.setAutoFreeze.bind(ne),Vl=ne.setUseStrictShallowCopy.bind(ne),$l=ne.applyPatches.bind(ne),Ll=ne.createDraft.bind(ne),Ol=ne.finishDraft.bind(ne);function xe(e){var n=H(function(){return Ke(typeof e=="function"?e():e,!0)}),t=n[1];return[n[0],J(function(r){t(typeof r=="function"?_o(r):Ke(r))},[])]}function Ns(e,n,t,r,o){window.Shiny.shinyapp.makeRequest(e,n,t,r,o)}function yo({method:e,args:n,blobs:t}){return new Promise((r,o)=>{Ns(e,n,i=>{r(i)},i=>{o(i)},t)})}function Fn({setData:e,newPatches:n,setCellEditMapAtLoc:t}){e(r=>{n.forEach(({rowIndex:o,columnIndex:i,value:s})=>{r[o][i]=s})}),n.forEach(({rowIndex:r,columnIndex:o,value:i})=>{t(r,o,s=>{s.value=i,s.state=fe.EditSuccess,s.errorTitle=void 0})})}function In(e){return e.map(t=>({rowIndex:t.row_index,columnIndex:t.column_index,value:t.value}))}function zs(e){return e.map(t=>({row_index:t.rowIndex,column_index:t.columnIndex,value:t.value}))}function vo({patchInfo:e,patches:n,onSuccess:t,onError:r,columns:o,setData:i,setCellEditMapAtLoc:s}){let a=zs(n);yo({method:e.key,args:[a]}).then(l=>{if(!Array.isArray(l))throw new Error("Expected a response of a list of patches");for(let f of l)if(!("row_index"in f&&"column_index"in f&&"value"in f))throw new Error("Expected list of patches containing `row_index`, `column_index`, and `value`");l=l;let u=In(l);n.forEach(({rowIndex:f,columnIndex:c,value:g})=>{s(f,c,d=>{d.state===fe.EditSaving&&(d.state=fe.Ready,d.value=g,d.errorTitle=void 0)})}),Fn({setData:i,newPatches:u,setCellEditMapAtLoc:s}),t(u)}).catch(l=>{n.forEach(({rowIndex:u,columnIndex:f,value:c})=>{s(u,f,g=>{g.value=String(c),g.state=fe.EditFailure,g.errorTitle=String(l)})}),r(l)})}var fe={EditSaving:"EditSaving",EditSuccess:"EditSuccess",EditFailure:"EditFailure",Editing:"Editing",Ready:"Ready"},Dn={EditSaving:"cell-edit-saving",EditSuccess:"cell-edit-success",EditFailure:"cell-edit-failure",Editing:"cell-edit-editing",Ready:void 0},Pn=e=>e!==null&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"isShinyHtml")&&e.isShinyHtml===!0,Tn=e=>e===null?"":Pn(e)?e.obj.html:e,So=({containerRef:e,rowId:n,cell:t,patchInfo:r,columns:o,coldefs:i,rowIndex:s,columnIndex:a,editCellsIsAllowed:l,getSortedRowModel:u,cellEditInfo:f,cellStyle:c,cellClassName:g,setData:d,setCellEditMapAtLoc:h,selection:p})=>{let _=t.getValue(),m=t.column.columnDef.meta.isHtmlColumn,y=f?.value??_,R=f?.state??fe.Ready,P=f?.errorTitle,I=f?.isEditing??!1,D=f?.editValue??Tn(y),q=Q(null),U=Q(null),K=J(({resetIsEditing:M=!1,resetEditValue:O=!1}={resetIsEditing:!0,resetEditValue:!0})=>{h(s,a,z=>{M&&(z.isEditing=!1),O&&(z.editValue=void 0)})},[s,a,h]),G=M=>{M.key==="Escape"&&(M.preventDefault(),M.stopPropagation(),K(),p.focusOffset(n,0))},Z=M=>{if(M.key!=="Tab")return;M.preventDefault(),M.stopPropagation();let O=M.shiftKey,z=a;for(;;){let W=z+(O?-1:1);if(W<0||W>=i.length)return;if(z=W,i[W].meta.isHtmlColumn!==!0)break}Ve(),h(s,z,W=>{W.isEditing=!0})},je=M=>{if(M.key!=="Enter")return;M.preventDefault(),M.stopPropagation();let O=M.shiftKey,z=u(),W=z.rows.findIndex(Oe=>Oe.id===n);if(W<0)return;let Xe=W+(O?-1:1);if(Xe<0||Xe>=z.rows.length)return;Ve();let Le=z.rows[Xe].index;h(Le,a,Oe=>{Oe.isEditing=!0})},it=M=>{[G,je,Z].forEach(O=>O(M))},Ve=J(()=>{if(h(s,a,M=>{M.errorTitle=void 0}),`${Tn(y)}`==`${D}`){K(),h(s,a,M=>{M.state=R});return}K({resetIsEditing:!0}),h(s,a,M=>{M.state=fe.EditSaving}),vo({patchInfo:r,patches:[{rowIndex:s,columnIndex:a,value:D}],onSuccess:M=>{K({resetEditValue:!0})},onError:M=>{},columns:o,setData:d,setCellEditMapAtLoc:h})},[h,s,a,y,D,K,r,o,d,R]);V(()=>{I&&U.current&&(U.current.focus(),U.current.select())},[I]),V(()=>{if(!I||!q.current||!U.current)return;let M=W=>{q.current?.contains(W.target)&&W.stopPropagation()},O=q.current;O.addEventListener("mousedown",M);let z=W=>{W.target!==U.current&&(Ve(),K())};return document.body.addEventListener("mousedown",z),()=>{O.removeEventListener("mousedown",M),document.body.removeEventListener("mousedown",z)}},[R,Ve,s,a,I,K]);function qe(M){I&&M.target.select()}function On(M){h(s,a,O=>{O.editValue=M.target.value})}let We,Se,we=P,$e=g,Ce=M=>{M&&($e?($e+=" ",$e+=M):$e=M)};Ce(Dn[I?fe.Editing:R]);let pe=!1,st=null;return R===fe.EditSaving?Se=D:(I?st=x.createElement("textarea",{value:String(D),onChange:On,onFocus:qe,onKeyDown:it,ref:U}):m?Ce("cell-html"):l&&(Ce("cell-editable"),We=M=>{h(s,a,O=>{O.isEditing=!0,O.editValue=Tn(y)})}),Pn(y)?pe=!0:Se=_t(t.column.columnDef.cell,t.getContext())),V(()=>{if(!q.current||!pe||!Pn(y))return;let M=JSON.parse(JSON.stringify(y.obj));window.Shiny.renderContentAsync(q.current,M);let O=q.current;return()=>{window.Shiny.unbindAll(O),O.replaceChildren("")}},[q,y,s,a,pe]),x.createElement("td",{ref:q,onDoubleClick:We,title:we,className:$e,style:{...c}},st,Se)};var wo=()=>{let[e,n]=xe(new Map);return Mt(),{cellEditMap:e,setCellEditMapAtLoc:(r,o,i)=>{n(s=>{let a=Co(r,o),l=s.get(a)??{};i(l),s.set(a,l)})},resetCellEditMap:()=>{n(new Map)}}},Co=(e,n)=>`[${e}, ${n}]`;var Eo=(e,n,t)=>{let r=Co(n,t);return[e.get(r)??{},r]};function Ft(e,n,t){let r=Object.assign({top:0,right:0,bottom:0,left:0},t),o=e,i=o.scrollTop+r.top,s=o.scrollLeft+r.left,a=i+o.clientHeight-r.top-r.bottom,l=s+o.clientWidth-r.left-r.right;for(let u=0;u=i&&c<=a&&g>=s&&g<=l)return f}return null}function Vn(e,n){return document?.defaultView?.getComputedStyle(e,null)?.getPropertyValue(n)}var xo=e=>{let[n,t]=H(!1),{range:r,from:o,to:i,onRangeChange:s}=e;return x.createElement(Gs,{range:r,value:[o,i],editing:n,onValueChange:a=>s(...a),onFocus:()=>t(!0),onBlur:()=>t(!1)})};var Gs=e=>{let[n,t]=e.value,{editing:r,onFocus:o}=e,[i,s]=e.range(),a=Q(null),l=Q(null);return x.createElement("div",{onBlur:u=>{if(!u.currentTarget.contains(u.relatedTarget))return e.onBlur()},onFocus:()=>o(),style:{display:"flex",gap:"0.5rem"}},x.createElement("input",{ref:a,className:`form-control form-control-sm ${a.current?.checkValidity()?"":"is-invalid"}`,style:{flex:"1 1 0",width:"0"},type:"number",placeholder:Ro(r,"Min",i),defaultValue:n,step:"any",onChange:u=>{let f=bo(u.target.value);a.current&&(a.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([f,t]))}}),x.createElement("input",{ref:l,className:`form-control form-control-sm ${l.current?.checkValidity()?"":"is-invalid"}`,style:{flex:"1 1 0",width:"0"},type:"number",placeholder:Ro(r,"Max",s),defaultValue:t,step:"any",onChange:u=>{let f=bo(u.target.value);l.current&&(l.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([n,f]))}}))};function Ro(e,n,t){if(e)return typeof t>"u"?n:`${n} (${t})`}function bo(e){if(e!=="")return+e}function Mo(e){let[n,t]=H([]),r=e?{getFilteredRowModel:Wr(),getFacetedRowModel:jr(),getFacetedUniqueValues:qr(),getFacetedMinMaxValues:Ur(),filterFns:{substring:(o,i,s,a)=>o.getValue(i)?.toString().includes(s)??!1},onColumnFiltersChange:t}:{};return{columnFilters:n,columnFiltersState:{columnFilters:n},filtersTableOptions:r,setColumnFilters:t}}var Fo=({header:e,className:n,...t})=>{let r=e.column.columnDef.meta?.typeHint;if(!r||r.type==="html")return null;if(r.type==="numeric"){let[o,i]=e.column.getFilterValue()??[void 0,void 0];return xo({from:o,to:i,range:()=>e.column.getFacetedMinMaxValues()??[void 0,void 0],onRangeChange:(a,l)=>e.column.setFilterValue([a,l])})}return x.createElement("input",{...t,value:e.column.getFilterValue()||"",className:`form-control form-control-sm ${n}`,type:"text",onChange:o=>e.column.setFilterValue(o.target.value)})};var re=class e{static{this._empty=new e(new Set)}constructor(n){this._set=n}static empty(){return this._empty}static just(...n){return this.empty().add(...n)}has(n){return this._set.has(n)}add(...n){let t=new Set(this._set.keys());for(let r of n)t.add(r);return new e(t)}toggle(n){return this.has(n)?this.delete(n):this.add(n)}delete(n){let t=new Set(this._set.keys());return t.delete(n),new e(t)}clear(){return e.empty()}[Symbol.iterator](){return this._set[Symbol.iterator]()}toList(){return[...this._set.keys()]}};var ae=class e{static{this._NONE="none"}static{this._ROW_SINGLE="single"}static{this._ROW_MULTIPLE="multiple"}static{this._COL_SINGLE="single"}static{this._col_multiple="multiple"}static{this._RECT_CELL="cell"}static{this._RECT_REGION="region"}static{this._rowEnum={NONE:e._NONE,SINGLE:e._ROW_SINGLE,MULTIPLE:e._ROW_MULTIPLE}}static{this._colEnum={NONE:e._NONE,SINGLE:e._COL_SINGLE,MULTIPLE:e._col_multiple}}static{this._rectEnum={NONE:e._NONE,REGION:e._RECT_REGION,CELL:e._RECT_CELL}}constructor({row:n,col:t,rect:r}){if(!Object.values(e._rowEnum).includes(n))throw new Error(`Invalid row selection mode: ${n}`);if(!Object.values(e._colEnum).includes(t))throw new Error(`Invalid col selection mode: ${t}`);if(!Object.values(e._rectEnum).includes(r))throw new Error(`Invalid rect selection mode: ${r}`);this.row=n,this.col=t,this.rect=r}isNone(){return this.row===e._rowEnum.NONE&&this.col===e._colEnum.NONE&&this.rect===e._rectEnum.NONE}};function To(e){return e||(e={row:"multiple",col:"none",rect:"none"}),new ae({row:e.row,col:e.col,rect:e.rect})}function Po({isEditingCell:e,editCellsIsAllowed:n,selectionModes:t,keyAccessor:r,focusOffset:o,focusEscape:i,onKeyDownEnter:s,between:a}){let[l,u]=H(re.empty()),[f,c]=H(null),g=p=>{if(t.isNone())return;let _=p.currentTarget,m=r(_);if(e&&_.classList.contains(Dn[fe.Editing]))return;let y=Bs(t,a,l,p,m,f);y&&(u(y.selection),y.anchor&&(c(m),_.focus()),p.preventDefault())},d=p=>{if(e||t.isNone())return;let _=p.currentTarget,m=r(_),y=l.has(m);if(p.key==="Escape"){i(_),p.preventDefault();return}if(t.row===ae._rowEnum.SINGLE){if(p.key===" "||p.key==="Enter")p.preventDefault(),n&&p.key==="Enter"?s(_):l.has(m)?u(re.empty()):u(re.just(m));else if(p.key==="ArrowUp"||p.key==="ArrowDown"){let R=o(m,p.key==="ArrowUp"?-1:1);R&&(p.preventDefault(),y&&u(re.just(R)))}}else t.row===ae._rowEnum.MULTIPLE&&(p.key===" "||p.key==="Enter"?(p.preventDefault(),n&&p.key==="Enter"?s(_):u(l.toggle(m))):(p.key==="ArrowUp"||p.key==="ArrowDown")&&o(m,p.key==="ArrowUp"?-1:1)&&p.preventDefault())};return{has(p){return l.has(p)},set(p,_){u(_?l.add(p):l.delete(p))},setMultiple(p){u(re.just(...p))},clear(){u(l.clear())},keys(){return l},itemHandlers(){return{onMouseDown:g,onKeyDown:d}},focusOffset:o}}var Io=/^mac/i.test(window.navigator.userAgentData?.platform??window.navigator.platform);function Bs(e,n,t,r,o,i){let{shiftKey:s,altKey:a}=r,l=Io?r.metaKey:r.ctrlKey;if((Io?r.ctrlKey:r.metaKey)||a||e.row===ae._rowEnum.NONE)return null;if(e.row===ae._rowEnum.SINGLE)return l&&!s?t.has(o)?{selection:re.empty(),anchor:!0}:{selection:re.just(o),anchor:!0}:{selection:re.just(o),anchor:!0};if(e.row===ae._rowEnum.MULTIPLE)if(s&&l){if(i!==null&&n){let f=n(i,o);return{selection:t.add(...f)}}}else{if(l)return{selection:t.toggle(o),anchor:!0};if(s){if(i!==null&&n){let f=n(i,o);return{selection:re.just(...f)}}}else return{selection:re.just(o),anchor:!0}}else throw new Error(`Unsupported row selection mode: ${e.row}`);return null}function Do({getColDefs:e}){let[n,t]=H([]);return{sorting:n,sortTableStateOptions:{sorting:n},sortTableOptions:{onSortingChange:r=>{let o=typeof r=="function"?r(n):r,i=e(),s=new Set(i.filter(l=>l.meta.isHtmlColumn).map(l=>l.header)),a=s.size==0?o:o.filter(l=>!s.has(l.id));t(a)},getSortedRowModel:Xr()},setSorting:t}}var Vo="sort-arrow",$o={viewBox:[-1,-1,2,2].map(e=>e*1.4).join(" "),width:"100%",height:"100%",style:{paddingLeft:"3px"}},Lo={stroke:"#333333",strokeWidth:"0.6",fill:"transparent"},Us=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...$o,className:`${Vo} sort-arrow-up`},x.createElement("path",{d:"M -1 0.5 L 0 -0.5 L 1 0.5",...Lo,strokeLinecap:"round"})),Ks=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...$o,className:`${Vo} sort-arrow-down`},x.createElement("path",{d:"M -1 -0.5 L 0 0.5 L 1 -0.5",...Lo,strokeLinecap:"round"})),Oo=({direction:e})=>{if(!e)return null;if(e==="asc")return Us;if(e==="desc")return Ks;throw new Error(`Unexpected sort direction: '${e}'`)};Mt();var ko=({location:e,rowIndex:n,columnIndex:t})=>`[${e}, ${n}, ${t}]`,Ho=({initStyleInfos:e,nrow:n,ncol:t})=>{let[r,o]=xe(new Map),i=J(l=>{let{location:u,rows:f,cols:c}=l;o(g=>{let d=f??Array.from({length:n},(p,_)=>_),h=c??Array.from({length:t},(p,_)=>_);for(let p of d)for(let _ of h){let m=ko({location:u,rowIndex:p,columnIndex:_}),y=g.get(m)??{style:{},class:void 0},R;y.class?l.class?R=`${y.class} ${l.class}`:R=y.class:l.class?R=l.class:R=void 0,g.set(m,{location:u,rowIndex:p,columnIndex:_,style:{...y.style,...l.style},class:R})}})},[t,n,o]),s=J(()=>{o(l=>{l.clear()})},[o]),a=J(l=>{s();for(let u of l)i(u)},[i,s]);return V(()=>{a(e)},[e,a]),{styleInfoMap:r,setStyleInfo:i,setStyleInfos:a,resetStyleInfos:s}};var Ao=(e,n,t,r)=>{let o=ko({location:n,rowIndex:t,columnIndex:r}),i=e.get(o);return{cellStyle:i?.style,cellClassName:i?.class}},Ba=document.createElement("cssStringToObj");var No=`
/*
*
* # Variables
@@ -261,7 +261,7 @@ shiny-data-frame .shiny-data-grid > table > tbody > tr > td.cell-edit-saving {
shiny-data-frame .shiny-data-grid > table > tbody > tr > td.cell-edit-failure {
outline: 2px var(--shiny-datagrid-table-cell-edit-failure-border-style) var(--shiny-datagrid-table-cell-edit-failure-border-color);
background-color: var(--shiny-datagrid-table-cell-edit-failure-bgcolor);
-}`;function Do(e,n,t){let[r,o]=A(0),i=b.useCallback(a=>{o(-1),a.target===a.currentTarget&&Et(e,n(),t)?.focus()},[e,n,t]),s=b.useCallback(a=>{o(0)},[]);return{containerTabIndex:r,containerHandlers:{onFocus:i,onBlur:s}}}function $o(e,n,t,r,o){return re(()=>{let i=e??!0;if(!i)return null;let s=typeof i=="string"?i:"Viewing rows {start} through {end} of {total}";if(!n||t.length===0||!r)return null;let a=n.scrollTop+r.clientHeight,l=n.scrollTop+n.clientHeight,[u,f]=ks(a,l,t,(h,p)=>h.start+h.size/2);if(u===null||f===null)return null;let c=t[u],g=t[f];if(c===void 0||g===void 0||c.index===0&&g.index===o-1)return null;let d=Hs(s,c.index+1,g.index+1,o);return b.createElement("div",{className:"shiny-data-grid-summary"},d)},[e,n,t,r,o])}function ks(e,n,t,r){let o=null,i=null;for(let s=0;s=e&&(o=s,i=s);else if(r(a,!1)<=n)i=s;else break}return[o,i]}function Hs(e,n,t,r){return e.replace(/\{(start|end|total)\}/g,(o,i)=>i==="start"?n+"":i==="end"?t+"":i==="total"?r+"":o)}var As=({id:e,gridInfo:{payload:n,patchInfo:t,selectionModes:r},bgcolor:o})=>{let{columns:i,typeHints:s,data:a,options:l={width:void 0,height:void 0,fill:!1,styles:[]},htmlDeps:u}=n,{width:f,height:c,fill:g,filters:d,styles:h}=l,p=X(null),_=X(null),m=X(null),y=To({initStyleInfos:h??[],nrow:a.length,ncol:i.length}),R=y.styleInfoMap,{setStyleInfos:P}=y,I=go(),D=I.cellEditMap,K=I.setCellEditMapAtLoc,B=l.editable===!0,q=re(()=>{for(let v of D.values())if(v.isEditing)return!0;return!1},[D]),z=re(()=>i.map((v,S)=>{let E=s?.[S],F=E?.type==="html",U=F?!1:void 0;return{accessorFn:(W,ce)=>W[S],filterFn:E?.type==="numeric"?"inNumberRange":"includesString",header:v,meta:{colIndex:S,isHtmlColumn:F,typeHint:E},cell:({getValue:W})=>{let ce=W();if(ce==null)return"";switch(E?.type){case"numeric":case"date":case"datetime":case"duration":case"categorical":case"html":return ce;case"string":case"boolean":return String(ce);case"unknown":case"object":return typeof ce=="string"?ce:JSON.stringify(ce);default:return ce}},enableSorting:U}}),[i,s]),de=re(()=>a,[a]),et=ze(a),Ee=et[0],Ie=et[1],Te=Ro({getColDefs:()=>z}),Pe=Te.sorting,Ge=Te.sortTableStateOptions,Rt=Te.sortTableOptions,ve=Te.setSorting,{columnFilters:Re,columnFiltersState:Be,filtersTableOptions:tt,setColumnFilters:x}=vo(d),N={data:Ee,columns:z,state:{...Ge,...Be},getCoreRowModel:Or(),...Rt,...tt},V=Gr(N),H=Yr({count:V.getFilteredRowModel().rows.length,getScrollElement:()=>p.current,estimateSize:()=>31,overscan:15,paddingStart:_.current?.clientHeight??0,isScrollingResetDelay:10});ne(()=>{H.scrollToOffset(0)},[n,H]);let Ue=H.getTotalSize(),ge=H.getVirtualItems(),Ve=(ge.length>0&&ge?.[0]?.start||0)-(_.current?.clientHeight??0),Tn=ge.length>0?Ue-(ge?.[ge.length-1]?.end||0):0,ko=$o(l.summary,p?.current,ge,_.current,H.options.count),Pn=l.style??"grid",Ho=Pn==="grid"?"shiny-data-grid-grid":"shiny-data-grid-table",Ao=Pn==="table"?"table table-sm":null,pe=Co(r),Gs=!pe.isNone(),No=pe.row!==ie._rowEnum.NONE,se=Eo({isEditingCell:q,editCellsIsAllowed:B,selectionModes:pe,keyAccessor:v=>v.dataset.key,focusEscape:v=>{setTimeout(()=>{v?.blur(),p.current?.focus()},0)},focusOffset:(v,S=0)=>{let E=V.getSortedRowModel(),F=E.rows.findIndex(W=>W.id===v);if(F<0||(F+=S,F<0||F>=E.rows.length))return null;let U=E.rows[F].id;return H.scrollToIndex(F),setTimeout(()=>{p.current?.querySelector(`[data-key='${U}']`)?.focus()},0),U},between:(v,S)=>Ns(V.getSortedRowModel(),v,S),onKeyDownEnter:v=>{let S=Array(...v.childNodes.values()).filter(U=>U instanceof HTMLElement&&U.classList.contains("cell-editable"));if(S.length===0)return;let E=Et(p.current,S);if(!E)return;let F=new MouseEvent("dblclick",{bubbles:!0,cancelable:!0});E.dispatchEvent(F)}});L(()=>{let v=E=>{let F=E.detail.cellSelection;if(F.type==="none"){se.clear();return}else if(F.type==="row"){se.setMultiple(F.rows.map(String));return}else console.error("Unhandled cell selection update:",F)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateCellSelection",v),()=>{S.removeEventListener("updateCellSelection",v)}},[e,se,Ee]),L(()=>{u&&Shiny.renderDependenciesAsync([...u])},[u]),L(()=>{let v=E=>{let F=E.detail.sort,U=[];F.map(W=>{U.push({id:i[W.col],desc:W.desc})}),ve(U)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateColumnSort",v),()=>{S.removeEventListener("updateColumnSort",v)}},[i,e,ve]),L(()=>{let v=E=>{let F=E.detail.filter,U=[];F.map(W=>{U.push({id:i[W.col],value:W.value})}),x(U)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateColumnFilter",v),()=>{S.removeEventListener("updateColumnFilter",v)}},[i,e,x]),L(()=>{let v=E=>{let F=E.detail.styles;P(F)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateStyles",v),()=>{S.removeEventListener("updateStyles",v)}},[e,P]),L(()=>{if(!e)return;let v=null;if(pe.isNone())v=null;else if(pe.row!==ie._rowEnum.NONE){let S=se.keys().toList(),E=V.getSortedRowModel().rowsById;v={type:"row",rows:S.map(F=>F in E?E[F].index:null).filter(F=>F!==null)}}else console.error("Unhandled row selection mode:",pe);Shiny.setInputValue(`${e}_cell_selection`,v)},[e,se,pe,V,V.getSortedRowModel]),L(()=>{if(!e)return;let v=[];Pe.map(S=>{let E=i.indexOf(S.id);v.push({col:E,desc:S.desc})}),Shiny.setInputValue(`${e}_sort`,v),Shiny.setInputValue(`${e}_column_sort`,v)},[i,e,Pe]),L(()=>{if(!e)return;let v=[];Re.map(S=>{let E=i.indexOf(S.id);v.push({col:E,value:S.value})}),Shiny.setInputValue(`${e}_filter`,v),Shiny.setInputValue(`${e}_column_filter`,v)},[e,Re,i]),L(()=>{if(!e)return;let v=V.getSortedRowModel().rows.map(S=>S.index);Shiny.setInputValue(`${e}_data_view_rows`,v),Shiny.setInputValue(`${e}_data_view_indices`,v)},[e,V,Pe,Re]),L(()=>{if(!e)return;let v=null;if(pe.row!==ie._rowEnum.NONE){let S=se.keys().toList(),E=V.getSortedRowModel().rowsById;v=S.map(F=>F in E?E[F].index:null).filter(F=>F!==null).sort()}Shiny.setInputValue(`${e}_selected_rows`,v)},[e,se,pe,V]);let zo=b.useCallback(()=>m.current.querySelectorAll("[tabindex='-1']"),[m.current]),Vn=Do(p.current,zo,{top:_.current?.clientHeight??0});L(()=>()=>{V.resetSorting(),se.clear()},[n]);let Go=V.getHeaderGroups().length;ne(()=>{let v=Ee.length>0;if(v){p.current?.classList.add("scrolling");let S=p.current?.scrollHeight,E=p.current?.clientHeight;S&&E&&S<=E&&(v=!1)}p.current?.classList.toggle("scrolling",v)},[Ee.length,p.current?.scrollHeight,p.current?.clientHeight]);let Bo=v=>S=>{(S.key===" "||S.key==="Enter")&&v.toggleSorting(void 0,S.shiftKey)},Uo=zs(H),Dn=`shiny-data-grid ${Ho}`;g&&(Dn+=" html-fill-item");let bt=!1;return b.createElement(b.Fragment,null,b.createElement("div",{className:Dn,ref:p,style:{width:f,height:c,overflow:"auto"}},b.createElement("table",{className:Ao+(d?" filtering":""),"aria-rowcount":Ee.length,"aria-multiselectable":No,style:{width:f===null||f==="auto"?void 0:"100%"}},b.createElement("thead",{ref:_,style:{backgroundColor:o}},V.getHeaderGroups().map((v,S)=>b.createElement("tr",{key:v.id,"aria-rowindex":S+1},bt&&b.createElement("th",{className:"table-corner"}),v.headers.map(E=>{let F=E.isPlaceholder?void 0:b.createElement("div",{style:{cursor:E.column.getCanSort()?"pointer":void 0,userSelect:E.column.getCanSort()?"none":void 0}},ft(E.column.columnDef.header,E.getContext()),b.createElement(Fo,{direction:E.column.getIsSorted()}));return b.createElement("th",{key:E.id,colSpan:E.colSpan,style:{width:E.getSize()},scope:"col",tabIndex:0,onClick:E.column.getToggleSortingHandler(),onKeyDown:Bo(E.column),className:E.column.getCanSort()?void 0:"header-html"},F)}))),d&&b.createElement("tr",{className:"filters"},bt&&b.createElement("th",{className:"table-corner"}),V.getFlatHeaders().map(v=>{let S=`filter-${v.id}`;return b.createElement("th",{key:S},b.createElement(So,{header:v}))}))),b.createElement("tbody",{ref:m,tabIndex:Vn.containerTabIndex,...Vn.containerHandlers},Ve>0&&b.createElement("tr",{style:{height:`${Ve}px`}}),ge.map(v=>{let S=V.getRowModel().rows[v.index];return S&&b.createElement("tr",{key:v.key,"data-index":v.index,"aria-rowindex":v.index+Go,"data-key":S.id,ref:Uo,"aria-selected":se.has(S.id),tabIndex:-1,...se.itemHandlers()},bt&&b.createElement("td",{className:"row-number"},S.index+1),S.getVisibleCells().map(E=>{let F=E.row.index,U=E.column.columnDef.meta.colIndex,[W,ce]=ho(D,F,U),{cellStyle:Ko,cellClassName:jo}=Po(R,"body",F,U);return b.createElement(fo,{key:E.id,rowId:E.row.id,containerRef:p,cell:E,patchInfo:t,editCellsIsAllowed:B,columns:i,coldefs:z,rowIndex:F,columnIndex:U,getSortedRowModel:V.getSortedRowModel,cellEditInfo:W,cellStyle:Ko,cellClassName:jo,setData:Ie,setCellEditMapAtLoc:K,selection:se})}))}),Tn>0&&b.createElement("tr",{style:{height:`${Tn}px`}})))),ko)};function Ns(e,n,t){let r=e.rows.findIndex(s=>s.id===n),o=e.rows.findIndex(s=>s.id===t);if(r<0||o<0)return[];r>o&&([r,o]=[o,r]);let i=[];for(let s=r;s<=o;s++)i.push(e.rows[s].id);return i}function zs(e){let n=X([]),t=Y(r=>{r&&(r.isConnected?e.measureElement(r):n.current.push(r))},[e]);return ne(()=>{n.current.length>0&&n.current.splice(0).forEach(e.measureElement)}),t}var Mn=class extends Shiny.OutputBinding{find(n){return $(n).find("shiny-data-frame")}renderValue(n,t){n.renderValue(t)}renderError(n,t){n.classList.add("shiny-output-error"),n.renderError(t)}clearError(n){n.classList.remove("shiny-output-error"),n.clearError()}};Shiny.outputBindings.register(new Mn,"shinyDataFrame");function Oo(e){if(!e)return;let n=xn(e,"background-color");if(!n)return n;let t=n.match(/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);if(n==="transparent"||t&&parseFloat(t[4])===0){let r=xn(e,"background-image");return r&&r!=="none"?void 0:Oo(e.parentElement)}return n}var Lo=document.createElement("template");Lo.innerHTML=``;var Fn=class extends HTMLElement{connectedCallback(){let[t]=[this];t.appendChild(Lo.content.cloneNode(!0)),this.errorRoot=document.createElement("span"),t.appendChild(this.errorRoot);let r=document.createElement("div");r.classList.add("html-fill-container","html-fill-item"),t.appendChild(r),this.reactRoot=Jr(r);let o=this.querySelector("script.data");if(o){let i=JSON.parse(o.innerText);this.renderValue(i)}}renderValue(t){if(this.clearError(),!t){this.reactRoot.render(null);return}this.reactRoot.render(b.createElement(Jt,null,b.createElement(As,{id:this.id,gridInfo:t,bgcolor:Oo(this)})))}renderError(t){this.reactRoot.render(null),this.errorRoot.innerText=t.message}clearError(){this.reactRoot.render(null),this.errorRoot.innerText=""}};customElements.define("shiny-data-frame",Fn);$(function(){Shiny.addCustomMessageHandler("shinyDataFrameMessage",function(e){let n=new CustomEvent(e.handler,{detail:e.obj});document.getElementById(e.id)?.dispatchEvent(n)})});export{Fn as ShinyDataFrameOutput};
+}`;function zo(e,n,t){let[r,o]=H(0),i=x.useCallback(a=>{o(-1),a.target===a.currentTarget&&Ft(e,n(),t)?.focus()},[e,n,t]),s=x.useCallback(a=>{o(0)},[]);return{containerTabIndex:r,containerHandlers:{onFocus:i,onBlur:s}}}function Go(e,n,t,r,o){return se(()=>{let i=e??!0;if(!i)return null;let s=typeof i=="string"?i:"Viewing rows {start} through {end} of {total}";if(!n||t.length===0||!r)return null;let a=n.scrollTop+r.clientHeight,l=n.scrollTop+n.clientHeight,[u,f]=js(a,l,t,(h,p)=>h.start+h.size/2);if(u===null||f===null)return null;let c=t[u],g=t[f];if(c===void 0||g===void 0||c.index===0&&g.index===o-1)return null;let d=qs(s,c.index+1,g.index+1,o);return x.createElement("div",{className:"shiny-data-grid-summary"},d)},[e,n,t,r,o])}function js(e,n,t,r){let o=null,i=null;for(let s=0;s=e&&(o=s,i=s);else if(r(a,!1)<=n)i=s;else break}return[o,i]}function qs(e,n,t,r){return e.replace(/\{(start|end|total)\}/g,(o,i)=>i==="start"?n+"":i==="end"?t+"":i==="total"?r+"":o)}var Ws=({id:e,gridInfo:{payload:n,patchInfo:t,selectionModes:r},bgcolor:o})=>{let{columns:i,typeHints:s,data:a,options:l={width:void 0,height:void 0,fill:!1,styles:[]},htmlDeps:u}=n,{width:f,height:c,fill:g,filters:d,styles:h}=l,p=Q(null),_=Q(null),m=Q(null),[y,R]=xe(i),[P,I]=xe(s),D=Ho({initStyleInfos:h??[],nrow:a.length,ncol:y.length}),q=D.styleInfoMap,{setStyleInfos:U}=D,K=wo(),G=K.cellEditMap,Z=K.setCellEditMapAtLoc,je=K.resetCellEditMap,it=l.editable===!0,Ve=se(()=>{for(let v of G.values())if(v.isEditing)return!0;return!1},[G]),qe=se(()=>y.map((v,S)=>{let w=P?.[S],b=w?.type==="html",A=b?!1:void 0;return{accessorFn:(X,N)=>X[S],filterFn:w?.type==="numeric"?"inNumberRange":"includesString",header:v,meta:{colIndex:S,isHtmlColumn:b,typeHint:w},cell:({getValue:X})=>{let N=X();if(N==null)return"";switch(w?.type){case"numeric":case"date":case"datetime":case"duration":case"categorical":case"html":return N;case"string":case"boolean":return String(N);case"unknown":case"object":return typeof N=="string"?N:JSON.stringify(N);default:return N}},enableSorting:A}}),[y,P]),On=se(()=>a,[a]),We=xe(a),Se=We[0],we=We[1],Ce=Do({getColDefs:()=>qe}),pe=Ce.sorting,st=Ce.sortTableStateOptions,M=Ce.sortTableOptions,O=Ce.setSorting,{columnFilters:z,columnFiltersState:W,filtersTableOptions:Xe,setColumnFilters:Le}=Mo(d),Oe=J(({data:v,columns:S,typeHints:w})=>{R(S),we(v),I(w),je();let b=new Map;w?.forEach((N,ke)=>{b.set(S[ke],N)});let A=pe.filter(N=>b.has(N.id)),X=z.filter(N=>{let ke=b.get(N.id);return ke?ke.type==="numeric"?N.value===null||Array.isArray(N.value)&&N.value.every(Tt=>Tt!==null):typeof N.value=="string":!1});Le(X),O(A)},[z,je,Le,R,O,we,I,pe]),Ko={data:Se,columns:qe,state:{...st,...W},getCoreRowModel:Br(),...M,...Xe},j=Yr(Ko),Me=oo({count:j.getFilteredRowModel().rows.length,getScrollElement:()=>p.current,estimateSize:()=>31,overscan:15,paddingStart:_.current?.clientHeight??0,isScrollingResetDelay:10});ie(()=>{Me.scrollToOffset(0)},[n,Me]);let jo=Me.getTotalSize(),Fe=Me.getVirtualItems(),kn=(Fe.length>0&&Fe?.[0]?.start||0)-(_.current?.clientHeight??0),Hn=Fe.length>0?jo-(Fe?.[Fe.length-1]?.end||0):0,qo=Go(l.summary,p?.current,Fe,_.current,Me.options.count),An=l.style??"grid",Wo=An==="grid"?"shiny-data-grid-grid":"shiny-data-grid-table",Xo=An==="table"?"table table-sm":null,he=To(r),Js=!he.isNone(),Yo=he.row!==ae._rowEnum.NONE,ue=Po({isEditingCell:Ve,editCellsIsAllowed:it,selectionModes:he,keyAccessor:v=>v.dataset.key,focusEscape:v=>{setTimeout(()=>{v?.blur(),p.current?.focus()},0)},focusOffset:(v,S=0)=>{let w=j.getSortedRowModel(),b=w.rows.findIndex(X=>X.id===v);if(b<0||(b+=S,b<0||b>=w.rows.length))return null;let A=w.rows[b].id;return Me.scrollToIndex(b),setTimeout(()=>{p.current?.querySelector(`[data-key='${A}']`)?.focus()},0),A},between:(v,S)=>Xs(j.getSortedRowModel(),v,S),onKeyDownEnter:v=>{let S=Array(...v.childNodes.values()).filter(A=>A instanceof HTMLElement&&A.classList.contains("cell-editable"));if(S.length===0)return;let w=Ft(p.current,S);if(!w)return;let b=new MouseEvent("dblclick",{bubbles:!0,cancelable:!0});w.dispatchEvent(b)}});V(()=>{let v=w=>{let b=w.detail.cellSelection;if(b.type==="none"){ue.clear();return}else if(b.type==="row"){ue.setMultiple(b.rows.map(String));return}else console.error("Unhandled cell selection update:",b)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateCellSelection",v),()=>{S.removeEventListener("updateCellSelection",v)}},[e,ue,Se]),V(()=>{u&&Shiny.renderDependenciesAsync([...u])},[u]),V(()=>{let v=w=>{let b=w.detail.patches,A=In(b);Fn({setData:we,newPatches:A,setCellEditMapAtLoc:Z})};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("addPatches",v),()=>{S.removeEventListener("addPatches",v)}},[y,e,Z,O,we]),V(()=>{let v=w=>{let b=w.detail;Oe(b)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateData",v),()=>{S.removeEventListener("updateData",v)}},[y,e,je,we,Oe]),V(()=>{let v=w=>{let b=w.detail.sort,A=[];b.map(X=>{A.push({id:y[X.col],desc:X.desc})}),O(A)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateColumnSort",v),()=>{S.removeEventListener("updateColumnSort",v)}},[y,e,O]),V(()=>{let v=w=>{let b=w.detail.filter,A=[];b.map(X=>{A.push({id:y[X.col],value:X.value})}),Le(A)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateColumnFilter",v),()=>{S.removeEventListener("updateColumnFilter",v)}},[y,e,Le]),V(()=>{let v=w=>{let b=w.detail.styles;U(b)};if(!e)return;let S=document.getElementById(e);if(S)return S.addEventListener("updateStyles",v),()=>{S.removeEventListener("updateStyles",v)}},[e,U]),V(()=>{if(!e)return;let v=null;if(he.isNone())v=null;else if(he.row!==ae._rowEnum.NONE){let S=ue.keys().toList(),w=j.getSortedRowModel().rowsById;v={type:"row",rows:S.map(b=>b in w?w[b].index:null).filter(b=>b!==null)}}else console.error("Unhandled row selection mode:",he);Shiny.setInputValue(`${e}_cell_selection`,v)},[e,ue,he,j,j.getSortedRowModel]),V(()=>{if(!e)return;let v=[];pe.map(S=>{let w=y.indexOf(S.id);v.push({col:w,desc:S.desc})}),Shiny.setInputValue(`${e}_sort`,v),Shiny.setInputValue(`${e}_column_sort`,v)},[y,e,pe]),V(()=>{if(!e)return;let v=[];z.map(S=>{let w=y.indexOf(S.id);v.push({col:w,value:S.value})}),Shiny.setInputValue(`${e}_filter`,v),Shiny.setInputValue(`${e}_column_filter`,v)},[e,z,y]),V(()=>{if(!e)return;let v=j.getSortedRowModel().rows.map(S=>S.index);Shiny.setInputValue(`${e}_data_view_rows`,v),Shiny.setInputValue(`${e}_data_view_indices`,v)},[e,j,pe,z]),V(()=>{if(!e)return;let v=null;if(he.row!==ae._rowEnum.NONE){let S=ue.keys().toList(),w=j.getSortedRowModel().rowsById;v=S.map(b=>b in w?w[b].index:null).filter(b=>b!==null).sort()}Shiny.setInputValue(`${e}_selected_rows`,v)},[e,ue,he,j]);let Jo=x.useCallback(()=>m.current.querySelectorAll("[tabindex='-1']"),[m.current]),Nn=zo(p.current,Jo,{top:_.current?.clientHeight??0});V(()=>()=>{j.resetSorting(),ue.clear()},[n]);let Qo=j.getHeaderGroups().length;ie(()=>{let v=Se.length>0;if(v){p.current?.classList.add("scrolling");let S=p.current?.scrollHeight,w=p.current?.clientHeight;S&&w&&S<=w&&(v=!1)}p.current?.classList.toggle("scrolling",v)},[Se.length,p.current?.scrollHeight,p.current?.clientHeight]);let Zo=v=>S=>{(S.key===" "||S.key==="Enter")&&v.toggleSorting(void 0,S.shiftKey)},ei=Ys(Me),zn=`shiny-data-grid ${Wo}`;g&&(zn+=" html-fill-item");let It=!1;return x.createElement(x.Fragment,null,x.createElement("div",{className:zn,ref:p,style:{width:f,height:c,overflow:"auto"}},x.createElement("table",{className:Xo+(d?" filtering":""),"aria-rowcount":j.getRowCount(),"aria-multiselectable":Yo,style:{width:f===null||f==="auto"?void 0:"100%"}},x.createElement("thead",{ref:_,style:{backgroundColor:o}},j.getHeaderGroups().map((v,S)=>x.createElement("tr",{key:v.id,"aria-rowindex":S+1},It&&x.createElement("th",{className:"table-corner"}),v.headers.map(w=>{let b=w.isPlaceholder?void 0:x.createElement("div",{style:{cursor:w.column.getCanSort()?"pointer":void 0,userSelect:w.column.getCanSort()?"none":void 0}},_t(w.column.columnDef.header,w.getContext()),x.createElement(Oo,{direction:w.column.getIsSorted()}));return x.createElement("th",{key:w.id,colSpan:w.colSpan,style:{width:w.getSize()},scope:"col",tabIndex:0,onClick:w.column.getToggleSortingHandler(),onKeyDown:Zo(w.column),className:w.column.getCanSort()?void 0:"header-html"},b)}))),d&&x.createElement("tr",{className:"filters"},It&&x.createElement("th",{className:"table-corner"}),j.getFlatHeaders().map(v=>{let S=`filter-${v.id}`;return x.createElement("th",{key:S},x.createElement(Fo,{header:v}))}))),x.createElement("tbody",{ref:m,tabIndex:Nn.containerTabIndex,...Nn.containerHandlers},kn>0&&x.createElement("tr",{style:{height:`${kn}px`}}),Fe.map(v=>{let S=j.getRowModel().rows[v.index];return S&&x.createElement("tr",{key:v.key,"data-index":v.index,"aria-rowindex":v.index+Qo,"data-key":S.id,ref:ei,"aria-selected":ue.has(S.id),tabIndex:-1,...ue.itemHandlers()},It&&x.createElement("td",{className:"row-number"},S.index+1),S.getVisibleCells().map(w=>{let b=w.row.index,A=w.column.columnDef.meta.colIndex,[X,N]=Eo(G,b,A),{cellStyle:ke,cellClassName:Tt}=Ao(q,"body",b,A);return x.createElement(So,{key:w.id,rowId:w.row.id,containerRef:p,cell:w,patchInfo:t,editCellsIsAllowed:it,columns:y,coldefs:qe,rowIndex:b,columnIndex:A,getSortedRowModel:j.getSortedRowModel,cellEditInfo:X,cellStyle:ke,cellClassName:Tt,setData:we,setCellEditMapAtLoc:Z,selection:ue})}))}),Hn>0&&x.createElement("tr",{style:{height:`${Hn}px`}})))),qo)};function Xs(e,n,t){let r=e.rows.findIndex(s=>s.id===n),o=e.rows.findIndex(s=>s.id===t);if(r<0||o<0)return[];r>o&&([r,o]=[o,r]);let i=[];for(let s=r;s<=o;s++)i.push(e.rows[s].id);return i}function Ys(e){let n=Q([]),t=J(r=>{r&&(r.isConnected?e.measureElement(r):n.current.push(r))},[e]);return ie(()=>{n.current.length>0&&n.current.splice(0).forEach(e.measureElement)}),t}var $n=class extends Shiny.OutputBinding{find(n){return $(n).find("shiny-data-frame")}renderValue(n,t){n.renderValue(t)}renderError(n,t){n.classList.add("shiny-output-error"),n.renderError(t)}clearError(n){n.classList.remove("shiny-output-error"),n.clearError()}};Shiny.outputBindings.register(new $n,"shinyDataFrame");function Bo(e){if(!e)return;let n=Vn(e,"background-color");if(!n)return n;let t=n.match(/^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);if(n==="transparent"||t&&parseFloat(t[4])===0){let r=Vn(e,"background-image");return r&&r!=="none"?void 0:Bo(e.parentElement)}return n}var Uo=document.createElement("template");Uo.innerHTML=``;var Ln=class extends HTMLElement{connectedCallback(){let[t]=[this];t.appendChild(Uo.content.cloneNode(!0)),this.errorRoot=document.createElement("span"),t.appendChild(this.errorRoot);let r=document.createElement("div");r.classList.add("html-fill-container","html-fill-item"),t.appendChild(r),this.reactRoot=io(r);let o=this.querySelector("script.data");if(o){let i=JSON.parse(o.innerText);this.renderValue(i)}}renderValue(t){if(this.clearError(),!t){this.reactRoot.render(null);return}this.reactRoot.render(x.createElement(nn,null,x.createElement(Ws,{id:this.id,gridInfo:t,bgcolor:Bo(this)})))}renderError(t){this.reactRoot.render(null),this.errorRoot.innerText=t.message}clearError(){this.reactRoot.render(null),this.errorRoot.innerText=""}};customElements.define("shiny-data-frame",Ln);$(function(){Shiny.addCustomMessageHandler("shinyDataFrameMessage",function(e){let n=new CustomEvent(e.handler,{detail:e.obj});document.getElementById(e.id)?.dispatchEvent(n)})});export{Ln as ShinyDataFrameOutput};
/*! Bundled license information:
@tanstack/table-core/build/lib/index.mjs:
diff --git a/shiny/www/py-shiny/data-frame/data-frame.js.map b/shiny/www/py-shiny/data-frame/data-frame.js.map
index d66220a34..341d46b00 100644
--- a/shiny/www/py-shiny/data-frame/data-frame.js.map
+++ b/shiny/www/py-shiny/data-frame/data-frame.js.map
@@ -1,7 +1,7 @@
{
"version": 3,
"sources": ["../../../../js/node_modules/preact/src/constants.js", "../../../../js/node_modules/preact/src/util.js", "../../../../js/node_modules/preact/src/options.js", "../../../../js/node_modules/preact/src/create-element.js", "../../../../js/node_modules/preact/src/component.js", "../../../../js/node_modules/preact/src/diff/props.js", "../../../../js/node_modules/preact/src/create-context.js", "../../../../js/node_modules/preact/src/diff/children.js", "../../../../js/node_modules/preact/src/diff/index.js", "../../../../js/node_modules/preact/src/render.js", "../../../../js/node_modules/preact/src/clone-element.js", "../../../../js/node_modules/preact/src/diff/catch-error.js", "../../../../js/node_modules/preact/hooks/src/index.js", "../../../../js/node_modules/preact/compat/src/util.js", "../../../../js/node_modules/preact/compat/src/PureComponent.js", "../../../../js/node_modules/preact/compat/src/memo.js", "../../../../js/node_modules/preact/compat/src/forwardRef.js", "../../../../js/node_modules/preact/compat/src/Children.js", "../../../../js/node_modules/preact/compat/src/suspense.js", "../../../../js/node_modules/preact/compat/src/suspense-list.js", "../../../../js/node_modules/preact/src/constants.js", "../../../../js/node_modules/preact/compat/src/portals.js", "../../../../js/node_modules/preact/compat/src/render.js", "../../../../js/node_modules/preact/compat/src/index.js", "../../../../js/node_modules/@tanstack/table-core/src/columnHelper.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/cell.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/column.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/headers.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/row.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/ColumnFaceting.ts", "../../../../js/node_modules/@tanstack/table-core/src/filterFns.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/ColumnFiltering.ts", "../../../../js/node_modules/@tanstack/table-core/src/aggregationFns.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/ColumnGrouping.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/ColumnOrdering.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/ColumnPinning.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/ColumnSizing.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/ColumnVisibility.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/GlobalFaceting.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/GlobalFiltering.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/RowExpanding.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/RowPagination.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/RowPinning.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/RowSelection.ts", "../../../../js/node_modules/@tanstack/table-core/src/sortingFns.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/RowSorting.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/table.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getCoreRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getExpandedRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getFacetedMinMaxValues.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/filterRowsUtils.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getFacetedRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getFacetedUniqueValues.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getFilteredRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getGroupedRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getPaginationRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getSortedRowModel.ts", "../../../../js/node_modules/@tanstack/react-table/src/index.tsx", "../../../../js/node_modules/@tanstack/virtual-core/src/utils.ts", "../../../../js/node_modules/@tanstack/virtual-core/src/index.ts", "../../../../js/node_modules/@tanstack/react-virtual/src/index.tsx", "../../../../js/node_modules/preact/compat/client.mjs", "../../../../js/node_modules/immer/src/utils/env.ts", "../../../../js/node_modules/immer/src/utils/errors.ts", "../../../../js/node_modules/immer/src/utils/common.ts", "../../../../js/node_modules/immer/src/utils/plugins.ts", "../../../../js/node_modules/immer/src/core/scope.ts", "../../../../js/node_modules/immer/src/core/finalize.ts", "../../../../js/node_modules/immer/src/core/proxy.ts", "../../../../js/node_modules/immer/src/core/immerClass.ts", "../../../../js/node_modules/immer/src/core/current.ts", "../../../../js/node_modules/immer/src/plugins/patches.ts", "../../../../js/node_modules/immer/src/plugins/mapset.ts", "../../../../js/node_modules/immer/src/immer.ts", "../../../../js/node_modules/use-immer/src/index.ts", "../../../../js/data-frame/request.ts", "../../../../js/data-frame/data-update.tsx", "../../../../js/data-frame/cell.tsx", "../../../../js/data-frame/cell-edit-map.tsx", "../../../../js/data-frame/dom-utils.tsx", "../../../../js/data-frame/filter-numeric.tsx", "../../../../js/data-frame/filter.tsx", "../../../../js/data-frame/immutable-set.tsx", "../../../../js/data-frame/selection.tsx", "../../../../js/data-frame/sort.ts", "../../../../js/data-frame/sort-arrows.tsx", "../../../../js/data-frame/style-info.ts", "../../../../js/data-frame/styles.scss", "../../../../js/data-frame/tabindex-group.ts", "../../../../js/data-frame/table-summary.tsx", "../../../../js/data-frame/index.tsx"],
- "sourcesContent": ["/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 16;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 17;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n", "import { EMPTY_ARR } from './constants';\n\nexport const isArray = Array.isArray;\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-expect-error We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {preact.ContainerNode} node The node to remove\n */\nexport function removeNode(node) {\n\tlet parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n", "import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n", "import { slice } from './util';\nimport options from './options';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {VNode[\"type\"]} type The node name or Component constructor for this\n * virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array} [children] The children of the\n * virtual node\n * @returns {VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != null) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, null);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\t/** @type {VNode} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t// _nextDom must be initialized to undefined b/c it will eventually\n\t\t// be set to dom.nextSibling which can return `null` and it is important\n\t\t// to be able to distinguish between an uninitialized _nextDom and\n\t\t// a _nextDom that has been set to `null`\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original,\n\t\t_index: -1,\n\t\t_flags: 0\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == null && options.vnode != null) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: null };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != null && vnode.constructor == undefined;\n", "import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\nimport { MODE_HYDRATE } from './constants';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function BaseComponent(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nBaseComponent.prototype.setState = function (update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != null && this._nextState !== this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == null) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nBaseComponent.prototype.forceUpdate = function (callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {ComponentChildren | void}\n */\nBaseComponent.prototype.render = Fragment;\n\n/**\n * @param {VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == null) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._index + 1)\n\t\t\t: null;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != null && sibling._dom != null) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : null;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet oldVNode = component._vnode,\n\t\toldDom = oldVNode._dom,\n\t\tcommitQueue = [],\n\t\trefQueue = [];\n\n\tif (component._parentDom) {\n\t\tconst newVNode = assign({}, oldVNode);\n\t\tnewVNode._original = oldVNode._original + 1;\n\t\tif (options.vnode) options.vnode(newVNode);\n\n\t\tdiff(\n\t\t\tcomponent._parentDom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tcomponent._parentDom.namespaceURI,\n\t\t\toldVNode._flags & MODE_HYDRATE ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(oldVNode) : oldDom,\n\t\t\t!!(oldVNode._flags & MODE_HYDRATE),\n\t\t\trefQueue\n\t\t);\n\n\t\tnewVNode._original = oldVNode._original;\n\t\tnewVNode._parent._children[newVNode._index] = newVNode;\n\t\tcommitRoot(commitQueue, newVNode, refQueue);\n\n\t\tif (newVNode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(newVNode);\n\t\t}\n\t}\n}\n\n/**\n * @param {VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != null && vnode._component != null) {\n\t\tvnode._dom = vnode._component.base = null;\n\t\tfor (let i = 0; i < vnode._children.length; i++) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child != null && child._dom != null) {\n\t\t\t\tvnode._dom = vnode._component.base = child._dom;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\nconst defer =\n\ttypeof Promise == 'function'\n\t\t? Promise.prototype.then.bind(Promise.resolve())\n\t\t: setTimeout;\n\n/**\n * Enqueue a rerender of a component\n * @param {Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce !== options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || defer)(process);\n\t}\n}\n\n/**\n * @param {Component} a\n * @param {Component} b\n */\nconst depthSort = (a, b) => a._vnode._depth - b._vnode._depth;\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\tlet c;\n\trerenderQueue.sort(depthSort);\n\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t// process() calls from getting scheduled while `queue` is still being consumed.\n\twhile ((c = rerenderQueue.shift())) {\n\t\tif (c._dirty) {\n\t\t\tlet renderQueueLength = rerenderQueue.length;\n\t\t\trenderComponent(c);\n\t\t\tif (rerenderQueue.length > renderQueueLength) {\n\t\t\t\t// When i.e. rerendering a provider additional new items can be injected, we want to\n\t\t\t\t// keep the order from top to bottom with those new items so we can handle them in a\n\t\t\t\t// single pass\n\t\t\t\trerenderQueue.sort(depthSort);\n\t\t\t}\n\t\t}\n\t}\n\tprocess._rerenderCount = 0;\n}\n\nprocess._rerenderCount = 0;\n", "import { IS_NON_DIMENSIONAL } from '../constants';\nimport options from '../options';\n\nfunction setStyle(style, key, value) {\n\tif (key[0] === '-') {\n\t\tstyle.setProperty(key, value == null ? '' : value);\n\t} else if (value == null) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\n// A logical clock to solve issues like https://github.com/preactjs/preact/issues/3927.\n// When the DOM performs an event it leaves micro-ticks in between bubbling up which means that\n// an event can trigger on a newly reated DOM-node while the event bubbles up.\n//\n// Originally inspired by Vue\n// (https://github.com/vuejs/core/blob/caeb8a68811a1b0f79/packages/runtime-dom/src/modules/events.ts#L90-L101),\n// but modified to use a logical clock instead of Date.now() in case event handlers get attached\n// and events get dispatched during the same millisecond.\n//\n// The clock is incremented after each new event dispatch. This allows 1 000 000 new events\n// per second for over 280 years before the value reaches Number.MAX_SAFE_INTEGER (2**53 - 1).\nlet eventClock = 0;\n\n/**\n * Set a property value on a DOM node\n * @param {PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {string} namespace Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, namespace) {\n\tlet useCapture;\n\n\to: if (name === 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] !== oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] === 'o' && name[1] === 'n') {\n\t\tuseCapture =\n\t\t\tname !== (name = name.replace(/(PointerCapture)$|Capture$/i, '$1'));\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (\n\t\t\tname.toLowerCase() in dom ||\n\t\t\tname === 'onFocusOut' ||\n\t\t\tname === 'onFocusIn'\n\t\t)\n\t\t\tname = name.toLowerCase().slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tvalue._attached = eventClock;\n\t\t\t\tdom.addEventListener(\n\t\t\t\t\tname,\n\t\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\t\tuseCapture\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tvalue._attached = oldValue._attached;\n\t\t\t}\n\t\t} else {\n\t\t\tdom.removeEventListener(\n\t\t\t\tname,\n\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\tuseCapture\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (namespace == 'http://www.w3.org/2000/svg') {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname != 'width' &&\n\t\t\tname != 'height' &&\n\t\t\tname != 'href' &&\n\t\t\tname != 'list' &&\n\t\t\tname != 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname != 'tabIndex' &&\n\t\t\tname != 'download' &&\n\t\t\tname != 'rowSpan' &&\n\t\t\tname != 'colSpan' &&\n\t\t\tname != 'role' &&\n\t\t\tname != 'popover' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == null ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// aria- and data- attributes have no boolean representation.\n\t\t// A `false` value is different from the attribute not being\n\t\t// present, so we can't remove it. For non-boolean aria\n\t\t// attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost too many bytes. On top of\n\t\t// that other frameworks generally stringify `false`.\n\n\t\tif (typeof value == 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != null && (value !== false || name[4] === '-')) {\n\t\t\tdom.setAttribute(name, name == 'popover' && value == true ? '' : value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Create an event proxy function.\n * @param {boolean} useCapture Is the event handler for the capture phase.\n * @private\n */\nfunction createEventProxy(useCapture) {\n\t/**\n\t * Proxy an event to hooked event handlers\n\t * @param {PreactEvent} e The event object from the browser\n\t * @private\n\t */\n\treturn function (e) {\n\t\tif (this._listeners) {\n\t\t\tconst eventHandler = this._listeners[e.type + useCapture];\n\t\t\tif (e._dispatched == null) {\n\t\t\t\te._dispatched = eventClock++;\n\n\t\t\t\t// When `e._dispatched` is smaller than the time when the targeted event\n\t\t\t\t// handler was attached we know we have bubbled up to an element that was added\n\t\t\t\t// during patching the DOM.\n\t\t\t} else if (e._dispatched < eventHandler._attached) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn eventHandler(options.event ? options.event(e) : e);\n\t\t}\n\t};\n}\n\nconst eventProxy = createEventProxy(false);\nconst eventProxyCapture = createEventProxy(true);\n", "import { enqueueRender } from './component';\n\nexport let i = 0;\n\nexport function createContext(defaultValue, contextId) {\n\tcontextId = '__cC' + i++;\n\n\tconst context = {\n\t\t_id: contextId,\n\t\t_defaultValue: defaultValue,\n\t\t/** @type {FunctionComponent} */\n\t\tConsumer(props, contextValue) {\n\t\t\t// return props.children(\n\t\t\t// \tcontext[contextId] ? context[contextId].props.value : defaultValue\n\t\t\t// );\n\t\t\treturn props.children(contextValue);\n\t\t},\n\t\t/** @type {FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\t/** @type {Component[] | null} */\n\t\t\t\tlet subs = [];\n\t\t\t\tlet ctx = {};\n\t\t\t\tctx[contextId] = this;\n\n\t\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\t\tthis.componentWillUnmount = () => {\n\t\t\t\t\tsubs = null;\n\t\t\t\t};\n\n\t\t\t\tthis.shouldComponentUpdate = function (_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\tsubs.some(c => {\n\t\t\t\t\t\t\tc._force = true;\n\t\t\t\t\t\t\tenqueueRender(c);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.sub = c => {\n\t\t\t\t\tsubs.push(c);\n\t\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\t\tif (subs) {\n\t\t\t\t\t\t\tsubs.splice(subs.indexOf(c), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn props.children;\n\t\t}\n\t};\n\n\t// Devtools needs access to the context object when it\n\t// encounters a Provider. This is necessary to support\n\t// setting `displayName` on the context object instead\n\t// of on the component itself. See:\n\t// https://reactjs.org/docs/context.html#contextdisplayname\n\n\treturn (context.Provider._contextRef = context.Consumer.contextType =\n\t\tcontext);\n}\n", "import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR, INSERT_VNODE, MATCHED } from '../constants';\nimport { isArray } from '../util';\nimport { getDomSibling } from '../component';\n\n/**\n * Diff the children of a virtual node\n * @param {PreactElement} parentDom The DOM element whose children are being\n * diffed\n * @param {ComponentChildren[]} renderResult\n * @param {VNode} newParentVNode The new virtual node whose children should be\n * diff'ed against oldParentVNode\n * @param {VNode} oldParentVNode The old virtual node whose children should be\n * diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\tlet i,\n\t\t/** @type {VNode} */\n\t\toldVNode,\n\t\t/** @type {VNode} */\n\t\tchildVNode,\n\t\t/** @type {PreactElement} */\n\t\tnewDom,\n\t\t/** @type {PreactElement} */\n\t\tfirstChildDom;\n\n\t// This is a compression of oldParentVNode!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\t/** @type {VNode[]} */\n\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet newChildrenLength = renderResult.length;\n\n\tnewParentVNode._nextDom = oldDom;\n\tconstructNewChildrenArray(newParentVNode, renderResult, oldChildren);\n\toldDom = newParentVNode._nextDom;\n\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\tchildVNode = newParentVNode._children[i];\n\t\tif (\n\t\t\tchildVNode == null ||\n\t\t\ttypeof childVNode == 'boolean' ||\n\t\t\ttypeof childVNode == 'function'\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// At this point, constructNewChildrenArray has assigned _index to be the\n\t\t// matchingIndex for this VNode's oldVNode (or -1 if there is no oldVNode).\n\t\tif (childVNode._index === -1) {\n\t\t\toldVNode = EMPTY_OBJ;\n\t\t} else {\n\t\t\toldVNode = oldChildren[childVNode._index] || EMPTY_OBJ;\n\t\t}\n\n\t\t// Update childVNode._index to its final index\n\t\tchildVNode._index = i;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\n\t\t// Adjust DOM nodes\n\t\tnewDom = childVNode._dom;\n\t\tif (childVNode.ref && oldVNode.ref != childVNode.ref) {\n\t\t\tif (oldVNode.ref) {\n\t\t\t\tapplyRef(oldVNode.ref, null, childVNode);\n\t\t\t}\n\t\t\trefQueue.push(\n\t\t\t\tchildVNode.ref,\n\t\t\t\tchildVNode._component || newDom,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t}\n\n\t\tif (firstChildDom == null && newDom != null) {\n\t\t\tfirstChildDom = newDom;\n\t\t}\n\n\t\tif (\n\t\t\tchildVNode._flags & INSERT_VNODE ||\n\t\t\toldVNode._children === childVNode._children\n\t\t) {\n\t\t\tif (\n\t\t\t\toldDom &&\n\t\t\t\ttypeof childVNode.type == 'string' &&\n\t\t\t\t// @ts-expect-error olDom should be present on a DOM node\n\t\t\t\t!parentDom.contains(oldDom)\n\t\t\t) {\n\t\t\t\toldDom = getDomSibling(oldVNode);\n\t\t\t}\n\t\t\toldDom = insert(childVNode, oldDom, parentDom);\n\t\t} else if (\n\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\tchildVNode._nextDom !== undefined\n\t\t) {\n\t\t\t// Since Fragments or components that return Fragment like VNodes can\n\t\t\t// contain multiple DOM nodes as the same level, continue the diff from\n\t\t\t// the sibling of last DOM child of this child VNode\n\t\t\toldDom = childVNode._nextDom;\n\t\t} else if (newDom) {\n\t\t\toldDom = newDom.nextSibling;\n\t\t}\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because it\n\t\t// is only used by `diffChildren` to determine where to resume the diff\n\t\t// after diffing Components and Fragments. Once we store it the nextDOM\n\t\t// local var, we can clean up the property. Also prevents us hanging on to\n\t\t// DOM nodes that may have been unmounted.\n\t\tchildVNode._nextDom = undefined;\n\n\t\t// Unset diffing flags\n\t\tchildVNode._flags &= ~(INSERT_VNODE | MATCHED);\n\t}\n\n\t// TODO: With new child diffing algo, consider alt ways to diff Fragments.\n\t// Such as dropping oldDom and moving fragments in place\n\t//\n\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t// _nextDom property to the nextSibling of its last child DOM node.\n\t//\n\t// `oldDom` contains the correct value here because if the last child\n\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t// node's nextSibling.\n\tnewParentVNode._nextDom = oldDom;\n\tnewParentVNode._dom = firstChildDom;\n}\n\n/**\n * @param {VNode} newParentVNode\n * @param {ComponentChildren[]} renderResult\n * @param {VNode[]} oldChildren\n */\nfunction constructNewChildrenArray(newParentVNode, renderResult, oldChildren) {\n\t/** @type {number} */\n\tlet i;\n\t/** @type {VNode} */\n\tlet childVNode;\n\t/** @type {VNode} */\n\tlet oldVNode;\n\n\tconst newChildrenLength = renderResult.length;\n\tlet oldChildrenLength = oldChildren.length,\n\t\tremainingOldChildren = oldChildrenLength;\n\n\tlet skew = 0;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\t// @ts-expect-error We are reusing the childVNode variable to hold both the\n\t\t// pre and post normalized childVNode\n\t\tchildVNode = renderResult[i];\n\n\t\tif (\n\t\t\tchildVNode == null ||\n\t\t\ttypeof childVNode == 'boolean' ||\n\t\t\ttypeof childVNode == 'function'\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = null;\n\t\t}\n\t\t// If this newVNode is being reused (e.g.
{reuse}{reuse}
) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint' ||\n\t\t\tchildVNode.constructor == String\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tnull,\n\t\t\t\tchildVNode,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t);\n\t\t} else if (childVNode.constructor === undefined && childVNode._depth > 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = \n\t\t\t//
{reuse}{reuse}
\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : null,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tchildVNode = newParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\tconst skewedIndex = i + skew;\n\n\t\t// Handle unmounting null placeholders, i.e. VNode => null in unkeyed children\n\t\tif (childVNode == null) {\n\t\t\toldVNode = oldChildren[skewedIndex];\n\t\t\tif (\n\t\t\t\toldVNode &&\n\t\t\t\toldVNode.key == null &&\n\t\t\t\toldVNode._dom &&\n\t\t\t\t(oldVNode._flags & MATCHED) === 0\n\t\t\t) {\n\t\t\t\tif (oldVNode._dom == newParentVNode._nextDom) {\n\t\t\t\t\tnewParentVNode._nextDom = getDomSibling(oldVNode);\n\t\t\t\t}\n\n\t\t\t\tunmount(oldVNode, oldVNode, false);\n\n\t\t\t\t// Explicitly nullify this position in oldChildren instead of just\n\t\t\t\t// setting `_match=true` to prevent other routines (e.g.\n\t\t\t\t// `findMatchingIndex` or `getDomSibling`) from thinking VNodes or DOM\n\t\t\t\t// nodes in this position are still available to be used in diffing when\n\t\t\t\t// they have actually already been unmounted. For example, by only\n\t\t\t\t// setting `_match=true` here, the unmounting loop later would attempt\n\t\t\t\t// to unmount this VNode again seeing `_match==true`. Further,\n\t\t\t\t// getDomSibling doesn't know about _match and so would incorrectly\n\t\t\t\t// assume DOM nodes in this subtree are mounted and usable.\n\t\t\t\toldChildren[skewedIndex] = null;\n\t\t\t\tremainingOldChildren--;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\tconst matchingIndex = findMatchingIndex(\n\t\t\tchildVNode,\n\t\t\toldChildren,\n\t\t\tskewedIndex,\n\t\t\tremainingOldChildren\n\t\t);\n\n\t\t// Temporarily store the matchingIndex on the _index property so we can pull\n\t\t// out the oldVNode in diffChildren. We'll override this to the VNode's\n\t\t// final index after using this property to get the oldVNode\n\t\tchildVNode._index = matchingIndex;\n\n\t\toldVNode = null;\n\t\tif (matchingIndex !== -1) {\n\t\t\toldVNode = oldChildren[matchingIndex];\n\t\t\tremainingOldChildren--;\n\t\t\tif (oldVNode) {\n\t\t\t\toldVNode._flags |= MATCHED;\n\t\t\t}\n\t\t}\n\n\t\t// Here, we define isMounting for the purposes of the skew diffing\n\t\t// algorithm. Nodes that are unsuspending are considered mounting and we detect\n\t\t// this by checking if oldVNode._original === null\n\t\tconst isMounting = oldVNode == null || oldVNode._original === null;\n\n\t\tif (isMounting) {\n\t\t\tif (matchingIndex == -1) {\n\t\t\t\tskew--;\n\t\t\t}\n\n\t\t\t// If we are mounting a DOM VNode, mark it for insertion\n\t\t\tif (typeof childVNode.type != 'function') {\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t} else if (matchingIndex !== skewedIndex) {\n\t\t\tif (matchingIndex == skewedIndex - 1) {\n\t\t\t\tskew = matchingIndex - skewedIndex;\n\t\t\t} else if (matchingIndex == skewedIndex + 1) {\n\t\t\t\tskew++;\n\t\t\t} else if (matchingIndex > skewedIndex) {\n\t\t\t\t// Our matched DOM-node is further in the list of children than\n\t\t\t\t// where it's at now.\n\n\t\t\t\t// When the remaining old children is bigger than the new-children\n\t\t\t\t// minus our skewed index we know we are dealing with a shrinking list\n\t\t\t\t// we have to increase our skew with the matchedIndex - the skewed index\n\t\t\t\tif (remainingOldChildren > newChildrenLength - skewedIndex) {\n\t\t\t\t\tskew += matchingIndex - skewedIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// If we have matched all the children just decrease the skew\n\t\t\t\t\tskew--;\n\t\t\t\t}\n\t\t\t} else if (matchingIndex < skewedIndex) {\n\t\t\t\t// When our new position is in front of our old position than we increase the skew\n\t\t\t\tskew++;\n\t\t\t}\n\n\t\t\t// Move this VNode's DOM if the original index (matchingIndex) doesn't\n\t\t\t// match the new skew index (i + new skew)\n\t\t\tif (matchingIndex !== i + skew) {\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove remaining oldChildren if there are any. Loop forwards so that as we\n\t// unmount DOM from the beginning of the oldChildren, we can adjust oldDom to\n\t// point to the next child, which needs to be the first DOM node that won't be\n\t// unmounted.\n\tif (remainingOldChildren) {\n\t\tfor (i = 0; i < oldChildrenLength; i++) {\n\t\t\toldVNode = oldChildren[i];\n\t\t\tif (oldVNode != null && (oldVNode._flags & MATCHED) === 0) {\n\t\t\t\tif (oldVNode._dom == newParentVNode._nextDom) {\n\t\t\t\t\tnewParentVNode._nextDom = getDomSibling(oldVNode);\n\t\t\t\t}\n\n\t\t\t\tunmount(oldVNode, oldVNode);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {VNode} parentVNode\n * @param {PreactElement} oldDom\n * @param {PreactElement} parentDom\n * @returns {PreactElement}\n */\nfunction insert(parentVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\n\tif (typeof parentVNode.type == 'function') {\n\t\tlet children = parentVNode._children;\n\t\tfor (let i = 0; children && i < children.length; i++) {\n\t\t\tif (children[i]) {\n\t\t\t\t// If we enter this code path on sCU bailout, where we copy\n\t\t\t\t// oldVNode._children to newVNode._children, we need to update the old\n\t\t\t\t// children's _parent pointer to point to the newVNode (parentVNode\n\t\t\t\t// here).\n\t\t\t\tchildren[i]._parent = parentVNode;\n\t\t\t\toldDom = insert(children[i], oldDom, parentDom);\n\t\t\t}\n\t\t}\n\n\t\treturn oldDom;\n\t} else if (parentVNode._dom != oldDom) {\n\t\tparentDom.insertBefore(parentVNode._dom, oldDom || null);\n\t\toldDom = parentVNode._dom;\n\t}\n\n\tdo {\n\t\toldDom = oldDom && oldDom.nextSibling;\n\t} while (oldDom != null && oldDom.nodeType === 8);\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {ComponentChildren} children The unflattened children of a virtual\n * node\n * @returns {VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == null || typeof children == 'boolean') {\n\t} else if (isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\n/**\n * @param {VNode} childVNode\n * @param {VNode[]} oldChildren\n * @param {number} skewedIndex\n * @param {number} remainingOldChildren\n * @returns {number}\n */\nfunction findMatchingIndex(\n\tchildVNode,\n\toldChildren,\n\tskewedIndex,\n\tremainingOldChildren\n) {\n\tconst key = childVNode.key;\n\tconst type = childVNode.type;\n\tlet x = skewedIndex - 1;\n\tlet y = skewedIndex + 1;\n\tlet oldVNode = oldChildren[skewedIndex];\n\n\t// We only need to perform a search if there are more children\n\t// (remainingOldChildren) to search. However, if the oldVNode we just looked\n\t// at skewedIndex was not already used in this diff, then there must be at\n\t// least 1 other (so greater than 1) remainingOldChildren to attempt to match\n\t// against. So the following condition checks that ensuring\n\t// remainingOldChildren > 1 if the oldVNode is not already used/matched. Else\n\t// if the oldVNode was null or matched, then there could needs to be at least\n\t// 1 (aka `remainingOldChildren > 0`) children to find and compare against.\n\tlet shouldSearch =\n\t\tremainingOldChildren >\n\t\t(oldVNode != null && (oldVNode._flags & MATCHED) === 0 ? 1 : 0);\n\n\tif (\n\t\toldVNode === null ||\n\t\t(oldVNode &&\n\t\t\tkey == oldVNode.key &&\n\t\t\ttype === oldVNode.type &&\n\t\t\t(oldVNode._flags & MATCHED) === 0)\n\t) {\n\t\treturn skewedIndex;\n\t} else if (shouldSearch) {\n\t\twhile (x >= 0 || y < oldChildren.length) {\n\t\t\tif (x >= 0) {\n\t\t\t\toldVNode = oldChildren[x];\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\t(oldVNode._flags & MATCHED) === 0 &&\n\t\t\t\t\tkey == oldVNode.key &&\n\t\t\t\t\ttype === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\treturn x;\n\t\t\t\t}\n\t\t\t\tx--;\n\t\t\t}\n\n\t\t\tif (y < oldChildren.length) {\n\t\t\t\toldVNode = oldChildren[y];\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\t(oldVNode._flags & MATCHED) === 0 &&\n\t\t\t\t\tkey == oldVNode.key &&\n\t\t\t\t\ttype === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\treturn y;\n\t\t\t\t}\n\t\t\t\ty++;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1;\n}\n", "import {\n\tEMPTY_OBJ,\n\tMODE_HYDRATE,\n\tMODE_SUSPENDED,\n\tRESET_MODE\n} from '../constants';\nimport { BaseComponent, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { setProperty } from './props';\nimport { assign, isArray, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {PreactElement} parentDom The parent of the DOM element\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\t/** @type {any} */\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== undefined) return null;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._flags & MODE_SUSPENDED) {\n\t\tisHydrating = !!(oldVNode._flags & MODE_HYDRATE);\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\touter: if (typeof newType == 'function') {\n\t\ttry {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\t\t\tconst isClassComponent =\n\t\t\t\t'prototype' in newType && newType.prototype.render;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif (isClassComponent) {\n\t\t\t\t\t// @ts-expect-error The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-expect-error Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new BaseComponent(\n\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tc.props = newProps;\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc.context = componentContext;\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (isClassComponent && c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (isClassComponent && newType.getDerivedStateFromProps != null) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\t\t\tc._vnode = newVNode;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tc.componentWillMount != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidMount != null) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == null &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != null\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t!c._force &&\n\t\t\t\t\t((c.shouldComponentUpdate != null &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false) ||\n\t\t\t\t\t\tnewVNode._original === oldVNode._original)\n\t\t\t\t) {\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original !== oldVNode._original) {\n\t\t\t\t\t\t// When we are dealing with a bail because of sCU we have to update\n\t\t\t\t\t\t// the props, state and dirty-state.\n\t\t\t\t\t\t// when we are dealing with strict-equality we don't as the child could still\n\t\t\t\t\t\t// be dirtied see #3883\n\t\t\t\t\t\tc.props = newProps;\n\t\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t\tc._dirty = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.forEach(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t\t}\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != null) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidUpdate != null) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._parentDom = parentDom;\n\t\t\tc._force = false;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif (isClassComponent) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tfor (let i = 0; i < c._stateCallbacks.length; i++) {\n\t\t\t\t\tc._renderCallbacks.push(c._stateCallbacks[i]);\n\t\t\t\t}\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != null) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (isClassComponent && !isNew && c.getSnapshotBeforeUpdate != null) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet isTopLevelFragment =\n\t\t\t\ttmp != null && tmp.type === Fragment && tmp.key == null;\n\t\t\tlet renderResult = isTopLevelFragment ? tmp.props.children : tmp;\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tisArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnamespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._flags &= RESET_MODE;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = null;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tnewVNode._original = null;\n\t\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\t\tnewVNode._dom = oldDom;\n\t\t\t\tnewVNode._flags |= isHydrating\n\t\t\t\t\t? MODE_HYDRATE | MODE_SUSPENDED\n\t\t\t\t\t: MODE_HYDRATE;\n\t\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t\t// ^ could possibly be simplified to:\n\t\t\t\t// excessDomChildren.length = 0;\n\t\t\t} else {\n\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t}\n\t\t\toptions._catchError(e, newVNode, oldVNode);\n\t\t}\n\t} else if (\n\t\texcessDomChildren == null &&\n\t\tnewVNode._original === oldVNode._original\n\t) {\n\t\tnewVNode._children = oldVNode._children;\n\t\tnewVNode._dom = oldVNode._dom;\n\t} else {\n\t\tnewVNode._dom = diffElementNodes(\n\t\t\toldVNode._dom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\t}\n\n\tif ((tmp = options.diffed)) tmp(newVNode);\n}\n\n/**\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {VNode} root\n */\nexport function commitRoot(commitQueue, root, refQueue) {\n\troot._nextDom = undefined;\n\n\tfor (let i = 0; i < refQueue.length; i++) {\n\t\tapplyRef(refQueue[i], refQueue[++i], refQueue[++i]);\n\t}\n\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-expect-error Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-expect-error See above comment on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {PreactElement} dom The DOM element representing the virtual nodes\n * being diffed\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n * @returns {PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating,\n\trefQueue\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = /** @type {string} */ (newVNode.type);\n\t/** @type {any} */\n\tlet i;\n\t/** @type {{ __html?: string }} */\n\tlet newHtml;\n\t/** @type {{ __html?: string }} */\n\tlet oldHtml;\n\t/** @type {ComponentChildren} */\n\tlet newChildren;\n\tlet value;\n\tlet inputValue;\n\tlet checked;\n\n\t// Tracks entering and exiting namespaces when descending through the tree.\n\tif (nodeType === 'svg') namespace = 'http://www.w3.org/2000/svg';\n\telse if (nodeType === 'math')\n\t\tnamespace = 'http://www.w3.org/1998/Math/MathML';\n\telse if (!namespace) namespace = 'http://www.w3.org/1999/xhtml';\n\n\tif (excessDomChildren != null) {\n\t\tfor (i = 0; i < excessDomChildren.length; i++) {\n\t\t\tvalue = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tvalue &&\n\t\t\t\t'setAttribute' in value === !!nodeType &&\n\t\t\t\t(nodeType ? value.localName === nodeType : value.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = value;\n\t\t\t\texcessDomChildren[i] = null;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == null) {\n\t\tif (nodeType === null) {\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tdom = document.createElementNS(\n\t\t\tnamespace,\n\t\t\tnodeType,\n\t\t\tnewProps.is && newProps\n\t\t);\n\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = null;\n\t\t// we are creating a new node, so we can assume this is a new subtree (in\n\t\t// case we are hydrating), this deopts the hydrate\n\t\tisHydrating = false;\n\t}\n\n\tif (nodeType === null) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data !== newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren && slice.call(dom.childNodes);\n\n\t\toldProps = oldVNode.props || EMPTY_OBJ;\n\n\t\t// If we are in a situation where we are not hydrating but are using\n\t\t// existing DOM (e.g. replaceNode) we should read the existing DOM\n\t\t// attributes to diff them\n\t\tif (!isHydrating && excessDomChildren != null) {\n\t\t\toldProps = {};\n\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\tvalue = dom.attributes[i];\n\t\t\t\toldProps[value.name] = value.value;\n\t\t\t}\n\t\t}\n\n\t\tfor (i in oldProps) {\n\t\t\tvalue = oldProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\toldHtml = value;\n\t\t\t} else if (i !== 'key' && !(i in newProps)) {\n\t\t\t\tif (\n\t\t\t\t\t(i == 'value' && 'defaultValue' in newProps) ||\n\t\t\t\t\t(i == 'checked' && 'defaultChecked' in newProps)\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tsetProperty(dom, i, null, value, namespace);\n\t\t\t}\n\t\t}\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tfor (i in newProps) {\n\t\t\tvalue = newProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t\tnewChildren = value;\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\tnewHtml = value;\n\t\t\t} else if (i == 'value') {\n\t\t\t\tinputValue = value;\n\t\t\t} else if (i == 'checked') {\n\t\t\t\tchecked = value;\n\t\t\t} else if (\n\t\t\t\ti !== 'key' &&\n\t\t\t\t(!isHydrating || typeof value == 'function') &&\n\t\t\t\toldProps[i] !== value\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, value, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\tif (\n\t\t\t\t!isHydrating &&\n\t\t\t\t(!oldHtml ||\n\t\t\t\t\t(newHtml.__html !== oldHtml.__html &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML))\n\t\t\t) {\n\t\t\t\tdom.innerHTML = newHtml.__html;\n\t\t\t}\n\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\tif (oldHtml) dom.innerHTML = '';\n\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tisArray(newChildren) ? newChildren : [newChildren],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnodeType === 'foreignObject'\n\t\t\t\t\t? 'http://www.w3.org/1999/xhtml'\n\t\t\t\t\t: namespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tif (excessDomChildren[i] != null) removeNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// As above, don't diff props during hydration\n\t\tif (!isHydrating) {\n\t\t\ti = 'value';\n\t\t\tif (\n\t\t\t\tinputValue !== undefined &&\n\t\t\t\t// #2756 For the