From 72eb5e471058a6a2c848503b6d03af692d6f60ba Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 10 Aug 2023 15:38:41 -0400 Subject: [PATCH 01/56] bug: QA followup from bs5 shiny theme (#639) --- examples/global_pyplot/app.py | 1 + examples/static_plots/app.py | 1 + setup.cfg | 7 +++++++ shiny/experimental/e2e/sidebar/app.py | 5 +++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/global_pyplot/app.py b/examples/global_pyplot/app.py index 96752da5a..e9de2f7f0 100644 --- a/examples/global_pyplot/app.py +++ b/examples/global_pyplot/app.py @@ -9,6 +9,7 @@ ui.tags.h5("A plot should appear immediately below this text."), ), ui.output_plot("mpl"), + ui.tags.hr(), ui.panel_conditional( "input.render", ui.tags.h5("An error message should appear immediately below this text."), diff --git a/examples/static_plots/app.py b/examples/static_plots/app.py index 8334e613d..4004c183a 100644 --- a/examples/static_plots/app.py +++ b/examples/static_plots/app.py @@ -118,6 +118,7 @@ def holoviews(): @output @render.plot def xarray(): + # `pooch` module required to download `open_dataset` import xarray as xr airtemps = xr.tutorial.open_dataset("air_temperature") diff --git a/setup.cfg b/setup.cfg index d1437ec04..079e062fb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,6 +72,13 @@ test = plotnine plotly duckdb + holoviews + bokeh + xarray + geopandas + missingno + pooch + dev = black>=23.1.0 flake8>=6.0.0 diff --git a/shiny/experimental/e2e/sidebar/app.py b/shiny/experimental/e2e/sidebar/app.py index dddfb42b2..46a581a1e 100644 --- a/shiny/experimental/e2e/sidebar/app.py +++ b/shiny/experimental/e2e/sidebar/app.py @@ -7,8 +7,9 @@ app_ui = ui.page_fixed( ui.h1("Toggle Sidebars"), ui.div( - ui.input_action_button("open_all", "Show all", class_="me-1"), - ui.input_action_button("close_all", "Close all", class_="me-2"), + ui.input_action_button("open_all", "Show all", class_="me-1 mb-1"), + ui.input_action_button("close_all", "Close all", class_="mb-1"), + ui.tags.br(), ui.input_action_button("toggle_outer", "Toggle outer", class_="me-1"), ui.input_action_button("toggle_inner", "Toggle inner"), class_="my-2", From 29c17529f96b12e6954b11bd80ab0ae96b9bb4a7 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 10 Aug 2023 15:53:53 -0400 Subject: [PATCH 02/56] Wrap bare value box value in `p` tag (#668) --- CHANGELOG.md | 2 ++ e2e/controls.py | 34 +++++++++++++++++---- e2e/experimental/value_box/app.py | 7 +++-- e2e/experimental/value_box/test_valuebox.py | 33 ++++++++++++++------ shiny/experimental/ui/_valuebox.py | 2 +- 5 files changed, 59 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eda448fd5..98544f820 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +Fixes #646: Wrap bare value box value in `

` tags. (#668) + ### Other changes diff --git a/e2e/controls.py b/e2e/controls.py index 9fa3d6762..b3a274324 100644 --- a/e2e/controls.py +++ b/e2e/controls.py @@ -2445,7 +2445,6 @@ def expect_full_screen( class ValueBox( _WidthLocM, - _CardBodyM, _CardFullScreenM, _InputWithContainer, ): @@ -2469,14 +2468,14 @@ def __init__(self, page: Page, id: str) -> None: loc="> div > .value-box-grid", ) value_box_grid = self.loc - self.loc = value_box_grid.locator( - "> div > .value-box-area > :not(:first-child)" - ) self.loc_showcase = value_box_grid.locator("> div > .value-box-showcase") self.loc_title = value_box_grid.locator( - "> div > .value-box-area > :first-child" + "> div > .value-box-area > :nth-child(1)" + ) + self.loc = value_box_grid.locator("> div > .value-box-area > :nth-child(2)") + self.loc_body = value_box_grid.locator( + "> div > .value-box-area > :not(:nth-child(1), :nth-child(2))" ) - self.loc_body = self.loc self._loc_fullscreen = self.loc_container.locator( "> bslib-tooltip > .bslib-full-screen-enter" ) @@ -2505,6 +2504,29 @@ def expect_title( timeout=timeout, ) + def expect_value( + self, + text: PatternOrStr, + *, + timeout: Timeout = None, + ) -> None: + playwright_expect(self.loc).to_have_text( + text, + timeout=timeout, + ) + + def expect_body( + self, + text: PatternOrStr | list[PatternOrStr], + *, + timeout: Timeout = None, + ) -> None: + """Note: If testing against multiple elements, text should be an array""" + playwright_expect(self.loc_body).to_have_text( + text, + timeout=timeout, + ) + # hard to test since it can be customized by user # def expect_showcase_layout(self, layout, *, timeout: Timeout = None) -> None: # raise NotImplementedError() diff --git a/e2e/experimental/value_box/app.py b/e2e/experimental/value_box/app.py index 2783180b3..c8e1dc0f5 100644 --- a/e2e/experimental/value_box/app.py +++ b/e2e/experimental/value_box/app.py @@ -22,9 +22,10 @@ id="valuebox1", ), x.ui.value_box( - "KPI Title", - ui.h1(ui.HTML("$1 Billion Dollars")), - ui.span(arrow_up, " 30% VS PREVIOUS 30 DAYS"), + "title", + "value", + ui.p("content"), + ui.p("more body"), showcase=piggy_bank, class_="bg-success", full_screen=True, diff --git a/e2e/experimental/value_box/test_valuebox.py b/e2e/experimental/value_box/test_valuebox.py index d4e9924e7..e93ad74e4 100644 --- a/e2e/experimental/value_box/test_valuebox.py +++ b/e2e/experimental/value_box/test_valuebox.py @@ -8,12 +8,27 @@ def test_valuebox(page: Page, local_app: ShinyAppProc, value_box_id: str) -> None: page.goto(local_app.url) - value_box = ValueBox(page, value_box_id) - value_box.expect_height(None) - value_box.expect_title("KPI Title") - value_box.expect_full_screen(False) - value_box.open_full_screen() - value_box.expect_full_screen(True) - value_box.expect_body(["$1 Billion Dollars", "30% VS PREVIOUS 30 DAYS"]) - value_box.close_full_screen() - value_box.expect_full_screen(False) + value_box1 = ValueBox(page, "valuebox1") + value_box1.expect_height(None) + value_box1.expect_title("KPI Title") + value_box1.expect_value("$1 Billion Dollars") + value_box1.expect_full_screen(False) + value_box1.open_full_screen() + value_box1.expect_full_screen(True) + value_box1.expect_body(["30% VS PREVIOUS 30 DAYS"]) + value_box1.close_full_screen() + value_box1.expect_full_screen(False) + + value_box2 = ValueBox(page, "valuebox2") + value_box2.expect_height(None) + value_box2.expect_title("title") + value_box2.expect_value("value") + value_box2.expect_full_screen(False) + value_box2.open_full_screen() + value_box2.expect_full_screen(True) + value_box2.expect_body(["content", "more body"]) + value_box2.close_full_screen() + value_box2.expect_full_screen(False) + + title_tag_name = value_box2.loc_title.evaluate("el => el.tagName.toLowerCase()") + assert title_tag_name == "p" diff --git a/shiny/experimental/ui/_valuebox.py b/shiny/experimental/ui/_valuebox.py index b5abeb1d8..192ac69b6 100644 --- a/shiny/experimental/ui/_valuebox.py +++ b/shiny/experimental/ui/_valuebox.py @@ -96,7 +96,7 @@ def value_box( showcase_layout = showcase_left_center() if isinstance(title, (str, int, float)): title = tags.p(str(title), class_="h6 mb-1") - if isinstance(title, (str, int, float)): + if isinstance(value, (str, int, float)): value = tags.p(str(value), class_="h2 mb-2") contents = div( From b231425f9fb19b25961ff09e159042fe0355cd47 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 10 Aug 2023 16:00:21 -0400 Subject: [PATCH 03/56] Make flaky dataframe test have larger timeout (#675) --- e2e/data_frame/test_data_frame.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/e2e/data_frame/test_data_frame.py b/e2e/data_frame/test_data_frame.py index 2c2e856de..bb47a9412 100644 --- a/e2e/data_frame/test_data_frame.py +++ b/e2e/data_frame/test_data_frame.py @@ -130,9 +130,19 @@ def test_sort( select_dataset.set("diamonds") select_dataset.expect.to_have_value("diamonds") - # Test sorting + # Table cell locators header_clarity = grid_container.locator("tr:first-child th:nth-child(4)") first_cell_clarity = grid_container.locator("tr:first-child td:nth-child(4)") + + # Test that the table contents have updated + # This may timeout unless a larger timeout is given + expect(header_clarity).not_to_have_text( + "num2", + timeout=15 * 1000, # Larger timeout for CI + ) + expect(first_cell_clarity).not_to_have_text("4") + + # Test sorting expect(first_cell_clarity).to_have_text("SI2") header_clarity.click() expect(first_cell_clarity).to_have_text("I1") From db198218af53fbe02e254bc2c82be8a80777857b Mon Sep 17 00:00:00 2001 From: Adejumo Ridwan Suleiman Date: Mon, 14 Aug 2023 21:01:35 +0100 Subject: [PATCH 04/56] More realistic file import example (#582) Co-authored-by: Winston Chang --- shiny/api-examples/input_file/app.py | 57 +++++++++++++++++++--------- shiny/examples/input_file/app.py | 53 ++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 17 deletions(-) create mode 100644 shiny/examples/input_file/app.py diff --git a/shiny/api-examples/input_file/app.py b/shiny/api-examples/input_file/app.py index 7038bf6de..a6134cb34 100644 --- a/shiny/api-examples/input_file/app.py +++ b/shiny/api-examples/input_file/app.py @@ -1,31 +1,54 @@ import pandas as pd -from shiny import App, Inputs, Outputs, Session, render, ui +from shiny import App, Inputs, Outputs, Session, reactive, render, ui from shiny.types import FileInfo app_ui = ui.page_fluid( - ui.layout_sidebar( - ui.panel_sidebar( - ui.input_file("file1", "Choose CSV File", accept=[".csv"], multiple=False), - ui.input_checkbox("header", "Header", True), - width=5, - ), - ui.panel_main( - ui.output_ui("contents"), - ), + ui.input_file("file1", "Choose CSV File", accept=[".csv"], multiple=False), + ui.input_checkbox_group( + "stats", + "Summary Stats", + choices=["Row Count", "Column Count", "Column Names"], + selected=["Row Count", "Column Count", "Column Names"], ), + ui.output_table("summary"), ) def server(input: Inputs, output: Outputs, session: Session): + @reactive.Calc + def parsed_file(): + file: list[FileInfo] = input.file1() + if file is None: + return pd.DataFrame() + return pd.read_csv(file[0]["datapath"]) + @output - @render.ui - def contents(): - if input.file1() is None: - return "Please upload a csv file" - f: list[FileInfo] = input.file1() - df = pd.read_csv(f[0]["datapath"], header=0 if input.header() else None) - return ui.HTML(df.to_html(classes="table table-striped")) + @render.table + def summary(): + df = parsed_file() + + if df.empty: + return pd.DataFrame() + + # Get the row count, column count, and column names of the DataFrame + row_count = df.shape[0] + column_count = df.shape[1] + names = df.columns.tolist() + column_names = ", ".join(str(name) for name in names) + + # Create a new DataFrame to display the information + info_df = pd.DataFrame( + { + "Row Count": [row_count], + "Column Count": [column_count], + "Column Names": [column_names], + } + ) + + # input.stats() is a list of strings; subset the columns based on the selected + # checkboxes + return info_df.loc[:, input.stats()] app = App(app_ui, server) diff --git a/shiny/examples/input_file/app.py b/shiny/examples/input_file/app.py new file mode 100644 index 000000000..d7bb420db --- /dev/null +++ b/shiny/examples/input_file/app.py @@ -0,0 +1,53 @@ +import pandas as pd + +from shiny import App, reactive, render, ui + +app_ui = ui.page_fluid( + ui.input_file("file1", "Upload a CSV file", accept=".csv"), + ui.input_checkbox_group( + "stats", + "Summary Stats", + choices=["Row Count", "Column Count", "Column Names"], + selected=["Row Count", "Column Count", "Column Names"], + ), + ui.output_table("summary"), +) + + +def server(input: Inputs, output: Outputs, session: Session): + @reactive.Calc + def parsed_file(): + file: list[FileInfo] = input.file1() + if file is None: + return pd.DataFrame() + return pd.read_csv(file[0]["datapath"]) + + @output + @render.table + def summary(): + df = parsed_file() + + if df.empty: + return pd.DataFrame() + + # Get the row count, column count, and column names of the DataFrame + row_count = df.shape[0] + column_count = df.shape[1] + names = df.columns.tolist() + column_names = ", ".join(str(name) for name in names) + + # Create a new DataFrame to display the information + info_df = pd.DataFrame( + { + "Row Count": [row_count], + "Column Count": [column_count], + "Column Names": [column_names], + } + ) + + # input.stats() is a list of strings; subset the columns based on the selected + # checkboxes + return info_df.loc[:, input.stats()] + + +app = App(app_ui, server) From 88e80544a816ef962492a3c3fa943d9808fb585d Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Mon, 14 Aug 2023 15:02:20 -0500 Subject: [PATCH 05/56] Synchonize input_file examples --- shiny/api-examples/input_file/app.py | 2 +- shiny/examples/input_file/app.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/shiny/api-examples/input_file/app.py b/shiny/api-examples/input_file/app.py index a6134cb34..2236bef20 100644 --- a/shiny/api-examples/input_file/app.py +++ b/shiny/api-examples/input_file/app.py @@ -18,7 +18,7 @@ def server(input: Inputs, output: Outputs, session: Session): @reactive.Calc def parsed_file(): - file: list[FileInfo] = input.file1() + file: list[FileInfo] | None = input.file1() if file is None: return pd.DataFrame() return pd.read_csv(file[0]["datapath"]) diff --git a/shiny/examples/input_file/app.py b/shiny/examples/input_file/app.py index d7bb420db..2236bef20 100644 --- a/shiny/examples/input_file/app.py +++ b/shiny/examples/input_file/app.py @@ -1,9 +1,10 @@ import pandas as pd -from shiny import App, reactive, render, ui +from shiny import App, Inputs, Outputs, Session, reactive, render, ui +from shiny.types import FileInfo app_ui = ui.page_fluid( - ui.input_file("file1", "Upload a CSV file", accept=".csv"), + ui.input_file("file1", "Choose CSV File", accept=[".csv"], multiple=False), ui.input_checkbox_group( "stats", "Summary Stats", @@ -17,7 +18,7 @@ def server(input: Inputs, output: Outputs, session: Session): @reactive.Calc def parsed_file(): - file: list[FileInfo] = input.file1() + file: list[FileInfo] | None = input.file1() if file is None: return pd.DataFrame() return pd.read_csv(file[0]["datapath"]) From 6d88bb3755956824e6841eb8057d19338f6b18cc Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Mon, 14 Aug 2023 16:24:31 -0500 Subject: [PATCH 06/56] Suppress type check for read_csv --- shiny/api-examples/input_file/app.py | 4 +++- shiny/examples/input_file/app.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/shiny/api-examples/input_file/app.py b/shiny/api-examples/input_file/app.py index 2236bef20..0b754bafa 100644 --- a/shiny/api-examples/input_file/app.py +++ b/shiny/api-examples/input_file/app.py @@ -21,7 +21,9 @@ def parsed_file(): file: list[FileInfo] | None = input.file1() if file is None: return pd.DataFrame() - return pd.read_csv(file[0]["datapath"]) + return pd.read_csv( # pyright: ignore[reportUnknownMemberType] + file[0]["datapath"] + ) @output @render.table diff --git a/shiny/examples/input_file/app.py b/shiny/examples/input_file/app.py index 2236bef20..0b754bafa 100644 --- a/shiny/examples/input_file/app.py +++ b/shiny/examples/input_file/app.py @@ -21,7 +21,9 @@ def parsed_file(): file: list[FileInfo] | None = input.file1() if file is None: return pd.DataFrame() - return pd.read_csv(file[0]["datapath"]) + return pd.read_csv( # pyright: ignore[reportUnknownMemberType] + file[0]["datapath"] + ) @output @render.table From 32b79ea5925b0b12cfecf745e5f112541a0541dd Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Mon, 14 Aug 2023 19:20:36 -0700 Subject: [PATCH 07/56] Make model score app work on Connect/Shinyapps.io (#657) --- examples/model-score/scoredata.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/model-score/scoredata.py b/examples/model-score/scoredata.py index 4e595fe72..11613c4da 100644 --- a/examples/model-score/scoredata.py +++ b/examples/model-score/scoredata.py @@ -55,4 +55,16 @@ async def update_db(position): def begin(): position = init_db() - asyncio.create_task(update_db(position)) + + # After initializing the database, we need to start a non-blocking task to update it + # every second or so. If an event loop is already running, we can use an asyncio + # task. (This is the case when running via `shiny run` and shinylive.) Otherwise, we + # need to launch a background thread and run an asyncio event loop there. (This is + # the case when running via shinyapps.io or Posit Connect.) + + if asyncio.get_event_loop().is_running(): + asyncio.create_task(update_db(position)) + else: + from threading import Thread + + Thread(target=lambda: asyncio.run(update_db(position)), daemon=True).start() From 4bcd5296e36438928e793b068c4aa5b79dd4f134 Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Tue, 15 Aug 2023 12:04:23 -0700 Subject: [PATCH 08/56] Fix pyright error (#678) --- shiny/examples/input_file/app.py | 56 -------------------------------- shiny/plotutils.py | 5 ++- 2 files changed, 4 insertions(+), 57 deletions(-) delete mode 100644 shiny/examples/input_file/app.py diff --git a/shiny/examples/input_file/app.py b/shiny/examples/input_file/app.py deleted file mode 100644 index 0b754bafa..000000000 --- a/shiny/examples/input_file/app.py +++ /dev/null @@ -1,56 +0,0 @@ -import pandas as pd - -from shiny import App, Inputs, Outputs, Session, reactive, render, ui -from shiny.types import FileInfo - -app_ui = ui.page_fluid( - ui.input_file("file1", "Choose CSV File", accept=[".csv"], multiple=False), - ui.input_checkbox_group( - "stats", - "Summary Stats", - choices=["Row Count", "Column Count", "Column Names"], - selected=["Row Count", "Column Count", "Column Names"], - ), - ui.output_table("summary"), -) - - -def server(input: Inputs, output: Outputs, session: Session): - @reactive.Calc - def parsed_file(): - file: list[FileInfo] | None = input.file1() - if file is None: - return pd.DataFrame() - return pd.read_csv( # pyright: ignore[reportUnknownMemberType] - file[0]["datapath"] - ) - - @output - @render.table - def summary(): - df = parsed_file() - - if df.empty: - return pd.DataFrame() - - # Get the row count, column count, and column names of the DataFrame - row_count = df.shape[0] - column_count = df.shape[1] - names = df.columns.tolist() - column_names = ", ".join(str(name) for name in names) - - # Create a new DataFrame to display the information - info_df = pd.DataFrame( - { - "Row Count": [row_count], - "Column Count": [column_count], - "Column Names": [column_names], - } - ) - - # input.stats() is a list of strings; subset the columns based on the selected - # checkboxes - return info_df.loc[:, input.stats()] - - -app = App(app_ui, server) diff --git a/shiny/plotutils.py b/shiny/plotutils.py index 05c3f1fad..a7e7bca68 100644 --- a/shiny/plotutils.py +++ b/shiny/plotutils.py @@ -104,7 +104,10 @@ def brushed_points( use_y = "y" in brush["direction"] # Filter out x and y values - keep_rows: pd.Series[bool] = pd.Series(True, index=new_df.index) + keep_rows: pd.Series[bool] = pd.Series( + True, + index=new_df.index, # pyright: ignore[reportUnknownMemberType] + ) if use_x: if xvar is None and "x" in brush["mapping"]: xvar = brush["mapping"]["x"] From 196f4cd42aef64931630666e31ed0d0dde211eee Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Wed, 16 Aug 2023 12:59:15 -0400 Subject: [PATCH 09/56] Consolidate all testing into `tests/` folder (#683) --- Makefile | 6 +++--- pytest.ini | 2 +- tests/__init__.py | 2 +- {e2e => tests/e2e}/README.md | 0 {e2e => tests/e2e}/async/app.py | 0 {e2e => tests/e2e}/async/test_async.py | 0 .../bugs/0648-update-slider-datetime-value/app.py | 0 .../test_update_slider_datetime_value.py | 0 {e2e => tests/e2e}/bugs/0666-sidebar/app.py | 0 {e2e => tests/e2e}/bugs/0666-sidebar/colors.py | 0 .../e2e}/bugs/0666-sidebar/test_sidebar_colors.py | 0 {e2e => tests/e2e}/conftest.py | 7 ++++--- {e2e => tests/e2e}/controls.py | 0 {e2e => tests/e2e}/cpuinfo/test_app.py | 0 .../data_frame/__snapshots__/test_data_frame.ambr | 0 {e2e => tests/e2e}/data_frame/test_data_frame.py | 0 {e2e => tests/e2e}/examples/test_examples.py | 11 ++++++----- {e2e => tests/e2e}/experimental/accordion/app.py | 0 .../e2e}/experimental/accordion/test_accordion.py | 0 {e2e => tests/e2e}/experimental/card/app.py | 0 {e2e => tests/e2e}/experimental/card/test_card.py | 0 {e2e => tests/e2e}/experimental/test_autoresize.py | 0 {e2e => tests/e2e}/experimental/test_sidebar.py | 0 {e2e => tests/e2e}/experimental/value_box/app.py | 0 .../e2e}/experimental/value_box/test_valuebox.py | 0 .../e2e}/inputs/input_radio_checkbox_group/app.py | 0 .../test_input_radio_checkbox_group_app.py | 0 {e2e => tests/e2e}/inputs/input_slider/app.py | 2 +- .../e2e}/inputs/input_slider/test_input_slider_app.py | 0 .../e2e}/inputs/test_input_action_button_link.py | 0 {e2e => tests/e2e}/inputs/test_input_checkbox.py | 0 .../e2e}/inputs/test_input_checkbox_group.py | 0 {e2e => tests/e2e}/inputs/test_input_date.py | 0 {e2e => tests/e2e}/inputs/test_input_date_range.py | 0 {e2e => tests/e2e}/inputs/test_input_file.py | 0 {e2e => tests/e2e}/inputs/test_input_numeric.py | 0 {e2e => tests/e2e}/inputs/test_input_password.py | 0 {e2e => tests/e2e}/inputs/test_input_radio_buttons.py | 0 {e2e => tests/e2e}/inputs/test_input_select.py | 0 {e2e => tests/e2e}/inputs/test_input_selectize.py | 0 {e2e => tests/e2e}/inputs/test_input_slider.py | 0 {e2e => tests/e2e}/inputs/test_input_switch.py | 0 {e2e => tests/e2e}/inputs/test_input_text.py | 0 {e2e => tests/e2e}/inputs/test_input_text_area.py | 0 {e2e => tests/e2e}/inputs/test_inputs_update.py | 0 {e2e => tests/e2e}/module-conditional/app.py | 0 .../module-conditional/test_module_conditional.py | 0 {e2e => tests/e2e}/outputs/test_output_image.py | 0 {e2e => tests/e2e}/outputs/test_output_plot.py | 0 {e2e => tests/e2e}/outputs/test_output_table.py | 0 {e2e => tests/e2e}/outputs/test_output_text.py | 0 {e2e => tests/e2e}/outputs/test_output_ui.py | 0 {e2e => tests/e2e}/server/output_transformer/app.py | 0 .../output_transformer/test_output_transformer.py | 0 tests/pytest/__init__.py | 1 + tests/{ => pytest}/asyncio_prevent.py | 0 tests/{ => pytest}/mocktime.py | 0 tests/{ => pytest}/test_datastructures.py | 0 tests/{ => pytest}/test_e2e_regex_matching.py | 2 +- tests/{ => pytest}/test_markdown.py | 0 tests/{ => pytest}/test_modules.py | 0 tests/{ => pytest}/test_namespaces.py | 0 tests/{ => pytest}/test_navs.py | 0 tests/{ => pytest}/test_output_transformer.py | 0 tests/{ => pytest}/test_poll.py | 0 tests/{ => pytest}/test_reactives.py | 0 tests/{ => pytest}/test_shinysession.py | 0 tests/{ => pytest}/test_static.py | 0 tests/{ => pytest}/test_ui.py | 0 tests/{ => pytest}/test_ui_dependencies.py | 0 tests/{ => pytest}/test_utils.py | 0 tests/{ => pytest}/test_utils_async.py | 0 tests/{ => pytest}/test_x_sidebar.py | 0 73 files changed, 18 insertions(+), 15 deletions(-) rename {e2e => tests/e2e}/README.md (100%) rename {e2e => tests/e2e}/async/app.py (100%) rename {e2e => tests/e2e}/async/test_async.py (100%) rename {e2e => tests/e2e}/bugs/0648-update-slider-datetime-value/app.py (100%) rename {e2e => tests/e2e}/bugs/0648-update-slider-datetime-value/test_update_slider_datetime_value.py (100%) rename {e2e => tests/e2e}/bugs/0666-sidebar/app.py (100%) rename {e2e => tests/e2e}/bugs/0666-sidebar/colors.py (100%) rename {e2e => tests/e2e}/bugs/0666-sidebar/test_sidebar_colors.py (100%) rename {e2e => tests/e2e}/conftest.py (96%) rename {e2e => tests/e2e}/controls.py (100%) rename {e2e => tests/e2e}/cpuinfo/test_app.py (100%) rename {e2e => tests/e2e}/data_frame/__snapshots__/test_data_frame.ambr (100%) rename {e2e => tests/e2e}/data_frame/test_data_frame.py (100%) rename {e2e => tests/e2e}/examples/test_examples.py (95%) rename {e2e => tests/e2e}/experimental/accordion/app.py (100%) rename {e2e => tests/e2e}/experimental/accordion/test_accordion.py (100%) rename {e2e => tests/e2e}/experimental/card/app.py (100%) rename {e2e => tests/e2e}/experimental/card/test_card.py (100%) rename {e2e => tests/e2e}/experimental/test_autoresize.py (100%) rename {e2e => tests/e2e}/experimental/test_sidebar.py (100%) rename {e2e => tests/e2e}/experimental/value_box/app.py (100%) rename {e2e => tests/e2e}/experimental/value_box/test_valuebox.py (100%) rename {e2e => tests/e2e}/inputs/input_radio_checkbox_group/app.py (100%) rename {e2e => tests/e2e}/inputs/input_radio_checkbox_group/test_input_radio_checkbox_group_app.py (100%) rename {e2e => tests/e2e}/inputs/input_slider/app.py (97%) rename {e2e => tests/e2e}/inputs/input_slider/test_input_slider_app.py (100%) rename {e2e => tests/e2e}/inputs/test_input_action_button_link.py (100%) rename {e2e => tests/e2e}/inputs/test_input_checkbox.py (100%) rename {e2e => tests/e2e}/inputs/test_input_checkbox_group.py (100%) rename {e2e => tests/e2e}/inputs/test_input_date.py (100%) rename {e2e => tests/e2e}/inputs/test_input_date_range.py (100%) rename {e2e => tests/e2e}/inputs/test_input_file.py (100%) rename {e2e => tests/e2e}/inputs/test_input_numeric.py (100%) rename {e2e => tests/e2e}/inputs/test_input_password.py (100%) rename {e2e => tests/e2e}/inputs/test_input_radio_buttons.py (100%) rename {e2e => tests/e2e}/inputs/test_input_select.py (100%) rename {e2e => tests/e2e}/inputs/test_input_selectize.py (100%) rename {e2e => tests/e2e}/inputs/test_input_slider.py (100%) rename {e2e => tests/e2e}/inputs/test_input_switch.py (100%) rename {e2e => tests/e2e}/inputs/test_input_text.py (100%) rename {e2e => tests/e2e}/inputs/test_input_text_area.py (100%) rename {e2e => tests/e2e}/inputs/test_inputs_update.py (100%) rename {e2e => tests/e2e}/module-conditional/app.py (100%) rename {e2e => tests/e2e}/module-conditional/test_module_conditional.py (100%) rename {e2e => tests/e2e}/outputs/test_output_image.py (100%) rename {e2e => tests/e2e}/outputs/test_output_plot.py (100%) rename {e2e => tests/e2e}/outputs/test_output_table.py (100%) rename {e2e => tests/e2e}/outputs/test_output_text.py (100%) rename {e2e => tests/e2e}/outputs/test_output_ui.py (100%) rename {e2e => tests/e2e}/server/output_transformer/app.py (100%) rename {e2e => tests/e2e}/server/output_transformer/test_output_transformer.py (100%) create mode 100644 tests/pytest/__init__.py rename tests/{ => pytest}/asyncio_prevent.py (100%) rename tests/{ => pytest}/mocktime.py (100%) rename tests/{ => pytest}/test_datastructures.py (100%) rename tests/{ => pytest}/test_e2e_regex_matching.py (93%) rename tests/{ => pytest}/test_markdown.py (100%) rename tests/{ => pytest}/test_modules.py (100%) rename tests/{ => pytest}/test_namespaces.py (100%) rename tests/{ => pytest}/test_navs.py (100%) rename tests/{ => pytest}/test_output_transformer.py (100%) rename tests/{ => pytest}/test_poll.py (100%) rename tests/{ => pytest}/test_reactives.py (100%) rename tests/{ => pytest}/test_shinysession.py (100%) rename tests/{ => pytest}/test_static.py (100%) rename tests/{ => pytest}/test_ui.py (100%) rename tests/{ => pytest}/test_ui_dependencies.py (100%) rename tests/{ => pytest}/test_utils.py (100%) rename tests/{ => pytest}/test_utils_async.py (100%) rename tests/{ => pytest}/test_x_sidebar.py (100%) diff --git a/Makefile b/Makefile index bdb9c31c0..504d2724e 100644 --- a/Makefile +++ b/Makefile @@ -77,11 +77,11 @@ check: ## check code quality with black and isort isort --check-only --diff . test: ## run tests quickly with the default Python - python3 tests/asyncio_prevent.py - pytest tests + python3 tests/pytest/asyncio_prevent.py + pytest # Default `FILE` to `e2e` if not specified -FILE:=e2e +FILE:=tests/e2e e2e: ## end-to-end tests with playwright playwright install --with-deps diff --git a/pytest.ini b/pytest.ini index b72857557..d9f04e617 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] asyncio_mode=strict -testpaths=tests +testpaths=tests/pytest/ addopts = --strict-markers --durations=6 --durations-min=5.0 --browser webkit --browser firefox --browser chromium --numprocesses auto markers = examples: Suite of tests to validate that examples do not produce errors (deselect with '-m "not examples"') diff --git a/tests/__init__.py b/tests/__init__.py index f75450590..ab964c858 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Unit test package for shiny.""" +"""Testing package for shiny. (Used by pytest)""" diff --git a/e2e/README.md b/tests/e2e/README.md similarity index 100% rename from e2e/README.md rename to tests/e2e/README.md diff --git a/e2e/async/app.py b/tests/e2e/async/app.py similarity index 100% rename from e2e/async/app.py rename to tests/e2e/async/app.py diff --git a/e2e/async/test_async.py b/tests/e2e/async/test_async.py similarity index 100% rename from e2e/async/test_async.py rename to tests/e2e/async/test_async.py diff --git a/e2e/bugs/0648-update-slider-datetime-value/app.py b/tests/e2e/bugs/0648-update-slider-datetime-value/app.py similarity index 100% rename from e2e/bugs/0648-update-slider-datetime-value/app.py rename to tests/e2e/bugs/0648-update-slider-datetime-value/app.py diff --git a/e2e/bugs/0648-update-slider-datetime-value/test_update_slider_datetime_value.py b/tests/e2e/bugs/0648-update-slider-datetime-value/test_update_slider_datetime_value.py similarity index 100% rename from e2e/bugs/0648-update-slider-datetime-value/test_update_slider_datetime_value.py rename to tests/e2e/bugs/0648-update-slider-datetime-value/test_update_slider_datetime_value.py diff --git a/e2e/bugs/0666-sidebar/app.py b/tests/e2e/bugs/0666-sidebar/app.py similarity index 100% rename from e2e/bugs/0666-sidebar/app.py rename to tests/e2e/bugs/0666-sidebar/app.py diff --git a/e2e/bugs/0666-sidebar/colors.py b/tests/e2e/bugs/0666-sidebar/colors.py similarity index 100% rename from e2e/bugs/0666-sidebar/colors.py rename to tests/e2e/bugs/0666-sidebar/colors.py diff --git a/e2e/bugs/0666-sidebar/test_sidebar_colors.py b/tests/e2e/bugs/0666-sidebar/test_sidebar_colors.py similarity index 100% rename from e2e/bugs/0666-sidebar/test_sidebar_colors.py rename to tests/e2e/bugs/0666-sidebar/test_sidebar_colors.py diff --git a/e2e/conftest.py b/tests/e2e/conftest.py similarity index 96% rename from e2e/conftest.py rename to tests/e2e/conftest.py index 5949f04f3..b8120ae9f 100644 --- a/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -29,6 +29,7 @@ ) here = PurePath(__file__).parent +here_root = here.parent.parent class OutputStream: @@ -192,20 +193,20 @@ def fixture_func(): def create_example_fixture(example_name: str, scope: str = "module"): """Used to create app fixtures from apps in py-shiny/examples""" - return create_app_fixture(here / "../examples" / example_name / "app.py", scope) + return create_app_fixture(here_root / "examples" / example_name / "app.py", scope) def create_doc_example_fixture(example_name: str, scope: str = "module"): """Used to create app fixtures from apps in py-shiny/shiny/api-examples""" return create_app_fixture( - here / "../shiny/api-examples" / example_name / "app.py", scope + here_root / "shiny/api-examples" / example_name / "app.py", scope ) def x_create_doc_example_fixture(example_name: str, scope: str = "module"): """Used to create app fixtures from apps in py-shiny/shiny/examples""" return create_app_fixture( - here / "../shiny/experimental/api-examples" / example_name / "app.py", scope + here_root / "shiny/experimental/api-examples" / example_name / "app.py", scope ) diff --git a/e2e/controls.py b/tests/e2e/controls.py similarity index 100% rename from e2e/controls.py rename to tests/e2e/controls.py diff --git a/e2e/cpuinfo/test_app.py b/tests/e2e/cpuinfo/test_app.py similarity index 100% rename from e2e/cpuinfo/test_app.py rename to tests/e2e/cpuinfo/test_app.py diff --git a/e2e/data_frame/__snapshots__/test_data_frame.ambr b/tests/e2e/data_frame/__snapshots__/test_data_frame.ambr similarity index 100% rename from e2e/data_frame/__snapshots__/test_data_frame.ambr rename to tests/e2e/data_frame/__snapshots__/test_data_frame.ambr diff --git a/e2e/data_frame/test_data_frame.py b/tests/e2e/data_frame/test_data_frame.py similarity index 100% rename from e2e/data_frame/test_data_frame.py rename to tests/e2e/data_frame/test_data_frame.py diff --git a/e2e/examples/test_examples.py b/tests/e2e/examples/test_examples.py similarity index 95% rename from e2e/examples/test_examples.py rename to tests/e2e/examples/test_examples.py index cd512bf0c..bc7d51cd3 100644 --- a/e2e/examples/test_examples.py +++ b/tests/e2e/examples/test_examples.py @@ -6,11 +6,12 @@ from conftest import run_shiny_app from playwright.sync_api import ConsoleMessage, Page -here = PurePath(__file__).parent +here_tests_e2e_examples = PurePath(__file__).parent +here_root = here_tests_e2e_examples.parent.parent.parent def get_apps(path: str) -> typing.List[str]: - full_path = here / path + full_path = here_root / path app_paths: typing.List[str] = [] for folder in os.listdir(full_path): folder_path = os.path.join(full_path, folder) @@ -23,8 +24,8 @@ def get_apps(path: str) -> typing.List[str]: example_apps: typing.List[str] = [ - *get_apps("../../examples"), - *get_apps("../../shiny/api-examples"), + *get_apps("examples"), + *get_apps("shiny/api-examples"), ] app_idle_wait = {"duration": 300, "timeout": 5 * 1000} @@ -107,7 +108,7 @@ def wait_for_idle_app( @pytest.mark.parametrize("ex_app_path", example_apps) @pytest.mark.flaky(reruns=3, reruns_delay=1) def test_examples(page: Page, ex_app_path: str) -> None: - app = run_shiny_app(here / ex_app_path, wait_for_start=True) + app = run_shiny_app(here_root / ex_app_path, wait_for_start=True) console_errors: typing.List[str] = [] diff --git a/e2e/experimental/accordion/app.py b/tests/e2e/experimental/accordion/app.py similarity index 100% rename from e2e/experimental/accordion/app.py rename to tests/e2e/experimental/accordion/app.py diff --git a/e2e/experimental/accordion/test_accordion.py b/tests/e2e/experimental/accordion/test_accordion.py similarity index 100% rename from e2e/experimental/accordion/test_accordion.py rename to tests/e2e/experimental/accordion/test_accordion.py diff --git a/e2e/experimental/card/app.py b/tests/e2e/experimental/card/app.py similarity index 100% rename from e2e/experimental/card/app.py rename to tests/e2e/experimental/card/app.py diff --git a/e2e/experimental/card/test_card.py b/tests/e2e/experimental/card/test_card.py similarity index 100% rename from e2e/experimental/card/test_card.py rename to tests/e2e/experimental/card/test_card.py diff --git a/e2e/experimental/test_autoresize.py b/tests/e2e/experimental/test_autoresize.py similarity index 100% rename from e2e/experimental/test_autoresize.py rename to tests/e2e/experimental/test_autoresize.py diff --git a/e2e/experimental/test_sidebar.py b/tests/e2e/experimental/test_sidebar.py similarity index 100% rename from e2e/experimental/test_sidebar.py rename to tests/e2e/experimental/test_sidebar.py diff --git a/e2e/experimental/value_box/app.py b/tests/e2e/experimental/value_box/app.py similarity index 100% rename from e2e/experimental/value_box/app.py rename to tests/e2e/experimental/value_box/app.py diff --git a/e2e/experimental/value_box/test_valuebox.py b/tests/e2e/experimental/value_box/test_valuebox.py similarity index 100% rename from e2e/experimental/value_box/test_valuebox.py rename to tests/e2e/experimental/value_box/test_valuebox.py diff --git a/e2e/inputs/input_radio_checkbox_group/app.py b/tests/e2e/inputs/input_radio_checkbox_group/app.py similarity index 100% rename from e2e/inputs/input_radio_checkbox_group/app.py rename to tests/e2e/inputs/input_radio_checkbox_group/app.py diff --git a/e2e/inputs/input_radio_checkbox_group/test_input_radio_checkbox_group_app.py b/tests/e2e/inputs/input_radio_checkbox_group/test_input_radio_checkbox_group_app.py similarity index 100% rename from e2e/inputs/input_radio_checkbox_group/test_input_radio_checkbox_group_app.py rename to tests/e2e/inputs/input_radio_checkbox_group/test_input_radio_checkbox_group_app.py diff --git a/e2e/inputs/input_slider/app.py b/tests/e2e/inputs/input_slider/app.py similarity index 97% rename from e2e/inputs/input_slider/app.py rename to tests/e2e/inputs/input_slider/app.py index 5f3626604..949746f89 100644 --- a/e2e/inputs/input_slider/app.py +++ b/tests/e2e/inputs/input_slider/app.py @@ -1,7 +1,7 @@ from __future__ import annotations -from e2e.controls import typing from shiny import App, Inputs, Outputs, Session, render, ui +from tests.e2e.controls import typing slider_nums: list[int] = [] diff --git a/e2e/inputs/input_slider/test_input_slider_app.py b/tests/e2e/inputs/input_slider/test_input_slider_app.py similarity index 100% rename from e2e/inputs/input_slider/test_input_slider_app.py rename to tests/e2e/inputs/input_slider/test_input_slider_app.py diff --git a/e2e/inputs/test_input_action_button_link.py b/tests/e2e/inputs/test_input_action_button_link.py similarity index 100% rename from e2e/inputs/test_input_action_button_link.py rename to tests/e2e/inputs/test_input_action_button_link.py diff --git a/e2e/inputs/test_input_checkbox.py b/tests/e2e/inputs/test_input_checkbox.py similarity index 100% rename from e2e/inputs/test_input_checkbox.py rename to tests/e2e/inputs/test_input_checkbox.py diff --git a/e2e/inputs/test_input_checkbox_group.py b/tests/e2e/inputs/test_input_checkbox_group.py similarity index 100% rename from e2e/inputs/test_input_checkbox_group.py rename to tests/e2e/inputs/test_input_checkbox_group.py diff --git a/e2e/inputs/test_input_date.py b/tests/e2e/inputs/test_input_date.py similarity index 100% rename from e2e/inputs/test_input_date.py rename to tests/e2e/inputs/test_input_date.py diff --git a/e2e/inputs/test_input_date_range.py b/tests/e2e/inputs/test_input_date_range.py similarity index 100% rename from e2e/inputs/test_input_date_range.py rename to tests/e2e/inputs/test_input_date_range.py diff --git a/e2e/inputs/test_input_file.py b/tests/e2e/inputs/test_input_file.py similarity index 100% rename from e2e/inputs/test_input_file.py rename to tests/e2e/inputs/test_input_file.py diff --git a/e2e/inputs/test_input_numeric.py b/tests/e2e/inputs/test_input_numeric.py similarity index 100% rename from e2e/inputs/test_input_numeric.py rename to tests/e2e/inputs/test_input_numeric.py diff --git a/e2e/inputs/test_input_password.py b/tests/e2e/inputs/test_input_password.py similarity index 100% rename from e2e/inputs/test_input_password.py rename to tests/e2e/inputs/test_input_password.py diff --git a/e2e/inputs/test_input_radio_buttons.py b/tests/e2e/inputs/test_input_radio_buttons.py similarity index 100% rename from e2e/inputs/test_input_radio_buttons.py rename to tests/e2e/inputs/test_input_radio_buttons.py diff --git a/e2e/inputs/test_input_select.py b/tests/e2e/inputs/test_input_select.py similarity index 100% rename from e2e/inputs/test_input_select.py rename to tests/e2e/inputs/test_input_select.py diff --git a/e2e/inputs/test_input_selectize.py b/tests/e2e/inputs/test_input_selectize.py similarity index 100% rename from e2e/inputs/test_input_selectize.py rename to tests/e2e/inputs/test_input_selectize.py diff --git a/e2e/inputs/test_input_slider.py b/tests/e2e/inputs/test_input_slider.py similarity index 100% rename from e2e/inputs/test_input_slider.py rename to tests/e2e/inputs/test_input_slider.py diff --git a/e2e/inputs/test_input_switch.py b/tests/e2e/inputs/test_input_switch.py similarity index 100% rename from e2e/inputs/test_input_switch.py rename to tests/e2e/inputs/test_input_switch.py diff --git a/e2e/inputs/test_input_text.py b/tests/e2e/inputs/test_input_text.py similarity index 100% rename from e2e/inputs/test_input_text.py rename to tests/e2e/inputs/test_input_text.py diff --git a/e2e/inputs/test_input_text_area.py b/tests/e2e/inputs/test_input_text_area.py similarity index 100% rename from e2e/inputs/test_input_text_area.py rename to tests/e2e/inputs/test_input_text_area.py diff --git a/e2e/inputs/test_inputs_update.py b/tests/e2e/inputs/test_inputs_update.py similarity index 100% rename from e2e/inputs/test_inputs_update.py rename to tests/e2e/inputs/test_inputs_update.py diff --git a/e2e/module-conditional/app.py b/tests/e2e/module-conditional/app.py similarity index 100% rename from e2e/module-conditional/app.py rename to tests/e2e/module-conditional/app.py diff --git a/e2e/module-conditional/test_module_conditional.py b/tests/e2e/module-conditional/test_module_conditional.py similarity index 100% rename from e2e/module-conditional/test_module_conditional.py rename to tests/e2e/module-conditional/test_module_conditional.py diff --git a/e2e/outputs/test_output_image.py b/tests/e2e/outputs/test_output_image.py similarity index 100% rename from e2e/outputs/test_output_image.py rename to tests/e2e/outputs/test_output_image.py diff --git a/e2e/outputs/test_output_plot.py b/tests/e2e/outputs/test_output_plot.py similarity index 100% rename from e2e/outputs/test_output_plot.py rename to tests/e2e/outputs/test_output_plot.py diff --git a/e2e/outputs/test_output_table.py b/tests/e2e/outputs/test_output_table.py similarity index 100% rename from e2e/outputs/test_output_table.py rename to tests/e2e/outputs/test_output_table.py diff --git a/e2e/outputs/test_output_text.py b/tests/e2e/outputs/test_output_text.py similarity index 100% rename from e2e/outputs/test_output_text.py rename to tests/e2e/outputs/test_output_text.py diff --git a/e2e/outputs/test_output_ui.py b/tests/e2e/outputs/test_output_ui.py similarity index 100% rename from e2e/outputs/test_output_ui.py rename to tests/e2e/outputs/test_output_ui.py diff --git a/e2e/server/output_transformer/app.py b/tests/e2e/server/output_transformer/app.py similarity index 100% rename from e2e/server/output_transformer/app.py rename to tests/e2e/server/output_transformer/app.py diff --git a/e2e/server/output_transformer/test_output_transformer.py b/tests/e2e/server/output_transformer/test_output_transformer.py similarity index 100% rename from e2e/server/output_transformer/test_output_transformer.py rename to tests/e2e/server/output_transformer/test_output_transformer.py diff --git a/tests/pytest/__init__.py b/tests/pytest/__init__.py new file mode 100644 index 000000000..25c456422 --- /dev/null +++ b/tests/pytest/__init__.py @@ -0,0 +1 @@ +"""Pytest test module for shiny. (Used by pytest)""" diff --git a/tests/asyncio_prevent.py b/tests/pytest/asyncio_prevent.py similarity index 100% rename from tests/asyncio_prevent.py rename to tests/pytest/asyncio_prevent.py diff --git a/tests/mocktime.py b/tests/pytest/mocktime.py similarity index 100% rename from tests/mocktime.py rename to tests/pytest/mocktime.py diff --git a/tests/test_datastructures.py b/tests/pytest/test_datastructures.py similarity index 100% rename from tests/test_datastructures.py rename to tests/pytest/test_datastructures.py diff --git a/tests/test_e2e_regex_matching.py b/tests/pytest/test_e2e_regex_matching.py similarity index 93% rename from tests/test_e2e_regex_matching.py rename to tests/pytest/test_e2e_regex_matching.py index 2c1b04b29..ab82ada73 100644 --- a/tests/test_e2e_regex_matching.py +++ b/tests/pytest/test_e2e_regex_matching.py @@ -1,6 +1,6 @@ import re -from e2e.controls import _attr_match_str, _style_match_str, _xpath_match_str +from tests.e2e.controls import _attr_match_str, _style_match_str, _xpath_match_str def test_style_match_str() -> None: diff --git a/tests/test_markdown.py b/tests/pytest/test_markdown.py similarity index 100% rename from tests/test_markdown.py rename to tests/pytest/test_markdown.py diff --git a/tests/test_modules.py b/tests/pytest/test_modules.py similarity index 100% rename from tests/test_modules.py rename to tests/pytest/test_modules.py diff --git a/tests/test_namespaces.py b/tests/pytest/test_namespaces.py similarity index 100% rename from tests/test_namespaces.py rename to tests/pytest/test_namespaces.py diff --git a/tests/test_navs.py b/tests/pytest/test_navs.py similarity index 100% rename from tests/test_navs.py rename to tests/pytest/test_navs.py diff --git a/tests/test_output_transformer.py b/tests/pytest/test_output_transformer.py similarity index 100% rename from tests/test_output_transformer.py rename to tests/pytest/test_output_transformer.py diff --git a/tests/test_poll.py b/tests/pytest/test_poll.py similarity index 100% rename from tests/test_poll.py rename to tests/pytest/test_poll.py diff --git a/tests/test_reactives.py b/tests/pytest/test_reactives.py similarity index 100% rename from tests/test_reactives.py rename to tests/pytest/test_reactives.py diff --git a/tests/test_shinysession.py b/tests/pytest/test_shinysession.py similarity index 100% rename from tests/test_shinysession.py rename to tests/pytest/test_shinysession.py diff --git a/tests/test_static.py b/tests/pytest/test_static.py similarity index 100% rename from tests/test_static.py rename to tests/pytest/test_static.py diff --git a/tests/test_ui.py b/tests/pytest/test_ui.py similarity index 100% rename from tests/test_ui.py rename to tests/pytest/test_ui.py diff --git a/tests/test_ui_dependencies.py b/tests/pytest/test_ui_dependencies.py similarity index 100% rename from tests/test_ui_dependencies.py rename to tests/pytest/test_ui_dependencies.py diff --git a/tests/test_utils.py b/tests/pytest/test_utils.py similarity index 100% rename from tests/test_utils.py rename to tests/pytest/test_utils.py diff --git a/tests/test_utils_async.py b/tests/pytest/test_utils_async.py similarity index 100% rename from tests/test_utils_async.py rename to tests/pytest/test_utils_async.py diff --git a/tests/test_x_sidebar.py b/tests/pytest/test_x_sidebar.py similarity index 100% rename from tests/test_x_sidebar.py rename to tests/pytest/test_x_sidebar.py From 57f6ba5e3983b6e8c1ffb6b1225fb06313a78959 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Thu, 17 Aug 2023 16:26:52 -0400 Subject: [PATCH 10/56] chore(api)!: Rename `ui.navset_pill_card` -> `ui.navset_card_pill` and `ui.navset_tab_card` -> `ui.navset_card_tab` (#681) --- CHANGELOG.md | 9 ++- docs/_quartodoc.yml | 8 +- examples/event/app.py | 2 +- shiny/api-examples/nav/app.py | 8 +- shiny/api-examples/update_navs/app.py | 2 +- shiny/experimental/e2e/navbar/app.py | 12 +-- shiny/experimental/ui/__init__.py | 6 +- shiny/experimental/ui/_navs.py | 16 ++-- shiny/experimental/ui/_sidebar.py | 6 +- shiny/ui/__init__.py | 9 ++- shiny/ui/_navs.py | 103 ++++++++++++++++++++------ tests/pytest/test_navs.py | 2 +- 12 files changed, 125 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98544f820..0116d3032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] +### API changes + +* Renamed `shiny.ui.navset_pill_card` to `shiny.ui.navset_card_pill`. `shiny.ui.navset_pill_card` will throw a deprecated warning (#492). +* Renamed `shiny.ui.navset_tab_card` to `shiny.ui.navset_card_tab`. `shiny.ui.navset_tab_card` will throw a deprecated warning (#492). +* Renamed `shiny.experimental.ui.navset_pill_card` to `shiny.experimental.ui.navset_card_pill` (#492). +* Renamed `shiny.experimental.ui.navset_tab_card` to `shiny.experimental.ui.navset_card_tab` (#492). + ### New features * Added `shiny.render.renderer_components` decorator to help create new output renderers. (#621) ### Bug fixes -Fixes #646: Wrap bare value box value in `

` tags. (#668) +* Fixes #646: Wrap bare value box value in `

` tags. (#668) ### Other changes diff --git a/docs/_quartodoc.yml b/docs/_quartodoc.yml index aaa17d8e1..6d032d539 100644 --- a/docs/_quartodoc.yml +++ b/docs/_quartodoc.yml @@ -77,9 +77,9 @@ quartodoc: - ui.nav_spacer - ui.nav_menu - ui.navset_tab - - ui.navset_tab_card + - ui.navset_card_tab - ui.navset_pill - - ui.navset_pill_card + - ui.navset_card_pill - ui.navset_pill_list - ui.navset_hidden - title: UI panels @@ -247,8 +247,8 @@ quartodoc: - experimental.ui.layout_sidebar - experimental.ui.page_navbar - experimental.ui.navset_bar - - experimental.ui.navset_tab_card - - experimental.ui.navset_pill_card + - experimental.ui.navset_card_tab + - experimental.ui.navset_card_pill - experimental.ui.sidebar_toggle - experimental.ui.panel_main - experimental.ui.panel_sidebar diff --git a/examples/event/app.py b/examples/event/app.py index c96f7ca85..20adf5d25 100644 --- a/examples/event/app.py +++ b/examples/event/app.py @@ -11,7 +11,7 @@ print the number of clicks in the console twice. """ ), - ui.navset_tab_card( + ui.navset_card_tab( ui.nav( "Sync", ui.input_action_button("btn", "Click me"), diff --git a/shiny/api-examples/nav/app.py b/shiny/api-examples/nav/app.py index 65c9bea3c..ed255589c 100644 --- a/shiny/api-examples/nav/app.py +++ b/shiny/api-examples/nav/app.py @@ -53,10 +53,10 @@ def nav_controls(prefix: str) -> List[NavSetArg]: ui.navset_tab(*nav_controls("navset_tab()")), ui.h4("navset_pill()"), ui.navset_pill(*nav_controls("navset_pill()")), - ui.h4("navset_tab_card()"), - ui.navset_tab_card(*nav_controls("navset_tab_card()")), - ui.h4("navset_pill_card()"), - ui.navset_pill_card(*nav_controls("navset_pill_card()")), + ui.h4("navset_card_tab()"), + ui.navset_card_tab(*nav_controls("navset_card_tab()")), + ui.h4("navset_card_pill()"), + ui.navset_card_pill(*nav_controls("navset_card_pill()")), ui.h4("navset_pill_list()"), ui.navset_pill_list(*nav_controls("navset_pill_list()")), ) diff --git a/shiny/api-examples/update_navs/app.py b/shiny/api-examples/update_navs/app.py index de5961508..e319eba51 100644 --- a/shiny/api-examples/update_navs/app.py +++ b/shiny/api-examples/update_navs/app.py @@ -6,7 +6,7 @@ ui.input_slider("controller", "Controller", min=1, max=3, value=1) ), ui.panel_main( - ui.navset_tab_card( + ui.navset_card_tab( ui.nav("Panel 1", "Panel 1 content", value="panel1"), ui.nav("Panel 2", "Panel 2 content", value="panel2"), ui.nav("Panel 3", "Panel 3 content", value="panel3"), diff --git a/shiny/experimental/e2e/navbar/app.py b/shiny/experimental/e2e/navbar/app.py index a9cf2d9e1..78761a44b 100644 --- a/shiny/experimental/e2e/navbar/app.py +++ b/shiny/experimental/e2e/navbar/app.py @@ -51,14 +51,14 @@ def nav_items(prefix: str) -> list[NavSetArg]: ), footer=ui.div( {"style": "width:80%; margin: 0 auto"}, - ui.h4("navset_tab_card()"), - x.ui.navset_tab_card( - *nav_items("navset_tab_card()"), + ui.h4("navset_card_tab()"), + x.ui.navset_card_tab( + *nav_items("navset_card_tab()"), sidebar=my_sidebar, ), - ui.h4("navset_pill_card()"), - x.ui.navset_pill_card( - *nav_items("navset_pill_card()"), + ui.h4("navset_card_pill()"), + x.ui.navset_card_pill( + *nav_items("navset_card_pill()"), sidebar=my_sidebar, ), # Do not include `navset_bar()` in example. Ok for testing only diff --git a/shiny/experimental/ui/__init__.py b/shiny/experimental/ui/__init__.py index 54005f500..6f46660dc 100644 --- a/shiny/experimental/ui/__init__.py +++ b/shiny/experimental/ui/__init__.py @@ -34,7 +34,7 @@ ) from ._input_text import input_text_area from ._layout import layout_column_wrap -from ._navs import navset_bar, navset_pill_card, navset_tab_card +from ._navs import navset_bar, navset_card_pill, navset_card_tab from ._output import output_image, output_plot, output_ui from ._page import page_fillable, page_navbar, page_sidebar from ._sidebar import ( @@ -70,8 +70,8 @@ "page_navbar", # Navs "navset_bar", - "navset_tab_card", - "navset_pill_card", + "navset_card_tab", + "navset_card_pill", # Card "CardItem", "ImgContainer", diff --git a/shiny/experimental/ui/_navs.py b/shiny/experimental/ui/_navs.py index 5f9f169cd..b3b9e78f0 100644 --- a/shiny/experimental/ui/_navs.py +++ b/shiny/experimental/ui/_navs.py @@ -2,8 +2,8 @@ __all__ = ( "navset_bar", - "navset_tab_card", - "navset_pill_card", + "navset_card_tab", + "navset_card_pill", ) import copy @@ -194,7 +194,7 @@ def navset_card_body(content: Tag, sidebar: Optional[Sidebar] = None) -> CardIte return CardItem(content) -def navset_tab_card( +def navset_card_tab( *args: NavSetArg, id: Optional[str] = None, selected: Optional[str] = None, @@ -229,7 +229,7 @@ def navset_tab_card( * ~shiny.experimental.ui.navset_bar * ~shiny.ui.navset_tab * ~shiny.ui.navset_pill - * ~shiny.experimental.ui.navset_pill_card + * ~shiny.experimental.ui.navset_card_pill * ~shiny.ui.navset_hidden Example @@ -249,7 +249,7 @@ def navset_tab_card( ) -def navset_pill_card( +def navset_card_pill( *args: NavSetArg, id: Optional[str] = None, selected: Optional[str] = None, @@ -287,7 +287,7 @@ def navset_pill_card( * ~shiny.experimental.ui.navset_bar * ~shiny.ui.navset_tab * ~shiny.ui.navset_pill - * ~shiny.experimental.ui.navset_tab_card + * ~shiny.experimental.ui.navset_card_tab * ~shiny.ui.navset_hidden Example @@ -533,8 +533,8 @@ def navset_bar( * ~shiny.ui.nav_spacer * ~shiny.ui.navset_tab * ~shiny.ui.navset_pill - * ~shiny.experimental.ui.navset_tab_card - * ~shiny.experimental.ui.navset_pill_card + * ~shiny.experimental.ui.navset_card_tab + * ~shiny.experimental.ui.navset_card_pill * ~shiny.ui.navset_hidden Example diff --git a/shiny/experimental/ui/_sidebar.py b/shiny/experimental/ui/_sidebar.py index 3933154a9..233186680 100644 --- a/shiny/experimental/ui/_sidebar.py +++ b/shiny/experimental/ui/_sidebar.py @@ -133,7 +133,7 @@ def sidebar( * :func:`~shiny.experimental.ui.layout_sidebar` * Creates a sidebar layout component which can be dropped inside any Shiny UI page method (e.g. :func:`~shiny.experimental.ui.page_fillable`) or :func:`~shiny.experimental.ui.card` context. - * :func:`~shiny.experimental.ui.navset_bar`, :func:`~shiny.experimental.ui.navset_tab_card`, and :func:`~shiny.experimental.ui.navset_pill_card` + * :func:`~shiny.experimental.ui.navset_bar`, :func:`~shiny.experimental.ui.navset_card_tab`, and :func:`~shiny.experimental.ui.navset_card_pill` * Creates a multi page/tab UI with a singular `sidebar()` (which is shown on every page/tab). @@ -185,8 +185,8 @@ def sidebar( -------- * :func:`~shiny.experimental.ui.layout_sidebar` * :func:`~shiny.experimental.ui.navset_bar` - * :func:`~shiny.experimental.ui.navset_tab_card` - * :func:`~shiny.experimental.ui.navset_pill_card` + * :func:`~shiny.experimental.ui.navset_card_tab` + * :func:`~shiny.experimental.ui.navset_card_pill` """ # TODO-future; validate `open`, bg, fg, class_, max_height_mobile diff --git a/shiny/ui/__init__.py b/shiny/ui/__init__.py index 5a579ac11..9554ee305 100644 --- a/shiny/ui/__init__.py +++ b/shiny/ui/__init__.py @@ -59,12 +59,15 @@ nav_control, nav_spacer, navset_tab, - navset_tab_card, navset_pill, - navset_pill_card, + navset_card_pill, + navset_card_tab, navset_pill_list, navset_hidden, navset_bar, + # Deprecated + navset_pill_card, + navset_tab_card, ) from ._notification import notification_show, notification_remove from ._output import ( @@ -176,6 +179,8 @@ "nav_spacer", "navset_tab", "navset_tab_card", + "navset_card_tab", + "navset_card_pill", "navset_pill", "navset_pill_card", "navset_pill_list", diff --git a/shiny/ui/_navs.py b/shiny/ui/_navs.py index e368f8be4..e5b7c9aa2 100644 --- a/shiny/ui/_navs.py +++ b/shiny/ui/_navs.py @@ -6,12 +6,15 @@ "nav_control", "nav_spacer", "navset_tab", - "navset_tab_card", + "navset_card_tab", "navset_pill", - "navset_pill_card", + "navset_card_pill", "navset_pill_list", "navset_hidden", "navset_bar", + # Deprecated - 2023-08-15 + "navset_pill_card", + "navset_tab_card", ) import copy @@ -20,6 +23,7 @@ from htmltools import MetadataNode, Tag, TagChild, TagList, div, tags +from .._deprecated import warn_deprecated from .._docstring import add_example from .._namespaces import resolve_id from .._utils import private_random_int @@ -119,8 +123,8 @@ def nav( ~shiny.ui.navset_bar ~shiny.ui.navset_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_tab_card - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_tab + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden """ if value is None: @@ -160,8 +164,8 @@ def nav_control(*args: TagChild) -> Nav: ~shiny.ui.navset_bar ~shiny.ui.navset_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_tab_card - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_tab + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden Example ------- @@ -182,8 +186,8 @@ def nav_spacer() -> Nav: ~shiny.ui.navset_bar ~shiny.ui.navset_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_tab_card - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_tab + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden Example @@ -315,8 +319,8 @@ def nav_menu( ~shiny.ui.navset_bar ~shiny.ui.navset_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_tab_card - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_tab + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden Example ------- @@ -409,8 +413,8 @@ def navset_tab( ~shiny.ui.nav_spacer ~shiny.ui.navset_bar ~shiny.ui.navset_pill - ~shiny.ui.navset_tab_card - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_tab + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden Example @@ -461,8 +465,8 @@ def navset_pill( ~shiny.ui.nav_spacer ~shiny.ui.navset_bar ~shiny.ui.navset_tab - ~shiny.ui.navset_tab_card - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_tab + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden Example @@ -513,9 +517,9 @@ def navset_hidden( ~shiny.ui.nav_control ~shiny.ui.nav_spacer ~shiny.ui.navset_tab - ~shiny.ui.navset_tab_card + ~shiny.ui.navset_card_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_pill ~shiny.ui.navset_pill_list ~shiny.ui.navset_bar """ @@ -560,7 +564,7 @@ def layout(self, nav: TagChild, content: TagChild) -> Tag: return card(self.header, content, self.footer, header=nav) -def navset_tab_card( +def navset_card_tab( *args: NavSetArg, id: Optional[str] = None, selected: Optional[str] = None, @@ -594,7 +598,7 @@ def navset_tab_card( ~shiny.ui.navset_bar ~shiny.ui.navset_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden Example @@ -613,7 +617,7 @@ def navset_tab_card( ) -def navset_pill_card( +def navset_card_pill( *args: NavSetArg, id: Optional[str] = None, selected: Optional[str] = None, @@ -650,7 +654,7 @@ def navset_pill_card( ~shiny.ui.navset_bar ~shiny.ui.navset_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_tab_card + ~shiny.ui.navset_card_tab ~shiny.ui.navset_hidden Example @@ -741,9 +745,9 @@ def navset_pill_list( ~shiny.ui.nav_control ~shiny.ui.nav_spacer ~shiny.ui.navset_tab - ~shiny.ui.navset_tab_card + ~shiny.ui.navset_card_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden ~shiny.ui.navset_bar ~shiny.ui.navset_hidden @@ -910,8 +914,8 @@ def navset_bar( ~shiny.ui.nav_spacer ~shiny.ui.navset_tab ~shiny.ui.navset_pill - ~shiny.ui.navset_tab_card - ~shiny.ui.navset_pill_card + ~shiny.ui.navset_card_tab + ~shiny.ui.navset_card_pill ~shiny.ui.navset_hidden Example @@ -997,3 +1001,54 @@ def card(*args: TagChild, header: TagChild = None, footer: TagChild = None) -> T bootstrap_deps(), class_="card", ) + + +############################################## +# Deprecated +############################################## +# Deprecated 2023-08-15 +def navset_pill_card( + *args: NavSetArg, + id: Optional[str] = None, + selected: Optional[str] = None, + header: TagChild = None, + footer: TagChild = None, + placement: Literal["above", "below"] = "above", +) -> NavSetCard: + """Deprecated. Please use `navset_card_pill()` instead of `navset_pill_card()`.""" + warn_deprecated( + "`navset_pill_card()` is deprecated. " + "This method will be removed in a future version, " + "please use :func:`~shiny.ui.navset_card_pill` instead." + ) + return navset_card_pill( + *args, + id=id, + selected=selected, + header=header, + footer=footer, + placement=placement, + ) + + +# Deprecated 2023-08-15 +def navset_tab_card( + *args: NavSetArg, + id: Optional[str] = None, + selected: Optional[str] = None, + header: TagChild = None, + footer: TagChild = None, +) -> NavSetCard: + """Deprecated. Please use `navset_card_tab()` instead of `navset_tab_card()`.""" + warn_deprecated( + "`navset_tab_card()` is deprecated. " + "This method will be removed in a future version, " + "please use :func:`~shiny.ui.navset_card_tab` instead." + ) + return navset_card_tab( + *args, + id=id, + selected=selected, + header=header, + footer=footer, + ) diff --git a/tests/pytest/test_navs.py b/tests/pytest/test_navs.py index 083eda6dd..8abf50d94 100644 --- a/tests/pytest/test_navs.py +++ b/tests/pytest/test_navs.py @@ -97,7 +97,7 @@ def test_nav_markup(): ) x = with_private_seed( - ui.navset_pill_card, + ui.navset_card_pill, a, ui.nav_menu("Menu", c), b, From 915b4c885ba0e176e4d3db7ba6d1519a9d4bd0b6 Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Mon, 21 Aug 2023 10:16:16 -0700 Subject: [PATCH 11/56] Make data frame selection return row numbers, not pandas index value (#677) --- CHANGELOG.md | 3 +- js/dataframe/index.tsx | 9 ++-- js/dataframe/types.ts | 2 +- shiny/api-examples/data_frame/app.py | 4 +- shiny/experimental/ui/_output.py | 6 +-- shiny/render/_dataframe.py | 35 ++++++++++--- shiny/ui/_output.py | 12 ++--- shiny/ui/dataframe/_dataframe.py | 5 +- shiny/www/shared/dataframe/dataframe.js | 8 +-- shiny/www/shared/dataframe/dataframe.js.map | 6 +-- tests/e2e/bugs/0676-row-selection/app.py | 51 +++++++++++++++++++ .../test_0676_row_selection.py | 29 +++++++++++ tests/e2e/data_frame/test_data_frame.py | 4 +- 13 files changed, 138 insertions(+), 36 deletions(-) create mode 100644 tests/e2e/bugs/0676-row-selection/app.py create mode 100644 tests/e2e/bugs/0676-row-selection/test_0676_row_selection.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 0116d3032..bf2493da9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes -* Fixes #646: Wrap bare value box value in `

` tags. (#668) +* Fixed #646: Wrap bare value box value in `

` tags. (#668) +* Fixed #676: The `render.data_frame` selection feature was underdocumented and buggy (sometimes returning `None` as a row identifier if the pandas data frame's index had gaps in it). With this release, the selection is consistently a tuple of the 0-based row numbers of the selected rows--or `None` if no rows are selected. (#677) ### Other changes diff --git a/js/dataframe/index.tsx b/js/dataframe/index.tsx index 2f7970129..03e94df55 100644 --- a/js/dataframe/index.tsx +++ b/js/dataframe/index.tsx @@ -58,12 +58,8 @@ interface ShinyDataGridProps { const ShinyDataGrid: FC> = (props) => { const { id, data, bgcolor } = props; - const { columns, index, type_hints, data: rowData } = data; + const { columns, type_hints, data: rowData } = data; const { width, height, filters: withFilters } = data.options; - const keyToIndex: Record = {}; - index.forEach((value) => { - keyToIndex[value + ""] = value; - }); const containerRef = useRef(null); const theadRef = useRef(null); @@ -192,7 +188,8 @@ const ShinyDataGrid: FC> = (props) => { rowSelection .keys() .toList() - .map((key) => keyToIndex[key]) + .map((key) => parseInt(key)) + .sort() ); } } diff --git a/js/dataframe/types.ts b/js/dataframe/types.ts index 8dcb756e7..fd1f93959 100644 --- a/js/dataframe/types.ts +++ b/js/dataframe/types.ts @@ -20,7 +20,7 @@ export interface DataGridOptions { export interface PandasData { columns: ReadonlyArray; - index: ReadonlyArray; + // index: ReadonlyArray; data: unknown[][]; type_hints?: ReadonlyArray; options: DataGridOptions; diff --git a/shiny/api-examples/data_frame/app.py b/shiny/api-examples/data_frame/app.py index 6fbe3e48f..57b0a2f1c 100644 --- a/shiny/api-examples/data_frame/app.py +++ b/shiny/api-examples/data_frame/app.py @@ -63,8 +63,10 @@ def summary_data(): @reactive.Calc def filtered_df(): + # input.summary_data_selected_rows() is a tuple, so we must convert it to list, + # as that's what Pandas requires for indexing. selected_idx = list(req(input.summary_data_selected_rows())) - countries = summary_df["country"][selected_idx] + countries = summary_df.iloc[selected_idx]["country"] # Filter data for selected countries return df[df["country"].isin(countries)] diff --git a/shiny/experimental/ui/_output.py b/shiny/experimental/ui/_output.py index 2344af5c4..a83f94b3e 100644 --- a/shiny/experimental/ui/_output.py +++ b/shiny/experimental/ui/_output.py @@ -47,7 +47,7 @@ def output_plot( Parameters ---------- id - An input id. + An output id. width The CSS width, e.g. '400px', or '100%'. height @@ -138,7 +138,7 @@ def output_image( Parameters ---------- id - An input id. + An output id. width The CSS width, e.g. '400px', or '100%'. height @@ -245,7 +245,7 @@ def output_ui( Parameters ---------- id - An input id. + An output id. inline If ``True``, the result is displayed inline container diff --git a/shiny/render/_dataframe.py b/shiny/render/_dataframe.py index 171a35e6c..ffb203e32 100644 --- a/shiny/render/_dataframe.py +++ b/shiny/render/_dataframe.py @@ -207,6 +207,10 @@ def to_payload(self) -> object: def serialize_pandas_df(df: "pd.DataFrame") -> dict[str, Any]: + # Currently, we don't make use of the index; drop it so we don't error trying to + # serialize it or something + df = df.reset_index(drop=True) + res = json.loads( # {index: [index], columns: [columns], data: [values]} df.to_json(None, orient="split") # pyright: ignore[reportUnknownMemberType] @@ -255,29 +259,44 @@ def data_frame( _fn: DataFrameTransformer.ValueFn | None = None, ) -> DataFrameTransformer.OutputRenderer | DataFrameTransformer.OutputRendererDecorator: """ - Reactively render a Pandas data frame object (or similar) as a basic HTML table. - + Reactively render a Pandas data frame object (or similar) as an interactive table or + grid. Features fast virtualized scrolling, sorting, filtering, and row selection + (single or multiple). Returns ------- : A decorator for a function that returns any of the following: - 1. A pandas :class:`DataFrame` object. - 2. A pandas :class:`Styler` object. + 1. A :class:`~shiny.render.DataGrid` or :class:`~shiny.render.DataTable` object, + which can be used to customize the appearance and behavior of the data frame + output. + 2. A pandas :class:`DataFrame` object. (Equivalent to + `shiny.render.DataGrid(df)`.) 3. Any object that has a `.to_pandas()` method (e.g., a Polars data frame or - Arrow table). + Arrow table). (Equivalent to `shiny.render.DataGrid(df.to_pandas())`.) + + Row selection + ------------- + When using the row selection feature, you can access the selected rows by using the + `input._selected_rows()` function, where `` is the `id` of the + :func:`~shiny.ui.output_data_frame`. The value returned will be `None` if no rows + are selected, or a tuple of integers representing the indices of the selected rows. + To filter a pandas data frame down to the selected rows, use + `df.iloc[list(input._selected_rows())]`. Tip ---- This decorator should be applied **before** the ``@output`` decorator. Also, the - name of the decorated function (or ``@output(id=...)``) should match the ``id`` of - a :func:`~shiny.ui.output_table` container (see :func:`~shiny.ui.output_table` for + name of the decorated function (or ``@output(id=...)``) should match the ``id`` of a + :func:`~shiny.ui.output_table` container (see :func:`~shiny.ui.output_table` for example usage). See Also -------- - ~shiny.ui.output_data_frame + * :func:`~shiny.ui.output_data_frame` + * :class:`~shiny.render.DataGrid` and :class:`~shiny.render.DataTable` are the + objects you can return from the rendering function to specify options. """ return DataFrameTransformer(_fn) diff --git a/shiny/ui/_output.py b/shiny/ui/_output.py index f615b77b7..bff4a931e 100644 --- a/shiny/ui/_output.py +++ b/shiny/ui/_output.py @@ -49,7 +49,7 @@ def output_plot( Parameters ---------- id - An input id. + An output id. width The CSS width, e.g. '400px', or '100%'. height @@ -127,7 +127,7 @@ def output_image( Parameters ---------- id - An input id. + An output id. width The CSS width, e.g. '400px', or '100%'. height @@ -223,7 +223,7 @@ def output_text( Parameters ---------- id - An input id. + An output id. inline If ``True``, the result is displayed inline container @@ -260,7 +260,7 @@ def output_text_verbatim(id: str, placeholder: bool = False) -> Tag: Parameters ---------- id - An input id. + An output id. placeholder If the output is empty or ``None``, should an empty rectangle be displayed to serve as a placeholder? (does not affect behavior when the output is nonempty) @@ -292,7 +292,7 @@ def output_table(id: str, **kwargs: TagAttrValue) -> Tag: Parameters ---------- id - An input id. + An output id. **kwargs Additional attributes to add to the container. @@ -320,7 +320,7 @@ def output_ui( Parameters ---------- id - An input id. + An output id. inline If ``True``, the result is displayed inline container diff --git a/shiny/ui/dataframe/_dataframe.py b/shiny/ui/dataframe/_dataframe.py index 73b6d1b1b..d6d1cca9b 100644 --- a/shiny/ui/dataframe/_dataframe.py +++ b/shiny/ui/dataframe/_dataframe.py @@ -23,12 +23,13 @@ def data_frame_deps() -> HTMLDependency: def output_data_frame(id: str) -> Tag: """ - Create a output container for a data frame. + Create an output container for an interactive table or grid. Features fast + virtualized scrolling, sorting, filtering, and row selection (single or multiple). Parameters ---------- id - An input id. + An output id. Returns ------- diff --git a/shiny/www/shared/dataframe/dataframe.js b/shiny/www/shared/dataframe/dataframe.js index d843bc977..ad0b0906c 100644 --- a/shiny/www/shared/dataframe/dataframe.js +++ b/shiny/www/shared/dataframe/dataframe.js @@ -1,4 +1,4 @@ -var dt=` +var at=` *, *::before, *::after { @@ -153,13 +153,13 @@ var dt=` .shiny-data-grid.shiny-data-grid-grid.scrolling > table > thead > tr > th:last-child, .shiny-data-grid.shiny-data-grid-grid.scrolling > table > tbody > tr > td:last-child { border-right-style: none; -}`;var se,h,_t,ir,Y,ct,mt,Fe,ht,fe={},vt=[],lr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,me=Array.isArray;function G(e,n){for(var t in n)e[t]=n[t];return e}function yt(e){var n=e.parentNode;n&&n.removeChild(e)}function T(e,n,t){var r,o,i,l={};for(i in n)i=="key"?r=n[i]:i=="ref"?o=n[i]:l[i]=n[i];if(arguments.length>2&&(l.children=arguments.length>3?se.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)l[i]===void 0&&(l[i]=e.defaultProps[i]);return ie(e,l,r,o,null)}function ie(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,__h:null,constructor:void 0,__v:o??++_t};return o==null&&h.vnode!=null&&h.vnode(i),i}function Me(){return{current:null}}function H(e){return e.children}function A(e,n){this.props=e,this.context=n}function le(e,n){if(n==null)return e.__?le(e.__,e.__.__k.indexOf(e)+1):null;for(var t;nn&&Y.sort(Fe));pe.__r=0}function St(e,n,t,r,o,i,l,u,a,c){var s,f,g,d,p,_,m,v=r&&r.__k||vt,E=v.length;for(t.__k=[],s=0;s0?ie(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)!=null){if(d.__=t,d.__b=t.__b+1,(g=v[s])===null||g&&d.key==g.key&&d.type===g.type)v[s]=void 0;else for(f=0;f=0;n--)if((t=e.__k[n])&&(r=Rt(t)))return r}return null}function sr(e,n,t,r,o){var i;for(i in t)i==="children"||i==="key"||i in n||_e(e,i,null,t[i],r);for(i in n)o&&typeof n[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||t[i]===n[i]||_e(e,i,n[i],t[i],r)}function gt(e,n,t){n[0]==="-"?e.setProperty(n,t??""):e[n]=t==null?"":typeof t!="number"||lr.test(n)?t:t+"px"}function _e(e,n,t,r,o){var i;e:if(n==="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(n in r)t&&n in t||gt(e.style,n,"");if(t)for(n in t)r&&t[n]===r[n]||gt(e.style,n,t[n])}else if(n[0]==="o"&&n[1]==="n")i=n!==(n=n.replace(/Capture$/,"")),n=n.toLowerCase()in e?n.toLowerCase().slice(2):n.slice(2),e.l||(e.l={}),e.l[n+i]=t,t?r||e.addEventListener(n,i?pt:ft,i):e.removeEventListener(n,i?pt:ft,i);else if(n!=="dangerouslySetInnerHTML"){if(o)n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!=="width"&&n!=="height"&&n!=="href"&&n!=="list"&&n!=="form"&&n!=="tabIndex"&&n!=="download"&&n!=="rowSpan"&&n!=="colSpan"&&n in e)try{e[n]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&n[4]!=="-"?e.removeAttribute(n):e.setAttribute(n,t))}}function ft(e){return this.l[e.type+!1](h.event?h.event(e):e)}function pt(e){return this.l[e.type+!0](h.event?h.event(e):e)}function Ve(e,n,t,r,o,i,l,u,a){var c,s,f,g,d,p,_,m,v,E,S,C,I,V,q,F=n.type;if(n.constructor!==void 0)return null;t.__h!=null&&(a=t.__h,u=n.__e=t.__e,n.__h=null,i=[u]),(c=h.__b)&&c(n);try{e:if(typeof F=="function"){if(m=n.props,v=(c=F.contextType)&&r[c.__c],E=c?v?v.props.value:c.__:r,t.__c?_=(s=n.__c=t.__c).__=s.__E:("prototype"in F&&F.prototype.render?n.__c=s=new F(m,E):(n.__c=s=new A(m,E),s.constructor=F,s.render=ar),v&&v.sub(s),s.props=m,s.state||(s.state={}),s.context=E,s.__n=r,f=s.__d=!0,s.__h=[],s._sb=[]),s.__s==null&&(s.__s=s.state),F.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=G({},s.__s)),G(s.__s,F.getDerivedStateFromProps(m,s.__s))),g=s.props,d=s.state,s.__v=n,f)F.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(F.getDerivedStateFromProps==null&&m!==g&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(m,E),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(m,s.__s,E)===!1||n.__v===t.__v){for(n.__v!==t.__v&&(s.props=m,s.state=s.__s,s.__d=!1),s.__e=!1,n.__e=t.__e,n.__k=t.__k,n.__k.forEach(function(Z){Z&&(Z.__=n)}),S=0;S2&&(u.children=arguments.length>3?se.call(arguments,2):t),ie(e.type,u,r||e.key,o||e.ref,null)}function De(e,n){var t={__c:n="__cC"+ht++,__: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.shouldComponentUpdate=function(l){this.props.value!==l.value&&o.some(function(u){u.__e=!0,$e(u)})},this.sub=function(l){o.push(l);var u=l.componentWillUnmount;l.componentWillUnmount=function(){o.splice(o.indexOf(l),1),u&&u.call(l)}}),r.children}};return t.Provider.__=t.Consumer.contextType=t}se=vt.slice,h={__e:function(e,n,t,r){for(var o,i,l;n=n.__;)if((o=n.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),l=o.__d),l)return o.__E=o}catch(u){e=u}throw e}},_t=0,ir=function(e){return e!=null&&e.constructor===void 0},A.prototype.setState=function(e,n){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=G({},this.state),typeof e=="function"&&(e=e(G({},t),this.props)),e&&G(t,e),e!=null&&this.__v&&(n&&this._sb.push(n),$e(this))},A.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$e(this))},A.prototype.render=H,Y=[],mt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fe=function(e,n){return e.__v.__b-n.__v.__b},pe.__r=0,ht=0;var W,R,Te,Mt,te=0,kt=[],he=[],Vt=h.__b,It=h.__r,Dt=h.diffed,Tt=h.__c,At=h.unmount;function ne(e,n){h.__h&&h.__h(R,e,te||n),te=0;var t=R.__H||(R.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({__V:he}),t.__[e]}function D(e){return te=1,ue(zt,e)}function ue(e,n,t){var r=ne(W++,2);if(r.t=e,!r.__c&&(r.__=[t?t(n):zt(void 0,n),function(u){var a=r.__N?r.__N[0]:r.__[0],c=r.t(a,u);a!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=R,!R.u)){var o=function(u,a,c){if(!r.__c.__H)return!0;var s=r.__c.__H.__.filter(function(g){return g.__c});if(s.every(function(g){return!g.__N}))return!i||i.call(this,u,a,c);var f=!1;return s.forEach(function(g){if(g.__N){var d=g.__[0];g.__=g.__N,g.__N=void 0,d!==g.__[0]&&(f=!0)}}),!(!f&&r.__c.props===u)&&(!i||i.call(this,u,a,c))};R.u=!0;var i=R.shouldComponentUpdate,l=R.componentWillUpdate;R.componentWillUpdate=function(u,a,c){if(this.__e){var s=i;i=void 0,o(u,a,c),i=s}l&&l.call(this,u,a,c)},R.shouldComponentUpdate=o}return r.__N||r.__}function B(e,n){var t=ne(W++,3);!h.__s&&Oe(t.__H,n)&&(t.__=e,t.i=n,R.__H.__h.push(t))}function L(e,n){var t=ne(W++,4);!h.__s&&Oe(t.__H,n)&&(t.__=e,t.i=n,R.__h.push(t))}function z(e){return te=5,U(function(){return{current:e}},[])}function Nt(e,n,t){te=6,L(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 U(e,n){var t=ne(W++,7);return Oe(t.__H,n)?(t.__V=e(),t.i=n,t.__h=e,t.__V):t.__}function ye(e,n){return te=8,U(function(){return e},n)}function Ht(e){var n=R.context[e.__c],t=ne(W++,9);return t.c=e,n?(t.__==null&&(t.__=!0,n.sub(R)),n.props.value):e.__}function Pt(e,n){h.useDebugValue&&h.useDebugValue(n?n(e):e)}function Lt(){var e=ne(W++,11);if(!e.__){for(var n=R.__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 dr(){for(var e;e=kt.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ve),e.__H.__h.forEach(Ae),e.__H.__h=[]}catch(n){e.__H.__h=[],h.__e(n,e.__v)}}h.__b=function(e){R=null,Vt&&Vt(e)},h.__r=function(e){It&&It(e),W=0;var n=(R=e.__c).__H;n&&(Te===R?(n.__h=[],R.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=he,t.__N=t.i=void 0})):(n.__h.forEach(ve),n.__h.forEach(Ae),n.__h=[],W=0)),Te=R},h.diffed=function(e){Dt&&Dt(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(kt.push(n)!==1&&Mt===h.requestAnimationFrame||((Mt=h.requestAnimationFrame)||cr)(dr)),n.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==he&&(t.__=t.__V),t.i=void 0,t.__V=he})),Te=R=null},h.__c=function(e,n){n.some(function(t){try{t.__h.forEach(ve),t.__h=t.__h.filter(function(r){return!r.__||Ae(r)})}catch(r){n.some(function(o){o.__h&&(o.__h=[])}),n=[],h.__e(r,t.__v)}}),Tt&&Tt(e,n)},h.unmount=function(e){At&&At(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{ve(r)}catch(o){n=o}}),t.__H=void 0,n&&h.__e(n,t.__v))};var Ot=typeof requestAnimationFrame=="function";function cr(e){var n,t=function(){clearTimeout(r),Ot&&cancelAnimationFrame(n),setTimeout(e)},r=setTimeout(t,100);Ot&&(n=requestAnimationFrame(t))}function ve(e){var n=R,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),R=n}function Ae(e){var n=R;e.__c=e.__(),R=n}function Oe(e,n){return!e||e.length!==n.length||n.some(function(t,r){return t!==e[r]})}function zt(e,n){return typeof n=="function"?n(e):n}function Jt(e,n){for(var t in n)e[t]=n[t];return e}function Ne(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 ke(e,n){return e===n&&(e!==0||1/e==1/n)||e!=e&&n!=n}function He(e){this.props=e}function gr(e,n){function t(o){var i=this.props.ref,l=i==o.ref;return!l&&i&&(i.call?i(null):i.current=null),n?!n(this.props,o)||!l:Ne(this.props,o)}function r(o){return this.shouldComponentUpdate=t,T(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(He.prototype=new A).isPureReactComponent=!0,He.prototype.shouldComponentUpdate=function(e,n){return Ne(this.props,e)||Ne(this.state,n)};var Gt=h.__b;h.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Gt&&Gt(e)};var fr=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function pr(e){function n(t){var r=Jt({},t);return delete r.ref,e(r,t.ref||null)}return n.$$typeof=fr,n.render=n,n.prototype.isReactComponent=n.__f=!0,n.displayName="ForwardRef("+(e.displayName||e.name)+")",n}var Bt=function(e,n){return e==null?null:P(P(e).map(n))},_r={map:Bt,forEach:Bt,count:function(e){return e?P(e).length:0},only:function(e){var n=P(e);if(n.length!==1)throw"Children.only";return n[0]},toArray:P},mr=h.__e;h.__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)}mr(e,n,t,r)};var Ut=h.unmount;function Yt(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=Jt({},e)).__c!=null&&(e.__c.__P===t&&(e.__c.__P=n),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Yt(r,n,t)})),e}function Qt(e,n,t){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Qt(r,n,t)}),e.__c&&e.__c.__P===n&&(e.__e&&t.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=t)),e}function be(){this.__u=0,this.t=null,this.__b=null}function Zt(e){var n=e.__.__c;return n&&n.__a&&n.__a(e)}function hr(e){var n,t,r;function o(i){if(n||(n=e()).then(function(l){t=l.default||l},function(l){r=l}),r)throw r;if(!t)throw n;return T(t,i)}return o.displayName="Lazy",o.__f=!0,o}function ae(){this.u=null,this.o=null}h.unmount=function(e){var n=e.__c;n&&n.__R&&n.__R(),n&&e.__h===!0&&(e.type=null),Ut&&Ut(e)},(be.prototype=new A).__c=function(e,n){var t=n.__c,r=this;r.t==null&&(r.t=[]),r.t.push(t);var o=Zt(r.__v),i=!1,l=function(){i||(i=!0,t.__R=null,o?o(u):u())};t.__R=l;var u=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=Qt(c,c.__c.__P,c.__c.__O)}var s;for(r.setState({__a:r.__b=null});s=r.t.pop();)s.forceUpdate()}},a=n.__h===!0;r.__u++||a||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(l,l)},be.prototype.componentWillUnmount=function(){this.t=[]},be.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]=Yt(this.__b,t,r.__O=r.__P)}this.__b=null}var o=n.__a&&T(H,null,e.fallback);return o&&(o.__h=null),[T(H,null,n.__a?null:e.children),o]};var jt=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)}}),ee(T(vr,{context:n.context},e.__v),n.l)):n.l&&n.componentWillUnmount()}function br(e,n){var t=T(yr,{__v:e,i:n});return t.containerInfo=n,t}(ae.prototype=new A).__a=function(e){var n=this,t=Zt(n.__v),r=n.o.get(e);return r[0]++,function(o){var i=function(){n.props.revealOrder?(r.push(o),jt(n,e,r)):o()};t?t(i):i()}},ae.prototype.render=function(e){this.u=null,this.o=new Map;var n=P(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},ae.prototype.componentDidUpdate=ae.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(n,t){jt(e,t,n)})};var en=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Sr=/^(?: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]/,Cr=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wr=/[A-Z0-9]/g,Rr=typeof document<"u",Er=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Pe(e,n,t){return n.__k==null&&(n.textContent=""),ee(e,n),typeof t=="function"&&t(),e?e.__c:null}function tn(e,n,t){return Ie(e,n),typeof t=="function"&&t(),e?e.__c:null}A.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(A.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(n){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:n})}})});var qt=h.event;function xr(){}function Fr(){return this.cancelBubble}function $r(){return this.defaultPrevented}h.event=function(e){return qt&&(e=qt(e)),e.persist=xr,e.isPropagationStopped=Fr,e.isDefaultPrevented=$r,e.nativeEvent=e};var Le,Mr={enumerable:!1,configurable:!0,get:function(){return this.class}},Kt=h.vnode;h.vnode=function(e){typeof e.type=="string"&&function(n){var t=n.props,r=n.type,o={};for(var i in t){var l=t[i];if(!(i==="value"&&"defaultValue"in t&&l==null||Rr&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var u=i.toLowerCase();i==="defaultValue"&&"value"in t&&t.value==null?i="value":i==="download"&&l===!0?l="":u==="ondoubleclick"?i="ondblclick":u!=="onchange"||r!=="input"&&r!=="textarea"||Er(t.type)?u==="onfocus"?i="onfocusin":u==="onblur"?i="onfocusout":Cr.test(i)?i=u:r.indexOf("-")===-1&&Sr.test(i)?i=i.replace(wr,"-$&").toLowerCase():l===null&&(l=void 0):u=i="oninput",u==="oninput"&&o[i=u]&&(i="oninputCapture"),o[i]=l}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=P(t.children).forEach(function(a){a.props.selected=o.value.indexOf(a.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=P(t.children).forEach(function(a){a.props.selected=o.multiple?o.defaultValue.indexOf(a.props.value)!=-1:o.defaultValue==a.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",Mr)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),n.props=o}(e),e.$$typeof=en,Kt&&Kt(e)};var Wt=h.__r;h.__r=function(e){Wt&&Wt(e),Le=e.__c};var Xt=h.diffed;h.diffed=function(e){Xt&&Xt(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),Le=null};var Vr={ReactCurrentDispatcher:{current:{readContext:function(e){return Le.__n[e.__c].props.value}}}};function Ir(e){return T.bind(null,e)}function nn(e){return!!e&&e.$$typeof===en}function Dr(e){return nn(e)?$t.apply(null,arguments):e}function ze(e){return!!e.__k&&(ee(null,e),!0)}function Tr(e){return e&&(e.base||e.nodeType===1&&e)||null}var Ar=function(e,n){return e(n)},Or=function(e,n){return e(n)},Ge=H;function rn(e){e()}function kr(e){return e}function Nr(){return[!1,rn]}var Hr=L;function Pr(e,n){var t=n(),r=D({h:{__:t,v:n}}),o=r[0].h,i=r[1];return L(function(){o.__=t,o.v=n,ke(o.__,n())||i({h:o})},[e,t,n]),B(function(){return ke(o.__,o.v())||i({h:o}),e(function(){ke(o.__,o.v())||i({h:o})})},[e]),t}var b={useState:D,useId:Lt,useReducer:ue,useEffect:B,useLayoutEffect:L,useInsertionEffect:Hr,useTransition:Nr,useDeferredValue:kr,useSyncExternalStore:Pr,startTransition:rn,useRef:z,useImperativeHandle:Nt,useMemo:U,useCallback:ye,useContext:Ht,useDebugValue:Pt,version:"17.0.2",Children:_r,render:Pe,hydrate:tn,unmountComponentAtNode:ze,createPortal:br,createElement:T,createContext:De,createFactory:Ir,cloneElement:Dr,createRef:Me,Fragment:H,isValidElement:nn,findDOMNode:Tr,Component:A,PureComponent:He,memo:gr,forwardRef:pr,flushSync:Or,unstable_batchedUpdates:Ar,StrictMode:Ge,Suspense:be,SuspenseList:ae,lazy:hr,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Vr};function X(e,n){return typeof e=="function"?e(n):e}function O(e,n){return t=>{n.setState(r=>({...r,[e]:X(t,r[e])}))}}function Re(e){return e instanceof Function}function Lr(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function zr(e,n){let t=[],r=o=>{o.forEach(i=>{t.push(i);let l=n(i);l!=null&&l.length&&r(l)})};return r(e),t}function y(e,n,t){let r=[],o;return()=>{let i;t.key&&t.debug&&(i=Date.now());let l=e();if(!(l.length!==r.length||l.some((c,s)=>r[s]!==c)))return o;r=l;let a;if(t.key&&t.debug&&(a=Date.now()),o=n(...l),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){let c=Math.round((Date.now()-i)*100)/100,s=Math.round((Date.now()-a)*100)/100,f=s/16,g=(d,p)=>{for(d=String(d);d.length2&&(l.children=arguments.length>3?se.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)l[i]===void 0&&(l[i]=e.defaultProps[i]);return ie(e,l,r,o,null)}function ie(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,__h:null,constructor:void 0,__v:o??++pt};return o==null&&h.vnode!=null&&h.vnode(i),i}function Me(){return{current:null}}function H(e){return e.children}function T(e,n){this.props=e,this.context=n}function le(e,n){if(n==null)return e.__?le(e.__,e.__.__k.indexOf(e)+1):null;for(var t;nn&&Y.sort(Fe));pe.__r=0}function bt(e,n,t,r,o,i,l,u,a,c){var s,f,g,d,p,_,m,v=r&&r.__k||ht,S=v.length;for(t.__k=[],s=0;s0?ie(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)!=null){if(d.__=t,d.__b=t.__b+1,(g=v[s])===null||g&&d.key==g.key&&d.type===g.type)v[s]=void 0;else for(f=0;f=0;n--)if((t=e.__k[n])&&(r=wt(t)))return r}return null}function ir(e,n,t,r,o){var i;for(i in t)i==="children"||i==="key"||i in n||_e(e,i,null,t[i],r);for(i in n)o&&typeof n[i]!="function"||i==="children"||i==="key"||i==="value"||i==="checked"||t[i]===n[i]||_e(e,i,n[i],t[i],r)}function ct(e,n,t){n[0]==="-"?e.setProperty(n,t??""):e[n]=t==null?"":typeof t!="number"||or.test(n)?t:t+"px"}function _e(e,n,t,r,o){var i;e:if(n==="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(n in r)t&&n in t||ct(e.style,n,"");if(t)for(n in t)r&&t[n]===r[n]||ct(e.style,n,t[n])}else if(n[0]==="o"&&n[1]==="n")i=n!==(n=n.replace(/Capture$/,"")),n=n.toLowerCase()in e?n.toLowerCase().slice(2):n.slice(2),e.l||(e.l={}),e.l[n+i]=t,t?r||e.addEventListener(n,i?ft:gt,i):e.removeEventListener(n,i?ft:gt,i);else if(n!=="dangerouslySetInnerHTML"){if(o)n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!=="width"&&n!=="height"&&n!=="href"&&n!=="list"&&n!=="form"&&n!=="tabIndex"&&n!=="download"&&n!=="rowSpan"&&n!=="colSpan"&&n in e)try{e[n]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&n[4]!=="-"?e.removeAttribute(n):e.setAttribute(n,t))}}function gt(e){return this.l[e.type+!1](h.event?h.event(e):e)}function ft(e){return this.l[e.type+!0](h.event?h.event(e):e)}function Ve(e,n,t,r,o,i,l,u,a){var c,s,f,g,d,p,_,m,v,S,x,C,V,N,J,F=n.type;if(n.constructor!==void 0)return null;t.__h!=null&&(a=t.__h,u=n.__e=t.__e,n.__h=null,i=[u]),(c=h.__b)&&c(n);try{e:if(typeof F=="function"){if(m=n.props,v=(c=F.contextType)&&r[c.__c],S=c?v?v.props.value:c.__:r,t.__c?_=(s=n.__c=t.__c).__=s.__E:("prototype"in F&&F.prototype.render?n.__c=s=new F(m,S):(n.__c=s=new T(m,S),s.constructor=F,s.render=sr),v&&v.sub(s),s.props=m,s.state||(s.state={}),s.context=S,s.__n=r,f=s.__d=!0,s.__h=[],s._sb=[]),s.__s==null&&(s.__s=s.state),F.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=G({},s.__s)),G(s.__s,F.getDerivedStateFromProps(m,s.__s))),g=s.props,d=s.state,s.__v=n,f)F.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(F.getDerivedStateFromProps==null&&m!==g&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(m,S),!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(m,s.__s,S)===!1||n.__v===t.__v){for(n.__v!==t.__v&&(s.props=m,s.state=s.__s,s.__d=!1),s.__e=!1,n.__e=t.__e,n.__k=t.__k,n.__k.forEach(function(Z){Z&&(Z.__=n)}),x=0;x2&&(u.children=arguments.length>3?se.call(arguments,2):t),ie(e.type,u,r||e.key,o||e.ref,null)}function De(e,n){var t={__c:n="__cC"+mt++,__: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.shouldComponentUpdate=function(l){this.props.value!==l.value&&o.some(function(u){u.__e=!0,$e(u)})},this.sub=function(l){o.push(l);var u=l.componentWillUnmount;l.componentWillUnmount=function(){o.splice(o.indexOf(l),1),u&&u.call(l)}}),r.children}};return t.Provider.__=t.Consumer.contextType=t}se=ht.slice,h={__e:function(e,n,t,r){for(var o,i,l;n=n.__;)if((o=n.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),l=o.__d),l)return o.__E=o}catch(u){e=u}throw e}},pt=0,rr=function(e){return e!=null&&e.constructor===void 0},T.prototype.setState=function(e,n){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=G({},this.state),typeof e=="function"&&(e=e(G({},t),this.props)),e&&G(t,e),e!=null&&this.__v&&(n&&this._sb.push(n),$e(this))},T.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$e(this))},T.prototype.render=H,Y=[],_t=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fe=function(e,n){return e.__v.__b-n.__v.__b},pe.__r=0,mt=0;var K,w,Te,$t,te=0,Ot=[],he=[],Mt=h.__b,Vt=h.__r,It=h.diffed,Dt=h.__c,Tt=h.unmount;function ne(e,n){h.__h&&h.__h(w,e,te||n),te=0;var t=w.__H||(w.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({__V:he}),t.__[e]}function I(e){return te=1,ue(Lt,e)}function ue(e,n,t){var r=ne(K++,2);if(r.t=e,!r.__c&&(r.__=[t?t(n):Lt(void 0,n),function(u){var a=r.__N?r.__N[0]:r.__[0],c=r.t(a,u);a!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=w,!w.u)){var o=function(u,a,c){if(!r.__c.__H)return!0;var s=r.__c.__H.__.filter(function(g){return g.__c});if(s.every(function(g){return!g.__N}))return!i||i.call(this,u,a,c);var f=!1;return s.forEach(function(g){if(g.__N){var d=g.__[0];g.__=g.__N,g.__N=void 0,d!==g.__[0]&&(f=!0)}}),!(!f&&r.__c.props===u)&&(!i||i.call(this,u,a,c))};w.u=!0;var i=w.shouldComponentUpdate,l=w.componentWillUpdate;w.componentWillUpdate=function(u,a,c){if(this.__e){var s=i;i=void 0,o(u,a,c),i=s}l&&l.call(this,u,a,c)},w.shouldComponentUpdate=o}return r.__N||r.__}function B(e,n){var t=ne(K++,3);!h.__s&&Oe(t.__H,n)&&(t.__=e,t.i=n,w.__H.__h.push(t))}function L(e,n){var t=ne(K++,4);!h.__s&&Oe(t.__H,n)&&(t.__=e,t.i=n,w.__h.push(t))}function z(e){return te=5,U(function(){return{current:e}},[])}function Nt(e,n,t){te=6,L(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 U(e,n){var t=ne(K++,7);return Oe(t.__H,n)?(t.__V=e(),t.i=n,t.__h=e,t.__V):t.__}function ye(e,n){return te=8,U(function(){return e},n)}function kt(e){var n=w.context[e.__c],t=ne(K++,9);return t.c=e,n?(t.__==null&&(t.__=!0,n.sub(w)),n.props.value):e.__}function Ht(e,n){h.useDebugValue&&h.useDebugValue(n?n(e):e)}function Pt(){var e=ne(K++,11);if(!e.__){for(var n=w.__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 ur(){for(var e;e=Ot.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ve),e.__H.__h.forEach(Ae),e.__H.__h=[]}catch(n){e.__H.__h=[],h.__e(n,e.__v)}}h.__b=function(e){w=null,Mt&&Mt(e)},h.__r=function(e){Vt&&Vt(e),K=0;var n=(w=e.__c).__H;n&&(Te===w?(n.__h=[],w.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=he,t.__N=t.i=void 0})):(n.__h.forEach(ve),n.__h.forEach(Ae),n.__h=[],K=0)),Te=w},h.diffed=function(e){It&&It(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Ot.push(n)!==1&&$t===h.requestAnimationFrame||(($t=h.requestAnimationFrame)||ar)(ur)),n.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==he&&(t.__=t.__V),t.i=void 0,t.__V=he})),Te=w=null},h.__c=function(e,n){n.some(function(t){try{t.__h.forEach(ve),t.__h=t.__h.filter(function(r){return!r.__||Ae(r)})}catch(r){n.some(function(o){o.__h&&(o.__h=[])}),n=[],h.__e(r,t.__v)}}),Dt&&Dt(e,n)},h.unmount=function(e){Tt&&Tt(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{ve(r)}catch(o){n=o}}),t.__H=void 0,n&&h.__e(n,t.__v))};var At=typeof requestAnimationFrame=="function";function ar(e){var n,t=function(){clearTimeout(r),At&&cancelAnimationFrame(n),setTimeout(e)},r=setTimeout(t,100);At&&(n=requestAnimationFrame(t))}function ve(e){var n=w,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),w=n}function Ae(e){var n=w;e.__c=e.__(),w=n}function Oe(e,n){return!e||e.length!==n.length||n.some(function(t,r){return t!==e[r]})}function Lt(e,n){return typeof n=="function"?n(e):n}function Xt(e,n){for(var t in n)e[t]=n[t];return e}function ke(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 Ne(e,n){return e===n&&(e!==0||1/e==1/n)||e!=e&&n!=n}function He(e){this.props=e}function dr(e,n){function t(o){var i=this.props.ref,l=i==o.ref;return!l&&i&&(i.call?i(null):i.current=null),n?!n(this.props,o)||!l:ke(this.props,o)}function r(o){return this.shouldComponentUpdate=t,D(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(He.prototype=new T).isPureReactComponent=!0,He.prototype.shouldComponentUpdate=function(e,n){return ke(this.props,e)||ke(this.state,n)};var zt=h.__b;h.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),zt&&zt(e)};var cr=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function gr(e){function n(t){var r=Xt({},t);return delete r.ref,e(r,t.ref||null)}return n.$$typeof=cr,n.render=n,n.prototype.isReactComponent=n.__f=!0,n.displayName="ForwardRef("+(e.displayName||e.name)+")",n}var Gt=function(e,n){return e==null?null:P(P(e).map(n))},fr={map:Gt,forEach:Gt,count:function(e){return e?P(e).length:0},only:function(e){var n=P(e);if(n.length!==1)throw"Children.only";return n[0]},toArray:P},pr=h.__e;h.__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)}pr(e,n,t,r)};var Bt=h.unmount;function Jt(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=Xt({},e)).__c!=null&&(e.__c.__P===t&&(e.__c.__P=n),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Jt(r,n,t)})),e}function Yt(e,n,t){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Yt(r,n,t)}),e.__c&&e.__c.__P===n&&(e.__e&&t.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=t)),e}function be(){this.__u=0,this.t=null,this.__b=null}function Qt(e){var n=e.__.__c;return n&&n.__a&&n.__a(e)}function _r(e){var n,t,r;function o(i){if(n||(n=e()).then(function(l){t=l.default||l},function(l){r=l}),r)throw r;if(!t)throw n;return D(t,i)}return o.displayName="Lazy",o.__f=!0,o}function ae(){this.u=null,this.o=null}h.unmount=function(e){var n=e.__c;n&&n.__R&&n.__R(),n&&e.__h===!0&&(e.type=null),Bt&&Bt(e)},(be.prototype=new T).__c=function(e,n){var t=n.__c,r=this;r.t==null&&(r.t=[]),r.t.push(t);var o=Qt(r.__v),i=!1,l=function(){i||(i=!0,t.__R=null,o?o(u):u())};t.__R=l;var u=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=Yt(c,c.__c.__P,c.__c.__O)}var s;for(r.setState({__a:r.__b=null});s=r.t.pop();)s.forceUpdate()}},a=n.__h===!0;r.__u++||a||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(l,l)},be.prototype.componentWillUnmount=function(){this.t=[]},be.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]=Jt(this.__b,t,r.__O=r.__P)}this.__b=null}var o=n.__a&&D(H,null,e.fallback);return o&&(o.__h=null),[D(H,null,n.__a?null:e.children),o]};var Ut=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)}}),ee(D(mr,{context:n.context},e.__v),n.l)):n.l&&n.componentWillUnmount()}function vr(e,n){var t=D(hr,{__v:e,i:n});return t.containerInfo=n,t}(ae.prototype=new T).__a=function(e){var n=this,t=Qt(n.__v),r=n.o.get(e);return r[0]++,function(o){var i=function(){n.props.revealOrder?(r.push(o),Ut(n,e,r)):o()};t?t(i):i()}},ae.prototype.render=function(e){this.u=null,this.o=new Map;var n=P(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},ae.prototype.componentDidUpdate=ae.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(n,t){Ut(e,t,n)})};var Zt=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,yr=/^(?: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]/,br=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Sr=/[A-Z0-9]/g,Cr=typeof document<"u",wr=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Pe(e,n,t){return n.__k==null&&(n.textContent=""),ee(e,n),typeof t=="function"&&t(),e?e.__c:null}function en(e,n,t){return Ie(e,n),typeof t=="function"&&t(),e?e.__c:null}T.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(T.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(n){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:n})}})});var jt=h.event;function Rr(){}function Er(){return this.cancelBubble}function xr(){return this.defaultPrevented}h.event=function(e){return jt&&(e=jt(e)),e.persist=Rr,e.isPropagationStopped=Er,e.isDefaultPrevented=xr,e.nativeEvent=e};var Le,Fr={enumerable:!1,configurable:!0,get:function(){return this.class}},qt=h.vnode;h.vnode=function(e){typeof e.type=="string"&&function(n){var t=n.props,r=n.type,o={};for(var i in t){var l=t[i];if(!(i==="value"&&"defaultValue"in t&&l==null||Cr&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var u=i.toLowerCase();i==="defaultValue"&&"value"in t&&t.value==null?i="value":i==="download"&&l===!0?l="":u==="ondoubleclick"?i="ondblclick":u!=="onchange"||r!=="input"&&r!=="textarea"||wr(t.type)?u==="onfocus"?i="onfocusin":u==="onblur"?i="onfocusout":br.test(i)?i=u:r.indexOf("-")===-1&&yr.test(i)?i=i.replace(Sr,"-$&").toLowerCase():l===null&&(l=void 0):u=i="oninput",u==="oninput"&&o[i=u]&&(i="oninputCapture"),o[i]=l}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=P(t.children).forEach(function(a){a.props.selected=o.value.indexOf(a.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=P(t.children).forEach(function(a){a.props.selected=o.multiple?o.defaultValue.indexOf(a.props.value)!=-1:o.defaultValue==a.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",Fr)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),n.props=o}(e),e.$$typeof=Zt,qt&&qt(e)};var Kt=h.__r;h.__r=function(e){Kt&&Kt(e),Le=e.__c};var Wt=h.diffed;h.diffed=function(e){Wt&&Wt(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),Le=null};var $r={ReactCurrentDispatcher:{current:{readContext:function(e){return Le.__n[e.__c].props.value}}}};function Mr(e){return D.bind(null,e)}function tn(e){return!!e&&e.$$typeof===Zt}function Vr(e){return tn(e)?Ft.apply(null,arguments):e}function ze(e){return!!e.__k&&(ee(null,e),!0)}function Ir(e){return e&&(e.base||e.nodeType===1&&e)||null}var Dr=function(e,n){return e(n)},Tr=function(e,n){return e(n)},Ge=H;function nn(e){e()}function Ar(e){return e}function Or(){return[!1,nn]}var Nr=L;function kr(e,n){var t=n(),r=I({h:{__:t,v:n}}),o=r[0].h,i=r[1];return L(function(){o.__=t,o.v=n,Ne(o.__,n())||i({h:o})},[e,t,n]),B(function(){return Ne(o.__,o.v())||i({h:o}),e(function(){Ne(o.__,o.v())||i({h:o})})},[e]),t}var b={useState:I,useId:Pt,useReducer:ue,useEffect:B,useLayoutEffect:L,useInsertionEffect:Nr,useTransition:Or,useDeferredValue:Ar,useSyncExternalStore:kr,startTransition:nn,useRef:z,useImperativeHandle:Nt,useMemo:U,useCallback:ye,useContext:kt,useDebugValue:Ht,version:"17.0.2",Children:fr,render:Pe,hydrate:en,unmountComponentAtNode:ze,createPortal:vr,createElement:D,createContext:De,createFactory:Mr,cloneElement:Vr,createRef:Me,Fragment:H,isValidElement:tn,findDOMNode:Ir,Component:T,PureComponent:He,memo:dr,forwardRef:gr,flushSync:Tr,unstable_batchedUpdates:Dr,StrictMode:Ge,Suspense:be,SuspenseList:ae,lazy:_r,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:$r};function W(e,n){return typeof e=="function"?e(n):e}function A(e,n){return t=>{n.setState(r=>({...r,[e]:W(t,r[e])}))}}function Re(e){return e instanceof Function}function Hr(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function Pr(e,n){let t=[],r=o=>{o.forEach(i=>{t.push(i);let l=n(i);l!=null&&l.length&&r(l)})};return r(e),t}function y(e,n,t){let r=[],o;return()=>{let i;t.key&&t.debug&&(i=Date.now());let l=e();if(!(l.length!==r.length||l.some((c,s)=>r[s]!==c)))return o;r=l;let a;if(t.key&&t.debug&&(a=Date.now()),o=n(...l),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){let c=Math.round((Date.now()-i)*100)/100,s=Math.round((Date.now()-a)*100)/100,f=s/16,g=(d,p)=>{for(d=String(d);d.length{let d=g;for(let _ of a.split(".")){var p;d=(p=d)==null?void 0:p[_]}return d}:s=g=>g[u.accessorKey]),!c)throw new Error;let f={id:`${String(c)}`,accessorFn:s,parent:r,depth:t,columnDef:u,columns:[],getFlatColumns:y(()=>[!0],()=>{var g;return[f,...(g=f.columns)==null?void 0:g.flatMap(d=>d.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}}),getLeafColumns:y(()=>[e._getOrderColumnsFn()],g=>{var d;if((d=f.columns)!=null&&d.length){let p=f.columns.flatMap(_=>_.getLeafColumns());return g(p)}return[f]},{key:"column.getLeafColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}})};return f=e._features.reduce((g,d)=>Object.assign(g,d.createColumn==null?void 0:d.createColumn(f,e)),f),f}function ln(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 l=[],u=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(u),l.push(a)};return u(i),l},getContext:()=>({table:e,header:i,column:n})};return e._features.forEach(l=>{Object.assign(i,l.createHeader==null?void 0:l.createHeader(i,e))}),i}var Br={createTable:e=>({getHeaderGroups:y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r,o)=>{var i,l;let u=(i=r?.map(f=>t.find(g=>g.id===f)).filter(Boolean))!=null?i:[],a=(l=o?.map(f=>t.find(g=>g.id===f)).filter(Boolean))!=null?l:[],c=t.filter(f=>!(r!=null&&r.includes(f.id))&&!(o!=null&&o.includes(f.id)));return Se(n,[...u,...c,...a],e)},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterHeaderGroups:y(()=>[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))),Se(n,t,e,"center")),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftHeaderGroups:y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,r)=>{var o;let i=(o=r?.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?o:[];return Se(n,i,e,"left")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightHeaderGroups:y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,r)=>{var o;let i=(o=r?.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?o:[];return Se(n,i,e,"right")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getFooterGroups:y(()=>[e.getHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftFooterGroups:y(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterFooterGroups:y(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightFooterGroups:y(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getFlatHeaders:y(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftFlatHeaders:y(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterFlatHeaders:y(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightFlatHeaders:y(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterLeafHeaders:y(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftLeafHeaders:y(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightLeafHeaders:y(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeafHeaders:y(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,r)=>{var o,i,l,u,a,c;return[...(o=(i=n[0])==null?void 0:i.headers)!=null?o:[],...(l=(u=t[0])==null?void 0:u.headers)!=null?l:[],...(a=(c=r[0])==null?void 0:c.headers)!=null?a:[]].map(s=>s.getLeafHeaders()).flat()},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}})})};function Se(e,n,t,r){var o,i;let l=0,u=function(g,d){d===void 0&&(d=1),l=Math.max(l,d),g.filter(p=>p.getIsVisible()).forEach(p=>{var _;(_=p.columns)!=null&&_.length&&u(p.columns,d+1)},0)};u(e);let a=[],c=(g,d)=>{let p={depth:d,id:[r,`${d}`].filter(Boolean).join("_"),headers:[]},_=[];g.forEach(m=>{let v=[..._].reverse()[0],E=m.column.depth===p.depth,S,C=!1;if(E&&m.column.parent?S=m.column.parent:(S=m.column,C=!0),v&&v?.column===S)v.subHeaders.push(m);else{let I=ln(t,S,{id:[r,d,S.id,m?.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${_.filter(V=>V.column===S).length}`:void 0,depth:d,index:_.length});I.subHeaders.push(m),_.push(I)}p.headers.push(m),m.headerGroup=p}),a.push(p),d>0&&c(_,d-1)},s=n.map((g,d)=>ln(t,g,{depth:l,index:d}));c(s,l-1),a.reverse();let f=g=>g.filter(p=>p.column.getIsVisible()).map(p=>{let _=0,m=0,v=[0];p.subHeaders&&p.subHeaders.length?(v=[],f(p.subHeaders).forEach(S=>{let{colSpan:C,rowSpan:I}=S;_+=C,v.push(I)})):_=1;let E=Math.min(...v);return m=m+E,p.colSpan=_,p.rowSpan=m,{colSpan:_,rowSpan:m}});return f((o=(i=a[0])==null?void 0:i.headers)!=null?o:[]),a}var Ce={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Be=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Ur={getDefaultColumnDef:()=>Ce,getInitialState:e=>({columnSizing:{},columnSizingInfo:Be(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:O("columnSizing",e),onColumnSizingInfoChange:O("columnSizingInfo",e)}),createColumn:(e,n)=>({getSize:()=>{var t,r,o;let i=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Ce.minSize,(r=i??e.columnDef.size)!=null?r:Ce.size),(o=e.columnDef.maxSize)!=null?o:Ce.maxSize)},getStart:t=>{let r=t?t==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns(),o=r.findIndex(i=>i.id===e.id);if(o>0){let i=r[o-1];return i.getStart(t)+i.getSize()}return 0},resetSize:()=>{n.setColumnSizing(t=>{let{[e.id]:r,...o}=t;return o})},getCanResize:()=>{var t,r;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((r=n.options.enableColumnResizing)!=null?r:!0)},getIsResizing:()=>n.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,n)=>({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},getStart:()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},getResizeHandler:()=>{let t=n.getColumn(e.column.id),r=t?.getCanResize();return o=>{if(!t||!r||(o.persist==null||o.persist(),Ue(o)&&o.touches&&o.touches.length>1))return;let i=e.getSize(),l=e?e.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[t.id,t.getSize()]],u=Ue(o)?Math.round(o.touches[0].clientX):o.clientX,a={},c=(_,m)=>{typeof m=="number"&&(n.setColumnSizingInfo(v=>{var E,S;let C=m-((E=v?.startOffset)!=null?E:0),I=Math.max(C/((S=v?.startSize)!=null?S:0),-.999999);return v.columnSizingStart.forEach(V=>{let[q,F]=V;a[q]=Math.round(Math.max(F+F*I,0)*100)/100}),{...v,deltaOffset:C,deltaPercentage:I}}),(n.options.columnResizeMode==="onChange"||_==="end")&&n.setColumnSizing(v=>({...v,...a})))},s=_=>c("move",_),f=_=>{c("end",_),n.setColumnSizingInfo(m=>({...m,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g={moveHandler:_=>s(_.clientX),upHandler:_=>{document.removeEventListener("mousemove",g.moveHandler),document.removeEventListener("mouseup",g.upHandler),f(_.clientX)}},d={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),s(_.touches[0].clientX),!1),upHandler:_=>{var m;document.removeEventListener("touchmove",d.moveHandler),document.removeEventListener("touchend",d.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),f((m=_.touches[0])==null?void 0:m.clientX)}},p=jr()?{passive:!1}:!1;Ue(o)?(document.addEventListener("touchmove",d.moveHandler,p),document.addEventListener("touchend",d.upHandler,p)):(document.addEventListener("mousemove",g.moveHandler,p),document.addEventListener("mouseup",g.upHandler,p)),n.setColumnSizingInfo(_=>({..._,startOffset:u,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:t.id}))}}}),createTable:e=>({setColumnSizing:n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),setColumnSizingInfo:n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),resetColumnSizing:n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},resetHeaderSizeInfo:n=>{var t;e.setColumnSizingInfo(n?Be():(t=e.initialState.columnSizingInfo)!=null?t:Be())},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},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},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},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}})},we=null;function jr(){if(typeof we=="boolean")return we;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 we=e,we}function Ue(e){return e.type==="touchstart"}var qr={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:O("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;return{_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})}},setExpanded:r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),toggleAllRowsExpanded:r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),getToggleAllRowsExpandedHandler:()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{let r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},getIsAllRowsExpanded:()=>{let r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},getExpandedDepth:()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{let l=i.split(".");r=Math.max(r,l.length)}),r},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,n)=>({toggleExpanded:t=>{n.setExpanded(r=>{var o;let i=r===!0?!0:!!(r!=null&&r[e.id]),l={};if(r===!0?Object.keys(n.getRowModel().rowsById).forEach(u=>{l[u]=!0}):l=r,t=(o=t)!=null?o:!i,!i&&t)return{...l,[e.id]:!0};if(i&&!t){let{[e.id]:u,...a}=l;return a}return r})},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])},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)},getToggleExpandedHandler:()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}})},dn=(e,n,t)=>{var r,o,i;let l=t.toLowerCase();return!!(!((r=e.getValue(n))==null||(o=r.toString())==null||(i=o.toLowerCase())==null)&&i.includes(l))};dn.autoRemove=e=>N(e);var cn=(e,n,t)=>{var r,o;return!!(!((r=e.getValue(n))==null||(o=r.toString())==null)&&o.includes(t))};cn.autoRemove=e=>N(e);var gn=(e,n,t)=>{var r,o;return((r=e.getValue(n))==null||(o=r.toString())==null?void 0:o.toLowerCase())===t?.toLowerCase()};gn.autoRemove=e=>N(e);var fn=(e,n,t)=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(t)};fn.autoRemove=e=>N(e)||!(e!=null&&e.length);var pn=(e,n,t)=>!t.some(r=>{var o;return!((o=e.getValue(n))!=null&&o.includes(r))});pn.autoRemove=e=>N(e)||!(e!=null&&e.length);var _n=(e,n,t)=>t.some(r=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(r)});_n.autoRemove=e=>N(e)||!(e!=null&&e.length);var mn=(e,n,t)=>e.getValue(n)===t;mn.autoRemove=e=>N(e);var hn=(e,n,t)=>e.getValue(n)==t;hn.autoRemove=e=>N(e);var Ze=(e,n,t)=>{let[r,o]=t,i=e.getValue(n);return i>=r&&i<=o};Ze.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,l=t===null||Number.isNaN(o)?1/0:o;if(i>l){let u=i;i=l,l=u}return[i,l]};Ze.autoRemove=e=>N(e)||N(e[0])&&N(e[1]);var j={includesString:dn,includesStringSensitive:cn,equalsString:gn,arrIncludes:fn,arrIncludesAll:pn,arrIncludesSome:_n,equals:mn,weakEquals:hn,inNumberRange:Ze};function N(e){return e==null||e===""}var Kr={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:O("columnFilters",e),onGlobalFilterChange:O("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t,r;let o=(t=e.getCoreRowModel().flatRows[0])==null||(r=t._getAllCellsByColumnId()[n.id])==null?void 0:r.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,n)=>({getAutoFilterFn:()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);return typeof r=="string"?j.includesString:typeof r=="number"?j.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?j.equals:Array.isArray(r)?j.arrIncludes:j.weakEquals},getFilterFn:()=>{var t,r;return Re(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:j[e.columnDef.filterFn]},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},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},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var t,r;return(t=n.getState().columnFilters)==null||(r=t.find(o=>o.id===e.id))==null?void 0:r.value},getFilterIndex:()=>{var t,r;return(t=(r=n.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},setFilterValue:t=>{n.setColumnFilters(r=>{let o=e.getFilterFn(),i=r?.find(s=>s.id===e.id),l=X(t,i?i.value:void 0);if(sn(o,l,e)){var u;return(u=r?.filter(s=>s.id!==e.id))!=null?u:[]}let a={id:e.id,value:l};if(i){var c;return(c=r?.map(s=>s.id===e.id?a:s))!=null?c:[]}return r!=null&&r.length?[...r,a]:[a]})},_getFacetedRowModel:n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),_getFacetedUniqueValues:n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,n)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>j.includesString,getGlobalFilterFn:()=>{var n,t;let{globalFilterFn:r}=e.options;return Re(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[r])!=null?n:j[r]},setColumnFilters:n=>{let t=e.getAllLeafColumns(),r=o=>{var i;return(i=X(n,o))==null?void 0:i.filter(l=>{let u=t.find(a=>a.id===l.id);if(u){let a=u.getFilterFn();if(sn(a,l.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},setGlobalFilter:n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},resetGlobalFilter:n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)},resetColumnFilters:n=>{var t,r;e.setColumnFilters(n?[]:(t=(r=e.initialState)==null?void 0:r.columnFilters)!=null?t:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function sn(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}var Wr=(e,n,t)=>t.reduce((r,o)=>{let i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),Xr=(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},Jr=(e,n,t)=>{let r;return t.forEach(o=>{let i=o.getValue(e);i!=null&&(r=i)&&(r=i)}),r},Yr=(e,n,t)=>{let r,o;return t.forEach(i=>{let l=i.getValue(e);l!=null&&(r===void 0?l>=l&&(r=o=l):(r>l&&(r=l),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},Zr=(e,n)=>{if(!n.length)return;let t=n.map(i=>i.getValue(e));if(!Lr(t))return;if(t.length===1)return t[0];let r=Math.floor(t.length/2),o=t.sort((i,l)=>i-l);return t.length%2!==0?o[r]:(o[r-1]+o[r])/2},eo=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),to=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,no=(e,n)=>n.length,je={sum:Wr,min:Xr,max:Jr,extent:Yr,mean:Qr,median:Zr,unique:eo,uniqueCount:to,count:no},ro={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:O("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>({toggleGrouping:()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(r=>r!==e.id):[...t??[],e.id])},getCanGroup:()=>{var t,r,o,i;return(t=(r=(o=(i=e.columnDef.enableGrouping)!=null?i:!0)!=null?o:n.options.enableGrouping)!=null?r:!0)!=null?t:!!e.accessorFn},getIsGrouped:()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},getGroupedIndex:()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},getToggleGroupingHandler:()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},getAutoAggregationFn:()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);if(typeof r=="number")return je.sum;if(Object.prototype.toString.call(r)==="[object Date]")return je.extent},getAggregationFn:()=>{var t,r;if(!e)throw new Error;return Re(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:je[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),resetGrouping:n=>{var t,r;e.setGrouping(n?[]:(t=(r=e.initialState)==null?void 0:r.grouping)!=null?t:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:(e,n)=>({getIsGrouped:()=>!!e.groupingColumnId,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)},_groupingValuesCache:{}}),createCell:(e,n,t,r)=>({getIsGrouped:()=>n.getIsGrouped()&&n.id===t.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&n.getIsGrouped(),getIsAggregated:()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}})};function oo(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(l=>l.id===i)).filter(Boolean),...r]}var io={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:O("columnOrder",e)}),createTable:e=>({setColumnOrder:n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),resetColumnOrder:n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},_getOrderColumnsFn:y(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,r)=>o=>{let i=[];if(!(n!=null&&n.length))i=o;else{let l=[...n],u=[...o];for(;u.length&&l.length;){let a=l.shift(),c=u.findIndex(s=>s.id===a);c>-1&&i.push(u.splice(c,1)[0])}i=[...i,...u]}return oo(i,t,r)},{key:!1})})},Xe=0,Je=10,qe=()=>({pageIndex:Xe,pageSize:Je}),lo={getInitialState:e=>({...e,pagination:{...qe(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:O("pagination",e)}),createTable:e=>{let n=!1,t=!1;return{_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})}},setPagination:r=>{let o=i=>X(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},resetPagination:r=>{var o;e.setPagination(r?qe():(o=e.initialState.pagination)!=null?o:qe())},setPageIndex:r=>{e.setPagination(o=>{let i=X(r,o.pageIndex),l=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,l)),{...o,pageIndex:i}})},resetPageIndex:r=>{var o,i,l;e.setPageIndex(r?Xe:(o=(i=e.initialState)==null||(l=i.pagination)==null?void 0:l.pageIndex)!=null?o:Xe)},resetPageSize:r=>{var o,i,l;e.setPageSize(r?Je:(o=(i=e.initialState)==null||(l=i.pagination)==null?void 0:l.pageSize)!=null?o:Je)},setPageSize:r=>{e.setPagination(o=>{let i=Math.max(1,X(r,o.pageSize)),l=o.pageSize*o.pageIndex,u=Math.floor(l/i);return{...o,pageIndex:u,pageSize:i}})},setPageCount:r=>e.setPagination(o=>{var i;let l=X(r,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...o,pageCount:l}}),getPageOptions:y(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,l)=>l)),o},{key:!1,debug:()=>{var r;return(r=e.options.debugAll)!=null?r:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{let{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),nextPage:()=>e.setPageIndex(r=>r+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},Ke=()=>({left:[],right:[]}),so={getInitialState:e=>({columnPinning:Ke(),...e}),getDefaultOptions:e=>({onColumnPinningChange:O("columnPinning",e)}),createColumn:(e,n)=>({pin:t=>{let r=e.getLeafColumns().map(o=>o.id).filter(Boolean);n.setColumnPinning(o=>{var i,l;if(t==="right"){var u,a;return{left:((u=o?.left)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((a=o?.right)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(t==="left"){var c,s;return{left:[...((c=o?.left)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((s=o?.right)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((i=o?.left)!=null?i:[]).filter(f=>!(r!=null&&r.includes(f))),right:((l=o?.right)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f)))}})},getCanPin:()=>e.getLeafColumns().some(r=>{var o,i;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=n.options.enablePinning)!=null?i:!0)}),getIsPinned:()=>{let t=e.getLeafColumns().map(u=>u.id),{left:r,right:o}=n.getState().columnPinning,i=t.some(u=>r?.includes(u)),l=t.some(u=>o?.includes(u));return i?"left":l?"right":!1},getPinnedIndex:()=>{var t,r,o;let i=e.getIsPinned();return i?(t=(r=n.getState().columnPinning)==null||(o=r[i])==null?void 0:o.indexOf(e.id))!=null?t:-1:0}}),createRow:(e,n)=>({getCenterVisibleCells:y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,r,o)=>{let i=[...r??[],...o??[]];return t.filter(l=>!i.includes(l.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getLeftVisibleCells:y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,,],(t,r)=>(r??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getRightVisibleCells:y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,r)=>(r??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),{key:"row.getRightVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}})}),createTable:e=>({setColumnPinning:n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),resetColumnPinning:n=>{var t,r;return e.setColumnPinning(n?Ke():(t=(r=e.initialState)==null?void 0:r.columnPinning)!=null?t:Ke())},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)},getLeftLeafColumns:y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),getRightLeafColumns:y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),getCenterLeafColumns:y(()=>[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))},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}})})},uo={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:O("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),resetRowSelection:n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},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})},toggleAllPageRowsSelected:n=>e.setRowSelection(t=>{let r=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{Ye(o,i.id,r,e)}),o}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:y(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),getFilteredSelectedRowModel:y(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),getGroupedSelectedRowModel:y(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),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},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},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())},getToggleAllRowsSelectedHandler:()=>n=>{e.toggleAllRowsSelected(n.target.checked)},getToggleAllPageRowsSelectedHandler:()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}}),createRow:(e,n)=>({toggleSelected:t=>{let r=e.getIsSelected();n.setRowSelection(o=>{if(t=typeof t<"u"?t:!r,r===t)return o;let i={...o};return Ye(i,e.id,t,n),i})},getIsSelected:()=>{let{rowSelection:t}=n.getState();return et(e,t)},getIsSomeSelected:()=>{let{rowSelection:t}=n.getState();return un(e,t)==="some"},getIsAllSubRowsSelected:()=>{let{rowSelection:t}=n.getState();return un(e,t)==="all"},getCanSelect:()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},getCanSelectSubRows:()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},getCanMultiSelect:()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},getToggleSelectedHandler:()=>{let t=e.getCanSelect();return r=>{var o;t&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}})},Ye=(e,n,t,r)=>{var o;let i=r.getRow(n);t?(i.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),i.getCanSelect()&&(e[n]=!0)):delete e[n],(o=i.subRows)!=null&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach(l=>Ye(e,l.id,t,r))};function We(e,n){let t=e.getState().rowSelection,r=[],o={},i=function(l,u){return l.map(a=>{var c;let s=et(a,t);if(s&&(r.push(a),o[a.id]=a),(c=a.subRows)!=null&&c.length&&(a={...a,subRows:i(a.subRows)}),s)return a}).filter(Boolean)};return{rows:i(n.rows),flatRows:r,rowsById:o}}function et(e,n){var t;return(t=n[e.id])!=null?t:!1}function un(e,n,t){if(e.subRows&&e.subRows.length){let r=!0,o=!1;return e.subRows.forEach(i=>{o&&!r||(et(i,n)?o=!0:r=!1)}),r?"all":o?"some":!1}return!1}var Qe=/([0-9]+)/gm,ao=(e,n,t)=>vn(J(e.getValue(t)).toLowerCase(),J(n.getValue(t)).toLowerCase()),co=(e,n,t)=>vn(J(e.getValue(t)),J(n.getValue(t))),go=(e,n,t)=>tt(J(e.getValue(t)).toLowerCase(),J(n.getValue(t)).toLowerCase()),fo=(e,n,t)=>tt(J(e.getValue(t)),J(n.getValue(t))),po=(e,n,t)=>{let r=e.getValue(t),o=n.getValue(t);return r>o?1:rtt(e.getValue(t),n.getValue(t));function tt(e,n){return e===n?0:e>n?1:-1}function J(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function vn(e,n){let t=e.split(Qe).filter(Boolean),r=n.split(Qe).filter(Boolean);for(;t.length&&r.length;){let o=t.shift(),i=r.shift(),l=parseInt(o,10),u=parseInt(i,10),a=[l,u].sort();if(isNaN(a[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>u)return 1;if(u>l)return-1}return t.length-r.length}var de={alphanumeric:ao,alphanumericCaseSensitive:co,text:go,textCaseSensitive:fo,datetime:po,basic:_o},mo={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:O("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>({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 de.datetime;if(typeof i=="string"&&(r=!0,i.split(Qe).length>1))return de.alphanumeric}return r?de.text:de.basic},getAutoSortDir:()=>{let t=n.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},getSortingFn:()=>{var t,r;if(!e)throw new Error;return Re(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:de[e.columnDef.sortingFn]},toggleSorting:(t,r)=>{let o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;n.setSorting(l=>{let u=l?.find(d=>d.id===e.id),a=l?.findIndex(d=>d.id===e.id),c=[],s,f=i?t:o==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&r?u?s="toggle":s="add":l!=null&&l.length&&a!==l.length-1?s="replace":u?s="toggle":s="replace",s==="toggle"&&(i||o||(s="remove")),s==="add"){var g;c=[...l,{id:e.id,desc:f}],c.splice(0,c.length-((g=n.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else s==="toggle"?c=l.map(d=>d.id===e.id?{...d,desc:f}:d):s==="remove"?c=l.filter(d=>d.id!==e.id):c=[{id:e.id,desc:f}];return c})},getFirstSortDir:()=>{var t,r;return((t=(r=e.columnDef.sortDescFirst)!=null?r:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:t=>{var r,o;let i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((r=n.options.enableSortingRemoval)==null||r)&&(!(t&&(o=n.options.enableMultiRemove)!=null)||o)?!1:l==="desc"?"asc":"desc":i},getCanSort:()=>{var t,r;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((r=n.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var t,r;return(t=(r=e.columnDef.enableMultiSort)!=null?r:n.options.enableMultiSort)!=null?t:!!e.accessorFn},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},getSortIndex:()=>{var t,r;return(t=(r=n.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},clearSorting:()=>{n.setSorting(t=>t!=null&&t.length?t.filter(r=>r.id!==e.id):[])},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=>({setSorting:n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),resetSorting:n=>{var t,r;e.setSorting(n?[]:(t=(r=e.initialState)==null?void 0:r.sorting)!=null?t:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},ho={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:O("columnVisibility",e)}),createColumn:(e,n)=>({toggleVisibility:t=>{e.getCanHide()&&n.setColumnVisibility(r=>({...r,[e.id]:t??!e.getIsVisible()}))},getIsVisible:()=>{var t,r;return(t=(r=n.getState().columnVisibility)==null?void 0:r[e.id])!=null?t:!0},getCanHide:()=>{var t,r;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((r=n.options.enableHiding)!=null?r:!0)},getToggleVisibilityHandler:()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}}),createRow:(e,n)=>({_getAllVisibleCells:y(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(r=>r.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getVisibleCells:y(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,r,o)=>[...t,...r,...o],{key:!1,debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}})}),createTable:e=>{let n=(t,r)=>y(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),{key:t,debug:()=>{var o;return(o=e.options.debugAll)!=null?o:e.options.debugColumns}});return{getVisibleFlatColumns:n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),resetColumnVisibility:t=>{var r;e.setColumnVisibility(t?{}:(r=e.initialState.columnVisibility)!=null?r:{})},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())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>t=>{var r;e.toggleAllColumnsVisible((r=t.target)==null?void 0:r.checked)}}}},an=[Br,ho,io,so,Kr,mo,ro,qr,lo,uo,Ur];function yn(e){var n;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let t={_features:an},r=t._features.reduce((s,f)=>Object.assign(s,f.getDefaultOptions==null?void 0:f.getDefaultOptions(t)),{}),o=s=>t.options.mergeOptions?t.options.mergeOptions(r,s):{...r,...s},l={...{},...(n=e.initialState)!=null?n:{}};t._features.forEach(s=>{var f;l=(f=s.getInitialState==null?void 0:s.getInitialState(l))!=null?f:l});let u=[],a=!1,c={_features:an,options:{...r,...e},initialState:l,_queue:s=>{u.push(s),a||(a=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();a=!1}).catch(f=>setTimeout(()=>{throw f})))},reset:()=>{t.setState(t.initialState)},setOptions:s=>{let f=X(s,t.options);t.options=o(f)},getState:()=>t.options.state,setState:s=>{t.options.onStateChange==null||t.options.onStateChange(s)},_getRowId:(s,f,g)=>{var d;return(d=t.options.getRowId==null?void 0:t.options.getRowId(s,f,g))!=null?d:`${g?[g.id,f].join("."):f}`},getCoreRowModel:()=>(t._getCoreRowModel||(t._getCoreRowModel=t.options.getCoreRowModel(t)),t._getCoreRowModel()),getRowModel:()=>t.getPaginationRowModel(),getRow:s=>{let f=t.getRowModel().rowsById[s];if(!f)throw new Error;return f},_getDefaultColumnDef:y(()=>[t.options.defaultColumn],s=>{var f;return s=(f=s)!=null?f:{},{header:g=>{let d=g.header.column.columnDef;return d.accessorKey?d.accessorKey:d.accessorFn?d.id:null},cell:g=>{var d,p;return(d=(p=g.renderValue())==null||p.toString==null?void 0:p.toString())!=null?d:null},...t._features.reduce((g,d)=>Object.assign(g,d.getDefaultColumnDef==null?void 0:d.getDefaultColumnDef()),{}),...s}},{debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns},key:!1}),_getColumnDefs:()=>t.options.columns,getAllColumns:y(()=>[t._getColumnDefs()],s=>{let f=function(g,d,p){return p===void 0&&(p=0),g.map(_=>{let m=Gr(t,_,p,d),v=_;return m.columns=v.columns?f(v.columns,m,p+1):[],m})};return f(s)},{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getAllFlatColumns:y(()=>[t.getAllColumns()],s=>s.flatMap(f=>f.getFlatColumns()),{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),_getAllFlatColumnsById:y(()=>[t.getAllFlatColumns()],s=>s.reduce((f,g)=>(f[g.id]=g,f),{}),{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getAllLeafColumns:y(()=>[t.getAllColumns(),t._getOrderColumnsFn()],(s,f)=>{let g=s.flatMap(d=>d.getLeafColumns());return f(g)},{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getColumn:s=>t._getAllFlatColumnsById()[s]};return Object.assign(t,c),t._features.forEach(s=>Object.assign(t,s.createTable==null?void 0:s.createTable(t))),t}function vo(e,n,t,r){let o=()=>{var l;return(l=i.getValue())!=null?l:e.options.renderFallbackValue},i={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(r),renderValue:o,getContext:y(()=>[e,t,n,i],(l,u,a,c)=>({table:l,column:u,row:a,cell:c,getValue:c.getValue,renderValue:c.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{Object.assign(i,l.createCell==null?void 0:l.createCell(i,t,n,e))},{}),i}var nt=(e,n,t,r,o,i,l)=>{let u={id:n,index:r,original:t,depth:o,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(u._valuesCache.hasOwnProperty(a))return u._valuesCache[a];let c=e.getColumn(a);if(c!=null&&c.accessorFn)return u._valuesCache[a]=c.accessorFn(u.original,r),u._valuesCache[a]},getUniqueValues:a=>{if(u._uniqueValuesCache.hasOwnProperty(a))return u._uniqueValuesCache[a];let c=e.getColumn(a);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(u._uniqueValuesCache[a]=c.columnDef.getUniqueValues(u.original,r),u._uniqueValuesCache[a]):(u._uniqueValuesCache[a]=[u.getValue(a)],u._uniqueValuesCache[a])},renderValue:a=>{var c;return(c=u.getValue(a))!=null?c:e.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>zr(u.subRows,a=>a.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId):void 0,getParentRows:()=>{let a=[],c=u;for(;;){let s=c.getParentRow();if(!s)break;a.push(s),c=s}return a.reverse()},getAllCells:y(()=>[e.getAllLeafColumns()],a=>a.map(c=>vo(e,u,c,c.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:y(()=>[u.getAllCells()],a=>a.reduce((c,s)=>(c[s.column.id]=s,c),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}})};for(let a=0;ay(()=>[e.options.data],n=>{let t={rows:[],flatRows:[],rowsById:{}},r=function(o,i,l){i===void 0&&(i=0);let u=[];for(let c=0;c{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Sn(e,n,t){return t.options.filterFromLeafRows?yo(e,n,t):bo(e,n,t)}function yo(e,n,t){var r;let o=[],i={},l=(r=t.options.maxLeafRowFilterDepth)!=null?r:100,u=function(a,c){c===void 0&&(c=0);let s=[];for(let g=0;gy(()=>[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 p=e.getColumn(g.id);if(!p)return;let _=p.getFilterFn();_&&o.push({id:g.id,filterFn:_,resolvedValue:(d=_.resolveFilterValue==null?void 0:_.resolveFilterValue(g.value))!=null?d:g.value})});let l=t.map(g=>g.id),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());r&&u&&a.length&&(l.push("__global__"),a.forEach(g=>{var d;i.push({id:g.id,filterFn:u,resolvedValue:(d=u.resolveFilterValue==null?void 0:u.resolveFilterValue(r))!=null?d:r})}));let c,s;for(let g=0;g{d.columnFiltersMeta[_]=m})}if(i.length){for(let p=0;p{d.columnFiltersMeta[_]=m})){d.columnFilters.__global__=!0;break}}d.columnFilters.__global__!==!0&&(d.columnFilters.__global__=!1)}}let f=g=>{for(let d=0;d{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function wn(){return(e,n)=>y(()=>[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(u=>u.id).filter(u=>u!==n),o?"__global__":void 0].filter(Boolean),l=u=>{for(let a=0;a{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{}})}function Rn(){return(e,n)=>y(()=>{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;i{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{}})}function En(){return(e,n)=>y(()=>{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 l=0;li[1]&&(i[1]=c)}}return i},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{}})}function xn(){return e=>y(()=>[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(a=>{var c;return(c=e.getColumn(a.id))==null?void 0:c.getCanSort()}),l={};i.forEach(a=>{let c=e.getColumn(a.id);c&&(l[a.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});let u=a=>{let c=[...a];return c.sort((s,f)=>{for(let d=0;d{var f;o.push(s),(f=s.subRows)!=null&&f.length&&(s.subRows=u(s.subRows))}),c};return{rows:u(t.rows),flatRows:o,rowsById:t.rowsById}},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function rt(e,n){return e?So(e)?T(e,n):e:null}function So(e){return Co(e)||typeof e=="function"||wo(e)}function Co(e){return typeof e=="function"&&(()=>{let n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function wo(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Fn(e){let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=D(()=>({current:yn(n)})),[r,o]=D(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:l=>{o(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var n=1;n{let d=g;for(let _ of a.split(".")){var p;d=(p=d)==null?void 0:p[_]}return d}:s=g=>g[u.accessorKey]),!c)throw new Error;let f={id:`${String(c)}`,accessorFn:s,parent:r,depth:t,columnDef:u,columns:[],getFlatColumns:y(()=>[!0],()=>{var g;return[f,...(g=f.columns)==null?void 0:g.flatMap(d=>d.getFlatColumns())]},{key:"column.getFlatColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}}),getLeafColumns:y(()=>[e._getOrderColumnsFn()],g=>{var d;if((d=f.columns)!=null&&d.length){let p=f.columns.flatMap(_=>_.getLeafColumns());return g(p)}return[f]},{key:"column.getLeafColumns",debug:()=>{var g;return(g=e.options.debugAll)!=null?g:e.options.debugColumns}})};return f=e._features.reduce((g,d)=>Object.assign(g,d.createColumn==null?void 0:d.createColumn(f,e)),f),f}function on(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 l=[],u=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(u),l.push(a)};return u(i),l},getContext:()=>({table:e,header:i,column:n})};return e._features.forEach(l=>{Object.assign(i,l.createHeader==null?void 0:l.createHeader(i,e))}),i}var zr={createTable:e=>({getHeaderGroups:y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,r,o)=>{var i,l;let u=(i=r?.map(f=>t.find(g=>g.id===f)).filter(Boolean))!=null?i:[],a=(l=o?.map(f=>t.find(g=>g.id===f)).filter(Boolean))!=null?l:[],c=t.filter(f=>!(r!=null&&r.includes(f.id))&&!(o!=null&&o.includes(f.id)));return Se(n,[...u,...c,...a],e)},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterHeaderGroups:y(()=>[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))),Se(n,t,e,"center")),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftHeaderGroups:y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,r)=>{var o;let i=(o=r?.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?o:[];return Se(n,i,e,"left")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightHeaderGroups:y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,r)=>{var o;let i=(o=r?.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?o:[];return Se(n,i,e,"right")},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getFooterGroups:y(()=>[e.getHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftFooterGroups:y(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterFooterGroups:y(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightFooterGroups:y(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getFlatHeaders:y(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftFlatHeaders:y(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterFlatHeaders:y(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightFlatHeaders:y(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getCenterLeafHeaders:y(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeftLeafHeaders:y(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getRightLeafHeaders:y(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var r;return!((r=t.subHeaders)!=null&&r.length)}),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}}),getLeafHeaders:y(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,r)=>{var o,i,l,u,a,c;return[...(o=(i=n[0])==null?void 0:i.headers)!=null?o:[],...(l=(u=t[0])==null?void 0:u.headers)!=null?l:[],...(a=(c=r[0])==null?void 0:c.headers)!=null?a:[]].map(s=>s.getLeafHeaders()).flat()},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugHeaders}})})};function Se(e,n,t,r){var o,i;let l=0,u=function(g,d){d===void 0&&(d=1),l=Math.max(l,d),g.filter(p=>p.getIsVisible()).forEach(p=>{var _;(_=p.columns)!=null&&_.length&&u(p.columns,d+1)},0)};u(e);let a=[],c=(g,d)=>{let p={depth:d,id:[r,`${d}`].filter(Boolean).join("_"),headers:[]},_=[];g.forEach(m=>{let v=[..._].reverse()[0],S=m.column.depth===p.depth,x,C=!1;if(S&&m.column.parent?x=m.column.parent:(x=m.column,C=!0),v&&v?.column===x)v.subHeaders.push(m);else{let V=on(t,x,{id:[r,d,x.id,m?.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${_.filter(N=>N.column===x).length}`:void 0,depth:d,index:_.length});V.subHeaders.push(m),_.push(V)}p.headers.push(m),m.headerGroup=p}),a.push(p),d>0&&c(_,d-1)},s=n.map((g,d)=>on(t,g,{depth:l,index:d}));c(s,l-1),a.reverse();let f=g=>g.filter(p=>p.column.getIsVisible()).map(p=>{let _=0,m=0,v=[0];p.subHeaders&&p.subHeaders.length?(v=[],f(p.subHeaders).forEach(x=>{let{colSpan:C,rowSpan:V}=x;_+=C,v.push(V)})):_=1;let S=Math.min(...v);return m=m+S,p.colSpan=_,p.rowSpan=m,{colSpan:_,rowSpan:m}});return f((o=(i=a[0])==null?void 0:i.headers)!=null?o:[]),a}var Ce={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Be=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Gr={getDefaultColumnDef:()=>Ce,getInitialState:e=>({columnSizing:{},columnSizingInfo:Be(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",onColumnSizingChange:A("columnSizing",e),onColumnSizingInfoChange:A("columnSizingInfo",e)}),createColumn:(e,n)=>({getSize:()=>{var t,r,o;let i=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Ce.minSize,(r=i??e.columnDef.size)!=null?r:Ce.size),(o=e.columnDef.maxSize)!=null?o:Ce.maxSize)},getStart:t=>{let r=t?t==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns(),o=r.findIndex(i=>i.id===e.id);if(o>0){let i=r[o-1];return i.getStart(t)+i.getSize()}return 0},resetSize:()=>{n.setColumnSizing(t=>{let{[e.id]:r,...o}=t;return o})},getCanResize:()=>{var t,r;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((r=n.options.enableColumnResizing)!=null?r:!0)},getIsResizing:()=>n.getState().columnSizingInfo.isResizingColumn===e.id}),createHeader:(e,n)=>({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},getStart:()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},getResizeHandler:()=>{let t=n.getColumn(e.column.id),r=t?.getCanResize();return o=>{if(!t||!r||(o.persist==null||o.persist(),Ue(o)&&o.touches&&o.touches.length>1))return;let i=e.getSize(),l=e?e.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[t.id,t.getSize()]],u=Ue(o)?Math.round(o.touches[0].clientX):o.clientX,a={},c=(_,m)=>{typeof m=="number"&&(n.setColumnSizingInfo(v=>{var S,x;let C=m-((S=v?.startOffset)!=null?S:0),V=Math.max(C/((x=v?.startSize)!=null?x:0),-.999999);return v.columnSizingStart.forEach(N=>{let[J,F]=N;a[J]=Math.round(Math.max(F+F*V,0)*100)/100}),{...v,deltaOffset:C,deltaPercentage:V}}),(n.options.columnResizeMode==="onChange"||_==="end")&&n.setColumnSizing(v=>({...v,...a})))},s=_=>c("move",_),f=_=>{c("end",_),n.setColumnSizingInfo(m=>({...m,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g={moveHandler:_=>s(_.clientX),upHandler:_=>{document.removeEventListener("mousemove",g.moveHandler),document.removeEventListener("mouseup",g.upHandler),f(_.clientX)}},d={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),s(_.touches[0].clientX),!1),upHandler:_=>{var m;document.removeEventListener("touchmove",d.moveHandler),document.removeEventListener("touchend",d.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),f((m=_.touches[0])==null?void 0:m.clientX)}},p=Br()?{passive:!1}:!1;Ue(o)?(document.addEventListener("touchmove",d.moveHandler,p),document.addEventListener("touchend",d.upHandler,p)):(document.addEventListener("mousemove",g.moveHandler,p),document.addEventListener("mouseup",g.upHandler,p)),n.setColumnSizingInfo(_=>({..._,startOffset:u,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:t.id}))}}}),createTable:e=>({setColumnSizing:n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),setColumnSizingInfo:n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),resetColumnSizing:n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},resetHeaderSizeInfo:n=>{var t;e.setColumnSizingInfo(n?Be():(t=e.initialState.columnSizingInfo)!=null?t:Be())},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},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},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},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}})},we=null;function Br(){if(typeof we=="boolean")return we;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 we=e,we}function Ue(e){return e.type==="touchstart"}var Ur={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:A("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;return{_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})}},setExpanded:r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),toggleAllRowsExpanded:r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},resetExpanded:r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},getCanSomeRowsExpand:()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),getToggleAllRowsExpandedHandler:()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},getIsSomeRowsExpanded:()=>{let r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},getIsAllRowsExpanded:()=>{let r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},getExpandedDepth:()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{let l=i.split(".");r=Math.max(r,l.length)}),r},getPreExpandedRowModel:()=>e.getSortedRowModel(),getExpandedRowModel:()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())}},createRow:(e,n)=>({toggleExpanded:t=>{n.setExpanded(r=>{var o;let i=r===!0?!0:!!(r!=null&&r[e.id]),l={};if(r===!0?Object.keys(n.getRowModel().rowsById).forEach(u=>{l[u]=!0}):l=r,t=(o=t)!=null?o:!i,!i&&t)return{...l,[e.id]:!0};if(i&&!t){let{[e.id]:u,...a}=l;return a}return r})},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])},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)},getToggleExpandedHandler:()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}})},an=(e,n,t)=>{var r,o,i;let l=t.toLowerCase();return!!(!((r=e.getValue(n))==null||(o=r.toString())==null||(i=o.toLowerCase())==null)&&i.includes(l))};an.autoRemove=e=>k(e);var dn=(e,n,t)=>{var r,o;return!!(!((r=e.getValue(n))==null||(o=r.toString())==null)&&o.includes(t))};dn.autoRemove=e=>k(e);var cn=(e,n,t)=>{var r,o;return((r=e.getValue(n))==null||(o=r.toString())==null?void 0:o.toLowerCase())===t?.toLowerCase()};cn.autoRemove=e=>k(e);var gn=(e,n,t)=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(t)};gn.autoRemove=e=>k(e)||!(e!=null&&e.length);var fn=(e,n,t)=>!t.some(r=>{var o;return!((o=e.getValue(n))!=null&&o.includes(r))});fn.autoRemove=e=>k(e)||!(e!=null&&e.length);var pn=(e,n,t)=>t.some(r=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(r)});pn.autoRemove=e=>k(e)||!(e!=null&&e.length);var _n=(e,n,t)=>e.getValue(n)===t;_n.autoRemove=e=>k(e);var mn=(e,n,t)=>e.getValue(n)==t;mn.autoRemove=e=>k(e);var Ze=(e,n,t)=>{let[r,o]=t,i=e.getValue(n);return i>=r&&i<=o};Ze.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,l=t===null||Number.isNaN(o)?1/0:o;if(i>l){let u=i;i=l,l=u}return[i,l]};Ze.autoRemove=e=>k(e)||k(e[0])&&k(e[1]);var j={includesString:an,includesStringSensitive:dn,equalsString:cn,arrIncludes:gn,arrIncludesAll:fn,arrIncludesSome:pn,equals:_n,weakEquals:mn,inNumberRange:Ze};function k(e){return e==null||e===""}var jr={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:A("columnFilters",e),onGlobalFilterChange:A("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t,r;let o=(t=e.getCoreRowModel().flatRows[0])==null||(r=t._getAllCellsByColumnId()[n.id])==null?void 0:r.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,n)=>({getAutoFilterFn:()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);return typeof r=="string"?j.includesString:typeof r=="number"?j.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?j.equals:Array.isArray(r)?j.arrIncludes:j.weakEquals},getFilterFn:()=>{var t,r;return Re(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:j[e.columnDef.filterFn]},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},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},getIsFiltered:()=>e.getFilterIndex()>-1,getFilterValue:()=>{var t,r;return(t=n.getState().columnFilters)==null||(r=t.find(o=>o.id===e.id))==null?void 0:r.value},getFilterIndex:()=>{var t,r;return(t=(r=n.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},setFilterValue:t=>{n.setColumnFilters(r=>{let o=e.getFilterFn(),i=r?.find(s=>s.id===e.id),l=W(t,i?i.value:void 0);if(ln(o,l,e)){var u;return(u=r?.filter(s=>s.id!==e.id))!=null?u:[]}let a={id:e.id,value:l};if(i){var c;return(c=r?.map(s=>s.id===e.id?a:s))!=null?c:[]}return r!=null&&r.length?[...r,a]:[a]})},_getFacetedRowModel:n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),getFacetedRowModel:()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),_getFacetedUniqueValues:n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),getFacetedUniqueValues:()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,_getFacetedMinMaxValues:n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),getFacetedMinMaxValues:()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}),createRow:(e,n)=>({columnFilters:{},columnFiltersMeta:{}}),createTable:e=>({getGlobalAutoFilterFn:()=>j.includesString,getGlobalFilterFn:()=>{var n,t;let{globalFilterFn:r}=e.options;return Re(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[r])!=null?n:j[r]},setColumnFilters:n=>{let t=e.getAllLeafColumns(),r=o=>{var i;return(i=W(n,o))==null?void 0:i.filter(l=>{let u=t.find(a=>a.id===l.id);if(u){let a=u.getFilterFn();if(ln(a,l.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},setGlobalFilter:n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},resetGlobalFilter:n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)},resetColumnFilters:n=>{var t,r;e.setColumnFilters(n?[]:(t=(r=e.initialState)==null?void 0:r.columnFilters)!=null?t:[])},getPreFilteredRowModel:()=>e.getCoreRowModel(),getFilteredRowModel:()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),_getGlobalFacetedRowModel:e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),getGlobalFacetedRowModel:()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),_getGlobalFacetedUniqueValues:e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),getGlobalFacetedUniqueValues:()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,_getGlobalFacetedMinMaxValues:e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),getGlobalFacetedMinMaxValues:()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}})};function ln(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}var qr=(e,n,t)=>t.reduce((r,o)=>{let i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),Kr=(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},Wr=(e,n,t)=>{let r;return t.forEach(o=>{let i=o.getValue(e);i!=null&&(r=i)&&(r=i)}),r},Xr=(e,n,t)=>{let r,o;return t.forEach(i=>{let l=i.getValue(e);l!=null&&(r===void 0?l>=l&&(r=o=l):(r>l&&(r=l),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},Yr=(e,n)=>{if(!n.length)return;let t=n.map(i=>i.getValue(e));if(!Hr(t))return;if(t.length===1)return t[0];let r=Math.floor(t.length/2),o=t.sort((i,l)=>i-l);return t.length%2!==0?o[r]:(o[r-1]+o[r])/2},Qr=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),Zr=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,eo=(e,n)=>n.length,je={sum:qr,min:Kr,max:Wr,extent:Xr,mean:Jr,median:Yr,unique:Qr,uniqueCount:Zr,count:eo},to={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:A("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>({toggleGrouping:()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(r=>r!==e.id):[...t??[],e.id])},getCanGroup:()=>{var t,r,o,i;return(t=(r=(o=(i=e.columnDef.enableGrouping)!=null?i:!0)!=null?o:n.options.enableGrouping)!=null?r:!0)!=null?t:!!e.accessorFn},getIsGrouped:()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},getGroupedIndex:()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},getToggleGroupingHandler:()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},getAutoAggregationFn:()=>{let t=n.getCoreRowModel().flatRows[0],r=t?.getValue(e.id);if(typeof r=="number")return je.sum;if(Object.prototype.toString.call(r)==="[object Date]")return je.extent},getAggregationFn:()=>{var t,r;if(!e)throw new Error;return Re(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:je[e.columnDef.aggregationFn]}}),createTable:e=>({setGrouping:n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),resetGrouping:n=>{var t,r;e.setGrouping(n?[]:(t=(r=e.initialState)==null?void 0:r.grouping)!=null?t:[])},getPreGroupedRowModel:()=>e.getFilteredRowModel(),getGroupedRowModel:()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())}),createRow:(e,n)=>({getIsGrouped:()=>!!e.groupingColumnId,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)},_groupingValuesCache:{}}),createCell:(e,n,t,r)=>({getIsGrouped:()=>n.getIsGrouped()&&n.id===t.groupingColumnId,getIsPlaceholder:()=>!e.getIsGrouped()&&n.getIsGrouped(),getIsAggregated:()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}})};function no(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(l=>l.id===i)).filter(Boolean),...r]}var ro={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:A("columnOrder",e)}),createTable:e=>({setColumnOrder:n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),resetColumnOrder:n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},_getOrderColumnsFn:y(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,r)=>o=>{let i=[];if(!(n!=null&&n.length))i=o;else{let l=[...n],u=[...o];for(;u.length&&l.length;){let a=l.shift(),c=u.findIndex(s=>s.id===a);c>-1&&i.push(u.splice(c,1)[0])}i=[...i,...u]}return no(i,t,r)},{key:!1})})},Xe=0,Je=10,qe=()=>({pageIndex:Xe,pageSize:Je}),oo={getInitialState:e=>({...e,pagination:{...qe(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:A("pagination",e)}),createTable:e=>{let n=!1,t=!1;return{_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})}},setPagination:r=>{let o=i=>W(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},resetPagination:r=>{var o;e.setPagination(r?qe():(o=e.initialState.pagination)!=null?o:qe())},setPageIndex:r=>{e.setPagination(o=>{let i=W(r,o.pageIndex),l=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,l)),{...o,pageIndex:i}})},resetPageIndex:r=>{var o,i,l;e.setPageIndex(r?Xe:(o=(i=e.initialState)==null||(l=i.pagination)==null?void 0:l.pageIndex)!=null?o:Xe)},resetPageSize:r=>{var o,i,l;e.setPageSize(r?Je:(o=(i=e.initialState)==null||(l=i.pagination)==null?void 0:l.pageSize)!=null?o:Je)},setPageSize:r=>{e.setPagination(o=>{let i=Math.max(1,W(r,o.pageSize)),l=o.pageSize*o.pageIndex,u=Math.floor(l/i);return{...o,pageIndex:u,pageSize:i}})},setPageCount:r=>e.setPagination(o=>{var i;let l=W(r,(i=e.options.pageCount)!=null?i:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...o,pageCount:l}}),getPageOptions:y(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,l)=>l)),o},{key:!1,debug:()=>{var r;return(r=e.options.debugAll)!=null?r:e.options.debugTable}}),getCanPreviousPage:()=>e.getState().pagination.pageIndex>0,getCanNextPage:()=>{let{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),nextPage:()=>e.setPageIndex(r=>r+1),getPrePaginationRowModel:()=>e.getExpandedRowModel(),getPaginationRowModel:()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),getPageCount:()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getPrePaginationRowModel().rows.length/e.getState().pagination.pageSize)}}}},Ke=()=>({left:[],right:[]}),io={getInitialState:e=>({columnPinning:Ke(),...e}),getDefaultOptions:e=>({onColumnPinningChange:A("columnPinning",e)}),createColumn:(e,n)=>({pin:t=>{let r=e.getLeafColumns().map(o=>o.id).filter(Boolean);n.setColumnPinning(o=>{var i,l;if(t==="right"){var u,a;return{left:((u=o?.left)!=null?u:[]).filter(f=>!(r!=null&&r.includes(f))),right:[...((a=o?.right)!=null?a:[]).filter(f=>!(r!=null&&r.includes(f))),...r]}}if(t==="left"){var c,s;return{left:[...((c=o?.left)!=null?c:[]).filter(f=>!(r!=null&&r.includes(f))),...r],right:((s=o?.right)!=null?s:[]).filter(f=>!(r!=null&&r.includes(f)))}}return{left:((i=o?.left)!=null?i:[]).filter(f=>!(r!=null&&r.includes(f))),right:((l=o?.right)!=null?l:[]).filter(f=>!(r!=null&&r.includes(f)))}})},getCanPin:()=>e.getLeafColumns().some(r=>{var o,i;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=n.options.enablePinning)!=null?i:!0)}),getIsPinned:()=>{let t=e.getLeafColumns().map(u=>u.id),{left:r,right:o}=n.getState().columnPinning,i=t.some(u=>r?.includes(u)),l=t.some(u=>o?.includes(u));return i?"left":l?"right":!1},getPinnedIndex:()=>{var t,r,o;let i=e.getIsPinned();return i?(t=(r=n.getState().columnPinning)==null||(o=r[i])==null?void 0:o.indexOf(e.id))!=null?t:-1:0}}),createRow:(e,n)=>({getCenterVisibleCells:y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,r,o)=>{let i=[...r??[],...o??[]];return t.filter(l=>!i.includes(l.column.id))},{key:"row.getCenterVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getLeftVisibleCells:y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,,],(t,r)=>(r??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),{key:"row.getLeftVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getRightVisibleCells:y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,r)=>(r??[]).map(i=>t.find(l=>l.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),{key:"row.getRightVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}})}),createTable:e=>({setColumnPinning:n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),resetColumnPinning:n=>{var t,r;return e.setColumnPinning(n?Ke():(t=(r=e.initialState)==null?void 0:r.columnPinning)!=null?t:Ke())},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)},getLeftLeafColumns:y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),getRightLeafColumns:y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(r=>n.find(o=>o.id===r)).filter(Boolean),{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}}),getCenterLeafColumns:y(()=>[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))},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugColumns}})})},lo={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:A("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>({setRowSelection:n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),resetRowSelection:n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},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})},toggleAllPageRowsSelected:n=>e.setRowSelection(t=>{let r=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{Ye(o,i.id,r,e)}),o}),getPreSelectedRowModel:()=>e.getCoreRowModel(),getSelectedRowModel:y(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),getFilteredSelectedRowModel:y(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getFilteredSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),getGroupedSelectedRowModel:y(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?We(e,t):{rows:[],flatRows:[],rowsById:{}},{key:"getGroupedSelectedRowModel",debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable}}),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},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},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())},getToggleAllRowsSelectedHandler:()=>n=>{e.toggleAllRowsSelected(n.target.checked)},getToggleAllPageRowsSelectedHandler:()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}}),createRow:(e,n)=>({toggleSelected:t=>{let r=e.getIsSelected();n.setRowSelection(o=>{if(t=typeof t<"u"?t:!r,r===t)return o;let i={...o};return Ye(i,e.id,t,n),i})},getIsSelected:()=>{let{rowSelection:t}=n.getState();return et(e,t)},getIsSomeSelected:()=>{let{rowSelection:t}=n.getState();return sn(e,t)==="some"},getIsAllSubRowsSelected:()=>{let{rowSelection:t}=n.getState();return sn(e,t)==="all"},getCanSelect:()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},getCanSelectSubRows:()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},getCanMultiSelect:()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},getToggleSelectedHandler:()=>{let t=e.getCanSelect();return r=>{var o;t&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}})},Ye=(e,n,t,r)=>{var o;let i=r.getRow(n);t?(i.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),i.getCanSelect()&&(e[n]=!0)):delete e[n],(o=i.subRows)!=null&&o.length&&i.getCanSelectSubRows()&&i.subRows.forEach(l=>Ye(e,l.id,t,r))};function We(e,n){let t=e.getState().rowSelection,r=[],o={},i=function(l,u){return l.map(a=>{var c;let s=et(a,t);if(s&&(r.push(a),o[a.id]=a),(c=a.subRows)!=null&&c.length&&(a={...a,subRows:i(a.subRows)}),s)return a}).filter(Boolean)};return{rows:i(n.rows),flatRows:r,rowsById:o}}function et(e,n){var t;return(t=n[e.id])!=null?t:!1}function sn(e,n,t){if(e.subRows&&e.subRows.length){let r=!0,o=!1;return e.subRows.forEach(i=>{o&&!r||(et(i,n)?o=!0:r=!1)}),r?"all":o?"some":!1}return!1}var Qe=/([0-9]+)/gm,so=(e,n,t)=>hn(X(e.getValue(t)).toLowerCase(),X(n.getValue(t)).toLowerCase()),uo=(e,n,t)=>hn(X(e.getValue(t)),X(n.getValue(t))),ao=(e,n,t)=>tt(X(e.getValue(t)).toLowerCase(),X(n.getValue(t)).toLowerCase()),co=(e,n,t)=>tt(X(e.getValue(t)),X(n.getValue(t))),go=(e,n,t)=>{let r=e.getValue(t),o=n.getValue(t);return r>o?1:rtt(e.getValue(t),n.getValue(t));function tt(e,n){return e===n?0:e>n?1:-1}function X(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function hn(e,n){let t=e.split(Qe).filter(Boolean),r=n.split(Qe).filter(Boolean);for(;t.length&&r.length;){let o=t.shift(),i=r.shift(),l=parseInt(o,10),u=parseInt(i,10),a=[l,u].sort();if(isNaN(a[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(a[1]))return isNaN(l)?-1:1;if(l>u)return 1;if(u>l)return-1}return t.length-r.length}var de={alphanumeric:so,alphanumericCaseSensitive:uo,text:ao,textCaseSensitive:co,datetime:go,basic:fo},po={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:A("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>({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 de.datetime;if(typeof i=="string"&&(r=!0,i.split(Qe).length>1))return de.alphanumeric}return r?de.text:de.basic},getAutoSortDir:()=>{let t=n.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},getSortingFn:()=>{var t,r;if(!e)throw new Error;return Re(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:de[e.columnDef.sortingFn]},toggleSorting:(t,r)=>{let o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;n.setSorting(l=>{let u=l?.find(d=>d.id===e.id),a=l?.findIndex(d=>d.id===e.id),c=[],s,f=i?t:o==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&r?u?s="toggle":s="add":l!=null&&l.length&&a!==l.length-1?s="replace":u?s="toggle":s="replace",s==="toggle"&&(i||o||(s="remove")),s==="add"){var g;c=[...l,{id:e.id,desc:f}],c.splice(0,c.length-((g=n.options.maxMultiSortColCount)!=null?g:Number.MAX_SAFE_INTEGER))}else s==="toggle"?c=l.map(d=>d.id===e.id?{...d,desc:f}:d):s==="remove"?c=l.filter(d=>d.id!==e.id):c=[{id:e.id,desc:f}];return c})},getFirstSortDir:()=>{var t,r;return((t=(r=e.columnDef.sortDescFirst)!=null?r:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},getNextSortingOrder:t=>{var r,o;let i=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==i&&((r=n.options.enableSortingRemoval)==null||r)&&(!(t&&(o=n.options.enableMultiRemove)!=null)||o)?!1:l==="desc"?"asc":"desc":i},getCanSort:()=>{var t,r;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((r=n.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},getCanMultiSort:()=>{var t,r;return(t=(r=e.columnDef.enableMultiSort)!=null?r:n.options.enableMultiSort)!=null?t:!!e.accessorFn},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},getSortIndex:()=>{var t,r;return(t=(r=n.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?t:-1},clearSorting:()=>{n.setSorting(t=>t!=null&&t.length?t.filter(r=>r.id!==e.id):[])},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=>({setSorting:n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),resetSorting:n=>{var t,r;e.setSorting(n?[]:(t=(r=e.initialState)==null?void 0:r.sorting)!=null?t:[])},getPreSortedRowModel:()=>e.getGroupedRowModel(),getSortedRowModel:()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())})},_o={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:A("columnVisibility",e)}),createColumn:(e,n)=>({toggleVisibility:t=>{e.getCanHide()&&n.setColumnVisibility(r=>({...r,[e.id]:t??!e.getIsVisible()}))},getIsVisible:()=>{var t,r;return(t=(r=n.getState().columnVisibility)==null?void 0:r[e.id])!=null?t:!0},getCanHide:()=>{var t,r;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((r=n.options.enableHiding)!=null?r:!0)},getToggleVisibilityHandler:()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}}),createRow:(e,n)=>({_getAllVisibleCells:y(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(r=>r.column.getIsVisible()),{key:"row._getAllVisibleCells",debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}}),getVisibleCells:y(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,r,o)=>[...t,...r,...o],{key:!1,debug:()=>{var t;return(t=n.options.debugAll)!=null?t:n.options.debugRows}})}),createTable:e=>{let n=(t,r)=>y(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),{key:t,debug:()=>{var o;return(o=e.options.debugAll)!=null?o:e.options.debugColumns}});return{getVisibleFlatColumns:n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),getVisibleLeafColumns:n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),getLeftVisibleLeafColumns:n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),getRightVisibleLeafColumns:n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),getCenterVisibleLeafColumns:n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),setColumnVisibility:t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),resetColumnVisibility:t=>{var r;e.setColumnVisibility(t?{}:(r=e.initialState.columnVisibility)!=null?r:{})},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())}),{}))},getIsAllColumnsVisible:()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),getIsSomeColumnsVisible:()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),getToggleAllColumnsVisibilityHandler:()=>t=>{var r;e.toggleAllColumnsVisible((r=t.target)==null?void 0:r.checked)}}}},un=[zr,_o,ro,io,jr,po,to,Ur,oo,lo,Gr];function vn(e){var n;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let t={_features:un},r=t._features.reduce((s,f)=>Object.assign(s,f.getDefaultOptions==null?void 0:f.getDefaultOptions(t)),{}),o=s=>t.options.mergeOptions?t.options.mergeOptions(r,s):{...r,...s},l={...{},...(n=e.initialState)!=null?n:{}};t._features.forEach(s=>{var f;l=(f=s.getInitialState==null?void 0:s.getInitialState(l))!=null?f:l});let u=[],a=!1,c={_features:un,options:{...r,...e},initialState:l,_queue:s=>{u.push(s),a||(a=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();a=!1}).catch(f=>setTimeout(()=>{throw f})))},reset:()=>{t.setState(t.initialState)},setOptions:s=>{let f=W(s,t.options);t.options=o(f)},getState:()=>t.options.state,setState:s=>{t.options.onStateChange==null||t.options.onStateChange(s)},_getRowId:(s,f,g)=>{var d;return(d=t.options.getRowId==null?void 0:t.options.getRowId(s,f,g))!=null?d:`${g?[g.id,f].join("."):f}`},getCoreRowModel:()=>(t._getCoreRowModel||(t._getCoreRowModel=t.options.getCoreRowModel(t)),t._getCoreRowModel()),getRowModel:()=>t.getPaginationRowModel(),getRow:s=>{let f=t.getRowModel().rowsById[s];if(!f)throw new Error;return f},_getDefaultColumnDef:y(()=>[t.options.defaultColumn],s=>{var f;return s=(f=s)!=null?f:{},{header:g=>{let d=g.header.column.columnDef;return d.accessorKey?d.accessorKey:d.accessorFn?d.id:null},cell:g=>{var d,p;return(d=(p=g.renderValue())==null||p.toString==null?void 0:p.toString())!=null?d:null},...t._features.reduce((g,d)=>Object.assign(g,d.getDefaultColumnDef==null?void 0:d.getDefaultColumnDef()),{}),...s}},{debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns},key:!1}),_getColumnDefs:()=>t.options.columns,getAllColumns:y(()=>[t._getColumnDefs()],s=>{let f=function(g,d,p){return p===void 0&&(p=0),g.map(_=>{let m=Lr(t,_,p,d),v=_;return m.columns=v.columns?f(v.columns,m,p+1):[],m})};return f(s)},{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getAllFlatColumns:y(()=>[t.getAllColumns()],s=>s.flatMap(f=>f.getFlatColumns()),{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),_getAllFlatColumnsById:y(()=>[t.getAllFlatColumns()],s=>s.reduce((f,g)=>(f[g.id]=g,f),{}),{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getAllLeafColumns:y(()=>[t.getAllColumns(),t._getOrderColumnsFn()],(s,f)=>{let g=s.flatMap(d=>d.getLeafColumns());return f(g)},{key:!1,debug:()=>{var s;return(s=t.options.debugAll)!=null?s:t.options.debugColumns}}),getColumn:s=>t._getAllFlatColumnsById()[s]};return Object.assign(t,c),t._features.forEach(s=>Object.assign(t,s.createTable==null?void 0:s.createTable(t))),t}function mo(e,n,t,r){let o=()=>{var l;return(l=i.getValue())!=null?l:e.options.renderFallbackValue},i={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(r),renderValue:o,getContext:y(()=>[e,t,n,i],(l,u,a,c)=>({table:l,column:u,row:a,cell:c,getValue:c.getValue,renderValue:c.renderValue}),{key:!1,debug:()=>e.options.debugAll})};return e._features.forEach(l=>{Object.assign(i,l.createCell==null?void 0:l.createCell(i,t,n,e))},{}),i}var nt=(e,n,t,r,o,i,l)=>{let u={id:n,index:r,original:t,depth:o,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(u._valuesCache.hasOwnProperty(a))return u._valuesCache[a];let c=e.getColumn(a);if(c!=null&&c.accessorFn)return u._valuesCache[a]=c.accessorFn(u.original,r),u._valuesCache[a]},getUniqueValues:a=>{if(u._uniqueValuesCache.hasOwnProperty(a))return u._uniqueValuesCache[a];let c=e.getColumn(a);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(u._uniqueValuesCache[a]=c.columnDef.getUniqueValues(u.original,r),u._uniqueValuesCache[a]):(u._uniqueValuesCache[a]=[u.getValue(a)],u._uniqueValuesCache[a])},renderValue:a=>{var c;return(c=u.getValue(a))!=null?c:e.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>Pr(u.subRows,a=>a.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId):void 0,getParentRows:()=>{let a=[],c=u;for(;;){let s=c.getParentRow();if(!s)break;a.push(s),c=s}return a.reverse()},getAllCells:y(()=>[e.getAllLeafColumns()],a=>a.map(c=>mo(e,u,c,c.id)),{key:!1,debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}}),_getAllCellsByColumnId:y(()=>[u.getAllCells()],a=>a.reduce((c,s)=>(c[s.column.id]=s,c),{}),{key:"row.getAllCellsByColumnId",debug:()=>{var a;return(a=e.options.debugAll)!=null?a:e.options.debugRows}})};for(let a=0;ay(()=>[e.options.data],n=>{let t={rows:[],flatRows:[],rowsById:{}},r=function(o,i,l){i===void 0&&(i=0);let u=[];for(let c=0;c{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function bn(e,n,t){return t.options.filterFromLeafRows?ho(e,n,t):vo(e,n,t)}function ho(e,n,t){var r;let o=[],i={},l=(r=t.options.maxLeafRowFilterDepth)!=null?r:100,u=function(a,c){c===void 0&&(c=0);let s=[];for(let g=0;gy(()=>[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 p=e.getColumn(g.id);if(!p)return;let _=p.getFilterFn();_&&o.push({id:g.id,filterFn:_,resolvedValue:(d=_.resolveFilterValue==null?void 0:_.resolveFilterValue(g.value))!=null?d:g.value})});let l=t.map(g=>g.id),u=e.getGlobalFilterFn(),a=e.getAllLeafColumns().filter(g=>g.getCanGlobalFilter());r&&u&&a.length&&(l.push("__global__"),a.forEach(g=>{var d;i.push({id:g.id,filterFn:u,resolvedValue:(d=u.resolveFilterValue==null?void 0:u.resolveFilterValue(r))!=null?d:r})}));let c,s;for(let g=0;g{d.columnFiltersMeta[_]=m})}if(i.length){for(let p=0;p{d.columnFiltersMeta[_]=m})){d.columnFilters.__global__=!0;break}}d.columnFilters.__global__!==!0&&(d.columnFilters.__global__=!1)}}let f=g=>{for(let d=0;d{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function Cn(){return(e,n)=>y(()=>[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(u=>u.id).filter(u=>u!==n),o?"__global__":void 0].filter(Boolean),l=u=>{for(let a=0;a{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{}})}function wn(){return(e,n)=>y(()=>{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;i{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{}})}function Rn(){return(e,n)=>y(()=>{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 l=0;li[1]&&(i[1]=c)}}return i},{key:!1,debug:()=>{var t;return(t=e.options.debugAll)!=null?t:e.options.debugTable},onChange:()=>{}})}function En(){return e=>y(()=>[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(a=>{var c;return(c=e.getColumn(a.id))==null?void 0:c.getCanSort()}),l={};i.forEach(a=>{let c=e.getColumn(a.id);c&&(l[a.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});let u=a=>{let c=[...a];return c.sort((s,f)=>{for(let d=0;d{var f;o.push(s),(f=s.subRows)!=null&&f.length&&(s.subRows=u(s.subRows))}),c};return{rows:u(t.rows),flatRows:o,rowsById:t.rowsById}},{key:!1,debug:()=>{var n;return(n=e.options.debugAll)!=null?n:e.options.debugTable},onChange:()=>{e._autoResetPageIndex()}})}function rt(e,n){return e?yo(e)?D(e,n):e:null}function yo(e){return bo(e)||typeof e=="function"||So(e)}function bo(e){return typeof e=="function"&&(()=>{let n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function So(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function xn(e){let n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=I(()=>({current:vn(n)})),[r,o]=I(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:l=>{o(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var n=1;n"u"&&delete r[i]}),t.options=ge({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ro,rangeExtractor:Eo,onChange:function(){},measureElement:xo,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},r)},this.notify=function(){t.options.onChange==null||t.options.onChange(t)},this.cleanup=function(){t.unsubs.filter(Boolean).forEach(function(r){return r()}),t.unsubs=[],t.scrollElement=null},this._didMount=function(){return t.measureElementCache.forEach(t.observer.observe),function(){t.observer.disconnect(),t.cleanup()}},this._willUpdate=function(){var r=t.options.getScrollElement();t.scrollElement!==r&&(t.cleanup(),t.scrollElement=r,t._scrollToOffset(t.scrollOffset,{adjustments:void 0,behavior:void 0}),t.unsubs.push(t.options.observeElementRect(t,function(o){var i=t.scrollRect;t.scrollRect=o,(t.options.horizontal?o.width!==i.width:o.height!==i.height)&&t.maybeNotify()})),t.unsubs.push(t.options.observeElementOffset(t,function(o){t.scrollAdjustments=0,t.scrollOffset!==o&&(t.isScrollingTimeoutId!==null&&(clearTimeout(t.isScrollingTimeoutId),t.isScrollingTimeoutId=null),t.isScrolling=!0,t.scrollDirection=t.scrollOffset=0;u--){var a=r[u];if(!i.has(a.lane)){var c=l.get(a.lane);if(c==null||a.end>c.end?l.set(a.lane,a):a.end0?Math.min.apply(Math,t.pendingMeasuredCacheIndexes):0;t.pendingMeasuredCacheIndexes=[];for(var s=t.measurementsCache.slice(0,c),f=c;f=t.scrollOffset+i?o="end":o="start"),o==="start"?r=r:o==="end"?r=r-i:o==="center"&&(r=r-i/2);var l=t.options.horizontal?"scrollWidth":"scrollHeight",u=t.scrollElement?"document"in t.scrollElement?t.scrollElement.document.documentElement[l]:t.scrollElement[l]:0,a=u-t.getSize();return Math.max(Math.min(a,r),0)},this.getOffsetForIndex=function(r,o){o===void 0&&(o="auto"),r=Math.max(0,Math.min(r,t.options.count-1));var i=Ee(t.getMeasurements()[r]);if(o==="auto")if(i.end>=t.scrollOffset+t.getSize()-t.options.scrollPaddingEnd)o="end";else if(i.start<=t.scrollOffset+t.options.scrollPaddingStart)o="start";else return[t.scrollOffset,o];var l=o==="end"?i.end+t.options.scrollPaddingEnd:i.start-t.options.scrollPaddingStart;return[t.getOffsetForAlignment(l,o),o]},this.isDynamicMode=function(){return t.measureElementCache.size>0},this.cancelScrollToIndex=function(){t.scrollToIndexTimeoutId!==null&&(clearTimeout(t.scrollToIndexTimeoutId),t.scrollToIndexTimeoutId=null)},this.scrollToOffset=function(r,o){var i=o===void 0?{}:o,l=i.align,u=l===void 0?"start":l,a=i.behavior;t.cancelScrollToIndex(),a==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t._scrollToOffset(t.getOffsetForAlignment(r,u),{adjustments:void 0,behavior:a})},this.scrollToIndex=function(r,o){var i=o===void 0?{}:o,l=i.align,u=l===void 0?"auto":l,a=i.behavior;r=Math.max(0,Math.min(r,t.options.count-1)),t.cancelScrollToIndex(),a==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var c=t.getOffsetForIndex(r,u),s=c[0],f=c[1];t._scrollToOffset(s,{adjustments:void 0,behavior:a}),a!=="smooth"&&t.isDynamicMode()&&(t.scrollToIndexTimeoutId=setTimeout(function(){t.scrollToIndexTimeoutId=null;var g=t.measureElementCache.has(t.options.getItemKey(r));if(g){var d=t.getOffsetForIndex(r,f),p=d[0];$n(p,t.scrollOffset)||t.scrollToIndex(r,{align:f,behavior:a})}else t.scrollToIndex(r,{align:f,behavior:a})}))},this.scrollBy=function(r,o){var i=o===void 0?{}:o,l=i.behavior;t.cancelScrollToIndex(),l==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t._scrollToOffset(t.scrollOffset+r,{adjustments:void 0,behavior:l})},this.getTotalSize=function(){var r;return(((r=t.getMeasurements()[t.options.count-1])==null?void 0:r.end)||t.options.paddingStart)-t.options.scrollMargin+t.options.paddingEnd},this._scrollToOffset=function(r,o){var i=o.adjustments,l=o.behavior;t.options.scrollToFn(r,{behavior:l,adjustments:i},t)},this.measure=function(){t.itemSizeCache=new Map,t.notify()},this.setOptions(n),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(r){t.itemSizeCache.set(r.key,r.size)}),this.maybeNotify()},Tn=function(n,t,r,o){for(;n<=t;){var i=(n+t)/2|0,l=r(i);if(lo)t=i-1;else return i}return n>0?n-1:0};function Fo(e){for(var n=e.measurements,t=e.outerSize,r=e.scrollOffset,o=n.length-1,i=function(c){return n[c].start},l=Tn(0,o,i,r),u=l;u=i&&f<=u&&g>=l&&g<=a)return s}return null}function ot(e,n){return document?.defaultView?.getComputedStyle(e,null)?.getPropertyValue(n)}var Pn=e=>{let[n,t]=D(!1),{range:r,from:o,to:i,onRangeChange:l}=e;return b.createElement(Vo,{range:r,value:[o,i],editing:n,onValueChange:u=>l(...u),onFocus:()=>t(!0),onBlur:()=>t(!1)})};var Vo=e=>{let[n,t]=e.value,{editing:r,onFocus:o}=e,i=z(null),l=z(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:i,className:`form-control form-control-sm ${i.current?.checkValidity()?"":"is-invalid"}`,style:{flex:"1 1 0",width:"0"},type:"number",placeholder:Nn(r,"Min",e.range()[0]),defaultValue:n,step:"any",onChange:u=>{let a=Hn(u.target.value);i.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([a,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:Nn(r,"Max",e.range()[1]),defaultValue:t,step:"any",onChange:u=>{let a=Hn(u.target.value);l.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([n,a])}}))};function Nn(e,n,t){return e?typeof t>"u"?n:`${n} (${t})`:null}function Hn(e){if(e!=="")return+e}function Ln(e){return e?{getFilteredRowModel:Cn(),getFacetedRowModel:wn(),getFacetedUniqueValues:Rn(),getFacetedMinMaxValues:En(),filterFns:{substring:(n,t,r,o)=>n.getValue(t).toString().includes(r)}}:{}}var zn=({header:e,className:n,...t})=>{if((e.column.columnDef.meta?.typeHint).type==="numeric"){let[o,i]=e.column.getFilterValue()??[void 0,void 0];return Pn({from:o,to:i,range:()=>e.column.getFacetedMinMaxValues()??[void 0,void 0],onRangeChange:(u,a)=>e.column.setFilterValue([u,a])})}return b.createElement("input",{...t,className:`form-control form-control-sm ${n}`,type:"text",onChange:o=>e.column.setFilterValue(o.target.value)})};var k=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()]}};function Bn(e,n,t,r){let[o,i]=D(k.empty()),[l,u]=D(null),a=s=>{if(e==="none")return;let f=s.currentTarget,g=n(f),d=Io(e,r,o,s,g,l);d&&(i(d.selection),d.anchor&&(u(g),f.focus()),s.preventDefault())},c=s=>{if(e==="none")return;let f=s.currentTarget,g=n(f),d=o.has(g);if(e==="single"){if(s.key===" "||s.key==="Enter")o.has(g)?i(k.empty()):i(k.just(g)),s.preventDefault();else if(s.key==="ArrowUp"||s.key==="ArrowDown"){let p=t(g,s.key==="ArrowUp"?-1:1);p&&(s.preventDefault(),d&&i(k.just(p)))}}else e==="multiple"&&(s.key===" "||s.key==="Enter"?(i(o.toggle(g)),s.preventDefault()):(s.key==="ArrowUp"||s.key==="ArrowDown")&&t(g,s.key==="ArrowUp"?-1:1)&&s.preventDefault())};return{has(s){return o.has(s)},set(s,f){i(f?o.add(s):o.delete(s))},clear(){i(o.clear())},keys(){return o},itemHandlers(){return{onMouseDown:a,onKeyDown:c}}}}var Gn=/^mac/i.test(window.navigator.userAgentData?.platform??window.navigator.platform);function Io(e,n,t,r,o,i){let{shiftKey:l,altKey:u}=r,a=Gn?r.metaKey:r.ctrlKey;if((Gn?r.ctrlKey:r.metaKey)||u)return null;if(e==="multiple")return{selection:t.toggle(o),anchor:!0};if(e==="single")return a&&!l?t.has(o)?{selection:k.empty(),anchor:!0}:{selection:k.just(o),anchor:!0}:{selection:k.just(o),anchor:!0};if(e==="multi-native")if(l&&a){let s=n(i,o);return{selection:t.add(...s)}}else{if(a)return{selection:t.toggle(o),anchor:!0};if(l){if(i!==null&&n){let s=n(i,o);return{selection:k.just(...s)}}}else return{selection:k.just(o),anchor:!0}}}var Un={className:"sort-arrow",viewBox:[-1,-1,2,2].map(e=>e*1.4).join(" "),width:"100%",height:"100%",style:{paddingLeft:"3px"}},jn={stroke:"#333333",strokeWidth:"0.6",fill:"transparent"},Do=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...Un},b.createElement("path",{d:"M -1 0.5 L 0 -0.5 L 1 0.5",...jn,strokeLinecap:"round"})),To=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...Un},b.createElement("path",{d:"M -1 -0.5 L 0 0.5 L 1 -0.5",...jn,strokeLinecap:"round"})),qn=({direction:e})=>{if(!e)return null;if(e==="asc")return Do;if(e==="desc")return To;throw new Error(`Unexpected sort direction: '${e}'`)};function Kn(e,n,t){let[r,o]=D(0),i=b.useCallback(u=>{o(-1),u.target===u.currentTarget&&kn(e,n(),t)?.focus()},[e,n,t]),l=b.useCallback(u=>{o(0)},[]);return{containerTabIndex:r,containerHandlers:{onFocus:i,onBlur:l}}}function Wn(e,n,t,r,o){return U(()=>{let i=e??!0;if(!i)return null;let l=typeof i=="string"?i:"Viewing rows {start} through {end} of {total}";if(!n||t.length===0)return null;let u=n.scrollTop+r.clientHeight,a=n.scrollTop+n.clientHeight,[c,s]=Ao(u,a,t,(p,_)=>p.start+p.size/2);if(c===null||s===null)return null;let f=t[c],g=t[s];if(f.index===0&&g.index===o-1)return null;let d=Oo(l,f.index+1,g.index+1,o);return b.createElement("div",{className:"shiny-data-grid-summary"},d)},[e,n,t,r,o])}function Ao(e,n,t,r){let o=null,i=null;for(let l=0;l=e&&(o=l,i=l);else if(r(u,!1)<=n)i=l;else break}return[o,i]}function Oo(e,n,t,r){return e.replace(/\{(start|end|total)\}/g,(o,i)=>i==="start"?n+"":i==="end"?t+"":i==="total"?r+"":o)}var ko=e=>{let{id:n,data:t,bgcolor:r}=e,{columns:o,index:i,type_hints:l,data:u}=t,{width:a,height:c,filters:s}=t.options,f={};i.forEach(w=>{f[w+""]=w});let g=z(null),d=z(null),p=z(null),_=U(()=>o.map((w,M)=>{let x=l?.[M];return{accessorFn:(K,xe)=>K[M],filterFn:x.type==="numeric"?"inNumberRange":"includesString",header:w,meta:{typeHint:x}}}),[o]),m=U(()=>[...u],[u]),v=Ln(s),E={data:m,columns:_,getCoreRowModel:bn(),getSortedRowModel:xn(),...v},S=Fn(E),C=An({count:S.getFilteredRowModel().rows.length,getScrollElement:()=>g.current,estimateSize:()=>31,paddingStart:d.current?.clientHeight??0,scrollingDelay:10});L(()=>{C.scrollToOffset(0)},[t]);let I=C.getTotalSize(),V=C.getVirtualItems(),q=(V.length>0&&V?.[0]?.start||0)-d.current?.clientHeight,F=V.length>0?I-(V?.[V.length-1]?.end||0):0,Z=Wn(t.options.summary,g?.current,V,d.current,C.options.count),st=t.options.style??"grid",Yn=st==="grid"?"shiny-data-grid-grid":"shiny-data-grid-table",Qn=st==="table"?"table table-sm":null,re=t.options.row_selection_mode??"multi-native",Po=re!=="none",Zn=re==="multi-native"||re==="multiple",oe=Bn(re,w=>w.dataset.key,(w,M)=>{let x=S.getSortedRowModel(),K=x.rows.findIndex(at=>at.id===w);if(K<0||(K+=M,K<0||K>=x.rows.length))return null;let xe=x.rows[K].id;return C.scrollToIndex(K),setTimeout(()=>{g.current?.querySelector(`[data-key='${xe}']`)?.focus()},0),xe},(w,M)=>No(S.getSortedRowModel(),w,M));B(()=>{n&&(re==="none"?Shiny.setInputValue(`${n}_selected_rows`,null):Shiny.setInputValue(`${n}_selected_rows`,oe.keys().toList().map(w=>f[w])))},[[...oe.keys()]]);let er=b.useCallback(()=>p.current.querySelectorAll("[tabindex='-1']"),[p.current]),ut=Kn(g.current,er,{top:d.current?.clientHeight??0});B(()=>()=>{S.resetSorting(),oe.clear()},[t]);let tr=S.getHeaderGroups().length,nr=g.current?.scrollHeight>g.current?.clientHeight?"scrolling":"",rr=w=>M=>{(M.key===" "||M.key==="Enter")&&w.toggleSorting(void 0,M.shiftKey)},or=Ho(C);return b.createElement(b.Fragment,null,b.createElement("div",{className:`shiny-data-grid ${Yn} ${nr}`,ref:g,style:{width:a,maxHeight:c,overflow:"auto"}},b.createElement("table",{className:Qn+(s?" filtering":""),"aria-rowcount":u.length,"aria-multiselectable":Zn,style:{width:a===null||a==="auto"?null:"100%"}},b.createElement("thead",{ref:d,style:{backgroundColor:r}},S.getHeaderGroups().map((w,M)=>b.createElement("tr",{key:w.id,"aria-rowindex":M+1},w.headers.map(x=>b.createElement("th",{key:x.id,colSpan:x.colSpan,style:{width:x.getSize()},scope:"col",tabIndex:0,onClick:x.column.getToggleSortingHandler(),onKeyDown:rr(x.column)},x.isPlaceholder?null:b.createElement("div",{style:{cursor:x.column.getCanSort()?"pointer":null,userSelect:x.column.getCanSort()?"none":null}},rt(x.column.columnDef.header,x.getContext()),b.createElement(qn,{direction:x.column.getIsSorted()})))))),s&&b.createElement("tr",{className:"filters"},S.getFlatHeaders().map(w=>b.createElement("th",{key:`filter-${w.id}`},b.createElement(zn,{header:w}))))),b.createElement("tbody",{ref:p,tabIndex:ut.containerTabIndex,...ut.containerHandlers},q>0&&b.createElement("tr",{style:{height:`${q}px`}}),V.map(w=>{let M=S.getRowModel().rows[w.index];return M&&b.createElement("tr",{key:w.key,"data-index":w.index,"aria-rowindex":w.index+tr,"data-key":M.id,ref:or,"aria-selected":oe.has(M.id),tabIndex:-1,...oe.itemHandlers()},M.getVisibleCells().map(x=>b.createElement("td",{key:x.id},rt(x.column.columnDef.cell,x.getContext()))))}),F>0&&b.createElement("tr",{style:{height:`${F}px`}})))),Z)};function No(e,n,t){let r=e.rows.findIndex(l=>l.id===n),o=e.rows.findIndex(l=>l.id===t);if(r<0||o<0)return[];r>o&&([r,o]=[o,r]);let i=[];for(let l=r;l<=o;l++)i.push(e.rows[l].id);return i}function Ho(e){let n=z([]),t=ye(r=>{r&&(r.isConnected?e.measureElement(r):n.current.push(r))},[e]);return L(()=>{n.current.length>0&&n.current.splice(0).forEach(e.measureElement)}),t}var it=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 it,"shinyDataFrame");function Xn(e){if(!e)return null;let n=ot(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=ot(e,"background-image");return r&&r!=="none"?null:Xn(e.parentElement)}return n}var Jn=document.createElement("template");Jn.innerHTML=``;var lt=class extends HTMLElement{connectedCallback(){let[t]=[this];t.appendChild(Jn.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=On(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(Ge,null,b.createElement(ko,{id:this.id,data:t,bgcolor:Xn(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",lt);export{lt as ShinyDataFrameOutput}; + color: hsl(`+Math.max(0,Math.min(120-120*g,120))+"deg 100% 31%);",t?.key)}return t==null||t.onChange==null||t.onChange(i),i}}function Ee(e,n){if(e===void 0)throw new Error("Unexpected undefined"+(n?": "+n:""));return e}var Fn=function(n,t){return Math.abs(n-t)<1};var Co=function(n){return n},wo=function(n){for(var t=Math.max(n.startIndex-n.overscan,0),r=Math.min(n.endIndex+n.overscan,n.count-1),o=[],i=t;i<=r;i++)o.push(i);return o},$n=function(n,t){var r=n.scrollElement;if(r){var o=function(u){var a=u.width,c=u.height;t({width:Math.round(a),height:Math.round(c)})};o(r.getBoundingClientRect());var i=new ResizeObserver(function(l){var u=l[0];if(u!=null&&u.borderBoxSize){var a=u.borderBoxSize[0];if(a){o({width:a.inlineSize,height:a.blockSize});return}}o(r.getBoundingClientRect())});return i.observe(r,{box:"border-box"}),function(){i.unobserve(r)}}};var Mn=function(n,t){var r=n.scrollElement;if(r){var o=function(){t(r[n.options.horizontal?"scrollLeft":"scrollTop"])};return o(),r.addEventListener("scroll",o,{passive:!0}),function(){r.removeEventListener("scroll",o)}}};var Ro=function(n,t,r){if(t!=null&&t.borderBoxSize){var o=t.borderBoxSize[0];if(o){var i=Math.round(o[r.options.horizontal?"inlineSize":"blockSize"]);return i}}return Math.round(n.getBoundingClientRect()[r.options.horizontal?"width":"height"])};var Vn=function(n,t,r){var o,i,l=t.adjustments,u=l===void 0?0:l,a=t.behavior,c=n+u;(o=r.scrollElement)==null||o.scrollTo==null||o.scrollTo((i={},i[r.options.horizontal?"left":"top"]=c,i.behavior=a,i))},In=function(n){var t=this;this.unsubs=[],this.scrollElement=null,this.isScrolling=!1,this.isScrollingTimeoutId=null,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=function(){var r=null,o=function(){return r||(typeof ResizeObserver<"u"?r=new ResizeObserver(function(l){l.forEach(function(u){t._measureElement(u.target,u)})}):null)};return{disconnect:function(){var l;return(l=o())==null?void 0:l.disconnect()},observe:function(l){var u;return(u=o())==null?void 0:u.observe(l,{box:"border-box"})},unobserve:function(l){var u;return(u=o())==null?void 0:u.unobserve(l)}}}(),this.range={startIndex:0,endIndex:0},this.setOptions=function(r){Object.entries(r).forEach(function(o){var i=o[0],l=o[1];typeof l>"u"&&delete r[i]}),t.options=ge({debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Co,rangeExtractor:wo,onChange:function(){},measureElement:Ro,initialRect:{width:0,height:0},scrollMargin:0,scrollingDelay:150,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1},r)},this.notify=function(){t.options.onChange==null||t.options.onChange(t)},this.cleanup=function(){t.unsubs.filter(Boolean).forEach(function(r){return r()}),t.unsubs=[],t.scrollElement=null},this._didMount=function(){return t.measureElementCache.forEach(t.observer.observe),function(){t.observer.disconnect(),t.cleanup()}},this._willUpdate=function(){var r=t.options.getScrollElement();t.scrollElement!==r&&(t.cleanup(),t.scrollElement=r,t._scrollToOffset(t.scrollOffset,{adjustments:void 0,behavior:void 0}),t.unsubs.push(t.options.observeElementRect(t,function(o){var i=t.scrollRect;t.scrollRect=o,(t.options.horizontal?o.width!==i.width:o.height!==i.height)&&t.maybeNotify()})),t.unsubs.push(t.options.observeElementOffset(t,function(o){t.scrollAdjustments=0,t.scrollOffset!==o&&(t.isScrollingTimeoutId!==null&&(clearTimeout(t.isScrollingTimeoutId),t.isScrollingTimeoutId=null),t.isScrolling=!0,t.scrollDirection=t.scrollOffset=0;u--){var a=r[u];if(!i.has(a.lane)){var c=l.get(a.lane);if(c==null||a.end>c.end?l.set(a.lane,a):a.end0?Math.min.apply(Math,t.pendingMeasuredCacheIndexes):0;t.pendingMeasuredCacheIndexes=[];for(var s=t.measurementsCache.slice(0,c),f=c;f=t.scrollOffset+i?o="end":o="start"),o==="start"?r=r:o==="end"?r=r-i:o==="center"&&(r=r-i/2);var l=t.options.horizontal?"scrollWidth":"scrollHeight",u=t.scrollElement?"document"in t.scrollElement?t.scrollElement.document.documentElement[l]:t.scrollElement[l]:0,a=u-t.getSize();return Math.max(Math.min(a,r),0)},this.getOffsetForIndex=function(r,o){o===void 0&&(o="auto"),r=Math.max(0,Math.min(r,t.options.count-1));var i=Ee(t.getMeasurements()[r]);if(o==="auto")if(i.end>=t.scrollOffset+t.getSize()-t.options.scrollPaddingEnd)o="end";else if(i.start<=t.scrollOffset+t.options.scrollPaddingStart)o="start";else return[t.scrollOffset,o];var l=o==="end"?i.end+t.options.scrollPaddingEnd:i.start-t.options.scrollPaddingStart;return[t.getOffsetForAlignment(l,o),o]},this.isDynamicMode=function(){return t.measureElementCache.size>0},this.cancelScrollToIndex=function(){t.scrollToIndexTimeoutId!==null&&(clearTimeout(t.scrollToIndexTimeoutId),t.scrollToIndexTimeoutId=null)},this.scrollToOffset=function(r,o){var i=o===void 0?{}:o,l=i.align,u=l===void 0?"start":l,a=i.behavior;t.cancelScrollToIndex(),a==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t._scrollToOffset(t.getOffsetForAlignment(r,u),{adjustments:void 0,behavior:a})},this.scrollToIndex=function(r,o){var i=o===void 0?{}:o,l=i.align,u=l===void 0?"auto":l,a=i.behavior;r=Math.max(0,Math.min(r,t.options.count-1)),t.cancelScrollToIndex(),a==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");var c=t.getOffsetForIndex(r,u),s=c[0],f=c[1];t._scrollToOffset(s,{adjustments:void 0,behavior:a}),a!=="smooth"&&t.isDynamicMode()&&(t.scrollToIndexTimeoutId=setTimeout(function(){t.scrollToIndexTimeoutId=null;var g=t.measureElementCache.has(t.options.getItemKey(r));if(g){var d=t.getOffsetForIndex(r,f),p=d[0];Fn(p,t.scrollOffset)||t.scrollToIndex(r,{align:f,behavior:a})}else t.scrollToIndex(r,{align:f,behavior:a})}))},this.scrollBy=function(r,o){var i=o===void 0?{}:o,l=i.behavior;t.cancelScrollToIndex(),l==="smooth"&&t.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t._scrollToOffset(t.scrollOffset+r,{adjustments:void 0,behavior:l})},this.getTotalSize=function(){var r;return(((r=t.getMeasurements()[t.options.count-1])==null?void 0:r.end)||t.options.paddingStart)-t.options.scrollMargin+t.options.paddingEnd},this._scrollToOffset=function(r,o){var i=o.adjustments,l=o.behavior;t.options.scrollToFn(r,{behavior:l,adjustments:i},t)},this.measure=function(){t.itemSizeCache=new Map,t.notify()},this.setOptions(n),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(function(r){t.itemSizeCache.set(r.key,r.size)}),this.maybeNotify()},Dn=function(n,t,r,o){for(;n<=t;){var i=(n+t)/2|0,l=r(i);if(lo)t=i-1;else return i}return n>0?n-1:0};function Eo(e){for(var n=e.measurements,t=e.outerSize,r=e.scrollOffset,o=n.length-1,i=function(c){return n[c].start},l=Dn(0,o,i,r),u=l;u=i&&f<=u&&g>=l&&g<=a)return s}return null}function ot(e,n){return document?.defaultView?.getComputedStyle(e,null)?.getPropertyValue(n)}var Hn=e=>{let[n,t]=I(!1),{range:r,from:o,to:i,onRangeChange:l}=e;return b.createElement($o,{range:r,value:[o,i],editing:n,onValueChange:u=>l(...u),onFocus:()=>t(!0),onBlur:()=>t(!1)})};var $o=e=>{let[n,t]=e.value,{editing:r,onFocus:o}=e,i=z(null),l=z(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:i,className:`form-control form-control-sm ${i.current?.checkValidity()?"":"is-invalid"}`,style:{flex:"1 1 0",width:"0"},type:"number",placeholder:Nn(r,"Min",e.range()[0]),defaultValue:n,step:"any",onChange:u=>{let a=kn(u.target.value);i.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([a,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:Nn(r,"Max",e.range()[1]),defaultValue:t,step:"any",onChange:u=>{let a=kn(u.target.value);l.current.classList.toggle("is-invalid",!u.target.checkValidity()),e.onValueChange([n,a])}}))};function Nn(e,n,t){return e?typeof t>"u"?n:`${n} (${t})`:null}function kn(e){if(e!=="")return+e}function Pn(e){return e?{getFilteredRowModel:Sn(),getFacetedRowModel:Cn(),getFacetedUniqueValues:wn(),getFacetedMinMaxValues:Rn(),filterFns:{substring:(n,t,r,o)=>n.getValue(t).toString().includes(r)}}:{}}var Ln=({header:e,className:n,...t})=>{if((e.column.columnDef.meta?.typeHint).type==="numeric"){let[o,i]=e.column.getFilterValue()??[void 0,void 0];return Hn({from:o,to:i,range:()=>e.column.getFacetedMinMaxValues()??[void 0,void 0],onRangeChange:(u,a)=>e.column.setFilterValue([u,a])})}return b.createElement("input",{...t,className:`form-control form-control-sm ${n}`,type:"text",onChange:o=>e.column.setFilterValue(o.target.value)})};var O=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()]}};function Gn(e,n,t,r){let[o,i]=I(O.empty()),[l,u]=I(null),a=s=>{if(e==="none")return;let f=s.currentTarget,g=n(f),d=Mo(e,r,o,s,g,l);d&&(i(d.selection),d.anchor&&(u(g),f.focus()),s.preventDefault())},c=s=>{if(e==="none")return;let f=s.currentTarget,g=n(f),d=o.has(g);if(e==="single"){if(s.key===" "||s.key==="Enter")o.has(g)?i(O.empty()):i(O.just(g)),s.preventDefault();else if(s.key==="ArrowUp"||s.key==="ArrowDown"){let p=t(g,s.key==="ArrowUp"?-1:1);p&&(s.preventDefault(),d&&i(O.just(p)))}}else e==="multiple"&&(s.key===" "||s.key==="Enter"?(i(o.toggle(g)),s.preventDefault()):(s.key==="ArrowUp"||s.key==="ArrowDown")&&t(g,s.key==="ArrowUp"?-1:1)&&s.preventDefault())};return{has(s){return o.has(s)},set(s,f){i(f?o.add(s):o.delete(s))},clear(){i(o.clear())},keys(){return o},itemHandlers(){return{onMouseDown:a,onKeyDown:c}}}}var zn=/^mac/i.test(window.navigator.userAgentData?.platform??window.navigator.platform);function Mo(e,n,t,r,o,i){let{shiftKey:l,altKey:u}=r,a=zn?r.metaKey:r.ctrlKey;if((zn?r.ctrlKey:r.metaKey)||u)return null;if(e==="multiple")return{selection:t.toggle(o),anchor:!0};if(e==="single")return a&&!l?t.has(o)?{selection:O.empty(),anchor:!0}:{selection:O.just(o),anchor:!0}:{selection:O.just(o),anchor:!0};if(e==="multi-native")if(l&&a){let s=n(i,o);return{selection:t.add(...s)}}else{if(a)return{selection:t.toggle(o),anchor:!0};if(l){if(i!==null&&n){let s=n(i,o);return{selection:O.just(...s)}}}else return{selection:O.just(o),anchor:!0}}}var Bn={className:"sort-arrow",viewBox:[-1,-1,2,2].map(e=>e*1.4).join(" "),width:"100%",height:"100%",style:{paddingLeft:"3px"}},Un={stroke:"#333333",strokeWidth:"0.6",fill:"transparent"},Vo=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...Bn},b.createElement("path",{d:"M -1 0.5 L 0 -0.5 L 1 0.5",...Un,strokeLinecap:"round"})),Io=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",...Bn},b.createElement("path",{d:"M -1 -0.5 L 0 0.5 L 1 -0.5",...Un,strokeLinecap:"round"})),jn=({direction:e})=>{if(!e)return null;if(e==="asc")return Vo;if(e==="desc")return Io;throw new Error(`Unexpected sort direction: '${e}'`)};function qn(e,n,t){let[r,o]=I(0),i=b.useCallback(u=>{o(-1),u.target===u.currentTarget&&On(e,n(),t)?.focus()},[e,n,t]),l=b.useCallback(u=>{o(0)},[]);return{containerTabIndex:r,containerHandlers:{onFocus:i,onBlur:l}}}function Kn(e,n,t,r,o){return U(()=>{let i=e??!0;if(!i)return null;let l=typeof i=="string"?i:"Viewing rows {start} through {end} of {total}";if(!n||t.length===0)return null;let u=n.scrollTop+r.clientHeight,a=n.scrollTop+n.clientHeight,[c,s]=Do(u,a,t,(p,_)=>p.start+p.size/2);if(c===null||s===null)return null;let f=t[c],g=t[s];if(f.index===0&&g.index===o-1)return null;let d=To(l,f.index+1,g.index+1,o);return b.createElement("div",{className:"shiny-data-grid-summary"},d)},[e,n,t,r,o])}function Do(e,n,t,r){let o=null,i=null;for(let l=0;l=e&&(o=l,i=l);else if(r(u,!1)<=n)i=l;else break}return[o,i]}function To(e,n,t,r){return e.replace(/\{(start|end|total)\}/g,(o,i)=>i==="start"?n+"":i==="end"?t+"":i==="total"?r+"":o)}var Ao=e=>{let{id:n,data:t,bgcolor:r}=e,{columns:o,type_hints:i,data:l}=t,{width:u,height:a,filters:c}=t.options,s=z(null),f=z(null),g=z(null),d=U(()=>o.map((R,M)=>{let E=i?.[M];return{accessorFn:(q,xe)=>q[M],filterFn:E.type==="numeric"?"inNumberRange":"includesString",header:R,meta:{typeHint:E}}}),[o]),p=U(()=>[...l],[l]),_=Pn(c),m={data:p,columns:d,getCoreRowModel:yn(),getSortedRowModel:En(),..._},v=xn(m),S=Tn({count:v.getFilteredRowModel().rows.length,getScrollElement:()=>s.current,estimateSize:()=>31,paddingStart:f.current?.clientHeight??0,scrollingDelay:10});L(()=>{S.scrollToOffset(0)},[t]);let x=S.getTotalSize(),C=S.getVirtualItems(),V=(C.length>0&&C?.[0]?.start||0)-f.current?.clientHeight,N=C.length>0?x-(C?.[C.length-1]?.end||0):0,J=Kn(t.options.summary,s?.current,C,f.current,S.options.count),F=t.options.style??"grid",Z=F==="grid"?"shiny-data-grid-grid":"shiny-data-grid-table",Jn=F==="table"?"table table-sm":null,re=t.options.row_selection_mode??"multi-native",ko=re!=="none",Yn=re==="multi-native"||re==="multiple",oe=Gn(re,R=>R.dataset.key,(R,M)=>{let E=v.getSortedRowModel(),q=E.rows.findIndex(ut=>ut.id===R);if(q<0||(q+=M,q<0||q>=E.rows.length))return null;let xe=E.rows[q].id;return S.scrollToIndex(q),setTimeout(()=>{s.current?.querySelector(`[data-key='${xe}']`)?.focus()},0),xe},(R,M)=>Oo(v.getSortedRowModel(),R,M));B(()=>{n&&(re==="none"?Shiny.setInputValue(`${n}_selected_rows`,null):Shiny.setInputValue(`${n}_selected_rows`,oe.keys().toList().map(R=>parseInt(R)).sort()))},[[...oe.keys()]]);let Qn=b.useCallback(()=>g.current.querySelectorAll("[tabindex='-1']"),[g.current]),st=qn(s.current,Qn,{top:f.current?.clientHeight??0});B(()=>()=>{v.resetSorting(),oe.clear()},[t]);let Zn=v.getHeaderGroups().length,er=s.current?.scrollHeight>s.current?.clientHeight?"scrolling":"",tr=R=>M=>{(M.key===" "||M.key==="Enter")&&R.toggleSorting(void 0,M.shiftKey)},nr=No(S);return b.createElement(b.Fragment,null,b.createElement("div",{className:`shiny-data-grid ${Z} ${er}`,ref:s,style:{width:u,maxHeight:a,overflow:"auto"}},b.createElement("table",{className:Jn+(c?" filtering":""),"aria-rowcount":l.length,"aria-multiselectable":Yn,style:{width:u===null||u==="auto"?null:"100%"}},b.createElement("thead",{ref:f,style:{backgroundColor:r}},v.getHeaderGroups().map((R,M)=>b.createElement("tr",{key:R.id,"aria-rowindex":M+1},R.headers.map(E=>b.createElement("th",{key:E.id,colSpan:E.colSpan,style:{width:E.getSize()},scope:"col",tabIndex:0,onClick:E.column.getToggleSortingHandler(),onKeyDown:tr(E.column)},E.isPlaceholder?null:b.createElement("div",{style:{cursor:E.column.getCanSort()?"pointer":null,userSelect:E.column.getCanSort()?"none":null}},rt(E.column.columnDef.header,E.getContext()),b.createElement(jn,{direction:E.column.getIsSorted()})))))),c&&b.createElement("tr",{className:"filters"},v.getFlatHeaders().map(R=>b.createElement("th",{key:`filter-${R.id}`},b.createElement(Ln,{header:R}))))),b.createElement("tbody",{ref:g,tabIndex:st.containerTabIndex,...st.containerHandlers},V>0&&b.createElement("tr",{style:{height:`${V}px`}}),C.map(R=>{let M=v.getRowModel().rows[R.index];return M&&b.createElement("tr",{key:R.key,"data-index":R.index,"aria-rowindex":R.index+Zn,"data-key":M.id,ref:nr,"aria-selected":oe.has(M.id),tabIndex:-1,...oe.itemHandlers()},M.getVisibleCells().map(E=>b.createElement("td",{key:E.id},rt(E.column.columnDef.cell,E.getContext()))))}),N>0&&b.createElement("tr",{style:{height:`${N}px`}})))),J)};function Oo(e,n,t){let r=e.rows.findIndex(l=>l.id===n),o=e.rows.findIndex(l=>l.id===t);if(r<0||o<0)return[];r>o&&([r,o]=[o,r]);let i=[];for(let l=r;l<=o;l++)i.push(e.rows[l].id);return i}function No(e){let n=z([]),t=ye(r=>{r&&(r.isConnected?e.measureElement(r):n.current.push(r))},[e]);return L(()=>{n.current.length>0&&n.current.splice(0).forEach(e.measureElement)}),t}var it=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 it,"shinyDataFrame");function Wn(e){if(!e)return null;let n=ot(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=ot(e,"background-image");return r&&r!=="none"?null:Wn(e.parentElement)}return n}var Xn=document.createElement("template");Xn.innerHTML=``;var lt=class extends HTMLElement{connectedCallback(){let[t]=[this];t.appendChild(Xn.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=An(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(Ge,null,b.createElement(Ao,{id:this.id,data:t,bgcolor:Wn(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",lt);export{lt as ShinyDataFrameOutput}; /*! Bundled license information: @tanstack/table-core/build/lib/index.mjs: diff --git a/shiny/www/shared/dataframe/dataframe.js.map b/shiny/www/shared/dataframe/dataframe.js.map index f51017827..aab56e122 100644 --- a/shiny/www/shared/dataframe/dataframe.js.map +++ b/shiny/www/shared/dataframe/dataframe.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../../../js/dataframe/styles.scss", "../../../../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/create-context.js", "../../../../js/node_modules/preact/src/constants.js", "../../../../js/node_modules/preact/src/diff/children.js", "../../../../js/node_modules/preact/src/diff/props.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/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/utils.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/features/ColumnSizing.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/Expanding.ts", "../../../../js/node_modules/@tanstack/table-core/src/filterFns.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/Filters.ts", "../../../../js/node_modules/@tanstack/table-core/src/aggregationFns.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/Grouping.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/Ordering.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/Pagination.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/Pinning.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/Sorting.ts", "../../../../js/node_modules/@tanstack/table-core/src/features/Visibility.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/table.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/cell.ts", "../../../../js/node_modules/@tanstack/table-core/src/core/row.ts", "../../../../js/node_modules/@tanstack/table-core/src/columnHelper.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getCoreRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/filterRowsUtils.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getFilteredRowModel.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/getFacetedMinMaxValues.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getSortedRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getGroupedRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getExpandedRowModel.ts", "../../../../js/node_modules/@tanstack/table-core/src/utils/getPaginationRowModel.ts", "../../../../js/node_modules/@tanstack/react-table/src/index.tsx", "../../../../js/node_modules/@tanstack/react-virtual/build/lib/_virtual/_rollupPluginBabelHelpers.mjs", "../../../../js/node_modules/@tanstack/virtual-core/build/lib/_virtual/_rollupPluginBabelHelpers.mjs", "../../../../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/dataframe/dom-utils.tsx", "../../../../js/dataframe/filter-numeric.tsx", "../../../../js/dataframe/filter.tsx", "../../../../js/dataframe/immutable-set.tsx", "../../../../js/dataframe/selection.tsx", "../../../../js/dataframe/sort-arrows.tsx", "../../../../js/dataframe/tabindex-group.ts", "../../../../js/dataframe/table-summary.tsx", "../../../../js/dataframe/index.tsx"], - "sourcesContent": ["export default `\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n.shiny-data-grid {\n --shiny-datagrid-font-size: 0.9em;\n --shiny-datagrid-padding-x: 0.5em;\n --shiny-datagrid-padding-y: 0.3em;\n --shiny-datagrid-padding: var(--shiny-datagrid-padding-y)\n var(--shiny-datagrid-padding-x);\n --shiny-datagrid-grid-header-bgcolor: var(--bs-light, #eee);\n --shiny-datagrid-grid-header-gridlines-color: var(--bs-border-color, #ccc);\n --shiny-datagrid-grid-header-gridlines-style: solid;\n --shiny-datagrid-grid-gridlines-color: var(--bs-border-color, #ccc);\n --shiny-datagrid-grid-gridlines-style: solid;\n --shiny-datagrid-table-header-bottom-border: 1px solid;\n --shiny-datagrid-table-top-border: 1px solid;\n --shiny-datagrid-table-bottom-border: 1px solid;\n --shiny-datagrid-grid-body-hover-bgcolor: var(\n --shiny-datagrid-grid-header-bgcolor\n );\n --shiny-datagrid-grid-body-selected-bgcolor: #b4d5fe;\n --shiny-datagrid-grid-body-selected-color: var(--bs-dark);\n}\n\n.shiny-data-grid svg.sort-arrow {\n display: inline-block;\n width: 0.85em;\n height: 0.85em;\n margin-bottom: 0.15em;\n}\n\n.shiny-data-grid {\n max-width: 100%;\n}\n.shiny-data-grid > table {\n border-collapse: separate;\n border-spacing: 0;\n}\n.shiny-data-grid > table > thead {\n position: sticky;\n top: 0;\n}\n.shiny-data-grid > table > thead > tr > th {\n text-align: left;\n white-space: nowrap;\n}\n.shiny-data-grid > table > thead > tr > th:focus-visible {\n outline: 5px auto Highlight;\n outline: 5px auto -webkit-focus-ring-color;\n}\n.shiny-data-grid > table.filtering > thead > tr:nth-last-child(2) > th {\n border-bottom: none;\n}\n.shiny-data-grid > table.filtering > thead > tr.filters > th {\n font-weight: unset;\n padding-top: 0;\n /* Slight boost to bottom padding */\n padding-bottom: var(--shiny-datagrid-padding-x);\n}\n.shiny-data-grid > table.filtering > thead > tr.filters > th > input {\n width: 100%;\n}\n\n.shiny-data-grid.shiny-data-grid-table {\n border-top: var(--shiny-datagrid-table-top-border);\n}\n.shiny-data-grid.shiny-data-grid-table.scrolling {\n border-bottom: var(--shiny-datagrid-table-bottom-border);\n}\n.shiny-data-grid.shiny-data-grid-table > table > thead > tr:last-child > th {\n border-bottom: var(--shiny-datagrid-table-header-bottom-border);\n}\n.shiny-data-grid.shiny-data-grid-table > table > tbody > tr[aria-selected=true] {\n --shiny-datagrid-grid-gridlines-color: var(\n --shiny-datagrid-grid-body-selected-bgcolor\n );\n background-color: var(--shiny-datagrid-grid-body-selected-bgcolor);\n color: var(--shiny-datagrid-grid-body-selected-color);\n}\n\n/*\n *\n * # GRID STYLES\n *\n */\n.shiny-data-grid.shiny-data-grid-grid > table {\n font-size: var(--shiny-datagrid-font-size);\n}\n.shiny-data-grid.shiny-data-grid-grid > table > thead > tr > th,\n.shiny-data-grid.shiny-data-grid-grid > table > thead > tr > td {\n background-color: var(--shiny-datagrid-grid-header-bgcolor);\n padding: var(--shiny-datagrid-padding);\n}\n.shiny-data-grid.shiny-data-grid-grid > table > tbody > tr:focus-visible {\n outline: 5px auto Highlight;\n outline: 5px auto -webkit-focus-ring-color;\n}\n.shiny-data-grid.shiny-data-grid-grid > table > tbody > tr:hover {\n --shiny-datagrid-grid-gridlines-color: inherit;\n background-color: var(--shiny-datagrid-grid-body-hover-bgcolor);\n}\n.shiny-data-grid.shiny-data-grid-grid > table > tbody > tr[aria-selected=true] {\n --shiny-datagrid-grid-gridlines-color: var(\n --shiny-datagrid-grid-body-selected-bgcolor\n );\n background-color: var(--shiny-datagrid-grid-body-selected-bgcolor);\n color: var(--shiny-datagrid-grid-body-selected-color);\n}\n.shiny-data-grid.shiny-data-grid-grid > table > tbody > tr > td {\n padding: var(--shiny-datagrid-padding);\n}\n\n/* ## Grid borders */\n.shiny-data-grid.shiny-data-grid-grid > table {\n border-collapse: separate;\n}\n.shiny-data-grid.shiny-data-grid-grid > table > thead > tr:first-child > th {\n border-top-style: var(--shiny-datagrid-grid-gridlines-style);\n}\n.shiny-data-grid.shiny-data-grid-grid > table > thead > tr > th {\n border: 1px var(--shiny-datagrid-grid-gridlines-style) var(--shiny-datagrid-grid-header-gridlines-color);\n border-top-style: none;\n border-left-style: none;\n}\n.shiny-data-grid.shiny-data-grid-grid > table > thead > tr > th:first-child {\n border-left-style: var(--shiny-datagrid-grid-gridlines-style);\n}\n.shiny-data-grid.shiny-data-grid-grid > table > tbody > tr > td {\n border: 1px var(--shiny-datagrid-grid-gridlines-style) var(--shiny-datagrid-grid-gridlines-color);\n border-top-style: none;\n border-left-style: none;\n}\n.shiny-data-grid.shiny-data-grid-grid > table > tbody > tr > td:first-child {\n border-left-style: var(--shiny-datagrid-grid-gridlines-style);\n}\n.shiny-data-grid.shiny-data-grid-grid.scrolling {\n border: var(--shiny-datagrid-grid-gridlines-style) 1px var(--shiny-datagrid-grid-header-gridlines-color);\n}\n.shiny-data-grid.shiny-data-grid-grid.scrolling > table > thead > tr:first-child > th {\n border-top-style: none;\n}\n.shiny-data-grid.shiny-data-grid-grid.scrolling > table > tbody > tr:last-child > td {\n border-bottom-style: none;\n}\n.shiny-data-grid.shiny-data-grid-grid.scrolling > table > thead > tr > th:first-child,\n.shiny-data-grid.shiny-data-grid-grid.scrolling > table > tbody > tr > td:first-child {\n border-left-style: none;\n}\n.shiny-data-grid.shiny-data-grid-grid.scrolling > table > thead > tr > th:last-child,\n.shiny-data-grid.shiny-data-grid-grid.scrolling > table > tbody > tr > td:last-child {\n border-right-style: none;\n}`;\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-ignore 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 {Node} 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 {import('./internal').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 {import('./internal').VNode[\"type\"]} type The node name or Component\n * constructor for this virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array} [children] The children of the virtual node\n * @returns {import('./internal').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 {import('./internal').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 {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').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\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\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: original == null ? ++vnodeId : original\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 import('./internal').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';\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 Component(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').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 */\nComponent.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 {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nComponent.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 {import('./index').ComponentChildren | void}\n */\nComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').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._parent._children.indexOf(vnode) + 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 {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tlet vnode = component._vnode,\n\t\toldDom = vnode._dom,\n\t\tparentDom = component._parentDom;\n\n\tif (parentDom) {\n\t\tlet commitQueue = [];\n\t\tconst oldVNode = assign({}, vnode);\n\t\toldVNode._original = vnode._original + 1;\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tvnode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.ownerSVGElement !== undefined,\n\t\t\tvnode._hydrating != null ? [oldDom] : null,\n\t\t\tcommitQueue,\n\t\t\toldDom == null ? getDomSibling(vnode) : oldDom,\n\t\t\tvnode._hydrating\n\t\t);\n\t\tcommitRoot(commitQueue, vnode);\n\n\t\tif (vnode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(vnode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').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 {import('./internal').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 {import('./internal').Component} a\n * @param {import('./internal').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 { 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 {import('./internal').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 {import('./internal').FunctionComponent} */\n\t\tProvider(props) {\n\t\t\tif (!this.getChildContext) {\n\t\t\t\t/** @type {import('./internal').Component[]} */\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.shouldComponentUpdate = function (_props) {\n\t\t\t\t\tif (this.props.value !== _props.value) {\n\t\t\t\t\t\t// I think the forced value propagation here was only needed when `options.debounceRendering` was being bypassed:\n\t\t\t\t\t\t// https://github.com/preactjs/preact/commit/4d339fb803bea09e9f198abf38ca1bf8ea4b7771#diff-54682ce380935a717e41b8bfc54737f6R358\n\t\t\t\t\t\t// In those cases though, even with the value corrected, we're double-rendering all nodes.\n\t\t\t\t\t\t// It might be better to just tell folks not to use force-sync mode.\n\t\t\t\t\t\t// Currently, using `useContext()` in a class component will overwrite its `this.context` value.\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\t// subs.some(c => {\n\t\t\t\t\t\t// \tc.context[contextId] = _props.value;\n\t\t\t\t\t\t// \tenqueueRender(c);\n\t\t\t\t\t\t// });\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\tsubs.splice(subs.indexOf(c), 1);\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", "export const EMPTY_OBJ = {};\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 { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport { EMPTY_OBJ, EMPTY_ARR } from '../constants';\nimport { getDomSibling } from '../component';\nimport { isArray } from '../util';\n\n/**\n * Diff the children of a virtual node\n * @param {import('../internal').PreactElement} parentDom The DOM element whose\n * children are being diffed\n * @param {import('../internal').ComponentChildren[]} renderResult\n * @param {import('../internal').VNode} newParentVNode The new virtual\n * node whose children should be diff'ed against oldParentVNode\n * @param {import('../internal').VNode} oldParentVNode The old virtual\n * node whose children should be diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by getChildContext\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\n\tlet i, j, oldVNode, childVNode, newDom, firstChildDom, refs;\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\tlet oldChildren = (oldParentVNode && oldParentVNode._children) || EMPTY_ARR;\n\n\tlet oldChildrenLength = oldChildren.length;\n\n\tnewParentVNode._children = [];\n\tfor (i = 0; i < renderResult.length; i++) {\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) {\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\tchildVNode\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._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\t// Terser removes the `continue` here and wraps the loop body\n\t\t// in a `if (childVNode) { ... } condition\n\t\tif (childVNode == null) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Check if we find a corresponding element in oldChildren.\n\t\t// If found, delete the array item by setting to `undefined`.\n\t\t// We use `undefined`, as `null` is reserved for empty placeholders\n\t\t// (holes).\n\t\toldVNode = oldChildren[i];\n\n\t\tif (\n\t\t\toldVNode === null ||\n\t\t\t(oldVNode &&\n\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\tchildVNode.type === oldVNode.type)\n\t\t) {\n\t\t\toldChildren[i] = undefined;\n\t\t} else {\n\t\t\t// Either oldVNode === undefined or oldChildrenLength > 0,\n\t\t\t// so after this loop oldVNode == null or oldVNode is a valid value.\n\t\t\tfor (j = 0; j < oldChildrenLength; j++) {\n\t\t\t\toldVNode = oldChildren[j];\n\t\t\t\t// If childVNode is unkeyed, we only match similarly unkeyed nodes, otherwise we match by key.\n\t\t\t\t// We always match by type (in either case).\n\t\t\t\tif (\n\t\t\t\t\toldVNode &&\n\t\t\t\t\tchildVNode.key == oldVNode.key &&\n\t\t\t\t\tchildVNode.type === oldVNode.type\n\t\t\t\t) {\n\t\t\t\t\toldChildren[j] = undefined;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toldVNode = null;\n\t\t\t}\n\t\t}\n\n\t\toldVNode = oldVNode || EMPTY_OBJ;\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\tisSvg,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating\n\t\t);\n\n\t\tnewDom = childVNode._dom;\n\n\t\tif ((j = childVNode.ref) && oldVNode.ref != j) {\n\t\t\tif (!refs) refs = [];\n\t\t\tif (oldVNode.ref) refs.push(oldVNode.ref, null, childVNode);\n\t\t\trefs.push(j, childVNode._component || newDom, childVNode);\n\t\t}\n\n\t\tif (newDom != null) {\n\t\t\tif (firstChildDom == null) {\n\t\t\t\tfirstChildDom = newDom;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof childVNode.type == 'function' &&\n\t\t\t\tchildVNode._children === oldVNode._children\n\t\t\t) {\n\t\t\t\tchildVNode._nextDom = oldDom = reorderChildren(\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldDom,\n\t\t\t\t\tparentDom\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(\n\t\t\t\t\tparentDom,\n\t\t\t\t\tchildVNode,\n\t\t\t\t\toldVNode,\n\t\t\t\t\toldChildren,\n\t\t\t\t\tnewDom,\n\t\t\t\t\toldDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof newParentVNode.type == 'function') {\n\t\t\t\t// Because the newParentVNode is Fragment-like, we need to set it's\n\t\t\t\t// _nextDom property to the nextSibling of its last child DOM node.\n\t\t\t\t//\n\t\t\t\t// `oldDom` contains the correct value here because if the last child\n\t\t\t\t// is a Fragment-like, then oldDom has already been set to that child's _nextDom.\n\t\t\t\t// If the last child is a DOM VNode, then oldDom will be set to that DOM\n\t\t\t\t// node's nextSibling.\n\t\t\t\tnewParentVNode._nextDom = oldDom;\n\t\t\t}\n\t\t} else if (\n\t\t\toldDom &&\n\t\t\toldVNode._dom == oldDom &&\n\t\t\toldDom.parentNode != parentDom\n\t\t) {\n\t\t\t// The above condition is to handle null placeholders. See test in placeholder.test.js:\n\t\t\t// `efficiently replace null placeholders in parent rerenders`\n\t\t\toldDom = getDomSibling(oldVNode);\n\t\t}\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\t// Remove remaining oldChildren if there are any.\n\tfor (i = oldChildrenLength; i--; ) {\n\t\tif (oldChildren[i] != null) {\n\t\t\tif (\n\t\t\t\ttypeof newParentVNode.type == 'function' &&\n\t\t\t\toldChildren[i]._dom != null &&\n\t\t\t\toldChildren[i]._dom == newParentVNode._nextDom\n\t\t\t) {\n\t\t\t\t// If the newParentVNode.__nextDom points to a dom node that is about to\n\t\t\t\t// be unmounted, then get the next sibling of that vnode and set\n\t\t\t\t// _nextDom to it\n\t\t\t\tnewParentVNode._nextDom = getLastDom(oldParentVNode).nextSibling;\n\t\t\t}\n\n\t\t\tunmount(oldChildren[i], oldChildren[i]);\n\t\t}\n\t}\n\n\t// Set refs only after unmount\n\tif (refs) {\n\t\tfor (i = 0; i < refs.length; i++) {\n\t\t\tapplyRef(refs[i], refs[++i], refs[++i]);\n\t\t}\n\t}\n}\n\nfunction reorderChildren(childVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tlet c = childVNode._children;\n\tlet tmp = 0;\n\tfor (; c && tmp < c.length; tmp++) {\n\t\tlet vnode = c[tmp];\n\t\tif (vnode) {\n\t\t\t// We typically enter this code path on sCU bailout, where we copy\n\t\t\t// oldVNode._children to newVNode._children. If that is the case, we need\n\t\t\t// to update the old children's _parent pointer to point to the newVNode\n\t\t\t// (childVNode here).\n\t\t\tvnode._parent = childVNode;\n\n\t\t\tif (typeof vnode.type == 'function') {\n\t\t\t\toldDom = reorderChildren(vnode, oldDom, parentDom);\n\t\t\t} else {\n\t\t\t\toldDom = placeChild(parentDom, vnode, vnode, c, vnode._dom, oldDom);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {import('../index').ComponentChildren} children The unflattened\n * children of a virtual node\n * @returns {import('../internal').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\nfunction placeChild(\n\tparentDom,\n\tchildVNode,\n\toldVNode,\n\toldChildren,\n\tnewDom,\n\toldDom\n) {\n\tlet nextDom;\n\tif (childVNode._nextDom !== undefined) {\n\t\t// Only Fragments or components that return Fragment like VNodes will\n\t\t// have a non-undefined _nextDom. Continue the diff from the sibling\n\t\t// of last DOM child of this child VNode\n\t\tnextDom = childVNode._nextDom;\n\n\t\t// Eagerly cleanup _nextDom. We don't need to persist the value because\n\t\t// it is only used by `diffChildren` to determine where to resume the diff after\n\t\t// diffing Components and Fragments. Once we store it the nextDOM local var, we\n\t\t// can clean up the property\n\t\tchildVNode._nextDom = undefined;\n\t} else if (\n\t\toldVNode == null ||\n\t\tnewDom != oldDom ||\n\t\tnewDom.parentNode == null\n\t) {\n\t\touter: if (oldDom == null || oldDom.parentNode !== parentDom) {\n\t\t\tparentDom.appendChild(newDom);\n\t\t\tnextDom = null;\n\t\t} else {\n\t\t\t// `j= 0; i--) {\n\t\t\tlet child = vnode._children[i];\n\t\t\tif (child) {\n\t\t\t\tlet lastDom = getLastDom(child);\n\t\t\t\tif (lastDom) {\n\t\t\t\t\treturn lastDom;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n", "import { IS_NON_DIMENSIONAL } from '../constants';\nimport options from '../options';\n\n/**\n * Diff the old and new properties of a VNode and apply changes to the DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to apply\n * changes to\n * @param {object} newProps The new props\n * @param {object} oldProps The old props\n * @param {boolean} isSvg Whether or not this node is an SVG node\n * @param {boolean} hydrate Whether or not we are in hydration mode\n */\nexport function diffProps(dom, newProps, oldProps, isSvg, hydrate) {\n\tlet i;\n\n\tfor (i in oldProps) {\n\t\tif (i !== 'children' && i !== 'key' && !(i in newProps)) {\n\t\t\tsetProperty(dom, i, null, oldProps[i], isSvg);\n\t\t}\n\t}\n\n\tfor (i in newProps) {\n\t\tif (\n\t\t\t(!hydrate || typeof newProps[i] == 'function') &&\n\t\t\ti !== 'children' &&\n\t\t\ti !== 'key' &&\n\t\t\ti !== 'value' &&\n\t\t\ti !== 'checked' &&\n\t\t\toldProps[i] !== newProps[i]\n\t\t) {\n\t\t\tsetProperty(dom, i, newProps[i], oldProps[i], isSvg);\n\t\t}\n\t}\n}\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/**\n * Set a property value on a DOM node\n * @param {import('../internal').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 {boolean} isSvg Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, isSvg) {\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 = name !== (name = name.replace(/Capture$/, ''));\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (name.toLowerCase() in dom) name = 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\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\t\tdom.addEventListener(name, handler, useCapture);\n\t\t\t}\n\t\t} else {\n\t\t\tconst handler = useCapture ? eventProxyCapture : eventProxy;\n\t\t\tdom.removeEventListener(name, handler, useCapture);\n\t\t}\n\t} else if (name !== 'dangerouslySetInnerHTML') {\n\t\tif (isSvg) {\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 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, value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n\treturn this._listeners[e.type + false](options.event ? options.event(e) : e);\n}\n\nfunction eventProxyCapture(e) {\n\treturn this._listeners[e.type + true](options.event ? options.event(e) : e);\n}\n", "import { EMPTY_OBJ } from '../constants';\nimport { Component, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { diffProps, 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 {import('../internal').PreactElement} parentDom The parent of the DOM element\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by getChildContext\n * @param {boolean} isSvg Whether or not this element is an SVG node\n * @param {Array} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').PreactElement} oldDom The current attached DOM\n * element any new dom elements should be placed around. Likely `null` on first\n * render (except when hydrating). Can be a sibling DOM element when diffing\n * Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} [isHydrating] Whether or not we are in hydration\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating\n) {\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._hydrating != null) {\n\t\tisHydrating = oldVNode._hydrating;\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\t// if we resume, we want the tree to be \"unlocked\"\n\t\tnewVNode._hydrating = null;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\ttry {\n\t\touter: if (typeof newType == 'function') {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\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 ('prototype' in newType && newType.prototype.render) {\n\t\t\t\t\t// @ts-ignore 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-ignore Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new Component(newProps, componentContext);\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 (c._nextState == null) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (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\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 (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\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\tc.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\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\t// In cases of bailing due to strict-equality we have to reset force as well\n\t\t\t\t\tc._force = false;\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 (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\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif ('prototype' in newType && newType.prototype.render) {\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 (!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\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating\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._hydrating = null;\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\n\t\t\tc._force = false;\n\t\t} else if (\n\t\t\texcessDomChildren == null &&\n\t\t\tnewVNode._original === oldVNode._original\n\t\t) {\n\t\t\tnewVNode._children = oldVNode._children;\n\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t} else {\n\t\t\tnewVNode._dom = diffElementNodes(\n\t\t\t\toldVNode._dom,\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\tisHydrating\n\t\t\t);\n\t\t}\n\n\t\tif ((tmp = options.diffed)) tmp(newVNode);\n\t} catch (e) {\n\t\tnewVNode._original = null;\n\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\tif (isHydrating || excessDomChildren != null) {\n\t\t\tnewVNode._dom = oldDom;\n\t\t\tnewVNode._hydrating = !!isHydrating;\n\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = null;\n\t\t\t// ^ could possibly be simplified to:\n\t\t\t// excessDomChildren.length = 0;\n\t\t}\n\t\toptions._catchError(e, newVNode, oldVNode);\n\t}\n}\n\n/**\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {import('../internal').VNode} root\n */\nexport function commitRoot(commitQueue, root) {\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-ignore 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-ignore See above ts-ignore 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 {import('../internal').PreactElement} dom The DOM element representing\n * the virtual nodes being diffed\n * @param {import('../internal').VNode} newVNode The new virtual node\n * @param {import('../internal').VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {boolean} isSvg Whether or not this DOM node is an SVG node\n * @param {*} excessDomChildren\n * @param {Array} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @returns {import('../internal').PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tisSvg,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating\n) {\n\tlet oldProps = oldVNode.props;\n\tlet newProps = newVNode.props;\n\tlet nodeType = newVNode.type;\n\tlet i = 0;\n\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\n\tif (nodeType === 'svg') isSvg = true;\n\n\tif (excessDomChildren != null) {\n\t\tfor (; i < excessDomChildren.length; i++) {\n\t\t\tconst child = 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\tchild &&\n\t\t\t\t'setAttribute' in child === !!nodeType &&\n\t\t\t\t(nodeType ? child.localName === nodeType : child.nodeType === 3)\n\t\t\t) {\n\t\t\t\tdom = child;\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\t// @ts-ignore createTextNode returns Text, we expect PreactElement\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tif (isSvg) {\n\t\t\tdom = document.createElementNS(\n\t\t\t\t'http://www.w3.org/2000/svg',\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType\n\t\t\t);\n\t\t} else {\n\t\t\tdom = document.createElement(\n\t\t\t\t// @ts-ignore We know `newVNode.type` is a string\n\t\t\t\tnodeType,\n\t\t\t\tnewProps.is && newProps\n\t\t\t);\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 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\tlet oldHtml = oldProps.dangerouslySetInnerHTML;\n\t\tlet newHtml = newProps.dangerouslySetInnerHTML;\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\tif (!isHydrating) {\n\t\t\t// But, if we are in a situation where we are using existing DOM (e.g. replaceNode)\n\t\t\t// we should read the existing DOM attributes to diff them\n\t\t\tif (excessDomChildren != null) {\n\t\t\t\toldProps = {};\n\t\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\t\toldProps[dom.attributes[i].name] = dom.attributes[i].value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (newHtml || oldHtml) {\n\t\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\t\tif (\n\t\t\t\t\t!newHtml ||\n\t\t\t\t\t((!oldHtml || newHtml.__html != oldHtml.__html) &&\n\t\t\t\t\t\tnewHtml.__html !== dom.innerHTML)\n\t\t\t\t) {\n\t\t\t\t\tdom.innerHTML = (newHtml && newHtml.__html) || '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdiffProps(dom, newProps, oldProps, isSvg, isHydrating);\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\ti = newVNode.props.children;\n\t\t\tdiffChildren(\n\t\t\t\tdom,\n\t\t\t\tisArray(i) ? i : [i],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tisSvg && nodeType !== 'foreignObject',\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);\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\tif (\n\t\t\t\t'value' in newProps &&\n\t\t\t\t(i = newProps.value) !== undefined &&\n\t\t\t\t// #2756 For the -element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(i !== dom.value ||\n\t\t\t\t\t(nodeType === 'progress' && !i) ||\n\t\t\t\t\t// This is only for IE 11 to fix \n\tif (\n\t\ttype == 'select' &&\n\t\tnormalizedProps.multiple &&\n\t\tArray.isArray(normalizedProps.value)\n\t) {\n\t\t// forEach() always returns undefined, which we abuse here to unset the value prop.\n\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\tchild.props.selected =\n\t\t\t\tnormalizedProps.value.indexOf(child.props.value) != -1;\n\t\t});\n\t}\n\n\t// Adding support for defaultValue in select tag\n\tif (type == 'select' && normalizedProps.defaultValue != null) {\n\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\tif (normalizedProps.multiple) {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.defaultValue.indexOf(child.props.value) != -1;\n\t\t\t} else {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.defaultValue == child.props.value;\n\t\t\t}\n\t\t});\n\t}\n\n\tif (props.class && !props.className) {\n\t\tnormalizedProps.class = props.class;\n\t\tObject.defineProperty(\n\t\t\tnormalizedProps,\n\t\t\t'className',\n\t\t\tclassNameDescriptorNonEnumberable\n\t\t);\n\t} else if (props.className && !props.class) {\n\t\tnormalizedProps.class = normalizedProps.className = props.className;\n\t} else if (props.class && props.className) {\n\t\tnormalizedProps.class = normalizedProps.className = props.className;\n\t}\n\n\tvnode.props = normalizedProps;\n}\n\nlet oldVNodeHook = options.vnode;\noptions.vnode = vnode => {\n\t// only normalize props on Element nodes\n\tif (typeof vnode.type === 'string') {\n\t\thandleDomVNode(vnode);\n\t}\n\n\tvnode.$$typeof = REACT_ELEMENT_TYPE;\n\n\tif (oldVNodeHook) oldVNodeHook(vnode);\n};\n\n// Only needed for react-relay\nlet currentComponent;\nconst oldBeforeRender = options._render;\noptions._render = function (vnode) {\n\tif (oldBeforeRender) {\n\t\toldBeforeRender(vnode);\n\t}\n\tcurrentComponent = vnode._component;\n};\n\nconst oldDiffed = options.diffed;\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.diffed = function (vnode) {\n\tif (oldDiffed) {\n\t\toldDiffed(vnode);\n\t}\n\n\tconst props = vnode.props;\n\tconst dom = vnode._dom;\n\n\tif (\n\t\tdom != null &&\n\t\tvnode.type === 'textarea' &&\n\t\t'value' in props &&\n\t\tprops.value !== dom.value\n\t) {\n\t\tdom.value = props.value == null ? '' : props.value;\n\t}\n\n\tcurrentComponent = null;\n};\n\n// This is a very very private internal function for React it\n// is used to sort-of do runtime dependency injection. So far\n// only `react-relay` makes use of it. It uses it to read the\n// context value.\nexport const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {\n\tReactCurrentDispatcher: {\n\t\tcurrent: {\n\t\t\treadContext(context) {\n\t\t\t\treturn currentComponent._globalContext[context._id].props.value;\n\t\t\t}\n\t\t}\n\t}\n};\n", "import {\n\tcreateElement,\n\trender as preactRender,\n\tcloneElement as preactCloneElement,\n\tcreateRef,\n\tComponent,\n\tcreateContext,\n\tFragment\n} from 'preact';\nimport {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue\n} from 'preact/hooks';\nimport { PureComponent } from './PureComponent';\nimport { memo } from './memo';\nimport { forwardRef } from './forwardRef';\nimport { Children } from './Children';\nimport { Suspense, lazy } from './suspense';\nimport { SuspenseList } from './suspense-list';\nimport { createPortal } from './portals';\nimport { is } from './util';\nimport {\n\thydrate,\n\trender,\n\tREACT_ELEMENT_TYPE,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n} from './render';\n\nconst version = '17.0.2'; // trick libraries to think we are react\n\n/**\n * Legacy version of createElement.\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor\n */\nfunction createFactory(type) {\n\treturn createElement.bind(null, type);\n}\n\n/**\n * Check if the passed element is a valid (p)react node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isValidElement(element) {\n\treturn !!element && element.$$typeof === REACT_ELEMENT_TYPE;\n}\n\n/**\n * Wrap `cloneElement` to abort if the passed element is not a valid element and apply\n * all vnode normalizations.\n * @param {import('./internal').VNode} element The vnode to clone\n * @param {object} props Props to add when cloning\n * @param {Array} rest Optional component children\n */\nfunction cloneElement(element) {\n\tif (!isValidElement(element)) return element;\n\treturn preactCloneElement.apply(null, arguments);\n}\n\n/**\n * Remove a component tree from the DOM, including state and event handlers.\n * @param {import('./internal').PreactElement} container\n * @returns {boolean}\n */\nfunction unmountComponentAtNode(container) {\n\tif (container._children) {\n\t\tpreactRender(null, container);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Get the matching DOM node for a component\n * @param {import('./internal').Component} component\n * @returns {import('./internal').PreactElement | null}\n */\nfunction findDOMNode(component) {\n\treturn (\n\t\t(component &&\n\t\t\t(component.base || (component.nodeType === 1 && component))) ||\n\t\tnull\n\t);\n}\n\n/**\n * Deprecated way to control batched rendering inside the reconciler, but we\n * already schedule in batches inside our rendering code\n * @template Arg\n * @param {(arg: Arg) => void} callback function that triggers the updated\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n */\n// eslint-disable-next-line camelcase\nconst unstable_batchedUpdates = (callback, arg) => callback(arg);\n\n/**\n * In React, `flushSync` flushes the entire tree and forces a rerender. It's\n * implmented here as a no-op.\n * @template Arg\n * @template Result\n * @param {(arg: Arg) => Result} callback function that runs before the flush\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n * @returns\n */\nconst flushSync = (callback, arg) => callback(arg);\n\n/**\n * Strict Mode is not implemented in Preact, so we provide a stand-in for it\n * that just renders its children without imposing any restrictions.\n */\nconst StrictMode = Fragment;\n\nexport function startTransition(cb) {\n\tcb();\n}\n\nexport function useDeferredValue(val) {\n\treturn val;\n}\n\nexport function useTransition() {\n\treturn [false, startTransition];\n}\n\n// TODO: in theory this should be done after a VNode is diffed as we want to insert\n// styles/... before it attaches\nexport const useInsertionEffect = useLayoutEffect;\n\n/**\n * This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation\n */\nexport function useSyncExternalStore(subscribe, getSnapshot) {\n\tconst value = getSnapshot();\n\n\tconst [{ _instance }, forceUpdate] = useState({\n\t\t_instance: { _value: value, _getSnapshot: getSnapshot }\n\t});\n\n\tuseLayoutEffect(() => {\n\t\t_instance._value = value;\n\t\t_instance._getSnapshot = getSnapshot;\n\n\t\tif (!is(_instance._value, getSnapshot())) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\t}, [subscribe, value, getSnapshot]);\n\n\tuseEffect(() => {\n\t\tif (!is(_instance._value, _instance._getSnapshot())) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\n\t\treturn subscribe(() => {\n\t\t\tif (!is(_instance._value, _instance._getSnapshot())) {\n\t\t\t\tforceUpdate({ _instance });\n\t\t\t}\n\t\t});\n\t}, [subscribe]);\n\n\treturn value;\n}\n\nexport * from 'preact/hooks';\nexport {\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\t// eslint-disable-next-line camelcase\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n\n// React copies the named exports to the default one.\nexport default {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseInsertionEffect,\n\tuseTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tstartTransition,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tunstable_batchedUpdates,\n\tStrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n", "import { TableState, Updater } from './types'\n\nexport type PartialKeys = Omit & Partial>\nexport type RequiredKeys = Omit &\n Required>\nexport type Overwrite = Omit<\n T,\n keyof U\n> &\n U\n\nexport type UnionToIntersection = (\n T extends any ? (x: T) => any : never\n) extends (x: infer R) => any\n ? R\n : never\n\nexport type IsAny = 1 extends 0 & T ? Y : N\nexport type IsKnown = unknown extends T ? N : Y\n\ntype ComputeRange<\n N extends number,\n Result extends Array = []\n> = Result['length'] extends N\n ? Result\n : ComputeRange\ntype Index40 = ComputeRange<40>[number]\n\n// Is this type a tuple?\ntype IsTuple = T extends readonly any[] & { length: infer Length }\n ? Length extends Index40\n ? T\n : never\n : never\n\n// If this type is a tuple, what indices are allowed?\ntype AllowedIndexes<\n Tuple extends ReadonlyArray,\n Keys extends number = never\n> = Tuple extends readonly []\n ? Keys\n : Tuple extends readonly [infer _, ...infer Tail]\n ? AllowedIndexes\n : Keys\n\nexport type DeepKeys = unknown extends T\n ? keyof T\n : object extends T\n ? string\n : T extends readonly any[] & IsTuple\n ? AllowedIndexes | DeepKeysPrefix>\n : T extends any[]\n ? never & 'Dynamic length array indexing is not supported'\n : T extends Date\n ? never\n : T extends object\n ? (keyof T & string) | DeepKeysPrefix\n : never\n\ntype DeepKeysPrefix = TPrefix extends keyof T & (number | string)\n ? `${TPrefix}.${DeepKeys & string}`\n : never\n\nexport type DeepValue = T extends Record\n ? TProp extends `${infer TBranch}.${infer TDeepProp}`\n ? DeepValue\n : T[TProp & string]\n : never\n\nexport type NoInfer = [T][T extends any ? 0 : never]\n\nexport type Getter = () => NoInfer\n\n///\n\nexport function functionalUpdate(updater: Updater, input: T): T {\n return typeof updater === 'function'\n ? (updater as (input: T) => T)(input)\n : updater\n}\n\nexport function noop() {\n //\n}\n\nexport function makeStateUpdater(\n key: K,\n instance: unknown\n) {\n return (updater: Updater) => {\n ;(instance as any).setState((old: TTableState) => {\n return {\n ...old,\n [key]: functionalUpdate(updater, (old as any)[key]),\n }\n })\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\nexport function isFunction(d: any): d is T {\n return d instanceof Function\n}\n\nexport function isNumberArray(d: any): d is number[] {\n return Array.isArray(d) && d.every(val => typeof val === 'number')\n}\n\nexport function flattenBy(\n arr: TNode[],\n getChildren: (item: TNode) => TNode[]\n) {\n const flat: TNode[] = []\n\n const recurse = (subArr: TNode[]) => {\n subArr.forEach(item => {\n flat.push(item)\n const children = getChildren(item)\n if (children?.length) {\n recurse(children)\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\nexport function memo(\n getDeps: () => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: any\n debug?: () => any\n onChange?: (result: TResult) => void\n }\n): () => TResult {\n let deps: any[] = []\n let result: TResult | undefined\n\n return () => {\n let depTime: number\n if (opts.key && opts.debug) depTime = Date.now()\n\n const newDeps = getDeps()\n\n const depsChanged =\n newDeps.length !== deps.length ||\n newDeps.some((dep: any, index: number) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime: number\n if (opts.key && opts.debug) resultTime = Date.now()\n\n result = fn(...newDeps)\n opts?.onChange?.(result)\n\n if (opts.key && opts.debug) {\n if (opts?.debug()) {\n const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120)\n )}deg 100% 31%);`,\n opts?.key\n )\n }\n }\n\n return result!\n }\n}\n", "import {\n Column,\n Table,\n AccessorFn,\n ColumnDef,\n RowData,\n ColumnDefResolved,\n} from '../types'\nimport { memo } from '../utils'\n\nexport interface CoreColumn {\n id: string\n depth: number\n accessorFn?: AccessorFn\n columnDef: ColumnDef\n columns: Column[]\n parent?: Column\n getFlatColumns: () => Column[]\n getLeafColumns: () => Column[]\n}\n\nexport function createColumn(\n table: Table,\n columnDef: ColumnDef,\n depth: number,\n parent?: Column\n): Column {\n const defaultColumn = table._getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n let id =\n resolvedColumnDef.id ??\n (accessorKey ? accessorKey.replace('.', '_') : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record\n\n for (const key of accessorKey.split('.')) {\n result = result?.[key]\n if (process.env.NODE_ENV !== 'production' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`\n )\n }\n }\n\n return result\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `Columns require an id when using an accessorFn`\n : `Columns require an id when using a non-string header`\n )\n }\n throw new Error()\n }\n\n let column: CoreColumn = {\n id: `${String(id)}`,\n accessorFn,\n parent: parent as any,\n depth,\n columnDef: resolvedColumnDef as ColumnDef,\n columns: [],\n getFlatColumns: memo(\n () => [true],\n () => {\n return [\n column as Column,\n ...column.columns?.flatMap(d => d.getFlatColumns()),\n ]\n },\n {\n key: process.env.NODE_ENV === 'production' && 'column.getFlatColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n getLeafColumns: memo(\n () => [table._getOrderColumnsFn()],\n orderColumns => {\n if (column.columns?.length) {\n let leafColumns = column.columns.flatMap(column =>\n column.getLeafColumns()\n )\n\n return orderColumns(leafColumns)\n }\n\n return [column as Column]\n },\n {\n key: process.env.NODE_ENV === 'production' && 'column.getLeafColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n }\n\n column = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.createColumn?.(column, table))\n }, column)\n\n // Yes, we have to convert table to uknown, because we know more than the compiler here.\n return column as Column\n}\n", "import { RowData, Column, Header, HeaderGroup, Table } from '../types'\nimport { memo } from '../utils'\nimport { TableFeature } from './table'\n\nexport interface CoreHeaderGroup {\n id: string\n depth: number\n headers: Header[]\n}\n\nexport interface HeaderContext {\n table: Table\n header: Header\n column: Column\n}\n\nexport interface CoreHeader {\n id: string\n index: number\n depth: number\n column: Column\n headerGroup: HeaderGroup\n subHeaders: Header[]\n colSpan: number\n rowSpan: number\n getLeafHeaders: () => Header[]\n isPlaceholder: boolean\n placeholderId?: string\n getContext: () => HeaderContext\n}\n\nexport interface HeadersInstance {\n getHeaderGroups: () => HeaderGroup[]\n getLeftHeaderGroups: () => HeaderGroup[]\n getCenterHeaderGroups: () => HeaderGroup[]\n getRightHeaderGroups: () => HeaderGroup[]\n\n getFooterGroups: () => HeaderGroup[]\n getLeftFooterGroups: () => HeaderGroup[]\n getCenterFooterGroups: () => HeaderGroup[]\n getRightFooterGroups: () => HeaderGroup[]\n\n getFlatHeaders: () => Header[]\n getLeftFlatHeaders: () => Header[]\n getCenterFlatHeaders: () => Header[]\n getRightFlatHeaders: () => Header[]\n\n getLeafHeaders: () => Header[]\n getLeftLeafHeaders: () => Header[]\n getCenterLeafHeaders: () => Header[]\n getRightLeafHeaders: () => Header[]\n}\n\n//\n\nfunction createHeader(\n table: Table,\n column: Column,\n options: {\n id?: string\n isPlaceholder?: boolean\n placeholderId?: string\n index: number\n depth: number\n }\n): Header {\n const id = options.id ?? column.id\n\n let header: CoreHeader = {\n id,\n column,\n index: options.index,\n isPlaceholder: !!options.isPlaceholder,\n placeholderId: options.placeholderId,\n depth: options.depth,\n subHeaders: [],\n colSpan: 0,\n rowSpan: 0,\n headerGroup: null!,\n getLeafHeaders: (): Header[] => {\n const leafHeaders: Header[] = []\n\n const recurseHeader = (h: CoreHeader) => {\n if (h.subHeaders && h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n },\n getContext: () => ({\n table,\n header: header as Header,\n column,\n }),\n }\n\n table._features.forEach(feature => {\n Object.assign(header, feature.createHeader?.(header, table))\n })\n\n return header as Header\n}\n\nexport const Headers: TableFeature = {\n createTable: (\n table: Table\n ): HeadersInstance => {\n return {\n // Header Groups\n\n getHeaderGroups: memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n const leftColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const rightColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n const centerColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n\n const headerGroups = buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table\n )\n\n return headerGroups\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getCenterHeaderGroups: memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, left, right) => {\n leafColumns = leafColumns.filter(\n column => !left?.includes(column.id) && !right?.includes(column.id)\n )\n return buildHeaderGroups(allColumns, leafColumns, table, 'center')\n },\n {\n key:\n process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getLeftHeaderGroups: memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.left,\n ],\n (allColumns, leafColumns, left) => {\n const orderedLeafColumns =\n left\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(\n allColumns,\n orderedLeafColumns,\n table,\n 'left'\n )\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getRightHeaderGroups: memo(\n () => [\n table.getAllColumns(),\n table.getVisibleLeafColumns(),\n table.getState().columnPinning.right,\n ],\n (allColumns, leafColumns, right) => {\n const orderedLeafColumns =\n right\n ?.map(columnId => leafColumns.find(d => d.id === columnId)!)\n .filter(Boolean) ?? []\n\n return buildHeaderGroups(\n allColumns,\n orderedLeafColumns,\n table,\n 'right'\n )\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n // Footer Groups\n\n getFooterGroups: memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getFooterGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getLeftFooterGroups: memo(\n () => [table.getLeftHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getCenterFooterGroups: memo(\n () => [table.getCenterHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n {\n key:\n process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getRightFooterGroups: memo(\n () => [table.getRightHeaderGroups()],\n headerGroups => {\n return [...headerGroups].reverse()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n // Flat Headers\n\n getFlatHeaders: memo(\n () => [table.getHeaderGroups()],\n headerGroups => {\n return headerGroups\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getLeftFlatHeaders: memo(\n () => [table.getLeftHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getCenterFlatHeaders: memo(\n () => [table.getCenterHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getRightFlatHeaders: memo(\n () => [table.getRightHeaderGroups()],\n left => {\n return left\n .map(headerGroup => {\n return headerGroup.headers\n })\n .flat()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n // Leaf Headers\n\n getCenterLeafHeaders: memo(\n () => [table.getCenterFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getLeftLeafHeaders: memo(\n () => [table.getLeftFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getRightLeafHeaders: memo(\n () => [table.getRightFlatHeaders()],\n flatHeaders => {\n return flatHeaders.filter(header => !header.subHeaders?.length)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n\n getLeafHeaders: memo(\n () => [\n table.getLeftHeaderGroups(),\n table.getCenterHeaderGroups(),\n table.getRightHeaderGroups(),\n ],\n (left, center, right) => {\n return [\n ...(left[0]?.headers ?? []),\n ...(center[0]?.headers ?? []),\n ...(right[0]?.headers ?? []),\n ]\n .map(header => {\n return header.getLeafHeaders()\n })\n .flat()\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',\n debug: () => table.options.debugAll ?? table.options.debugHeaders,\n }\n ),\n }\n },\n}\n\nexport function buildHeaderGroups(\n allColumns: Column[],\n columnsToGroup: Column[],\n table: Table,\n headerFamily?: 'center' | 'left' | 'right'\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (columns: Column[], depth = 1) => {\n maxDepth = Math.max(maxDepth, depth)\n\n columns\n .filter(column => column.getIsVisible())\n .forEach(column => {\n if (column.columns?.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }, 0)\n }\n\n findMaxDepth(allColumns)\n\n let headerGroups: HeaderGroup[] = []\n\n const createHeaderGroup = (\n headersToGroup: Header[],\n depth: number\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Header[] = []\n\n // Scan each column for parents\n headersToGroup.forEach(headerToGroup => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader?.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = createHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup?.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter(d => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(headerToGroup)\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n createHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n createHeader(table, column, {\n depth: maxDepth,\n index,\n })\n )\n\n createHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n // headerGroups = headerGroups.filter(headerGroup => {\n // return !headerGroup.headers.every(header => header.isPlaceholder)\n // })\n\n const recurseHeadersForSpans = (\n headers: Header[]\n ): { colSpan: number; rowSpan: number }[] => {\n const filteredHeaders = headers.filter(header =>\n header.column.getIsVisible()\n )\n\n return filteredHeaders.map(header => {\n let colSpan = 0\n let rowSpan = 0\n let childRowSpans = [0]\n\n if (header.subHeaders && header.subHeaders.length) {\n childRowSpans = []\n\n recurseHeadersForSpans(header.subHeaders).forEach(\n ({ colSpan: childColSpan, rowSpan: childRowSpan }) => {\n colSpan += childColSpan\n childRowSpans.push(childRowSpan)\n }\n )\n } else {\n colSpan = 1\n }\n\n const minChildRowSpan = Math.min(...childRowSpans)\n rowSpan = rowSpan + minChildRowSpan\n\n header.colSpan = colSpan\n header.rowSpan = rowSpan\n\n return { colSpan, rowSpan }\n })\n }\n\n recurseHeadersForSpans(headerGroups[0]?.headers ?? [])\n\n return headerGroups\n}\n", "import { TableFeature } from '../core/table'\nimport { RowData, Column, Header, OnChangeFn, Table, Updater } from '../types'\nimport { makeStateUpdater } from '../utils'\nimport { ColumnPinningPosition } from './Pinning'\n\n//\n\nexport interface ColumnSizingTableState {\n columnSizing: ColumnSizingState\n columnSizingInfo: ColumnSizingInfoState\n}\n\nexport type ColumnSizingState = Record\n\nexport interface ColumnSizingInfoState {\n startOffset: null | number\n startSize: null | number\n deltaOffset: null | number\n deltaPercentage: null | number\n isResizingColumn: false | string\n columnSizingStart: [string, number][]\n}\n\nexport type ColumnResizeMode = 'onChange' | 'onEnd'\n\nexport interface ColumnSizingOptions {\n enableColumnResizing?: boolean\n columnResizeMode?: ColumnResizeMode\n onColumnSizingChange?: OnChangeFn\n onColumnSizingInfoChange?: OnChangeFn\n}\n\nexport interface ColumnSizingDefaultOptions {\n columnResizeMode: ColumnResizeMode\n onColumnSizingChange: OnChangeFn\n onColumnSizingInfoChange: OnChangeFn\n}\n\nexport interface ColumnSizingInstance {\n setColumnSizing: (updater: Updater) => void\n setColumnSizingInfo: (updater: Updater) => void\n resetColumnSizing: (defaultState?: boolean) => void\n resetHeaderSizeInfo: (defaultState?: boolean) => void\n getTotalSize: () => number\n getLeftTotalSize: () => number\n getCenterTotalSize: () => number\n getRightTotalSize: () => number\n}\n\nexport interface ColumnSizingColumnDef {\n enableResizing?: boolean\n size?: number\n minSize?: number\n maxSize?: number\n}\n\nexport interface ColumnSizingColumn {\n getSize: () => number\n getStart: (position?: ColumnPinningPosition) => number\n getCanResize: () => boolean\n getIsResizing: () => boolean\n resetSize: () => void\n}\n\nexport interface ColumnSizingHeader {\n getSize: () => number\n getStart: (position?: ColumnPinningPosition) => number\n getResizeHandler: () => (event: unknown) => void\n}\n\n//\n\nexport const defaultColumnSizing = {\n size: 150,\n minSize: 20,\n maxSize: Number.MAX_SAFE_INTEGER,\n}\n\nconst getDefaultColumnSizingInfoState = (): ColumnSizingInfoState => ({\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n isResizingColumn: false,\n columnSizingStart: [],\n})\n\nexport const ColumnSizing: TableFeature = {\n getDefaultColumnDef: (): ColumnSizingColumnDef => {\n return defaultColumnSizing\n },\n getInitialState: (state): ColumnSizingTableState => {\n return {\n columnSizing: {},\n columnSizingInfo: getDefaultColumnSizingInfoState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnSizingDefaultOptions => {\n return {\n columnResizeMode: 'onEnd',\n onColumnSizingChange: makeStateUpdater('columnSizing', table),\n onColumnSizingInfoChange: makeStateUpdater('columnSizingInfo', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): ColumnSizingColumn => {\n return {\n getSize: () => {\n const columnSize = table.getState().columnSizing[column.id]\n\n return Math.min(\n Math.max(\n column.columnDef.minSize ?? defaultColumnSizing.minSize,\n columnSize ?? column.columnDef.size ?? defaultColumnSizing.size\n ),\n column.columnDef.maxSize ?? defaultColumnSizing.maxSize\n )\n },\n getStart: position => {\n const columns = !position\n ? table.getVisibleLeafColumns()\n : position === 'left'\n ? table.getLeftVisibleLeafColumns()\n : table.getRightVisibleLeafColumns()\n\n const index = columns.findIndex(d => d.id === column.id)\n\n if (index > 0) {\n const prevSiblingColumn = columns[index - 1]!\n\n return (\n prevSiblingColumn.getStart(position) + prevSiblingColumn.getSize()\n )\n }\n\n return 0\n },\n resetSize: () => {\n table.setColumnSizing(({ [column.id]: _, ...rest }) => {\n return rest\n })\n },\n getCanResize: () => {\n return (\n (column.columnDef.enableResizing ?? true) &&\n (table.options.enableColumnResizing ?? true)\n )\n },\n getIsResizing: () => {\n return table.getState().columnSizingInfo.isResizingColumn === column.id\n },\n }\n },\n\n createHeader: (\n header: Header,\n table: Table\n ): ColumnSizingHeader => {\n return {\n getSize: () => {\n let sum = 0\n\n const recurse = (header: Header) => {\n if (header.subHeaders.length) {\n header.subHeaders.forEach(recurse)\n } else {\n sum += header.column.getSize() ?? 0\n }\n }\n\n recurse(header)\n\n return sum\n },\n getStart: () => {\n if (header.index > 0) {\n const prevSiblingHeader =\n header.headerGroup.headers[header.index - 1]!\n return prevSiblingHeader.getStart() + prevSiblingHeader.getSize()\n }\n\n return 0\n },\n getResizeHandler: () => {\n const column = table.getColumn(header.column.id)\n const canResize = column?.getCanResize()\n\n return (e: unknown) => {\n if (!column || !canResize) {\n return\n }\n\n ;(e as any).persist?.()\n\n if (isTouchStartEvent(e)) {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return\n }\n }\n\n const startSize = header.getSize()\n\n const columnSizingStart: [string, number][] = header\n ? header\n .getLeafHeaders()\n .map(d => [d.column.id, d.column.getSize()])\n : [[column.id, column.getSize()]]\n\n const clientX = isTouchStartEvent(e)\n ? Math.round(e.touches[0]!.clientX)\n : (e as MouseEvent).clientX\n\n const newColumnSizing: ColumnSizingState = {}\n\n const updateOffset = (\n eventType: 'move' | 'end',\n clientXPos?: number\n ) => {\n if (typeof clientXPos !== 'number') {\n return\n }\n\n table.setColumnSizingInfo(old => {\n const deltaOffset = clientXPos - (old?.startOffset ?? 0)\n const deltaPercentage = Math.max(\n deltaOffset / (old?.startSize ?? 0),\n -0.999999\n )\n\n old.columnSizingStart.forEach(([columnId, headerSize]) => {\n newColumnSizing[columnId] =\n Math.round(\n Math.max(headerSize + headerSize * deltaPercentage, 0) * 100\n ) / 100\n })\n\n return {\n ...old,\n deltaOffset,\n deltaPercentage,\n }\n })\n\n if (\n table.options.columnResizeMode === 'onChange' ||\n eventType === 'end'\n ) {\n table.setColumnSizing(old => ({\n ...old,\n ...newColumnSizing,\n }))\n }\n }\n\n const onMove = (clientXPos?: number) =>\n updateOffset('move', clientXPos)\n\n const onEnd = (clientXPos?: number) => {\n updateOffset('end', clientXPos)\n\n table.setColumnSizingInfo(old => ({\n ...old,\n isResizingColumn: false,\n startOffset: null,\n startSize: null,\n deltaOffset: null,\n deltaPercentage: null,\n columnSizingStart: [],\n }))\n }\n\n const mouseEvents = {\n moveHandler: (e: MouseEvent) => onMove(e.clientX),\n upHandler: (e: MouseEvent) => {\n document.removeEventListener('mousemove', mouseEvents.moveHandler)\n document.removeEventListener('mouseup', mouseEvents.upHandler)\n onEnd(e.clientX)\n },\n }\n\n const touchEvents = {\n moveHandler: (e: TouchEvent) => {\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onMove(e.touches[0]!.clientX)\n return false\n },\n upHandler: (e: TouchEvent) => {\n document.removeEventListener('touchmove', touchEvents.moveHandler)\n document.removeEventListener('touchend', touchEvents.upHandler)\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n onEnd(e.touches[0]?.clientX)\n },\n }\n\n const passiveIfSupported = passiveEventSupported()\n ? { passive: false }\n : false\n\n if (isTouchStartEvent(e)) {\n document.addEventListener(\n 'touchmove',\n touchEvents.moveHandler,\n passiveIfSupported\n )\n document.addEventListener(\n 'touchend',\n touchEvents.upHandler,\n passiveIfSupported\n )\n } else {\n document.addEventListener(\n 'mousemove',\n mouseEvents.moveHandler,\n passiveIfSupported\n )\n document.addEventListener(\n 'mouseup',\n mouseEvents.upHandler,\n passiveIfSupported\n )\n }\n\n table.setColumnSizingInfo(old => ({\n ...old,\n startOffset: clientX,\n startSize,\n deltaOffset: 0,\n deltaPercentage: 0,\n columnSizingStart,\n isResizingColumn: column.id,\n }))\n }\n },\n }\n },\n\n createTable: (\n table: Table\n ): ColumnSizingInstance => {\n return {\n setColumnSizing: updater => table.options.onColumnSizingChange?.(updater),\n setColumnSizingInfo: updater =>\n table.options.onColumnSizingInfoChange?.(updater),\n resetColumnSizing: defaultState => {\n table.setColumnSizing(\n defaultState ? {} : table.initialState.columnSizing ?? {}\n )\n },\n resetHeaderSizeInfo: defaultState => {\n table.setColumnSizingInfo(\n defaultState\n ? getDefaultColumnSizingInfoState()\n : table.initialState.columnSizingInfo ??\n getDefaultColumnSizingInfoState()\n )\n },\n getTotalSize: () =>\n table.getHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0,\n getLeftTotalSize: () =>\n table.getLeftHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0,\n getCenterTotalSize: () =>\n table.getCenterHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0,\n getRightTotalSize: () =>\n table.getRightHeaderGroups()[0]?.headers.reduce((sum, header) => {\n return sum + header.getSize()\n }, 0) ?? 0,\n }\n },\n}\n\nlet passiveSupported: boolean | null = null\nexport function passiveEventSupported() {\n if (typeof passiveSupported === 'boolean') return passiveSupported\n\n let supported = false\n try {\n const options = {\n get passive() {\n supported = true\n return false\n },\n }\n\n const noop = () => {}\n\n window.addEventListener('test', noop, options)\n window.removeEventListener('test', noop)\n } catch (err) {\n supported = false\n }\n passiveSupported = supported\n return passiveSupported\n}\n\nfunction isTouchStartEvent(e: unknown): e is TouchEvent {\n return (e as TouchEvent).type === 'touchstart'\n}\n", "import { RowModel } from '..'\nimport { TableFeature } from '../core/table'\nimport { OnChangeFn, Table, Row, Updater, RowData } from '../types'\nimport { makeStateUpdater } from '../utils'\n\nexport type ExpandedStateList = Record\nexport type ExpandedState = true | Record\nexport interface ExpandedTableState {\n expanded: ExpandedState\n}\n\nexport interface ExpandedRow {\n toggleExpanded: (expanded?: boolean) => void\n getIsExpanded: () => boolean\n getCanExpand: () => boolean\n getToggleExpandedHandler: () => () => void\n}\n\nexport interface ExpandedOptions {\n manualExpanding?: boolean\n onExpandedChange?: OnChangeFn\n autoResetExpanded?: boolean\n enableExpanding?: boolean\n getExpandedRowModel?: (table: Table) => () => RowModel\n getIsRowExpanded?: (row: Row) => boolean\n getRowCanExpand?: (row: Row) => boolean\n paginateExpandedRows?: boolean\n}\n\nexport interface ExpandedInstance {\n _autoResetExpanded: () => void\n setExpanded: (updater: Updater) => void\n toggleAllRowsExpanded: (expanded?: boolean) => void\n resetExpanded: (defaultState?: boolean) => void\n getCanSomeRowsExpand: () => boolean\n getToggleAllRowsExpandedHandler: () => (event: unknown) => void\n getIsSomeRowsExpanded: () => boolean\n getIsAllRowsExpanded: () => boolean\n getExpandedDepth: () => number\n getExpandedRowModel: () => RowModel\n _getExpandedRowModel?: () => RowModel\n getPreExpandedRowModel: () => RowModel\n}\n\n//\n\nexport const Expanding: TableFeature = {\n getInitialState: (state): ExpandedTableState => {\n return {\n expanded: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ExpandedOptions => {\n return {\n onExpandedChange: makeStateUpdater('expanded', table),\n paginateExpandedRows: true,\n }\n },\n\n createTable: (\n table: Table\n ): ExpandedInstance => {\n let registered = false\n let queued = false\n\n return {\n _autoResetExpanded: () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetExpanded ??\n !table.options.manualExpanding\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetExpanded()\n queued = false\n })\n }\n },\n setExpanded: updater => table.options.onExpandedChange?.(updater),\n toggleAllRowsExpanded: expanded => {\n if (expanded ?? !table.getIsAllRowsExpanded()) {\n table.setExpanded(true)\n } else {\n table.setExpanded({})\n }\n },\n resetExpanded: defaultState => {\n table.setExpanded(\n defaultState ? {} : table.initialState?.expanded ?? {}\n )\n },\n getCanSomeRowsExpand: () => {\n return table\n .getPrePaginationRowModel()\n .flatRows.some(row => row.getCanExpand())\n },\n getToggleAllRowsExpandedHandler: () => {\n return (e: unknown) => {\n ;(e as any).persist?.()\n table.toggleAllRowsExpanded()\n }\n },\n getIsSomeRowsExpanded: () => {\n const expanded = table.getState().expanded\n return expanded === true || Object.values(expanded).some(Boolean)\n },\n getIsAllRowsExpanded: () => {\n const expanded = table.getState().expanded\n\n // If expanded is true, save some cycles and return true\n if (typeof expanded === 'boolean') {\n return expanded === true\n }\n\n if (!Object.keys(expanded).length) {\n return false\n }\n\n // If any row is not expanded, return false\n if (table.getRowModel().flatRows.some(row => !row.getIsExpanded())) {\n return false\n }\n\n // They must all be expanded :shrug:\n return true\n },\n getExpandedDepth: () => {\n let maxDepth = 0\n\n const rowIds =\n table.getState().expanded === true\n ? Object.keys(table.getRowModel().rowsById)\n : Object.keys(table.getState().expanded)\n\n rowIds.forEach(id => {\n const splitId = id.split('.')\n maxDepth = Math.max(maxDepth, splitId.length)\n })\n\n return maxDepth\n },\n getPreExpandedRowModel: () => table.getSortedRowModel(),\n getExpandedRowModel: () => {\n if (!table._getExpandedRowModel && table.options.getExpandedRowModel) {\n table._getExpandedRowModel = table.options.getExpandedRowModel(table)\n }\n\n if (table.options.manualExpanding || !table._getExpandedRowModel) {\n return table.getPreExpandedRowModel()\n }\n\n return table._getExpandedRowModel()\n },\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): ExpandedRow => {\n return {\n toggleExpanded: expanded => {\n table.setExpanded(old => {\n const exists = old === true ? true : !!old?.[row.id]\n\n let oldExpanded: ExpandedStateList = {}\n\n if (old === true) {\n Object.keys(table.getRowModel().rowsById).forEach(rowId => {\n oldExpanded[rowId] = true\n })\n } else {\n oldExpanded = old\n }\n\n expanded = expanded ?? !exists\n\n if (!exists && expanded) {\n return {\n ...oldExpanded,\n [row.id]: true,\n }\n }\n\n if (exists && !expanded) {\n const { [row.id]: _, ...rest } = oldExpanded\n return rest\n }\n\n return old\n })\n },\n getIsExpanded: () => {\n const expanded = table.getState().expanded\n\n return !!(\n table.options.getIsRowExpanded?.(row) ??\n (expanded === true || expanded?.[row.id])\n )\n },\n getCanExpand: () => {\n return (\n table.options.getRowCanExpand?.(row) ??\n ((table.options.enableExpanding ?? true) && !!row.subRows?.length)\n )\n },\n getToggleExpandedHandler: () => {\n const canExpand = row.getCanExpand()\n\n return () => {\n if (!canExpand) return\n row.toggleExpanded()\n }\n },\n }\n },\n}\n", "import { FilterFn } from './features/Filters'\n\nconst includesString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n const search = filterValue.toLowerCase()\n return Boolean(\n row\n .getValue(columnId)\n ?.toString()\n ?.toLowerCase()\n ?.includes(search)\n )\n}\n\nincludesString.autoRemove = (val: any) => testFalsey(val)\n\nconst includesStringSensitive: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return Boolean(\n row.getValue(columnId)?.toString()?.includes(filterValue)\n )\n}\n\nincludesStringSensitive.autoRemove = (val: any) => testFalsey(val)\n\nconst equalsString: FilterFn = (\n row,\n columnId: string,\n filterValue: string\n) => {\n return (\n row.getValue(columnId)?.toString()?.toLowerCase() ===\n filterValue?.toLowerCase()\n )\n}\n\nequalsString.autoRemove = (val: any) => testFalsey(val)\n\nconst arrIncludes: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId)?.includes(filterValue)\n}\n\narrIncludes.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst arrIncludesAll: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return !filterValue.some(\n val => !row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesAll.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst arrIncludesSome: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown[]\n) => {\n return filterValue.some(val =>\n row.getValue(columnId)?.includes(val)\n )\n}\n\narrIncludesSome.autoRemove = (val: any) => testFalsey(val) || !val?.length\n\nconst equals: FilterFn = (row, columnId: string, filterValue: unknown) => {\n return row.getValue(columnId) === filterValue\n}\n\nequals.autoRemove = (val: any) => testFalsey(val)\n\nconst weakEquals: FilterFn = (\n row,\n columnId: string,\n filterValue: unknown\n) => {\n return row.getValue(columnId) == filterValue\n}\n\nweakEquals.autoRemove = (val: any) => testFalsey(val)\n\nconst inNumberRange: FilterFn = (\n row,\n columnId: string,\n filterValue: [number, number]\n) => {\n let [min, max] = filterValue\n\n const rowValue = row.getValue(columnId)\n return rowValue >= min && rowValue <= max\n}\n\ninNumberRange.resolveFilterValue = (val: [any, any]) => {\n let [unsafeMin, unsafeMax] = val\n\n let parsedMin =\n typeof unsafeMin !== 'number' ? parseFloat(unsafeMin as string) : unsafeMin\n let parsedMax =\n typeof unsafeMax !== 'number' ? parseFloat(unsafeMax as string) : unsafeMax\n\n let min =\n unsafeMin === null || Number.isNaN(parsedMin) ? -Infinity : parsedMin\n let max = unsafeMax === null || Number.isNaN(parsedMax) ? Infinity : parsedMax\n\n if (min > max) {\n const temp = min\n min = max\n max = temp\n }\n\n return [min, max] as const\n}\n\ninNumberRange.autoRemove = (val: any) =>\n testFalsey(val) || (testFalsey(val[0]) && testFalsey(val[1]))\n\n// Export\n\nexport const filterFns = {\n includesString,\n includesStringSensitive,\n equalsString,\n arrIncludes,\n arrIncludesAll,\n arrIncludesSome,\n equals,\n weakEquals,\n inNumberRange,\n}\n\nexport type BuiltInFilterFn = keyof typeof filterFns\n\n// Utils\n\nfunction testFalsey(val: any) {\n return val === undefined || val === null || val === ''\n}\n", "import { RowModel } from '..'\nimport { TableFeature } from '../core/table'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n FilterMeta,\n FilterFns,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface FiltersTableState {\n columnFilters: ColumnFiltersState\n globalFilter: any\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter {\n id: string\n resolvedValue: unknown\n filterFn: FilterFn\n}\n\nexport interface FilterFn {\n (\n row: Row,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n\n resolveFilterValue?: TransformFilterValueFn\n autoRemove?: ColumnFilterAutoRemoveTestFn\n}\n\nexport type TransformFilterValueFn = (\n value: any,\n column?: Column\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn = (\n value: any,\n column?: Column\n) => boolean\n\nexport type CustomFilterFns = Record<\n string,\n FilterFn\n>\n\nexport type FilterFnOption =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn\n\nexport interface FiltersColumnDef {\n filterFn?: FilterFnOption\n enableColumnFilter?: boolean\n enableGlobalFilter?: boolean\n}\n\nexport interface FiltersColumn {\n getAutoFilterFn: () => FilterFn | undefined\n getFilterFn: () => FilterFn | undefined\n setFilterValue: (updater: Updater) => void\n getCanFilter: () => boolean\n getCanGlobalFilter: () => boolean\n getFacetedRowModel: () => RowModel\n _getFacetedRowModel?: () => RowModel\n getIsFiltered: () => boolean\n getFilterValue: () => unknown\n getFilterIndex: () => number\n getFacetedUniqueValues: () => Map\n _getFacetedUniqueValues?: () => Map\n getFacetedMinMaxValues: () => undefined | [number, number]\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n}\n\nexport interface FiltersRow {\n columnFilters: Record\n columnFiltersMeta: Record\n}\n\ninterface FiltersOptionsBase {\n enableFilters?: boolean\n manualFiltering?: boolean\n filterFromLeafRows?: boolean\n maxLeafRowFilterDepth?: number\n getFilteredRowModel?: (table: Table) => () => RowModel\n\n // Column\n onColumnFiltersChange?: OnChangeFn\n enableColumnFilters?: boolean\n\n // Global\n globalFilterFn?: FilterFnOption\n onGlobalFilterChange?: OnChangeFn\n enableGlobalFilter?: boolean\n getColumnCanGlobalFilter?: (column: Column) => boolean\n\n // Faceting\n getFacetedRowModel?: (\n table: Table,\n columnId: string\n ) => () => RowModel\n getFacetedUniqueValues?: (\n table: Table,\n columnId: string\n ) => () => Map\n getFacetedMinMaxValues?: (\n table: Table,\n columnId: string\n ) => () => undefined | [number, number]\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record>\n }\n : {\n filterFns: Record>\n }\n\nexport interface FiltersOptions\n extends FiltersOptionsBase,\n ResolvedFilterFns {}\n\nexport interface FiltersInstance {\n setColumnFilters: (updater: Updater) => void\n\n resetColumnFilters: (defaultState?: boolean) => void\n\n // Column Filters\n getPreFilteredRowModel: () => RowModel\n getFilteredRowModel: () => RowModel\n _getFilteredRowModel?: () => RowModel\n\n // Global Filters\n setGlobalFilter: (updater: Updater) => void\n resetGlobalFilter: (defaultState?: boolean) => void\n getGlobalAutoFilterFn: () => FilterFn | undefined\n getGlobalFilterFn: () => FilterFn | undefined\n getGlobalFacetedRowModel: () => RowModel\n _getGlobalFacetedRowModel?: () => RowModel\n getGlobalFacetedUniqueValues: () => Map\n _getGlobalFacetedUniqueValues?: () => Map\n getGlobalFacetedMinMaxValues: () => undefined | [number, number]\n _getGlobalFacetedMinMaxValues?: () => undefined | [number, number]\n}\n\n//\n\nexport const Filters: TableFeature = {\n getDefaultColumnDef: (): FiltersColumnDef => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): FiltersTableState => {\n return {\n columnFilters: [],\n globalFilter: undefined,\n // filtersProgress: 1,\n // facetProgress: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): FiltersOptions => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n onGlobalFilterChange: makeStateUpdater('globalFilter', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n globalFilterFn: 'auto',\n getColumnCanGlobalFilter: column => {\n const value = table\n .getCoreRowModel()\n .flatRows[0]?._getAllCellsByColumnId()\n [column.id]?.getValue()\n\n return typeof value === 'string' || typeof value === 'number'\n },\n } as FiltersOptions\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): FiltersColumn => {\n return {\n getAutoFilterFn: () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return filterFns.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns.arrIncludes\n }\n\n return filterFns.weakEquals\n },\n getFilterFn: () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n // @ts-ignore \n : table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n },\n getCanFilter: () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n },\n\n getCanGlobalFilter: () => {\n return (\n (column.columnDef.enableGlobalFilter ?? true) &&\n (table.options.enableGlobalFilter ?? true) &&\n (table.options.enableFilters ?? true) &&\n (table.options.getColumnCanGlobalFilter?.(column) ?? true) &&\n !!column.accessorFn\n )\n },\n\n getIsFiltered: () => column.getFilterIndex() > -1,\n\n getFilterValue: () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value,\n\n getFilterIndex: () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ??\n -1,\n\n setFilterValue: value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\n const previousfilter = old?.find(d => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousfilter ? previousfilter.value : undefined\n )\n\n //\n if (\n shouldAutoRemoveFilter(\n filterFn as FilterFn,\n newFilter,\n column\n )\n ) {\n return old?.filter(d => d.id !== column.id) ?? []\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousfilter) {\n return (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n },\n _getFacetedRowModel:\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, column.id),\n getFacetedRowModel: () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return column._getFacetedRowModel()\n },\n _getFacetedUniqueValues:\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, column.id),\n getFacetedUniqueValues: () => {\n if (!column._getFacetedUniqueValues) {\n return new Map()\n }\n\n return column._getFacetedUniqueValues()\n },\n _getFacetedMinMaxValues:\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, column.id),\n getFacetedMinMaxValues: () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined\n }\n\n return column._getFacetedMinMaxValues()\n },\n // () => [column.getFacetedRowModel()],\n // facetedRowModel => getRowModelMinMaxValues(facetedRowModel, column.id),\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): FiltersRow => {\n return {\n columnFilters: {},\n columnFiltersMeta: {},\n }\n },\n\n createTable: (\n table: Table\n ): FiltersInstance => {\n return {\n getGlobalAutoFilterFn: () => {\n return filterFns.includesString\n },\n\n getGlobalFilterFn: () => {\n const { globalFilterFn: globalFilterFn } = table.options\n\n return isFunction(globalFilterFn)\n ? globalFilterFn\n : globalFilterFn === 'auto'\n ? table.getGlobalAutoFilterFn()\n // @ts-ignore\n : table.options.filterFns?.[globalFilterFn as string] ??\n filterFns[globalFilterFn as BuiltInFilterFn]\n },\n\n setColumnFilters: (updater: Updater) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n },\n\n setGlobalFilter: updater => {\n table.options.onGlobalFilterChange?.(updater)\n },\n\n resetGlobalFilter: defaultState => {\n table.setGlobalFilter(\n defaultState ? undefined : table.initialState.globalFilter\n )\n },\n\n resetColumnFilters: defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n },\n\n getPreFilteredRowModel: () => table.getCoreRowModel(),\n getFilteredRowModel: () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n },\n\n _getGlobalFacetedRowModel:\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, '__global__'),\n\n getGlobalFacetedRowModel: () => {\n if (table.options.manualFiltering || !table._getGlobalFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getGlobalFacetedRowModel()\n },\n\n _getGlobalFacetedUniqueValues:\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, '__global__'),\n getGlobalFacetedUniqueValues: () => {\n if (!table._getGlobalFacetedUniqueValues) {\n return new Map()\n }\n\n return table._getGlobalFacetedUniqueValues()\n },\n\n _getGlobalFacetedMinMaxValues:\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, '__global__'),\n getGlobalFacetedMinMaxValues: () => {\n if (!table._getGlobalFacetedMinMaxValues) {\n return\n }\n\n return table._getGlobalFacetedMinMaxValues()\n },\n }\n },\n}\n\nexport function shouldAutoRemoveFilter(\n filterFn?: FilterFn,\n value?: any,\n column?: Column\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n", "import { AggregationFn } from './features/Grouping'\nimport { isNumberArray } from './utils'\n\nconst sum: AggregationFn = (columnId, _leafRows, childRows) => {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return childRows.reduce((sum, next) => {\n const nextValue = next.getValue(columnId)\n return sum + (typeof nextValue === 'number' ? nextValue : 0)\n }, 0)\n}\n\nconst min: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n\n if (\n value != null &&\n (min! > value || (min === undefined && value >= value))\n ) {\n min = value\n }\n })\n\n return min\n}\n\nconst max: AggregationFn = (columnId, _leafRows, childRows) => {\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (\n value != null &&\n (max! < value || (max === undefined && value >= value))\n ) {\n max = value\n }\n })\n\n return max\n}\n\nconst extent: AggregationFn = (columnId, _leafRows, childRows) => {\n let min: number | undefined\n let max: number | undefined\n\n childRows.forEach(row => {\n const value = row.getValue(columnId)\n if (value != null) {\n if (min === undefined) {\n if (value >= value) min = max = value\n } else {\n if (min > value) min = value\n if (max! < value) max = value\n }\n }\n })\n\n return [min, max]\n}\n\nconst mean: AggregationFn = (columnId, leafRows) => {\n let count = 0\n let sum = 0\n\n leafRows.forEach(row => {\n let value = row.getValue(columnId)\n if (value != null && (value = +value) >= value) {\n ++count, (sum += value)\n }\n })\n\n if (count) return sum / count\n\n return\n}\n\nconst median: AggregationFn = (columnId, leafRows) => {\n if (!leafRows.length) {\n return\n }\n\n const values = leafRows.map(row => row.getValue(columnId))\n if (!isNumberArray(values)) {\n return\n }\n if (values.length === 1) {\n return values[0]\n }\n\n const mid = Math.floor(values.length / 2)\n const nums = values.sort((a, b) => a - b)\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1]! + nums[mid]!) / 2\n}\n\nconst unique: AggregationFn = (columnId, leafRows) => {\n return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values())\n}\n\nconst uniqueCount: AggregationFn = (columnId, leafRows) => {\n return new Set(leafRows.map(d => d.getValue(columnId))).size\n}\n\nconst count: AggregationFn = (_columnId, leafRows) => {\n return leafRows.length\n}\n\nexport const aggregationFns = {\n sum,\n min,\n max,\n extent,\n mean,\n median,\n unique,\n uniqueCount,\n count,\n}\n\nexport type BuiltInAggregationFn = keyof typeof aggregationFns\n", "import { RowModel } from '..'\nimport { BuiltInAggregationFn, aggregationFns } from '../aggregationFns'\nimport { TableFeature } from '../core/table'\nimport {\n Cell,\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n ColumnDefTemplate,\n RowData,\n AggregationFns,\n} from '../types'\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type GroupingState = string[]\n\nexport interface GroupingTableState {\n grouping: GroupingState\n}\n\nexport type AggregationFn = (\n columnId: string,\n leafRows: Row[],\n childRows: Row[]\n) => any\n\nexport type CustomAggregationFns = Record>\n\nexport type AggregationFnOption =\n | 'auto'\n | keyof AggregationFns\n | BuiltInAggregationFn\n | AggregationFn\n\nexport interface GroupingColumnDef {\n aggregationFn?: AggregationFnOption\n aggregatedCell?: ColumnDefTemplate<\n ReturnType['getContext']>\n >\n enableGrouping?: boolean\n getGroupingValue?: (row: TData) => any\n}\n\nexport interface GroupingColumn {\n getCanGroup: () => boolean\n getIsGrouped: () => boolean\n getGroupedIndex: () => number\n toggleGrouping: () => void\n getToggleGroupingHandler: () => () => void\n getAutoAggregationFn: () => AggregationFn | undefined\n getAggregationFn: () => AggregationFn | undefined\n}\n\nexport interface GroupingRow {\n groupingColumnId?: string\n groupingValue?: unknown\n getIsGrouped: () => boolean\n getGroupingValue: (columnId: string) => unknown\n _groupingValuesCache: Record\n}\n\nexport interface GroupingCell {\n getIsGrouped: () => boolean\n getIsPlaceholder: () => boolean\n getIsAggregated: () => boolean\n}\n\nexport interface ColumnDefaultOptions {\n // Column\n onGroupingChange: OnChangeFn\n enableGrouping: boolean\n}\n\ninterface GroupingOptionsBase {\n manualGrouping?: boolean\n onGroupingChange?: OnChangeFn\n enableGrouping?: boolean\n getGroupedRowModel?: (table: Table) => () => RowModel\n groupedColumnMode?: false | 'reorder' | 'remove'\n}\n\ntype ResolvedAggregationFns = keyof AggregationFns extends never\n ? {\n aggregationFns?: Record>\n }\n : {\n aggregationFns: Record>\n }\n\nexport interface GroupingOptions\n extends GroupingOptionsBase,\n ResolvedAggregationFns {}\n\nexport type GroupingColumnMode = false | 'reorder' | 'remove'\n\nexport interface GroupingInstance {\n setGrouping: (updater: Updater) => void\n resetGrouping: (defaultState?: boolean) => void\n getPreGroupedRowModel: () => RowModel\n getGroupedRowModel: () => RowModel\n _getGroupedRowModel?: () => RowModel\n}\n\n//\n\nexport const Grouping: TableFeature = {\n getDefaultColumnDef: (): GroupingColumnDef<\n TData,\n unknown\n > => {\n return {\n aggregatedCell: props => (props.getValue() as any)?.toString?.() ?? null,\n aggregationFn: 'auto',\n }\n },\n\n getInitialState: (state): GroupingTableState => {\n return {\n grouping: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): GroupingOptions => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder',\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): GroupingColumn => {\n return {\n toggleGrouping: () => {\n table.setGrouping(old => {\n // Find any existing grouping for this column\n if (old?.includes(column.id)) {\n return old.filter(d => d !== column.id)\n }\n\n return [...(old ?? []), column.id]\n })\n },\n\n getCanGroup: () => {\n return (\n column.columnDef.enableGrouping ??\n true ??\n table.options.enableGrouping ??\n true ??\n !!column.accessorFn\n )\n },\n\n getIsGrouped: () => {\n return table.getState().grouping?.includes(column.id)\n },\n\n getGroupedIndex: () => table.getState().grouping?.indexOf(column.id),\n\n getToggleGroupingHandler: () => {\n const canGroup = column.getCanGroup()\n\n return () => {\n if (!canGroup) return\n column.toggleGrouping()\n }\n },\n getAutoAggregationFn: () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns.extent\n }\n },\n getAggregationFn: () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column.getAutoAggregationFn()\n : table.options.aggregationFns?.[\n column.columnDef.aggregationFn as string\n ] ??\n aggregationFns[\n column.columnDef.aggregationFn as BuiltInAggregationFn\n ]\n },\n }\n },\n\n createTable: (\n table: Table\n ): GroupingInstance => {\n return {\n setGrouping: updater => table.options.onGroupingChange?.(updater),\n\n resetGrouping: defaultState => {\n table.setGrouping(\n defaultState ? [] : table.initialState?.grouping ?? []\n )\n },\n\n getPreGroupedRowModel: () => table.getFilteredRowModel(),\n getGroupedRowModel: () => {\n if (!table._getGroupedRowModel && table.options.getGroupedRowModel) {\n table._getGroupedRowModel = table.options.getGroupedRowModel(table)\n }\n\n if (table.options.manualGrouping || !table._getGroupedRowModel) {\n return table.getPreGroupedRowModel()\n }\n\n return table._getGroupedRowModel()\n },\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): GroupingRow => {\n return {\n getIsGrouped: () => !!row.groupingColumnId,\n getGroupingValue: columnId => {\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original\n )\n\n return row._groupingValuesCache[columnId]\n },\n _groupingValuesCache: {},\n }\n },\n\n createCell: (\n cell: Cell,\n column: Column,\n row: Row,\n table: Table\n ): GroupingCell => {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n return {\n getIsGrouped: () =>\n column.getIsGrouped() && column.id === row.groupingColumnId,\n getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),\n getIsAggregated: () =>\n !cell.getIsGrouped() &&\n !cell.getIsPlaceholder() &&\n !!row.subRows?.length,\n }\n },\n}\n\nexport function orderColumns(\n leafColumns: Column[],\n grouping: string[],\n groupedColumnMode?: GroupingColumnMode\n) {\n if (!grouping?.length || !groupedColumnMode) {\n return leafColumns\n }\n\n const nonGroupingColumns = leafColumns.filter(\n col => !grouping.includes(col.id)\n )\n\n if (groupedColumnMode === 'remove') {\n return nonGroupingColumns\n }\n\n const groupingColumns = grouping\n .map(g => leafColumns.find(col => col.id === g)!)\n .filter(Boolean)\n\n return [...groupingColumns, ...nonGroupingColumns]\n}\n", "import { makeStateUpdater, memo } from '../utils'\n\nimport { Table, OnChangeFn, Updater, Column, RowData } from '../types'\n\nimport { orderColumns } from './Grouping'\nimport { TableFeature } from '../core/table'\n\nexport interface ColumnOrderTableState {\n columnOrder: ColumnOrderState\n}\n\nexport type ColumnOrderState = string[]\n\nexport interface ColumnOrderOptions {\n onColumnOrderChange?: OnChangeFn\n}\n\nexport interface ColumnOrderDefaultOptions {\n onColumnOrderChange: OnChangeFn\n}\n\nexport interface ColumnOrderInstance {\n setColumnOrder: (updater: Updater) => void\n resetColumnOrder: (defaultState?: boolean) => void\n _getOrderColumnsFn: () => (\n columns: Column[]\n ) => Column[]\n}\n\n//\n\nexport const Ordering: TableFeature = {\n getInitialState: (state): ColumnOrderTableState => {\n return {\n columnOrder: [],\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnOrderDefaultOptions => {\n return {\n onColumnOrderChange: makeStateUpdater('columnOrder', table),\n }\n },\n\n createTable: (\n table: Table\n ): ColumnOrderInstance => {\n return {\n setColumnOrder: updater => table.options.onColumnOrderChange?.(updater),\n resetColumnOrder: defaultState => {\n table.setColumnOrder(\n defaultState ? [] : table.initialState.columnOrder ?? []\n )\n },\n _getOrderColumnsFn: memo(\n () => [\n table.getState().columnOrder,\n table.getState().grouping,\n table.options.groupedColumnMode,\n ],\n (columnOrder, grouping, groupedColumnMode) => columns => {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n let orderedColumns: Column[] = []\n\n // If there is no order, return the normal columns\n if (!columnOrder?.length) {\n orderedColumns = columns\n } else {\n const columnOrderCopy = [...columnOrder]\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns]\n\n // And make a new ordered array of the columns\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift()\n const foundIndex = columnsCopy.findIndex(\n d => d.id === targetColumnId\n )\n if (foundIndex > -1) {\n orderedColumns.push(columnsCopy.splice(foundIndex, 1)[0]!)\n }\n }\n\n // If there are any columns left, add them to the end\n orderedColumns = [...orderedColumns, ...columnsCopy]\n }\n\n return orderColumns(orderedColumns, grouping, groupedColumnMode)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getOrderColumnsFn',\n // debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n ),\n }\n },\n}\n", "import { TableFeature } from '../core/table'\nimport { OnChangeFn, Table, RowModel, Updater, RowData } from '../types'\nimport { functionalUpdate, makeStateUpdater, memo } from '../utils'\n\nexport interface PaginationState {\n pageIndex: number\n pageSize: number\n}\n\nexport interface PaginationTableState {\n pagination: PaginationState\n}\n\nexport interface PaginationInitialTableState {\n pagination?: Partial\n}\n\nexport interface PaginationOptions {\n pageCount?: number\n manualPagination?: boolean\n onPaginationChange?: OnChangeFn\n autoResetPageIndex?: boolean\n getPaginationRowModel?: (table: Table) => () => RowModel\n}\n\nexport interface PaginationDefaultOptions {\n onPaginationChange: OnChangeFn\n}\n\nexport interface PaginationInstance {\n _autoResetPageIndex: () => void\n setPagination: (updater: Updater) => void\n resetPagination: (defaultState?: boolean) => void\n setPageIndex: (updater: Updater) => void\n resetPageIndex: (defaultState?: boolean) => void\n setPageSize: (updater: Updater) => void\n resetPageSize: (defaultState?: boolean) => void\n setPageCount: (updater: Updater) => void\n getPageOptions: () => number[]\n getCanPreviousPage: () => boolean\n getCanNextPage: () => boolean\n previousPage: () => void\n nextPage: () => void\n getPrePaginationRowModel: () => RowModel\n getPaginationRowModel: () => RowModel\n _getPaginationRowModel?: () => RowModel\n getPageCount: () => number\n}\n\n//\n\nconst defaultPageIndex = 0\nconst defaultPageSize = 10\n\nconst getDefaultPaginationState = (): PaginationState => ({\n pageIndex: defaultPageIndex,\n pageSize: defaultPageSize,\n})\n\nexport const Pagination: TableFeature = {\n getInitialState: (state): PaginationTableState => {\n return {\n ...state,\n pagination: {\n ...getDefaultPaginationState(),\n ...state?.pagination,\n },\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): PaginationDefaultOptions => {\n return {\n onPaginationChange: makeStateUpdater('pagination', table),\n }\n },\n\n createTable: (\n table: Table\n ): PaginationInstance => {\n let registered = false\n let queued = false\n\n return {\n _autoResetPageIndex: () => {\n if (!registered) {\n table._queue(() => {\n registered = true\n })\n return\n }\n\n if (\n table.options.autoResetAll ??\n table.options.autoResetPageIndex ??\n !table.options.manualPagination\n ) {\n if (queued) return\n queued = true\n table._queue(() => {\n table.resetPageIndex()\n queued = false\n })\n }\n },\n setPagination: updater => {\n const safeUpdater: Updater = old => {\n let newState = functionalUpdate(updater, old)\n\n return newState\n }\n\n return table.options.onPaginationChange?.(safeUpdater)\n },\n resetPagination: defaultState => {\n table.setPagination(\n defaultState\n ? getDefaultPaginationState()\n : table.initialState.pagination ?? getDefaultPaginationState()\n )\n },\n setPageIndex: updater => {\n table.setPagination(old => {\n let pageIndex = functionalUpdate(updater, old.pageIndex)\n\n const maxPageIndex =\n typeof table.options.pageCount === 'undefined' ||\n table.options.pageCount === -1\n ? Number.MAX_SAFE_INTEGER\n : table.options.pageCount - 1\n\n pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))\n\n return {\n ...old,\n pageIndex,\n }\n })\n },\n resetPageIndex: defaultState => {\n table.setPageIndex(\n defaultState\n ? defaultPageIndex\n : table.initialState?.pagination?.pageIndex ?? defaultPageIndex\n )\n },\n resetPageSize: defaultState => {\n table.setPageSize(\n defaultState\n ? defaultPageSize\n : table.initialState?.pagination?.pageSize ?? defaultPageSize\n )\n },\n setPageSize: updater => {\n table.setPagination(old => {\n const pageSize = Math.max(1, functionalUpdate(updater, old.pageSize))\n const topRowIndex = old.pageSize * old.pageIndex!\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...old,\n pageIndex,\n pageSize,\n }\n })\n },\n setPageCount: updater =>\n table.setPagination(old => {\n let newPageCount = functionalUpdate(\n updater,\n table.options.pageCount ?? -1\n )\n\n if (typeof newPageCount === 'number') {\n newPageCount = Math.max(-1, newPageCount)\n }\n\n return {\n ...old,\n pageCount: newPageCount,\n }\n }),\n\n getPageOptions: memo(\n () => [table.getPageCount()],\n pageCount => {\n let pageOptions: number[] = []\n if (pageCount && pageCount > 0) {\n pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i)\n }\n return pageOptions\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getPageOptions',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n ),\n\n getCanPreviousPage: () => table.getState().pagination.pageIndex > 0,\n\n getCanNextPage: () => {\n const { pageIndex } = table.getState().pagination\n\n const pageCount = table.getPageCount()\n\n if (pageCount === -1) {\n return true\n }\n\n if (pageCount === 0) {\n return false\n }\n\n return pageIndex < pageCount - 1\n },\n\n previousPage: () => {\n return table.setPageIndex(old => old - 1)\n },\n\n nextPage: () => {\n return table.setPageIndex(old => {\n return old + 1\n })\n },\n\n getPrePaginationRowModel: () => table.getExpandedRowModel(),\n getPaginationRowModel: () => {\n if (\n !table._getPaginationRowModel &&\n table.options.getPaginationRowModel\n ) {\n table._getPaginationRowModel =\n table.options.getPaginationRowModel(table)\n }\n\n if (table.options.manualPagination || !table._getPaginationRowModel) {\n return table.getPrePaginationRowModel()\n }\n\n return table._getPaginationRowModel()\n },\n\n getPageCount: () => {\n return (\n table.options.pageCount ??\n Math.ceil(\n table.getPrePaginationRowModel().rows.length /\n table.getState().pagination.pageSize\n )\n )\n },\n }\n },\n}\n", "import { TableFeature } from '../core/table'\nimport {\n OnChangeFn,\n Updater,\n Table,\n Column,\n Row,\n Cell,\n RowData,\n} from '../types'\nimport { makeStateUpdater, memo } from '../utils'\n\nexport type ColumnPinningPosition = false | 'left' | 'right'\n\nexport interface ColumnPinningState {\n left?: string[]\n right?: string[]\n}\n\nexport interface ColumnPinningTableState {\n columnPinning: ColumnPinningState\n}\n\nexport interface ColumnPinningOptions {\n onColumnPinningChange?: OnChangeFn\n enablePinning?: boolean\n}\n\nexport interface ColumnPinningDefaultOptions {\n onColumnPinningChange: OnChangeFn\n}\n\nexport interface ColumnPinningColumnDef {\n enablePinning?: boolean\n}\n\nexport interface ColumnPinningColumn {\n getCanPin: () => boolean\n getPinnedIndex: () => number\n getIsPinned: () => ColumnPinningPosition\n pin: (position: ColumnPinningPosition) => void\n}\n\nexport interface ColumnPinningRow {\n getLeftVisibleCells: () => Cell[]\n getCenterVisibleCells: () => Cell[]\n getRightVisibleCells: () => Cell[]\n}\n\nexport interface ColumnPinningInstance {\n setColumnPinning: (updater: Updater) => void\n resetColumnPinning: (defaultState?: boolean) => void\n getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean\n getLeftLeafColumns: () => Column[]\n getRightLeafColumns: () => Column[]\n getCenterLeafColumns: () => Column[]\n}\n\n//\n\nconst getDefaultPinningState = (): ColumnPinningState => ({\n left: [],\n right: [],\n})\n\nexport const Pinning: TableFeature = {\n getInitialState: (state): ColumnPinningTableState => {\n return {\n columnPinning: getDefaultPinningState(),\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): ColumnPinningDefaultOptions => {\n return {\n onColumnPinningChange: makeStateUpdater('columnPinning', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): ColumnPinningColumn => {\n return {\n pin: position => {\n const columnIds = column\n .getLeafColumns()\n .map(d => d.id)\n .filter(Boolean) as string[]\n\n table.setColumnPinning(old => {\n if (position === 'right') {\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: [\n ...(old?.right ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n }\n }\n\n if (position === 'left') {\n return {\n left: [\n ...(old?.left ?? []).filter(d => !columnIds?.includes(d)),\n ...columnIds,\n ],\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n }\n\n return {\n left: (old?.left ?? []).filter(d => !columnIds?.includes(d)),\n right: (old?.right ?? []).filter(d => !columnIds?.includes(d)),\n }\n })\n },\n\n getCanPin: () => {\n const leafColumns = column.getLeafColumns()\n\n return leafColumns.some(\n d =>\n (d.columnDef.enablePinning ?? true) &&\n (table.options.enablePinning ?? true)\n )\n },\n\n getIsPinned: () => {\n const leafColumnIds = column.getLeafColumns().map(d => d.id)\n\n const { left, right } = table.getState().columnPinning\n\n const isLeft = leafColumnIds.some(d => left?.includes(d))\n const isRight = leafColumnIds.some(d => right?.includes(d))\n\n return isLeft ? 'left' : isRight ? 'right' : false\n },\n\n getPinnedIndex: () => {\n const position = column.getIsPinned()\n\n return position\n ? table.getState().columnPinning?.[position]?.indexOf(column.id) ?? -1\n : 0\n },\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): ColumnPinningRow => {\n return {\n getCenterVisibleCells: memo(\n () => [\n row._getAllVisibleCells(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allCells, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allCells.filter(d => !leftAndRight.includes(d.column.id))\n },\n {\n key:\n process.env.NODE_ENV === 'production' &&\n 'row.getCenterVisibleCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n getLeftVisibleCells: memo(\n () => [\n row._getAllVisibleCells(),\n table.getState().columnPinning.left,\n ,\n ],\n (allCells, left) => {\n const cells = (left ?? [])\n .map(\n columnId => allCells.find(cell => cell.column.id === columnId)!\n )\n .filter(Boolean)\n .map(d => ({ ...d, position: 'left' } as Cell))\n\n return cells\n },\n {\n key:\n process.env.NODE_ENV === 'production' && 'row.getLeftVisibleCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n getRightVisibleCells: memo(\n () => [row._getAllVisibleCells(), table.getState().columnPinning.right],\n (allCells, right) => {\n const cells = (right ?? [])\n .map(\n columnId => allCells.find(cell => cell.column.id === columnId)!\n )\n .filter(Boolean)\n .map(d => ({ ...d, position: 'right' } as Cell))\n\n return cells\n },\n {\n key:\n process.env.NODE_ENV === 'production' && 'row.getRightVisibleCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n }\n },\n\n createTable: (\n table: Table\n ): ColumnPinningInstance => {\n return {\n setColumnPinning: updater =>\n table.options.onColumnPinningChange?.(updater),\n\n resetColumnPinning: defaultState =>\n table.setColumnPinning(\n defaultState\n ? getDefaultPinningState()\n : table.initialState?.columnPinning ?? getDefaultPinningState()\n ),\n\n getIsSomeColumnsPinned: position => {\n const pinningState = table.getState().columnPinning\n\n if (!position) {\n return Boolean(\n pinningState.left?.length || pinningState.right?.length\n )\n }\n return Boolean(pinningState[position]?.length)\n },\n\n getLeftLeafColumns: memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.left],\n (allColumns, left) => {\n return (left ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getLeftLeafColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n\n getRightLeafColumns: memo(\n () => [table.getAllLeafColumns(), table.getState().columnPinning.right],\n (allColumns, right) => {\n return (right ?? [])\n .map(columnId => allColumns.find(column => column.id === columnId)!)\n .filter(Boolean)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getRightLeafColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n\n getCenterLeafColumns: memo(\n () => [\n table.getAllLeafColumns(),\n table.getState().columnPinning.left,\n table.getState().columnPinning.right,\n ],\n (allColumns, left, right) => {\n const leftAndRight: string[] = [...(left ?? []), ...(right ?? [])]\n\n return allColumns.filter(d => !leftAndRight.includes(d.id))\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getCenterLeafColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n }\n },\n}\n", "import { TableFeature } from '../core/table'\nimport { OnChangeFn, Table, Row, RowModel, Updater, RowData } from '../types'\nimport { makeStateUpdater, memo } from '../utils'\n\nexport type RowSelectionState = Record\n\nexport interface RowSelectionTableState {\n rowSelection: RowSelectionState\n}\n\nexport interface RowSelectionOptions {\n enableRowSelection?: boolean | ((row: Row) => boolean)\n enableMultiRowSelection?: boolean | ((row: Row) => boolean)\n enableSubRowSelection?: boolean | ((row: Row) => boolean)\n onRowSelectionChange?: OnChangeFn\n // enableGroupingRowSelection?:\n // | boolean\n // | ((\n // row: Row\n // ) => boolean)\n // isAdditiveSelectEvent?: (e: unknown) => boolean\n // isInclusiveSelectEvent?: (e: unknown) => boolean\n // selectRowsFn?: (\n // table: Table,\n // rowModel: RowModel\n // ) => RowModel\n}\n\nexport interface RowSelectionRow {\n getIsSelected: () => boolean\n getIsSomeSelected: () => boolean\n getIsAllSubRowsSelected: () => boolean\n getCanSelect: () => boolean\n getCanMultiSelect: () => boolean\n getCanSelectSubRows: () => boolean\n toggleSelected: (value?: boolean) => void\n getToggleSelectedHandler: () => (event: unknown) => void\n}\n\nexport interface RowSelectionInstance {\n getToggleAllRowsSelectedHandler: () => (event: unknown) => void\n getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void\n setRowSelection: (updater: Updater) => void\n resetRowSelection: (defaultState?: boolean) => void\n getIsAllRowsSelected: () => boolean\n getIsAllPageRowsSelected: () => boolean\n getIsSomeRowsSelected: () => boolean\n getIsSomePageRowsSelected: () => boolean\n toggleAllRowsSelected: (value?: boolean) => void\n toggleAllPageRowsSelected: (value?: boolean) => void\n getPreSelectedRowModel: () => RowModel\n getSelectedRowModel: () => RowModel\n getFilteredSelectedRowModel: () => RowModel\n getGroupedSelectedRowModel: () => RowModel\n}\n\n//\n\nexport const RowSelection: TableFeature = {\n getInitialState: (state): RowSelectionTableState => {\n return {\n rowSelection: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): RowSelectionOptions => {\n return {\n onRowSelectionChange: makeStateUpdater('rowSelection', table),\n enableRowSelection: true,\n enableMultiRowSelection: true,\n enableSubRowSelection: true,\n // enableGroupingRowSelection: false,\n // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,\n // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,\n }\n },\n\n createTable: (\n table: Table\n ): RowSelectionInstance => {\n return {\n setRowSelection: updater => table.options.onRowSelectionChange?.(updater),\n resetRowSelection: defaultState =>\n table.setRowSelection(\n defaultState ? {} : table.initialState.rowSelection ?? {}\n ),\n toggleAllRowsSelected: value => {\n table.setRowSelection(old => {\n value =\n typeof value !== 'undefined' ? value : !table.getIsAllRowsSelected()\n\n const rowSelection = { ...old }\n\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach(row => {\n if (!row.getCanSelect()) {\n return\n }\n rowSelection[row.id] = true\n })\n } else {\n preGroupedFlatRows.forEach(row => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n },\n toggleAllPageRowsSelected: value =>\n table.setRowSelection(old => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !table.getIsAllPageRowsSelected()\n\n const rowSelection: RowSelectionState = { ...old }\n\n table.getRowModel().rows.forEach(row => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, table)\n })\n\n return rowSelection\n }),\n\n // addRowSelectionRange: rowId => {\n // const {\n // rows,\n // rowsById,\n // options: { selectGroupingRows, selectSubRows },\n // } = table\n\n // const findSelectedRow = (rows: Row[]) => {\n // let found\n // rows.find(d => {\n // if (d.getIsSelected()) {\n // found = d\n // return true\n // }\n // const subFound = findSelectedRow(d.subRows || [])\n // if (subFound) {\n // found = subFound\n // return true\n // }\n // return false\n // })\n // return found\n // }\n\n // const firstRow = findSelectedRow(rows) || rows[0]\n // const lastRow = rowsById[rowId]\n\n // let include = false\n // const selectedRowIds = {}\n\n // const addRow = (row: Row) => {\n // mutateRowIsSelected(selectedRowIds, row.id, true, {\n // rowsById,\n // selectGroupingRows: selectGroupingRows!,\n // selectSubRows: selectSubRows!,\n // })\n // }\n\n // table.rows.forEach(row => {\n // const isFirstRow = row.id === firstRow.id\n // const isLastRow = row.id === lastRow.id\n\n // if (isFirstRow || isLastRow) {\n // if (!include) {\n // include = true\n // } else if (include) {\n // addRow(row)\n // include = false\n // }\n // }\n\n // if (include) {\n // addRow(row)\n // }\n // })\n\n // table.setRowSelection(selectedRowIds)\n // },\n getPreSelectedRowModel: () => table.getCoreRowModel(),\n getSelectedRowModel: memo(\n () => [table.getState().rowSelection, table.getCoreRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getSelectedRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n ),\n\n getFilteredSelectedRowModel: memo(\n () => [table.getState().rowSelection, table.getFilteredRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n {\n key:\n process.env.NODE_ENV === 'production' &&\n 'getFilteredSelectedRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n ),\n\n getGroupedSelectedRowModel: memo(\n () => [table.getState().rowSelection, table.getSortedRowModel()],\n (rowSelection, rowModel) => {\n if (!Object.keys(rowSelection).length) {\n return {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n }\n\n return selectRowsFn(table, rowModel)\n },\n {\n key:\n process.env.NODE_ENV === 'production' &&\n 'getGroupedSelectedRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n ),\n\n ///\n\n // getGroupingRowCanSelect: rowId => {\n // const row = table.getRow(rowId)\n\n // if (!row) {\n // throw new Error()\n // }\n\n // if (typeof table.options.enableGroupingRowSelection === 'function') {\n // return table.options.enableGroupingRowSelection(row)\n // }\n\n // return table.options.enableGroupingRowSelection ?? false\n // },\n\n getIsAllRowsSelected: () => {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const { rowSelection } = table.getState()\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n row => row.getCanSelect() && !rowSelection[row.id]\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n },\n\n getIsAllPageRowsSelected: () => {\n const paginationFlatRows = table\n .getPaginationRowModel()\n .flatRows.filter(row => row.getCanSelect())\n const { rowSelection } = table.getState()\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some(row => !rowSelection[row.id])\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n },\n\n getIsSomeRowsSelected: () => {\n const totalSelected = Object.keys(\n table.getState().rowSelection ?? {}\n ).length\n return (\n totalSelected > 0 &&\n totalSelected < table.getFilteredRowModel().flatRows.length\n )\n },\n\n getIsSomePageRowsSelected: () => {\n const paginationFlatRows = table.getPaginationRowModel().flatRows\n return table.getIsAllPageRowsSelected()\n ? false\n : paginationFlatRows\n .filter(row => row.getCanSelect())\n .some(d => d.getIsSelected() || d.getIsSomeSelected())\n },\n\n getToggleAllRowsSelectedHandler: () => {\n return (e: unknown) => {\n table.toggleAllRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n },\n\n getToggleAllPageRowsSelectedHandler: () => {\n return (e: unknown) => {\n table.toggleAllPageRowsSelected(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n },\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): RowSelectionRow => {\n return {\n toggleSelected: value => {\n const isSelected = row.getIsSelected()\n\n table.setRowSelection(old => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n if (isSelected === value) {\n return old\n }\n\n const selectedRowIds = { ...old }\n\n mutateRowIsSelected(selectedRowIds, row.id, value, table)\n\n return selectedRowIds\n })\n },\n getIsSelected: () => {\n const { rowSelection } = table.getState()\n return isRowSelected(row, rowSelection)\n },\n\n getIsSomeSelected: () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'some'\n },\n\n getIsAllSubRowsSelected: () => {\n const { rowSelection } = table.getState()\n return isSubRowSelected(row, rowSelection, table) === 'all'\n },\n\n getCanSelect: () => {\n if (typeof table.options.enableRowSelection === 'function') {\n return table.options.enableRowSelection(row)\n }\n\n return table.options.enableRowSelection ?? true\n },\n\n getCanSelectSubRows: () => {\n if (typeof table.options.enableSubRowSelection === 'function') {\n return table.options.enableSubRowSelection(row)\n }\n\n return table.options.enableSubRowSelection ?? true\n },\n\n getCanMultiSelect: () => {\n if (typeof table.options.enableMultiRowSelection === 'function') {\n return table.options.enableMultiRowSelection(row)\n }\n\n return table.options.enableMultiRowSelection ?? true\n },\n getToggleSelectedHandler: () => {\n const canSelect = row.getCanSelect()\n\n return (e: unknown) => {\n if (!canSelect) return\n row.toggleSelected(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n },\n }\n },\n}\n\nconst mutateRowIsSelected = (\n selectedRowIds: Record,\n id: string,\n value: boolean,\n table: Table\n) => {\n const row = table.getRow(id)\n\n // const isGrouped = row.getIsGrouped()\n\n // if ( // TODO: enforce grouping row selection rules\n // !isGrouped ||\n // (isGrouped && table.options.enableGroupingRowSelection)\n // ) {\n if (value) {\n if (!row.getCanMultiSelect()) {\n Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key])\n }\n if (row.getCanSelect()) {\n selectedRowIds[id] = true\n }\n } else {\n delete selectedRowIds[id]\n }\n // }\n\n if (row.subRows?.length && row.getCanSelectSubRows()) {\n row.subRows.forEach(row =>\n mutateRowIsSelected(selectedRowIds, row.id, value, table)\n )\n }\n}\n\nexport function selectRowsFn(\n table: Table,\n rowModel: RowModel\n): RowModel {\n const rowSelection = table.getState().rowSelection\n\n const newSelectedFlatRows: Row[] = []\n const newSelectedRowsById: Record> = {}\n\n // Filters top level and nested rows\n const recurseRows = (rows: Row[], depth = 0): Row[] => {\n return rows\n .map(row => {\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows?.length) {\n row = {\n ...row,\n subRows: recurseRows(row.subRows, depth + 1),\n }\n }\n\n if (isSelected) {\n return row\n }\n })\n .filter(Boolean) as Row[]\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\nexport function isRowSelected(\n row: Row,\n selection: Record\n): boolean {\n return selection[row.id] ?? false\n}\n\nexport function isSubRowSelected(\n row: Row,\n selection: Record,\n table: Table\n): boolean | 'some' | 'all' {\n if (row.subRows && row.subRows.length) {\n let allChildrenSelected = true\n let someSelected = false\n\n row.subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (isRowSelected(subRow, selection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n })\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n }\n\n return false\n}\n", "import { SortingFn } from './features/Sorting'\n\nexport const reSplitAlphaNumeric = /([0-9]+)/gm\n\nconst alphanumeric: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\nconst alphanumericCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareAlphanumeric(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst text: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)).toLowerCase(),\n toString(rowB.getValue(columnId)).toLowerCase()\n )\n}\n\n// The text filter is more basic (less numeric support)\n// but is much faster\nconst textCaseSensitive: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(\n toString(rowA.getValue(columnId)),\n toString(rowB.getValue(columnId))\n )\n}\n\nconst datetime: SortingFn = (rowA, rowB, columnId) => {\n const a = rowA.getValue(columnId)\n const b = rowB.getValue(columnId)\n\n // Can handle nullish values\n // Use > and < because == (and ===) doesn't work with\n // Date objects (would require calling getTime()).\n return a > b ? 1 : a < b ? -1 : 0\n}\n\nconst basic: SortingFn = (rowA, rowB, columnId) => {\n return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId))\n}\n\n// Utils\n\nfunction compareBasic(a: any, b: any) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction toString(a: any) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nfunction compareAlphanumeric(aStr: string, bStr: string) {\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n const a = aStr.split(reSplitAlphaNumeric).filter(Boolean)\n const b = bStr.split(reSplitAlphaNumeric).filter(Boolean)\n\n // While\n while (a.length && b.length) {\n const aa = a.shift()!\n const bb = b.shift()!\n\n const an = parseInt(aa, 10)\n const bn = parseInt(bb, 10)\n\n const combo = [an, bn].sort()\n\n // Both are string\n if (isNaN(combo[0]!)) {\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1]!)) {\n return isNaN(an) ? -1 : 1\n }\n\n // Both are numbers\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n }\n\n return a.length - b.length\n}\n\n// Exports\n\nexport const sortingFns = {\n alphanumeric,\n alphanumericCaseSensitive,\n text,\n textCaseSensitive,\n datetime,\n basic,\n}\n\nexport type BuiltInSortingFn = keyof typeof sortingFns\n", "import { RowModel } from '..'\nimport { TableFeature } from '../core/table'\nimport {\n BuiltInSortingFn,\n reSplitAlphaNumeric,\n sortingFns,\n} from '../sortingFns'\n\nimport {\n Column,\n OnChangeFn,\n Table,\n Row,\n Updater,\n RowData,\n SortingFns,\n} from '../types'\n\nimport { isFunction, makeStateUpdater } from '../utils'\n\nexport type SortDirection = 'asc' | 'desc'\n\nexport interface ColumnSort {\n id: string\n desc: boolean\n}\n\nexport type SortingState = ColumnSort[]\n\nexport interface SortingTableState {\n sorting: SortingState\n}\n\nexport interface SortingFn {\n (rowA: Row, rowB: Row, columnId: string): number\n}\n\nexport type CustomSortingFns = Record<\n string,\n SortingFn\n>\n\nexport type SortingFnOption =\n | 'auto'\n | keyof SortingFns\n | BuiltInSortingFn\n | SortingFn\n\nexport interface SortingColumnDef {\n sortingFn?: SortingFnOption\n sortDescFirst?: boolean\n enableSorting?: boolean\n enableMultiSort?: boolean\n invertSorting?: boolean\n sortUndefined?: false | -1 | 1\n}\n\nexport interface SortingColumn {\n getAutoSortingFn: () => SortingFn\n getAutoSortDir: () => SortDirection\n getSortingFn: () => SortingFn\n getFirstSortDir: () => SortDirection\n getNextSortingOrder: () => SortDirection | false\n getCanSort: () => boolean\n getCanMultiSort: () => boolean\n getSortIndex: () => number\n getIsSorted: () => false | SortDirection\n clearSorting: () => void\n toggleSorting: (desc?: boolean, isMulti?: boolean) => void\n getToggleSortingHandler: () => undefined | ((event: unknown) => void)\n}\n\ninterface SortingOptionsBase {\n manualSorting?: boolean\n onSortingChange?: OnChangeFn\n enableSorting?: boolean\n enableSortingRemoval?: boolean\n enableMultiRemove?: boolean\n enableMultiSort?: boolean\n sortDescFirst?: boolean\n getSortedRowModel?: (table: Table) => () => RowModel\n maxMultiSortColCount?: number\n isMultiSortEvent?: (e: unknown) => boolean\n}\n\ntype ResolvedSortingFns = keyof SortingFns extends never\n ? {\n sortingFns?: Record>\n }\n : {\n sortingFns: Record>\n }\n\nexport interface SortingOptions\n extends SortingOptionsBase,\n ResolvedSortingFns {}\n\nexport interface SortingInstance {\n setSorting: (updater: Updater) => void\n resetSorting: (defaultState?: boolean) => void\n getPreSortedRowModel: () => RowModel\n getSortedRowModel: () => RowModel\n _getSortedRowModel?: () => RowModel\n}\n\n//\n\nexport const Sorting: TableFeature = {\n getInitialState: (state): SortingTableState => {\n return {\n sorting: [],\n ...state,\n }\n },\n\n getDefaultColumnDef: (): SortingColumnDef => {\n return {\n sortingFn: 'auto',\n sortUndefined: 1,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): SortingOptions => {\n return {\n onSortingChange: makeStateUpdater('sorting', table),\n isMultiSortEvent: (e: unknown) => {\n return (e as MouseEvent).shiftKey\n },\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): SortingColumn => {\n return {\n getAutoSortingFn: () => {\n const firstRows = table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row?.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return sortingFns.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n return sortingFns.alphanumeric\n }\n }\n }\n\n if (isString) {\n return sortingFns.text\n }\n\n return sortingFns.basic\n },\n getAutoSortDir: () => {\n const firstRow = table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n },\n getSortingFn: () => {\n if (!column) {\n throw new Error()\n }\n\n return isFunction(column.columnDef.sortingFn)\n ? column.columnDef.sortingFn\n : column.columnDef.sortingFn === 'auto'\n ? column.getAutoSortingFn()\n : table.options.sortingFns?.[column.columnDef.sortingFn as string] ??\n sortingFns[column.columnDef.sortingFn as BuiltInSortingFn]\n },\n toggleSorting: (desc, multi) => {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column.getNextSortingOrder()\n const hasManualValue = typeof desc !== 'undefined' && desc !== null\n\n table.setSorting(old => {\n // Find any existing sorting for this column\n const existingSorting = old?.find(d => d.id === column.id)\n const existingIndex = old?.findIndex(d => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old?.length && column.getCanMultiSort() && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old?.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (table.options.maxMultiSortColCount ?? Number.MAX_SAFE_INTEGER)\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map(d => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter(d => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n },\n\n getFirstSortDir: () => {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n table.options.sortDescFirst ??\n column.getAutoSortDir() === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n },\n\n getNextSortingOrder: (multi?: boolean) => {\n const firstSortDirection = column.getFirstSortDir()\n const isSorted = column.getIsSorted()\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? table.options.enableMultiRemove ?? true : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n },\n\n getCanSort: () => {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n },\n\n getCanMultiSort: () => {\n return (\n column.columnDef.enableMultiSort ??\n table.options.enableMultiSort ??\n !!column.accessorFn\n )\n },\n\n getIsSorted: () => {\n const columnSort = table\n .getState()\n .sorting?.find(d => d.id === column.id)\n\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n },\n\n getSortIndex: () =>\n table.getState().sorting?.findIndex(d => d.id === column.id) ?? -1,\n\n clearSorting: () => {\n //clear sorting for just 1 column\n table.setSorting(old =>\n old?.length ? old.filter(d => d.id !== column.id) : []\n )\n },\n\n getToggleSortingHandler: () => {\n const canSort = column.getCanSort()\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column.toggleSorting?.(\n undefined,\n column.getCanMultiSort()\n ? table.options.isMultiSortEvent?.(e)\n : false\n )\n }\n },\n }\n },\n\n createTable: (\n table: Table\n ): SortingInstance => {\n return {\n setSorting: updater => table.options.onSortingChange?.(updater),\n resetSorting: defaultState => {\n table.setSorting(defaultState ? [] : table.initialState?.sorting ?? [])\n },\n getPreSortedRowModel: () => table.getGroupedRowModel(),\n getSortedRowModel: () => {\n if (!table._getSortedRowModel && table.options.getSortedRowModel) {\n table._getSortedRowModel = table.options.getSortedRowModel(table)\n }\n\n if (table.options.manualSorting || !table._getSortedRowModel) {\n return table.getPreSortedRowModel()\n }\n\n return table._getSortedRowModel()\n },\n }\n },\n}\n", "import { TableFeature } from '../core/table'\nimport {\n Cell,\n Column,\n OnChangeFn,\n Table,\n Updater,\n Row,\n RowData,\n} from '../types'\nimport { makeStateUpdater, memo } from '../utils'\n\nexport type VisibilityState = Record\n\nexport interface VisibilityTableState {\n columnVisibility: VisibilityState\n}\n\nexport interface VisibilityOptions {\n onColumnVisibilityChange?: OnChangeFn\n enableHiding?: boolean\n}\n\nexport interface VisibilityDefaultOptions {\n onColumnVisibilityChange: OnChangeFn\n}\n\nexport interface VisibilityInstance {\n getVisibleFlatColumns: () => Column[]\n getVisibleLeafColumns: () => Column[]\n getLeftVisibleLeafColumns: () => Column[]\n getRightVisibleLeafColumns: () => Column[]\n getCenterVisibleLeafColumns: () => Column[]\n setColumnVisibility: (updater: Updater) => void\n resetColumnVisibility: (defaultState?: boolean) => void\n toggleAllColumnsVisible: (value?: boolean) => void\n getIsAllColumnsVisible: () => boolean\n getIsSomeColumnsVisible: () => boolean\n getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void\n}\n\nexport interface VisibilityColumnDef {\n enableHiding?: boolean\n}\n\nexport interface VisibilityRow {\n _getAllVisibleCells: () => Cell[]\n getVisibleCells: () => Cell[]\n}\n\nexport interface VisibilityColumn {\n getCanHide: () => boolean\n getIsVisible: () => boolean\n toggleVisibility: (value?: boolean) => void\n getToggleVisibilityHandler: () => (event: unknown) => void\n}\n\n//\n\nexport const Visibility: TableFeature = {\n getInitialState: (state): VisibilityTableState => {\n return {\n columnVisibility: {},\n ...state,\n }\n },\n\n getDefaultOptions: (\n table: Table\n ): VisibilityDefaultOptions => {\n return {\n onColumnVisibilityChange: makeStateUpdater('columnVisibility', table),\n }\n },\n\n createColumn: (\n column: Column,\n table: Table\n ): VisibilityColumn => {\n return {\n toggleVisibility: value => {\n if (column.getCanHide()) {\n table.setColumnVisibility(old => ({\n ...old,\n [column.id]: value ?? !column.getIsVisible(),\n }))\n }\n },\n getIsVisible: () => {\n return table.getState().columnVisibility?.[column.id] ?? true\n },\n\n getCanHide: () => {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (table.options.enableHiding ?? true)\n )\n },\n getToggleVisibilityHandler: () => {\n return (e: unknown) => {\n column.toggleVisibility?.(\n ((e as MouseEvent).target as HTMLInputElement).checked\n )\n }\n },\n }\n },\n\n createRow: (\n row: Row,\n table: Table\n ): VisibilityRow => {\n return {\n _getAllVisibleCells: memo(\n () => [row.getAllCells(), table.getState().columnVisibility],\n cells => {\n return cells.filter(cell => cell.column.getIsVisible())\n },\n {\n key:\n process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n getVisibleCells: memo(\n () => [\n row.getLeftVisibleCells(),\n row.getCenterVisibleCells(),\n row.getRightVisibleCells(),\n ],\n (left, center, right) => [...left, ...center, ...right],\n {\n key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n }\n },\n\n createTable: (\n table: Table\n ): VisibilityInstance => {\n const makeVisibleColumnsMethod = (\n key: string,\n getColumns: () => Column[]\n ): (() => Column[]) => {\n return memo(\n () => [\n getColumns(),\n getColumns()\n .filter(d => d.getIsVisible())\n .map(d => d.id)\n .join('_'),\n ],\n columns => {\n return columns.filter(d => d.getIsVisible?.())\n },\n {\n key,\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n )\n }\n\n return {\n getVisibleFlatColumns: makeVisibleColumnsMethod(\n 'getVisibleFlatColumns',\n () => table.getAllFlatColumns()\n ),\n getVisibleLeafColumns: makeVisibleColumnsMethod(\n 'getVisibleLeafColumns',\n () => table.getAllLeafColumns()\n ),\n getLeftVisibleLeafColumns: makeVisibleColumnsMethod(\n 'getLeftVisibleLeafColumns',\n () => table.getLeftLeafColumns()\n ),\n getRightVisibleLeafColumns: makeVisibleColumnsMethod(\n 'getRightVisibleLeafColumns',\n () => table.getRightLeafColumns()\n ),\n getCenterVisibleLeafColumns: makeVisibleColumnsMethod(\n 'getCenterVisibleLeafColumns',\n () => table.getCenterLeafColumns()\n ),\n\n setColumnVisibility: updater =>\n table.options.onColumnVisibilityChange?.(updater),\n\n resetColumnVisibility: defaultState => {\n table.setColumnVisibility(\n defaultState ? {} : table.initialState.columnVisibility ?? {}\n )\n },\n\n toggleAllColumnsVisible: value => {\n value = value ?? !table.getIsAllColumnsVisible()\n\n table.setColumnVisibility(\n table.getAllLeafColumns().reduce(\n (obj, column) => ({\n ...obj,\n [column.id]: !value ? !column.getCanHide?.() : value,\n }),\n {}\n )\n )\n },\n\n getIsAllColumnsVisible: () =>\n !table.getAllLeafColumns().some(column => !column.getIsVisible?.()),\n\n getIsSomeColumnsVisible: () =>\n table.getAllLeafColumns().some(column => column.getIsVisible?.()),\n\n getToggleAllColumnsVisibilityHandler: () => {\n return (e: unknown) => {\n table.toggleAllColumnsVisible(\n ((e as MouseEvent).target as HTMLInputElement)?.checked\n )\n }\n },\n }\n },\n}\n", "import { functionalUpdate, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { Expanding } from '../features/Expanding'\nimport { Filters } from '../features/Filters'\nimport { Grouping } from '../features/Grouping'\nimport { Ordering } from '../features/Ordering'\nimport { Pagination } from '../features/Pagination'\nimport { Pinning } from '../features/Pinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { Sorting } from '../features/Sorting'\nimport { Visibility } from '../features/Visibility'\n\nexport interface TableFeature {\n getDefaultOptions?: (table: any) => any\n getInitialState?: (initialState?: InitialTableState) => any\n createTable?: (table: any) => any\n getDefaultColumnDef?: () => any\n createColumn?: (column: any, table: any) => any\n createHeader?: (column: any, table: any) => any\n createCell?: (cell: any, column: any, row: any, table: any) => any\n createRow?: (row: any, table: any) => any\n}\n\nconst features = [\n Headers,\n Visibility,\n Ordering,\n Pinning,\n Filters,\n Sorting,\n Grouping,\n Expanding,\n Pagination,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions {\n data: TData[]\n state: Partial\n onStateChange: (updater: Updater) => void\n debugAll?: boolean\n debugTable?: boolean\n debugHeaders?: boolean\n debugColumns?: boolean\n debugRows?: boolean\n initialState?: InitialTableState\n autoResetAll?: boolean\n mergeOptions?: (\n defaultOptions: TableOptions,\n options: Partial>\n ) => TableOptions\n meta?: TableMeta\n getCoreRowModel: (table: Table) => () => RowModel\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n getRowId?: (originalRow: TData, index: number, parent?: Row) => string\n columns: ColumnDef[]\n defaultColumn?: Partial>\n renderFallbackValue: any\n}\n\nexport interface CoreInstance {\n initialState: TableState\n reset: () => void\n options: RequiredKeys, 'state'>\n setOptions: (newOptions: Updater>) => void\n getState: () => TableState\n setState: (updater: Updater) => void\n _features: readonly TableFeature[]\n _queue: (cb: () => void) => void\n _getRowId: (_: TData, index: number, parent?: Row) => string\n getCoreRowModel: () => RowModel\n _getCoreRowModel?: () => RowModel\n getRowModel: () => RowModel\n getRow: (id: string) => Row\n _getDefaultColumnDef: () => Partial>\n _getColumnDefs: () => ColumnDef[]\n _getAllFlatColumnsById: () => Record>\n getAllColumns: () => Column[]\n getAllFlatColumns: () => Column[]\n getAllLeafColumns: () => Column[]\n getColumn: (columnId: string) => Column | undefined\n}\n\nexport function createTable(\n options: TableOptionsResolved\n): Table {\n if (options.debugAll || options.debugTable) {\n console.info('Creating Table Instance...')\n }\n\n let table = { _features: features } as unknown as Table\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved\n\n const mergeOptions = (options: TableOptionsResolved) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance = {\n _features: features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n getRow: (id: string) => {\n const row = table.getRowModel().rowsById[id]\n\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow expected an ID, but got ${id}`)\n }\n throw new Error()\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial>\n },\n {\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef',\n }\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef[],\n parent?: Column,\n depth = 0\n ): Column[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getAllColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getAllFlatColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce((acc, column) => {\n acc[column.id] = column\n return acc\n }, {} as Record>)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getAllFlatColumnsById',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getAllLeafColumns',\n debug: () => table.options.debugAll ?? table.options.debugColumns,\n }\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n table._features.forEach(feature => {\n return Object.assign(table, feature.createTable?.(table))\n })\n\n return table\n}\n", "import { RowData, Cell, Column, Row, Table } from '../types'\nimport { Getter, memo } from '../utils'\n\nexport interface CellContext {\n table: Table\n column: Column\n row: Row\n cell: Cell\n getValue: Getter\n renderValue: Getter\n}\n\nexport interface CoreCell {\n id: string\n getValue: CellContext['getValue']\n renderValue: CellContext['renderValue']\n row: Row\n column: Column\n getContext: () => CellContext\n}\n\nexport function createCell(\n table: Table,\n row: Row,\n column: Column,\n columnId: string\n): Cell {\n const getRenderValue = () =>\n cell.getValue() ?? table.options.renderFallbackValue\n\n const cell: CoreCell = {\n id: `${row.id}_${column.id}`,\n row,\n column,\n getValue: () => row.getValue(columnId),\n renderValue: getRenderValue,\n getContext: memo(\n () => [table, column, row, cell],\n (table, column, row, cell) => ({\n table,\n column,\n row,\n cell: cell as Cell,\n getValue: cell.getValue,\n renderValue: cell.renderValue,\n }),\n {\n key: process.env.NODE_ENV === 'development' && 'cell.getContext',\n debug: () => table.options.debugAll,\n }\n ),\n }\n\n table._features.forEach(feature => {\n Object.assign(\n cell,\n feature.createCell?.(\n cell as Cell,\n column,\n row as Row,\n table\n )\n )\n }, {})\n\n return cell as Cell\n}\n", "import { RowData, Cell, Row, Table } from '../types'\nimport { flattenBy, memo } from '../utils'\nimport { createCell } from './cell'\n\nexport interface CoreRow {\n id: string\n index: number\n original: TData\n depth: number\n parentId?: string\n _valuesCache: Record\n _uniqueValuesCache: Record\n getValue: (columnId: string) => TValue\n getUniqueValues: (columnId: string) => TValue[]\n renderValue: (columnId: string) => TValue\n subRows: Row[]\n getLeafRows: () => Row[]\n originalSubRows?: TData[]\n getAllCells: () => Cell[]\n _getAllCellsByColumnId: () => Record>\n getParentRow: () => Row | undefined\n getParentRows: () => Row[]\n}\n\nexport const createRow = (\n table: Table,\n id: string,\n original: TData,\n rowIndex: number,\n depth: number,\n subRows?: Row[],\n parentId?: string\n): Row => {\n let row: CoreRow = {\n id,\n index: rowIndex,\n original,\n depth,\n parentId,\n _valuesCache: {},\n _uniqueValuesCache: {},\n getValue: columnId => {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n row._valuesCache[columnId] = column.accessorFn(\n row.original as TData,\n rowIndex\n )\n\n return row._valuesCache[columnId] as any\n },\n getUniqueValues: columnId => {\n if (row._uniqueValuesCache.hasOwnProperty(columnId)) {\n return row._uniqueValuesCache[columnId]\n }\n\n const column = table.getColumn(columnId)\n\n if (!column?.accessorFn) {\n return undefined\n }\n\n if (!column.columnDef.getUniqueValues) {\n row._uniqueValuesCache[columnId] = [row.getValue(columnId)]\n return row._uniqueValuesCache[columnId]\n }\n\n row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(\n row.original as TData,\n rowIndex\n )\n\n return row._uniqueValuesCache[columnId] as any\n },\n renderValue: columnId =>\n row.getValue(columnId) ?? table.options.renderFallbackValue,\n subRows: subRows ?? [],\n getLeafRows: () => flattenBy(row.subRows, d => d.subRows),\n getParentRow: () => (row.parentId ? table.getRow(row.parentId) : undefined),\n getParentRows: () => {\n let parentRows: Row[] = []\n let currentRow = row\n while (true) {\n const parentRow = currentRow.getParentRow()\n if (!parentRow) break\n parentRows.push(parentRow)\n currentRow = parentRow\n }\n return parentRows.reverse()\n },\n getAllCells: memo(\n () => [table.getAllLeafColumns()],\n leafColumns => {\n return leafColumns.map(column => {\n return createCell(table, row as Row, column, column.id)\n })\n },\n {\n key: process.env.NODE_ENV === 'development' && 'row.getAllCells',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n\n _getAllCellsByColumnId: memo(\n () => [row.getAllCells()],\n allCells => {\n return allCells.reduce((acc, cell) => {\n acc[cell.column.id] = cell\n return acc\n }, {} as Record>)\n },\n {\n key:\n process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',\n debug: () => table.options.debugAll ?? table.options.debugRows,\n }\n ),\n }\n\n for (let i = 0; i < table._features.length; i++) {\n const feature = table._features[i]\n Object.assign(row, feature?.createRow?.(row, table))\n }\n\n return row as Row\n}\n", "import {\n AccessorFn,\n ColumnDef,\n DisplayColumnDef,\n GroupColumnDef,\n IdentifiedColumnDef,\n RowData,\n} from './types'\nimport { DeepKeys, DeepValue, RequiredKeys } from './utils'\n\n// type Person = {\n// firstName: string\n// lastName: string\n// age: number\n// visits: number\n// status: string\n// progress: number\n// createdAt: Date\n// nested: {\n// foo: [\n// {\n// bar: 'bar'\n// }\n// ]\n// bar: { subBar: boolean }[]\n// baz: {\n// foo: 'foo'\n// bar: {\n// baz: 'baz'\n// }\n// }\n// }\n// }\n\n// const test: DeepKeys = 'nested.foo.0.bar'\n// const test2: DeepKeys = 'nested.bar'\n\n// const helper = createColumnHelper()\n\n// helper.accessor('nested.foo', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.foo.0.bar', {\n// cell: info => info.getValue(),\n// })\n\n// helper.accessor('nested.bar', {\n// cell: info => info.getValue(),\n// })\n\nexport type ColumnHelper = {\n accessor: <\n TAccessor extends AccessorFn | DeepKeys,\n TValue extends TAccessor extends AccessorFn\n ? TReturn\n : TAccessor extends DeepKeys\n ? DeepValue\n : never\n >(\n accessor: TAccessor,\n column: TAccessor extends AccessorFn\n ? DisplayColumnDef\n : IdentifiedColumnDef\n ) => ColumnDef\n display: (column: DisplayColumnDef) => ColumnDef\n group: (column: GroupColumnDef) => ColumnDef\n}\n\nexport function createColumnHelper<\n TData extends RowData\n>(): ColumnHelper {\n return {\n accessor: (accessor, column) => {\n return typeof accessor === 'function'\n ? ({\n ...column,\n accessorFn: accessor,\n } as any)\n : {\n ...column,\n accessorKey: accessor,\n }\n },\n display: column => column as ColumnDef,\n group: column => column as ColumnDef,\n }\n}\n", "import { createRow } from '../core/row'\nimport { Table, Row, RowModel, RowData } from '../types'\nimport { memo } from '../utils'\n\nexport function getCoreRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.options.data],\n (\n data\n ): {\n rows: Row[]\n flatRows: Row[]\n rowsById: Record>\n } => {\n const rowModel: RowModel = {\n rows: [],\n flatRows: [],\n rowsById: {},\n }\n\n const accessRows = (\n originalRows: TData[],\n depth = 0,\n parentRow?: Row\n ): Row[] => {\n const rows = [] as Row[]\n\n for (let i = 0; i < originalRows.length; i++) {\n // This could be an expensive check at scale, so we should move it somewhere else, but where?\n // if (!id) {\n // if (process.env.NODE_ENV !== 'production') {\n // throw new Error(`getRowId expected an ID, but got ${id}`)\n // }\n // }\n\n // Make the row\n const row = createRow(\n table,\n table._getRowId(originalRows[i]!, i, parentRow),\n originalRows[i]!,\n i,\n depth,\n undefined,\n parentRow?.id\n )\n\n // Keep track of every row in a flat array\n rowModel.flatRows.push(row)\n // Also keep track of every row by its ID\n rowModel.rowsById[row.id] = row\n // Push table row into parent\n rows.push(row)\n\n // Get the original subrows\n if (table.options.getSubRows) {\n row.originalSubRows = table.options.getSubRows(\n originalRows[i]!,\n i\n )\n\n // Then recursively access them\n if (row.originalSubRows?.length) {\n row.subRows = accessRows(row.originalSubRows, depth + 1, row)\n }\n }\n }\n\n return rows\n }\n\n rowModel.rows = accessRows(data)\n\n return rowModel\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {\n table._autoResetPageIndex()\n },\n }\n )\n}\n", "import { createRow } from '../core/row'\nimport { Row, RowModel, Table, RowData } from '../types'\n\nexport function filterRows(\n rows: Row[],\n filterRowImpl: (row: Row) => any,\n table: Table\n) {\n if (table.options.filterFromLeafRows) {\n return filterRowModelFromLeafs(rows, filterRowImpl, table)\n }\n\n return filterRowModelFromRoot(rows, filterRowImpl, table)\n}\n\nexport function filterRowModelFromLeafs(\n rowsToFilter: Row[],\n filterRow: (row: Row) => Row[],\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n const rows: Row[] = []\n\n // Filter from children up first\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.columnFilters = row.columnFilters\n\n if (row.subRows?.length && depth < maxDepth) {\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n\n if (filterRow(row) && !newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredRowsById[i] = row\n continue\n }\n\n if (filterRow(row) || newRow.subRows.length) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredRowsById[i] = row\n continue\n }\n } else {\n row = newRow\n if (filterRow(row)) {\n rows.push(row)\n newFilteredRowsById[row.id] = row\n newFilteredRowsById[i] = row\n }\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n\nexport function filterRowModelFromRoot(\n rowsToFilter: Row[],\n filterRow: (row: Row) => any,\n table: Table\n): RowModel {\n const newFilteredFlatRows: Row[] = []\n const newFilteredRowsById: Record> = {}\n const maxDepth = table.options.maxLeafRowFilterDepth ?? 100\n\n // Filters top level and nested rows\n const recurseFilterRows = (rowsToFilter: Row[], depth = 0) => {\n // Filter from parents downward first\n\n const rows: Row[] = []\n\n // Apply the filter to any subRows\n for (let i = 0; i < rowsToFilter.length; i++) {\n let row = rowsToFilter[i]!\n\n const pass = filterRow(row)\n\n if (pass) {\n if (row.subRows?.length && depth < maxDepth) {\n const newRow = createRow(\n table,\n row.id,\n row.original,\n row.index,\n row.depth,\n undefined,\n row.parentId\n )\n newRow.subRows = recurseFilterRows(row.subRows, depth + 1)\n row = newRow\n }\n\n rows.push(row)\n newFilteredFlatRows.push(row)\n newFilteredRowsById[row.id] = row\n }\n }\n\n return rows\n }\n\n return {\n rows: recurseFilterRows(rowsToFilter),\n flatRows: newFilteredFlatRows,\n rowsById: newFilteredRowsById,\n }\n}\n", "import { ResolvedColumnFilter } from '../features/Filters'\nimport { Table, RowModel, Row, RowData } from '../types'\nimport { memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFilteredRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n ],\n (rowModel, columnFilters, globalFilter) => {\n if (\n !rowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n for (let i = 0; i < rowModel.flatRows.length; i++) {\n rowModel.flatRows[i]!.columnFilters = {}\n rowModel.flatRows[i]!.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: ResolvedColumnFilter[] = []\n const resolvedGlobalFilters: ResolvedColumnFilter[] = []\n\n ;(columnFilters ?? []).forEach(d => {\n const column = table.getColumn(d.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column.getFilterFn()\n\n if (!filterFn) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`\n )\n }\n return\n }\n\n resolvedColumnFilters.push({\n id: d.id,\n filterFn,\n resolvedValue: filterFn.resolveFilterValue?.(d.value) ?? d.value,\n })\n })\n\n const filterableIds = columnFilters.map(d => d.id)\n\n const globalFilterFn = table.getGlobalFilterFn()\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter(column => column.getCanGlobalFilter())\n\n if (\n globalFilter &&\n globalFilterFn &&\n globallyFilterableColumns.length\n ) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach(column => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ??\n globalFilter,\n })\n })\n }\n\n let currentColumnFilter\n let currentGlobalFilter\n\n // Flag the prefiltered row model with each filter state\n for (let j = 0; j < rowModel.flatRows.length; j++) {\n const row = rowModel.flatRows[j]!\n\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let i = 0; i < resolvedColumnFilters.length; i++) {\n currentColumnFilter = resolvedColumnFilters[i]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let i = 0; i < resolvedGlobalFilters.length; i++) {\n currentGlobalFilter = resolvedGlobalFilters[i]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n filterMeta => {\n row.columnFiltersMeta[id] = filterMeta\n }\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl, table)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getFilteredRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {\n table._autoResetPageIndex()\n },\n }\n )\n}\n", "import { Table, RowModel, Row, RowData } from '../types'\nimport { memo } from '../utils'\nimport { filterRows } from './filterRowsUtils'\n\nexport function getFacetedRowModel(): (\n table: Table,\n columnId: string\n) => () => RowModel {\n return (table, columnId) =>\n memo(\n () => [\n table.getPreFilteredRowModel(),\n table.getState().columnFilters,\n table.getState().globalFilter,\n table.getFilteredRowModel(),\n ],\n (preRowModel, columnFilters, globalFilter) => {\n if (\n !preRowModel.rows.length ||\n (!columnFilters?.length && !globalFilter)\n ) {\n return preRowModel\n }\n\n const filterableIds = [\n ...columnFilters.map(d => d.id).filter(d => d !== columnId),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as string[]\n\n const filterRowsImpl = (row: Row) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n },\n {\n key:\n process.env.NODE_ENV === 'development' &&\n 'getFacetedRowModel_' + columnId,\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {},\n }\n )\n}\n", "import { Table, RowData } from '../types'\nimport { memo } from '../utils'\n\nexport function getFacetedUniqueValues(): (\n table: Table,\n columnId: string\n) => () => Map {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return new Map()\n\n let facetedUniqueValues = new Map()\n\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values =\n facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]!\n\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n },\n {\n key:\n process.env.NODE_ENV === 'development' &&\n 'getFacetedUniqueValues_' + columnId,\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {},\n }\n )\n}\n", "import { Table, RowData } from '../types'\nimport { memo } from '../utils'\n\nexport function getFacetedMinMaxValues(): (\n table: Table,\n columnId: string\n) => () => undefined | [number, number] {\n return (table, columnId) =>\n memo(\n () => [table.getColumn(columnId)?.getFacetedRowModel()],\n facetedRowModel => {\n if (!facetedRowModel) return undefined\n\n const firstValue =\n facetedRowModel.flatRows[0]?.getUniqueValues(columnId)\n\n if (typeof firstValue === 'undefined') {\n return undefined\n }\n\n let facetedMinMaxValues: [any, any] = [firstValue, firstValue]\n\n for (let i = 0; i < facetedRowModel.flatRows.length; i++) {\n const values =\n facetedRowModel.flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]!\n\n if (value < facetedMinMaxValues[0]) {\n facetedMinMaxValues[0] = value\n } else if (value > facetedMinMaxValues[1]) {\n facetedMinMaxValues[1] = value\n }\n }\n }\n\n return facetedMinMaxValues\n },\n {\n key:\n process.env.NODE_ENV === 'development' &&\n 'getFacetedMinMaxValues_' + columnId,\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {},\n }\n )\n}\n", "import { Table, Row, RowModel, RowData } from '../types'\nimport { SortingFn } from '../features/Sorting'\nimport { memo } from '../utils'\n\nexport function getSortedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().sorting, table.getPreSortedRowModel()],\n (sorting, rowModel) => {\n if (!rowModel.rows.length || !sorting?.length) {\n return rowModel\n }\n\n const sortingState = table.getState().sorting\n\n const sortedFlatRows: Row[] = []\n\n // Filter out sortings that correspond to non existing columns\n const availableSorting = sortingState.filter(sort =>\n table.getColumn(sort.id)?.getCanSort()\n )\n\n const columnInfoById: Record<\n string,\n {\n sortUndefined?: false | -1 | 1\n invertSorting?: boolean\n sortingFn: SortingFn\n }\n > = {}\n\n availableSorting.forEach(sortEntry => {\n const column = table.getColumn(sortEntry.id)\n if (!column) return\n\n columnInfoById[sortEntry.id] = {\n sortUndefined: column.columnDef.sortUndefined,\n invertSorting: column.columnDef.invertSorting,\n sortingFn: column.getSortingFn(),\n }\n })\n\n const sortData = (rows: Row[]) => {\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = [...rows]\n\n sortedData.sort((rowA, rowB) => {\n for (let i = 0; i < availableSorting.length; i += 1) {\n const sortEntry = availableSorting[i]!\n const columnInfo = columnInfoById[sortEntry.id]!\n const isDesc = sortEntry?.desc ?? false\n\n let sortInt = 0\n\n // All sorting ints should always return in ascending order\n if (columnInfo.sortUndefined) {\n const aValue = rowA.getValue(sortEntry.id)\n const bValue = rowB.getValue(sortEntry.id)\n\n const aUndefined = aValue === undefined\n const bUndefined = bValue === undefined\n\n if (aUndefined || bUndefined) {\n sortInt =\n aUndefined && bUndefined\n ? 0\n : aUndefined\n ? columnInfo.sortUndefined\n : -columnInfo.sortUndefined\n }\n }\n\n if (sortInt === 0) {\n sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)\n }\n\n // If sorting is non-zero, take care of desc and inversion\n if (sortInt !== 0) {\n if (isDesc) {\n sortInt *= -1\n }\n\n if (columnInfo.invertSorting) {\n sortInt *= -1\n }\n\n return sortInt\n }\n }\n\n return rowA.index - rowB.index\n })\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n sortedFlatRows.push(row)\n if (row.subRows?.length) {\n row.subRows = sortData(row.subRows)\n }\n })\n\n return sortedData\n }\n\n return {\n rows: sortData(rowModel.rows),\n flatRows: sortedFlatRows,\n rowsById: rowModel.rowsById,\n }\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getSortedRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {\n table._autoResetPageIndex()\n },\n }\n )\n}\n", "import { createRow } from '../core/row'\nimport { Table, Row, RowModel, RowData } from '../types'\nimport { flattenBy, memo } from '../utils'\n\nexport function getGroupedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [table.getState().grouping, table.getPreGroupedRowModel()],\n (grouping, rowModel) => {\n if (!rowModel.rows.length || !grouping.length) {\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter(columnId =>\n table.getColumn(columnId)\n )\n\n const groupedFlatRows: Row[] = []\n const groupedRowsById: Record> = {}\n // const onlyGroupedFlatRows: Row[] = [];\n // const onlyGroupedRowsById: Record = {};\n // const nonGroupedFlatRows: Row[] = [];\n // const nonGroupedRowsById: Record = {};\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Row[],\n depth = 0,\n parentId?: string\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map(row => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId: string = existingGrouping[depth]!\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Peform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, row => row.subRows)\n : groupedRows\n\n const row = createRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId\n )\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (columnId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(columnId)) {\n if (row._valuesCache.hasOwnProperty(columnId)) {\n return row._valuesCache[columnId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[columnId] =\n groupedRows[0].getValue(columnId) ?? undefined\n }\n\n return row._valuesCache[columnId]\n }\n\n if (row._groupingValuesCache.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n // Aggregate the values\n const column = table.getColumn(columnId)\n const aggregateFn = column?.getAggregationFn()\n\n if (aggregateFn) {\n row._groupingValuesCache[columnId] = aggregateFn(\n columnId,\n leafRows,\n groupedRows\n )\n\n return row._groupingValuesCache[columnId]\n }\n },\n })\n\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return row\n }\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n // if (subRow.getIsGrouped?.()) {\n // onlyGroupedFlatRows.push(subRow);\n // onlyGroupedRowsById[subRow.id] = subRow;\n // } else {\n // nonGroupedFlatRows.push(subRow);\n // nonGroupedRowsById[subRow.id] = subRow;\n // }\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getGroupedRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n onChange: () => {\n table._queue(() => {\n table._autoResetExpanded()\n table._autoResetPageIndex()\n })\n },\n }\n )\n}\n\nfunction groupBy(rows: Row[], columnId: string) {\n const groupMap = new Map[]>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row.getGroupingValue(columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n", "import { Table, Row, RowModel, RowData } from '../types'\nimport { memo } from '../utils'\n\nexport function getExpandedRowModel(): (\n table: Table\n) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().expanded,\n table.getPreExpandedRowModel(),\n table.options.paginateExpandedRows,\n ],\n (expanded, rowModel, paginateExpandedRows) => {\n if (\n !rowModel.rows.length ||\n (expanded !== true && !Object.keys(expanded ?? {}).length)\n ) {\n return rowModel\n }\n\n if (!paginateExpandedRows) {\n // Only expand rows at this point if they are being paginated\n return rowModel\n }\n\n return expandRows(rowModel)\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getExpandedRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n )\n}\n\nexport function expandRows(rowModel: RowModel) {\n const expandedRows: Row[] = []\n\n const handleRow = (row: Row) => {\n expandedRows.push(row)\n\n if (row.subRows?.length && row.getIsExpanded()) {\n row.subRows.forEach(handleRow)\n }\n }\n\n rowModel.rows.forEach(handleRow)\n\n return {\n rows: expandedRows,\n flatRows: rowModel.flatRows,\n rowsById: rowModel.rowsById,\n }\n}\n", "import { Table, RowModel, Row, RowData } from '../types'\nimport { memo } from '../utils'\nimport { expandRows } from './getExpandedRowModel'\n\nexport function getPaginationRowModel(opts?: {\n initialSync: boolean\n}): (table: Table) => () => RowModel {\n return table =>\n memo(\n () => [\n table.getState().pagination,\n table.getPrePaginationRowModel(),\n table.options.paginateExpandedRows\n ? undefined\n : table.getState().expanded,\n ],\n (pagination, rowModel) => {\n if (!rowModel.rows.length) {\n return rowModel\n }\n\n const { pageSize, pageIndex } = pagination\n let { rows, flatRows, rowsById } = rowModel\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n rows = rows.slice(pageStart, pageEnd)\n\n let paginatedRowModel: RowModel\n\n if (!table.options.paginateExpandedRows) {\n paginatedRowModel = expandRows({\n rows,\n flatRows,\n rowsById,\n })\n } else {\n paginatedRowModel = {\n rows,\n flatRows,\n rowsById,\n }\n }\n\n paginatedRowModel.flatRows = []\n\n const handleRow = (row: Row) => {\n paginatedRowModel.flatRows.push(row)\n if (row.subRows.length) {\n row.subRows.forEach(handleRow)\n }\n }\n\n paginatedRowModel.rows.forEach(handleRow)\n\n return paginatedRowModel\n },\n {\n key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',\n debug: () => table.options.debugAll ?? table.options.debugTable,\n }\n )\n}\n", "import * as React from 'react'\nexport * from '@tanstack/table-core'\n\nimport {\n TableOptions,\n TableOptionsResolved,\n RowData,\n createTable,\n} from '@tanstack/table-core'\n\nexport type Renderable = React.ReactNode | React.ComponentType\n\n//\n\nexport function flexRender(\n Comp: Renderable,\n props: TProps\n): React.ReactNode | JSX.Element {\n return !Comp ? null : isReactComponent(Comp) ? (\n \n ) : (\n Comp\n )\n}\n\nfunction isReactComponent(\n component: unknown\n): component is React.ComponentType {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component: any) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component: any) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n\nexport function useReactTable(\n options: TableOptions\n) {\n // Compose in the generic options to the user options\n const resolvedOptions: TableOptionsResolved = {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n ...options,\n }\n\n // Create a new table and store it in state\n const [tableRef] = React.useState(() => ({\n current: createTable(resolvedOptions),\n }))\n\n // By default, manage table state here using the table's initial state\n const [state, setState] = React.useState(() => tableRef.current.initialState)\n\n // Compose the default state above with any user state. This will allow the user\n // to only control a subset of the state if desired.\n tableRef.current.setOptions(prev => ({\n ...prev,\n ...options,\n state: {\n ...state,\n ...options.state,\n },\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: updater => {\n setState(updater)\n options.onStateChange?.(updater)\n },\n }))\n\n return tableRef.current\n}\n", "/**\n * react-virtual\n *\n * Copyright (c) TanStack\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\nexport { _extends as extends };\n//# sourceMappingURL=_rollupPluginBabelHelpers.mjs.map\n", "/**\n * virtual-core\n *\n * Copyright (c) TanStack\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\nexport { _extends as extends };\n//# sourceMappingURL=_rollupPluginBabelHelpers.mjs.map\n", "export type NoInfer = [A][A extends any ? 0 : never]\n\nexport type PartialKeys = Omit & Partial>\n\nexport function memo(\n getDeps: () => [...TDeps],\n fn: (...args: NoInfer<[...TDeps]>) => TResult,\n opts: {\n key: false | string\n debug?: () => any\n onChange?: (result: TResult) => void\n initialDeps?: TDeps\n },\n) {\n let deps = opts.initialDeps ?? []\n let result: TResult | undefined\n\n return (): TResult => {\n let depTime: number\n if (opts.key && opts.debug?.()) depTime = Date.now()\n\n const newDeps = getDeps()\n\n const depsChanged =\n newDeps.length !== deps.length ||\n newDeps.some((dep: any, index: number) => deps[index] !== dep)\n\n if (!depsChanged) {\n return result!\n }\n\n deps = newDeps\n\n let resultTime: number\n if (opts.key && opts.debug?.()) resultTime = Date.now()\n\n result = fn(...newDeps)\n\n if (opts.key && opts.debug?.()) {\n const depEndTime = Math.round((Date.now() - depTime!) * 100) / 100\n const resultEndTime = Math.round((Date.now() - resultTime!) * 100) / 100\n const resultFpsPercentage = resultEndTime / 16\n\n const pad = (str: number | string, num: number) => {\n str = String(str)\n while (str.length < num) {\n str = ' ' + str\n }\n return str\n }\n\n console.info(\n `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,\n `\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(\n 0,\n Math.min(120 - 120 * resultFpsPercentage, 120),\n )}deg 100% 31%);`,\n opts?.key,\n )\n }\n\n opts?.onChange?.(result)\n\n return result!\n }\n}\n\nexport function notUndefined(value: T | undefined, msg?: string): T {\n if (value === undefined) {\n throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ''}`)\n } else {\n return value\n }\n}\n\nexport const approxEqual = (a: number, b: number) => Math.abs(a - b) < 1\n", "import { approxEqual, memo, notUndefined } from './utils'\n\nexport * from './utils'\n\n//\n\ntype ScrollDirection = 'forward' | 'backward'\n\ntype ScrollAlignment = 'start' | 'center' | 'end' | 'auto'\n\ntype ScrollBehavior = 'auto' | 'smooth'\n\nexport interface ScrollToOptions {\n align?: ScrollAlignment\n behavior?: ScrollBehavior\n}\n\ntype ScrollToOffsetOptions = ScrollToOptions\n\ntype ScrollToIndexOptions = ScrollToOptions\n\nexport interface Range {\n startIndex: number\n endIndex: number\n overscan: number\n count: number\n}\n\ntype Key = number | string\n\nexport interface VirtualItem {\n key: Key\n index: number\n start: number\n end: number\n size: number\n lane: number\n}\n\ninterface Rect {\n width: number\n height: number\n}\n\n//\n\nexport const defaultKeyExtractor = (index: number) => index\n\nexport const defaultRangeExtractor = (range: Range) => {\n const start = Math.max(range.startIndex - range.overscan, 0)\n const end = Math.min(range.endIndex + range.overscan, range.count - 1)\n\n const arr = []\n\n for (let i = start; i <= end; i++) {\n arr.push(i)\n }\n\n return arr\n}\n\nexport const observeElementRect = (\n instance: Virtualizer,\n cb: (rect: Rect) => void,\n) => {\n const element = instance.scrollElement\n if (!element) {\n return\n }\n\n const handler = (rect: Rect) => {\n const { width, height } = rect\n cb({ width: Math.round(width), height: Math.round(height) })\n }\n\n handler(element.getBoundingClientRect())\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (entry?.borderBoxSize) {\n const box = entry.borderBoxSize[0]\n if (box) {\n handler({ width: box.inlineSize, height: box.blockSize })\n return\n }\n }\n handler(element.getBoundingClientRect())\n })\n\n observer.observe(element, { box: 'border-box' })\n\n return () => {\n observer.unobserve(element)\n }\n}\n\nexport const observeWindowRect = (\n instance: Virtualizer,\n cb: (rect: Rect) => void,\n) => {\n const element = instance.scrollElement\n if (!element) {\n return\n }\n\n const handler = () => {\n cb({ width: element.innerWidth, height: element.innerHeight })\n }\n handler()\n\n element.addEventListener('resize', handler, {\n passive: true,\n })\n\n return () => {\n element.removeEventListener('resize', handler)\n }\n}\n\nexport const observeElementOffset = (\n instance: Virtualizer,\n cb: (offset: number) => void,\n) => {\n const element = instance.scrollElement\n if (!element) {\n return\n }\n\n const handler = () => {\n cb(element[instance.options.horizontal ? 'scrollLeft' : 'scrollTop'])\n }\n handler()\n\n element.addEventListener('scroll', handler, {\n passive: true,\n })\n\n return () => {\n element.removeEventListener('scroll', handler)\n }\n}\n\nexport const observeWindowOffset = (\n instance: Virtualizer,\n cb: (offset: number) => void,\n) => {\n const element = instance.scrollElement\n if (!element) {\n return\n }\n\n const handler = () => {\n cb(element[instance.options.horizontal ? 'scrollX' : 'scrollY'])\n }\n handler()\n\n element.addEventListener('scroll', handler, {\n passive: true,\n })\n\n return () => {\n element.removeEventListener('scroll', handler)\n }\n}\n\nexport const measureElement = (\n element: TItemElement,\n entry: ResizeObserverEntry | undefined,\n instance: Virtualizer,\n) => {\n if (entry?.borderBoxSize) {\n const box = entry.borderBoxSize[0]\n if (box) {\n const size = Math.round(\n box[instance.options.horizontal ? 'inlineSize' : 'blockSize'],\n )\n return size\n }\n }\n return Math.round(\n element.getBoundingClientRect()[\n instance.options.horizontal ? 'width' : 'height'\n ],\n )\n}\n\nexport const windowScroll = (\n offset: number,\n {\n adjustments = 0,\n behavior,\n }: { adjustments?: number; behavior?: ScrollBehavior },\n instance: Virtualizer,\n) => {\n const toOffset = offset + adjustments\n\n instance.scrollElement?.scrollTo?.({\n [instance.options.horizontal ? 'left' : 'top']: toOffset,\n behavior,\n })\n}\n\nexport const elementScroll = (\n offset: number,\n {\n adjustments = 0,\n behavior,\n }: { adjustments?: number; behavior?: ScrollBehavior },\n instance: Virtualizer,\n) => {\n const toOffset = offset + adjustments\n\n instance.scrollElement?.scrollTo?.({\n [instance.options.horizontal ? 'left' : 'top']: toOffset,\n behavior,\n })\n}\n\nexport interface VirtualizerOptions<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n> {\n // Required from the user\n count: number\n getScrollElement: () => TScrollElement | null\n estimateSize: (index: number) => number\n\n // Required from the framework adapter (but can be overridden)\n scrollToFn: (\n offset: number,\n options: { adjustments?: number; behavior?: ScrollBehavior },\n instance: Virtualizer,\n ) => void\n observeElementRect: (\n instance: Virtualizer,\n cb: (rect: Rect) => void,\n ) => void | (() => void)\n observeElementOffset: (\n instance: Virtualizer,\n cb: (offset: number) => void,\n ) => void | (() => void)\n\n // Optional\n debug?: any\n initialRect?: Rect\n onChange?: (instance: Virtualizer) => void\n measureElement?: (\n element: TItemElement,\n entry: ResizeObserverEntry | undefined,\n instance: Virtualizer,\n ) => number\n overscan?: number\n horizontal?: boolean\n paddingStart?: number\n paddingEnd?: number\n scrollPaddingStart?: number\n scrollPaddingEnd?: number\n initialOffset?: number\n getItemKey?: (index: number) => Key\n rangeExtractor?: (range: Range) => number[]\n scrollMargin?: number\n scrollingDelay?: number\n indexAttribute?: string\n initialMeasurementsCache?: VirtualItem[]\n lanes?: number\n}\n\nexport class Virtualizer<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n> {\n private unsubs: (void | (() => void))[] = []\n options!: Required>\n scrollElement: TScrollElement | null = null\n isScrolling: boolean = false\n private isScrollingTimeoutId: ReturnType | null = null\n private scrollToIndexTimeoutId: ReturnType | null = null\n measurementsCache: VirtualItem[] = []\n private itemSizeCache = new Map()\n private pendingMeasuredCacheIndexes: number[] = []\n private scrollRect: Rect\n scrollOffset: number\n scrollDirection: ScrollDirection | null = null\n private scrollAdjustments: number = 0\n measureElementCache = new Map()\n private observer = (() => {\n let _ro: ResizeObserver | null = null\n\n const get = () => {\n if (_ro) {\n return _ro\n } else if (typeof ResizeObserver !== 'undefined') {\n return (_ro = new ResizeObserver((entries) => {\n entries.forEach((entry) => {\n this._measureElement(entry.target as TItemElement, entry)\n })\n }))\n } else {\n return null\n }\n }\n\n return {\n disconnect: () => get()?.disconnect(),\n observe: (target: Element) =>\n get()?.observe(target, { box: 'border-box' }),\n unobserve: (target: Element) => get()?.unobserve(target),\n }\n })()\n range: { startIndex: number; endIndex: number } = {\n startIndex: 0,\n endIndex: 0,\n }\n\n constructor(opts: VirtualizerOptions) {\n this.setOptions(opts)\n this.scrollRect = this.options.initialRect\n this.scrollOffset = this.options.initialOffset\n this.measurementsCache = this.options.initialMeasurementsCache\n this.measurementsCache.forEach((item) => {\n this.itemSizeCache.set(item.key, item.size)\n })\n\n this.maybeNotify()\n }\n\n setOptions = (opts: VirtualizerOptions) => {\n Object.entries(opts).forEach(([key, value]) => {\n if (typeof value === 'undefined') delete (opts as any)[key]\n })\n\n this.options = {\n debug: false,\n initialOffset: 0,\n overscan: 1,\n paddingStart: 0,\n paddingEnd: 0,\n scrollPaddingStart: 0,\n scrollPaddingEnd: 0,\n horizontal: false,\n getItemKey: defaultKeyExtractor,\n rangeExtractor: defaultRangeExtractor,\n onChange: () => {},\n measureElement,\n initialRect: { width: 0, height: 0 },\n scrollMargin: 0,\n scrollingDelay: 150,\n indexAttribute: 'data-index',\n initialMeasurementsCache: [],\n lanes: 1,\n ...opts,\n }\n }\n\n private notify = () => {\n this.options.onChange?.(this)\n }\n\n private cleanup = () => {\n this.unsubs.filter(Boolean).forEach((d) => d!())\n this.unsubs = []\n this.scrollElement = null\n }\n\n _didMount = () => {\n this.measureElementCache.forEach(this.observer.observe)\n return () => {\n this.observer.disconnect()\n this.cleanup()\n }\n }\n\n _willUpdate = () => {\n const scrollElement = this.options.getScrollElement()\n\n if (this.scrollElement !== scrollElement) {\n this.cleanup()\n\n this.scrollElement = scrollElement\n\n this._scrollToOffset(this.scrollOffset, {\n adjustments: undefined,\n behavior: undefined,\n })\n\n this.unsubs.push(\n this.options.observeElementRect(this, (rect) => {\n const prev = this.scrollRect\n this.scrollRect = rect\n if (\n this.options.horizontal\n ? rect.width !== prev.width\n : rect.height !== prev.height\n ) {\n this.maybeNotify()\n }\n }),\n )\n\n this.unsubs.push(\n this.options.observeElementOffset(this, (offset) => {\n this.scrollAdjustments = 0\n\n if (this.scrollOffset === offset) {\n return\n }\n\n if (this.isScrollingTimeoutId !== null) {\n clearTimeout(this.isScrollingTimeoutId)\n this.isScrollingTimeoutId = null\n }\n\n this.isScrolling = true\n this.scrollDirection =\n this.scrollOffset < offset ? 'forward' : 'backward'\n this.scrollOffset = offset\n\n this.maybeNotify()\n\n this.isScrollingTimeoutId = setTimeout(() => {\n this.isScrollingTimeoutId = null\n this.isScrolling = false\n this.scrollDirection = null\n\n this.maybeNotify()\n }, this.options.scrollingDelay)\n }),\n )\n }\n }\n\n private getSize = () => {\n return this.scrollRect[this.options.horizontal ? 'width' : 'height']\n }\n\n private memoOptions = memo(\n () => [\n this.options.count,\n this.options.paddingStart,\n this.options.scrollMargin,\n this.options.getItemKey,\n ],\n (count, paddingStart, scrollMargin, getItemKey) => {\n this.pendingMeasuredCacheIndexes = []\n return {\n count,\n paddingStart,\n scrollMargin,\n getItemKey,\n }\n },\n {\n key: false,\n },\n )\n\n private getFurthestMeasurement = (\n measurements: VirtualItem[],\n index: number,\n ) => {\n const furthestMeasurementsFound = new Map()\n const furthestMeasurements = new Map()\n for (let m = index - 1; m >= 0; m--) {\n const measurement = measurements[m]!\n\n if (furthestMeasurementsFound.has(measurement.lane)) {\n continue\n }\n\n const previousFurthestMeasurement = furthestMeasurements.get(\n measurement.lane,\n )\n if (\n previousFurthestMeasurement == null ||\n measurement.end > previousFurthestMeasurement.end\n ) {\n furthestMeasurements.set(measurement.lane, measurement)\n } else if (measurement.end < previousFurthestMeasurement.end) {\n furthestMeasurementsFound.set(measurement.lane, true)\n }\n\n if (furthestMeasurementsFound.size === this.options.lanes) {\n break\n }\n }\n\n return furthestMeasurements.size === this.options.lanes\n ? Array.from(furthestMeasurements.values()).sort(\n (a, b) => a.end - b.end,\n )[0]\n : undefined\n }\n\n private getMeasurements = memo(\n () => [this.memoOptions(), this.itemSizeCache],\n ({ count, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => {\n const min =\n this.pendingMeasuredCacheIndexes.length > 0\n ? Math.min(...this.pendingMeasuredCacheIndexes)\n : 0\n this.pendingMeasuredCacheIndexes = []\n\n const measurements = this.measurementsCache.slice(0, min)\n\n for (let i = min; i < count; i++) {\n const key = getItemKey(i)\n\n const furthestMeasurement =\n this.options.lanes === 1\n ? measurements[i - 1]\n : this.getFurthestMeasurement(measurements, i)\n\n const start = furthestMeasurement\n ? furthestMeasurement.end\n : paddingStart + scrollMargin\n\n const measuredSize = itemSizeCache.get(key)\n const size =\n typeof measuredSize === 'number'\n ? measuredSize\n : this.options.estimateSize(i)\n\n const end = start + size\n\n const lane = furthestMeasurement\n ? furthestMeasurement.lane\n : i % this.options.lanes\n\n measurements[i] = {\n index: i,\n start,\n size,\n end,\n key,\n lane,\n }\n }\n\n this.measurementsCache = measurements\n\n return measurements\n },\n {\n key: process.env.NODE_ENV !== 'production' && 'getMeasurements',\n debug: () => this.options.debug,\n },\n )\n\n calculateRange = memo(\n () => [this.getMeasurements(), this.getSize(), this.scrollOffset],\n (measurements, outerSize, scrollOffset) => {\n return (this.range = calculateRange({\n measurements,\n outerSize,\n scrollOffset,\n }))\n },\n {\n key: process.env.NODE_ENV !== 'production' && 'calculateRange',\n debug: () => this.options.debug,\n },\n )\n\n private maybeNotify = memo(\n () => {\n const range = this.calculateRange()\n\n return [range.startIndex, range.endIndex, this.isScrolling]\n },\n () => {\n this.notify()\n },\n {\n key: process.env.NODE_ENV !== 'production' && 'maybeNotify',\n debug: () => this.options.debug,\n initialDeps: [\n this.range.startIndex,\n this.range.endIndex,\n this.isScrolling,\n ],\n },\n )\n\n private getIndexes = memo(\n () => [\n this.options.rangeExtractor,\n this.calculateRange(),\n this.options.overscan,\n this.options.count,\n ],\n (rangeExtractor, range, overscan, count) => {\n return rangeExtractor({\n ...range,\n overscan,\n count,\n })\n },\n {\n key: process.env.NODE_ENV !== 'production' && 'getIndexes',\n debug: () => this.options.debug,\n },\n )\n\n indexFromElement = (node: TItemElement) => {\n const attributeName = this.options.indexAttribute\n const indexStr = node.getAttribute(attributeName)\n\n if (!indexStr) {\n console.warn(\n `Missing attribute name '${attributeName}={index}' on measured element.`,\n )\n return -1\n }\n\n return parseInt(indexStr, 10)\n }\n\n private _measureElement = (\n node: TItemElement,\n entry: ResizeObserverEntry | undefined,\n ) => {\n const index = this.indexFromElement(node)\n\n const item = this.measurementsCache[index]\n if (!item) {\n return\n }\n\n const prevNode = this.measureElementCache.get(item.key)\n\n if (!node.isConnected) {\n this.observer.unobserve(node)\n if (node === prevNode) {\n this.measureElementCache.delete(item.key)\n }\n return\n }\n\n if (prevNode !== node) {\n if (prevNode) {\n this.observer.unobserve(prevNode)\n }\n this.observer.observe(node)\n this.measureElementCache.set(item.key, node)\n }\n\n const measuredItemSize = this.options.measureElement(node, entry, this)\n\n const itemSize = this.itemSizeCache.get(item.key) ?? item.size\n\n const delta = measuredItemSize - itemSize\n\n if (delta !== 0) {\n if (item.start < this.scrollOffset) {\n if (process.env.NODE_ENV !== 'production' && this.options.debug) {\n console.info('correction', delta)\n }\n\n this._scrollToOffset(this.scrollOffset, {\n adjustments: (this.scrollAdjustments += delta),\n behavior: undefined,\n })\n }\n\n this.pendingMeasuredCacheIndexes.push(index)\n\n this.itemSizeCache = new Map(\n this.itemSizeCache.set(item.key, measuredItemSize),\n )\n\n this.notify()\n }\n }\n\n measureElement = (node: TItemElement | null) => {\n if (!node) {\n return\n }\n\n this._measureElement(node, undefined)\n }\n\n getVirtualItems = memo(\n () => [this.getIndexes(), this.getMeasurements()],\n (indexes, measurements) => {\n const virtualItems: VirtualItem[] = []\n\n for (let k = 0, len = indexes.length; k < len; k++) {\n const i = indexes[k]!\n const measurement = measurements[i]!\n\n virtualItems.push(measurement)\n }\n\n return virtualItems\n },\n {\n key: process.env.NODE_ENV !== 'production' && 'getIndexes',\n debug: () => this.options.debug,\n },\n )\n\n getVirtualItemForOffset = (offset: number) => {\n const measurements = this.getMeasurements()\n\n return notUndefined(\n measurements[\n findNearestBinarySearch(\n 0,\n measurements.length - 1,\n (index: number) => notUndefined(measurements[index]).start,\n offset,\n )\n ],\n )\n }\n\n getOffsetForAlignment = (toOffset: number, align: ScrollAlignment) => {\n const size = this.getSize()\n\n if (align === 'auto') {\n if (toOffset <= this.scrollOffset) {\n align = 'start'\n } else if (toOffset >= this.scrollOffset + size) {\n align = 'end'\n } else {\n align = 'start'\n }\n }\n\n if (align === 'start') {\n toOffset = toOffset\n } else if (align === 'end') {\n toOffset = toOffset - size\n } else if (align === 'center') {\n toOffset = toOffset - size / 2\n }\n\n const scrollSizeProp = this.options.horizontal\n ? 'scrollWidth'\n : 'scrollHeight'\n const scrollSize = this.scrollElement\n ? 'document' in this.scrollElement\n ? this.scrollElement.document.documentElement[scrollSizeProp]\n : this.scrollElement[scrollSizeProp]\n : 0\n\n const maxOffset = scrollSize - this.getSize()\n\n return Math.max(Math.min(maxOffset, toOffset), 0)\n }\n\n getOffsetForIndex = (index: number, align: ScrollAlignment = 'auto') => {\n index = Math.max(0, Math.min(index, this.options.count - 1))\n\n const measurement = notUndefined(this.getMeasurements()[index])\n\n if (align === 'auto') {\n if (\n measurement.end >=\n this.scrollOffset + this.getSize() - this.options.scrollPaddingEnd\n ) {\n align = 'end'\n } else if (\n measurement.start <=\n this.scrollOffset + this.options.scrollPaddingStart\n ) {\n align = 'start'\n } else {\n return [this.scrollOffset, align] as const\n }\n }\n\n const toOffset =\n align === 'end'\n ? measurement.end + this.options.scrollPaddingEnd\n : measurement.start - this.options.scrollPaddingStart\n\n return [this.getOffsetForAlignment(toOffset, align), align] as const\n }\n\n private isDynamicMode = () => this.measureElementCache.size > 0\n\n private cancelScrollToIndex = () => {\n if (this.scrollToIndexTimeoutId !== null) {\n clearTimeout(this.scrollToIndexTimeoutId)\n this.scrollToIndexTimeoutId = null\n }\n }\n\n scrollToOffset = (\n toOffset: number,\n { align = 'start', behavior }: ScrollToOffsetOptions = {},\n ) => {\n this.cancelScrollToIndex()\n\n if (behavior === 'smooth' && this.isDynamicMode()) {\n console.warn(\n 'The `smooth` scroll behavior is not fully supported with dynamic size.',\n )\n }\n\n this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {\n adjustments: undefined,\n behavior,\n })\n }\n\n scrollToIndex = (\n index: number,\n { align: initialAlign = 'auto', behavior }: ScrollToIndexOptions = {},\n ) => {\n index = Math.max(0, Math.min(index, this.options.count - 1))\n\n this.cancelScrollToIndex()\n\n if (behavior === 'smooth' && this.isDynamicMode()) {\n console.warn(\n 'The `smooth` scroll behavior is not fully supported with dynamic size.',\n )\n }\n\n const [toOffset, align] = this.getOffsetForIndex(index, initialAlign)\n\n this._scrollToOffset(toOffset, { adjustments: undefined, behavior })\n\n if (behavior !== 'smooth' && this.isDynamicMode()) {\n this.scrollToIndexTimeoutId = setTimeout(() => {\n this.scrollToIndexTimeoutId = null\n\n const elementInDOM = this.measureElementCache.has(\n this.options.getItemKey(index),\n )\n\n if (elementInDOM) {\n const [toOffset] = this.getOffsetForIndex(index, align)\n\n if (!approxEqual(toOffset, this.scrollOffset)) {\n this.scrollToIndex(index, { align, behavior })\n }\n } else {\n this.scrollToIndex(index, { align, behavior })\n }\n })\n }\n }\n\n scrollBy = (delta: number, { behavior }: ScrollToOffsetOptions = {}) => {\n this.cancelScrollToIndex()\n\n if (behavior === 'smooth' && this.isDynamicMode()) {\n console.warn(\n 'The `smooth` scroll behavior is not fully supported with dynamic size.',\n )\n }\n\n this._scrollToOffset(this.scrollOffset + delta, {\n adjustments: undefined,\n behavior,\n })\n }\n\n getTotalSize = () =>\n (this.getMeasurements()[this.options.count - 1]?.end ||\n this.options.paddingStart) -\n this.options.scrollMargin +\n this.options.paddingEnd\n\n private _scrollToOffset = (\n offset: number,\n {\n adjustments,\n behavior,\n }: {\n adjustments: number | undefined\n behavior: ScrollBehavior | undefined\n },\n ) => {\n this.options.scrollToFn(offset, { behavior, adjustments }, this)\n }\n\n measure = () => {\n this.itemSizeCache = new Map()\n this.notify()\n }\n}\n\nconst findNearestBinarySearch = (\n low: number,\n high: number,\n getCurrentValue: (i: number) => number,\n value: number,\n) => {\n while (low <= high) {\n const middle = ((low + high) / 2) | 0\n const currentValue = getCurrentValue(middle)\n\n if (currentValue < value) {\n low = middle + 1\n } else if (currentValue > value) {\n high = middle - 1\n } else {\n return middle\n }\n }\n\n if (low > 0) {\n return low - 1\n } else {\n return 0\n }\n}\n\nfunction calculateRange({\n measurements,\n outerSize,\n scrollOffset,\n}: {\n measurements: VirtualItem[]\n outerSize: number\n scrollOffset: number\n}) {\n const count = measurements.length - 1\n const getOffset = (index: number) => measurements[index]!.start\n\n const startIndex = findNearestBinarySearch(0, count, getOffset, scrollOffset)\n let endIndex = startIndex\n\n while (\n endIndex < count &&\n measurements[endIndex]!.end < scrollOffset + outerSize\n ) {\n endIndex++\n }\n\n return { startIndex, endIndex }\n}\n", "import * as React from 'react'\nimport {\n elementScroll,\n observeElementOffset,\n observeElementRect,\n observeWindowOffset,\n observeWindowRect,\n PartialKeys,\n Virtualizer,\n VirtualizerOptions,\n windowScroll,\n} from '@tanstack/virtual-core'\nexport * from '@tanstack/virtual-core'\n\n//\n\nconst useIsomorphicLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nfunction useVirtualizerBase<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>(\n options: VirtualizerOptions,\n): Virtualizer {\n const rerender = React.useReducer(() => ({}), {})[1]\n\n const resolvedOptions: VirtualizerOptions = {\n ...options,\n onChange: (instance) => {\n rerender()\n options.onChange?.(instance)\n },\n }\n\n const [instance] = React.useState(\n () => new Virtualizer(resolvedOptions),\n )\n\n instance.setOptions(resolvedOptions)\n\n React.useEffect(() => {\n return instance._didMount()\n }, [])\n\n useIsomorphicLayoutEffect(() => {\n return instance._willUpdate()\n })\n\n return instance\n}\n\nexport function useVirtualizer<\n TScrollElement extends Element,\n TItemElement extends Element,\n>(\n options: PartialKeys<\n VirtualizerOptions,\n 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'\n >,\n): Virtualizer {\n return useVirtualizerBase({\n observeElementRect: observeElementRect,\n observeElementOffset: observeElementOffset,\n scrollToFn: elementScroll,\n ...options,\n })\n}\n\nexport function useWindowVirtualizer(\n options: PartialKeys<\n VirtualizerOptions,\n | 'getScrollElement'\n | 'observeElementRect'\n | 'observeElementOffset'\n | 'scrollToFn'\n >,\n): Virtualizer {\n return useVirtualizerBase({\n getScrollElement: () => (typeof document !== 'undefined' ? window : null),\n observeElementRect: observeWindowRect,\n observeElementOffset: observeWindowOffset,\n scrollToFn: windowScroll,\n ...options,\n })\n}\n", "import { render, hydrate, unmountComponentAtNode } from 'preact/compat';\n\nexport function createRoot(container) {\n\treturn {\n\t\trender(children) {\n\t\t\trender(children, container);\n\t\t},\n\t\tunmount() {\n\t\t\tunmountComponentAtNode(container);\n\t\t}\n\t};\n}\n\nexport function hydrateRoot(container, children) {\n\thydrate(children, container);\n\treturn createRoot(container);\n}\n\nexport default {\n\tcreateRoot,\n\thydrateRoot\n};\n", "// Find the first item whose top-left corner is fully inside the visible portion of the\n// scroll container\nexport function findFirstItemInView(\n scrollContainer: HTMLElement,\n items: NodeList,\n extraPadding?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n) {\n const pad = Object.assign(\n { top: 0, right: 0, bottom: 0, left: 0 },\n extraPadding\n );\n const container = scrollContainer;\n const top = container.scrollTop + pad.top;\n const left = container.scrollLeft + pad.left;\n const bottom = top + container.clientHeight - pad.top - pad.bottom;\n const right = left + container.clientWidth - pad.left - pad.right;\n\n for (let i = 0; i < items.length; i++) {\n const el = items[i] as HTMLElement;\n const y = el.offsetTop,\n x = el.offsetLeft;\n if (y >= top && y <= bottom && x >= left && x <= right) {\n return el;\n }\n }\n return null;\n}\n\nexport function getStyle(el: Element, styleProp: string): string | undefined {\n // getComputedStyle can return null when we're inside a hidden iframe on\n // Firefox; don't attempt to retrieve style props in this case.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n return document?.defaultView\n ?.getComputedStyle(el, null)\n ?.getPropertyValue(styleProp);\n}\n", "import React, { FC, useEffect, useRef, useState } from \"react\";\n\nexport interface FilterNumericProps\n extends React.InputHTMLAttributes {\n // The absolute min/max possible values\n range: () => [number | undefined, number | undefined];\n\n // The currently selected min/max values\n from: number | undefined;\n to: number | undefined;\n\n onRangeChange: (from?: number, to?: number) => void;\n}\n\nexport const FilterNumeric: FC = (props) => {\n const [editing, setEditing] = useState(false);\n const { range, from, to, onRangeChange } = props;\n\n return (\n onRangeChange(...x)}\n onFocus={() => setEditing(true)}\n onBlur={() => setEditing(false)}\n />\n );\n};\n\nfunction generateLabel(from?: number, to?: number) {\n if (typeof from === \"undefined\" && typeof to === \"undefined\") {\n return \"\";\n } else if (typeof from === \"undefined\") {\n return `\u2264 ${to}`;\n } else if (typeof to === \"undefined\") {\n return `\u2265 ${from}`;\n } else {\n return `\u2265${from}, \u2264${to}`;\n }\n}\n\ninterface FilterNumericImplProps {\n range: () => [number | undefined, number | undefined];\n value: [number | undefined, number | undefined];\n editing: boolean;\n onValueChange: (range: [number | undefined, number | undefined]) => void;\n onFocus: () => void;\n onBlur: () => void;\n}\n\nconst FilterNumericImpl: React.FC = (props) => {\n const [min, max] = props.value;\n const { editing, onFocus } = props;\n\n const minInputRef = useRef(null);\n const maxInputRef = useRef(null);\n\n return (\n {\n if (e.currentTarget.contains(e.relatedTarget)) {\n return;\n }\n return props.onBlur();\n }}\n onFocus={() => onFocus()}\n style={{\n display: \"flex\",\n gap: \"0.5rem\",\n }}\n >\n {\n const value = coerceToNum(e.target.value);\n minInputRef.current.classList.toggle(\n \"is-invalid\",\n !e.target.checkValidity()\n );\n props.onValueChange([value, max]);\n }}\n />\n {\n const value = coerceToNum(e.target.value);\n maxInputRef.current.classList.toggle(\n \"is-invalid\",\n !e.target.checkValidity()\n );\n props.onValueChange([min, value]);\n }}\n />\n
\n );\n};\n\nfunction createPlaceholder(\n editing: boolean,\n label: string,\n value: number | undefined\n) {\n if (!editing) {\n return null;\n } else if (typeof value === \"undefined\") {\n return label;\n } else {\n return `${label} (${value})`;\n }\n}\n\nfunction coerceToNum(value: string): number | undefined {\n if (value === \"\") {\n return undefined;\n }\n return +value;\n}\n", "import {\n FiltersOptions,\n Header,\n TableOptions,\n getFacetedMinMaxValues,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n} from \"@tanstack/react-table\";\nimport React, {\n FC,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { FilterNumeric } from \"./filter-numeric\";\n\nexport function useFilter(enabled: boolean): FiltersOptions {\n if (enabled) {\n return {\n getFilteredRowModel: getFilteredRowModel(),\n getFacetedRowModel: getFacetedRowModel(),\n getFacetedUniqueValues: getFacetedUniqueValues(),\n getFacetedMinMaxValues: getFacetedMinMaxValues(),\n filterFns: {\n substring: (row, columnId, value, addMeta) => {\n return row.getValue(columnId).toString().includes(value);\n },\n },\n };\n } else {\n return {};\n }\n}\n\nexport interface FilterProps\n extends React.InputHTMLAttributes {\n header: Header;\n}\n\nexport const Filter: FC = ({ header, className, ...props }) => {\n const typeHint = header.column.columnDef.meta?.typeHint;\n\n if (typeHint.type === \"numeric\") {\n const [from, to] = (header.column.getFilterValue() as\n | [number | undefined, number | undefined]\n | undefined) ?? [undefined, undefined];\n\n const range = () => {\n return header.column.getFacetedMinMaxValues() ?? [undefined, undefined];\n };\n\n return FilterNumeric({\n from,\n to,\n range,\n onRangeChange: (from, to) => header.column.setFilterValue([from, to]),\n });\n }\n\n return (\n header.column.setFilterValue(e.target.value)}\n />\n );\n};\n", "export class ImmutableSet {\n private _set: Set;\n private static _empty: ImmutableSet = new ImmutableSet(new Set());\n\n private constructor(set: Set) {\n this._set = set;\n }\n\n static empty(): ImmutableSet {\n return this._empty as ImmutableSet;\n }\n\n static just(...values: T[]): ImmutableSet {\n return this.empty().add(...values);\n }\n\n has(value: T): boolean {\n return this._set.has(value);\n }\n\n add(...values: T[]): ImmutableSet {\n const newSet = new Set(this._set.keys());\n for (const value of values) {\n newSet.add(value);\n }\n return new ImmutableSet(newSet);\n }\n\n toggle(value: T): ImmutableSet {\n if (this.has(value)) {\n return this.delete(value);\n } else {\n return this.add(value);\n }\n }\n\n delete(value: T): ImmutableSet {\n const newSet = new Set(this._set.keys());\n newSet.delete(value);\n return new ImmutableSet(newSet);\n }\n\n clear(): ImmutableSet {\n return ImmutableSet.empty();\n }\n\n [Symbol.iterator]() {\n return this._set[Symbol.iterator]();\n }\n\n toList(): T[] {\n return [...this._set.keys()];\n }\n}\n", "import * as React from \"react\";\nimport { useState } from \"react\";\nimport { ImmutableSet } from \"./immutable-set\";\n\nexport interface SelectionSet {\n has(key: TKey): boolean;\n set(key: TKey, selected: boolean): void;\n clear(): void;\n keys(): ImmutableSet;\n itemHandlers(): {\n onMouseDown: (event: React.MouseEvent) => void;\n onKeyDown: (event: React.KeyboardEvent) => void;\n };\n}\n\nexport enum SelectionMode {\n None = \"none\",\n Single = \"single\",\n Multiple = \"multiple\",\n MultiNative = \"multi-native\",\n}\n\nexport function useSelection(\n mode: SelectionMode,\n keyAccessor: (el: TElement) => TKey,\n focusOffset: (start: TKey, offset: number) => TKey,\n between?: (from: TKey, to: TKey) => ReadonlyArray\n): SelectionSet {\n const [selectedKeys, setSelectedKeys] = useState>(\n ImmutableSet.empty()\n );\n\n // The anchor is the item that was most recently selected with a click or ctrl-click,\n // and is used to determine the \"other end\" of a shift-click selection operation.\n const [anchor, setAnchor] = useState(null);\n\n const onMouseDown = (event: React.MouseEvent): void => {\n if (mode === SelectionMode.None) {\n return;\n }\n\n const el = event.currentTarget as TElement;\n const key = keyAccessor(el);\n\n const result = performMouseDownAction(\n mode,\n between,\n selectedKeys,\n event,\n key,\n anchor\n );\n if (result) {\n setSelectedKeys(result.selection);\n if (result.anchor) {\n setAnchor(key);\n el.focus();\n }\n event.preventDefault();\n }\n };\n\n const onKeyDown = (event: React.KeyboardEvent): void => {\n if (mode === SelectionMode.None) {\n return;\n }\n\n const el = event.currentTarget as TElement;\n const key = keyAccessor(el);\n const selected = selectedKeys.has(key);\n\n if (mode === SelectionMode.Single) {\n if (event.key === \" \" || event.key === \"Enter\") {\n if (selectedKeys.has(key)) {\n setSelectedKeys(ImmutableSet.empty());\n } else {\n setSelectedKeys(ImmutableSet.just(key));\n }\n event.preventDefault();\n } else if (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n const targetKey = focusOffset(key, event.key === \"ArrowUp\" ? -1 : 1);\n if (targetKey) {\n event.preventDefault();\n if (selected) {\n setSelectedKeys(ImmutableSet.just(targetKey));\n }\n }\n }\n } else if (mode === SelectionMode.Multiple) {\n if (event.key === \" \" || event.key === \"Enter\") {\n setSelectedKeys(selectedKeys.toggle(key));\n event.preventDefault();\n } else if (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n if (focusOffset(key, event.key === \"ArrowUp\" ? -1 : 1)) {\n event.preventDefault();\n }\n }\n }\n };\n\n return {\n has(key: TKey): boolean {\n return selectedKeys.has(key);\n },\n\n set(key: TKey, selected: boolean) {\n if (selected) {\n setSelectedKeys(selectedKeys.add(key));\n } else {\n setSelectedKeys(selectedKeys.delete(key));\n }\n },\n\n clear() {\n setSelectedKeys(selectedKeys.clear());\n },\n\n keys() {\n return selectedKeys;\n },\n\n itemHandlers() {\n return { onMouseDown, onKeyDown };\n },\n };\n}\n\ndeclare global {\n interface Navigator {\n readonly userAgentData?: NavigatorUAData;\n }\n interface NavigatorUAData {\n readonly brands?: { brand: string; version: string }[];\n readonly mobile?: boolean;\n readonly platform?: string;\n }\n}\n\nconst isMac = /^mac/i.test(\n window.navigator.userAgentData?.platform ?? window.navigator.platform\n);\n\nfunction performMouseDownAction(\n mode: SelectionMode,\n between: (from: TKey, to: TKey) => readonly TKey[],\n selectedKeys: ImmutableSet,\n event: React.MouseEvent,\n key: TKey,\n anchor: TKey | null\n): { selection: ImmutableSet; anchor?: true } {\n const { shiftKey, altKey } = event;\n const ctrlKey = isMac ? event.metaKey : event.ctrlKey;\n const metaKey = isMac ? event.ctrlKey : event.metaKey;\n\n if (metaKey || altKey) {\n return null;\n }\n\n if (mode === SelectionMode.Multiple) {\n return { selection: selectedKeys.toggle(key), anchor: true };\n } else if (mode === SelectionMode.Single) {\n if (ctrlKey && !shiftKey) {\n // Ctrl-click is like simple click, except it removes selection if an item is\n // already selected\n if (selectedKeys.has(key)) {\n return { selection: ImmutableSet.empty(), anchor: true };\n } else {\n return { selection: ImmutableSet.just(key), anchor: true };\n }\n } else {\n // Simple click sets selection, always\n return { selection: ImmutableSet.just(key), anchor: true };\n }\n } else if (mode === SelectionMode.MultiNative) {\n if (shiftKey && ctrlKey) {\n // Ctrl-Shift-click: Add anchor row through current row to selection\n const toSelect = between(anchor, key);\n return { selection: selectedKeys.add(...toSelect) };\n } else if (ctrlKey) {\n // Ctrl-click: toggle the current row and make it anchor\n return { selection: selectedKeys.toggle(key), anchor: true };\n } else if (shiftKey) {\n // Shift-click: replace selection with anchor row through current row\n if (anchor !== null && between) {\n const toSelect = between(anchor, key);\n return { selection: ImmutableSet.just(...toSelect) };\n }\n } else {\n // Regular click: Select the current row and make it anchor\n return { selection: ImmutableSet.just(key), anchor: true };\n }\n }\n}\n", "import { SortDirection } from \"@tanstack/react-table\";\nimport React, { FC } from \"react\";\n\nconst sortCommonProps = {\n className: \"sort-arrow\",\n viewBox: [-1, -1, 2, 2].map((x) => x * 1.4).join(\" \"),\n width: \"100%\",\n height: \"100%\",\n style: { paddingLeft: \"3px\" },\n};\n\nconst sortPathCommonProps = {\n stroke: \"#333333\",\n strokeWidth: \"0.6\",\n fill: \"transparent\",\n};\n\nconst sortArrowUp = (\n \n \n \n);\n\nconst sortArrowDown = (\n \n \n \n);\n\ninterface SortArrowProps {\n direction: SortDirection | false;\n}\n\nexport const SortArrow: FC = ({ direction }) => {\n if (!direction) {\n return null;\n }\n if (direction === \"asc\") {\n return sortArrowUp;\n }\n if (direction === \"desc\") {\n return sortArrowDown;\n }\n throw new Error(`Unexpected sort direction: '${direction}'`);\n};\n\n//const sortArrowUp = \u25B2;\n//const sortArrowDown = \u25BC;\n", "import React, { useState } from \"react\";\nimport { findFirstItemInView } from \"./dom-utils\";\n\nexport interface TabindexGroup {\n containerTabIndex: number;\n containerHandlers: {\n onFocus: (event: React.FocusEvent) => void;\n onBlur: (event: React.FocusEvent) => void;\n };\n}\n\nexport function useTabindexGroup(\n container: TContainerElement,\n focusableItems: () => NodeList,\n extraPadding?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n }\n): TabindexGroup {\n const [tabIndex, setTabIndex] = useState(0);\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent) => {\n // When focus is within (or on, but we only really care about within) the\n // container, remove it from the tab order. If we don't set the tab stop to -1,\n // then the logic below (that, on container focus, moves focus to the first item)\n // causes Shift-Tab from a focused item to break, as focus moves to the container\n // and then (back) to the first item.\n setTabIndex(-1);\n\n if (event.target !== event.currentTarget) {\n // Not interested in capturing, only care about focus on the container itself\n return;\n }\n findFirstItemInView(container, focusableItems(), extraPadding)?.focus();\n },\n [container, focusableItems, extraPadding]\n );\n\n const onBlur = React.useCallback(\n (event: React.FocusEvent) => {\n setTabIndex(0);\n },\n []\n );\n\n return {\n containerTabIndex: tabIndex,\n containerHandlers: {\n onFocus,\n onBlur,\n },\n };\n}\n", "import { VirtualItem } from \"@tanstack/react-virtual\";\nimport React, { useMemo } from \"react\";\n\n/**\n * Create a summary\n *\n * @param summaryTemplate A string with \"{start}\", \"{end}\", and \"{total}\"\n * @param scrollContainer Scrolling container of the table/grid\n * @param virtualRows VirtualItem objects that might currently be visible\n * @param thead The thead tag of the table\n * @param nrows Number of total rows of data that exist\n */\nexport function useSummary(\n summaryTemplate: string | boolean | null,\n scrollContainer: HTMLElement | null,\n virtualRows: VirtualItem[],\n thead: HTMLTableSectionElement,\n nrows: number\n): JSX.Element | null {\n return useMemo(() => {\n const summaryOption = summaryTemplate ?? true;\n if (!summaryOption) {\n return null;\n }\n\n const template =\n typeof summaryOption === \"string\"\n ? summaryOption\n : \"Viewing rows {start} through {end} of {total}\";\n\n if (!scrollContainer) {\n return null;\n }\n if (virtualRows.length === 0) {\n return null;\n }\n\n const top = scrollContainer.scrollTop + thead.clientHeight;\n const bot = scrollContainer.scrollTop + scrollContainer.clientHeight;\n\n const [firstIndex, lastIndex] = findRangeIndex(\n top,\n bot,\n virtualRows,\n (vrow, start) => vrow.start + vrow.size / 2\n );\n\n if (firstIndex === null || lastIndex === null) {\n // Something must've gone wrong if there are rows but none of them are within the\n // visible scroll area... shrug\n return null;\n }\n\n const firstRow = virtualRows[firstIndex];\n const lastRow = virtualRows[lastIndex];\n\n if (firstRow.index === 0 && lastRow.index === nrows - 1) {\n // Viewing all rows; no need for a summary\n return null;\n }\n\n const summaryMessage = formatSummary(\n template,\n firstRow.index + 1,\n lastRow.index + 1,\n nrows\n );\n\n return
{summaryMessage}
;\n }, [summaryTemplate, scrollContainer, virtualRows, thead, nrows]);\n}\n\n/**\n * Find the subset of (sorted) items that are between start and end (inclusive), where\n * each item's value to compare is calculated by a mapping function. The mapping\n * function may behave differently when comparing to start vs. end.\n *\n * @param start The smallest value to include.\n * @param end The largest value to include.\n * @param items A set of items to be evaluated, in sorted order.\n * @param map A function for converting from an item to a comparison value; for example,\n * if 'start' and 'end' are vertical pixel coordinates, then the function might\n * return the item's vertical top (for start) or bottom (for end) coordinate.\n * @returns The start and end indexes into the 'items' array indicating the first and\n * last item that is included.\n */\nfunction findRangeIndex(\n start: number,\n end: number,\n items: TItem[],\n map: (x: TItem, start: boolean) => number\n): [first: number | null, last: number | null] {\n let first: number | null = null;\n let last: number | null = null;\n\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (first === null) {\n if (map(item, true) >= start) {\n first = i;\n last = i;\n }\n } else {\n if (map(item, false) <= end) {\n last = i;\n } else {\n break;\n }\n }\n }\n\n return [first, last];\n}\n\nfunction formatSummary(\n template: string,\n start: number,\n end: number,\n total: number\n) {\n return template.replace(/\\{(start|end|total)\\}/g, (substr, token) => {\n if (token === \"start\") {\n return start + \"\";\n } else if (token === \"end\") {\n return end + \"\";\n } else if (token === \"total\") {\n return total + \"\";\n } else {\n return substr;\n }\n });\n}\n", "import css from \"./styles.scss\";\n\nimport {\n Column,\n ColumnDef,\n RowData,\n RowModel,\n TableOptions,\n flexRender,\n getCoreRowModel,\n getSortedRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { Virtualizer, useVirtualizer } from \"@tanstack/react-virtual\";\nimport React, {\n FC,\n StrictMode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { Root, createRoot } from \"react-dom/client\";\nimport { ErrorsMessageValue } from \"rstudio-shiny/srcts/types/src/shiny/shinyapp\";\nimport { findFirstItemInView, getStyle } from \"./dom-utils\";\nimport { Filter, useFilter } from \"./filter\";\nimport { SelectionMode, useSelection } from \"./selection\";\nimport { SortArrow } from \"./sort-arrows\";\nimport { useTabindexGroup } from \"./tabindex-group\";\nimport { useSummary } from \"./table-summary\";\nimport { PandasData, TypeHint } from \"./types\";\n\ndeclare module \"@tanstack/table-core\" {\n interface ColumnMeta {\n typeHint: TypeHint;\n }\n}\n// TODO: Right-align numeric columns, maybe change font\n// TODO: Explicit column widths\n// TODO: Filtering\n// TODO: Editing\n// TODO: Pagination\n// TODO: Range selection + copying\n// TODO: Find\n// TODO: Server-side mode (don't pull all data to client at once)\n// TODO: Localization of summary\n// TODO: Accessibility review\n// TODO: Drag to resize columns\n// TODO: Drag to resize table/grid\n// TODO: Row numbers\n\ninterface ShinyDataGridProps {\n id: string | null;\n data: PandasData;\n bgcolor?: string;\n}\n\nconst ShinyDataGrid: FC> = (props) => {\n const { id, data, bgcolor } = props;\n const { columns, index, type_hints, data: rowData } = data;\n const { width, height, filters: withFilters } = data.options;\n const keyToIndex: Record = {};\n index.forEach((value) => {\n keyToIndex[value + \"\"] = value;\n });\n\n const containerRef = useRef(null);\n const theadRef = useRef(null);\n const tbodyRef = useRef(null);\n\n const coldefs = useMemo[]>(\n () =>\n columns.map((colname, i) => {\n const typeHint = type_hints?.[i];\n\n return {\n accessorFn: (row, index) => {\n return row[i];\n },\n // TODO: delegate this decision to something in filter.tsx\n filterFn:\n typeHint.type === \"numeric\" ? \"inNumberRange\" : \"includesString\",\n header: colname,\n meta: {\n typeHint: typeHint,\n },\n };\n }),\n [columns]\n );\n\n // Not sure if it's even necessary to clone\n const dataClone = useMemo(() => [...rowData], [rowData]);\n\n const filterOpts = useFilter(withFilters);\n\n const options: TableOptions = {\n data: dataClone,\n columns: coldefs,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n ...filterOpts,\n //debugAll: true,\n };\n const table = useReactTable(options);\n\n const rowVirtualizer = useVirtualizer({\n count: table.getFilteredRowModel().rows.length,\n getScrollElement: () => containerRef.current,\n estimateSize: () => 31,\n paddingStart: theadRef.current?.clientHeight ?? 0,\n // In response to https://github.com/rstudio/py-shiny/pull/538/files#r1228352446\n // (the default scrollingDelay is 150)\n scrollingDelay: 10,\n });\n\n // Reset scroll when dataset changes\n useLayoutEffect(() => {\n rowVirtualizer.scrollToOffset(0);\n }, [data]);\n\n const totalSize = rowVirtualizer.getTotalSize();\n const virtualRows = rowVirtualizer.getVirtualItems();\n\n // paddingTop and paddingBottom are to force the to add up to the correct\n // virtual height.\n // paddingTop must subtract out the thead height, since thead is inside the scroll\n // container but not virtualized.\n const paddingTop =\n (virtualRows.length > 0 ? virtualRows?.[0]?.start || 0 : 0) -\n theadRef.current?.clientHeight ?? 0;\n const paddingBottom =\n virtualRows.length > 0\n ? totalSize - (virtualRows?.[virtualRows.length - 1]?.end || 0)\n : 0;\n\n const summary = useSummary(\n data.options[\"summary\"],\n containerRef?.current,\n virtualRows,\n theadRef.current,\n rowVirtualizer.options.count\n );\n\n const tableStyle = data.options[\"style\"] ?? \"grid\";\n const containerClass =\n tableStyle === \"grid\" ? \"shiny-data-grid-grid\" : \"shiny-data-grid-table\";\n const tableClass = tableStyle === \"table\" ? \"table table-sm\" : null;\n\n const rowSelectionMode =\n data.options[\"row_selection_mode\"] ?? SelectionMode.MultiNative;\n const canSelect = rowSelectionMode !== SelectionMode.None;\n const canMultiSelect =\n rowSelectionMode === SelectionMode.MultiNative ||\n rowSelectionMode === SelectionMode.Multiple;\n\n const rowSelection = useSelection(\n rowSelectionMode,\n (el) => el.dataset.key,\n (key, offset) => {\n const rowModel = table.getSortedRowModel();\n let index = rowModel.rows.findIndex((row) => row.id === key);\n if (index < 0) {\n return null;\n }\n index += offset;\n if (index < 0 || index >= rowModel.rows.length) {\n return null;\n }\n const targetKey = rowModel.rows[index].id;\n rowVirtualizer.scrollToIndex(index);\n setTimeout(() => {\n const targetEl = containerRef.current?.querySelector(\n `[data-key='${targetKey}']`\n ) as HTMLElement | null;\n targetEl?.focus();\n }, 0);\n return targetKey;\n },\n (fromKey, toKey) =>\n findKeysBetween(table.getSortedRowModel(), fromKey, toKey)\n );\n\n useEffect(() => {\n if (id) {\n if (rowSelectionMode === SelectionMode.None) {\n Shiny.setInputValue(`${id}_selected_rows`, null);\n } else {\n Shiny.setInputValue(\n `${id}_selected_rows`,\n rowSelection\n .keys()\n .toList()\n .map((key) => keyToIndex[key])\n );\n }\n }\n }, [[...rowSelection.keys()]]);\n\n const tbodyTabItems = React.useCallback(\n () => tbodyRef.current.querySelectorAll(\"[tabindex='-1']\"),\n [tbodyRef.current]\n );\n const tbodyTabGroup = useTabindexGroup(containerRef.current, tbodyTabItems, {\n top: theadRef.current?.clientHeight ?? 0,\n });\n\n // Reset sorting and selection whenever dataset changes. (Should we do this?)\n useEffect(() => {\n return () => {\n table.resetSorting();\n rowSelection.clear();\n };\n }, [data]);\n\n const headerRowCount = table.getHeaderGroups().length;\n\n const scrollingClass =\n containerRef.current?.scrollHeight > containerRef.current?.clientHeight\n ? \"scrolling\"\n : \"\";\n\n const makeHeaderKeyDown =\n (column: Column) => (event: React.KeyboardEvent) => {\n if (event.key === \" \" || event.key === \"Enter\") {\n column.toggleSorting(undefined, event.shiftKey);\n }\n };\n\n const measureEl = useVirtualizerMeasureWorkaround(rowVirtualizer);\n\n return (\n <>\n \n \n \n {table.getHeaderGroups().map((headerGroup, i) => (\n \n {headerGroup.headers.map((header) => {\n return (\n \n {header.isPlaceholder ? null : (\n \n {flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n \n \n )}\n \n );\n })}\n \n ))}\n {withFilters && (\n \n {table.getFlatHeaders().map((header) => {\n return (\n \n \n \n );\n })}\n \n )}\n \n \n {paddingTop > 0 && }\n {virtualRows.map((virtualRow) => {\n const row = table.getRowModel().rows[virtualRow.index];\n return (\n row && (\n \n {row.getVisibleCells().map((cell) => {\n return (\n \n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext()\n )}\n \n );\n })}\n \n )\n );\n })}\n {paddingBottom > 0 && (\n \n )}\n \n \n \n {summary}\n \n );\n};\n\nfunction findKeysBetween(\n rowModel: RowModel,\n fromKey: string,\n toKey: string\n): readonly string[] {\n let fromIdx = rowModel.rows.findIndex((row) => row.id === fromKey);\n let toIdx = rowModel.rows.findIndex((row) => row.id === toKey);\n if (fromIdx < 0 || toIdx < 0) {\n return [];\n }\n if (fromIdx > toIdx) {\n // Swap order to simplify things\n [fromIdx, toIdx] = [toIdx, fromIdx];\n }\n const keys = [];\n for (let i = fromIdx; i <= toIdx; i++) {\n keys.push(rowModel.rows[i].id);\n }\n return keys;\n}\n\n/**\n * Works around a problem where the ref={...} callback is called before the element to\n * be measured is attached to the DOM, which will result in the virtualizer using its\n * estimated size instead of the actual size. This hook will detect when elements that\n * are not yet attached to the DOM are measured, and will retry measuring them in the\n * useEffect.\n * @returns A callback that can be used as a ref for an element that needs to be measured.\n */\nfunction useVirtualizerMeasureWorkaround(\n rowVirtualizer: Virtualizer\n) {\n // Tracks elements that need to be measured, but are not yet attached to the DOM\n const measureTodoQueue = useRef([]);\n\n // This is the callback that will be passed back to the caller, intended to be used as\n // a ref for each virtual item's element.\n const measureElementWithRetry = useCallback(\n (el: Element) => {\n if (!el) {\n return;\n }\n\n if (el.isConnected) {\n rowVirtualizer.measureElement(el);\n } else {\n measureTodoQueue.current.push(el as HTMLElement);\n }\n },\n [rowVirtualizer]\n );\n\n // Once the DOM is updated, try to measure any elements that were not yet attached\n useLayoutEffect(() => {\n if (measureTodoQueue.current.length > 0) {\n const todo = measureTodoQueue.current.splice(0);\n // The next line can mutate measureTodoQueue.current, hence the need to splice out\n // all the items to work on before actually calling measureElement on any of them.\n todo.forEach(rowVirtualizer.measureElement);\n }\n });\n\n return measureElementWithRetry;\n}\n\nclass ShinyDataFrameOutputBinding extends Shiny.OutputBinding {\n find(scope: HTMLElement | JQuery): JQuery {\n return $(scope).find(\"shiny-data-frame\");\n }\n\n renderValue(el: ShinyDataFrameOutput, data: unknown): void {\n el.renderValue(data);\n }\n\n renderError(el: ShinyDataFrameOutput, err: ErrorsMessageValue): void {\n el.classList.add(\"shiny-output-error\");\n el.renderError(err);\n }\n\n clearError(el: ShinyDataFrameOutput): void {\n el.classList.remove(\"shiny-output-error\");\n el.clearError();\n }\n}\nShiny.outputBindings.register(\n new ShinyDataFrameOutputBinding(),\n \"shinyDataFrame\"\n);\n\nfunction getComputedBgColor(el: HTMLElement | null): string | null | undefined {\n if (!el) {\n // Top of document, can't recurse further\n return null;\n }\n\n const bgColor = getStyle(el, \"background-color\");\n\n if (!bgColor) return bgColor;\n const m = bgColor.match(\n /^rgba\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*\\)$/\n );\n\n if (bgColor === \"transparent\" || (m && parseFloat(m[4]) === 0)) {\n // No background color on this element. See if it has a background image.\n const bgImage = getStyle(el, \"background-image\");\n\n if (bgImage && bgImage !== \"none\") {\n // Failed to detect background color, since it has a background image\n return null;\n } else {\n // Recurse\n return getComputedBgColor(el.parentElement);\n }\n }\n return bgColor;\n}\n\nconst cssTemplate = document.createElement(\"template\");\ncssTemplate.innerHTML = ``;\n\nexport class ShinyDataFrameOutput extends HTMLElement {\n reactRoot?: Root;\n errorRoot: HTMLSpanElement;\n\n connectedCallback() {\n // Currently not using shadow DOM since Bootstrap's table styling is pretty nice and\n // I don't have time to duplicate all that right now.\n // this.attachShadow({ mode: \"open\" });\n // const target = this.shadowRoot!;\n\n const [target] = [this]; // brackets are to avoid linter\n\n target.appendChild(cssTemplate.content.cloneNode(true));\n\n // Need to put error messages in an inline element () instead of in the\n // reactRoot div, because we want the error messages to appear on the same line as\n // \"Error:\".\n this.errorRoot = document.createElement(\"span\");\n target.appendChild(this.errorRoot);\n\n const myDiv = document.createElement(\"div\");\n myDiv.classList.add(\"html-fill-container\", \"html-fill-item\");\n target.appendChild(myDiv);\n\n this.reactRoot = createRoot(myDiv);\n\n // If there is a \n * ```\n * @nocollapse\n * @category styles\n */\n static styles?: CSSResultGroup;\n\n /**\n * The set of properties defined by this class that caused an accessor to be\n * added during `createProperty`.\n * @nocollapse\n */\n private static __reactivePropertyKeys?: Set;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this.elementProperties.forEach((v, p) => {\n const attr = this.__attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n // if this is a state property, force the attribute to false.\n if (options.state) {\n // Cast as any since this is readonly.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (options as any).attribute = false;\n }\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure finalization has been kicked off.\n this.finalize();\n this.elementProperties.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n if (DEV_MODE) {\n // If this class doesn't have its own set, create one and initialize\n // with the values in the set from the nearest ancestor class, if any.\n if (!this.hasOwnProperty('__reactivePropertyKeys')) {\n this.__reactivePropertyKeys = new Set(\n this.__reactivePropertyKeys ?? []\n );\n }\n this.__reactivePropertyKeys!.add(name);\n }\n }\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n protected static getPropertyDescriptor(\n name: PropertyKey,\n key: string | symbol,\n options: PropertyDeclaration\n ): PropertyDescriptor | undefined {\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: ReactiveElement, value: unknown) {\n const oldValue = (this as {} as {[key: string]: unknown})[\n name as string\n ];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as ReactiveElement).requestUpdate(\n name,\n oldValue,\n options\n );\n },\n configurable: true,\n enumerable: true,\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name: PropertyKey) {\n return this.elementProperties.get(name) || defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties, sets up element\n * styling, and ensures any superclasses are also finalized. Returns true if\n * the element was finalized.\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(finalized)) {\n return false;\n }\n this[finalized] = true;\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this) as typeof ReactiveElement;\n superCtor.finalize();\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n this.elementProperties = new Map(superCtor.elementProperties);\n // initialize Map populated in observedAttributes\n this.__attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...Object.getOwnPropertySymbols(props),\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeScript lack of support for symbol in\n // index types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.createProperty(p, (props as any)[p]);\n }\n }\n this.elementStyles = this.finalizeStyles(this.styles);\n // DEV mode warnings\n if (DEV_MODE) {\n const warnRemovedOrRenamed = (name: string, renamed = false) => {\n if (this.prototype.hasOwnProperty(name)) {\n issueWarning(\n renamed ? 'renamed-api' : 'removed-api',\n `\\`${name}\\` is implemented on class ${this.name}. It ` +\n `has been ${renamed ? 'renamed' : 'removed'} ` +\n `in this version of LitElement.`\n );\n }\n };\n warnRemovedOrRenamed('initialize');\n warnRemovedOrRenamed('requestUpdateInternal');\n warnRemovedOrRenamed('_getUpdateComplete', true);\n }\n return true;\n }\n\n /**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n protected static finalizeStyles(\n styles?: CSSResultGroup\n ): Array {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set((styles as Array).flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative));\n }\n } else if (styles !== undefined) {\n elementStyles.push(getCompatibleStyle(styles));\n }\n return elementStyles;\n }\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n * @category rendering\n */\n readonly renderRoot!: HTMLElement | ShadowRoot;\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static __attributeNameForProperty(\n name: PropertyKey,\n options: PropertyDeclaration\n ) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n\n private __instanceProperties?: PropertyValues = new Map();\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private __updatePromise!: Promise;\n\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n isUpdatePending = false;\n\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n hasUpdated = false;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n *\n * @internal\n */\n _$changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private __reflectingProperties?: Map;\n\n /**\n * Name of currently reflecting property\n */\n private __reflectingProperty: PropertyKey | null = null;\n\n /**\n * Set of controllers.\n */\n private __controllers?: ReactiveController[];\n\n constructor() {\n super();\n this._initialize();\n }\n\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n *\n * @internal\n */\n _initialize() {\n this.__updatePromise = new Promise(\n (res) => (this.enableUpdating = res)\n );\n this._$changedProperties = new Map();\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n (this.constructor as typeof ReactiveElement)._initializers?.forEach((i) =>\n i(this)\n );\n }\n\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller: ReactiveController) {\n (this.__controllers ??= []).push(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller: ReactiveController) {\n // Note, if the indexOf is -1, the >>> will flip the sign which makes the\n // splice do nothing.\n this.__controllers?.splice(this.__controllers.indexOf(controller) >>> 0, 1);\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private __saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof ReactiveElement).elementProperties.forEach(\n (_v, p) => {\n if (this.hasOwnProperty(p)) {\n this.__instanceProperties!.set(p, this[p as keyof this]);\n delete this[p as keyof this];\n }\n }\n );\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n protected createRenderRoot(): Element | ShadowRoot {\n const renderRoot =\n this.shadowRoot ??\n this.attachShadow(\n (this.constructor as typeof ReactiveElement).shadowRootOptions\n );\n adoptStyles(\n renderRoot,\n (this.constructor as typeof ReactiveElement).elementStyles\n );\n return renderRoot;\n }\n\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // create renderRoot before first update.\n if (this.renderRoot === undefined) {\n (\n this as {\n renderRoot: Element | DocumentFragment;\n }\n ).renderRoot = this.createRenderRoot();\n }\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n protected enableUpdating(_requestedUpdate: boolean) {}\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(\n name: string,\n _old: string | null,\n value: string | null\n ) {\n this._$attributeToProperty(name, value);\n }\n\n private __propertyToAttribute(\n name: PropertyKey,\n value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n const attr = (\n this.constructor as typeof ReactiveElement\n ).__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter =\n (options.converter as ComplexAttributeConverter)?.toAttribute !==\n undefined\n ? (options.converter as ComplexAttributeConverter)\n : defaultConverter;\n const attrValue = converter.toAttribute!(value, options.type);\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.indexOf(\n 'migration'\n ) >= 0 &&\n attrValue === undefined\n ) {\n issueWarning(\n 'undefined-attribute-value',\n `The attribute value for the ${name as string} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`\n );\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /** @internal */\n _$attributeToProperty(name: string, value: string | null) {\n const ctor = this.constructor as typeof ReactiveElement;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = (ctor.__attributeToPropertyMap as AttributeMap).get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter =\n typeof options.converter === 'function'\n ? {fromAttribute: options.converter}\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n this[propName as keyof this] = converter.fromAttribute!(\n value,\n options.type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @category updates\n */\n requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration\n ): void {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n options =\n options ||\n (this.constructor as typeof ReactiveElement).getPropertyOptions(name);\n const hasChanged = options.hasChanged || notEqual;\n if (hasChanged(this[name as keyof this], oldValue)) {\n if (!this._$changedProperties.has(name)) {\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true && this.__reflectingProperty !== name) {\n if (this.__reflectingProperties === undefined) {\n this.__reflectingProperties = new Map();\n }\n this.__reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this.isUpdatePending && shouldRequestUpdate) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n // Note, since this no longer returns a promise, in dev mode we return a\n // thenable which warns if it's called.\n return DEV_MODE\n ? (requestUpdateThenable(this.localName) as unknown as void)\n : undefined;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n } catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n protected scheduleUpdate(): void | Promise {\n return this.performUpdate();\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * Note: To ensure `performUpdate()` synchronously completes a pending update,\n * it should not be overridden. In LitElement 2.x it was suggested to override\n * `performUpdate()` to also customizing update scheduling. Instead, you should now\n * override `scheduleUpdate()`. For backwards compatibility with LitElement 2.x,\n * scheduling updates via `performUpdate()` continues to work, but will make\n * also calling `performUpdate()` to synchronously process updates difficult.\n *\n * @category updates\n */\n protected performUpdate(): void | Promise {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({kind: 'update'});\n // create renderRoot before first update.\n if (!this.hasUpdated) {\n // Produce warning if any class properties are shadowed by class fields\n if (DEV_MODE) {\n const shadowedProperties: string[] = [];\n (\n this.constructor as typeof ReactiveElement\n ).__reactivePropertyKeys?.forEach((p) => {\n if (this.hasOwnProperty(p) && !this.__instanceProperties?.has(p)) {\n shadowedProperties.push(p as string);\n }\n });\n if (shadowedProperties.length) {\n throw new Error(\n `The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`\n );\n }\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.__instanceProperties!.forEach((v, p) => ((this as any)[p] = v));\n this.__instanceProperties = undefined;\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n } else {\n this.__markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n protected willUpdate(_changedProperties: PropertyValues): void {}\n\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties: PropertyValues) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (\n DEV_MODE &&\n this.isUpdatePending &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.indexOf(\n 'change-in-update'\n ) >= 0\n ) {\n issueWarning(\n 'change-in-update',\n `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`\n );\n }\n }\n\n private __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete(): Promise {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n protected getUpdateComplete(): Promise {\n return this.__updatePromise;\n }\n\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected update(_changedProperties: PropertyValues) {\n if (this.__reflectingProperties !== undefined) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this.__reflectingProperties.forEach((v, k) =>\n this.__propertyToAttribute(k, this[k as keyof this], v)\n );\n this.__reflectingProperties = undefined;\n }\n this.__markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected updated(_changedProperties: PropertyValues) {}\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected firstUpdated(_changedProperties: PropertyValues) {}\n}\n\n// Apply polyfills if available\npolyfillSupport?.({ReactiveElement});\n\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = ['change-in-update'];\n const ensureOwnWarnings = function (ctor: typeof ReactiveElement) {\n if (\n !ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))\n ) {\n ctor.enabledWarnings = ctor.enabledWarnings!.slice();\n }\n };\n ReactiveElement.enableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n if (this.enabledWarnings!.indexOf(warning) < 0) {\n this.enabledWarnings!.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings!.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings!.splice(i, 1);\n }\n };\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('1.6.2');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n// Use window for browser builds because IE11 doesn't have globalThis.\nconst global = NODE_MODE ? globalThis : window;\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LitUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | TemplatePrep\n | TemplateInstantiated\n | TemplateInstantiatedAndUpdated\n | TemplateUpdating\n | BeginRender\n | EndRender\n | CommitPartEntry\n | SetPartValue;\n export interface TemplatePrep {\n kind: 'template prep';\n template: Template;\n strings: TemplateStringsArray;\n clonableTemplate: HTMLTemplateElement;\n parts: TemplatePart[];\n }\n export interface BeginRender {\n kind: 'begin render';\n id: number;\n value: unknown;\n container: HTMLElement | DocumentFragment;\n options: RenderOptions | undefined;\n part: ChildPart | undefined;\n }\n export interface EndRender {\n kind: 'end render';\n id: number;\n value: unknown;\n container: HTMLElement | DocumentFragment;\n options: RenderOptions | undefined;\n part: ChildPart;\n }\n export interface TemplateInstantiated {\n kind: 'template instantiated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array;\n values: unknown[];\n }\n export interface TemplateInstantiatedAndUpdated {\n kind: 'template instantiated and updated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array;\n values: unknown[];\n }\n export interface TemplateUpdating {\n kind: 'template updating';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n parts: Array;\n values: unknown[];\n }\n export interface SetPartValue {\n kind: 'set part';\n part: Part;\n value: unknown;\n valueIndex: number;\n values: unknown[];\n templateInstance: TemplateInstance;\n }\n\n export type CommitPartEntry =\n | CommitNothingToChildEntry\n | CommitText\n | CommitNode\n | CommitAttribute\n | CommitProperty\n | CommitBooleanAttribute\n | CommitEventListener\n | CommitToElementBinding;\n\n export interface CommitNothingToChildEntry {\n kind: 'commit nothing to child';\n start: ChildNode;\n end: ChildNode | null;\n parent: Disconnectable | undefined;\n options: RenderOptions | undefined;\n }\n\n export interface CommitText {\n kind: 'commit text';\n node: Text;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitNode {\n kind: 'commit node';\n start: Node;\n parent: Disconnectable | undefined;\n value: Node;\n options: RenderOptions | undefined;\n }\n\n export interface CommitAttribute {\n kind: 'commit attribute';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitProperty {\n kind: 'commit property';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitBooleanAttribute {\n kind: 'commit boolean attribute';\n element: Element;\n name: string;\n value: boolean;\n options: RenderOptions | undefined;\n }\n\n export interface CommitEventListener {\n kind: 'commit event listener';\n element: Element;\n name: string;\n value: unknown;\n oldListener: unknown;\n options: RenderOptions | undefined;\n // True if we're removing the old event listener (e.g. because settings changed, or value is nothing)\n removeListener: boolean;\n // True if we're adding a new event listener (e.g. because first render, or settings changed)\n addListener: boolean;\n }\n\n export interface CommitToElementBinding {\n kind: 'commit to element binding';\n element: Element;\n value: unknown;\n options: RenderOptions | undefined;\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: LitUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n\n // Issue a warning, if we haven't already.\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!global.litIssuedWarnings!.has(warning)) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? global.ShadyDOM!.wrap\n : (node: Node) => node;\n\nconst trustedTypes = (global as unknown as Partial).trustedTypes;\n\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${String(Math.random()).slice(9)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d =\n NODE_MODE && global.document === undefined\n ? ({\n createTreeWalker() {\n return {};\n },\n } as unknown as Document)\n : document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with /g;\n/**\n * Comments not started with ([\\s\\S]*?)/;\nvar reHead = /]*)?>([\\s\\S]*?)<\\/head>/;\nvar knownSingletons = {};\nfunction renderHtml(html, el, where) {\n var processed = processHtml(html);\n addToHead(processed.head);\n register(processed.singletons);\n\n // N.B. even though the DOM insertion below _could_ be done with vanilla JS,\n // we intentionally use jQuery so that """ ) @@ -163,11 +164,11 @@ def test_nav_markup(): -
-
Page header
-
-
c
+
+ Page header +
+
c
-
Page footer
+ Page footer
""" ) diff --git a/tests/pytest/test_sidebar.py b/tests/pytest/test_sidebar.py new file mode 100644 index 000000000..1b38d31c0 --- /dev/null +++ b/tests/pytest/test_sidebar.py @@ -0,0 +1,60 @@ +from shiny import ui + +_s = ui.sidebar("Sidebar!") +_m = "Body" +_ps = ui.panel_sidebar("Panel Sidebar!") +_pm = ui.panel_main("Panel Main!", TestAttr=True) + + +def test_panel_main_and_panel_sidebar(): + ps = ui.layout_sidebar(_ps, _pm) + ps_str = str(ps.tagify()) + assert "TestAttr" in ps_str + assert "Panel Sidebar!" in ps_str + assert "Panel Main!" in ps_str + + # OK + ui.layout_sidebar(_s) + ui.layout_sidebar(_s, None) + ui.layout_sidebar(None, _s) + ui.layout_sidebar(None, _s, None) + + try: + ui.layout_sidebar(_s, _s) + raise AssertionError("Should have raised ValueError") + except ValueError as e: + assert "multiple `sidebar()` objects" in str(e) + + try: + ui.layout_sidebar(None, _ps) + raise AssertionError("Should have raised ValueError") + except ValueError as e: + assert "not being used as the first argument" in str(e) + + try: + ui.layout_sidebar(_s, _pm) + raise AssertionError("Should have raised ValueError") + except ValueError as e: + assert "is not being used with `panel_sidebar()`" in str(e) + + try: + ui.layout_sidebar(_pm) + raise AssertionError("Should have raised ValueError") + except ValueError as e: + assert "not being supplied as the second argument" in str(e) + try: + ui.layout_sidebar(_ps, None, _pm) + raise AssertionError("Should have raised ValueError") + except ValueError as e: + assert "not being supplied as the second argument" in str(e) + try: + ui.layout_sidebar(_ps, _pm, None, "42") + raise AssertionError("Should have raised ValueError") + except ValueError as e: + assert "Unexpected extra legacy `*args`" in str(e) + + try: + ui.layout_sidebar(_m) + raise AssertionError("Should have raised ValueError") + except ValueError as e: + assert "did not receive a `sidebar()`" in str(e) diff --git a/tests/pytest/test_x_sidebar.py b/tests/pytest/test_x_sidebar.py deleted file mode 100644 index 53f2ee445..000000000 --- a/tests/pytest/test_x_sidebar.py +++ /dev/null @@ -1,40 +0,0 @@ -import shiny.experimental as x - - -def test_panel_main_and_panel_sidebar(): - ps = x.ui.layout_sidebar( - x.ui.panel_sidebar("Sidebar!"), - x.ui.panel_main("Main!", TestAttr=True), - ) - ps_str = str(ps.tagify()) - assert "TestAttr" in ps_str - assert "Sidebar!" in ps_str - assert "Main!" in ps_str - - try: - x.ui.layout_sidebar( - None, - x.ui.sidebar("Sidebar!"), # type: ignore - ) - raise AssertionError("Should have raised TypeError") - except TypeError as e: - assert "Please use the `sidebar=` argument" in str(e) - - try: - x.ui.layout_sidebar( - None, # sidebar - x.ui.panel_sidebar("Sidebar!"), - x.ui.panel_sidebar("Sidebar!"), - ) - raise AssertionError("Should have raised TypeError") - except TypeError as e: - assert "Multiple `panel_sidebar()` calls detected" in str(e) - - try: - x.ui.layout_sidebar( - "Sidebar2!", - x.ui.panel_sidebar("Sidebar!"), - ) - raise AssertionError("Should have raised TypeError") - except TypeError as e: - assert "was supplied along with" in str(e) From 1a441bcc77577428f4c139d495371ec3c72bf4e2 Mon Sep 17 00:00:00 2001 From: Joe Cheng Date: Wed, 18 Oct 2023 19:11:09 -0700 Subject: [PATCH 36/56] Tweak autoreload behavior (#769) Co-authored-by: Barret Schloerke --- scripts/htmlDependencies.R | 3 +-- shiny/www/shared/_version.json | 2 +- shiny/www/shared/bootstrap/_version.json | 2 +- shiny/www/shared/shiny-autoreload.js | 3 ++- shiny/www/shared/shiny-autoreload.js.map | 8 ++++---- shiny/www/shared/shiny.js | 10 ++++++---- shiny/www/shared/shiny.js.map | 4 ++-- shiny/www/shared/shiny.min.css | 2 +- shiny/www/shared/shiny.min.js | 2 +- shiny/www/shared/shiny.min.js.map | 6 +++--- 10 files changed, 22 insertions(+), 20 deletions(-) diff --git a/scripts/htmlDependencies.R b/scripts/htmlDependencies.R index 76f1cc2d6..80455818d 100755 --- a/scripts/htmlDependencies.R +++ b/scripts/htmlDependencies.R @@ -11,7 +11,7 @@ versions <- list() message("Installing GitHub packages: bslib, shiny, htmltools") withr::local_temp_libpaths() ignore <- capture.output({ - pak::pkg_install(c("rstudio/bslib@a076e72e78562d7f006889da4118cd781c66c84c", "rstudio/shiny@68546c319e465a9cb113ea4499912823e264e75f", "rstudio/htmltools@9338b7f3e2ed7b3fef8fd813904b9b05281344aa")) + pak::pkg_install(c("rstudio/bslib@a076e72e78562d7f006889da4118cd781c66c84c", "rstudio/shiny@ab69d7292c51d8983174e0828496a7096f513673", "rstudio/htmltools@9338b7f3e2ed7b3fef8fd813904b9b05281344aa")) }) # pak::pkg_install(c("cran::bslib", "cran::shiny", "cran::htmltools")) @@ -34,7 +34,6 @@ write_json <- function(file, x, ..., pretty = TRUE, auto_unbox = TRUE) { ..., pretty = pretty, auto_unbox = auto_unbox ) - } bslib_version <- pkg_source_version("bslib") diff --git a/shiny/www/shared/_version.json b/shiny/www/shared/_version.json index 977c9ee1a..05ff11045 100644 --- a/shiny/www/shared/_version.json +++ b/shiny/www/shared/_version.json @@ -1,5 +1,5 @@ { "note!": "This file is auto-generated by scripts/htmlDependencies.R", "package": "shiny", - "version": "Github (rstudio/shiny@68546c319e465a9cb113ea4499912823e264e75f)" + "version": "Github (rstudio/shiny@ab69d7292c51d8983174e0828496a7096f513673)" } diff --git a/shiny/www/shared/bootstrap/_version.json b/shiny/www/shared/bootstrap/_version.json index 94c0f9da6..0f559a0f1 100644 --- a/shiny/www/shared/bootstrap/_version.json +++ b/shiny/www/shared/bootstrap/_version.json @@ -1,6 +1,6 @@ { "note!": "This file is auto-generated by scripts/htmlDependencies.R", - "shiny_version": "Github (rstudio/shiny@68546c319e465a9cb113ea4499912823e264e75f)", + "shiny_version": "Github (rstudio/shiny@ab69d7292c51d8983174e0828496a7096f513673)", "bslib_version": "Github (rstudio/bslib@a076e72e78562d7f006889da4118cd781c66c84c)", "htmltools_version": "Github (rstudio/htmltools@9338b7f3e2ed7b3fef8fd813904b9b05281344aa)", "bootstrap_version": "5.2.2" diff --git a/shiny/www/shared/shiny-autoreload.js b/shiny/www/shared/shiny-autoreload.js index 16ac0ffad..d5c092283 100644 --- a/shiny/www/shared/shiny-autoreload.js +++ b/shiny/www/shared/shiny-autoreload.js @@ -1,3 +1,4 @@ /*! shiny 1.7.4.9003 | (c) 2012-2023 RStudio, PBC. | License: GPL-3 | file LICENSE */ -"use strict";(function(){var xi=Object.create;var De=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var hi=Object.getOwnPropertyNames;var Oi=Object.getPrototypeOf,Ei=Object.prototype.hasOwnProperty;var a=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var Ii=function(r,e,t,n){if(e&&typeof e=="object"||typeof e=="function")for(var i=hi(e),o=0,u=i.length,c;o0&&S[0]<4?1:+(S[0]+S[1]));!J&&wr&&(S=wr.match(/Edge\/(\d+)/),(!S||S[1]>=74)&&(S=wr.match(/Chrome\/(\d+)/),S&&(J=+S[1])));gt.exports=J});var Rr=a(function(Es,xt){var bt=Z(),zi=p();xt.exports=!!Object.getOwnPropertySymbols&&!zi(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&bt&&bt<41})});var _r=a(function(Is,St){var Hi=Rr();St.exports=Hi&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Cr=a(function(Ts,ht){var Xi=B(),Vi=q(),Ji=vt(),Zi=_r(),Qi=Object;ht.exports=Zi?function(r){return typeof r=="symbol"}:function(r){var e=Xi("Symbol");return Vi(e)&&Ji(e.prototype,Qi(r))}});var Et=a(function(ms,Ot){var ro=String;Ot.exports=function(r){try{return ro(r)}catch(e){return"Object"}}});var Tt=a(function(Ps,It){var eo=q(),to=Et(),no=TypeError;It.exports=function(r){if(eo(r))return r;throw no(to(r)+" is not a function")}});var Ar=a(function(ws,mt){var ao=Tt(),io=V();mt.exports=function(r,e){var t=r[e];return io(t)?void 0:ao(t)}});var wt=a(function(Rs,Pt){var jr=C(),Dr=q(),Fr=m(),oo=TypeError;Pt.exports=function(r,e){var t,n;if(e==="string"&&Dr(t=r.toString)&&!Fr(n=jr(t,r))||Dr(t=r.valueOf)&&!Fr(n=jr(t,r))||e!=="string"&&Dr(t=r.toString)&&!Fr(n=jr(t,r)))return n;throw oo("Can't convert object to primitive value")}});var _t=a(function(_s,Rt){Rt.exports=!1});var Q=a(function(Cs,At){var Ct=g(),uo=Object.defineProperty;At.exports=function(r,e){try{uo(Ct,r,{value:e,configurable:!0,writable:!0})}catch(t){Ct[r]=e}return e}});var rr=a(function(As,Dt){var co=g(),vo=Q(),jt="__core-js_shared__",lo=co[jt]||vo(jt,{});Dt.exports=lo});var er=a(function(js,Nt){var so=_t(),Ft=rr();(Nt.exports=function(r,e){return Ft[r]||(Ft[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.29.0",mode:so?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var tr=a(function(Ds,Mt){var fo=U(),po=Object;Mt.exports=function(r){return po(fo(r))}});var P=a(function(Fs,Lt){var yo=d(),qo=tr(),go=yo({}.hasOwnProperty);Lt.exports=Object.hasOwn||function(e,t){return go(qo(e),t)}});var Nr=a(function(Ns,Ut){var bo=d(),xo=0,So=Math.random(),ho=bo(1 .toString);Ut.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+ho(++xo+So,36)}});var I=a(function(Ms,Bt){var Oo=g(),Eo=er(),$t=P(),Io=Nr(),To=Rr(),mo=_r(),D=Oo.Symbol,Mr=Eo("wks"),Po=mo?D.for||D:D&&D.withoutSetter||Io;Bt.exports=function(r){return $t(Mr,r)||(Mr[r]=To&&$t(D,r)?D[r]:Po("Symbol."+r)),Mr[r]}});var Wt=a(function(Ls,kt){var wo=C(),Gt=m(),Kt=Cr(),Ro=Ar(),_o=wt(),Co=I(),Ao=TypeError,jo=Co("toPrimitive");kt.exports=function(r,e){if(!Gt(r)||Kt(r))return r;var t=Ro(r,jo),n;if(t){if(e===void 0&&(e="default"),n=wo(t,r,e),!Gt(n)||Kt(n))return n;throw Ao("Can't convert object to primitive value")}return e===void 0&&(e="number"),_o(r,e)}});var nr=a(function(Us,Yt){var Do=Wt(),Fo=Cr();Yt.exports=function(r){var e=Do(r,"string");return Fo(e)?e:e+""}});var Ur=a(function($s,Ht){var No=g(),zt=m(),Lr=No.document,Mo=zt(Lr)&&zt(Lr.createElement);Ht.exports=function(r){return Mo?Lr.createElement(r):{}}});var $r=a(function(Bs,Xt){var Lo=E(),Uo=p(),$o=Ur();Xt.exports=!Lo&&!Uo(function(){return Object.defineProperty($o("div"),"a",{get:function(){return 7}}).a!=7})});var Br=a(function(Jt){var Bo=E(),Go=C(),Ko=Ke(),ko=X(),Wo=$(),Yo=nr(),zo=P(),Ho=$r(),Vt=Object.getOwnPropertyDescriptor;Jt.f=Bo?Vt:function(e,t){if(e=Wo(e),t=Yo(t),Ho)try{return Vt(e,t)}catch(n){}if(zo(e,t))return ko(!Go(Ko.f,e,t),e[t])}});var Gr=a(function(Ks,Zt){var Xo=E(),Vo=p();Zt.exports=Xo&&Vo(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var w=a(function(ks,Qt){var Jo=m(),Zo=String,Qo=TypeError;Qt.exports=function(r){if(Jo(r))return r;throw Qo(Zo(r)+" is not an object")}});var F=a(function(en){var ru=E(),eu=$r(),tu=Gr(),ar=w(),rn=nr(),nu=TypeError,Kr=Object.defineProperty,au=Object.getOwnPropertyDescriptor,kr="enumerable",Wr="configurable",Yr="writable";en.f=ru?tu?function(e,t,n){if(ar(e),t=rn(t),ar(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Yr in n&&!n[Yr]){var i=au(e,t);i&&i[Yr]&&(e[t]=n.value,n={configurable:Wr in n?n[Wr]:i[Wr],enumerable:kr in n?n[kr]:i[kr],writable:!1})}return Kr(e,t,n)}:Kr:function(e,t,n){if(ar(e),t=rn(t),ar(n),eu)try{return Kr(e,t,n)}catch(i){}if("get"in n||"set"in n)throw nu("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var ir=a(function(Ys,tn){var iu=E(),ou=F(),uu=X();tn.exports=iu?function(r,e,t){return ou.f(r,e,uu(1,t))}:function(r,e,t){return r[e]=t,r}});var on=a(function(zs,an){var zr=E(),cu=P(),nn=Function.prototype,vu=zr&&Object.getOwnPropertyDescriptor,Hr=cu(nn,"name"),lu=Hr&&function(){}.name==="something",su=Hr&&(!zr||zr&&vu(nn,"name").configurable);an.exports={EXISTS:Hr,PROPER:lu,CONFIGURABLE:su}});var Vr=a(function(Hs,un){var fu=d(),pu=q(),Xr=rr(),du=fu(Function.toString);pu(Xr.inspectSource)||(Xr.inspectSource=function(r){return du(r)});un.exports=Xr.inspectSource});var ln=a(function(Xs,vn){var yu=g(),qu=q(),cn=yu.WeakMap;vn.exports=qu(cn)&&/native code/.test(String(cn))});var Jr=a(function(Vs,fn){var gu=er(),bu=Nr(),sn=gu("keys");fn.exports=function(r){return sn[r]||(sn[r]=bu(r))}});var or=a(function(Js,pn){pn.exports={}});var ee=a(function(Zs,qn){var xu=ln(),yn=g(),Su=m(),hu=ir(),Zr=P(),Qr=rr(),Ou=Jr(),Eu=or(),dn="Object already initialized",re=yn.TypeError,Iu=yn.WeakMap,ur,G,cr,Tu=function(r){return cr(r)?G(r):ur(r,{})},mu=function(r){return function(e){var t;if(!Su(e)||(t=G(e)).type!==r)throw re("Incompatible receiver, "+r+" required");return t}};xu||Qr.state?(h=Qr.state||(Qr.state=new Iu),h.get=h.get,h.has=h.has,h.set=h.set,ur=function(r,e){if(h.has(r))throw re(dn);return e.facade=r,h.set(r,e),e},G=function(r){return h.get(r)||{}},cr=function(r){return h.has(r)}):(A=Ou("state"),Eu[A]=!0,ur=function(r,e){if(Zr(r,A))throw re(dn);return e.facade=r,hu(r,A,e),e},G=function(r){return Zr(r,A)?r[A]:{}},cr=function(r){return Zr(r,A)});var h,A;qn.exports={set:ur,get:G,has:cr,enforce:Tu,getterFor:mu}});var Sn=a(function(Qs,xn){var ne=d(),Pu=p(),wu=q(),vr=P(),te=E(),Ru=on().CONFIGURABLE,_u=Vr(),bn=ee(),Cu=bn.enforce,Au=bn.get,gn=String,lr=Object.defineProperty,ju=ne("".slice),Du=ne("".replace),Fu=ne([].join),Nu=te&&!Pu(function(){return lr(function(){},"length",{value:8}).length!==8}),Mu=String(String).split("String"),Lu=xn.exports=function(r,e,t){ju(gn(e),0,7)==="Symbol("&&(e="["+Du(gn(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!vr(r,"name")||Ru&&r.name!==e)&&(te?lr(r,"name",{value:e,configurable:!0}):r.name=e),Nu&&t&&vr(t,"arity")&&r.length!==t.arity&&lr(r,"length",{value:t.arity});try{t&&vr(t,"constructor")&&t.constructor?te&&lr(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(i){}var n=Cu(r);return vr(n,"source")||(n.source=Fu(Mu,typeof e=="string"?e:"")),r};Function.prototype.toString=Lu(function(){return wu(this)&&Au(this).source||_u(this)},"toString")});var ae=a(function(rf,hn){var Uu=q(),$u=F(),Bu=Sn(),Gu=Q();hn.exports=function(r,e,t,n){n||(n={});var i=n.enumerable,o=n.name!==void 0?n.name:e;if(Uu(t)&&Bu(t,o,n),n.global)i?r[e]=t:Gu(e,t);else{try{n.unsafe?r[e]&&(i=!0):delete r[e]}catch(u){}i?r[e]=t:$u.f(r,e,{value:t,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r}});var En=a(function(ef,On){var Ku=Math.ceil,ku=Math.floor;On.exports=Math.trunc||function(e){var t=+e;return(t>0?ku:Ku)(t)}});var K=a(function(tf,In){var Wu=En();In.exports=function(r){var e=+r;return e!==e||e===0?0:Wu(e)}});var mn=a(function(nf,Tn){var Yu=K(),zu=Math.max,Hu=Math.min;Tn.exports=function(r,e){var t=Yu(r);return t<0?zu(t+e,0):Hu(t,e)}});var ie=a(function(af,Pn){var Xu=K(),Vu=Math.min;Pn.exports=function(r){return r>0?Vu(Xu(r),9007199254740991):0}});var oe=a(function(of,wn){var Ju=ie();wn.exports=function(r){return Ju(r.length)}});var Cn=a(function(uf,_n){var Zu=$(),Qu=mn(),rc=oe(),Rn=function(r){return function(e,t,n){var i=Zu(e),o=rc(i),u=Qu(n,o),c;if(r&&t!=t){for(;o>u;)if(c=i[u++],c!=c)return!0}else for(;o>u;u++)if((r||u in i)&&i[u]===t)return r||u||0;return!r&&-1}};_n.exports={includes:Rn(!0),indexOf:Rn(!1)}});var ce=a(function(cf,jn){var ec=d(),ue=P(),tc=$(),nc=Cn().indexOf,ac=or(),An=ec([].push);jn.exports=function(r,e){var t=tc(r),n=0,i=[],o;for(o in t)!ue(ac,o)&&ue(t,o)&&An(i,o);for(;e.length>n;)ue(t,o=e[n++])&&(~nc(i,o)||An(i,o));return i}});var sr=a(function(vf,Dn){Dn.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Nn=a(function(Fn){var ic=ce(),oc=sr(),uc=oc.concat("length","prototype");Fn.f=Object.getOwnPropertyNames||function(e){return ic(e,uc)}});var Ln=a(function(Mn){Mn.f=Object.getOwnPropertySymbols});var $n=a(function(ff,Un){var cc=B(),vc=d(),lc=Nn(),sc=Ln(),fc=w(),pc=vc([].concat);Un.exports=cc("Reflect","ownKeys")||function(e){var t=lc.f(fc(e)),n=sc.f;return n?pc(t,n(e)):t}});var Kn=a(function(pf,Gn){var Bn=P(),dc=$n(),yc=Br(),qc=F();Gn.exports=function(r,e,t){for(var n=dc(e),i=qc.f,o=yc.f,u=0;uu;)Xc.f(e,c=i[u++],n[c]);return e}});var ua=a(function(Ef,oa){var Qc=B();oa.exports=Qc("document","documentElement")});var ya=a(function(If,da){var rv=w(),ev=ia(),ca=sr(),tv=or(),nv=ua(),av=Ur(),iv=Jr(),va=">",la="<",qe="prototype",ge="script",fa=iv("IE_PROTO"),ye=function(){},pa=function(r){return la+ge+va+r+la+"/"+ge+va},sa=function(r){r.write(pa("")),r.close();var e=r.parentWindow.Object;return r=null,e},ov=function(){var r=av("iframe"),e="java"+ge+":",t;return r.style.display="none",nv.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(pa("document.F=Object")),t.close(),t.F},dr,yr=function(){try{dr=new ActiveXObject("htmlfile")}catch(e){}yr=typeof document!="undefined"?document.domain&&dr?sa(dr):ov():sa(dr);for(var r=ca.length;r--;)delete yr[qe][ca[r]];return yr()};tv[fa]=!0;da.exports=Object.create||function(e,t){var n;return e!==null?(ye[qe]=rv(e),n=new ye,ye[qe]=null,n[fa]=e):n=yr(),t===void 0?n:ev.f(n,t)}});var ga=a(function(Tf,qa){var uv=p(),cv=g(),vv=cv.RegExp;qa.exports=uv(function(){var r=vv(".","s");return!(r.dotAll&&r.exec("\n")&&r.flags==="s")})});var xa=a(function(mf,ba){var lv=p(),sv=g(),fv=sv.RegExp;ba.exports=lv(function(){var r=fv("(?
b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$c")!=="bc"})});var br=a(function(Pf,ha){"use strict";var N=C(),gr=d(),pv=pr(),dv=Qn(),yv=ea(),qv=er(),gv=ya(),bv=ee().get,xv=ga(),Sv=xa(),hv=qv("native-string-replace",String.prototype.replace),qr=RegExp.prototype.exec,xe=qr,Ov=gr("".charAt),Ev=gr("".indexOf),Iv=gr("".replace),be=gr("".slice),Se=function(){var r=/a/,e=/b*/g;return N(qr,r,"a"),N(qr,e,"a"),r.lastIndex!==0||e.lastIndex!==0}(),Sa=yv.BROKEN_CARET,he=/()??/.exec("")[1]!==void 0,Tv=Se||he||Sa||xv||Sv;Tv&&(xe=function(e){var t=this,n=bv(t),i=pv(e),o=n.raw,u,c,s,v,l,b,y;if(o)return o.lastIndex=t.lastIndex,u=N(xe,o,i),t.lastIndex=o.lastIndex,u;var f=n.groups,R=Sa&&t.sticky,x=N(dv,t),O=t.source,_=0,T=i;if(R&&(x=Iv(x,"y",""),Ev(x,"g")===-1&&(x+="g"),T=be(i,t.lastIndex),t.lastIndex>0&&(!t.multiline||t.multiline&&Ov(i,t.lastIndex-1)!=="\n")&&(O="(?: "+O+")",T=" "+T,_++),c=new RegExp("^(?:"+O+")",x)),he&&(c=new RegExp("^"+O+"$(?!\\s)",x)),Se&&(s=t.lastIndex),v=N(qr,R?c:t,T),R?v?(v.input=be(v.input,_),v[0]=be(v[0],_),v.index=t.lastIndex,t.lastIndex+=v[0].length):t.lastIndex=0:Se&&v&&(t.lastIndex=t.global?v.index+v[0].length:s),he&&v&&v.length>1&&N(hv,v[0],c,function(){for(l=1;l=o?r?"":void 0:(u=Na(n,i),u<55296||u>56319||i+1===o||(c=Na(n,i+1))<56320||c>57343?r?Nv(n,i):u:r?Mv(n,i,i+2):(u-55296<<10)+(c-56320)+65536)}};La.exports={codeAt:Ma(!1),charAt:Ma(!0)}});var Ba=a(function(Df,$a){"use strict";var Lv=Ua().charAt;$a.exports=function(r,e,t){return e+(t?Lv(r,e).length:1)}});var Ka=a(function(Ff,Ga){var Pe=d(),Uv=tr(),$v=Math.floor,Te=Pe("".charAt),Bv=Pe("".replace),me=Pe("".slice),Gv=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Kv=/\$([$&'`]|\d{1,2})/g;Ga.exports=function(r,e,t,n,i,o){var u=t+r.length,c=n.length,s=Kv;return i!==void 0&&(i=Uv(i),s=Gv),Bv(o,s,function(v,l){var b;switch(Te(l,0)){case"$":return"$";case"&":return r;case"`":return me(e,0,t);case"'":return me(e,u);case"<":b=i[me(l,1,-1)];break;default:var y=+l;if(y===0)return v;if(y>c){var f=$v(y/10);return f===0?v:f<=c?n[f-1]===void 0?Te(l,1):n[f-1]+Te(l,1):v}b=n[y-1]}return b===void 0?"":b})}});var Ya=a(function(Nf,Wa){var ka=C(),kv=w(),Wv=q(),Yv=j(),zv=br(),Hv=TypeError;Wa.exports=function(r,e){var t=r.exec;if(Wv(t)){var n=ka(t,r,e);return n!==null&&kv(n),n}if(Yv(r)==="RegExp")return ka(zv,r,e);throw Hv("RegExp#exec called on incompatible receiver")}});var _e=a(function(Mf,Ja){var yl=j();Ja.exports=Array.isArray||function(e){return yl(e)=="Array"}});var Qa=a(function(Lf,Za){var ql=TypeError,gl=9007199254740991;Za.exports=function(r){if(r>gl)throw ql("Maximum allowed index exceeded");return r}});var ei=a(function(Uf,ri){"use strict";var bl=nr(),xl=F(),Sl=X();ri.exports=function(r,e,t){var n=bl(e);n in r?xl.f(r,n,Sl(0,t)):r[n]=t}});var ui=a(function($f,oi){var hl=d(),Ol=p(),ti=q(),El=se(),Il=B(),Tl=Vr(),ni=function(){},ml=[],ai=Il("Reflect","construct"),Ce=/^\s*(?:class|function)\b/,Pl=hl(Ce.exec),wl=!Ce.exec(ni),W=function(e){if(!ti(e))return!1;try{return ai(ni,ml,e),!0}catch(t){return!1}},ii=function(e){if(!ti(e))return!1;switch(El(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return wl||!!Pl(Ce,Tl(e))}catch(t){return!0}};ii.sham=!0;oi.exports=!ai||Ol(function(){var r;return W(W.call)||!W(Object)||!W(function(){r=!0})||r})?ii:W});var si=a(function(Bf,li){var ci=_e(),Rl=ui(),_l=m(),Cl=I(),Al=Cl("species"),vi=Array;li.exports=function(r){var e;return ci(r)&&(e=r.constructor,Rl(e)&&(e===vi||ci(e.prototype))?e=void 0:_l(e)&&(e=e[Al],e===null&&(e=void 0))),e===void 0?vi:e}});var pi=a(function(Gf,fi){var jl=si();fi.exports=function(r,e){return new(jl(r))(e===0?0:e)}});var yi=a(function(Kf,di){var Dl=p(),Fl=I(),Nl=Z(),Ml=Fl("species");di.exports=function(r){return Nl>=51||!Dl(function(){var e=[],t=e.constructor={};return t[Ml]=function(){return{foo:1}},e[r](Boolean).foo!==1})}});var kf=Ti(Oe());var Xv=Pa(),za=C(),xr=d(),Vv=Fa(),Jv=p(),Zv=w(),Qv=q(),rl=V(),el=K(),tl=ie(),M=pr(),nl=U(),al=Ba(),il=Ar(),ol=Ka(),ul=Ya(),cl=I(),Re=cl("replace"),vl=Math.max,ll=Math.min,sl=xr([].concat),we=xr([].push),Ha=xr("".indexOf),Xa=xr("".slice),fl=function(r){return r===void 0?r:String(r)},pl=function(){return"a".replace(/./,"$0")==="$0"}(),Va=function(){return/./[Re]?/./[Re]("a","$0")==="":!1}(),dl=!Jv(function(){var r=/./;return r.exec=function(){var e=[];return e.groups={a:"7"},e},"".replace(r,"$")!=="7"});Vv("replace",function(r,e,t){var n=Va?"$":"$0";return[function(o,u){var c=nl(this),s=rl(o)?void 0:il(o,Re);return s?za(s,o,c,u):za(e,M(c),o,u)},function(i,o){var u=Zv(this),c=M(i);if(typeof o=="string"&&Ha(o,n)===-1&&Ha(o,"$<")===-1){var s=t(e,u,c,o);if(s.done)return s.value}var v=Qv(o);v||(o=M(o));var l=u.global;if(l){var b=u.unicode;u.lastIndex=0}for(var y=[];;){var f=ul(u,c);if(f===null||(we(y,f),!l))break;var R=M(f[0]);R===""&&(u.lastIndex=al(c,tl(u.lastIndex),b))}for(var x="",O=0,_=0;_=O&&(x+=Xa(c,O,L)+je,O=L+T.length)}return x+Xa(c,O)}]},!dl||!pl||Va);var Ll=le(),Ul=p(),$l=_e(),Bl=m(),Gl=tr(),Kl=oe(),qi=Qa(),gi=ei(),kl=pi(),Wl=yi(),Yl=I(),zl=Z(),bi=Yl("isConcatSpreadable"),Hl=zl>=51||!Ul(function(){var r=[];return r[bi]=!1,r.concat()[0]!==r}),Xl=function(r){if(!Bl(r))return!1;var e=r[bi];return e!==void 0?!!e:$l(r)},Vl=!Hl||!Wl("concat");Ll({target:"Array",proto:!0,arity:1,forced:Vl},{concat:function(e){var t=Gl(this),n=kl(t,0),i=0,o,u,c,s,v;for(o=-1,c=arguments.length;o0&&H[0]<4?1:+(H[0]+H[1]));!Ne&&Ft&&(H=Ft.match(/Edge\/(\d+)/),(!H||H[1]>=74)&&(H=Ft.match(/Chrome\/(\d+)/),H&&(Ne=+H[1])));Yi.exports=Ne});var pr=i(function(HI,Hi){var Wi=Qr(),fp=w();Hi.exports=!!Object.getOwnPropertySymbols&&!fp(function(){var r=Symbol();return!String(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Wi&&Wi<41})});var $t=i(function(JI,Ji){var lp=pr();Ji.exports=lp&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Zr=i(function(zI,zi){var pp=Y(),yp=P(),dp=_r(),qp=$t(),hp=Object;zi.exports=qp?function(r){return typeof r=="symbol"}:function(r){var e=pp("Symbol");return yp(e)&&dp(e.prototype,hp(r))}});var Cr=i(function(XI,Xi){var gp=String;Xi.exports=function(r){try{return gp(r)}catch(e){return"Object"}}});var rr=i(function(QI,Qi){var Sp=P(),bp=Cr(),mp=TypeError;Qi.exports=function(r){if(Sp(r))return r;throw mp(bp(r)+" is not a function")}});var re=i(function(ZI,Zi){var Op=rr(),Ep=xr();Zi.exports=function(r,e){var t=r[e];return Ep(t)?void 0:Op(t)}});var eo=i(function(rT,ro){var Ut=A(),Gt=P(),Bt=V(),Ip=TypeError;ro.exports=function(r,e){var t,n;if(e==="string"&&Gt(t=r.toString)&&!Bt(n=Ut(t,r))||Gt(t=r.valueOf)&&!Bt(n=Ut(t,r))||e!=="string"&&Gt(t=r.toString)&&!Bt(n=Ut(t,r)))return n;throw Ip("Can't convert object to primitive value")}});var z=i(function(eT,to){to.exports=!1});var Ae=i(function(tT,ao){var no=x(),Tp=Object.defineProperty;ao.exports=function(r,e){try{Tp(no,r,{value:e,configurable:!0,writable:!0})}catch(t){no[r]=e}return e}});var je=i(function(nT,oo){var Pp=x(),wp=Ae(),io="__core-js_shared__",Rp=Pp[io]||wp(io,{});oo.exports=Rp});var yr=i(function(aT,vo){var xp=z(),uo=je();(vo.exports=function(r,e){return uo[r]||(uo[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.29.0",mode:xp?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var or=i(function(iT,so){var _p=zr(),Cp=Object;so.exports=function(r){return Cp(_p(r))}});var D=i(function(oT,co){var Np=R(),Ap=or(),jp=Np({}.hasOwnProperty);co.exports=Object.hasOwn||function(e,t){return jp(Ap(e),t)}});var De=i(function(uT,fo){var Dp=R(),Lp=0,Mp=Math.random(),Fp=Dp(1 .toString);fo.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Fp(++Lp+Mp,36)}});var _=i(function(vT,po){var $p=x(),Up=yr(),lo=D(),Gp=De(),Bp=pr(),kp=$t(),Nr=$p.Symbol,kt=Up("wks"),Kp=kp?Nr.for||Nr:Nr&&Nr.withoutSetter||Gp;po.exports=function(r){return lo(kt,r)||(kt[r]=Bp&&lo(Nr,r)?Nr[r]:Kp("Symbol."+r)),kt[r]}});var go=i(function(sT,ho){var Vp=A(),yo=V(),qo=Zr(),Yp=re(),Wp=eo(),Hp=_(),Jp=TypeError,zp=Hp("toPrimitive");ho.exports=function(r,e){if(!yo(r)||qo(r))return r;var t=Yp(r,zp),n;if(t){if(e===void 0&&(e="default"),n=Vp(t,r,e),!yo(n)||qo(n))return n;throw Jp("Can't convert object to primitive value")}return e===void 0&&(e="number"),Wp(r,e)}});var ee=i(function(cT,So){var Xp=go(),Qp=Zr();So.exports=function(r){var e=Xp(r,"string");return Qp(e)?e:e+""}});var te=i(function(fT,mo){var Zp=x(),bo=V(),Kt=Zp.document,ry=bo(Kt)&&bo(Kt.createElement);mo.exports=function(r){return ry?Kt.createElement(r):{}}});var Vt=i(function(lT,Oo){var ey=M(),ty=w(),ny=te();Oo.exports=!ey&&!ty(function(){return Object.defineProperty(ny("div"),"a",{get:function(){return 7}}).a!=7})});var ne=i(function(Io){var ay=M(),iy=A(),oy=Ct(),uy=Rr(),vy=Z(),sy=ee(),cy=D(),fy=Vt(),Eo=Object.getOwnPropertyDescriptor;Io.f=ay?Eo:function(e,t){if(e=vy(e),t=sy(t),fy)try{return Eo(e,t)}catch(n){}if(cy(e,t))return uy(!iy(oy.f,e,t),e[t])}});var Yt=i(function(yT,To){var ly=M(),py=w();To.exports=ly&&py(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})});var F=i(function(dT,Po){var yy=V(),dy=String,qy=TypeError;Po.exports=function(r){if(yy(r))return r;throw qy(dy(r)+" is not an object")}});var B=i(function(Ro){var hy=M(),gy=Vt(),Sy=Yt(),Le=F(),wo=ee(),by=TypeError,Wt=Object.defineProperty,my=Object.getOwnPropertyDescriptor,Ht="enumerable",Jt="configurable",zt="writable";Ro.f=hy?Sy?function(e,t,n){if(Le(e),t=wo(t),Le(n),typeof e=="function"&&t==="prototype"&&"value"in n&&zt in n&&!n[zt]){var a=my(e,t);a&&a[zt]&&(e[t]=n.value,n={configurable:Jt in n?n[Jt]:a[Jt],enumerable:Ht in n?n[Ht]:a[Ht],writable:!1})}return Wt(e,t,n)}:Wt:function(e,t,n){if(Le(e),t=wo(t),Le(n),gy)try{return Wt(e,t,n)}catch(a){}if("get"in n||"set"in n)throw by("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var dr=i(function(hT,xo){var Oy=M(),Ey=B(),Iy=Rr();xo.exports=Oy?function(r,e,t){return Ey.f(r,e,Iy(1,t))}:function(r,e,t){return r[e]=t,r}});var Me=i(function(gT,Co){var Xt=M(),Ty=D(),_o=Function.prototype,Py=Xt&&Object.getOwnPropertyDescriptor,Qt=Ty(_o,"name"),wy=Qt&&function(){}.name==="something",Ry=Qt&&(!Xt||Xt&&Py(_o,"name").configurable);Co.exports={EXISTS:Qt,PROPER:wy,CONFIGURABLE:Ry}});var Fe=i(function(ST,No){var xy=R(),_y=P(),Zt=je(),Cy=xy(Function.toString);_y(Zt.inspectSource)||(Zt.inspectSource=function(r){return Cy(r)});No.exports=Zt.inspectSource});var Do=i(function(bT,jo){var Ny=x(),Ay=P(),Ao=Ny.WeakMap;jo.exports=Ay(Ao)&&/native code/.test(String(Ao))});var ae=i(function(mT,Mo){var jy=yr(),Dy=De(),Lo=jy("keys");Mo.exports=function(r){return Lo[r]||(Lo[r]=Dy(r))}});var ie=i(function(OT,Fo){Fo.exports={}});var hr=i(function(ET,Go){var Ly=Do(),Uo=x(),My=V(),Fy=dr(),rn=D(),en=je(),$y=ae(),Uy=ie(),$o="Object already initialized",tn=Uo.TypeError,Gy=Uo.WeakMap,$e,oe,Ue,By=function(r){return Ue(r)?oe(r):$e(r,{})},ky=function(r){return function(e){var t;if(!My(e)||(t=oe(e)).type!==r)throw tn("Incompatible receiver, "+r+" required");return t}};Ly||en.state?(J=en.state||(en.state=new Gy),J.get=J.get,J.has=J.has,J.set=J.set,$e=function(r,e){if(J.has(r))throw tn($o);return e.facade=r,J.set(r,e),e},oe=function(r){return J.get(r)||{}},Ue=function(r){return J.has(r)}):(qr=$y("state"),Uy[qr]=!0,$e=function(r,e){if(rn(r,qr))throw tn($o);return e.facade=r,Fy(r,qr,e),e},oe=function(r){return rn(r,qr)?r[qr]:{}},Ue=function(r){return rn(r,qr)});var J,qr;Go.exports={set:$e,get:oe,has:Ue,enforce:By,getterFor:ky}});var on=i(function(IT,Ko){var an=R(),Ky=w(),Vy=P(),Ge=D(),nn=M(),Yy=Me().CONFIGURABLE,Wy=Fe(),ko=hr(),Hy=ko.enforce,Jy=ko.get,Bo=String,Be=Object.defineProperty,zy=an("".slice),Xy=an("".replace),Qy=an([].join),Zy=nn&&!Ky(function(){return Be(function(){},"length",{value:8}).length!==8}),rd=String(String).split("String"),ed=Ko.exports=function(r,e,t){zy(Bo(e),0,7)==="Symbol("&&(e="["+Xy(Bo(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Ge(r,"name")||Yy&&r.name!==e)&&(nn?Be(r,"name",{value:e,configurable:!0}):r.name=e),Zy&&t&&Ge(t,"arity")&&r.length!==t.arity&&Be(r,"length",{value:t.arity});try{t&&Ge(t,"constructor")&&t.constructor?nn&&Be(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(a){}var n=Hy(r);return Ge(n,"source")||(n.source=Qy(rd,typeof e=="string"?e:"")),r};Function.prototype.toString=ed(function(){return Vy(this)&&Jy(this).source||Wy(this)},"toString")});var X=i(function(TT,Vo){var td=P(),nd=B(),ad=on(),id=Ae();Vo.exports=function(r,e,t,n){n||(n={});var a=n.enumerable,o=n.name!==void 0?n.name:e;if(td(t)&&ad(t,o,n),n.global)a?r[e]=t:id(e,t);else{try{n.unsafe?r[e]&&(a=!0):delete r[e]}catch(v){}a?r[e]=t:nd.f(r,e,{value:t,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r}});var Wo=i(function(PT,Yo){var od=Math.ceil,ud=Math.floor;Yo.exports=Math.trunc||function(e){var t=+e;return(t>0?ud:od)(t)}});var ue=i(function(wT,Ho){var vd=Wo();Ho.exports=function(r){var e=+r;return e!==e||e===0?0:vd(e)}});var ke=i(function(RT,Jo){var sd=ue(),cd=Math.max,fd=Math.min;Jo.exports=function(r,e){var t=sd(r);return t<0?cd(t+e,0):fd(t,e)}});var un=i(function(xT,zo){var ld=ue(),pd=Math.min;zo.exports=function(r){return r>0?pd(ld(r),9007199254740991):0}});var gr=i(function(_T,Xo){var yd=un();Xo.exports=function(r){return yd(r.length)}});var ru=i(function(CT,Zo){var dd=Z(),qd=ke(),hd=gr(),Qo=function(r){return function(e,t,n){var a=dd(e),o=hd(a),v=qd(n,o),u;if(r&&t!=t){for(;o>v;)if(u=a[v++],u!=u)return!0}else for(;o>v;v++)if((r||v in a)&&a[v]===t)return r||v||0;return!r&&-1}};Zo.exports={includes:Qo(!0),indexOf:Qo(!1)}});var sn=i(function(NT,tu){var gd=R(),vn=D(),Sd=Z(),bd=ru().indexOf,md=ie(),eu=gd([].push);tu.exports=function(r,e){var t=Sd(r),n=0,a=[],o;for(o in t)!vn(md,o)&&vn(t,o)&&eu(a,o);for(;e.length>n;)vn(t,o=e[n++])&&(~bd(a,o)||eu(a,o));return a}});var Ke=i(function(AT,nu){nu.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Ve=i(function(au){var Od=sn(),Ed=Ke(),Id=Ed.concat("length","prototype");au.f=Object.getOwnPropertyNames||function(e){return Od(e,Id)}});var Ye=i(function(iu){iu.f=Object.getOwnPropertySymbols});var uu=i(function(LT,ou){var Td=Y(),Pd=R(),wd=Ve(),Rd=Ye(),xd=F(),_d=Pd([].concat);ou.exports=Td("Reflect","ownKeys")||function(e){var t=wd.f(xd(e)),n=Rd.f;return n?_d(t,n(e)):t}});var cn=i(function(MT,su){var vu=D(),Cd=uu(),Nd=ne(),Ad=B();su.exports=function(r,e,t){for(var n=Cd(e),a=Ad.f,o=Nd.f,v=0;vv;)lq.f(e,u=a[v++],n[u]);return e}});var gn=i(function(WT,Ou){var qq=Y();Ou.exports=qq("document","documentElement")});var Ar=i(function(HT,xu){var hq=F(),gq=hn(),Eu=Ke(),Sq=ie(),bq=gn(),mq=te(),Oq=ae(),Iu=">",Tu="<",bn="prototype",mn="script",wu=Oq("IE_PROTO"),Sn=function(){},Ru=function(r){return Tu+mn+Iu+r+Tu+"/"+mn+Iu},Pu=function(r){r.write(Ru("")),r.close();var e=r.parentWindow.Object;return r=null,e},Eq=function(){var r=mq("iframe"),e="java"+mn+":",t;return r.style.display="none",bq.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(Ru("document.F=Object")),t.close(),t.F},Je,ze=function(){try{Je=new ActiveXObject("htmlfile")}catch(e){}ze=typeof document!="undefined"?document.domain&&Je?Pu(Je):Eq():Pu(Je);for(var r=Eu.length;r--;)delete ze[bn][Eu[r]];return ze()};Sq[wu]=!0;xu.exports=Object.create||function(e,t){var n;return e!==null?(Sn[bn]=hq(e),n=new Sn,Sn[bn]=null,n[wu]=e):n=ze(),t===void 0?n:gq.f(n,t)}});var Cu=i(function(JT,_u){var Iq=w(),Tq=x(),Pq=Tq.RegExp;_u.exports=Iq(function(){var r=Pq(".","s");return!(r.dotAll&&r.exec("\n")&&r.flags==="s")})});var Au=i(function(zT,Nu){var wq=w(),Rq=x(),xq=Rq.RegExp;Nu.exports=wq(function(){var r=xq("(?b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$c")!=="bc"})});var Ze=i(function(XT,Du){"use strict";var jr=A(),Qe=R(),_q=er(),Cq=hu(),Nq=Su(),Aq=yr(),jq=Ar(),Dq=hr().get,Lq=Cu(),Mq=Au(),Fq=Aq("native-string-replace",String.prototype.replace),Xe=RegExp.prototype.exec,En=Xe,$q=Qe("".charAt),Uq=Qe("".indexOf),Gq=Qe("".replace),On=Qe("".slice),In=function(){var r=/a/,e=/b*/g;return jr(Xe,r,"a"),jr(Xe,e,"a"),r.lastIndex!==0||e.lastIndex!==0}(),ju=Nq.BROKEN_CARET,Tn=/()??/.exec("")[1]!==void 0,Bq=In||Tn||ju||Lq||Mq;Bq&&(En=function(e){var t=this,n=Dq(t),a=_q(e),o=n.raw,v,u,c,f,y,S,m;if(o)return o.lastIndex=t.lastIndex,v=jr(En,o,a),t.lastIndex=o.lastIndex,v;var h=n.groups,O=ju&&t.sticky,I=jr(Cq,t),E=t.source,T=0,b=a;if(O&&(I=Gq(I,"y",""),Uq(I,"g")===-1&&(I+="g"),b=On(a,t.lastIndex),t.lastIndex>0&&(!t.multiline||t.multiline&&$q(a,t.lastIndex-1)!=="\n")&&(E="(?: "+E+")",b=" "+b,T++),u=new RegExp("^(?:"+E+")",I)),Tn&&(u=new RegExp("^"+E+"$(?!\\s)",I)),In&&(c=t.lastIndex),f=jr(Xe,O?u:t,b),O?f?(f.input=On(f.input,T),f[0]=On(f[0],T),f.index=t.lastIndex,t.lastIndex+=f[0].length):t.lastIndex=0:In&&f&&(t.lastIndex=t.global?f.index+f[0].length:c),Tn&&f&&f.length>1&&jr(Fq,f[0],u,function(){for(y=1;y=o?r?"":void 0:(v=Hu(n,a),v<55296||v>56319||a+1===o||(u=Hu(n,a+1))<56320||u>57343?r?Zq(n,a):v:r?rh(n,a,a+2):(v-55296<<10)+(u-56320)+65536)}};zu.exports={codeAt:Ju(!1),charAt:Ju(!0)}});var Qu=i(function(aP,Xu){"use strict";var eh=_n().charAt;Xu.exports=function(r,e,t){return e+(t?eh(r,e).length:1)}});var rv=i(function(iP,Zu){var An=R(),th=or(),nh=Math.floor,Cn=An("".charAt),ah=An("".replace),Nn=An("".slice),ih=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,oh=/\$([$&'`]|\d{1,2})/g;Zu.exports=function(r,e,t,n,a,o){var v=t+r.length,u=n.length,c=oh;return a!==void 0&&(a=th(a),c=ih),ah(o,c,function(f,y){var S;switch(Cn(y,0)){case"$":return"$";case"&":return r;case"`":return Nn(e,0,t);case"'":return Nn(e,v);case"<":S=a[Nn(y,1,-1)];break;default:var m=+y;if(m===0)return f;if(m>u){var h=nh(m/10);return h===0?f:h<=u?n[h-1]===void 0?Cn(y,1):n[h-1]+Cn(y,1):f}S=n[m-1]}return S===void 0?"":S})}});var nv=i(function(oP,tv){var ev=A(),uh=F(),vh=P(),sh=Q(),ch=Ze(),fh=TypeError;tv.exports=function(r,e){var t=r.exec;if(vh(t)){var n=ev(t,r,e);return n!==null&&uh(n),n}if(sh(r)==="RegExp")return ev(ch,r,e);throw fh("RegExp#exec called on incompatible receiver")}});var Lr=i(function(uP,vv){var Nh=Q();vv.exports=Array.isArray||function(e){return Nh(e)=="Array"}});var cv=i(function(vP,sv){var Ah=TypeError,jh=9007199254740991;sv.exports=function(r){if(r>jh)throw Ah("Maximum allowed index exceeded");return r}});var tt=i(function(sP,fv){"use strict";var Dh=ee(),Lh=B(),Mh=Rr();fv.exports=function(r,e,t){var n=Dh(e);n in r?Lh.f(r,n,Mh(0,t)):r[n]=t}});var nt=i(function(cP,qv){var Fh=R(),$h=w(),lv=P(),Uh=se(),Gh=Y(),Bh=Fe(),pv=function(){},kh=[],yv=Gh("Reflect","construct"),Ln=/^\s*(?:class|function)\b/,Kh=Fh(Ln.exec),Vh=!Ln.exec(pv),ce=function(e){if(!lv(e))return!1;try{return yv(pv,kh,e),!0}catch(t){return!1}},dv=function(e){if(!lv(e))return!1;switch(Uh(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Vh||!!Kh(Ln,Bh(e))}catch(t){return!0}};dv.sham=!0;qv.exports=!yv||$h(function(){var r;return ce(ce.call)||!ce(Object)||!ce(function(){r=!0})||r})?dv:ce});var bv=i(function(fP,Sv){var hv=Lr(),Yh=nt(),Wh=V(),Hh=_(),Jh=Hh("species"),gv=Array;Sv.exports=function(r){var e;return hv(r)&&(e=r.constructor,Yh(e)&&(e===gv||hv(e.prototype))?e=void 0:Wh(e)&&(e=e[Jh],e===null&&(e=void 0))),e===void 0?gv:e}});var Mn=i(function(lP,mv){var zh=bv();mv.exports=function(r,e){return new(zh(r))(e===0?0:e)}});var Fn=i(function(pP,Ov){var Xh=w(),Qh=_(),Zh=Qr(),rg=Qh("species");Ov.exports=function(r){return Zh>=51||!Xh(function(){var e=[],t=e.constructor={};return t[rg]=function(){return{foo:1}},e[r](Boolean).foo!==1})}});var wv=i(function(yP,Pv){"use strict";var yg=We(),dg=se();Pv.exports=yg?{}.toString:function(){return"[object "+dg(this)+"]"}});var fe=i(function(dP,Rv){var Sg=Q();Rv.exports=typeof process!="undefined"&&Sg(process)=="process"});var _v=i(function(qP,xv){var bg=R(),mg=rr();xv.exports=function(r,e,t){try{return bg(mg(Object.getOwnPropertyDescriptor(r,e)[t]))}catch(n){}}});var Nv=i(function(hP,Cv){var Og=P(),Eg=String,Ig=TypeError;Cv.exports=function(r){if(typeof r=="object"||Og(r))return r;throw Ig("Can't set "+Eg(r)+" as a prototype")}});var at=i(function(gP,Av){var Tg=_v(),Pg=F(),wg=Nv();Av.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,e={},t;try{t=Tg(Object.prototype,"__proto__","set"),t(e,[]),r=e instanceof Array}catch(n){}return function(a,o){return Pg(a),wg(o),r?t(a,o):a.__proto__=o,a}}():void 0)});var ur=i(function(SP,Dv){var Rg=B().f,xg=D(),_g=_(),jv=_g("toStringTag");Dv.exports=function(r,e,t){r&&!t&&(r=r.prototype),r&&!xg(r,jv)&&Rg(r,jv,{configurable:!0,value:e})}});var le=i(function(bP,Mv){var Lv=on(),Cg=B();Mv.exports=function(r,e,t){return t.get&&Lv(t.get,e,{getter:!0}),t.set&&Lv(t.set,e,{setter:!0}),Cg.f(r,e,t)}});var Uv=i(function(mP,$v){"use strict";var Ng=Y(),Ag=le(),jg=_(),Dg=M(),Fv=jg("species");$v.exports=function(r){var e=Ng(r);Dg&&e&&!e[Fv]&&Ag(e,Fv,{configurable:!0,get:function(){return this}})}});var Bv=i(function(OP,Gv){var Lg=_r(),Mg=TypeError;Gv.exports=function(r,e){if(Lg(e,r))return r;throw Mg("Incorrect invocation")}});var Kv=i(function(EP,kv){var Fg=nt(),$g=Cr(),Ug=TypeError;kv.exports=function(r){if(Fg(r))return r;throw Ug($g(r)+" is not a constructor")}});var Wv=i(function(IP,Yv){var Vv=F(),Gg=Kv(),Bg=xr(),kg=_(),Kg=kg("species");Yv.exports=function(r,e){var t=Vv(r).constructor,n;return t===void 0||Bg(n=Vv(t)[Kg])?e:Gg(n)}});var pe=i(function(TP,Jv){var Hv=wn(),Vg=rr(),Yg=Jr(),Wg=Hv(Hv.bind);Jv.exports=function(r,e){return Vg(r),e===void 0?r:Yg?Wg(r,e):function(){return r.apply(e,arguments)}}});var it=i(function(PP,zv){var Hg=R();zv.exports=Hg([].slice)});var Qv=i(function(wP,Xv){var Jg=TypeError;Xv.exports=function(r,e){if(rS;S++)if(h=T(r[S]),h&&cc(lc,h))return h;return new dt(!1)}f=Sb(r,y)}for(O=o?r.next:f.next;!(I=yb(O,f)).done;){try{h=T(I.value)}catch(b){fc(f,"throw",b)}if(typeof h=="object"&&h&&cc(lc,h))return h}return new dt(!1)}});var gc=i(function(JP,hc){var Ob=_(),dc=Ob("iterator"),qc=!1;try{yc=0,ya={next:function(){return{done:!!yc++}},return:function(){qc=!0}},ya[dc]=function(){return this},Array.from(ya,function(){throw 2})}catch(r){}var yc,ya;hc.exports=function(r,e){if(!e&&!qc)return!1;var t=!1;try{var n={};n[dc]=function(){return{next:function(){return{done:t=!0}}}},r(n)}catch(a){}return t}});var da=i(function(zP,Sc){var Eb=Fr(),Ib=gc(),Tb=$r().CONSTRUCTOR;Sc.exports=Tb||!Ib(function(r){Eb.all(r).then(void 0,function(){})})});var bc=i(function(){"use strict";var Pb=C(),wb=A(),Rb=rr(),xb=Ur(),_b=vt(),Cb=pa(),Nb=da();Pb({target:"Promise",stat:!0,forced:Nb},{all:function(e){var t=this,n=xb.f(t),a=n.resolve,o=n.reject,v=_b(function(){var u=Rb(t.resolve),c=[],f=0,y=1;Cb(e,function(S){var m=f++,h=!1;y++,wb(u,t,S).then(function(O){h||(h=!0,c[m]=O,--y||a(c))},o)}),--y||a(c)});return v.error&&o(v.value),n.promise}})});var Oc=i(function(){"use strict";var Ab=C(),jb=z(),Db=$r().CONSTRUCTOR,ha=Fr(),Lb=Y(),Mb=P(),Fb=X(),mc=ha&&ha.prototype;Ab({target:"Promise",proto:!0,forced:Db,real:!0},{catch:function(r){return this.then(void 0,r)}});!jb&&Mb(ha)&&(qa=Lb("Promise").prototype.catch,mc.catch!==qa&&Fb(mc,"catch",qa,{unsafe:!0}));var qa});var Ec=i(function(){"use strict";var $b=C(),Ub=A(),Gb=rr(),Bb=Ur(),kb=vt(),Kb=pa(),Vb=da();$b({target:"Promise",stat:!0,forced:Vb},{race:function(e){var t=this,n=Bb.f(t),a=n.reject,o=kb(function(){var v=Gb(t.resolve);Kb(e,function(u){Ub(v,t,u).then(n.resolve,a)})});return o.error&&a(o.value),n.promise}})});var Ic=i(function(){"use strict";var Yb=C(),Wb=A(),Hb=Ur(),Jb=$r().CONSTRUCTOR;Yb({target:"Promise",stat:!0,forced:Jb},{reject:function(e){var t=Hb.f(this);return Wb(t.reject,void 0,e),t.promise}})});var Pc=i(function(iw,Tc){var zb=F(),Xb=V(),Qb=Ur();Tc.exports=function(r,e){if(zb(r),Xb(e)&&e.constructor===r)return e;var t=Qb.f(r),n=t.resolve;return n(e),t.promise}});var xc=i(function(){"use strict";var Zb=C(),rm=Y(),wc=z(),em=Fr(),Rc=$r().CONSTRUCTOR,tm=Pc(),nm=rm("Promise"),am=wc&&!Rc;Zb({target:"Promise",stat:!0,forced:wc||Rc},{resolve:function(e){return tm(am&&this===nm?em:this,e)}})});var Ac=i(function(vw,Nc){var Cc=ke(),um=gr(),vm=tt(),sm=Array,cm=Math.max;Nc.exports=function(r,e,t){for(var n=um(r),a=Cc(e,n),o=Cc(t===void 0?n:t,n),v=sm(cm(o-a,0)),u=0;aE;E++)if((u||E in h)&&($=h[E],K=O($,E,m),r))if(e)b[E]=K;else if(K)switch(r){case 3:return!0;case 5:return $;case 6:return E;case 2:Vc(b,$)}else switch(r){case 4:return!1;case 7:Vc(b,$)}return o?-1:n||a?a:b}};Yc.exports={forEach:sr(0),map:sr(1),filter:sr(2),some:sr(3),every:sr(4),find:sr(5),findIndex:sr(6),filterReject:sr(7)}});var sf=i(function(){"use strict";var qt=C(),Ra=x(),xa=A(),_m=R(),Cm=z(),Yr=M(),Wr=pr(),Nm=w(),j=D(),Am=_r(),Ea=F(),ht=Z(),_a=ee(),jm=er(),Ia=Rr(),me=Ar(),Jc=qn(),Dm=Ve(),zc=Mc(),Lm=Ye(),Xc=ne(),Qc=B(),Mm=hn(),Zc=Ct(),ba=X(),Fm=le(),Ca=yr(),$m=ae(),rf=ie(),Wc=De(),Um=_(),Gm=ga(),Bm=Se(),km=Kc(),Km=ur(),ef=hr(),gt=Sa().forEach,G=$m("hidden"),St="Symbol",Oe="prototype",Vm=ef.set,Hc=ef.getterFor(St),W=Object[Oe],Er=Ra.Symbol,be=Er&&Er[Oe],Ym=Ra.TypeError,ma=Ra.QObject,tf=Xc.f,Or=Qc.f,nf=zc.f,Wm=Zc.f,af=_m([].push),tr=Ca("symbols"),Ee=Ca("op-symbols"),Hm=Ca("wks"),Ta=!ma||!ma[Oe]||!ma[Oe].findChild,Pa=Yr&&Nm(function(){return me(Or({},"a",{get:function(){return Or(this,"a",{value:7}).a}})).a!=7})?function(r,e,t){var n=tf(W,e);n&&delete W[e],Or(r,e,t),n&&r!==W&&Or(W,e,n)}:Or,Oa=function(r,e){var t=tr[r]=me(be);return Vm(t,{type:St,tag:r,description:e}),Yr||(t.description=e),t},bt=function(e,t,n){e===W&&bt(Ee,t,n),Ea(e);var a=_a(t);return Ea(n),j(tr,a)?(n.enumerable?(j(e,G)&&e[G][a]&&(e[G][a]=!1),n=me(n,{enumerable:Ia(0,!1)})):(j(e,G)||Or(e,G,Ia(1,{})),e[G][a]=!0),Pa(e,a,n)):Or(e,a,n)},Na=function(e,t){Ea(e);var n=ht(t),a=Jc(n).concat(vf(n));return gt(a,function(o){(!Yr||xa(wa,n,o))&&bt(e,o,n[o])}),e},Jm=function(e,t){return t===void 0?me(e):Na(me(e),t)},wa=function(e){var t=_a(e),n=xa(Wm,this,t);return this===W&&j(tr,t)&&!j(Ee,t)?!1:n||!j(this,t)||!j(tr,t)||j(this,G)&&this[G][t]?n:!0},of=function(e,t){var n=ht(e),a=_a(t);if(!(n===W&&j(tr,a)&&!j(Ee,a))){var o=tf(n,a);return o&&j(tr,a)&&!(j(n,G)&&n[G][a])&&(o.enumerable=!0),o}},uf=function(e){var t=nf(ht(e)),n=[];return gt(t,function(a){!j(tr,a)&&!j(rf,a)&&af(n,a)}),n},vf=function(r){var e=r===W,t=nf(e?Ee:ht(r)),n=[];return gt(t,function(a){j(tr,a)&&(!e||j(W,a))&&af(n,tr[a])}),n};Wr||(Er=function(){if(Am(be,this))throw Ym("Symbol is not a constructor");var e=!arguments.length||arguments[0]===void 0?void 0:jm(arguments[0]),t=Wc(e),n=function(a){this===W&&xa(n,Ee,a),j(this,G)&&j(this[G],t)&&(this[G][t]=!1),Pa(this,t,Ia(1,a))};return Yr&&Ta&&Pa(W,t,{configurable:!0,set:n}),Oa(t,e)},be=Er[Oe],ba(be,"toString",function(){return Hc(this).tag}),ba(Er,"withoutSetter",function(r){return Oa(Wc(r),r)}),Zc.f=wa,Qc.f=bt,Mm.f=Na,Xc.f=of,Dm.f=zc.f=uf,Lm.f=vf,Gm.f=function(r){return Oa(Um(r),r)},Yr&&(Fm(be,"description",{configurable:!0,get:function(){return Hc(this).description}}),Cm||ba(W,"propertyIsEnumerable",wa,{unsafe:!0})));qt({global:!0,constructor:!0,wrap:!0,forced:!Wr,sham:!Wr},{Symbol:Er});gt(Jc(Hm),function(r){Bm(r)});qt({target:St,stat:!0,forced:!Wr},{useSetter:function(){Ta=!0},useSimple:function(){Ta=!1}});qt({target:"Object",stat:!0,forced:!Wr,sham:!Yr},{create:Jm,defineProperty:bt,defineProperties:Na,getOwnPropertyDescriptor:of});qt({target:"Object",stat:!0,forced:!Wr},{getOwnPropertyNames:uf});km();Km(Er,St);rf[G]=!0});var Aa=i(function(hw,cf){var zm=pr();cf.exports=zm&&!!Symbol.for&&!!Symbol.keyFor});var lf=i(function(){var Xm=C(),Qm=Y(),Zm=D(),rO=er(),ff=yr(),eO=Aa(),ja=ff("string-to-symbol-registry"),tO=ff("symbol-to-string-registry");Xm({target:"Symbol",stat:!0,forced:!eO},{for:function(r){var e=rO(r);if(Zm(ja,e))return ja[e];var t=Qm("Symbol")(e);return ja[e]=t,tO[t]=e,t}})});var yf=i(function(){var nO=C(),aO=D(),iO=Zr(),oO=Cr(),uO=yr(),vO=Aa(),pf=uO("symbol-to-string-registry");nO({target:"Symbol",stat:!0,forced:!vO},{keyFor:function(e){if(!iO(e))throw TypeError(oO(e)+" is not a symbol");if(aO(pf,e))return pf[e]}})});var Sf=i(function(Ow,gf){var sO=R(),df=Lr(),cO=P(),qf=Q(),fO=er(),hf=sO([].push);gf.exports=function(r){if(cO(r))return r;if(!!df(r)){for(var e=r.length,t=[],n=0;n=e.length?(r.target=void 0,Pt(void 0,!0)):t=="keys"?Pt(n,!1):t=="values"?Pt(e[n],!1):Pt([n,e[n]],!1)},"values");var vl=ul.Arguments=ul.Array;Wa("keys");Wa("values");Wa("entries");if(!bE&&mE&&vl.name!=="values")try{gE(vl,"name",{value:"values"})}catch(r){}});var Ja=i(function(Dw,dl){dl.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var Xa=i(function(Lw,hl){var xE=te(),za=xE("span").classList,ql=za&&za.constructor&&za.constructor.prototype;hl.exports=ql===Object.prototype?void 0:ql});var Tl=i(function(Mw,Il){"use strict";var kE=w();Il.exports=function(r,e){var t=[][r];return!!t&&kE(function(){t.call(null,e||function(){return 1},1)})}});var ei=i(function(Fw,Pl){"use strict";var KE=Sa().forEach,VE=Tl(),YE=VE("forEach");Pl.exports=YE?[].forEach:function(e){return KE(this,e,arguments.length>1?arguments[1]:void 0)}});var $w=pi(Pn());var lh=rt(),av=A(),et=R(),ph=Wu(),yh=w(),dh=F(),qh=P(),hh=xr(),gh=ue(),Sh=un(),Dr=er(),bh=zr(),mh=Qu(),Oh=re(),Eh=rv(),Ih=nv(),Th=_(),Dn=Th("replace"),Ph=Math.max,wh=Math.min,Rh=et([].concat),jn=et([].push),iv=et("".indexOf),ov=et("".slice),xh=function(r){return r===void 0?r:String(r)},_h=function(){return"a".replace(/./,"$0")==="$0"}(),uv=function(){return/./[Dn]?/./[Dn]("a","$0")==="":!1}(),Ch=!yh(function(){var r=/./;return r.exec=function(){var e=[];return e.groups={a:"7"},e},"".replace(r,"$")!=="7"});ph("replace",function(r,e,t){var n=uv?"$":"$0";return[function(o,v){var u=bh(this),c=hh(o)?void 0:Oh(o,Dn);return c?av(c,o,u,v):av(e,Dr(u),o,v)},function(a,o){var v=dh(this),u=Dr(a);if(typeof o=="string"&&iv(o,n)===-1&&iv(o,"$<")===-1){var c=t(e,v,u,o);if(c.done)return c.value}var f=qh(o);f||(o=Dr(o));var y=v.global;if(y){var S=v.unicode;v.lastIndex=0}for(var m=[];;){var h=Ih(v,u);if(h===null||(jn(m,h),!y))break;var O=Dr(h[0]);O===""&&(v.lastIndex=mh(u,Sh(v.lastIndex),S))}for(var I="",E=0,T=0;T=E&&(I+=ov(u,E,$)+wr,E=$+b.length)}return I+ov(u,E)}]},!Ch||!_h||uv);var eg=C(),tg=w(),ng=Lr(),ag=V(),ig=or(),og=gr(),Ev=cv(),Iv=tt(),ug=Mn(),vg=Fn(),sg=_(),cg=Qr(),Tv=sg("isConcatSpreadable"),fg=cg>=51||!tg(function(){var r=[];return r[Tv]=!1,r.concat()[0]!==r}),lg=function(r){if(!ag(r))return!1;var e=r[Tv];return e!==void 0?!!e:ng(r)},pg=!fg||!vg("concat");eg({target:"Array",proto:!0,arity:1,forced:pg},{concat:function(e){var t=ig(this),n=ug(t,0),a=0,o,v,u,c,f;for(o=-1,u=arguments.length;o=t.length?ll(void 0,!0):(a=IE(t,n),e.index+=a.length,ll(a,!1))});var gl=x(),bl=Ja(),_E=Xa(),Re=Ha(),Qa=dr(),ml=_(),Za=ml("iterator"),Sl=ml("toStringTag"),ri=Re.values,Ol=function(r,e){if(r){if(r[Za]!==ri)try{Qa(r,Za,ri)}catch(n){r[Za]=ri}if(r[Sl]||Qa(r,Sl,e),bl[e]){for(var t in Re)if(r[t]!==Re[t])try{Qa(r,t,Re[t])}catch(n){r[t]=Re[t]}}}};for(wt in bl)Ol(gl[wt]&&gl[wt].prototype,wt);var wt;Ol(_E,"DOMTokenList");var CE=Se();CE("asyncIterator");var NE=Y(),AE=Se(),jE=ur();AE("toStringTag");jE(NE("Symbol"),"Symbol");var DE=x(),LE=ur();LE(DE.JSON,"JSON",!0);var ME=ur();ME(Math,"Math",!0);var FE=C(),$E=w(),UE=or(),El=Et(),GE=Fa(),BE=$E(function(){El(1)});FE({target:"Object",stat:!0,forced:BE,sham:!GE},{getPrototypeOf:function(e){return El(UE(e))}});var WE=C(),wl=ei();WE({target:"Array",proto:!0,forced:[].forEach!=wl},{forEach:wl});var Rl=x(),xl=Ja(),HE=Xa(),ti=ei(),JE=dr(),_l=function(r){if(r&&r.forEach!==ti)try{JE(r,"forEach",ti)}catch(e){r.forEach=ti}};for(Rt in xl)xl[Rt]&&_l(Rl[Rt]&&Rl[Rt].prototype);var Rt;_l(HE);var zE=M(),XE=Me().EXISTS,Cl=R(),QE=le(),Nl=Function.prototype,ZE=Cl(Nl.toString),Al=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,rI=Cl(Al.exec),eI="name";zE&&!XE&&QE(Nl,eI,{configurable:!0,get:function(){try{return rI(Al,ZE(this))[1]}catch(r){return""}}});var tI=C(),nI=at();tI({target:"Object",stat:!0},{setPrototypeOf:nI});var aI=C(),iI=R(),oI=Lr(),uI=iI([].reverse),jl=[1,2];aI({target:"Array",proto:!0,forced:String(jl)===String(jl.reverse())},{reverse:function(){return oI(this)&&(this.length=this.length),uI(this)}});var vI=C(),Dl=Lr(),sI=nt(),cI=V(),Ll=ke(),fI=gr(),lI=Z(),pI=tt(),yI=_(),dI=Fn(),qI=it(),hI=dI("slice"),gI=yI("species"),ni=Array,SI=Math.max;vI({target:"Array",proto:!0,forced:!hI},{slice:function(e,t){var n=lI(this),a=fI(n),o=Ll(e,a),v=Ll(t===void 0?a:t,a),u,c,f;if(Dl(n)&&(u=n.constructor,sI(u)&&(u===ni||Dl(u.prototype))?u=void 0:cI(u)&&(u=u[gI],u===null&&(u=void 0)),u===ni||u===void 0))return qI(n,o,v);for(c=new(u===void 0?ni:u)(SI(v-o,0)),f=0;o=0;--g){var q=this.tryEntries[g],N=q.completion;if(q.tryLoc==="root")return d("end");if(q.tryLoc<=this.prev){var L=t.call(q,"catchLoc"),U=t.call(q,"finallyLoc");if(L&&U){if(this.prev=0;--d){var g=this.tryEntries[d];if(g.tryLoc<=this.prev&&t.call(g,"finallyLoc")&&this.prev=0;--l){var d=this.tryEntries[l];if(d.finallyLoc===s)return this.complete(d.completion,d.afterLoc),wr(d),S}},catch:function(s){for(var l=this.tryEntries.length-1;l>=0;--l){var d=this.tryEntries[l];if(d.tryLoc===s){var g=d.completion;if(g.type==="throw"){var q=g.arg;wr(d)}return q}}throw new Error("illegal catch attempt")},delegateYield:function(s,l,d){return this.delegate={iterator:_t(s),resultName:l,nextLoc:d},this.method==="next"&&(this.arg=void 0),S}},r}function Ml(r,e,t,n,a,o,v){try{var u=r[o](v),c=u.value}catch(f){t(f);return}u.done?e(c):Promise.resolve(c).then(n,a)}function ci(r){return function(){var e=this,t=arguments;return new Promise(function(n,a){var o=r.apply(e,t);function v(c){Ml(o,n,a,v,u,"next",c)}function u(c){Ml(o,n,a,v,u,"throw",c)}v(void 0)})}}document.documentElement.classList.add("autoreload-enabled");var bI=window.location.protocol==="https:"?"wss:":"ws:",mI=window.location.pathname.replace(/\/?$/,"/")+"autoreload/",OI="".concat(bI,"//").concat(window.location.host).concat(mI),EI=((ai=document.currentScript)===null||ai===void 0||(ii=ai.dataset)===null||ii===void 0?void 0:ii.wsUrl)||OI;function II(r){return ui.apply(this,arguments)}function ui(){return ui=ci(Tr().mark(function r(e){var t,n;return Tr().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return t=new WebSocket(e),n=!1,o.abrupt("return",new Promise(function(v,u){t.onopen=function(){n=!0},t.onerror=function(c){u(c)},t.onclose=function(){n?v(!1):u(new Error("WebSocket connection failed"))},t.onmessage=function(c){c.data==="autoreload"&&v(!0)}}));case 3:case"end":return o.stop()}},r)})),ui.apply(this,arguments)}function TI(r){return vi.apply(this,arguments)}function vi(){return vi=ci(Tr().mark(function r(e){return Tr().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",new Promise(function(a){return setTimeout(a,e)}));case 1:case"end":return n.stop()}},r)})),vi.apply(this,arguments)}function PI(){return si.apply(this,arguments)}function si(){return si=ci(Tr().mark(function r(){return Tr().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=1,t.next=4,II(EI);case 4:if(!t.sent){t.next=7;break}return window.location.reload(),t.abrupt("return");case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(1),console.debug("Giving up on autoreload"),t.abrupt("return");case 13:return t.next=15,TI(1e3);case 15:t.next=0;break;case 17:case"end":return t.stop()}},r,null,[[1,9]])})),si.apply(this,arguments)}PI().catch(function(r){console.error(r)});})(); +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ //# sourceMappingURL=shiny-autoreload.js.map diff --git a/shiny/www/shared/shiny-autoreload.js.map b/shiny/www/shared/shiny-autoreload.js.map index ffe58420a..9727a863c 100644 --- a/shiny/www/shared/shiny-autoreload.js.map +++ b/shiny/www/shared/shiny-autoreload.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../../../node_modules/core-js/internals/global.js", "../../../node_modules/core-js/internals/fails.js", "../../../node_modules/core-js/internals/descriptors.js", "../../../node_modules/core-js/internals/function-bind-native.js", "../../../node_modules/core-js/internals/function-call.js", "../../../node_modules/core-js/internals/object-property-is-enumerable.js", "../../../node_modules/core-js/internals/create-property-descriptor.js", "../../../node_modules/core-js/internals/function-uncurry-this.js", "../../../node_modules/core-js/internals/classof-raw.js", "../../../node_modules/core-js/internals/indexed-object.js", "../../../node_modules/core-js/internals/is-null-or-undefined.js", "../../../node_modules/core-js/internals/require-object-coercible.js", "../../../node_modules/core-js/internals/to-indexed-object.js", "../../../node_modules/core-js/internals/document-all.js", "../../../node_modules/core-js/internals/is-callable.js", "../../../node_modules/core-js/internals/is-object.js", "../../../node_modules/core-js/internals/get-built-in.js", "../../../node_modules/core-js/internals/object-is-prototype-of.js", "../../../node_modules/core-js/internals/engine-user-agent.js", "../../../node_modules/core-js/internals/engine-v8-version.js", "../../../node_modules/core-js/internals/symbol-constructor-detection.js", "../../../node_modules/core-js/internals/use-symbol-as-uid.js", "../../../node_modules/core-js/internals/is-symbol.js", "../../../node_modules/core-js/internals/try-to-string.js", "../../../node_modules/core-js/internals/a-callable.js", "../../../node_modules/core-js/internals/get-method.js", "../../../node_modules/core-js/internals/ordinary-to-primitive.js", "../../../node_modules/core-js/internals/is-pure.js", "../../../node_modules/core-js/internals/define-global-property.js", "../../../node_modules/core-js/internals/shared-store.js", "../../../node_modules/core-js/internals/shared.js", "../../../node_modules/core-js/internals/to-object.js", "../../../node_modules/core-js/internals/has-own-property.js", "../../../node_modules/core-js/internals/uid.js", "../../../node_modules/core-js/internals/well-known-symbol.js", "../../../node_modules/core-js/internals/to-primitive.js", "../../../node_modules/core-js/internals/to-property-key.js", "../../../node_modules/core-js/internals/document-create-element.js", "../../../node_modules/core-js/internals/ie8-dom-define.js", "../../../node_modules/core-js/internals/object-get-own-property-descriptor.js", "../../../node_modules/core-js/internals/v8-prototype-define-bug.js", "../../../node_modules/core-js/internals/an-object.js", "../../../node_modules/core-js/internals/object-define-property.js", "../../../node_modules/core-js/internals/create-non-enumerable-property.js", "../../../node_modules/core-js/internals/function-name.js", "../../../node_modules/core-js/internals/inspect-source.js", "../../../node_modules/core-js/internals/weak-map-basic-detection.js", "../../../node_modules/core-js/internals/shared-key.js", "../../../node_modules/core-js/internals/hidden-keys.js", "../../../node_modules/core-js/internals/internal-state.js", "../../../node_modules/core-js/internals/make-built-in.js", "../../../node_modules/core-js/internals/define-built-in.js", "../../../node_modules/core-js/internals/math-trunc.js", "../../../node_modules/core-js/internals/to-integer-or-infinity.js", "../../../node_modules/core-js/internals/to-absolute-index.js", "../../../node_modules/core-js/internals/to-length.js", "../../../node_modules/core-js/internals/length-of-array-like.js", "../../../node_modules/core-js/internals/array-includes.js", "../../../node_modules/core-js/internals/object-keys-internal.js", "../../../node_modules/core-js/internals/enum-bug-keys.js", "../../../node_modules/core-js/internals/object-get-own-property-names.js", "../../../node_modules/core-js/internals/object-get-own-property-symbols.js", "../../../node_modules/core-js/internals/own-keys.js", "../../../node_modules/core-js/internals/copy-constructor-properties.js", "../../../node_modules/core-js/internals/is-forced.js", "../../../node_modules/core-js/internals/export.js", "../../../node_modules/core-js/internals/to-string-tag-support.js", "../../../node_modules/core-js/internals/classof.js", "../../../node_modules/core-js/internals/to-string.js", "../../../node_modules/core-js/internals/regexp-flags.js", "../../../node_modules/core-js/internals/regexp-sticky-helpers.js", "../../../node_modules/core-js/internals/object-keys.js", "../../../node_modules/core-js/internals/object-define-properties.js", "../../../node_modules/core-js/internals/html.js", "../../../node_modules/core-js/internals/object-create.js", "../../../node_modules/core-js/internals/regexp-unsupported-dot-all.js", "../../../node_modules/core-js/internals/regexp-unsupported-ncg.js", "../../../node_modules/core-js/internals/regexp-exec.js", "../../../node_modules/core-js/modules/es.regexp.exec.js", "../../../node_modules/core-js/internals/function-apply.js", "../../../node_modules/core-js/internals/function-uncurry-this-clause.js", "../../../node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js", "../../../node_modules/core-js/internals/string-multibyte.js", "../../../node_modules/core-js/internals/advance-string-index.js", "../../../node_modules/core-js/internals/get-substitution.js", "../../../node_modules/core-js/internals/regexp-exec-abstract.js", "../../../node_modules/core-js/internals/is-array.js", "../../../node_modules/core-js/internals/does-not-exceed-safe-integer.js", "../../../node_modules/core-js/internals/create-property.js", "../../../node_modules/core-js/internals/is-constructor.js", "../../../node_modules/core-js/internals/array-species-constructor.js", "../../../node_modules/core-js/internals/array-species-create.js", "../../../node_modules/core-js/internals/array-method-has-species-support.js", "../../../srcts/extras/shiny-autoreload.ts", "../../../node_modules/core-js/modules/es.string.replace.js", "../../../node_modules/core-js/modules/es.array.concat.js"], - "sourcesContent": ["var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line es/no-global-this -- safe\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n // eslint-disable-next-line no-restricted-globals -- safe\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func -- fallback\n (function () { return this; })() || Function('return this')();\n", "module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n", "var fails = require('../internals/fails');\n\n// Detect IE8's incomplete defineProperty implementation\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n", "var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-function-prototype-bind -- safe\n var test = (function () { /* empty */ }).bind();\n // eslint-disable-next-line no-prototype-builtins -- safe\n return typeof test != 'function' || test.hasOwnProperty('prototype');\n});\n", "var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar call = Function.prototype.call;\n\nmodule.exports = NATIVE_BIND ? call.bind(call) : function () {\n return call.apply(call, arguments);\n};\n", "'use strict';\nvar $propertyIsEnumerable = {}.propertyIsEnumerable;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : $propertyIsEnumerable;\n", "module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n", "var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar call = FunctionPrototype.call;\nvar uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);\n\nmodule.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {\n return function () {\n return call.apply(fn, arguments);\n };\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\n\nvar toString = uncurryThis({}.toString);\nvar stringSlice = uncurryThis(''.slice);\n\nmodule.exports = function (it) {\n return stringSlice(toString(it), 8, -1);\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar $Object = Object;\nvar split = uncurryThis(''.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins -- safe\n return !$Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split(it, '') : $Object(it);\n} : $Object;\n", "// we can't use just `it == null` since of `document.all` special case\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec\nmodule.exports = function (it) {\n return it === null || it === undefined;\n};\n", "var isNullOrUndefined = require('../internals/is-null-or-undefined');\n\nvar $TypeError = TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (isNullOrUndefined(it)) throw $TypeError(\"Can't call method on \" + it);\n return it;\n};\n", "// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n", "var documentAll = typeof document == 'object' && document.all;\n\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot\n// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing\nvar IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;\n\nmodule.exports = {\n all: documentAll,\n IS_HTMLDDA: IS_HTMLDDA\n};\n", "var $documentAll = require('../internals/document-all');\n\nvar documentAll = $documentAll.all;\n\n// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\nmodule.exports = $documentAll.IS_HTMLDDA ? function (argument) {\n return typeof argument == 'function' || argument === documentAll;\n} : function (argument) {\n return typeof argument == 'function';\n};\n", "var isCallable = require('../internals/is-callable');\nvar $documentAll = require('../internals/document-all');\n\nvar documentAll = $documentAll.all;\n\nmodule.exports = $documentAll.IS_HTMLDDA ? function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;\n} : function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n", "var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar aFunction = function (argument) {\n return isCallable(argument) ? argument : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n", "module.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || '';\n", "var global = require('../internals/global');\nvar userAgent = require('../internals/engine-user-agent');\n\nvar process = global.process;\nvar Deno = global.Deno;\nvar versions = process && process.versions || Deno && Deno.version;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n // in old Chrome, versions of V8 isn't V8 = Chrome / 10\n // but their correct versions are not interesting for us\n version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = +match[1];\n }\n}\n\nmodule.exports = version;\n", "/* eslint-disable es/no-symbol -- required for testing */\nvar V8_VERSION = require('../internals/engine-v8-version');\nvar fails = require('../internals/fails');\n\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol();\n // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n return !String(symbol) || !(Object(symbol) instanceof Symbol) ||\n // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n", "/* eslint-disable es/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\n\nmodule.exports = NATIVE_SYMBOL\n && !Symbol.sham\n && typeof Symbol.iterator == 'symbol';\n", "var getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar $Object = Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n var $Symbol = getBuiltIn('Symbol');\n return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));\n};\n", "var $String = String;\n\nmodule.exports = function (argument) {\n try {\n return $String(argument);\n } catch (error) {\n return 'Object';\n }\n};\n", "var isCallable = require('../internals/is-callable');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n if (isCallable(argument)) return argument;\n throw $TypeError(tryToString(argument) + ' is not a function');\n};\n", "var aCallable = require('../internals/a-callable');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n var func = V[P];\n return isNullOrUndefined(func) ? undefined : aCallable(func);\n};\n", "var call = require('../internals/function-call');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\n\nvar $TypeError = TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n var fn, val;\n if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n throw $TypeError(\"Can't convert object to primitive value\");\n};\n", "module.exports = false;\n", "var global = require('../internals/global');\n\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n try {\n defineProperty(global, key, { value: value, configurable: true, writable: true });\n } catch (error) {\n global[key] = value;\n } return value;\n};\n", "var global = require('../internals/global');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || defineGlobalProperty(SHARED, {});\n\nmodule.exports = store;\n", "var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.29.0',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '\u00A9 2014-2023 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.29.0/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n", "var requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar $Object = Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return $Object(requireObjectCoercible(argument));\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty(toObject(it), key);\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.0.toString);\n\nmodule.exports = function (key) {\n return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);\n};\n", "var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar hasOwn = require('../internals/has-own-property');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar Symbol = global.Symbol;\nvar WellKnownSymbolsStore = shared('wks');\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name)) {\n WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)\n ? Symbol[name]\n : createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n", "var call = require('../internals/function-call');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar getMethod = require('../internals/get-method');\nvar ordinaryToPrimitive = require('../internals/ordinary-to-primitive');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $TypeError = TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n if (!isObject(input) || isSymbol(input)) return input;\n var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n var result;\n if (exoticToPrim) {\n if (pref === undefined) pref = 'default';\n result = call(exoticToPrim, input, pref);\n if (!isObject(result) || isSymbol(result)) return result;\n throw $TypeError(\"Can't convert object to primitive value\");\n }\n if (pref === undefined) pref = 'number';\n return ordinaryToPrimitive(input, pref);\n};\n", "var toPrimitive = require('../internals/to-primitive');\nvar isSymbol = require('../internals/is-symbol');\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n var key = toPrimitive(argument, 'string');\n return isSymbol(key) ? key : key + '';\n};\n", "var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n", "var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n", "var DESCRIPTORS = require('../internals/descriptors');\nvar call = require('../internals/function-call');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar hasOwn = require('../internals/has-own-property');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPropertyKey(P);\n if (IE8_DOM_DEFINE) try {\n return $getOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n", "var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(function () { /* empty */ }, 'prototype', {\n value: 42,\n writable: false\n }).prototype != 42;\n});\n", "var isObject = require('../internals/is-object');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n if (isObject(argument)) return argument;\n throw $TypeError($String(argument) + ' is not an object');\n};\n", "var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = 'enumerable';\nvar CONFIGURABLE = 'configurable';\nvar WRITABLE = 'writable';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n var current = $getOwnPropertyDescriptor(O, P);\n if (current && current[WRITABLE]) {\n O[P] = Attributes.value;\n Attributes = {\n configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n writable: false\n };\n }\n } return $defineProperty(O, P, Attributes);\n} : $defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return $defineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n", "var DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n", "var DESCRIPTORS = require('../internals/descriptors');\nvar hasOwn = require('../internals/has-own-property');\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, 'name');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));\n\nmodule.exports = {\n EXISTS: EXISTS,\n PROPER: PROPER,\n CONFIGURABLE: CONFIGURABLE\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar store = require('../internals/shared-store');\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper\nif (!isCallable(store.inspectSource)) {\n store.inspectSource = function (it) {\n return functionToString(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n", "var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));\n", "var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n", "module.exports = {};\n", "var NATIVE_WEAK_MAP = require('../internals/weak-map-basic-detection');\nvar global = require('../internals/global');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = global.TypeError;\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n /* eslint-disable no-self-assign -- prototype methods protection */\n store.get = store.get;\n store.has = store.has;\n store.set = store.set;\n /* eslint-enable no-self-assign -- prototype methods protection */\n set = function (it, metadata) {\n if (store.has(it)) throw TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n store.set(it, metadata);\n return metadata;\n };\n get = function (it) {\n return store.get(it) || {};\n };\n has = function (it) {\n return store.has(it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar hasOwn = require('../internals/has-own-property');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar CONFIGURABLE_FUNCTION_NAME = require('../internals/function-name').CONFIGURABLE;\nvar inspectSource = require('../internals/inspect-source');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar enforceInternalState = InternalStateModule.enforce;\nvar getInternalState = InternalStateModule.get;\nvar $String = String;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\nvar stringSlice = uncurryThis(''.slice);\nvar replace = uncurryThis(''.replace);\nvar join = uncurryThis([].join);\n\nvar CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {\n return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;\n});\n\nvar TEMPLATE = String(String).split('String');\n\nvar makeBuiltIn = module.exports = function (value, name, options) {\n if (stringSlice($String(name), 0, 7) === 'Symbol(') {\n name = '[' + replace($String(name), /^Symbol\\(([^)]*)\\)/, '$1') + ']';\n }\n if (options && options.getter) name = 'get ' + name;\n if (options && options.setter) name = 'set ' + name;\n if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {\n if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });\n else value.name = name;\n }\n if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {\n defineProperty(value, 'length', { value: options.arity });\n }\n try {\n if (options && hasOwn(options, 'constructor') && options.constructor) {\n if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });\n // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable\n } else if (value.prototype) value.prototype = undefined;\n } catch (error) { /* empty */ }\n var state = enforceInternalState(value);\n if (!hasOwn(state, 'source')) {\n state.source = join(TEMPLATE, typeof name == 'string' ? name : '');\n } return value;\n};\n\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n// eslint-disable-next-line no-extend-native -- required\nFunction.prototype.toString = makeBuiltIn(function toString() {\n return isCallable(this) && getInternalState(this).source || inspectSource(this);\n}, 'toString');\n", "var isCallable = require('../internals/is-callable');\nvar definePropertyModule = require('../internals/object-define-property');\nvar makeBuiltIn = require('../internals/make-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nmodule.exports = function (O, key, value, options) {\n if (!options) options = {};\n var simple = options.enumerable;\n var name = options.name !== undefined ? options.name : key;\n if (isCallable(value)) makeBuiltIn(value, name, options);\n if (options.global) {\n if (simple) O[key] = value;\n else defineGlobalProperty(key, value);\n } else {\n try {\n if (!options.unsafe) delete O[key];\n else if (O[key]) simple = true;\n } catch (error) { /* empty */ }\n if (simple) O[key] = value;\n else definePropertyModule.f(O, key, {\n value: value,\n enumerable: false,\n configurable: !options.nonConfigurable,\n writable: !options.nonWritable\n });\n } return O;\n};\n", "var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n var n = +x;\n return (n > 0 ? floor : ceil)(n);\n};\n", "var trunc = require('../internals/math-trunc');\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n var number = +argument;\n // eslint-disable-next-line no-self-compare -- NaN check\n return number !== number || number === 0 ? 0 : trunc(number);\n};\n", "var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toIntegerOrInfinity(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n", "var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n", "var toLength = require('../internals/to-length');\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n return toLength(obj.length);\n};\n", "var toIndexedObject = require('../internals/to-indexed-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = lengthOfArrayLike(O);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare -- NaN check\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare -- NaN check\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.es/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.es/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (hasOwn(O, key = names[i++])) {\n ~indexOf(result, key) || push(result, key);\n }\n return result;\n};\n", "// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n", "var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n", "// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n", "var getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n", "var hasOwn = require('../internals/has-own-property');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source, exceptions) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {\n defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n }\n};\n", "var fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : isCallable(detection) ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n", "var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineGlobalProperty = require('../internals/define-global-property');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.dontCallGetSet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || defineGlobalProperty(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty == typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n defineBuiltIn(target, key, sourceProperty, options);\n }\n};\n", "var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG] = 'z';\n\nmodule.exports = String(test) === '[object z]';\n", "var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar isCallable = require('../internals/is-callable');\nvar classofRaw = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar $Object = Object;\n\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;\n};\n", "var classof = require('../internals/classof');\n\nvar $String = String;\n\nmodule.exports = function (argument) {\n if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');\n return $String(argument);\n};\n", "'use strict';\nvar anObject = require('../internals/an-object');\n\n// `RegExp.prototype.flags` getter implementation\n// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.hasIndices) result += 'd';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.dotAll) result += 's';\n if (that.unicode) result += 'u';\n if (that.unicodeSets) result += 'v';\n if (that.sticky) result += 'y';\n return result;\n};\n", "var fails = require('../internals/fails');\nvar global = require('../internals/global');\n\n// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError\nvar $RegExp = global.RegExp;\n\nvar UNSUPPORTED_Y = fails(function () {\n var re = $RegExp('a', 'y');\n re.lastIndex = 2;\n return re.exec('abcd') != null;\n});\n\n// UC Browser bug\n// https://github.com/zloirock/core-js/issues/1008\nvar MISSED_STICKY = UNSUPPORTED_Y || fails(function () {\n return !$RegExp('a', 'y').sticky;\n});\n\nvar BROKEN_CARET = UNSUPPORTED_Y || fails(function () {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=773687\n var re = $RegExp('^r', 'gy');\n re.lastIndex = 2;\n return re.exec('str') != null;\n});\n\nmodule.exports = {\n BROKEN_CARET: BROKEN_CARET,\n MISSED_STICKY: MISSED_STICKY,\n UNSUPPORTED_Y: UNSUPPORTED_Y\n};\n", "var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n", "var DESCRIPTORS = require('../internals/descriptors');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var props = toIndexedObject(Properties);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n return O;\n};\n", "var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n", "/* global ActiveXObject -- old IE, WSH */\nvar anObject = require('../internals/an-object');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n activeXDocument = new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = typeof document != 'undefined'\n ? document.domain && activeXDocument\n ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n : NullProtoObjectViaIFrame()\n : NullProtoObjectViaActiveX(activeXDocument); // WSH\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n", "var fails = require('../internals/fails');\nvar global = require('../internals/global');\n\n// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError\nvar $RegExp = global.RegExp;\n\nmodule.exports = fails(function () {\n var re = $RegExp('.', 's');\n return !(re.dotAll && re.exec('\\n') && re.flags === 's');\n});\n", "var fails = require('../internals/fails');\nvar global = require('../internals/global');\n\n// babel-minify and Closure Compiler transpiles RegExp('(?b)', 'g') -> /(?b)/g and it causes SyntaxError\nvar $RegExp = global.RegExp;\n\nmodule.exports = fails(function () {\n var re = $RegExp('(?b)', 'g');\n return re.exec('b').groups.a !== 'b' ||\n 'b'.replace(re, '$c') !== 'bc';\n});\n", "'use strict';\n/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */\n/* eslint-disable regexp/no-useless-quantifier -- testing */\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toString = require('../internals/to-string');\nvar regexpFlags = require('../internals/regexp-flags');\nvar stickyHelpers = require('../internals/regexp-sticky-helpers');\nvar shared = require('../internals/shared');\nvar create = require('../internals/object-create');\nvar getInternalState = require('../internals/internal-state').get;\nvar UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');\nvar UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');\n\nvar nativeReplace = shared('native-string-replace', String.prototype.replace);\nvar nativeExec = RegExp.prototype.exec;\nvar patchedExec = nativeExec;\nvar charAt = uncurryThis(''.charAt);\nvar indexOf = uncurryThis(''.indexOf);\nvar replace = uncurryThis(''.replace);\nvar stringSlice = uncurryThis(''.slice);\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/;\n var re2 = /b*/g;\n call(nativeExec, re1, 'a');\n call(nativeExec, re2, 'a');\n return re1.lastIndex !== 0 || re2.lastIndex !== 0;\n})();\n\nvar UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;\n\nif (PATCH) {\n patchedExec = function exec(string) {\n var re = this;\n var state = getInternalState(re);\n var str = toString(string);\n var raw = state.raw;\n var result, reCopy, lastIndex, match, i, object, group;\n\n if (raw) {\n raw.lastIndex = re.lastIndex;\n result = call(patchedExec, raw, str);\n re.lastIndex = raw.lastIndex;\n return result;\n }\n\n var groups = state.groups;\n var sticky = UNSUPPORTED_Y && re.sticky;\n var flags = call(regexpFlags, re);\n var source = re.source;\n var charsAdded = 0;\n var strCopy = str;\n\n if (sticky) {\n flags = replace(flags, 'y', '');\n if (indexOf(flags, 'g') === -1) {\n flags += 'g';\n }\n\n strCopy = stringSlice(str, re.lastIndex);\n // Support anchored sticky behavior.\n if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\\n')) {\n source = '(?: ' + source + ')';\n strCopy = ' ' + strCopy;\n charsAdded++;\n }\n // ^(? + rx + ) is needed, in combination with some str slicing, to\n // simulate the 'y' flag.\n reCopy = new RegExp('^(?:' + source + ')', flags);\n }\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + source + '$(?!\\\\s)', flags);\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;\n\n match = call(nativeExec, sticky ? reCopy : re, strCopy);\n\n if (sticky) {\n if (match) {\n match.input = stringSlice(match.input, charsAdded);\n match[0] = stringSlice(match[0], charsAdded);\n match.index = re.lastIndex;\n re.lastIndex += match[0].length;\n } else re.lastIndex = 0;\n } else if (UPDATES_LAST_INDEX_WRONG && match) {\n re.lastIndex = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/\n call(nativeReplace, match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n if (match && groups) {\n match.groups = object = create(null);\n for (i = 0; i < groups.length; i++) {\n group = groups[i];\n object[group[0]] = match[group[1]];\n }\n }\n\n return match;\n };\n}\n\nmodule.exports = patchedExec;\n", "'use strict';\nvar $ = require('../internals/export');\nvar exec = require('../internals/regexp-exec');\n\n// `RegExp.prototype.exec` method\n// https://tc39.es/ecma262/#sec-regexp.prototype.exec\n$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {\n exec: exec\n});\n", "var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar apply = FunctionPrototype.apply;\nvar call = FunctionPrototype.call;\n\n// eslint-disable-next-line es/no-reflect -- safe\nmodule.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {\n return call.apply(apply, arguments);\n});\n", "var classofRaw = require('../internals/classof-raw');\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = function (fn) {\n // Nashorn bug:\n // https://github.com/zloirock/core-js/issues/1128\n // https://github.com/zloirock/core-js/issues/1130\n if (classofRaw(fn) === 'Function') return uncurryThis(fn);\n};\n", "'use strict';\n// TODO: Remove from `core-js@4` since it's moved to entry points\nrequire('../modules/es.regexp.exec');\nvar uncurryThis = require('../internals/function-uncurry-this-clause');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar regexpExec = require('../internals/regexp-exec');\nvar fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nvar SPECIES = wellKnownSymbol('species');\nvar RegExpPrototype = RegExp.prototype;\n\nmodule.exports = function (KEY, exec, FORCED, SHAM) {\n var SYMBOL = wellKnownSymbol(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n\n if (KEY === 'split') {\n // We can't use real regex here since it causes deoptimization\n // and serious performance degradation in V8\n // https://github.com/zloirock/core-js/issues/306\n re = {};\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n re.flags = '';\n re[SYMBOL] = /./[SYMBOL];\n }\n\n re.exec = function () { execCalled = true; return null; };\n\n re[SYMBOL]('');\n return !execCalled;\n });\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n FORCED\n ) {\n var uncurriedNativeRegExpMethod = uncurryThis(/./[SYMBOL]);\n var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {\n var uncurriedNativeMethod = uncurryThis(nativeMethod);\n var $exec = regexp.exec;\n if ($exec === regexpExec || $exec === RegExpPrototype.exec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };\n }\n return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };\n }\n return { done: false };\n });\n\n defineBuiltIn(String.prototype, KEY, methods[0]);\n defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);\n }\n\n if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar stringSlice = uncurryThis(''.slice);\n\nvar createMethod = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = toString(requireObjectCoercible($this));\n var position = toIntegerOrInfinity(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = charCodeAt(S, position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING\n ? charAt(S, position)\n : first\n : CONVERT_TO_STRING\n ? stringSlice(S, position, position + 2)\n : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n};\n\nmodule.exports = {\n // `String.prototype.codePointAt` method\n // https://tc39.es/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod(true)\n};\n", "'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\n\n// `AdvanceStringIndex` abstract operation\n// https://tc39.es/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n return index + (unicode ? charAt(S, index).length : 1);\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar floor = Math.floor;\nvar charAt = uncurryThis(''.charAt);\nvar replace = uncurryThis(''.replace);\nvar stringSlice = uncurryThis(''.slice);\n// eslint-disable-next-line redos/no-vulnerable -- safe\nvar SUBSTITUTION_SYMBOLS = /\\$([$&'`]|\\d{1,2}|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&'`]|\\d{1,2})/g;\n\n// `GetSubstitution` abstract operation\n// https://tc39.es/ecma262/#sec-getsubstitution\nmodule.exports = function (matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return replace(replacement, symbols, function (match, ch) {\n var capture;\n switch (charAt(ch, 0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return stringSlice(str, 0, position);\n case \"'\": return stringSlice(str, tailPos);\n case '<':\n capture = namedCaptures[stringSlice(ch, 1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n};\n", "var call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof-raw');\nvar regexpExec = require('../internals/regexp-exec');\n\nvar $TypeError = TypeError;\n\n// `RegExpExec` abstract operation\n// https://tc39.es/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n var exec = R.exec;\n if (isCallable(exec)) {\n var result = call(exec, R, S);\n if (result !== null) anObject(result);\n return result;\n }\n if (classof(R) === 'RegExp') return call(regexpExec, R, S);\n throw $TypeError('RegExp#exec called on incompatible receiver');\n};\n", "var classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.es/ecma262/#sec-isarray\n// eslint-disable-next-line es/no-array-isarray -- safe\nmodule.exports = Array.isArray || function isArray(argument) {\n return classof(argument) == 'Array';\n};\n", "var $TypeError = TypeError;\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991\n\nmodule.exports = function (it) {\n if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');\n return it;\n};\n", "'use strict';\nvar toPropertyKey = require('../internals/to-property-key');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = function (object, key, value) {\n var propertyKey = toPropertyKey(key);\n if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));\n else object[propertyKey] = value;\n};\n", "var uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof');\nvar getBuiltIn = require('../internals/get-built-in');\nvar inspectSource = require('../internals/inspect-source');\n\nvar noop = function () { /* empty */ };\nvar empty = [];\nvar construct = getBuiltIn('Reflect', 'construct');\nvar constructorRegExp = /^\\s*(?:class|function)\\b/;\nvar exec = uncurryThis(constructorRegExp.exec);\nvar INCORRECT_TO_STRING = !constructorRegExp.exec(noop);\n\nvar isConstructorModern = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n try {\n construct(noop, empty, argument);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nvar isConstructorLegacy = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n switch (classof(argument)) {\n case 'AsyncFunction':\n case 'GeneratorFunction':\n case 'AsyncGeneratorFunction': return false;\n }\n try {\n // we can't check .prototype since constructors produced by .bind haven't it\n // `Function#toString` throws on some built-it function in some legacy engines\n // (for example, `DOMQuad` and similar in FF41-)\n return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));\n } catch (error) {\n return true;\n }\n};\n\nisConstructorLegacy.sham = true;\n\n// `IsConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-isconstructor\nmodule.exports = !construct || fails(function () {\n var called;\n return isConstructorModern(isConstructorModern.call)\n || !isConstructorModern(Object)\n || !isConstructorModern(function () { called = true; })\n || called;\n}) ? isConstructorLegacy : isConstructorModern;\n", "var isArray = require('../internals/is-array');\nvar isConstructor = require('../internals/is-constructor');\nvar isObject = require('../internals/is-object');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\nvar $Array = Array;\n\n// a part of `ArraySpeciesCreate` abstract operation\n// https://tc39.es/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? $Array : C;\n};\n", "var arraySpeciesConstructor = require('../internals/array-species-constructor');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.es/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray, length) {\n return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);\n};\n", "var fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return V8_VERSION >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n};\n", "import \"core-js/modules/es.regexp.exec.js\";\nimport \"core-js/modules/es.string.replace.js\";\nimport \"core-js/modules/es.array.concat.js\";\n/* eslint-disable unicorn/filename-case */\nvar protocol = window.location.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n// Add trailing slash to path, if necessary, before appending \"autoreload\"\nvar defaultPath = window.location.pathname.replace(/\\/?$/, \"/\") + \"autoreload/\";\nvar defaultUrl = \"\".concat(protocol, \"//\").concat(window.location.host).concat(defaultPath);\n\n// By default, use the defaultUrl. But if there's a data-ws-url attribute on our\n// \n * ```\n * @nocollapse\n * @category styles\n */\n static styles?: CSSResultGroup;\n\n /**\n * The set of properties defined by this class that caused an accessor to be\n * added during `createProperty`.\n * @nocollapse\n */\n private static __reactivePropertyKeys?: Set;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this.elementProperties.forEach((v, p) => {\n const attr = this.__attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n // if this is a state property, force the attribute to false.\n if (options.state) {\n // Cast as any since this is readonly.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (options as any).attribute = false;\n }\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure finalization has been kicked off.\n this.finalize();\n this.elementProperties.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n if (DEV_MODE) {\n // If this class doesn't have its own set, create one and initialize\n // with the values in the set from the nearest ancestor class, if any.\n if (!this.hasOwnProperty('__reactivePropertyKeys')) {\n this.__reactivePropertyKeys = new Set(\n this.__reactivePropertyKeys ?? []\n );\n }\n this.__reactivePropertyKeys!.add(name);\n }\n }\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n protected static getPropertyDescriptor(\n name: PropertyKey,\n key: string | symbol,\n options: PropertyDeclaration\n ): PropertyDescriptor | undefined {\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: ReactiveElement, value: unknown) {\n const oldValue = (this as {} as {[key: string]: unknown})[\n name as string\n ];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as ReactiveElement).requestUpdate(\n name,\n oldValue,\n options\n );\n },\n configurable: true,\n enumerable: true,\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name: PropertyKey) {\n return this.elementProperties.get(name) || defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties, sets up element\n * styling, and ensures any superclasses are also finalized. Returns true if\n * the element was finalized.\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(finalized)) {\n return false;\n }\n this[finalized] = true;\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this) as typeof ReactiveElement;\n superCtor.finalize();\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n this.elementProperties = new Map(superCtor.elementProperties);\n // initialize Map populated in observedAttributes\n this.__attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...Object.getOwnPropertySymbols(props),\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeScript lack of support for symbol in\n // index types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.createProperty(p, (props as any)[p]);\n }\n }\n this.elementStyles = this.finalizeStyles(this.styles);\n // DEV mode warnings\n if (DEV_MODE) {\n const warnRemovedOrRenamed = (name: string, renamed = false) => {\n if (this.prototype.hasOwnProperty(name)) {\n issueWarning(\n renamed ? 'renamed-api' : 'removed-api',\n `\\`${name}\\` is implemented on class ${this.name}. It ` +\n `has been ${renamed ? 'renamed' : 'removed'} ` +\n `in this version of LitElement.`\n );\n }\n };\n warnRemovedOrRenamed('initialize');\n warnRemovedOrRenamed('requestUpdateInternal');\n warnRemovedOrRenamed('_getUpdateComplete', true);\n }\n return true;\n }\n\n /**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\n static shadowRootOptions: ShadowRootInit = {mode: 'open'};\n\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n protected static finalizeStyles(\n styles?: CSSResultGroup\n ): Array {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set((styles as Array).flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift(getCompatibleStyle(s as CSSResultOrNative));\n }\n } else if (styles !== undefined) {\n elementStyles.push(getCompatibleStyle(styles));\n }\n return elementStyles;\n }\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n * @category rendering\n */\n readonly renderRoot!: HTMLElement | ShadowRoot;\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static __attributeNameForProperty(\n name: PropertyKey,\n options: PropertyDeclaration\n ) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n\n private __instanceProperties?: PropertyValues = new Map();\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private __updatePromise!: Promise;\n\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n isUpdatePending = false;\n\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n hasUpdated = false;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n *\n * @internal\n */\n _$changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private __reflectingProperties?: Map;\n\n /**\n * Name of currently reflecting property\n */\n private __reflectingProperty: PropertyKey | null = null;\n\n /**\n * Set of controllers.\n */\n private __controllers?: ReactiveController[];\n\n constructor() {\n super();\n this._initialize();\n }\n\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n *\n * @internal\n */\n _initialize() {\n this.__updatePromise = new Promise(\n (res) => (this.enableUpdating = res)\n );\n this._$changedProperties = new Map();\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n (this.constructor as typeof ReactiveElement)._initializers?.forEach((i) =>\n i(this)\n );\n }\n\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller: ReactiveController) {\n (this.__controllers ??= []).push(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller: ReactiveController) {\n // Note, if the indexOf is -1, the >>> will flip the sign which makes the\n // splice do nothing.\n this.__controllers?.splice(this.__controllers.indexOf(controller) >>> 0, 1);\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private __saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof ReactiveElement).elementProperties.forEach(\n (_v, p) => {\n if (this.hasOwnProperty(p)) {\n this.__instanceProperties!.set(p, this[p as keyof this]);\n delete this[p as keyof this];\n }\n }\n );\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n protected createRenderRoot(): Element | ShadowRoot {\n const renderRoot =\n this.shadowRoot ??\n this.attachShadow(\n (this.constructor as typeof ReactiveElement).shadowRootOptions\n );\n adoptStyles(\n renderRoot,\n (this.constructor as typeof ReactiveElement).elementStyles\n );\n return renderRoot;\n }\n\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // create renderRoot before first update.\n if (this.renderRoot === undefined) {\n (\n this as {\n renderRoot: Element | DocumentFragment;\n }\n ).renderRoot = this.createRenderRoot();\n }\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n protected enableUpdating(_requestedUpdate: boolean) {}\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(\n name: string,\n _old: string | null,\n value: string | null\n ) {\n this._$attributeToProperty(name, value);\n }\n\n private __propertyToAttribute(\n name: PropertyKey,\n value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration\n ) {\n const attr = (\n this.constructor as typeof ReactiveElement\n ).__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter =\n (options.converter as ComplexAttributeConverter)?.toAttribute !==\n undefined\n ? (options.converter as ComplexAttributeConverter)\n : defaultConverter;\n const attrValue = converter.toAttribute!(value, options.type);\n if (\n DEV_MODE &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.indexOf(\n 'migration'\n ) >= 0 &&\n attrValue === undefined\n ) {\n issueWarning(\n 'undefined-attribute-value',\n `The attribute value for the ${name as string} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`\n );\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /** @internal */\n _$attributeToProperty(name: string, value: string | null) {\n const ctor = this.constructor as typeof ReactiveElement;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = (ctor.__attributeToPropertyMap as AttributeMap).get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter =\n typeof options.converter === 'function'\n ? {fromAttribute: options.converter}\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n this[propName as keyof this] = converter.fromAttribute!(\n value,\n options.type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @category updates\n */\n requestUpdate(\n name?: PropertyKey,\n oldValue?: unknown,\n options?: PropertyDeclaration\n ): void {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n options =\n options ||\n (this.constructor as typeof ReactiveElement).getPropertyOptions(name);\n const hasChanged = options.hasChanged || notEqual;\n if (hasChanged(this[name as keyof this], oldValue)) {\n if (!this._$changedProperties.has(name)) {\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true && this.__reflectingProperty !== name) {\n if (this.__reflectingProperties === undefined) {\n this.__reflectingProperties = new Map();\n }\n this.__reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this.isUpdatePending && shouldRequestUpdate) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n // Note, since this no longer returns a promise, in dev mode we return a\n // thenable which warns if it's called.\n return DEV_MODE\n ? (requestUpdateThenable(this.localName) as unknown as void)\n : undefined;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n } catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n protected scheduleUpdate(): void | Promise {\n return this.performUpdate();\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * Note: To ensure `performUpdate()` synchronously completes a pending update,\n * it should not be overridden. In LitElement 2.x it was suggested to override\n * `performUpdate()` to also customizing update scheduling. Instead, you should now\n * override `scheduleUpdate()`. For backwards compatibility with LitElement 2.x,\n * scheduling updates via `performUpdate()` continues to work, but will make\n * also calling `performUpdate()` to synchronously process updates difficult.\n *\n * @category updates\n */\n protected performUpdate(): void | Promise {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({kind: 'update'});\n // create renderRoot before first update.\n if (!this.hasUpdated) {\n // Produce warning if any class properties are shadowed by class fields\n if (DEV_MODE) {\n const shadowedProperties: string[] = [];\n (\n this.constructor as typeof ReactiveElement\n ).__reactivePropertyKeys?.forEach((p) => {\n if (this.hasOwnProperty(p) && !this.__instanceProperties?.has(p)) {\n shadowedProperties.push(p as string);\n }\n });\n if (shadowedProperties.length) {\n throw new Error(\n `The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`\n );\n }\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.__instanceProperties!.forEach((v, p) => ((this as any)[p] = v));\n this.__instanceProperties = undefined;\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n } else {\n this.__markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n protected willUpdate(_changedProperties: PropertyValues): void {}\n\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties: PropertyValues) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (\n DEV_MODE &&\n this.isUpdatePending &&\n (this.constructor as typeof ReactiveElement).enabledWarnings!.indexOf(\n 'change-in-update'\n ) >= 0\n ) {\n issueWarning(\n 'change-in-update',\n `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`\n );\n }\n }\n\n private __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete(): Promise {\n return this.getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n protected getUpdateComplete(): Promise {\n return this.__updatePromise;\n }\n\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected update(_changedProperties: PropertyValues) {\n if (this.__reflectingProperties !== undefined) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this.__reflectingProperties.forEach((v, k) =>\n this.__propertyToAttribute(k, this[k as keyof this], v)\n );\n this.__reflectingProperties = undefined;\n }\n this.__markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected updated(_changedProperties: PropertyValues) {}\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n protected firstUpdated(_changedProperties: PropertyValues) {}\n}\n\n// Apply polyfills if available\npolyfillSupport?.({ReactiveElement});\n\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = ['change-in-update'];\n const ensureOwnWarnings = function (ctor: typeof ReactiveElement) {\n if (\n !ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))\n ) {\n ctor.enabledWarnings = ctor.enabledWarnings!.slice();\n }\n };\n ReactiveElement.enableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n if (this.enabledWarnings!.indexOf(warning) < 0) {\n this.enabledWarnings!.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (\n this: typeof ReactiveElement,\n warning: WarningKind\n ) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings!.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings!.splice(i, 1);\n }\n };\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('1.6.2');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n issueWarning!(\n 'multiple-versions',\n `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`\n );\n}\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// IMPORTANT: these imports must be type-only\nimport type {Directive, DirectiveResult, PartInfo} from './directive.js';\n\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n// Use window for browser builds because IE11 doesn't have globalThis.\nconst global = NODE_MODE ? globalThis : window;\n\n/**\n * Contains types that are part of the unstable debug API.\n *\n * Everything in this API is not stable and may change or be removed in the future,\n * even on patch releases.\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace LitUnstable {\n /**\n * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true,\n * we will emit 'lit-debug' events to window, with live details about the update and render\n * lifecycle. These can be useful for writing debug tooling and visualizations.\n *\n * Please be aware that running with window.emitLitDebugLogEvents has performance overhead,\n * making certain operations that are normally very cheap (like a no-op render) much slower,\n * because we must copy data and dispatch events.\n */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace DebugLog {\n export type Entry =\n | TemplatePrep\n | TemplateInstantiated\n | TemplateInstantiatedAndUpdated\n | TemplateUpdating\n | BeginRender\n | EndRender\n | CommitPartEntry\n | SetPartValue;\n export interface TemplatePrep {\n kind: 'template prep';\n template: Template;\n strings: TemplateStringsArray;\n clonableTemplate: HTMLTemplateElement;\n parts: TemplatePart[];\n }\n export interface BeginRender {\n kind: 'begin render';\n id: number;\n value: unknown;\n container: HTMLElement | DocumentFragment;\n options: RenderOptions | undefined;\n part: ChildPart | undefined;\n }\n export interface EndRender {\n kind: 'end render';\n id: number;\n value: unknown;\n container: HTMLElement | DocumentFragment;\n options: RenderOptions | undefined;\n part: ChildPart;\n }\n export interface TemplateInstantiated {\n kind: 'template instantiated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array;\n values: unknown[];\n }\n export interface TemplateInstantiatedAndUpdated {\n kind: 'template instantiated and updated';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n fragment: Node;\n parts: Array;\n values: unknown[];\n }\n export interface TemplateUpdating {\n kind: 'template updating';\n template: Template | CompiledTemplate;\n instance: TemplateInstance;\n options: RenderOptions | undefined;\n parts: Array;\n values: unknown[];\n }\n export interface SetPartValue {\n kind: 'set part';\n part: Part;\n value: unknown;\n valueIndex: number;\n values: unknown[];\n templateInstance: TemplateInstance;\n }\n\n export type CommitPartEntry =\n | CommitNothingToChildEntry\n | CommitText\n | CommitNode\n | CommitAttribute\n | CommitProperty\n | CommitBooleanAttribute\n | CommitEventListener\n | CommitToElementBinding;\n\n export interface CommitNothingToChildEntry {\n kind: 'commit nothing to child';\n start: ChildNode;\n end: ChildNode | null;\n parent: Disconnectable | undefined;\n options: RenderOptions | undefined;\n }\n\n export interface CommitText {\n kind: 'commit text';\n node: Text;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitNode {\n kind: 'commit node';\n start: Node;\n parent: Disconnectable | undefined;\n value: Node;\n options: RenderOptions | undefined;\n }\n\n export interface CommitAttribute {\n kind: 'commit attribute';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitProperty {\n kind: 'commit property';\n element: Element;\n name: string;\n value: unknown;\n options: RenderOptions | undefined;\n }\n\n export interface CommitBooleanAttribute {\n kind: 'commit boolean attribute';\n element: Element;\n name: string;\n value: boolean;\n options: RenderOptions | undefined;\n }\n\n export interface CommitEventListener {\n kind: 'commit event listener';\n element: Element;\n name: string;\n value: unknown;\n oldListener: unknown;\n options: RenderOptions | undefined;\n // True if we're removing the old event listener (e.g. because settings changed, or value is nothing)\n removeListener: boolean;\n // True if we're adding a new event listener (e.g. because first render, or settings changed)\n addListener: boolean;\n }\n\n export interface CommitToElementBinding {\n kind: 'commit to element binding';\n element: Element;\n value: unknown;\n options: RenderOptions | undefined;\n }\n }\n}\n\ninterface DebugLoggingWindow {\n // Even in dev mode, we generally don't want to emit these events, as that's\n // another level of cost, so only emit them when DEV_MODE is true _and_ when\n // window.emitLitDebugEvents is true.\n emitLitDebugLogEvents?: boolean;\n}\n\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event: LitUnstable.DebugLog.Entry) => {\n const shouldEmit = (global as unknown as DebugLoggingWindow)\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(\n new CustomEvent('lit-debug', {\n detail: event,\n })\n );\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\n\nlet issueWarning: (code: string, warning: string) => void;\n\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n\n // Issue a warning, if we haven't already.\n issueWarning = (code: string, warning: string) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!global.litIssuedWarnings!.has(warning)) {\n console.warn(warning);\n global.litIssuedWarnings!.add(warning);\n }\n };\n\n issueWarning(\n 'dev-mode',\n `Lit is in dev mode. Not recommended for production!`\n );\n}\n\nconst wrap =\n ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? global.ShadyDOM!.wrap\n : (node: Node) => node;\n\nconst trustedTypes = (global as unknown as Partial).trustedTypes;\n\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\n\n/**\n * Used to sanitize any value before it is written into the DOM. This can be\n * used to implement a security policy of allowed and disallowed values in\n * order to prevent XSS attacks.\n *\n * One way of using this callback would be to check attributes and properties\n * against a list of high risk fields, and require that values written to such\n * fields be instances of a class which is safe by construction. Closure's Safe\n * HTML Types is one implementation of this technique (\n * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md).\n * The TrustedTypes polyfill in API-only mode could also be used as a basis\n * for this technique (https://github.com/WICG/trusted-types).\n *\n * @param node The HTML node (usually either a #text node or an Element) that\n * is being written to. Note that this is just an exemplar node, the write\n * may take place against another instance of the same class of node.\n * @param name The name of an attribute or property (for example, 'href').\n * @param type Indicates whether the write that's about to be performed will\n * be to a property or a node.\n * @return A function that will sanitize this class of writes.\n */\nexport type SanitizerFactory = (\n node: Node,\n name: string,\n type: 'property' | 'attribute'\n) => ValueSanitizer;\n\n/**\n * A function which can sanitize values that will be written to a specific kind\n * of DOM sink.\n *\n * See SanitizerFactory.\n *\n * @param value The value to sanitize. Will be the actual value passed into\n * the lit-html template literal, so this could be of any type.\n * @return The value to write to the DOM. Usually the same as the input value,\n * unless sanitization is needed.\n */\nexport type ValueSanitizer = (value: unknown) => unknown;\n\nconst identityFunction: ValueSanitizer = (value: unknown) => value;\nconst noopSanitizer: SanitizerFactory = (\n _node: Node,\n _name: string,\n _type: 'property' | 'attribute'\n) => identityFunction;\n\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer: SanitizerFactory) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(\n `Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`\n );\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\n\nconst createSanitizer: SanitizerFactory = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${String(Math.random()).slice(9)}$`;\n\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\n\nconst d =\n NODE_MODE && global.document === undefined\n ? ({\n createTreeWalker() {\n return {};\n },\n } as unknown as Document)\n : document;\n\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\ntype Primitive = null | undefined | boolean | number | string | symbol | bigint;\nconst isPrimitive = (value: unknown): value is Primitive =>\n value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value: unknown): value is Iterable =>\n isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof (value as any)?.[Symbol.iterator] === 'function';\n\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\n\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with /g;\n/**\n * Comments not started with /g,Le=/>/g,C=RegExp(`>|${pe}(?:([^\\s"'>=/]+)(${pe}*=${pe}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),Me=/'/g,xe=/"/g,Ue=/^(?:script|style|textarea|title)$/i,Ne=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),G=Ne(1),jt=Ne(2),w=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Pe=new WeakMap,S=T.createTreeWalker(T,129,null,!1);function ze(n,e){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Oe!==void 0?Oe.createHTML(e):e}var Ye=(n,e)=>{let t=n.length-1,i=[],s,r=e===2?"":"",o=U;for(let h=0;h"?(o=s!=null?s:U,d=-1):p[1]===void 0?d=-2:(d=o.lastIndex-p[2].length,a=p[1],o=p[3]===void 0?C:p[3]==='"'?xe:Me):o===xe||o===Me?o=C:o===He||o===Le?o=U:(o=C,s=void 0);let v=o===C&&n[h+1].startsWith("/>")?" ":"";r+=o===U?l+Ze:d>=0?(i.push(a),l.slice(0,d)+de+l.slice(d)+b+v):l+b+(d===-2?(i.push(void 0),h):v)}return[ze(n,r+(n[t]||"")+(e===2?"":"")),i]},O=class{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,o=0,h=e.length-1,l=this.parts,[a,p]=Ye(e,t);if(this.el=O.createElement(a,i),S.currentNode=this.el.content,t===2){let d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(s=S.nextNode())!==null&&l.length0){s.textContent=M?M.emptyScript:"";for(let v=0;v2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=c}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,s){let r=this.strings,o=!1;if(r===void 0)e=x(this,e,t,0),o=!z(e)||e!==this._$AH&&e!==w,o&&(this._$AH=e);else{let h=e,l,a;for(e=r[0],l=0;l{var i,s;let r=(i=t==null?void 0:t.renderBefore)!==null&&i!==void 0?i:e,o=r._$litPart$;if(o===void 0){let h=(s=t==null?void 0:t.renderBefore)!==null&&s!==void 0?s:null;r._$litPart$=o=new H(e.insertBefore(N(),h),h,void 0,t!=null?t:{})}return o._$AI(n),o};var fe,ye;var E=class extends m{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=D(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return w}};E.finalized=!0,E._$litElement$=!0,(fe=globalThis.litElementHydrateSupport)===null||fe===void 0||fe.call(globalThis,{LitElement:E});var De=globalThis.litElementPolyfillSupport;De==null||De({LitElement:E});((ye=globalThis.litElementVersions)!==null&&ye!==void 0?ye:globalThis.litElementVersions=[]).push("3.3.2");var _=class extends E{connectedCallback(){this.maybeCarryFill(),super.connectedCallback()}render(){return G``}maybeCarryFill(){this.isFillCarrier?(this.classList.add("html-fill-container"),this.classList.add("html-fill-item")):(this.classList.remove("html-fill-container"),this.classList.remove("html-fill-item"))}get isFillCarrier(){if(!this.parentElement)return!1;let e=this.parentElement.classList.contains("html-fill-container"),t=Array.from(this.children).some(i=>i.classList.contains("html-fill-item"));return e&&t}};_.isShinyInput=!1,_.styles=se` - :host { - display: contents; - } - `;function Q(n){let e=n.querySelector(":scope > [data-bs-toggle='tooltip']");if(e)return e;let t=n.querySelector(":scope > [data-bs-toggle='popover']");if(t)return t;if(n.children.length>1)return n.children[n.children.length-1];if(n.childNodes.length>1){let i=document.createElement("span");return i.append(n.childNodes[n.childNodes.length-1]),n.appendChild(i),i}return n}function Z(n){var h;let{instance:e,trigger:t,content:i,type:s}=n,{tip:r}=e;if(!(r&&r.offsetParent!==null)){e.setContent(i);return}for(let[l,a]of Object.entries(i)){let p=r.querySelector(l);if(!p&&l===".popover-header"){let d=document.createElement("div");d.classList.add("popover-header"),(h=r.querySelector(".popover-body"))==null||h.before(d),p=d}if(!p){console.warn(`Could not find ${l} in ${s} content`);continue}p instanceof HTMLElement?p.replaceChildren(a):p.innerHTML=a}e.update(),t.addEventListener(`hidden.bs.${s}`,()=>e.setContent(i),{once:!0})}function q(n,e){let t=document.createElement("div");return t.style.display=e,n instanceof DocumentFragment?t.append(n):t.innerHTML=n,t}var k=class{constructor(){this.resizeObserverEntries=[],this.resizeObserver=new ResizeObserver(e=>{let t=new Event("resize");if(window.dispatchEvent(t),!window.Shiny)return;let i=[];for(let s of e)s.target instanceof HTMLElement&&s.target.querySelector(".shiny-bound-output")&&s.target.querySelectorAll(".shiny-bound-output").forEach(r=>{if(i.includes(r))return;let{binding:o,onResize:h}=$(r).data("shinyOutputBinding");if(!o||!o.resize)return;let l=r.shinyResizeObserver;if(l&&l!==this||(l||(r.shinyResizeObserver=this),h(r),i.push(r),!r.classList.contains("shiny-plot-output")))return;let a=r.querySelector('img:not([width="100%"])');a&&a.setAttribute("width","100%")})})}observe(e){this.resizeObserver.observe(e),this.resizeObserverEntries.push(e)}unobserve(e){let t=this.resizeObserverEntries.indexOf(e);t<0||(this.resizeObserver.unobserve(e),this.resizeObserverEntries.splice(t,1))}flush(){this.resizeObserverEntries.forEach(e=>{document.body.contains(e)||this.unobserve(e)})}};var tt=window.bootstrap?window.bootstrap.Tooltip:class{},X=class extends _{constructor(){super();this.placement="auto";this.bsOptions="{}";this.visible=!1;this.onChangeCallback=t=>{};this._onShown=this._onShown.bind(this),this._onInsert=this._onInsert.bind(this),this._onHidden=this._onHidden.bind(this)}get options(){let t=JSON.parse(this.bsOptions);return y({title:this.content,placement:this.placement,html:!0,sanitize:!1},t)}get content(){return this.children[0]}get triggerElement(){return Q(this)}get visibleTrigger(){let t=this.triggerElement;return t&&t.offsetParent!==null}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.prepend(q(t.content,"none")),t.remove();let i=this.triggerElement;i.setAttribute("data-bs-toggle","tooltip"),i.setAttribute("tabindex","0"),this.bsTooltip=new tt(i,this.options),i.addEventListener("shown.bs.tooltip",this._onShown),i.addEventListener("hidden.bs.tooltip",this._onHidden),i.addEventListener("inserted.bs.tooltip",this._onInsert),this.visibilityObserver=this._createVisibilityObserver()}disconnectedCallback(){let t=this.triggerElement;t.removeEventListener("shown.bs.tooltip",this._onShown),t.removeEventListener("hidden.bs.tooltip",this._onHidden),t.removeEventListener("inserted.bs.tooltip",this._onInsert),this.visibilityObserver.disconnect(),this.bsTooltip.dispose(),super.disconnectedCallback()}getValue(){return this.visible}_onShown(){this.visible=!0,this.onChangeCallback(!0),this.visibilityObserver.observe(this.triggerElement)}_onHidden(){this.visible=!1,this.onChangeCallback(!0),this._restoreContent(),this.visibilityObserver.unobserve(this.triggerElement),X.shinyResizeObserver.flush()}_onInsert(){var s;let{tip:t}=this.bsTooltip;if(!t)return;X.shinyResizeObserver.observe(t);let i=(s=t.querySelector(".tooltip-inner"))==null?void 0:s.firstChild;i instanceof HTMLElement&&(i.style.display="contents")}_restoreContent(){var s;let{tip:t}=this.bsTooltip;if(!t)throw new Error("Failed to find the popover's DOM element. Please report this bug.");let i=(s=t.querySelector(".tooltip-inner"))==null?void 0:s.firstChild;i instanceof HTMLElement&&(i.style.display="none",this.prepend(i))}receiveMessage(t,i){let s=i.method;if(s==="toggle")this._toggle(i.value);else if(s==="update")this._updateTitle(i.title);else throw new Error(`Unknown method ${s}`)}_toggle(t){(t==="toggle"||t===void 0)&&(t=this.visible?"hide":"show"),t==="hide"&&this.bsTooltip.hide(),t==="show"&&this._show()}_show(){!this.visible&&this.visibleTrigger&&this.bsTooltip.show()}_updateTitle(t){t&&(Shiny.renderDependencies(t.deps),Z({instance:this.bsTooltip,trigger:this.triggerElement,content:{".tooltip-inner":t.html},type:"tooltip"}))}_createVisibilityObserver(){let t=i=>{this.visible&&i.forEach(s=>{s.isIntersecting||this.bsTooltip.hide()})};return new IntersectionObserver(t)}},g=X;g.tagName="bslib-tooltip",g.shinyResizeObserver=new k,g.isShinyInput=!0,L([A({type:String})],g.prototype,"placement",2),L([A({type:String})],g.prototype,"bsOptions",2);var it=window.bootstrap?window.bootstrap.Popover:class{},Y=class extends _{constructor(){super();this.placement="auto";this.bsOptions="{}";this.visible=!1;this.onChangeCallback=t=>{};this._onShown=this._onShown.bind(this),this._onInsert=this._onInsert.bind(this),this._onHidden=this._onHidden.bind(this),this._handleTabKey=this._handleTabKey.bind(this),this._handleEscapeKey=this._handleEscapeKey.bind(this),this._closeButton=this._closeButton.bind(this)}get options(){let t=JSON.parse(this.bsOptions);return y({content:this.content,title:be(this.header)?this.header:"",placement:this.placement,html:!0,sanitize:!1,trigger:this.isHyperLink?"focus hover":"click"},t)}get content(){return this.contentContainer.children[0]}get header(){return this.contentContainer.children[1]}get contentContainer(){return this.children[0]}get triggerElement(){return Q(this)}get visibleTrigger(){let t=this.triggerElement;return t&&t.offsetParent!==null}get isButtonLike(){return this.options.trigger==="click"&&this.triggerElement.tagName!=="BUTTON"}get focusablePopover(){return!this.options.trigger.includes("focus")}get isHyperLink(){let t=this.triggerElement;return t.tagName==="A"&&t.hasAttribute("href")&&t.getAttribute("href")!=="#"&&t.getAttribute("href")!==""&&t.getAttribute("href")!=="javascript:void(0)"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.prepend(q(t.content,"none")),t.remove(),this.content&&D(this._closeButton(this.header),this.content);let i=this.triggerElement;i.setAttribute("data-bs-toggle","popover"),this.isButtonLike&&(i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-pressed","false"),this.triggerElement.tagName!=="A"&&(i.onkeydown=s=>{(s.key==="Enter"||s.key===" ")&&this._toggle()}),i.style.cursor="pointer"),this.bsPopover=new it(i,this.options),i.addEventListener("shown.bs.popover",this._onShown),i.addEventListener("hidden.bs.popover",this._onHidden),i.addEventListener("inserted.bs.popover",this._onInsert),this.visibilityObserver=this._createVisibilityObserver()}disconnectedCallback(){let t=this.triggerElement;t.removeEventListener("shown.bs.popover",this._onShown),t.removeEventListener("hidden.bs.popover",this._onHidden),t.removeEventListener("inserted.bs.popover",this._onInsert),this.visibilityObserver.disconnect(),this.bsPopover.dispose(),super.disconnectedCallback()}getValue(){return this.visible}_onShown(){this.visible=!0,this.onChangeCallback(!0),this.visibilityObserver.observe(this.triggerElement),this.focusablePopover&&(document.addEventListener("keydown",this._handleTabKey),document.addEventListener("keydown",this._handleEscapeKey)),this.isButtonLike&&this.triggerElement.setAttribute("aria-pressed","true")}_onHidden(){this.visible=!1,this.onChangeCallback(!0),this._restoreContent(),this.visibilityObserver.unobserve(this.triggerElement),Y.shinyResizeObserver.flush(),this.focusablePopover&&(document.removeEventListener("keydown",this._handleTabKey),document.removeEventListener("keydown",this._handleEscapeKey)),this.isButtonLike&&this.triggerElement.setAttribute("aria-pressed","false")}_onInsert(){let{tip:t}=this.bsPopover;t&&(Y.shinyResizeObserver.observe(t),this.focusablePopover&&t.setAttribute("tabindex","0"))}_handleTabKey(t){if(t.key!=="Tab")return;let{tip:i}=this.bsPopover;if(!i)return;let s=()=>{t.preventDefault(),t.stopImmediatePropagation()},r=document.activeElement;r===this.triggerElement&&!t.shiftKey&&(s(),i.focus()),r===i&&t.shiftKey&&(s(),this.triggerElement.focus())}_handleEscapeKey(t){if(t.key!=="Escape")return;let{tip:i}=this.bsPopover;if(!i)return;let s=document.activeElement;(s===this.triggerElement||i.contains(s))&&(t.preventDefault(),t.stopImmediatePropagation(),this._hide(),this.triggerElement.focus())}_restoreContent(){let{tip:t}=this.bsPopover;if(!t)throw new Error("Failed to find the popover's DOM element. Please report this bug.");let i=t.querySelector(".popover-body");i&&this.contentContainer.append(i==null?void 0:i.firstChild);let s=t.querySelector(".popover-header");s&&this.contentContainer.append(s==null?void 0:s.firstChild)}receiveMessage(t,i){let s=i.method;if(s==="toggle")this._toggle(i.value);else if(s==="update")this._updatePopover(i);else throw new Error(`Unknown method ${s}`)}_toggle(t){(t==="toggle"||t===void 0)&&(t=this.visible?"hide":"show"),t==="hide"&&this._hide(),t==="show"&&this._show()}_hide(){this.bsPopover.hide()}_show(){!this.visible&&this.visibleTrigger&&this.bsPopover.show()}_updatePopover(t){let{content:i,header:s}=t,r=[];i&&r.push(...i.deps),s&&r.push(...s.deps),Shiny.renderDependencies(r);let o=(a,p,d)=>{var u;return a?q(a.html,"contents"):p||((u=this.bsPopover.tip)==null?void 0:u.querySelector(d))},h=o(s,this.header,".popover-header"),l=o(i,this.content,".popover-body");D(this._closeButton(h),l),Z({instance:this.bsPopover,trigger:this.triggerElement,content:{".popover-header":be(h)?h:"",".popover-body":l},type:"popover"})}_closeButton(t){if(!this.focusablePopover)return c;let i=()=>{this._hide(),this.focusablePopover&&this.triggerElement.focus()},s=be(t)?"0.6rem":"0.25rem";return G``}_createVisibilityObserver(){let t=i=>{this.visible&&i.forEach(s=>{s.isIntersecting||this._hide()})};return new IntersectionObserver(t)}},f=Y;f.tagName="bslib-popover",f.shinyResizeObserver=new k,f.isShinyInput=!0,L([A({type:String})],f.prototype,"placement",2),L([A({type:String})],f.prototype,"bsOptions",2);function be(n){return!!n&&n.childNodes.length>0}function qe(n,{type:e=null}={}){if(!window.Shiny)return;class t extends Shiny.InputBinding{constructor(){super()}find(s){return $(s).find(n)}getValue(s){return"getValue"in s?s.getValue():s.value}getType(s){return e}subscribe(s,r){s.onChangeCallback=r}unsubscribe(s){s.onChangeCallback=r=>{}}receiveMessage(s,r){s.receiveMessage(s,r)}}Shiny.inputBindings.register(new t,`${n}-Binding`)}[g,f].forEach(n=>{customElements.define(n.tagName,n),n.isShinyInput&&qe(n.tagName)});})(); -/*! Bundled license information: - -@lit/reactive-element/decorators/custom-element.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/property.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/state.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/base.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/event-options.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/query.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/query-all.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/query-async.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/query-assigned-elements.js: - (** - * @license - * Copyright 2021 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/decorators/query-assigned-nodes.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/css-tag.js: - (** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -@lit/reactive-element/reactive-element.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -lit-html/lit-html.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -lit-element/lit-element.js: - (** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) - -lit-html/is-server.js: - (** - * @license - * Copyright 2022 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - *) -*/ -//# sourceMappingURL=webComponents.min.js.map diff --git a/shiny/www/shared/datepicker/css/bootstrap-datepicker3.css b/shiny/www/shared/datepicker/css/bootstrap-datepicker3.css deleted file mode 100644 index 06fe4a802..000000000 --- a/shiny/www/shared/datepicker/css/bootstrap-datepicker3.css +++ /dev/null @@ -1,533 +0,0 @@ -.datepicker { - border-radius: 0.25rem; - direction: ltr; -} - -.datepicker-inline { - width: 220px; -} - -.datepicker-rtl { - direction: rtl; -} - -.datepicker-rtl.dropdown-menu { - left: auto; -} - -.datepicker-rtl table tr td span { - float: right; -} - -.datepicker-dropdown { - top: 0; - left: 0; - padding: 4px; -} - -.datepicker-dropdown:before { - content: ''; - display: inline-block; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-bottom: 7px solid rgba(0, 0, 0, 0.15); - border-top: 0; - border-bottom-color: rgba(0, 0, 0, 0.2); - position: absolute; -} - -.datepicker-dropdown:after { - content: ''; - display: inline-block; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-top: 0; - position: absolute; -} - -.datepicker-dropdown.datepicker-orient-left:before { - left: 6px; -} - -.datepicker-dropdown.datepicker-orient-left:after { - left: 7px; -} - -.datepicker-dropdown.datepicker-orient-right:before { - right: 6px; -} - -.datepicker-dropdown.datepicker-orient-right:after { - right: 7px; -} - -.datepicker-dropdown.datepicker-orient-bottom:before { - top: -7px; -} - -.datepicker-dropdown.datepicker-orient-bottom:after { - top: -6px; -} - -.datepicker-dropdown.datepicker-orient-top:before { - bottom: -7px; - border-bottom: 0; - border-top: 7px solid rgba(0, 0, 0, 0.15); -} - -.datepicker-dropdown.datepicker-orient-top:after { - bottom: -6px; - border-bottom: 0; - border-top: 6px solid #fff; -} - -.datepicker table { - margin: 0; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.datepicker table tr td, .datepicker table tr th { - text-align: center; - width: 30px; - height: 30px; - border-radius: 4px; - border: none; -} - -.table-striped .datepicker table tr td, .table-striped .datepicker table tr th { - background-color: transparent; -} - -.datepicker table tr td.old, .datepicker table tr td.new { - color: #6c757d; -} - -.datepicker table tr td.day:hover, .datepicker table tr td.focused { - color: #000; - background: #e9e9ea; - cursor: pointer; -} - -.datepicker table tr td.disabled, .datepicker table tr td.disabled:hover { - background: none; - color: #6c757d; - cursor: default; -} - -.datepicker table tr td.highlighted { - color: #000; - background-color: #d1ecf1; - border-color: #83ccd9; - border-radius: 0; -} - -.datepicker table tr td.highlighted:focus, .datepicker table tr td.highlighted.focus { - color: #000; - background-color: #bcd4d9; - border-color: #6299a3; -} - -.datepicker table tr td.highlighted:hover { - color: #000; - background-color: #697679; - border-color: #73b3bf; -} - -.datepicker table tr td.highlighted:active, .datepicker table tr td.highlighted.active { - color: #000; - background-color: #bcd4d9; - border-color: #73b3bf; -} - -.datepicker table tr td.highlighted:active:hover, .datepicker table tr td.highlighted:active:focus, .datepicker table tr td.highlighted.focus:active, .datepicker table tr td.highlighted.active:hover, .datepicker table tr td.highlighted.active:focus, .datepicker table tr td.highlighted.active.focus { - color: #000; - background-color: #adc4c8; - border-color: #6299a3; -} - -.datepicker table tr td.highlighted.disabled:hover, .datepicker table tr td.highlighted.disabled:focus, .datepicker table tr td.highlighted.disabled.focus, .datepicker table tr td.highlighted[disabled]:hover, .datepicker table tr td.highlighted[disabled]:focus, .datepicker table tr td.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.highlighted:hover, fieldset[disabled] .datepicker table tr td.highlighted:focus, fieldset[disabled] .datepicker table tr td.highlighted.focus { - background-color: #d1ecf1; - border-color: #83ccd9; -} - -.datepicker table tr td.highlighted.focused { - background: #aadce5; -} - -.datepicker table tr td.highlighted.disabled, .datepicker table tr td.highlighted.disabled:active { - background: #d1ecf1; - color: #6c757d; -} - -.datepicker table tr td.today { - color: #000; - background-color: #ffdb99; - border-color: #ffb733; -} - -.datepicker table tr td.today:focus, .datepicker table tr td.today.focus { - color: #000; - background-color: #e6c58a; - border-color: #bf8926; -} - -.datepicker table tr td.today:hover { - color: #000; - background-color: #806e4d; - border-color: #e0a12d; -} - -.datepicker table tr td.today:active, .datepicker table tr td.today.active { - color: #000; - background-color: #e6c58a; - border-color: #e0a12d; -} - -.datepicker table tr td.today:active:hover, .datepicker table tr td.today:active:focus, .datepicker table tr td.today.focus:active, .datepicker table tr td.today.active:hover, .datepicker table tr td.today.active:focus, .datepicker table tr td.today.active.focus { - color: #000; - background-color: #d4b67f; - border-color: #bf8926; -} - -.datepicker table tr td.today.disabled:hover, .datepicker table tr td.today.disabled:focus, .datepicker table tr td.today.disabled.focus, .datepicker table tr td.today[disabled]:hover, .datepicker table tr td.today[disabled]:focus, .datepicker table tr td.today.focus[disabled], fieldset[disabled] .datepicker table tr td.today:hover, fieldset[disabled] .datepicker table tr td.today:focus, fieldset[disabled] .datepicker table tr td.today.focus { - background-color: #ffdb99; - border-color: #ffb733; -} - -.datepicker table tr td.today.focused { - background: #ffc966; -} - -.datepicker table tr td.today.disabled, .datepicker table tr td.today.disabled:active { - background: #ffdb99; - color: #6c757d; -} - -.datepicker table tr td.range { - color: #000; - background-color: #e9e9ea; - border-color: #b5b5b8; - border-radius: 0; -} - -.datepicker table tr td.range:focus, .datepicker table tr td.range.focus { - color: #000; - background-color: #d2d2d3; - border-color: #88888a; -} - -.datepicker table tr td.range:hover { - color: #000; - background-color: #757575; - border-color: #9f9fa2; -} - -.datepicker table tr td.range:active, .datepicker table tr td.range.active { - color: #000; - background-color: #d2d2d3; - border-color: #9f9fa2; -} - -.datepicker table tr td.range:active:hover, .datepicker table tr td.range:active:focus, .datepicker table tr td.range.focus:active, .datepicker table tr td.range.active:hover, .datepicker table tr td.range.active:focus, .datepicker table tr td.range.active.focus { - color: #000; - background-color: #c1c1c2; - border-color: #88888a; -} - -.datepicker table tr td.range.disabled:hover, .datepicker table tr td.range.disabled:focus, .datepicker table tr td.range.disabled.focus, .datepicker table tr td.range[disabled]:hover, .datepicker table tr td.range[disabled]:focus, .datepicker table tr td.range.focus[disabled], fieldset[disabled] .datepicker table tr td.range:hover, fieldset[disabled] .datepicker table tr td.range:focus, fieldset[disabled] .datepicker table tr td.range.focus { - background-color: #e9e9ea; - border-color: #b5b5b8; -} - -.datepicker table tr td.range.focused { - background: #cfcfd1; -} - -.datepicker table tr td.range.disabled, .datepicker table tr td.range.disabled:active { - background: #e9e9ea; - color: #6c757d; -} - -.datepicker table tr td.range.highlighted { - color: #000; - background-color: #ddebee; - border-color: #99c3cc; -} - -.datepicker table tr td.range.highlighted:focus, .datepicker table tr td.range.highlighted.focus { - color: #000; - background-color: #c7d4d6; - border-color: #739299; -} - -.datepicker table tr td.range.highlighted:hover { - color: #000; - background-color: #6f7677; - border-color: #87acb4; -} - -.datepicker table tr td.range.highlighted:active, .datepicker table tr td.range.highlighted.active { - color: #000; - background-color: #c7d4d6; - border-color: #87acb4; -} - -.datepicker table tr td.range.highlighted:active:hover, .datepicker table tr td.range.highlighted:active:focus, .datepicker table tr td.range.highlighted.focus:active, .datepicker table tr td.range.highlighted.active:hover, .datepicker table tr td.range.highlighted.active:focus, .datepicker table tr td.range.highlighted.active.focus { - color: #000; - background-color: #b7c3c6; - border-color: #739299; -} - -.datepicker table tr td.range.highlighted.disabled:hover, .datepicker table tr td.range.highlighted.disabled:focus, .datepicker table tr td.range.highlighted.disabled.focus, .datepicker table tr td.range.highlighted[disabled]:hover, .datepicker table tr td.range.highlighted[disabled]:focus, .datepicker table tr td.range.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.range.highlighted:hover, fieldset[disabled] .datepicker table tr td.range.highlighted:focus, fieldset[disabled] .datepicker table tr td.range.highlighted.focus { - background-color: #ddebee; - border-color: #99c3cc; -} - -.datepicker table tr td.range.highlighted.focused { - background: #bbd7dd; -} - -.datepicker table tr td.range.highlighted.disabled, .datepicker table tr td.range.highlighted.disabled:active { - background: #ddebee; - color: #6c757d; -} - -.datepicker table tr td.range.today { - color: #000; - background-color: #f4c775; - border-color: #eca117; -} - -.datepicker table tr td.range.today:focus, .datepicker table tr td.range.today.focus { - color: #000; - background-color: #dcb369; - border-color: #b17811; -} - -.datepicker table tr td.range.today:hover { - color: #000; - background-color: #7a643b; - border-color: #d08d14; -} - -.datepicker table tr td.range.today:active, .datepicker table tr td.range.today.active { - color: #000; - background-color: #dcb369; - border-color: #d08d14; -} - -.datepicker table tr td.range.today:active:hover, .datepicker table tr td.range.today:active:focus, .datepicker table tr td.range.today.focus:active, .datepicker table tr td.range.today.active:hover, .datepicker table tr td.range.today.active:focus, .datepicker table tr td.range.today.active.focus { - color: #000; - background-color: #cba561; - border-color: #b17811; -} - -.datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today.disabled:focus, .datepicker table tr td.range.today.disabled.focus, .datepicker table tr td.range.today[disabled]:hover, .datepicker table tr td.range.today[disabled]:focus, .datepicker table tr td.range.today.focus[disabled], fieldset[disabled] .datepicker table tr td.range.today:hover, fieldset[disabled] .datepicker table tr td.range.today:focus, fieldset[disabled] .datepicker table tr td.range.today.focus { - background-color: #f4c775; - border-color: #eca117; -} - -.datepicker table tr td.range.today.disabled, .datepicker table tr td.range.today.disabled:active { - background: #f4c775; - color: #6c757d; -} - -.datepicker table tr td.selected, .datepicker table tr td.selected.highlighted { - color: #fff; - background-color: #898b8d; - border-color: #6b6e71; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} - -.datepicker table tr td.selected:focus, .datepicker table tr td.selected.focus, .datepicker table tr td.selected.highlighted:focus, .datepicker table tr td.selected.highlighted.focus { - color: #fff; - background-color: #959798; - border-color: #909295; -} - -.datepicker table tr td.selected:hover, .datepicker table tr td.selected.highlighted:hover { - color: #fff; - background-color: #c4c5c6; - border-color: #7d7f82; -} - -.datepicker table tr td.selected:active, .datepicker table tr td.selected.active, .datepicker table tr td.selected.highlighted:active, .datepicker table tr td.selected.highlighted.active { - color: #fff; - background-color: #959798; - border-color: #7d7f82; -} - -.datepicker table tr td.selected:active:hover, .datepicker table tr td.selected:active:focus, .datepicker table tr td.selected.focus:active, .datepicker table tr td.selected.active:hover, .datepicker table tr td.selected.active:focus, .datepicker table tr td.selected.active.focus, .datepicker table tr td.selected.highlighted:active:hover, .datepicker table tr td.selected.highlighted:active:focus, .datepicker table tr td.selected.highlighted.focus:active, .datepicker table tr td.selected.highlighted.active:hover, .datepicker table tr td.selected.highlighted.active:focus, .datepicker table tr td.selected.highlighted.active.focus { - color: #fff; - background-color: #9d9fa0; - border-color: #909295; -} - -.datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected.disabled:focus, .datepicker table tr td.selected.disabled.focus, .datepicker table tr td.selected[disabled]:hover, .datepicker table tr td.selected[disabled]:focus, .datepicker table tr td.selected.focus[disabled], fieldset[disabled] .datepicker table tr td.selected:hover, fieldset[disabled] .datepicker table tr td.selected:focus, fieldset[disabled] .datepicker table tr td.selected.focus, .datepicker table tr td.selected.highlighted.disabled:hover, .datepicker table tr td.selected.highlighted.disabled:focus, .datepicker table tr td.selected.highlighted.disabled.focus, .datepicker table tr td.selected.highlighted[disabled]:hover, .datepicker table tr td.selected.highlighted[disabled]:focus, .datepicker table tr td.selected.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.selected.highlighted:hover, fieldset[disabled] .datepicker table tr td.selected.highlighted:focus, fieldset[disabled] .datepicker table tr td.selected.highlighted.focus { - background-color: #898b8d; - border-color: #6b6e71; -} - -.datepicker table tr td.active, .datepicker table tr td.active.highlighted { - color: #fff; - background-color: #007bff; - border-color: #0277f4; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} - -.datepicker table tr td.active:focus, .datepicker table tr td.active.focus, .datepicker table tr td.active.highlighted:focus, .datepicker table tr td.active.highlighted.focus { - color: #fff; - background-color: #1a88ff; - border-color: #4199f7; -} - -.datepicker table tr td.active:hover, .datepicker table tr td.active.highlighted:hover { - color: #fff; - background-color: #80bdff; - border-color: #2087f5; -} - -.datepicker table tr td.active:active, .datepicker table tr td.active.active, .datepicker table tr td.active.highlighted:active, .datepicker table tr td.active.highlighted.active { - color: #fff; - background-color: #1a88ff; - border-color: #2087f5; -} - -.datepicker table tr td.active:active:hover, .datepicker table tr td.active:active:focus, .datepicker table tr td.active.focus:active, .datepicker table tr td.active.active:hover, .datepicker table tr td.active.active:focus, .datepicker table tr td.active.active.focus, .datepicker table tr td.active.highlighted:active:hover, .datepicker table tr td.active.highlighted:active:focus, .datepicker table tr td.active.highlighted.focus:active, .datepicker table tr td.active.highlighted.active:hover, .datepicker table tr td.active.highlighted.active:focus, .datepicker table tr td.active.highlighted.active.focus { - color: #fff; - background-color: #2b91ff; - border-color: #4199f7; -} - -.datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:focus, .datepicker table tr td.active.disabled.focus, .datepicker table tr td.active[disabled]:hover, .datepicker table tr td.active[disabled]:focus, .datepicker table tr td.active.focus[disabled], fieldset[disabled] .datepicker table tr td.active:hover, fieldset[disabled] .datepicker table tr td.active:focus, fieldset[disabled] .datepicker table tr td.active.focus, .datepicker table tr td.active.highlighted.disabled:hover, .datepicker table tr td.active.highlighted.disabled:focus, .datepicker table tr td.active.highlighted.disabled.focus, .datepicker table tr td.active.highlighted[disabled]:hover, .datepicker table tr td.active.highlighted[disabled]:focus, .datepicker table tr td.active.highlighted.focus[disabled], fieldset[disabled] .datepicker table tr td.active.highlighted:hover, fieldset[disabled] .datepicker table tr td.active.highlighted:focus, fieldset[disabled] .datepicker table tr td.active.highlighted.focus { - background-color: #007bff; - border-color: #0277f4; -} - -.datepicker table tr td span { - display: block; - width: 23%; - height: 54px; - line-height: 54px; - float: left; - margin: 1%; - cursor: pointer; - border-radius: 4px; -} - -.datepicker table tr td span:hover, .datepicker table tr td span.focused { - color: #000; - background: #e9e9ea; -} - -.datepicker table tr td span.disabled, .datepicker table tr td span.disabled:hover { - background: none; - color: #6c757d; - cursor: default; -} - -.datepicker table tr td span.active, .datepicker table tr td span.active:hover, .datepicker table tr td span.active.disabled, .datepicker table tr td span.active.disabled:hover { - color: #fff; - background-color: #007bff; - border-color: #0277f4; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} - -.datepicker table tr td span.active:focus, .datepicker table tr td span.active.focus, .datepicker table tr td span.active:hover:focus, .datepicker table tr td span.active.focus:hover, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active.disabled.focus:hover { - color: #fff; - background-color: #1a88ff; - border-color: #4199f7; -} - -.datepicker table tr td span.active:hover, .datepicker table tr td span.active:hover:hover, .datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:hover:hover { - color: #fff; - background-color: #80bdff; - border-color: #2087f5; -} - -.datepicker table tr td span.active:active, .datepicker table tr td span.active.active, .datepicker table tr td span.active:hover:active, .datepicker table tr td span.active.active:hover, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.disabled.active:hover { - color: #fff; - background-color: #1a88ff; - border-color: #2087f5; -} - -.datepicker table tr td span.active:active:hover, .datepicker table tr td span.active:active:focus, .datepicker table tr td span.active.focus:active, .datepicker table tr td span.active.active:hover, .datepicker table tr td span.active.active:focus, .datepicker table tr td span.active.active.focus, .datepicker table tr td span.active:hover:active:hover, .datepicker table tr td span.active:hover:active:focus, .datepicker table tr td span.active.focus:hover:active, .datepicker table tr td span.active.active:hover:hover, .datepicker table tr td span.active.active:hover:focus, .datepicker table tr td span.active.active.focus:hover, .datepicker table tr td span.active.disabled:active:hover, .datepicker table tr td span.active.disabled:active:focus, .datepicker table tr td span.active.disabled.focus:active, .datepicker table tr td span.active.disabled.active:hover, .datepicker table tr td span.active.disabled.active:focus, .datepicker table tr td span.active.disabled.active.focus, .datepicker table tr td span.active.disabled:hover:active:hover, .datepicker table tr td span.active.disabled:hover:active:focus, .datepicker table tr td span.active.disabled.focus:hover:active, .datepicker table tr td span.active.disabled.active:hover:hover, .datepicker table tr td span.active.disabled.active:hover:focus, .datepicker table tr td span.active.disabled.active.focus:hover { - color: #fff; - background-color: #2b91ff; - border-color: #4199f7; -} - -.datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active[disabled]:hover, .datepicker table tr td span.active[disabled]:focus, .datepicker table tr td span.active.focus[disabled], fieldset[disabled] .datepicker table tr td span.active:hover, fieldset[disabled] .datepicker table tr td span.active:focus, fieldset[disabled] .datepicker table tr td span.active.focus, .datepicker table tr td span.active.disabled:hover:hover, .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active.disabled.focus:hover, .datepicker table tr td span.active[disabled]:hover:hover, .datepicker table tr td span.active[disabled]:hover:focus, .datepicker table tr td span.active.focus[disabled]:hover, fieldset[disabled] .datepicker table tr td span.active:hover:hover, fieldset[disabled] .datepicker table tr td span.active:hover:focus, fieldset[disabled] .datepicker table tr td span.active.focus:hover, .datepicker table tr td span.active.disabled.disabled:hover, .datepicker table tr td span.active.disabled.disabled:focus, .datepicker table tr td span.active.disabled.disabled.focus, .datepicker table tr td span.active.disabled[disabled]:hover, .datepicker table tr td span.active.disabled[disabled]:focus, .datepicker table tr td span.active.disabled.focus[disabled], fieldset[disabled] .datepicker table tr td span.active.disabled:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:focus, fieldset[disabled] .datepicker table tr td span.active.disabled.focus, .datepicker table tr td span.active.disabled.disabled:hover:hover, .datepicker table tr td span.active.disabled.disabled:hover:focus, .datepicker table tr td span.active.disabled.disabled.focus:hover, .datepicker table tr td span.active.disabled[disabled]:hover:hover, .datepicker table tr td span.active.disabled[disabled]:hover:focus, .datepicker table tr td span.active.disabled.focus[disabled]:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus, fieldset[disabled] .datepicker table tr td span.active.disabled.focus:hover { - background-color: #007bff; - border-color: #0277f4; -} - -.datepicker table tr td span.old, .datepicker table tr td span.new { - color: #6c757d; -} - -.datepicker .datepicker-switch { - width: 145px; -} - -.datepicker .datepicker-switch, -.datepicker .prev, -.datepicker .next, -.datepicker tfoot tr th { - cursor: pointer; -} - -.datepicker .datepicker-switch:hover, -.datepicker .prev:hover, -.datepicker .next:hover, -.datepicker tfoot tr th:hover { - color: #000; - background: #e9e9ea; -} - -.datepicker .prev.disabled, .datepicker .next.disabled { - visibility: hidden; -} - -.datepicker .cw { - font-size: 10px; - width: 12px; - padding: 0 2px 0 5px; - vertical-align: middle; -} - -.input-group.date .input-group-addon { - cursor: pointer; -} - -.input-daterange { - width: 100%; -} - -.input-daterange input { - text-align: center; -} - -.input-daterange input:first-child { - border-radius: 3px 0 0 3px; -} - -.input-daterange input:last-child { - border-radius: 0 3px 3px 0; -} - -.input-daterange .input-group-addon { - width: auto; - min-width: 16px; - padding: 4px 5px; - line-height: 1.5; - border-width: 1px 0; - margin-left: -5px; - margin-right: -5px; -} diff --git a/shiny/www/shared/datepicker/js/bootstrap-datepicker.js b/shiny/www/shared/datepicker/js/bootstrap-datepicker.js deleted file mode 100644 index c22f0806a..000000000 --- a/shiny/www/shared/datepicker/js/bootstrap-datepicker.js +++ /dev/null @@ -1,2039 +0,0 @@ -/*! - * Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker) - * - * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0) - */ - -(function(factory){ - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } else if (typeof exports === 'object') { - factory(require('jquery')); - } else { - factory(jQuery); - } -}(function($, undefined){ - function UTCDate(){ - return new Date(Date.UTC.apply(Date, arguments)); - } - function UTCToday(){ - var today = new Date(); - return UTCDate(today.getFullYear(), today.getMonth(), today.getDate()); - } - function isUTCEquals(date1, date2) { - return ( - date1.getUTCFullYear() === date2.getUTCFullYear() && - date1.getUTCMonth() === date2.getUTCMonth() && - date1.getUTCDate() === date2.getUTCDate() - ); - } - function alias(method, deprecationMsg){ - return function(){ - if (deprecationMsg !== undefined) { - $.fn.datepicker.deprecated(deprecationMsg); - } - - return this[method].apply(this, arguments); - }; - } - function isValidDate(d) { - return d && !isNaN(d.getTime()); - } - - var DateArray = (function(){ - var extras = { - get: function(i){ - return this.slice(i)[0]; - }, - contains: function(d){ - // Array.indexOf is not cross-browser; - // $.inArray doesn't work with Dates - var val = d && d.valueOf(); - for (var i=0, l=this.length; i < l; i++) - // Use date arithmetic to allow dates with different times to match - if (0 <= this[i].valueOf() - val && this[i].valueOf() - val < 1000*60*60*24) - return i; - return -1; - }, - remove: function(i){ - this.splice(i,1); - }, - replace: function(new_array){ - if (!new_array) - return; - if (!$.isArray(new_array)) - new_array = [new_array]; - this.clear(); - this.push.apply(this, new_array); - }, - clear: function(){ - this.length = 0; - }, - copy: function(){ - var a = new DateArray(); - a.replace(this); - return a; - } - }; - - return function(){ - var a = []; - a.push.apply(a, arguments); - $.extend(a, extras); - return a; - }; - })(); - - - // Picker object - - var Datepicker = function(element, options){ - $.data(element, 'datepicker', this); - - this._events = []; - this._secondaryEvents = []; - - this._process_options(options); - - this.dates = new DateArray(); - this.viewDate = this.o.defaultViewDate; - this.focusDate = null; - - this.element = $(element); - this.isInput = this.element.is('input'); - this.inputField = this.isInput ? this.element : this.element.find('input'); - this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false; - if (this.component && this.component.length === 0) - this.component = false; - this.isInline = !this.component && this.element.is('div'); - - this.picker = $(DPGlobal.template); - - // Checking templates and inserting - if (this._check_template(this.o.templates.leftArrow)) { - this.picker.find('.prev').html(this.o.templates.leftArrow); - } - - if (this._check_template(this.o.templates.rightArrow)) { - this.picker.find('.next').html(this.o.templates.rightArrow); - } - - this._buildEvents(); - this._attachEvents(); - - if (this.isInline){ - this.picker.addClass('datepicker-inline').appendTo(this.element); - } - else { - this.picker.addClass('datepicker-dropdown dropdown-menu'); - } - - if (this.o.rtl){ - this.picker.addClass('datepicker-rtl'); - } - - if (this.o.calendarWeeks) { - this.picker.find('.datepicker-days .datepicker-switch, thead .datepicker-title, tfoot .today, tfoot .clear') - .attr('colspan', function(i, val){ - return Number(val) + 1; - }); - } - - this._process_options({ - startDate: this._o.startDate, - endDate: this._o.endDate, - daysOfWeekDisabled: this.o.daysOfWeekDisabled, - daysOfWeekHighlighted: this.o.daysOfWeekHighlighted, - datesDisabled: this.o.datesDisabled - }); - - this._allow_update = false; - this.setViewMode(this.o.startView); - this._allow_update = true; - - this.fillDow(); - this.fillMonths(); - - this.update(); - - if (this.isInline){ - this.show(); - } - }; - - Datepicker.prototype = { - constructor: Datepicker, - - _resolveViewName: function(view){ - $.each(DPGlobal.viewModes, function(i, viewMode){ - if (view === i || $.inArray(view, viewMode.names) !== -1){ - view = i; - return false; - } - }); - - return view; - }, - - _resolveDaysOfWeek: function(daysOfWeek){ - if (!$.isArray(daysOfWeek)) - daysOfWeek = daysOfWeek.split(/[,\s]*/); - return $.map(daysOfWeek, Number); - }, - - _check_template: function(tmp){ - try { - // If empty - if (tmp === undefined || tmp === "") { - return false; - } - // If no html, everything ok - if ((tmp.match(/[<>]/g) || []).length <= 0) { - return true; - } - // Checking if html is fine - var jDom = $(tmp); - return jDom.length > 0; - } - catch (ex) { - return false; - } - }, - - _process_options: function(opts){ - // Store raw options for reference - this._o = $.extend({}, this._o, opts); - // Processed options - var o = this.o = $.extend({}, this._o); - - // Check if "de-DE" style date is available, if not language should - // fallback to 2 letter code eg "de" - var lang = o.language; - if (!dates[lang]){ - lang = lang.split('-')[0]; - if (!dates[lang]) - lang = defaults.language; - } - o.language = lang; - - // Retrieve view index from any aliases - o.startView = this._resolveViewName(o.startView); - o.minViewMode = this._resolveViewName(o.minViewMode); - o.maxViewMode = this._resolveViewName(o.maxViewMode); - - // Check view is between min and max - o.startView = Math.max(this.o.minViewMode, Math.min(this.o.maxViewMode, o.startView)); - - // true, false, or Number > 0 - if (o.multidate !== true){ - o.multidate = Number(o.multidate) || false; - if (o.multidate !== false) - o.multidate = Math.max(0, o.multidate); - } - o.multidateSeparator = String(o.multidateSeparator); - - o.weekStart %= 7; - o.weekEnd = (o.weekStart + 6) % 7; - - var format = DPGlobal.parseFormat(o.format); - if (o.startDate !== -Infinity){ - if (!!o.startDate){ - if (o.startDate instanceof Date) - o.startDate = this._local_to_utc(this._zero_time(o.startDate)); - else - o.startDate = DPGlobal.parseDate(o.startDate, format, o.language, o.assumeNearbyYear); - } - else { - o.startDate = -Infinity; - } - } - if (o.endDate !== Infinity){ - if (!!o.endDate){ - if (o.endDate instanceof Date) - o.endDate = this._local_to_utc(this._zero_time(o.endDate)); - else - o.endDate = DPGlobal.parseDate(o.endDate, format, o.language, o.assumeNearbyYear); - } - else { - o.endDate = Infinity; - } - } - - o.daysOfWeekDisabled = this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]); - o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]); - - o.datesDisabled = o.datesDisabled||[]; - if (!$.isArray(o.datesDisabled)) { - o.datesDisabled = o.datesDisabled.split(','); - } - o.datesDisabled = $.map(o.datesDisabled, function(d){ - return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear); - }); - - var plc = String(o.orientation).toLowerCase().split(/\s+/g), - _plc = o.orientation.toLowerCase(); - plc = $.grep(plc, function(word){ - return /^auto|left|right|top|bottom$/.test(word); - }); - o.orientation = {x: 'auto', y: 'auto'}; - if (!_plc || _plc === 'auto') - ; // no action - else if (plc.length === 1){ - switch (plc[0]){ - case 'top': - case 'bottom': - o.orientation.y = plc[0]; - break; - case 'left': - case 'right': - o.orientation.x = plc[0]; - break; - } - } - else { - _plc = $.grep(plc, function(word){ - return /^left|right$/.test(word); - }); - o.orientation.x = _plc[0] || 'auto'; - - _plc = $.grep(plc, function(word){ - return /^top|bottom$/.test(word); - }); - o.orientation.y = _plc[0] || 'auto'; - } - if (o.defaultViewDate instanceof Date || typeof o.defaultViewDate === 'string') { - o.defaultViewDate = DPGlobal.parseDate(o.defaultViewDate, format, o.language, o.assumeNearbyYear); - } else if (o.defaultViewDate) { - var year = o.defaultViewDate.year || new Date().getFullYear(); - var month = o.defaultViewDate.month || 0; - var day = o.defaultViewDate.day || 1; - o.defaultViewDate = UTCDate(year, month, day); - } else { - o.defaultViewDate = UTCToday(); - } - }, - _applyEvents: function(evs){ - for (var i=0, el, ch, ev; i < evs.length; i++){ - el = evs[i][0]; - if (evs[i].length === 2){ - ch = undefined; - ev = evs[i][1]; - } else if (evs[i].length === 3){ - ch = evs[i][1]; - ev = evs[i][2]; - } - el.on(ev, ch); - } - }, - _unapplyEvents: function(evs){ - for (var i=0, el, ev, ch; i < evs.length; i++){ - el = evs[i][0]; - if (evs[i].length === 2){ - ch = undefined; - ev = evs[i][1]; - } else if (evs[i].length === 3){ - ch = evs[i][1]; - ev = evs[i][2]; - } - el.off(ev, ch); - } - }, - _buildEvents: function(){ - var events = { - keyup: $.proxy(function(e){ - if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1) - this.update(); - }, this), - keydown: $.proxy(this.keydown, this), - paste: $.proxy(this.paste, this) - }; - - if (this.o.showOnFocus === true) { - events.focus = $.proxy(this.show, this); - } - - if (this.isInput) { // single input - this._events = [ - [this.element, events] - ]; - } - // component: input + button - else if (this.component && this.inputField.length) { - this._events = [ - // For components that are not readonly, allow keyboard nav - [this.inputField, events], - [this.component, { - click: $.proxy(this.show, this) - }] - ]; - } - else { - this._events = [ - [this.element, { - click: $.proxy(this.show, this), - keydown: $.proxy(this.keydown, this) - }] - ]; - } - this._events.push( - // Component: listen for blur on element descendants - [this.element, '*', { - blur: $.proxy(function(e){ - this._focused_from = e.target; - }, this) - }], - // Input: listen for blur on element - [this.element, { - blur: $.proxy(function(e){ - this._focused_from = e.target; - }, this) - }] - ); - - if (this.o.immediateUpdates) { - // Trigger input updates immediately on changed year/month - this._events.push([this.element, { - 'changeYear changeMonth': $.proxy(function(e){ - this.update(e.date); - }, this) - }]); - } - - this._secondaryEvents = [ - [this.picker, { - click: $.proxy(this.click, this) - }], - [this.picker, '.prev, .next', { - click: $.proxy(this.navArrowsClick, this) - }], - [this.picker, '.day:not(.disabled)', { - click: $.proxy(this.dayCellClick, this) - }], - [$(window), { - resize: $.proxy(this.place, this) - }], - [$(document), { - 'mousedown touchstart': $.proxy(function(e){ - // Clicked outside the datepicker, hide it - if (!( - this.element.is(e.target) || - this.element.find(e.target).length || - this.picker.is(e.target) || - this.picker.find(e.target).length || - this.isInline - )){ - this.hide(); - } - }, this) - }] - ]; - }, - _attachEvents: function(){ - this._detachEvents(); - this._applyEvents(this._events); - }, - _detachEvents: function(){ - this._unapplyEvents(this._events); - }, - _attachSecondaryEvents: function(){ - this._detachSecondaryEvents(); - this._applyEvents(this._secondaryEvents); - }, - _detachSecondaryEvents: function(){ - this._unapplyEvents(this._secondaryEvents); - }, - _trigger: function(event, altdate){ - var date = altdate || this.dates.get(-1), - local_date = this._utc_to_local(date); - - this.element.trigger({ - type: event, - date: local_date, - viewMode: this.viewMode, - dates: $.map(this.dates, this._utc_to_local), - format: $.proxy(function(ix, format){ - if (arguments.length === 0){ - ix = this.dates.length - 1; - format = this.o.format; - } else if (typeof ix === 'string'){ - format = ix; - ix = this.dates.length - 1; - } - format = format || this.o.format; - var date = this.dates.get(ix); - return DPGlobal.formatDate(date, format, this.o.language); - }, this) - }); - }, - - show: function(){ - if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false)) - return; - if (!this.isInline) - this.picker.appendTo(this.o.container); - this.place(); - this.picker.show(); - this._attachSecondaryEvents(); - this._trigger('show'); - if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) { - $(this.element).blur(); - } - return this; - }, - - hide: function(){ - if (this.isInline || !this.picker.is(':visible')) - return this; - this.focusDate = null; - this.picker.hide().detach(); - this._detachSecondaryEvents(); - this.setViewMode(this.o.startView); - - if (this.o.forceParse && this.inputField.val()) - this.setValue(); - this._trigger('hide'); - return this; - }, - - destroy: function(){ - this.hide(); - this._detachEvents(); - this._detachSecondaryEvents(); - this.picker.remove(); - delete this.element.data().datepicker; - if (!this.isInput){ - delete this.element.data().date; - } - return this; - }, - - paste: function(e){ - var dateString; - if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.types - && $.inArray('text/plain', e.originalEvent.clipboardData.types) !== -1) { - dateString = e.originalEvent.clipboardData.getData('text/plain'); - } else if (window.clipboardData) { - dateString = window.clipboardData.getData('Text'); - } else { - return; - } - this.setDate(dateString); - this.update(); - e.preventDefault(); - }, - - _utc_to_local: function(utc){ - if (!utc) { - return utc; - } - - var local = new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000)); - - if (local.getTimezoneOffset() !== utc.getTimezoneOffset()) { - local = new Date(utc.getTime() + (local.getTimezoneOffset() * 60000)); - } - - return local; - }, - _local_to_utc: function(local){ - return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000)); - }, - _zero_time: function(local){ - return local && new Date(local.getFullYear(), local.getMonth(), local.getDate()); - }, - _zero_utc_time: function(utc){ - return utc && UTCDate(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()); - }, - - getDates: function(){ - return $.map(this.dates, this._utc_to_local); - }, - - getUTCDates: function(){ - return $.map(this.dates, function(d){ - return new Date(d); - }); - }, - - getDate: function(){ - return this._utc_to_local(this.getUTCDate()); - }, - - getUTCDate: function(){ - var selected_date = this.dates.get(-1); - if (selected_date !== undefined) { - return new Date(selected_date); - } else { - return null; - } - }, - - clearDates: function(){ - this.inputField.val(''); - this.update(); - this._trigger('changeDate'); - - if (this.o.autoclose) { - this.hide(); - } - }, - - setDates: function(){ - var args = $.isArray(arguments[0]) ? arguments[0] : arguments; - this.update.apply(this, args); - this._trigger('changeDate'); - this.setValue(); - return this; - }, - - setUTCDates: function(){ - var args = $.isArray(arguments[0]) ? arguments[0] : arguments; - this.setDates.apply(this, $.map(args, this._utc_to_local)); - return this; - }, - - setDate: alias('setDates'), - setUTCDate: alias('setUTCDates'), - remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead'), - - setValue: function(){ - var formatted = this.getFormattedDate(); - this.inputField.val(formatted); - return this; - }, - - getFormattedDate: function(format){ - if (format === undefined) - format = this.o.format; - - var lang = this.o.language; - return $.map(this.dates, function(d){ - return DPGlobal.formatDate(d, format, lang); - }).join(this.o.multidateSeparator); - }, - - getStartDate: function(){ - return this.o.startDate; - }, - - setStartDate: function(startDate){ - this._process_options({startDate: startDate}); - this.update(); - this.updateNavArrows(); - return this; - }, - - getEndDate: function(){ - return this.o.endDate; - }, - - setEndDate: function(endDate){ - this._process_options({endDate: endDate}); - this.update(); - this.updateNavArrows(); - return this; - }, - - setDaysOfWeekDisabled: function(daysOfWeekDisabled){ - this._process_options({daysOfWeekDisabled: daysOfWeekDisabled}); - this.update(); - return this; - }, - - setDaysOfWeekHighlighted: function(daysOfWeekHighlighted){ - this._process_options({daysOfWeekHighlighted: daysOfWeekHighlighted}); - this.update(); - return this; - }, - - setDatesDisabled: function(datesDisabled){ - this._process_options({datesDisabled: datesDisabled}); - this.update(); - return this; - }, - - place: function(){ - if (this.isInline) - return this; - var calendarWidth = this.picker.outerWidth(), - calendarHeight = this.picker.outerHeight(), - visualPadding = 10, - container = $(this.o.container), - windowWidth = container.width(), - scrollTop = this.o.container === 'body:first' ? $(document).scrollTop() : container.scrollTop(), - appendOffset = container.offset(); - - var parentsZindex = [0]; - this.element.parents().each(function(){ - var itemZIndex = $(this).css('z-index'); - if (itemZIndex !== 'auto' && Number(itemZIndex) !== 0) parentsZindex.push(Number(itemZIndex)); - }); - var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset; - var offset = this.component ? this.component.parent().offset() : this.element.offset(); - var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false); - var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false); - var left = offset.left - appendOffset.left; - var top = offset.top - appendOffset.top; - - if (this.o.container !== 'body:first') { - top += scrollTop; - } - - this.picker.removeClass( - 'datepicker-orient-top datepicker-orient-bottom '+ - 'datepicker-orient-right datepicker-orient-left' - ); - - if (this.o.orientation.x !== 'auto'){ - this.picker.addClass('datepicker-orient-' + this.o.orientation.x); - if (this.o.orientation.x === 'right') - left -= calendarWidth - width; - } - // auto x orientation is best-placement: if it crosses a window - // edge, fudge it sideways - else { - if (offset.left < 0) { - // component is outside the window on the left side. Move it into visible range - this.picker.addClass('datepicker-orient-left'); - left -= offset.left - visualPadding; - } else if (left + calendarWidth > windowWidth) { - // the calendar passes the widow right edge. Align it to component right side - this.picker.addClass('datepicker-orient-right'); - left += width - calendarWidth; - } else { - if (this.o.rtl) { - // Default to right - this.picker.addClass('datepicker-orient-right'); - } else { - // Default to left - this.picker.addClass('datepicker-orient-left'); - } - } - } - - // auto y orientation is best-situation: top or bottom, no fudging, - // decision based on which shows more of the calendar - var yorient = this.o.orientation.y, - top_overflow; - if (yorient === 'auto'){ - top_overflow = -scrollTop + top - calendarHeight; - yorient = top_overflow < 0 ? 'bottom' : 'top'; - } - - this.picker.addClass('datepicker-orient-' + yorient); - if (yorient === 'top') - top -= calendarHeight + parseInt(this.picker.css('padding-top')); - else - top += height; - - if (this.o.rtl) { - var right = windowWidth - (left + width); - this.picker.css({ - top: top, - right: right, - zIndex: zIndex - }); - } else { - this.picker.css({ - top: top, - left: left, - zIndex: zIndex - }); - } - return this; - }, - - _allow_update: true, - update: function(){ - if (!this._allow_update) - return this; - - var oldDates = this.dates.copy(), - dates = [], - fromArgs = false; - if (arguments.length){ - $.each(arguments, $.proxy(function(i, date){ - if (date instanceof Date) - date = this._local_to_utc(date); - dates.push(date); - }, this)); - fromArgs = true; - } else { - dates = this.isInput - ? this.element.val() - : this.element.data('date') || this.inputField.val(); - if (dates && this.o.multidate) - dates = dates.split(this.o.multidateSeparator); - else - dates = [dates]; - delete this.element.data().date; - } - - dates = $.map(dates, $.proxy(function(date){ - return DPGlobal.parseDate(date, this.o.format, this.o.language, this.o.assumeNearbyYear); - }, this)); - dates = $.grep(dates, $.proxy(function(date){ - return ( - !this.dateWithinRange(date) || - !date - ); - }, this), true); - this.dates.replace(dates); - - if (this.o.updateViewDate) { - if (this.dates.length) - this.viewDate = new Date(this.dates.get(-1)); - else if (this.viewDate < this.o.startDate) - this.viewDate = new Date(this.o.startDate); - else if (this.viewDate > this.o.endDate) - this.viewDate = new Date(this.o.endDate); - else - this.viewDate = this.o.defaultViewDate; - } - - if (fromArgs){ - // setting date by clicking - this.setValue(); - this.element.change(); - } - else if (this.dates.length){ - // setting date by typing - if (String(oldDates) !== String(this.dates) && fromArgs) { - this._trigger('changeDate'); - this.element.change(); - } - } - if (!this.dates.length && oldDates.length) { - this._trigger('clearDate'); - this.element.change(); - } - - this.fill(); - return this; - }, - - fillDow: function(){ - if (this.o.showWeekDays) { - var dowCnt = this.o.weekStart, - html = ''; - if (this.o.calendarWeeks){ - html += ' '; - } - while (dowCnt < this.o.weekStart + 7){ - html += ''+dates[this.o.language].daysMin[(dowCnt++)%7]+''; - } - html += ''; - this.picker.find('.datepicker-days thead').append(html); - } - }, - - fillMonths: function(){ - var localDate = this._utc_to_local(this.viewDate); - var html = ''; - var focused; - for (var i = 0; i < 12; i++){ - focused = localDate && localDate.getMonth() === i ? ' focused' : ''; - html += '' + dates[this.o.language].monthsShort[i] + ''; - } - this.picker.find('.datepicker-months td').html(html); - }, - - setRange: function(range){ - if (!range || !range.length) - delete this.range; - else - this.range = $.map(range, function(d){ - return d.valueOf(); - }); - this.fill(); - }, - - getClassNames: function(date){ - var cls = [], - year = this.viewDate.getUTCFullYear(), - month = this.viewDate.getUTCMonth(), - today = UTCToday(); - if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){ - cls.push('old'); - } else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){ - cls.push('new'); - } - if (this.focusDate && date.valueOf() === this.focusDate.valueOf()) - cls.push('focused'); - // Compare internal UTC date with UTC today, not local today - if (this.o.todayHighlight && isUTCEquals(date, today)) { - cls.push('today'); - } - if (this.dates.contains(date) !== -1) - cls.push('active'); - if (!this.dateWithinRange(date)){ - cls.push('disabled'); - } - if (this.dateIsDisabled(date)){ - cls.push('disabled', 'disabled-date'); - } - if ($.inArray(date.getUTCDay(), this.o.daysOfWeekHighlighted) !== -1){ - cls.push('highlighted'); - } - - if (this.range){ - if (date > this.range[0] && date < this.range[this.range.length-1]){ - cls.push('range'); - } - if ($.inArray(date.valueOf(), this.range) !== -1){ - cls.push('selected'); - } - if (date.valueOf() === this.range[0]){ - cls.push('range-start'); - } - if (date.valueOf() === this.range[this.range.length-1]){ - cls.push('range-end'); - } - } - return cls; - }, - - _fill_yearsView: function(selector, cssClass, factor, year, startYear, endYear, beforeFn){ - var html = ''; - var step = factor / 10; - var view = this.picker.find(selector); - var startVal = Math.floor(year / factor) * factor; - var endVal = startVal + step * 9; - var focusedVal = Math.floor(this.viewDate.getFullYear() / step) * step; - var selected = $.map(this.dates, function(d){ - return Math.floor(d.getUTCFullYear() / step) * step; - }); - - var classes, tooltip, before; - for (var currVal = startVal - step; currVal <= endVal + step; currVal += step) { - classes = [cssClass]; - tooltip = null; - - if (currVal === startVal - step) { - classes.push('old'); - } else if (currVal === endVal + step) { - classes.push('new'); - } - if ($.inArray(currVal, selected) !== -1) { - classes.push('active'); - } - if (currVal < startYear || currVal > endYear) { - classes.push('disabled'); - } - if (currVal === focusedVal) { - classes.push('focused'); - } - - if (beforeFn !== $.noop) { - before = beforeFn(new Date(currVal, 0, 1)); - if (before === undefined) { - before = {}; - } else if (typeof before === 'boolean') { - before = {enabled: before}; - } else if (typeof before === 'string') { - before = {classes: before}; - } - if (before.enabled === false) { - classes.push('disabled'); - } - if (before.classes) { - classes = classes.concat(before.classes.split(/\s+/)); - } - if (before.tooltip) { - tooltip = before.tooltip; - } - } - - html += '' + currVal + ''; - } - - view.find('.datepicker-switch').text(startVal + '-' + endVal); - view.find('td').html(html); - }, - - fill: function(){ - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(), - startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity, - startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity, - endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity, - endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity, - todaytxt = dates[this.o.language].today || dates['en'].today || '', - cleartxt = dates[this.o.language].clear || dates['en'].clear || '', - titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat, - todayDate = UTCToday(), - titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate), - tooltip, - before; - if (isNaN(year) || isNaN(month)) - return; - this.picker.find('.datepicker-days .datepicker-switch') - .text(DPGlobal.formatDate(d, titleFormat, this.o.language)); - this.picker.find('tfoot .today') - .text(todaytxt) - .css('display', titleBtnVisible ? 'table-cell' : 'none'); - this.picker.find('tfoot .clear') - .text(cleartxt) - .css('display', this.o.clearBtn === true ? 'table-cell' : 'none'); - this.picker.find('thead .datepicker-title') - .text(this.o.title) - .css('display', typeof this.o.title === 'string' && this.o.title !== '' ? 'table-cell' : 'none'); - this.updateNavArrows(); - this.fillMonths(); - var prevMonth = UTCDate(year, month, 0), - day = prevMonth.getUTCDate(); - prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7); - var nextMonth = new Date(prevMonth); - if (prevMonth.getUTCFullYear() < 100){ - nextMonth.setUTCFullYear(prevMonth.getUTCFullYear()); - } - nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); - nextMonth = nextMonth.valueOf(); - var html = []; - var weekDay, clsName; - while (prevMonth.valueOf() < nextMonth){ - weekDay = prevMonth.getUTCDay(); - if (weekDay === this.o.weekStart){ - html.push(''); - if (this.o.calendarWeeks){ - // ISO 8601: First week contains first thursday. - // ISO also states week starts on Monday, but we can be more abstract here. - var - // Start of current week: based on weekstart/current date - ws = new Date(+prevMonth + (this.o.weekStart - weekDay - 7) % 7 * 864e5), - // Thursday of this week - th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5), - // First Thursday of year, year from thursday - yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5), - // Calendar week: ms between thursdays, div ms per day, div 7 days - calWeek = (th - yth) / 864e5 / 7 + 1; - html.push(''+ calWeek +''); - } - } - clsName = this.getClassNames(prevMonth); - clsName.push('day'); - - var content = prevMonth.getUTCDate(); - - if (this.o.beforeShowDay !== $.noop){ - before = this.o.beforeShowDay(this._utc_to_local(prevMonth)); - if (before === undefined) - before = {}; - else if (typeof before === 'boolean') - before = {enabled: before}; - else if (typeof before === 'string') - before = {classes: before}; - if (before.enabled === false) - clsName.push('disabled'); - if (before.classes) - clsName = clsName.concat(before.classes.split(/\s+/)); - if (before.tooltip) - tooltip = before.tooltip; - if (before.content) - content = before.content; - } - - //Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2) - //Fallback to unique function for older jquery versions - if ($.isFunction($.uniqueSort)) { - clsName = $.uniqueSort(clsName); - } else { - clsName = $.unique(clsName); - } - - html.push('' + content + ''); - tooltip = null; - if (weekDay === this.o.weekEnd){ - html.push(''); - } - prevMonth.setUTCDate(prevMonth.getUTCDate() + 1); - } - this.picker.find('.datepicker-days tbody').html(html.join('')); - - var monthsTitle = dates[this.o.language].monthsTitle || dates['en'].monthsTitle || 'Months'; - var months = this.picker.find('.datepicker-months') - .find('.datepicker-switch') - .text(this.o.maxViewMode < 2 ? monthsTitle : year) - .end() - .find('tbody span').removeClass('active'); - - $.each(this.dates, function(i, d){ - if (d.getUTCFullYear() === year) - months.eq(d.getUTCMonth()).addClass('active'); - }); - - if (year < startYear || year > endYear){ - months.addClass('disabled'); - } - if (year === startYear){ - months.slice(0, startMonth).addClass('disabled'); - } - if (year === endYear){ - months.slice(endMonth+1).addClass('disabled'); - } - - if (this.o.beforeShowMonth !== $.noop){ - var that = this; - $.each(months, function(i, month){ - var moDate = new Date(year, i, 1); - var before = that.o.beforeShowMonth(moDate); - if (before === undefined) - before = {}; - else if (typeof before === 'boolean') - before = {enabled: before}; - else if (typeof before === 'string') - before = {classes: before}; - if (before.enabled === false && !$(month).hasClass('disabled')) - $(month).addClass('disabled'); - if (before.classes) - $(month).addClass(before.classes); - if (before.tooltip) - $(month).prop('title', before.tooltip); - }); - } - - // Generating decade/years picker - this._fill_yearsView( - '.datepicker-years', - 'year', - 10, - year, - startYear, - endYear, - this.o.beforeShowYear - ); - - // Generating century/decades picker - this._fill_yearsView( - '.datepicker-decades', - 'decade', - 100, - year, - startYear, - endYear, - this.o.beforeShowDecade - ); - - // Generating millennium/centuries picker - this._fill_yearsView( - '.datepicker-centuries', - 'century', - 1000, - year, - startYear, - endYear, - this.o.beforeShowCentury - ); - }, - - updateNavArrows: function(){ - if (!this._allow_update) - return; - - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(), - startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity, - startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity, - endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity, - endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity, - prevIsDisabled, - nextIsDisabled, - factor = 1; - switch (this.viewMode){ - case 4: - factor *= 10; - /* falls through */ - case 3: - factor *= 10; - /* falls through */ - case 2: - factor *= 10; - /* falls through */ - case 1: - prevIsDisabled = Math.floor(year / factor) * factor <= startYear; - nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear; - break; - case 0: - prevIsDisabled = year <= startYear && month <= startMonth; - nextIsDisabled = year >= endYear && month >= endMonth; - break; - } - - this.picker.find('.prev').toggleClass('disabled', prevIsDisabled); - this.picker.find('.next').toggleClass('disabled', nextIsDisabled); - }, - - click: function(e){ - e.preventDefault(); - e.stopPropagation(); - - var target, dir, day, year, month; - target = $(e.target); - - // Clicked on the switch - if (target.hasClass('datepicker-switch') && this.viewMode !== this.o.maxViewMode){ - this.setViewMode(this.viewMode + 1); - } - - // Clicked on today button - if (target.hasClass('today') && !target.hasClass('day')){ - this.setViewMode(0); - this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view'); - } - - // Clicked on clear button - if (target.hasClass('clear')){ - this.clearDates(); - } - - if (!target.hasClass('disabled')){ - // Clicked on a month, year, decade, century - if (target.hasClass('month') - || target.hasClass('year') - || target.hasClass('decade') - || target.hasClass('century')) { - this.viewDate.setUTCDate(1); - - day = 1; - if (this.viewMode === 1){ - month = target.parent().find('span').index(target); - year = this.viewDate.getUTCFullYear(); - this.viewDate.setUTCMonth(month); - } else { - month = 0; - year = Number(target.text()); - this.viewDate.setUTCFullYear(year); - } - - this._trigger(DPGlobal.viewModes[this.viewMode - 1].e, this.viewDate); - - if (this.viewMode === this.o.minViewMode){ - this._setDate(UTCDate(year, month, day)); - } else { - this.setViewMode(this.viewMode - 1); - this.fill(); - } - } - } - - if (this.picker.is(':visible') && this._focused_from){ - this._focused_from.focus(); - } - delete this._focused_from; - }, - - dayCellClick: function(e){ - var $target = $(e.currentTarget); - var timestamp = $target.data('date'); - var date = new Date(timestamp); - - if (this.o.updateViewDate) { - if (date.getUTCFullYear() !== this.viewDate.getUTCFullYear()) { - this._trigger('changeYear', this.viewDate); - } - - if (date.getUTCMonth() !== this.viewDate.getUTCMonth()) { - this._trigger('changeMonth', this.viewDate); - } - } - this._setDate(date); - }, - - // Clicked on prev or next - navArrowsClick: function(e){ - var $target = $(e.currentTarget); - var dir = $target.hasClass('prev') ? -1 : 1; - if (this.viewMode !== 0){ - dir *= DPGlobal.viewModes[this.viewMode].navStep * 12; - } - this.viewDate = this.moveMonth(this.viewDate, dir); - this._trigger(DPGlobal.viewModes[this.viewMode].e, this.viewDate); - this.fill(); - }, - - _toggle_multidate: function(date){ - var ix = this.dates.contains(date); - if (!date){ - this.dates.clear(); - } - - if (ix !== -1){ - if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){ - this.dates.remove(ix); - } - } else if (this.o.multidate === false) { - this.dates.clear(); - this.dates.push(date); - } - else { - this.dates.push(date); - } - - if (typeof this.o.multidate === 'number') - while (this.dates.length > this.o.multidate) - this.dates.remove(0); - }, - - _setDate: function(date, which){ - if (!which || which === 'date') - this._toggle_multidate(date && new Date(date)); - if ((!which && this.o.updateViewDate) || which === 'view') - this.viewDate = date && new Date(date); - - this.fill(); - this.setValue(); - if (!which || which !== 'view') { - this._trigger('changeDate'); - } - this.inputField.trigger('change'); - if (this.o.autoclose && (!which || which === 'date')){ - this.hide(); - } - }, - - moveDay: function(date, dir){ - var newDate = new Date(date); - newDate.setUTCDate(date.getUTCDate() + dir); - - return newDate; - }, - - moveWeek: function(date, dir){ - return this.moveDay(date, dir * 7); - }, - - moveMonth: function(date, dir){ - if (!isValidDate(date)) - return this.o.defaultViewDate; - if (!dir) - return date; - var new_date = new Date(date.valueOf()), - day = new_date.getUTCDate(), - month = new_date.getUTCMonth(), - mag = Math.abs(dir), - new_month, test; - dir = dir > 0 ? 1 : -1; - if (mag === 1){ - test = dir === -1 - // If going back one month, make sure month is not current month - // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) - ? function(){ - return new_date.getUTCMonth() === month; - } - // If going forward one month, make sure month is as expected - // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) - : function(){ - return new_date.getUTCMonth() !== new_month; - }; - new_month = month + dir; - new_date.setUTCMonth(new_month); - // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 - new_month = (new_month + 12) % 12; - } - else { - // For magnitudes >1, move one month at a time... - for (var i=0; i < mag; i++) - // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... - new_date = this.moveMonth(new_date, dir); - // ...then reset the day, keeping it in the new month - new_month = new_date.getUTCMonth(); - new_date.setUTCDate(day); - test = function(){ - return new_month !== new_date.getUTCMonth(); - }; - } - // Common date-resetting loop -- if date is beyond end of month, make it - // end of month - while (test()){ - new_date.setUTCDate(--day); - new_date.setUTCMonth(new_month); - } - return new_date; - }, - - moveYear: function(date, dir){ - return this.moveMonth(date, dir*12); - }, - - moveAvailableDate: function(date, dir, fn){ - do { - date = this[fn](date, dir); - - if (!this.dateWithinRange(date)) - return false; - - fn = 'moveDay'; - } - while (this.dateIsDisabled(date)); - - return date; - }, - - weekOfDateIsDisabled: function(date){ - return $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1; - }, - - dateIsDisabled: function(date){ - return ( - this.weekOfDateIsDisabled(date) || - $.grep(this.o.datesDisabled, function(d){ - return isUTCEquals(date, d); - }).length > 0 - ); - }, - - dateWithinRange: function(date){ - return date >= this.o.startDate && date <= this.o.endDate; - }, - - keydown: function(e){ - if (!this.picker.is(':visible')){ - if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker - this.show(); - e.stopPropagation(); - } - return; - } - var dateChanged = false, - dir, newViewDate, - focusDate = this.focusDate || this.viewDate; - switch (e.keyCode){ - case 27: // escape - if (this.focusDate){ - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - } - else - this.hide(); - e.preventDefault(); - e.stopPropagation(); - break; - case 37: // left - case 38: // up - case 39: // right - case 40: // down - if (!this.o.keyboardNavigation || this.o.daysOfWeekDisabled.length === 7) - break; - dir = e.keyCode === 37 || e.keyCode === 38 ? -1 : 1; - if (this.viewMode === 0) { - if (e.ctrlKey){ - newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear'); - - if (newViewDate) - this._trigger('changeYear', this.viewDate); - } else if (e.shiftKey){ - newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth'); - - if (newViewDate) - this._trigger('changeMonth', this.viewDate); - } else if (e.keyCode === 37 || e.keyCode === 39){ - newViewDate = this.moveAvailableDate(focusDate, dir, 'moveDay'); - } else if (!this.weekOfDateIsDisabled(focusDate)){ - newViewDate = this.moveAvailableDate(focusDate, dir, 'moveWeek'); - } - } else if (this.viewMode === 1) { - if (e.keyCode === 38 || e.keyCode === 40) { - dir = dir * 4; - } - newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth'); - } else if (this.viewMode === 2) { - if (e.keyCode === 38 || e.keyCode === 40) { - dir = dir * 4; - } - newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear'); - } - if (newViewDate){ - this.focusDate = this.viewDate = newViewDate; - this.setValue(); - this.fill(); - e.preventDefault(); - } - break; - case 13: // enter - if (!this.o.forceParse) - break; - focusDate = this.focusDate || this.dates.get(-1) || this.viewDate; - if (this.o.keyboardNavigation) { - this._toggle_multidate(focusDate); - dateChanged = true; - } - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.setValue(); - this.fill(); - if (this.picker.is(':visible')){ - e.preventDefault(); - e.stopPropagation(); - if (this.o.autoclose) - this.hide(); - } - break; - case 9: // tab - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - this.hide(); - break; - } - if (dateChanged){ - if (this.dates.length) - this._trigger('changeDate'); - else - this._trigger('clearDate'); - this.inputField.trigger('change'); - } - }, - - setViewMode: function(viewMode){ - this.viewMode = viewMode; - this.picker - .children('div') - .hide() - .filter('.datepicker-' + DPGlobal.viewModes[this.viewMode].clsName) - .show(); - this.updateNavArrows(); - this._trigger('changeViewMode', new Date(this.viewDate)); - } - }; - - var DateRangePicker = function(element, options){ - $.data(element, 'datepicker', this); - this.element = $(element); - this.inputs = $.map(options.inputs, function(i){ - return i.jquery ? i[0] : i; - }); - delete options.inputs; - - this.keepEmptyValues = options.keepEmptyValues; - delete options.keepEmptyValues; - - datepickerPlugin.call($(this.inputs), options) - .on('changeDate', $.proxy(this.dateUpdated, this)); - - this.pickers = $.map(this.inputs, function(i){ - return $.data(i, 'datepicker'); - }); - this.updateDates(); - }; - DateRangePicker.prototype = { - updateDates: function(){ - this.dates = $.map(this.pickers, function(i){ - return i.getUTCDate(); - }); - this.updateRanges(); - }, - updateRanges: function(){ - var range = $.map(this.dates, function(d){ - return d.valueOf(); - }); - $.each(this.pickers, function(i, p){ - p.setRange(range); - }); - }, - clearDates: function(){ - $.each(this.pickers, function(i, p){ - p.clearDates(); - }); - }, - dateUpdated: function(e){ - // `this.updating` is a workaround for preventing infinite recursion - // between `changeDate` triggering and `setUTCDate` calling. Until - // there is a better mechanism. - if (this.updating) - return; - this.updating = true; - - var dp = $.data(e.target, 'datepicker'); - - if (dp === undefined) { - return; - } - - var new_date = dp.getUTCDate(), - keep_empty_values = this.keepEmptyValues, - i = $.inArray(e.target, this.inputs), - j = i - 1, - k = i + 1, - l = this.inputs.length; - if (i === -1) - return; - - $.each(this.pickers, function(i, p){ - if (!p.getUTCDate() && (p === dp || !keep_empty_values)) - p.setUTCDate(new_date); - }); - - if (new_date < this.dates[j]){ - // Date being moved earlier/left - while (j >= 0 && new_date < this.dates[j]){ - this.pickers[j--].setUTCDate(new_date); - } - } else if (new_date > this.dates[k]){ - // Date being moved later/right - while (k < l && new_date > this.dates[k]){ - this.pickers[k++].setUTCDate(new_date); - } - } - this.updateDates(); - - delete this.updating; - }, - destroy: function(){ - $.map(this.pickers, function(p){ p.destroy(); }); - $(this.inputs).off('changeDate', this.dateUpdated); - delete this.element.data().datepicker; - }, - remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead') - }; - - function opts_from_el(el, prefix){ - // Derive options from element data-attrs - var data = $(el).data(), - out = {}, inkey, - replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'); - prefix = new RegExp('^' + prefix.toLowerCase()); - function re_lower(_,a){ - return a.toLowerCase(); - } - for (var key in data) - if (prefix.test(key)){ - inkey = key.replace(replace, re_lower); - out[inkey] = data[key]; - } - return out; - } - - function opts_from_locale(lang){ - // Derive options from locale plugins - var out = {}; - // Check if "de-DE" style date is available, if not language should - // fallback to 2 letter code eg "de" - if (!dates[lang]){ - lang = lang.split('-')[0]; - if (!dates[lang]) - return; - } - var d = dates[lang]; - $.each(locale_opts, function(i,k){ - if (k in d) - out[k] = d[k]; - }); - return out; - } - - var old = $.fn.datepicker; - var datepickerPlugin = function(option){ - var args = Array.apply(null, arguments); - args.shift(); - var internal_return; - this.each(function(){ - var $this = $(this), - data = $this.data('datepicker'), - options = typeof option === 'object' && option; - if (!data){ - var elopts = opts_from_el(this, 'date'), - // Preliminary otions - xopts = $.extend({}, defaults, elopts, options), - locopts = opts_from_locale(xopts.language), - // Options priority: js args, data-attrs, locales, defaults - opts = $.extend({}, defaults, locopts, elopts, options); - if ($this.hasClass('input-daterange') || opts.inputs){ - $.extend(opts, { - inputs: opts.inputs || $this.find('input').toArray() - }); - data = new DateRangePicker(this, opts); - } - else { - data = new Datepicker(this, opts); - } - $this.data('datepicker', data); - } - if (typeof option === 'string' && typeof data[option] === 'function'){ - internal_return = data[option].apply(data, args); - } - }); - - if ( - internal_return === undefined || - internal_return instanceof Datepicker || - internal_return instanceof DateRangePicker - ) - return this; - - if (this.length > 1) - throw new Error('Using only allowed for the collection of a single element (' + option + ' function)'); - else - return internal_return; - }; - $.fn.datepicker = datepickerPlugin; - - var defaults = $.fn.datepicker.defaults = { - assumeNearbyYear: false, - autoclose: false, - beforeShowDay: $.noop, - beforeShowMonth: $.noop, - beforeShowYear: $.noop, - beforeShowDecade: $.noop, - beforeShowCentury: $.noop, - calendarWeeks: false, - clearBtn: false, - toggleActive: false, - daysOfWeekDisabled: [], - daysOfWeekHighlighted: [], - datesDisabled: [], - endDate: Infinity, - forceParse: true, - format: 'mm/dd/yyyy', - keepEmptyValues: false, - keyboardNavigation: true, - language: 'en', - minViewMode: 0, - maxViewMode: 4, - multidate: false, - multidateSeparator: ',', - orientation: "auto", - rtl: false, - startDate: -Infinity, - startView: 0, - todayBtn: false, - todayHighlight: false, - updateViewDate: true, - weekStart: 0, - disableTouchKeyboard: false, - enableOnReadonly: true, - showOnFocus: true, - zIndexOffset: 10, - container: 'body:first', - immediateUpdates: false, - title: '', - templates: { - leftArrow: '«', - rightArrow: '»' - }, - showWeekDays: true - }; - var locale_opts = $.fn.datepicker.locale_opts = [ - 'format', - 'rtl', - 'weekStart' - ]; - $.fn.datepicker.Constructor = Datepicker; - var dates = $.fn.datepicker.dates = { - en: { - days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], - daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], - months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], - monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - today: "Today", - clear: "Clear", - titleFormat: "MM yyyy" - } - }; - - var DPGlobal = { - viewModes: [ - { - names: ['days', 'month'], - clsName: 'days', - e: 'changeMonth' - }, - { - names: ['months', 'year'], - clsName: 'months', - e: 'changeYear', - navStep: 1 - }, - { - names: ['years', 'decade'], - clsName: 'years', - e: 'changeDecade', - navStep: 10 - }, - { - names: ['decades', 'century'], - clsName: 'decades', - e: 'changeCentury', - navStep: 100 - }, - { - names: ['centuries', 'millennium'], - clsName: 'centuries', - e: 'changeMillennium', - navStep: 1000 - } - ], - validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g, - nonpunctuation: /[^ -\/:-@\u5e74\u6708\u65e5\[-`{-~\t\n\r]+/g, - parseFormat: function(format){ - if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function') - return format; - // IE treats \0 as a string end in inputs (truncating the value), - // so it's a bad format delimiter, anyway - var separators = format.replace(this.validParts, '\0').split('\0'), - parts = format.match(this.validParts); - if (!separators || !separators.length || !parts || parts.length === 0){ - throw new Error("Invalid date format."); - } - return {separators: separators, parts: parts}; - }, - parseDate: function(date, format, language, assumeNearby){ - if (!date) - return undefined; - if (date instanceof Date) - return date; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - if (format.toValue) - return format.toValue(date, format, language); - var fn_map = { - d: 'moveDay', - m: 'moveMonth', - w: 'moveWeek', - y: 'moveYear' - }, - dateAliases = { - yesterday: '-1d', - today: '+0d', - tomorrow: '+1d' - }, - parts, part, dir, i, fn; - if (date in dateAliases){ - date = dateAliases[date]; - } - if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/i.test(date)){ - parts = date.match(/([\-+]\d+)([dmwy])/gi); - date = new Date(); - for (i=0; i < parts.length; i++){ - part = parts[i].match(/([\-+]\d+)([dmwy])/i); - dir = Number(part[1]); - fn = fn_map[part[2].toLowerCase()]; - date = Datepicker.prototype[fn](date, dir); - } - return Datepicker.prototype._zero_utc_time(date); - } - - parts = date && date.match(this.nonpunctuation) || []; - - function applyNearbyYear(year, threshold){ - if (threshold === true) - threshold = 10; - - // if year is 2 digits or less, than the user most likely is trying to get a recent century - if (year < 100){ - year += 2000; - // if the new year is more than threshold years in advance, use last century - if (year > ((new Date()).getFullYear()+threshold)){ - year -= 100; - } - } - - return year; - } - - var parsed = {}, - setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'], - setters_map = { - yyyy: function(d,v){ - return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v); - }, - m: function(d,v){ - if (isNaN(d)) - return d; - v -= 1; - while (v < 0) v += 12; - v %= 12; - d.setUTCMonth(v); - while (d.getUTCMonth() !== v) - d.setUTCDate(d.getUTCDate()-1); - return d; - }, - d: function(d,v){ - return d.setUTCDate(v); - } - }, - val, filtered; - setters_map['yy'] = setters_map['yyyy']; - setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; - setters_map['dd'] = setters_map['d']; - date = UTCToday(); - var fparts = format.parts.slice(); - // Remove noop parts - if (parts.length !== fparts.length){ - fparts = $(fparts).filter(function(i,p){ - return $.inArray(p, setters_order) !== -1; - }).toArray(); - } - // Process remainder - function match_part(){ - var m = this.slice(0, parts[i].length), - p = parts[i].slice(0, m.length); - return m.toLowerCase() === p.toLowerCase(); - } - if (parts.length === fparts.length){ - var cnt; - for (i=0, cnt = fparts.length; i < cnt; i++){ - val = parseInt(parts[i], 10); - part = fparts[i]; - if (isNaN(val)){ - switch (part){ - case 'MM': - filtered = $(dates[language].months).filter(match_part); - val = $.inArray(filtered[0], dates[language].months) + 1; - break; - case 'M': - filtered = $(dates[language].monthsShort).filter(match_part); - val = $.inArray(filtered[0], dates[language].monthsShort) + 1; - break; - } - } - parsed[part] = val; - } - var _date, s; - for (i=0; i < setters_order.length; i++){ - s = setters_order[i]; - if (s in parsed && !isNaN(parsed[s])){ - _date = new Date(date); - setters_map[s](_date, parsed[s]); - if (!isNaN(_date)) - date = _date; - } - } - } - return date; - }, - formatDate: function(date, format, language){ - if (!date) - return ''; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - if (format.toDisplay) - return format.toDisplay(date, format, language); - var val = { - d: date.getUTCDate(), - D: dates[language].daysShort[date.getUTCDay()], - DD: dates[language].days[date.getUTCDay()], - m: date.getUTCMonth() + 1, - M: dates[language].monthsShort[date.getUTCMonth()], - MM: dates[language].months[date.getUTCMonth()], - yy: date.getUTCFullYear().toString().substring(2), - yyyy: date.getUTCFullYear() - }; - val.dd = (val.d < 10 ? '0' : '') + val.d; - val.mm = (val.m < 10 ? '0' : '') + val.m; - date = []; - var seps = $.extend([], format.separators); - for (var i=0, cnt = format.parts.length; i <= cnt; i++){ - if (seps.length) - date.push(seps.shift()); - date.push(val[format.parts[i]]); - } - return date.join(''); - }, - headTemplate: ''+ - ''+ - ''+ - ''+ - ''+ - ''+defaults.templates.leftArrow+''+ - ''+ - ''+defaults.templates.rightArrow+''+ - ''+ - '', - contTemplate: '', - footTemplate: ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '' - }; - DPGlobal.template = '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - ''+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'; - - $.fn.datepicker.DPGlobal = DPGlobal; - - - /* DATEPICKER NO CONFLICT - * =================== */ - - $.fn.datepicker.noConflict = function(){ - $.fn.datepicker = old; - return this; - }; - - /* DATEPICKER VERSION - * =================== */ - $.fn.datepicker.version = '1.9.0'; - - $.fn.datepicker.deprecated = function(msg){ - var console = window.console; - if (console && console.warn) { - console.warn('DEPRECATED: ' + msg); - } - }; - - - /* DATEPICKER DATA-API - * ================== */ - - $(document).on( - 'focus.datepicker.data-api click.datepicker.data-api', - '[data-provide="datepicker"]', - function(e){ - var $this = $(this); - if ($this.data('datepicker')) - return; - e.preventDefault(); - // component click requires us to explicitly show it - datepickerPlugin.call($this, 'show'); - } - ); - $(function(){ - datepickerPlugin.call($('[data-provide="datepicker-inline"]')); - }); - -})); diff --git a/shiny/www/shared/datepicker/scss/build3.scss b/shiny/www/shared/datepicker/scss/build3.scss deleted file mode 100644 index 3a9d55b7f..000000000 --- a/shiny/www/shared/datepicker/scss/build3.scss +++ /dev/null @@ -1,77 +0,0 @@ -// Datepicker .scss buildfile. Includes select mixins/variables from bootstrap -// and imports the included datepicker.scss to output a minimal datepicker.css -// -// Usage: -// lessc build3.scss datepicker.css -// -// Variables and mixins copied from Bootstrap 3.3.5 - -// These are BS3 variables that are used in datepicker3.scss. So, when compiling against -// a BS3 bslib theme, these variables should already be defined. Here we set -// *defaults* for these variables based on BS4 variables, so this scss can work for -// both BS3 and BS4 -$gray: mix($body-bg, $body-color, 33.5%) !default; -$gray-light: mix($body-bg, $body-color, 46.7%) !default; -$gray-lighter: mix($body-bg, $body-color, 90%) !default; -$brand-primary: $primary !default; -$btn-primary-color: $body-bg !default; -$btn-primary-bg: $primary !default; -$btn-primary-border: mix($body-color, $btn-primary-bg, 5%) !default; -$state-info-bg: mix($body-bg, $info, 80%) !default; -$border-radius-base: $border-radius !default; -$dropdown-border: $dropdown-border-color !default; -// These variables are also used in datepicker3.scss, but we don't need to set them since -// they're the same in BS3 and BS4 -//$line-height-base: 1.428571429; -//$btn-link-disabled-color: $gray-light; -//$dropdown-bg: #fff; - - - - - -@mixin button-variant($background, $border) { - $color: color-contrast($background); - - color: $color; - background-color: $background; - border-color: $border; - - &:focus, - &.focus { - color: $color; - background-color: mix($background, $color, 90%); - border-color: mix($border, $color, 75%); - } - &:hover { - color: $color; - background-color: mix($background, $color, 50%); - border-color: mix($border, $color, 88%); - } - &:active, - &.active { - color: $color; - background-color: mix($background, $color, 90%); - border-color: mix($border, $color, 88%); - - &:hover, - &:focus, - &.focus { - color: $color; - background-color: mix($background, $color, 83%); - border-color: mix($border, $color, 75%); - } - } - &.disabled, - &[disabled], - fieldset[disabled] & { - &:hover, - &:focus, - &.focus { - background-color: $background; - border-color: $border; - } - } -} - -@import "datepicker3.scss"; diff --git a/shiny/www/shared/datepicker/scss/datepicker3.scss b/shiny/www/shared/datepicker/scss/datepicker3.scss deleted file mode 100644 index e1b7585c8..000000000 --- a/shiny/www/shared/datepicker/scss/datepicker3.scss +++ /dev/null @@ -1,270 +0,0 @@ -// Both BS3 and BS4 define a border radius mixin, but just in case -// we're trying to compile this without bootstrapSass -@mixin border-radius-shim($radius) { - @if mixin-exists("border-radius") { - @include border-radius($radius); - } @else { - border-radius: $radius; - } -} - -.datepicker { - @include border-radius-shim($border-radius-base); - &-inline { - width: 220px; - } - direction: ltr; - &-rtl { - direction: rtl; - &.dropdown-menu { left: auto; } - table tr td span { - float: right; - } - } - &-dropdown { - top: 0; - left: 0; - padding: 4px; - &:before { - content: ''; - display: inline-block; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-bottom: 7px solid $dropdown-border; - border-top: 0; - border-bottom-color: rgba(0,0,0,.2); - position: absolute; - } - &:after { - content: ''; - display: inline-block; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid $dropdown-bg; - border-top: 0; - position: absolute; - } - &.datepicker-orient-left:before { left: 6px; } - &.datepicker-orient-left:after { left: 7px; } - &.datepicker-orient-right:before { right: 6px; } - &.datepicker-orient-right:after { right: 7px; } - &.datepicker-orient-bottom:before { top: -7px; } - &.datepicker-orient-bottom:after { top: -6px; } - &.datepicker-orient-top:before { - bottom: -7px; - border-bottom: 0; - border-top: 7px solid $dropdown-border; - } - &.datepicker-orient-top:after { - bottom: -6px; - border-bottom: 0; - border-top: 6px solid $dropdown-bg; - } - } - table { - margin: 0; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - tr { - td, th { - text-align: center; - width: 30px; - height: 30px; - @include border-radius-shim(4px); - border: none; - } - } - } - // Inline display inside a table presents some problems with - // border and background colors. - .table-striped & table tr { - td, th { - background-color: transparent; - } - } - table tr td { - &.old, - &.new { - color: $btn-link-disabled-color; - } - &.day:hover, - &.focused { - color: color-contrast($gray-lighter); - background: $gray-lighter; - cursor: pointer; - } - &.disabled, - &.disabled:hover { - background: none; - color: $btn-link-disabled-color; - cursor: default; - } - &.highlighted { - $highlighted-bg: $state-info-bg; - @include button-variant($highlighted-bg, darken($highlighted-bg, 20%)); - border-radius: 0; - - &.focused { - background: darken($highlighted-bg, 10%); - } - - &.disabled, - &.disabled:active { - background: $highlighted-bg; - color: $btn-link-disabled-color; - } - } - &.today { - $today-bg: lighten(orange, 30%); - @include button-variant($today-bg, darken($today-bg, 20%)); - - &.focused { - background: darken($today-bg, 10%); - } - - &.disabled, - &.disabled:active { - background: $today-bg; - color: $btn-link-disabled-color; - } - } - &.range { - $range-bg: $gray-lighter; - @include button-variant($range-bg, darken($range-bg, 20%)); - border-radius: 0; - - &.focused { - background: darken($range-bg, 10%); - } - - &.disabled, - &.disabled:active { - background: $range-bg; - color: $btn-link-disabled-color; - } - } - &.range.highlighted { - $range-highlighted-bg: mix($state-info-bg, $gray-lighter, 50%); - @include button-variant($range-highlighted-bg, darken($range-highlighted-bg, 20%)); - - &.focused { - background: darken($range-highlighted-bg, 10%); - } - - &.disabled, - &.disabled:active { - background: $range-highlighted-bg; - color: $btn-link-disabled-color; - } - } - &.range.today { - $range-today-bg: mix(orange, $gray-lighter, 50%); - @include button-variant($range-today-bg, darken($range-today-bg, 20%)); - - &.disabled, - &.disabled:active { - background: $range-today-bg; - color: $btn-link-disabled-color; - } - } - &.selected, - &.selected.highlighted { - @include button-variant($gray-light, $gray); - text-shadow: 0 -1px 0 rgba(0,0,0,.25); - } - &.active, - &.active.highlighted { - @include button-variant($btn-primary-bg, $btn-primary-border); - text-shadow: 0 -1px 0 rgba(0,0,0,.25); - } - span { - display: block; - width: 23%; - height: 54px; - line-height: 54px; - float: left; - margin: 1%; - cursor: pointer; - @include border-radius-shim(4px); - &:hover, - &.focused { - color: color-contrast($gray-lighter); - background: $gray-lighter; - } - &.disabled, - &.disabled:hover { - background: none; - color: $btn-link-disabled-color; - cursor: default; - } - &.active, - &.active:hover, - &.active.disabled, - &.active.disabled:hover { - @include button-variant($btn-primary-bg, $btn-primary-border); - text-shadow: 0 -1px 0 rgba(0,0,0,.25); - } - &.old, - &.new { - color: $btn-link-disabled-color; - } - } - } - - .datepicker-switch { - width: 145px; - } - - .datepicker-switch, - .prev, - .next, - tfoot tr th { - cursor: pointer; - &:hover { - color: color-contrast($gray-lighter); - background: $gray-lighter; - } - } - - .prev, .next { - &.disabled { - visibility: hidden; - } - } - - // Basic styling for calendar-week cells - .cw { - font-size: 10px; - width: 12px; - padding: 0 2px 0 5px; - vertical-align: middle; - } -} -.input-group.date .input-group-addon { - cursor: pointer; -} -.input-daterange { - width: 100%; - input { - text-align: center; - } - input:first-child { - @include border-radius-shim(3px 0 0 3px); - } - input:last-child { - @include border-radius-shim(0 3px 3px 0); - } - .input-group-addon { - width: auto; - min-width: 16px; - padding: 4px 5px; - line-height: $line-height-base; - border-width: 1px 0; - margin-left: -5px; - margin-right: -5px; - } -} diff --git a/shiny/www/shared/htmltools/_version.json b/shiny/www/shared/htmltools/_version.json index 98029b959..1897b91f6 100644 --- a/shiny/www/shared/htmltools/_version.json +++ b/shiny/www/shared/htmltools/_version.json @@ -1,5 +1,5 @@ { "note!": "This file is auto-generated by scripts/htmlDependencies.R", "package": "htmltools", - "version": "Github (rstudio/htmltools@9338b7f3e2ed7b3fef8fd813904b9b05281344aa)" + "version": "Github (rstudio/htmltools@94360318c5d5fa4cc95a40fe4a9c94caea8c83f1)" } diff --git a/shiny/www/shared/htmltools/fill/fill.css b/shiny/www/shared/htmltools/fill/fill.css index 4c2711ec9..74ff612c1 100644 --- a/shiny/www/shared/htmltools/fill/fill.css +++ b/shiny/www/shared/htmltools/fill/fill.css @@ -1,21 +1,19 @@ .html-fill-container { display: flex; flex-direction: column; - width: 100%; - min-width: 0; + /* Prevent the container from expanding vertically or horizontally beyond its + parent's constraints. */ min-height: 0; + min-width: 0; } .html-fill-container > .html-fill-item { /* Fill items can grow and shrink freely within available vertical space in fillable container */ flex: 1 1 auto; - overflow: auto; - width: 100%; + min-height: 0; + min-width: 0; } .html-fill-container > :not(.html-fill-item) { /* Prevent shrinking or growing of non-fill items */ flex: 0 0 auto; } -.html-fill-container > .html-fill-item.html-fill-item-overflow-hidden { - overflow: hidden; -} diff --git a/shiny/www/shared/ionrangeslider/css/ion.rangeSlider.css b/shiny/www/shared/ionrangeslider/css/ion.rangeSlider.css index 9decf1b46..fec168031 100644 --- a/shiny/www/shared/ionrangeslider/css/ion.rangeSlider.css +++ b/shiny/www/shared/ionrangeslider/css/ion.rangeSlider.css @@ -1,5 +1,4 @@ @charset "UTF-8"; -/*-- scss:defaults --*/ /* 'shiny' skin for Ion.RangeSlider, largely based on the 'big' skin, but with smaller dimensions, grayscale grid text, and without gradients © Posit, PBC, 2023 © RStudio, Inc, 2014 @@ -173,7 +172,7 @@ top: 32px; height: 1px; background: none; - background-color: #707782; + background-color: RGBA(var(--bs-emphasis-color-rgb, 0, 0, 0), 0.65); border: none; border-radius: 1px; overflow: visible; @@ -237,7 +236,7 @@ } .irs--shiny .irs-handle.state_hover, .irs--shiny .irs-handle:hover { - background: #268fcb; + background: rgba(0, 123, 194, 0.85); } .irs--shiny .irs-min, @@ -245,7 +244,7 @@ top: 0; padding: 1px 3px; text-shadow: none; - background-color: #e9ecef; + background-color: RGBA(var(--bs-emphasis-color-rgb, 0, 0, 0), 0.1); border-radius: 3px; font-size: 10px; line-height: 1.333; @@ -279,12 +278,12 @@ } .irs--shiny .irs-grid-pol { - background-color: #707782; + background-color: RGBA(var(--bs-emphasis-color-rgb, 0, 0, 0), 0.65); } .irs--shiny .irs-grid-text { bottom: 5px; - color: #343A46; + color: RGBA(var(--bs-emphasis-color-rgb, 0, 0, 0), 0.85); } .irs--shiny .irs-grid-pol.small { @@ -295,7 +294,6 @@ /* shiny preset styles */ -/*-- scss:defaults --*/ .irs.irs--shiny { margin-top: 3px; } diff --git a/shiny/www/shared/ionrangeslider/js/ion.rangeSlider.js b/shiny/www/shared/ionrangeslider/js/ion.rangeSlider.js deleted file mode 100644 index dc83c9863..000000000 --- a/shiny/www/shared/ionrangeslider/js/ion.rangeSlider.js +++ /dev/null @@ -1,2456 +0,0 @@ -// Ion.RangeSlider -// version 2.3.1 Build: 382 -// © Denis Ineshin, 2019 -// https://github.com/IonDen -// -// Project page: http://ionden.com/a/plugins/ion.rangeSlider/en.html -// GitHub page: https://github.com/IonDen/ion.rangeSlider -// -// Released under MIT licence: -// http://ionden.com/a/plugins/licence-en.html -// ===================================================================================================================== - -;(function(factory) { - if ((typeof jQuery === 'undefined' || !jQuery) && typeof define === "function" && define.amd) { - define(["jquery"], function (jQuery) { - return factory(jQuery, document, window, navigator); - }); - } else if ((typeof jQuery === 'undefined' || !jQuery) && typeof exports === "object") { - factory(require("jquery"), document, window, navigator); - } else { - factory(jQuery, document, window, navigator); - } -} (function ($, document, window, navigator, undefined) { - "use strict"; - - // ================================================================================================================= - // Service - - var plugin_count = 0; - - // IE8 fix - var is_old_ie = (function () { - var n = navigator.userAgent, - r = /msie\s\d+/i, - v; - if (n.search(r) > 0) { - v = r.exec(n).toString(); - v = v.split(" ")[1]; - if (v < 9) { - $("html").addClass("lt-ie9"); - return true; - } - } - return false; - } ()); - if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { - - var target = this; - var slice = [].slice; - - if (typeof target != "function") { - throw new TypeError(); - } - - var args = slice.call(arguments, 1), - bound = function () { - - if (this instanceof bound) { - - var F = function(){}; - F.prototype = target.prototype; - var self = new F(); - - var result = target.apply( - self, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return self; - - } else { - - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - - return bound; - }; - } - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function(searchElement, fromIndex) { - var k; - if (this == null) { - throw new TypeError('"this" is null or not defined'); - } - var O = Object(this); - var len = O.length >>> 0; - if (len === 0) { - return -1; - } - var n = +fromIndex || 0; - if (Math.abs(n) === Infinity) { - n = 0; - } - if (n >= len) { - return -1; - } - k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); - while (k < len) { - if (k in O && O[k] === searchElement) { - return k; - } - k++; - } - return -1; - }; - } - - - - // ================================================================================================================= - // Template - - var base_html = - '' + - '' + - '01' + - '000' + - '' + - ''; - - var single_html = - '' + - '' + - ''; - - var double_html = - '' + - '' + - '' + - '' + - ''; - - var disable_html = - ''; - - - - // ================================================================================================================= - // Core - - /** - * Main plugin constructor - * - * @param input {Object} link to base input element - * @param options {Object} slider config - * @param plugin_count {Number} - * @constructor - */ - var IonRangeSlider = function (input, options, plugin_count) { - this.VERSION = "2.3.1"; - this.input = input; - this.plugin_count = plugin_count; - this.current_plugin = 0; - this.calc_count = 0; - this.update_tm = 0; - this.old_from = 0; - this.old_to = 0; - this.old_min_interval = null; - this.raf_id = null; - this.dragging = false; - this.force_redraw = false; - this.no_diapason = false; - this.has_tab_index = true; - this.is_key = false; - this.is_update = false; - this.is_start = true; - this.is_finish = false; - this.is_active = false; - this.is_resize = false; - this.is_click = false; - - options = options || {}; - - // cache for links to all DOM elements - this.$cache = { - win: $(window), - body: $(document.body), - input: $(input), - cont: null, - rs: null, - min: null, - max: null, - from: null, - to: null, - single: null, - bar: null, - line: null, - s_single: null, - s_from: null, - s_to: null, - shad_single: null, - shad_from: null, - shad_to: null, - edge: null, - grid: null, - grid_labels: [] - }; - - // storage for measure variables - this.coords = { - // left - x_gap: 0, - x_pointer: 0, - - // width - w_rs: 0, - w_rs_old: 0, - w_handle: 0, - - // percents - p_gap: 0, - p_gap_left: 0, - p_gap_right: 0, - p_step: 0, - p_pointer: 0, - p_handle: 0, - p_single_fake: 0, - p_single_real: 0, - p_from_fake: 0, - p_from_real: 0, - p_to_fake: 0, - p_to_real: 0, - p_bar_x: 0, - p_bar_w: 0, - - // grid - grid_gap: 0, - big_num: 0, - big: [], - big_w: [], - big_p: [], - big_x: [] - }; - - // storage for labels measure variables - this.labels = { - // width - w_min: 0, - w_max: 0, - w_from: 0, - w_to: 0, - w_single: 0, - - // percents - p_min: 0, - p_max: 0, - p_from_fake: 0, - p_from_left: 0, - p_to_fake: 0, - p_to_left: 0, - p_single_fake: 0, - p_single_left: 0 - }; - - - - /** - * get and validate config - */ - var $inp = this.$cache.input, - val = $inp.prop("value"), - config, config_from_data, prop; - - // default config - config = { - skin: "flat", - type: "single", - - min: 10, - max: 100, - from: null, - to: null, - step: 1, - - min_interval: 0, - max_interval: 0, - drag_interval: false, - - values: [], - p_values: [], - - from_fixed: false, - from_min: null, - from_max: null, - from_shadow: false, - - to_fixed: false, - to_min: null, - to_max: null, - to_shadow: false, - - prettify_enabled: true, - prettify_separator: " ", - prettify: null, - - force_edges: false, - - keyboard: true, - - grid: false, - grid_margin: true, - grid_num: 4, - grid_snap: false, - - hide_min_max: false, - hide_from_to: false, - - prefix: "", - postfix: "", - max_postfix: "", - decorate_both: true, - values_separator: " — ", - - input_values_separator: ";", - - disable: false, - block: false, - - extra_classes: "", - - scope: null, - onStart: null, - onChange: null, - onFinish: null, - onUpdate: null - }; - - - // check if base element is input - if ($inp[0].nodeName !== "INPUT") { - console && console.warn && console.warn("Base element should be !", $inp[0]); - } - - - // config from data-attributes extends js config - config_from_data = { - skin: $inp.data("skin"), - type: $inp.data("type"), - - min: $inp.data("min"), - max: $inp.data("max"), - from: $inp.data("from"), - to: $inp.data("to"), - step: $inp.data("step"), - - min_interval: $inp.data("minInterval"), - max_interval: $inp.data("maxInterval"), - drag_interval: $inp.data("dragInterval"), - - values: $inp.data("values"), - - from_fixed: $inp.data("fromFixed"), - from_min: $inp.data("fromMin"), - from_max: $inp.data("fromMax"), - from_shadow: $inp.data("fromShadow"), - - to_fixed: $inp.data("toFixed"), - to_min: $inp.data("toMin"), - to_max: $inp.data("toMax"), - to_shadow: $inp.data("toShadow"), - - prettify_enabled: $inp.data("prettifyEnabled"), - prettify_separator: $inp.data("prettifySeparator"), - - force_edges: $inp.data("forceEdges"), - - keyboard: $inp.data("keyboard"), - - grid: $inp.data("grid"), - grid_margin: $inp.data("gridMargin"), - grid_num: $inp.data("gridNum"), - grid_snap: $inp.data("gridSnap"), - - hide_min_max: $inp.data("hideMinMax"), - hide_from_to: $inp.data("hideFromTo"), - - prefix: $inp.data("prefix"), - postfix: $inp.data("postfix"), - max_postfix: $inp.data("maxPostfix"), - decorate_both: $inp.data("decorateBoth"), - values_separator: $inp.data("valuesSeparator"), - - input_values_separator: $inp.data("inputValuesSeparator"), - - disable: $inp.data("disable"), - block: $inp.data("block"), - - extra_classes: $inp.data("extraClasses"), - }; - config_from_data.values = config_from_data.values && config_from_data.values.split(","); - - for (prop in config_from_data) { - if (config_from_data.hasOwnProperty(prop)) { - if (config_from_data[prop] === undefined || config_from_data[prop] === "") { - delete config_from_data[prop]; - } - } - } - - - // input value extends default config - if (val !== undefined && val !== "") { - val = val.split(config_from_data.input_values_separator || options.input_values_separator || ";"); - - if (val[0] && val[0] == +val[0]) { - val[0] = +val[0]; - } - if (val[1] && val[1] == +val[1]) { - val[1] = +val[1]; - } - - if (options && options.values && options.values.length) { - config.from = val[0] && options.values.indexOf(val[0]); - config.to = val[1] && options.values.indexOf(val[1]); - } else { - config.from = val[0] && +val[0]; - config.to = val[1] && +val[1]; - } - } - - - - // js config extends default config - $.extend(config, options); - - - // data config extends config - $.extend(config, config_from_data); - this.options = config; - - - - // validate config, to be sure that all data types are correct - this.update_check = {}; - this.validate(); - - - - // default result object, returned to callbacks - this.result = { - input: this.$cache.input, - slider: null, - - min: this.options.min, - max: this.options.max, - - from: this.options.from, - from_percent: 0, - from_value: null, - - to: this.options.to, - to_percent: 0, - to_value: null - }; - - - - this.init(); - }; - - IonRangeSlider.prototype = { - - /** - * Starts or updates the plugin instance - * - * @param [is_update] {boolean} - */ - init: function (is_update) { - this.no_diapason = false; - this.coords.p_step = this.convertToPercent(this.options.step, true); - - this.target = "base"; - - this.toggleInput(); - this.append(); - this.setMinMax(); - - if (is_update) { - this.force_redraw = true; - this.calc(true); - - // callbacks called - this.callOnUpdate(); - } else { - this.force_redraw = true; - this.calc(true); - - // callbacks called - this.callOnStart(); - } - - this.updateScene(); - }, - - /** - * Appends slider template to a DOM - */ - append: function () { - var container_html = ''; - this.$cache.input.before(container_html); - this.$cache.input.prop("readonly", true); - this.$cache.cont = this.$cache.input.prev(); - this.result.slider = this.$cache.cont; - - this.$cache.cont.html(base_html); - this.$cache.rs = this.$cache.cont.find(".irs"); - this.$cache.min = this.$cache.cont.find(".irs-min"); - this.$cache.max = this.$cache.cont.find(".irs-max"); - this.$cache.from = this.$cache.cont.find(".irs-from"); - this.$cache.to = this.$cache.cont.find(".irs-to"); - this.$cache.single = this.$cache.cont.find(".irs-single"); - this.$cache.line = this.$cache.cont.find(".irs-line"); - this.$cache.grid = this.$cache.cont.find(".irs-grid"); - - if (this.options.type === "single") { - this.$cache.cont.append(single_html); - this.$cache.bar = this.$cache.cont.find(".irs-bar"); - this.$cache.edge = this.$cache.cont.find(".irs-bar-edge"); - this.$cache.s_single = this.$cache.cont.find(".single"); - this.$cache.from[0].style.visibility = "hidden"; - this.$cache.to[0].style.visibility = "hidden"; - this.$cache.shad_single = this.$cache.cont.find(".shadow-single"); - } else { - this.$cache.cont.append(double_html); - this.$cache.bar = this.$cache.cont.find(".irs-bar"); - this.$cache.s_from = this.$cache.cont.find(".from"); - this.$cache.s_to = this.$cache.cont.find(".to"); - this.$cache.shad_from = this.$cache.cont.find(".shadow-from"); - this.$cache.shad_to = this.$cache.cont.find(".shadow-to"); - - this.setTopHandler(); - } - - if (this.options.hide_from_to) { - this.$cache.from[0].style.display = "none"; - this.$cache.to[0].style.display = "none"; - this.$cache.single[0].style.display = "none"; - } - - this.appendGrid(); - - if (this.options.disable) { - this.appendDisableMask(); - this.$cache.input[0].disabled = true; - } else { - this.$cache.input[0].disabled = false; - this.removeDisableMask(); - this.bindEvents(); - } - - // block only if not disabled - if (!this.options.disable) { - if (this.options.block) { - this.appendDisableMask(); - } else { - this.removeDisableMask(); - } - } - - if (this.options.drag_interval) { - this.$cache.bar[0].style.cursor = "ew-resize"; - } - }, - - /** - * Determine which handler has a priority - * works only for double slider type - */ - setTopHandler: function () { - var min = this.options.min, - max = this.options.max, - from = this.options.from, - to = this.options.to; - - if (from > min && to === max) { - this.$cache.s_from.addClass("type_last"); - } else if (to < max) { - this.$cache.s_to.addClass("type_last"); - } - }, - - /** - * Determine which handles was clicked last - * and which handler should have hover effect - * - * @param target {String} - */ - changeLevel: function (target) { - switch (target) { - case "single": - this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_single_fake); - this.$cache.s_single.addClass("state_hover"); - break; - case "from": - this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake); - this.$cache.s_from.addClass("state_hover"); - this.$cache.s_from.addClass("type_last"); - this.$cache.s_to.removeClass("type_last"); - break; - case "to": - this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_to_fake); - this.$cache.s_to.addClass("state_hover"); - this.$cache.s_to.addClass("type_last"); - this.$cache.s_from.removeClass("type_last"); - break; - case "both": - this.coords.p_gap_left = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake); - this.coords.p_gap_right = this.toFixed(this.coords.p_to_fake - this.coords.p_pointer); - this.$cache.s_to.removeClass("type_last"); - this.$cache.s_from.removeClass("type_last"); - break; - } - }, - - /** - * Then slider is disabled - * appends extra layer with opacity - */ - appendDisableMask: function () { - this.$cache.cont.append(disable_html); - this.$cache.cont.addClass("irs-disabled"); - }, - - /** - * Then slider is not disabled - * remove disable mask - */ - removeDisableMask: function () { - this.$cache.cont.remove(".irs-disable-mask"); - this.$cache.cont.removeClass("irs-disabled"); - }, - - /** - * Remove slider instance - * and unbind all events - */ - remove: function () { - this.$cache.cont.remove(); - this.$cache.cont = null; - - this.$cache.line.off("keydown.irs_" + this.plugin_count); - - this.$cache.body.off("touchmove.irs_" + this.plugin_count); - this.$cache.body.off("mousemove.irs_" + this.plugin_count); - - this.$cache.win.off("touchend.irs_" + this.plugin_count); - this.$cache.win.off("mouseup.irs_" + this.plugin_count); - - if (is_old_ie) { - this.$cache.body.off("mouseup.irs_" + this.plugin_count); - this.$cache.body.off("mouseleave.irs_" + this.plugin_count); - } - - this.$cache.grid_labels = []; - this.coords.big = []; - this.coords.big_w = []; - this.coords.big_p = []; - this.coords.big_x = []; - - cancelAnimationFrame(this.raf_id); - }, - - /** - * bind all slider events - */ - bindEvents: function () { - if (this.no_diapason) { - return; - } - - this.$cache.body.on("touchmove.irs_" + this.plugin_count, this.pointerMove.bind(this)); - this.$cache.body.on("mousemove.irs_" + this.plugin_count, this.pointerMove.bind(this)); - - this.$cache.win.on("touchend.irs_" + this.plugin_count, this.pointerUp.bind(this)); - this.$cache.win.on("mouseup.irs_" + this.plugin_count, this.pointerUp.bind(this)); - - this.$cache.line.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - this.$cache.line.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - - this.$cache.line.on("focus.irs_" + this.plugin_count, this.pointerFocus.bind(this)); - - if (this.options.drag_interval && this.options.type === "double") { - this.$cache.bar.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "both")); - this.$cache.bar.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "both")); - } else { - this.$cache.bar.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - this.$cache.bar.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - } - - if (this.options.type === "single") { - this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")); - this.$cache.s_single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")); - this.$cache.shad_single.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - - this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")); - this.$cache.s_single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single")); - this.$cache.edge.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - this.$cache.shad_single.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - } else { - this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, null)); - this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, null)); - - this.$cache.from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")); - this.$cache.s_from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")); - this.$cache.to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")); - this.$cache.s_to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")); - this.$cache.shad_from.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - this.$cache.shad_to.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - - this.$cache.from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")); - this.$cache.s_from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from")); - this.$cache.to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")); - this.$cache.s_to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to")); - this.$cache.shad_from.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - this.$cache.shad_to.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); - } - - if (this.options.keyboard) { - this.$cache.line.on("keydown.irs_" + this.plugin_count, this.key.bind(this, "keyboard")); - } - - if (is_old_ie) { - this.$cache.body.on("mouseup.irs_" + this.plugin_count, this.pointerUp.bind(this)); - this.$cache.body.on("mouseleave.irs_" + this.plugin_count, this.pointerUp.bind(this)); - } - }, - - /** - * Focus with tabIndex - * - * @param e {Object} event object - */ - pointerFocus: function (e) { - if (!this.target) { - var x; - var $handle; - - if (this.options.type === "single") { - $handle = this.$cache.single; - } else { - $handle = this.$cache.from; - } - - x = $handle.offset().left; - x += ($handle.width() / 2) - 1; - - this.pointerClick("single", {preventDefault: function () {}, stopPropagation: function () {}, pageX: x}); - } - }, - - /** - * Mousemove or touchmove - * only for handlers - * - * @param e {Object} event object - */ - pointerMove: function (e) { - if (!this.dragging) { - return; - } - - var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX; - this.coords.x_pointer = x - this.coords.x_gap; - - this.calc(); - }, - - /** - * Mouseup or touchend - * only for handlers - * - * @param e {Object} event object - */ - pointerUp: function (e) { - if (this.current_plugin !== this.plugin_count) { - return; - } - - if (this.is_active) { - this.is_active = false; - } else { - return; - } - - this.$cache.cont.find(".state_hover").removeClass("state_hover"); - - this.force_redraw = true; - - if (is_old_ie) { - $("*").prop("unselectable", false); - } - - this.updateScene(); - this.restoreOriginalMinInterval(); - - // callbacks call - if ($.contains(this.$cache.cont[0], e.target) || this.dragging) { - this.callOnFinish(); - } - - this.dragging = false; - }, - - /** - * Mousedown or touchstart - * only for handlers - * - * @param target {String|null} - * @param e {Object} event object - */ - pointerDown: function (target, e) { - e.preventDefault(); - e.stopPropagation(); - var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX; - if (e.button === 2) { - return; - } - - if (target === "both") { - this.setTempMinInterval(); - } - - if (!target) { - target = this.target || "from"; - } - - this.current_plugin = this.plugin_count; - this.target = target; - - this.is_active = true; - this.dragging = true; - - this.coords.x_gap = this.$cache.rs.offset().left; - this.coords.x_pointer = x - this.coords.x_gap; - - this.calcPointerPercent(); - this.changeLevel(target); - - if (is_old_ie) { - $("*").prop("unselectable", true); - } - - this.$cache.line.trigger("focus"); - - this.updateScene(); - }, - - /** - * Mousedown or touchstart - * for other slider elements, like diapason line - * - * @param target {String} - * @param e {Object} event object - */ - pointerClick: function (target, e) { - e.preventDefault(); - e.stopPropagation(); - var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX; - if (e.button === 2) { - return; - } - - this.current_plugin = this.plugin_count; - this.target = target; - - this.is_click = true; - this.coords.x_gap = this.$cache.rs.offset().left; - this.coords.x_pointer = +(x - this.coords.x_gap).toFixed(); - - this.force_redraw = true; - this.calc(); - - this.$cache.line.trigger("focus"); - }, - - /** - * Keyborard controls for focused slider - * - * @param target {String} - * @param e {Object} event object - * @returns {boolean|undefined} - */ - key: function (target, e) { - if (this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) { - return; - } - - switch (e.which) { - case 83: // W - case 65: // A - case 40: // DOWN - case 37: // LEFT - e.preventDefault(); - this.moveByKey(false); - break; - - case 87: // S - case 68: // D - case 38: // UP - case 39: // RIGHT - e.preventDefault(); - this.moveByKey(true); - break; - } - - return true; - }, - - /** - * Move by key - * - * @param right {boolean} direction to move - */ - moveByKey: function (right) { - var p = this.coords.p_pointer; - var p_step = (this.options.max - this.options.min) / 100; - p_step = this.options.step / p_step; - - if (right) { - p += p_step; - } else { - p -= p_step; - } - - this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p); - this.is_key = true; - this.calc(); - }, - - /** - * Set visibility and content - * of Min and Max labels - */ - setMinMax: function () { - if (!this.options) { - return; - } - - if (this.options.hide_min_max) { - this.$cache.min[0].style.display = "none"; - this.$cache.max[0].style.display = "none"; - return; - } - - if (this.options.values.length) { - this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])); - this.$cache.max.html(this.decorate(this.options.p_values[this.options.max])); - } else { - var min_pretty = this._prettify(this.options.min); - var max_pretty = this._prettify(this.options.max); - - this.result.min_pretty = min_pretty; - this.result.max_pretty = max_pretty; - - this.$cache.min.html(this.decorate(min_pretty, this.options.min)); - this.$cache.max.html(this.decorate(max_pretty, this.options.max)); - } - - this.labels.w_min = this.$cache.min.outerWidth(false); - this.labels.w_max = this.$cache.max.outerWidth(false); - }, - - /** - * Then dragging interval, prevent interval collapsing - * using min_interval option - */ - setTempMinInterval: function () { - var interval = this.result.to - this.result.from; - - if (this.old_min_interval === null) { - this.old_min_interval = this.options.min_interval; - } - - this.options.min_interval = interval; - }, - - /** - * Restore min_interval option to original - */ - restoreOriginalMinInterval: function () { - if (this.old_min_interval !== null) { - this.options.min_interval = this.old_min_interval; - this.old_min_interval = null; - } - }, - - - - // ============================================================================================================= - // Calculations - - /** - * All calculations and measures start here - * - * @param update {boolean=} - */ - calc: function (update) { - if (!this.options) { - return; - } - - this.calc_count++; - - if (this.calc_count === 10 || update) { - this.calc_count = 0; - this.coords.w_rs = this.$cache.rs.outerWidth(false); - - this.calcHandlePercent(); - } - - if (!this.coords.w_rs) { - return; - } - - this.calcPointerPercent(); - var handle_x = this.getHandleX(); - - - if (this.target === "both") { - this.coords.p_gap = 0; - handle_x = this.getHandleX(); - } - - if (this.target === "click") { - this.coords.p_gap = this.coords.p_handle / 2; - handle_x = this.getHandleX(); - - if (this.options.drag_interval) { - this.target = "both_one"; - } else { - this.target = this.chooseHandle(handle_x); - } - } - - switch (this.target) { - case "base": - var w = (this.options.max - this.options.min) / 100, - f = (this.result.from - this.options.min) / w, - t = (this.result.to - this.options.min) / w; - - this.coords.p_single_real = this.toFixed(f); - this.coords.p_from_real = this.toFixed(f); - this.coords.p_to_real = this.toFixed(t); - - this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max); - this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max); - this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max); - - this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real); - this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real); - this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real); - - this.target = null; - - break; - - case "single": - if (this.options.from_fixed) { - break; - } - - this.coords.p_single_real = this.convertToRealPercent(handle_x); - this.coords.p_single_real = this.calcWithStep(this.coords.p_single_real); - this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max); - - this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real); - - break; - - case "from": - if (this.options.from_fixed) { - break; - } - - this.coords.p_from_real = this.convertToRealPercent(handle_x); - this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real); - if (this.coords.p_from_real > this.coords.p_to_real) { - this.coords.p_from_real = this.coords.p_to_real; - } - this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max); - this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from"); - this.coords.p_from_real = this.checkMaxInterval(this.coords.p_from_real, this.coords.p_to_real, "from"); - - this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real); - - break; - - case "to": - if (this.options.to_fixed) { - break; - } - - this.coords.p_to_real = this.convertToRealPercent(handle_x); - this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real); - if (this.coords.p_to_real < this.coords.p_from_real) { - this.coords.p_to_real = this.coords.p_from_real; - } - this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max); - this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to"); - this.coords.p_to_real = this.checkMaxInterval(this.coords.p_to_real, this.coords.p_from_real, "to"); - - this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real); - - break; - - case "both": - if (this.options.from_fixed || this.options.to_fixed) { - break; - } - - handle_x = this.toFixed(handle_x + (this.coords.p_handle * 0.001)); - - this.coords.p_from_real = this.convertToRealPercent(handle_x) - this.coords.p_gap_left; - this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real); - this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max); - this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from"); - this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real); - - this.coords.p_to_real = this.convertToRealPercent(handle_x) + this.coords.p_gap_right; - this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real); - this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max); - this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to"); - this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real); - - break; - - case "both_one": - if (this.options.from_fixed || this.options.to_fixed) { - break; - } - - var real_x = this.convertToRealPercent(handle_x), - from = this.result.from_percent, - to = this.result.to_percent, - full = to - from, - half = full / 2, - new_from = real_x - half, - new_to = real_x + half; - - if (new_from < 0) { - new_from = 0; - new_to = new_from + full; - } - - if (new_to > 100) { - new_to = 100; - new_from = new_to - full; - } - - this.coords.p_from_real = this.calcWithStep(new_from); - this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max); - this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real); - - this.coords.p_to_real = this.calcWithStep(new_to); - this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max); - this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real); - - break; - } - - if (this.options.type === "single") { - this.coords.p_bar_x = (this.coords.p_handle / 2); - this.coords.p_bar_w = this.coords.p_single_fake; - - this.result.from_percent = this.coords.p_single_real; - this.result.from = this.convertToValue(this.coords.p_single_real); - this.result.from_pretty = this._prettify(this.result.from); - - if (this.options.values.length) { - this.result.from_value = this.options.values[this.result.from]; - } - } else { - this.coords.p_bar_x = this.toFixed(this.coords.p_from_fake + (this.coords.p_handle / 2)); - this.coords.p_bar_w = this.toFixed(this.coords.p_to_fake - this.coords.p_from_fake); - - this.result.from_percent = this.coords.p_from_real; - this.result.from = this.convertToValue(this.coords.p_from_real); - this.result.from_pretty = this._prettify(this.result.from); - this.result.to_percent = this.coords.p_to_real; - this.result.to = this.convertToValue(this.coords.p_to_real); - this.result.to_pretty = this._prettify(this.result.to); - - if (this.options.values.length) { - this.result.from_value = this.options.values[this.result.from]; - this.result.to_value = this.options.values[this.result.to]; - } - } - - this.calcMinMax(); - this.calcLabels(); - }, - - - /** - * calculates pointer X in percent - */ - calcPointerPercent: function () { - if (!this.coords.w_rs) { - this.coords.p_pointer = 0; - return; - } - - if (this.coords.x_pointer < 0 || isNaN(this.coords.x_pointer) ) { - this.coords.x_pointer = 0; - } else if (this.coords.x_pointer > this.coords.w_rs) { - this.coords.x_pointer = this.coords.w_rs; - } - - this.coords.p_pointer = this.toFixed(this.coords.x_pointer / this.coords.w_rs * 100); - }, - - convertToRealPercent: function (fake) { - var full = 100 - this.coords.p_handle; - return fake / full * 100; - }, - - convertToFakePercent: function (real) { - var full = 100 - this.coords.p_handle; - return real / 100 * full; - }, - - getHandleX: function () { - var max = 100 - this.coords.p_handle, - x = this.toFixed(this.coords.p_pointer - this.coords.p_gap); - - if (x < 0) { - x = 0; - } else if (x > max) { - x = max; - } - - return x; - }, - - calcHandlePercent: function () { - if (this.options.type === "single") { - this.coords.w_handle = this.$cache.s_single.outerWidth(false); - } else { - this.coords.w_handle = this.$cache.s_from.outerWidth(false); - } - - this.coords.p_handle = this.toFixed(this.coords.w_handle / this.coords.w_rs * 100); - }, - - /** - * Find closest handle to pointer click - * - * @param real_x {Number} - * @returns {String} - */ - chooseHandle: function (real_x) { - if (this.options.type === "single") { - return "single"; - } else { - var m_point = this.coords.p_from_real + ((this.coords.p_to_real - this.coords.p_from_real) / 2); - if (real_x >= m_point) { - return this.options.to_fixed ? "from" : "to"; - } else { - return this.options.from_fixed ? "to" : "from"; - } - } - }, - - /** - * Measure Min and Max labels width in percent - */ - calcMinMax: function () { - if (!this.coords.w_rs) { - return; - } - - this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100; - this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100; - }, - - /** - * Measure labels width and X in percent - */ - calcLabels: function () { - if (!this.coords.w_rs || this.options.hide_from_to) { - return; - } - - if (this.options.type === "single") { - - this.labels.w_single = this.$cache.single.outerWidth(false); - this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100; - this.labels.p_single_left = this.coords.p_single_fake + (this.coords.p_handle / 2) - (this.labels.p_single_fake / 2); - this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake); - - } else { - - this.labels.w_from = this.$cache.from.outerWidth(false); - this.labels.p_from_fake = this.labels.w_from / this.coords.w_rs * 100; - this.labels.p_from_left = this.coords.p_from_fake + (this.coords.p_handle / 2) - (this.labels.p_from_fake / 2); - this.labels.p_from_left = this.toFixed(this.labels.p_from_left); - this.labels.p_from_left = this.checkEdges(this.labels.p_from_left, this.labels.p_from_fake); - - this.labels.w_to = this.$cache.to.outerWidth(false); - this.labels.p_to_fake = this.labels.w_to / this.coords.w_rs * 100; - this.labels.p_to_left = this.coords.p_to_fake + (this.coords.p_handle / 2) - (this.labels.p_to_fake / 2); - this.labels.p_to_left = this.toFixed(this.labels.p_to_left); - this.labels.p_to_left = this.checkEdges(this.labels.p_to_left, this.labels.p_to_fake); - - this.labels.w_single = this.$cache.single.outerWidth(false); - this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100; - this.labels.p_single_left = ((this.labels.p_from_left + this.labels.p_to_left + this.labels.p_to_fake) / 2) - (this.labels.p_single_fake / 2); - this.labels.p_single_left = this.toFixed(this.labels.p_single_left); - this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake); - - } - }, - - - - // ============================================================================================================= - // Drawings - - /** - * Main function called in request animation frame - * to update everything - */ - updateScene: function () { - if (this.raf_id) { - cancelAnimationFrame(this.raf_id); - this.raf_id = null; - } - - clearTimeout(this.update_tm); - this.update_tm = null; - - if (!this.options) { - return; - } - - this.drawHandles(); - - if (this.is_active) { - this.raf_id = requestAnimationFrame(this.updateScene.bind(this)); - } else { - this.update_tm = setTimeout(this.updateScene.bind(this), 300); - } - }, - - /** - * Draw handles - */ - drawHandles: function () { - this.coords.w_rs = this.$cache.rs.outerWidth(false); - - if (!this.coords.w_rs) { - return; - } - - if (this.coords.w_rs !== this.coords.w_rs_old) { - this.target = "base"; - this.is_resize = true; - } - - if (this.coords.w_rs !== this.coords.w_rs_old || this.force_redraw) { - this.setMinMax(); - this.calc(true); - this.drawLabels(); - if (this.options.grid) { - this.calcGridMargin(); - this.calcGridLabels(); - } - this.force_redraw = true; - this.coords.w_rs_old = this.coords.w_rs; - this.drawShadow(); - } - - if (!this.coords.w_rs) { - return; - } - - if (!this.dragging && !this.force_redraw && !this.is_key) { - return; - } - - if (this.old_from !== this.result.from || this.old_to !== this.result.to || this.force_redraw || this.is_key) { - - this.drawLabels(); - - this.$cache.bar[0].style.left = this.coords.p_bar_x + "%"; - this.$cache.bar[0].style.width = this.coords.p_bar_w + "%"; - - if (this.options.type === "single") { - this.$cache.bar[0].style.left = 0; - this.$cache.bar[0].style.width = this.coords.p_bar_w + this.coords.p_bar_x + "%"; - - this.$cache.s_single[0].style.left = this.coords.p_single_fake + "%"; - - this.$cache.single[0].style.left = this.labels.p_single_left + "%"; - } else { - this.$cache.s_from[0].style.left = this.coords.p_from_fake + "%"; - this.$cache.s_to[0].style.left = this.coords.p_to_fake + "%"; - - if (this.old_from !== this.result.from || this.force_redraw) { - this.$cache.from[0].style.left = this.labels.p_from_left + "%"; - } - if (this.old_to !== this.result.to || this.force_redraw) { - this.$cache.to[0].style.left = this.labels.p_to_left + "%"; - } - - this.$cache.single[0].style.left = this.labels.p_single_left + "%"; - } - - this.writeToInput(); - - if ((this.old_from !== this.result.from || this.old_to !== this.result.to) && !this.is_start) { - this.$cache.input.trigger("change"); - this.$cache.input.trigger("input"); - } - - this.old_from = this.result.from; - this.old_to = this.result.to; - - // callbacks call - if (!this.is_resize && !this.is_update && !this.is_start && !this.is_finish) { - this.callOnChange(); - } - if (this.is_key || this.is_click) { - this.is_key = false; - this.is_click = false; - this.callOnFinish(); - } - - this.is_update = false; - this.is_resize = false; - this.is_finish = false; - } - - this.is_start = false; - this.is_key = false; - this.is_click = false; - this.force_redraw = false; - }, - - /** - * Draw labels - * measure labels collisions - * collapse close labels - */ - drawLabels: function () { - if (!this.options) { - return; - } - - var values_num = this.options.values.length; - var p_values = this.options.p_values; - var text_single; - var text_from; - var text_to; - var from_pretty; - var to_pretty; - - if (this.options.hide_from_to) { - return; - } - - if (this.options.type === "single") { - - if (values_num) { - text_single = this.decorate(p_values[this.result.from]); - this.$cache.single.html(text_single); - } else { - from_pretty = this._prettify(this.result.from); - - text_single = this.decorate(from_pretty, this.result.from); - this.$cache.single.html(text_single); - } - - this.calcLabels(); - - if (this.labels.p_single_left < this.labels.p_min + 1) { - this.$cache.min[0].style.visibility = "hidden"; - } else { - this.$cache.min[0].style.visibility = "visible"; - } - - if (this.labels.p_single_left + this.labels.p_single_fake > 100 - this.labels.p_max - 1) { - this.$cache.max[0].style.visibility = "hidden"; - } else { - this.$cache.max[0].style.visibility = "visible"; - } - - } else { - - if (values_num) { - - if (this.options.decorate_both) { - text_single = this.decorate(p_values[this.result.from]); - text_single += this.options.values_separator; - text_single += this.decorate(p_values[this.result.to]); - } else { - text_single = this.decorate(p_values[this.result.from] + this.options.values_separator + p_values[this.result.to]); - } - text_from = this.decorate(p_values[this.result.from]); - text_to = this.decorate(p_values[this.result.to]); - - this.$cache.single.html(text_single); - this.$cache.from.html(text_from); - this.$cache.to.html(text_to); - - } else { - from_pretty = this._prettify(this.result.from); - to_pretty = this._prettify(this.result.to); - - if (this.options.decorate_both) { - text_single = this.decorate(from_pretty, this.result.from); - text_single += this.options.values_separator; - text_single += this.decorate(to_pretty, this.result.to); - } else { - text_single = this.decorate(from_pretty + this.options.values_separator + to_pretty, this.result.to); - } - text_from = this.decorate(from_pretty, this.result.from); - text_to = this.decorate(to_pretty, this.result.to); - - this.$cache.single.html(text_single); - this.$cache.from.html(text_from); - this.$cache.to.html(text_to); - - } - - this.calcLabels(); - - var min = Math.min(this.labels.p_single_left, this.labels.p_from_left), - single_left = this.labels.p_single_left + this.labels.p_single_fake, - to_left = this.labels.p_to_left + this.labels.p_to_fake, - max = Math.max(single_left, to_left); - - if (this.labels.p_from_left + this.labels.p_from_fake >= this.labels.p_to_left) { - this.$cache.from[0].style.visibility = "hidden"; - this.$cache.to[0].style.visibility = "hidden"; - this.$cache.single[0].style.visibility = "visible"; - - if (this.result.from === this.result.to) { - if (this.target === "from") { - this.$cache.from[0].style.visibility = "visible"; - } else if (this.target === "to") { - this.$cache.to[0].style.visibility = "visible"; - } else if (!this.target) { - this.$cache.from[0].style.visibility = "visible"; - } - this.$cache.single[0].style.visibility = "hidden"; - max = to_left; - } else { - this.$cache.from[0].style.visibility = "hidden"; - this.$cache.to[0].style.visibility = "hidden"; - this.$cache.single[0].style.visibility = "visible"; - max = Math.max(single_left, to_left); - } - } else { - this.$cache.from[0].style.visibility = "visible"; - this.$cache.to[0].style.visibility = "visible"; - this.$cache.single[0].style.visibility = "hidden"; - } - - if (min < this.labels.p_min + 1) { - this.$cache.min[0].style.visibility = "hidden"; - } else { - this.$cache.min[0].style.visibility = "visible"; - } - - if (max > 100 - this.labels.p_max - 1) { - this.$cache.max[0].style.visibility = "hidden"; - } else { - this.$cache.max[0].style.visibility = "visible"; - } - - } - }, - - /** - * Draw shadow intervals - */ - drawShadow: function () { - var o = this.options, - c = this.$cache, - - is_from_min = typeof o.from_min === "number" && !isNaN(o.from_min), - is_from_max = typeof o.from_max === "number" && !isNaN(o.from_max), - is_to_min = typeof o.to_min === "number" && !isNaN(o.to_min), - is_to_max = typeof o.to_max === "number" && !isNaN(o.to_max), - - from_min, - from_max, - to_min, - to_max; - - if (o.type === "single") { - if (o.from_shadow && (is_from_min || is_from_max)) { - from_min = this.convertToPercent(is_from_min ? o.from_min : o.min); - from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min; - from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min)); - from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max)); - from_min = from_min + (this.coords.p_handle / 2); - - c.shad_single[0].style.display = "block"; - c.shad_single[0].style.left = from_min + "%"; - c.shad_single[0].style.width = from_max + "%"; - } else { - c.shad_single[0].style.display = "none"; - } - } else { - if (o.from_shadow && (is_from_min || is_from_max)) { - from_min = this.convertToPercent(is_from_min ? o.from_min : o.min); - from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min; - from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min)); - from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max)); - from_min = from_min + (this.coords.p_handle / 2); - - c.shad_from[0].style.display = "block"; - c.shad_from[0].style.left = from_min + "%"; - c.shad_from[0].style.width = from_max + "%"; - } else { - c.shad_from[0].style.display = "none"; - } - - if (o.to_shadow && (is_to_min || is_to_max)) { - to_min = this.convertToPercent(is_to_min ? o.to_min : o.min); - to_max = this.convertToPercent(is_to_max ? o.to_max : o.max) - to_min; - to_min = this.toFixed(to_min - (this.coords.p_handle / 100 * to_min)); - to_max = this.toFixed(to_max - (this.coords.p_handle / 100 * to_max)); - to_min = to_min + (this.coords.p_handle / 2); - - c.shad_to[0].style.display = "block"; - c.shad_to[0].style.left = to_min + "%"; - c.shad_to[0].style.width = to_max + "%"; - } else { - c.shad_to[0].style.display = "none"; - } - } - }, - - - - /** - * Write values to input element - */ - writeToInput: function () { - if (this.options.type === "single") { - if (this.options.values.length) { - this.$cache.input.prop("value", this.result.from_value); - } else { - this.$cache.input.prop("value", this.result.from); - } - this.$cache.input.data("from", this.result.from); - } else { - if (this.options.values.length) { - this.$cache.input.prop("value", this.result.from_value + this.options.input_values_separator + this.result.to_value); - } else { - this.$cache.input.prop("value", this.result.from + this.options.input_values_separator + this.result.to); - } - this.$cache.input.data("from", this.result.from); - this.$cache.input.data("to", this.result.to); - } - }, - - - - // ============================================================================================================= - // Callbacks - - callOnStart: function () { - this.writeToInput(); - - if (this.options.onStart && typeof this.options.onStart === "function") { - if (this.options.scope) { - this.options.onStart.call(this.options.scope, this.result); - } else { - this.options.onStart(this.result); - } - } - }, - callOnChange: function () { - this.writeToInput(); - - if (this.options.onChange && typeof this.options.onChange === "function") { - if (this.options.scope) { - this.options.onChange.call(this.options.scope, this.result); - } else { - this.options.onChange(this.result); - } - } - }, - callOnFinish: function () { - this.writeToInput(); - - if (this.options.onFinish && typeof this.options.onFinish === "function") { - if (this.options.scope) { - this.options.onFinish.call(this.options.scope, this.result); - } else { - this.options.onFinish(this.result); - } - } - }, - callOnUpdate: function () { - this.writeToInput(); - - if (this.options.onUpdate && typeof this.options.onUpdate === "function") { - if (this.options.scope) { - this.options.onUpdate.call(this.options.scope, this.result); - } else { - this.options.onUpdate(this.result); - } - } - }, - - - - - // ============================================================================================================= - // Service methods - - toggleInput: function () { - this.$cache.input.toggleClass("irs-hidden-input"); - - if (this.has_tab_index) { - this.$cache.input.prop("tabindex", -1); - } else { - try { - this.$cache.input.removeProp("tabindex"); - } catch(e) { - // Do nothing (PhantomJS can throw an error with the - // above, #2587) - } - } - - this.has_tab_index = !this.has_tab_index; - }, - - /** - * Convert real value to percent - * - * @param value {Number} X in real - * @param no_min {boolean=} don't use min value - * @returns {Number} X in percent - */ - convertToPercent: function (value, no_min) { - var diapason = this.options.max - this.options.min, - one_percent = diapason / 100, - val, percent; - - if (!diapason) { - this.no_diapason = true; - return 0; - } - - if (no_min) { - val = value; - } else { - val = value - this.options.min; - } - - percent = val / one_percent; - - return this.toFixed(percent); - }, - - /** - * Convert percent to real values - * - * @param percent {Number} X in percent - * @returns {Number} X in real - */ - convertToValue: function (percent) { - var min = this.options.min, - max = this.options.max, - min_decimals = min.toString().split(".")[1], - max_decimals = max.toString().split(".")[1], - min_length, max_length, - avg_decimals = 0, - abs = 0; - - if (percent === 0) { - return this.options.min; - } - if (percent === 100) { - return this.options.max; - } - - - if (min_decimals) { - min_length = min_decimals.length; - avg_decimals = min_length; - } - if (max_decimals) { - max_length = max_decimals.length; - avg_decimals = max_length; - } - if (min_length && max_length) { - avg_decimals = (min_length >= max_length) ? min_length : max_length; - } - - if (min < 0) { - abs = Math.abs(min); - min = +(min + abs).toFixed(avg_decimals); - max = +(max + abs).toFixed(avg_decimals); - } - - var number = ((max - min) / 100 * percent) + min, - string = this.options.step.toString().split(".")[1], - result; - - if (string) { - number = +number.toFixed(string.length); - } else { - number = number / this.options.step; - number = number * this.options.step; - - number = +number.toFixed(0); - } - - if (abs) { - number -= abs; - } - - if (string) { - result = +number.toFixed(string.length); - } else { - result = this.toFixed(number); - } - - if (result < this.options.min) { - result = this.options.min; - } else if (result > this.options.max) { - result = this.options.max; - } - - return result; - }, - - /** - * Round percent value with step - * - * @param percent {Number} - * @returns percent {Number} rounded - */ - calcWithStep: function (percent) { - var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step; - - if (rounded > 100) { - rounded = 100; - } - if (percent === 100) { - rounded = 100; - } - - return this.toFixed(rounded); - }, - - checkMinInterval: function (p_current, p_next, type) { - var o = this.options, - current, - next; - - if (!o.min_interval) { - return p_current; - } - - current = this.convertToValue(p_current); - next = this.convertToValue(p_next); - - if (type === "from") { - - if (next - current < o.min_interval) { - current = next - o.min_interval; - } - - } else { - - if (current - next < o.min_interval) { - current = next + o.min_interval; - } - - } - - return this.convertToPercent(current); - }, - - checkMaxInterval: function (p_current, p_next, type) { - var o = this.options, - current, - next; - - if (!o.max_interval) { - return p_current; - } - - current = this.convertToValue(p_current); - next = this.convertToValue(p_next); - - if (type === "from") { - - if (next - current > o.max_interval) { - current = next - o.max_interval; - } - - } else { - - if (current - next > o.max_interval) { - current = next + o.max_interval; - } - - } - - return this.convertToPercent(current); - }, - - checkDiapason: function (p_num, min, max) { - var num = this.convertToValue(p_num), - o = this.options; - - if (typeof min !== "number") { - min = o.min; - } - - if (typeof max !== "number") { - max = o.max; - } - - if (num < min) { - num = min; - } - - if (num > max) { - num = max; - } - - return this.convertToPercent(num); - }, - - toFixed: function (num) { - num = num.toFixed(20); - return +num; - }, - - _prettify: function (num) { - if (!this.options.prettify_enabled) { - return num; - } - - if (this.options.prettify && typeof this.options.prettify === "function") { - return this.options.prettify(num); - } else { - return this.prettify(num); - } - }, - - prettify: function (num) { - var n = num.toString(); - return n.replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g, "$1" + this.options.prettify_separator); - }, - - checkEdges: function (left, width) { - if (!this.options.force_edges) { - return this.toFixed(left); - } - - if (left < 0) { - left = 0; - } else if (left > 100 - width) { - left = 100 - width; - } - - return this.toFixed(left); - }, - - validate: function () { - var o = this.options, - r = this.result, - v = o.values, - vl = v.length, - value, - i; - - if (typeof o.min === "string") o.min = +o.min; - if (typeof o.max === "string") o.max = +o.max; - if (typeof o.from === "string") o.from = +o.from; - if (typeof o.to === "string") o.to = +o.to; - if (typeof o.step === "string") o.step = +o.step; - - if (typeof o.from_min === "string") o.from_min = +o.from_min; - if (typeof o.from_max === "string") o.from_max = +o.from_max; - if (typeof o.to_min === "string") o.to_min = +o.to_min; - if (typeof o.to_max === "string") o.to_max = +o.to_max; - - if (typeof o.grid_num === "string") o.grid_num = +o.grid_num; - - if (o.max < o.min) { - o.max = o.min; - } - - if (vl) { - o.p_values = []; - o.min = 0; - o.max = vl - 1; - o.step = 1; - o.grid_num = o.max; - o.grid_snap = true; - - for (i = 0; i < vl; i++) { - value = +v[i]; - - if (!isNaN(value)) { - v[i] = value; - value = this._prettify(value); - } else { - value = v[i]; - } - - o.p_values.push(value); - } - } - - if (typeof o.from !== "number" || isNaN(o.from)) { - o.from = o.min; - } - - if (typeof o.to !== "number" || isNaN(o.to)) { - o.to = o.max; - } - - if (o.type === "single") { - - if (o.from < o.min) o.from = o.min; - if (o.from > o.max) o.from = o.max; - - } else { - - if (o.from < o.min) o.from = o.min; - if (o.from > o.max) o.from = o.max; - - if (o.to < o.min) o.to = o.min; - if (o.to > o.max) o.to = o.max; - - if (this.update_check.from) { - - if (this.update_check.from !== o.from) { - if (o.from > o.to) o.from = o.to; - } - if (this.update_check.to !== o.to) { - if (o.to < o.from) o.to = o.from; - } - - } - - if (o.from > o.to) o.from = o.to; - if (o.to < o.from) o.to = o.from; - - } - - if (typeof o.step !== "number" || isNaN(o.step) || !o.step || o.step < 0) { - o.step = 1; - } - - if (typeof o.from_min === "number" && o.from < o.from_min) { - o.from = o.from_min; - } - - if (typeof o.from_max === "number" && o.from > o.from_max) { - o.from = o.from_max; - } - - if (typeof o.to_min === "number" && o.to < o.to_min) { - o.to = o.to_min; - } - - if (typeof o.to_max === "number" && o.from > o.to_max) { - o.to = o.to_max; - } - - if (r) { - if (r.min !== o.min) { - r.min = o.min; - } - - if (r.max !== o.max) { - r.max = o.max; - } - - if (r.from < r.min || r.from > r.max) { - r.from = o.from; - } - - if (r.to < r.min || r.to > r.max) { - r.to = o.to; - } - } - - if (typeof o.min_interval !== "number" || isNaN(o.min_interval) || !o.min_interval || o.min_interval < 0) { - o.min_interval = 0; - } - - if (typeof o.max_interval !== "number" || isNaN(o.max_interval) || !o.max_interval || o.max_interval < 0) { - o.max_interval = 0; - } - - if (o.min_interval && o.min_interval > o.max - o.min) { - o.min_interval = o.max - o.min; - } - - if (o.max_interval && o.max_interval > o.max - o.min) { - o.max_interval = o.max - o.min; - } - }, - - decorate: function (num, original) { - var decorated = "", - o = this.options; - - if (o.prefix) { - decorated += o.prefix; - } - - decorated += num; - - if (o.max_postfix) { - if (o.values.length && num === o.p_values[o.max]) { - decorated += o.max_postfix; - if (o.postfix) { - decorated += " "; - } - } else if (original === o.max) { - decorated += o.max_postfix; - if (o.postfix) { - decorated += " "; - } - } - } - - if (o.postfix) { - decorated += o.postfix; - } - - return decorated; - }, - - updateFrom: function () { - this.result.from = this.options.from; - this.result.from_percent = this.convertToPercent(this.result.from); - this.result.from_pretty = this._prettify(this.result.from); - if (this.options.values) { - this.result.from_value = this.options.values[this.result.from]; - } - }, - - updateTo: function () { - this.result.to = this.options.to; - this.result.to_percent = this.convertToPercent(this.result.to); - this.result.to_pretty = this._prettify(this.result.to); - if (this.options.values) { - this.result.to_value = this.options.values[this.result.to]; - } - }, - - updateResult: function () { - this.result.min = this.options.min; - this.result.max = this.options.max; - this.updateFrom(); - this.updateTo(); - }, - - - // ============================================================================================================= - // Grid - - appendGrid: function () { - if (!this.options.grid) { - return; - } - - var o = this.options, - i, z, - - total = o.max - o.min, - big_num = o.grid_num, - big_p = 0, - big_w = 0, - - small_max = 4, - local_small_max, - small_p, - small_w = 0, - - result, - html = ''; - - - - this.calcGridMargin(); - - if (o.grid_snap) { - big_num = total / o.step; - } - - if (big_num > 50) big_num = 50; - big_p = this.toFixed(100 / big_num); - - if (big_num > 4) { - small_max = 3; - } - if (big_num > 7) { - small_max = 2; - } - if (big_num > 14) { - small_max = 1; - } - if (big_num > 28) { - small_max = 0; - } - - for (i = 0; i < big_num + 1; i++) { - local_small_max = small_max; - - big_w = this.toFixed(big_p * i); - - if (big_w > 100) { - big_w = 100; - } - this.coords.big[i] = big_w; - - small_p = (big_w - (big_p * (i - 1))) / (local_small_max + 1); - - for (z = 1; z <= local_small_max; z++) { - if (big_w === 0) { - break; - } - - small_w = this.toFixed(big_w - (small_p * z)); - - html += ''; - } - - html += ''; - - result = this.convertToValue(big_w); - if (o.values.length) { - result = o.p_values[result]; - } else { - result = this._prettify(result); - } - - html += '' + result + ''; - } - this.coords.big_num = Math.ceil(big_num + 1); - - - - this.$cache.cont.addClass("irs-with-grid"); - this.$cache.grid.html(html); - this.cacheGridLabels(); - }, - - cacheGridLabels: function () { - var $label, i, - num = this.coords.big_num; - - for (i = 0; i < num; i++) { - $label = this.$cache.grid.find(".js-grid-text-" + i); - this.$cache.grid_labels.push($label); - } - - this.calcGridLabels(); - }, - - calcGridLabels: function () { - var i, label, start = [], finish = [], - num = this.coords.big_num; - - for (i = 0; i < num; i++) { - this.coords.big_w[i] = this.$cache.grid_labels[i].outerWidth(false); - this.coords.big_p[i] = this.toFixed(this.coords.big_w[i] / this.coords.w_rs * 100); - this.coords.big_x[i] = this.toFixed(this.coords.big_p[i] / 2); - - start[i] = this.toFixed(this.coords.big[i] - this.coords.big_x[i]); - finish[i] = this.toFixed(start[i] + this.coords.big_p[i]); - } - - if (this.options.force_edges) { - if (start[0] < -this.coords.grid_gap) { - start[0] = -this.coords.grid_gap; - finish[0] = this.toFixed(start[0] + this.coords.big_p[0]); - - this.coords.big_x[0] = this.coords.grid_gap; - } - - if (finish[num - 1] > 100 + this.coords.grid_gap) { - finish[num - 1] = 100 + this.coords.grid_gap; - start[num - 1] = this.toFixed(finish[num - 1] - this.coords.big_p[num - 1]); - - this.coords.big_x[num - 1] = this.toFixed(this.coords.big_p[num - 1] - this.coords.grid_gap); - } - } - - this.calcGridCollision(2, start, finish); - this.calcGridCollision(4, start, finish); - - for (i = 0; i < num; i++) { - label = this.$cache.grid_labels[i][0]; - - if (this.coords.big_x[i] !== Number.POSITIVE_INFINITY) { - label.style.marginLeft = -this.coords.big_x[i] + "%"; - } - } - }, - - // Collisions Calc Beta - // TODO: Refactor then have plenty of time - calcGridCollision: function (step, start, finish) { - var i, next_i, label, - num = this.coords.big_num; - - for (i = 0; i < num; i += step) { - next_i = i + (step / 2); - if (next_i >= num) { - break; - } - - label = this.$cache.grid_labels[next_i][0]; - - if (finish[i] <= start[next_i]) { - label.style.visibility = "visible"; - } else { - label.style.visibility = "hidden"; - } - } - }, - - calcGridMargin: function () { - if (!this.options.grid_margin) { - return; - } - - this.coords.w_rs = this.$cache.rs.outerWidth(false); - if (!this.coords.w_rs) { - return; - } - - if (this.options.type === "single") { - this.coords.w_handle = this.$cache.s_single.outerWidth(false); - } else { - this.coords.w_handle = this.$cache.s_from.outerWidth(false); - } - this.coords.p_handle = this.toFixed(this.coords.w_handle / this.coords.w_rs * 100); - this.coords.grid_gap = this.toFixed((this.coords.p_handle / 2) - 0.1); - - this.$cache.grid[0].style.width = this.toFixed(100 - this.coords.p_handle) + "%"; - this.$cache.grid[0].style.left = this.coords.grid_gap + "%"; - }, - - - - // ============================================================================================================= - // Public methods - - update: function (options) { - if (!this.input) { - return; - } - - this.is_update = true; - - this.options.from = this.result.from; - this.options.to = this.result.to; - this.update_check.from = this.result.from; - this.update_check.to = this.result.to; - - this.options = $.extend(this.options, options); - this.validate(); - this.updateResult(options); - - this.toggleInput(); - this.remove(); - this.init(true); - }, - - reset: function () { - if (!this.input) { - return; - } - - this.updateResult(); - this.update(); - }, - - destroy: function () { - if (!this.input) { - return; - } - - this.toggleInput(); - this.$cache.input.prop("readonly", false); - $.data(this.input, "ionRangeSlider", null); - - this.remove(); - this.input = null; - this.options = null; - } - }; - - $.fn.ionRangeSlider = function (options) { - return this.each(function() { - if (!$.data(this, "ionRangeSlider")) { - $.data(this, "ionRangeSlider", new IonRangeSlider(this, options, plugin_count++)); - } - }); - }; - - - - // ================================================================================================================= - // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating - - // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel - - // MIT license - - (function() { - var lastTime = 0; - var vendors = ['ms', 'moz', 'webkit', 'o']; - for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; - window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] - || window[vendors[x]+'CancelRequestAnimationFrame']; - } - - if (!window.requestAnimationFrame) - window.requestAnimationFrame = function(callback, element) { - var currTime = new Date().getTime(); - var timeToCall = Math.max(0, 16 - (currTime - lastTime)); - var id = window.setTimeout(function() { callback(currTime + timeToCall); }, - timeToCall); - lastTime = currTime + timeToCall; - return id; - }; - - if (!window.cancelAnimationFrame) - window.cancelAnimationFrame = function(id) { - clearTimeout(id); - }; - }()); - -})); diff --git a/shiny/www/shared/ionrangeslider/scss/_base.scss b/shiny/www/shared/ionrangeslider/scss/_base.scss deleted file mode 100644 index 010de8255..000000000 --- a/shiny/www/shared/ionrangeslider/scss/_base.scss +++ /dev/null @@ -1,147 +0,0 @@ -@import "_mixins"; - -.irs { - @include pos-r(); - -webkit-touch-callout: none; - @include no-click(); - /* https://github.com/rstudio/shiny/issues/3443 */ - /* https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ */ - box-sizing: border-box; - *, *:before, *:after { - box-sizing: inherit; - } - - &-line { - @include pos-r(); - overflow: hidden; - outline: none !important; - } - - &-bar { - @include pos-a(); - left: 0; - width: 0; - } - - &-shadow { - position: absolute; - display: none; - left: 0; - width: 0; - } - - &-handle { - @include pos-a(); - box-sizing: border-box; - cursor: pointer; - z-index: 1; - - &.single, - &.from, - &.to {} - - &.type_last { - z-index: 2; - } - } - - &-min, - &-max { - @include pos-a(); - cursor: default; - } - - &-min { - left: 0; - } - - &-max { - right: 0; - } - - &-from, - &-to, - &-single { - @include pos-a(); - top: 0; - left: 0; - cursor: default; - white-space: nowrap; - } - - &-grid { - position: absolute; - display: none; - bottom: 0; - left: 0; - width: 100%; - height: 20px; - - .irs-with-grid & { - display: block; - } - - &-pol { - position: absolute; - top: 0; - left: 0; - width: 1px; - height: 8px; - - &.small { - height: 4px; - } - } - - &-text { - position: absolute; - bottom: 0; - left: 0; - white-space: nowrap; - text-align: center; - font-size: 9px; - line-height: 9px; - padding: 0 3px; - } - } - - &-disable-mask { - @include pos-a(); - top: 0; - left: -1%; - width: 102%; - height: 100%; - cursor: default; - background: rgba(0,0,0,0.0); - z-index: 2; - - .lt-ie9 & { - background: #000; - filter: alpha(opacity=0); - cursor: not-allowed; - } - } - - &-disabled { - opacity: 0.4; - } - - &-hidden-input { - position: absolute !important; - display: block !important; - top: 0 !important; - left: 0 !important; - width: 0 !important; - height: 0 !important; - font-size: 0 !important; - line-height: 0 !important; - padding: 0 !important; - margin: 0 !important; - overflow: hidden; - outline: none !important; - z-index: -9999 !important; - background: none !important; - border-style: solid !important; - border-color: transparent !important; - } -} diff --git a/shiny/www/shared/ionrangeslider/scss/_mixins.scss b/shiny/www/shared/ionrangeslider/scss/_mixins.scss deleted file mode 100644 index b346ee9e5..000000000 --- a/shiny/www/shared/ionrangeslider/scss/_mixins.scss +++ /dev/null @@ -1,17 +0,0 @@ -@mixin no-click() { - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -@mixin pos-r() { - position: relative; - display: block; -} - -@mixin pos-a() { - position: absolute; - display: block; -} diff --git a/shiny/www/shared/ionrangeslider/scss/shiny.scss b/shiny/www/shared/ionrangeslider/scss/shiny.scss deleted file mode 100644 index 72203cc23..000000000 --- a/shiny/www/shared/ionrangeslider/scss/shiny.scss +++ /dev/null @@ -1,201 +0,0 @@ -/* 'shiny' skin for Ion.RangeSlider, largely based on the 'big' skin, but with smaller dimensions, grayscale grid text, and without gradients -© Posit, PBC, 2023 -© RStudio, Inc, 2014 -© Denis Ineshin, 2014 https://github.com/IonDen -© guybowden, 2014 https://github.com/guybowden -*/ - -@import "_base"; - -// Both BS3 and BS4 define a border radius mixin, but just in case -// we're trying to compile this without bootstrapSass -@mixin border-radius-shim($radius) { - @if mixin-exists("border-radius") { - @include border-radius($radius); - } @else { - border-radius: $radius; - } -} - - -//////////////////////////////////////////////////////////////////////////// - -$font-family: $font-family-base !default; -.irs { - font-family: $font-family; -} - -.irs--shiny { - $name: irs !default; - - // Sizing controls - $top: 25px !default; - $line_height: 8px !default; - $handle_width: 22px !default; - $handle_height: 22px !default; - $custom_radius: 3px !default; - - // "High-level" coloring - $bg: $body-bg !default; - $fg: color-contrast($body-bg) !default; - $accent: #428bca !default; - - // "Low-level" coloring, borders, and fonts - $line_bg: linear-gradient(to bottom, mix($bg, $fg, 87%) -50%, $bg 150%) !default; - $line_bg_color: mix($bg, $fg, 93%) !default; - $line_border: 1px solid mix($bg, $fg, 80%) !default; - - $bar_color: $accent !default; - - $handle_color: mix($bg, $fg, 87%) !default; - $handle_color_hover: $bg !default; - $handle_border: 1px solid mix($bg, $fg, 67%) !default; - $handle_box_shadow: 1px 1px 3px rgba($bg, 0.3) !default; - - $minmax_text_color: null !default; - $minmax_bg_color: rgba($fg, 0.1) !default; - $minmax_font_size: 10px !default; - $minmax_line_height: 1.333 !default; - - $fromto_bg_color: $accent !default; - $fromto_color: color-contrast($fromto_bg_color) !default; - $fromto_font_size: 11px !default; - $fromto_line_height: 1.333 !default; - - $grid_major_color: $fg !default; - $grid_minor_color: mix($bg, $fg, 60%) !default; - $grid_text_color: null !default; - - - height: 40px; - - &.irs-with-grid { - height: 60px; - } - - .#{$name}-line { - top: $top; - height: $line_height; - background: $line_bg; - background-color: $line_bg_color; - border: $line_border; - @include border-radius-shim($line_height); - - // Increase the touch target area of the slider line - overflow: visible; - &::before { - content: ""; - display: block; - position: relative; - cursor: s-resize; // downward arrow - width: 100%; - height: $handle_height; - top: -(($handle_height - $line_height / 2) / 2); - z-index: 1; // raise touch area above grid - } - } - - .#{$name}-bar { - top: $top; - height: $line_height; - border-top: 1px solid $bar_color; - border-bottom: 1px solid $bar_color; - background: $bar_color; - cursor: s-resize; // downard arrow, overwritten when a range - z-index: 2; - - &--single { - @include border-radius-shim($line_height 0 0 $line_height); - } - - // Increase the touch target area of the slider bar - &::before { - content: ""; - display: block; - position: relative; - width: 100%; - height: $handle_height; - top: -(($handle_height - $line_height / 2) / 2); - z-index: 2; // raise touch area above line touch target - } - } - - // sliderInput() doesn't currently support from_min/from_max, so this isn't relevant - .#{$name}-shadow { - top: 38px; - height: 2px; - background: rgba($fg, 0.3); - @include border-radius-shim(5px); - } - .lt-ie9 .#{$name}-shadow { - filter: alpha(opacity=30); - } - - // .irs-slider changed to .irs-handle in v2.3.0 - // https://github.com/IonDen/ion.rangeSlider/commit/c98c10d3d360aa52e997bb8e4fd371c958f78e4b#diff-91cc6fde25fe380ac2a7ac58e1538dceR140 - .#{$name}-handle { - top: 17px; - width: $handle_width; - height: $handle_height; - border: $handle_border; - background-color: $handle_color; - box-shadow: $handle_box_shadow; - border-radius: $handle_width; - z-index: 2; - - &.state_hover, - &:hover { - background: $handle_color_hover; - } - } - - .#{$name}-min, - .#{$name}-max { - top: 0; - padding: 1px 3px; - color: $minmax_text_color; - text-shadow: none; - background-color: $minmax_bg_color; - @include border-radius-shim($custom_radius); - font-size: $minmax_font_size; - line-height: $minmax_line_height; - } - - .lt-ie9 .#{$name}-min, - .lt-ie9 .#{$name}-max { - background: mix($bg, $fg, 80%); - } - - .#{$name}-from, - .#{$name}-to, - .#{$name}-single { - color: $fromto_color; - text-shadow: none; - padding: 1px 3px; - background-color: $fromto_bg_color; - @include border-radius-shim($custom_radius); - font-size: $fromto_font_size; - line-height: $fromto_line_height; - } - - .lt-ie9 .#{$name}-from, - .lt-ie9 .#{$name}-to, - .lt-ie9 .#{$name}-single { - background: mix($bg, $fg, 60%); - } - - .#{$name}-grid { - height: 27px; - &-pol { - background-color: $grid_major_color; - } - &-text { - bottom: 5px; - color: $grid_text_color; - } - &-pol.small { - background-color: $grid_minor_color; - } - } - -} diff --git a/shiny/www/shared/jquery/jquery-3.6.0.js b/shiny/www/shared/jquery/jquery-3.6.0.js deleted file mode 100644 index fc6c299b7..000000000 --- a/shiny/www/shared/jquery/jquery-3.6.0.js +++ /dev/null @@ -1,10881 +0,0 @@ -/*! - * jQuery JavaScript Library v3.6.0 - * https://jquery.com/ - * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright OpenJS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2021-03-02T17:08Z - */ -( function( global, factory ) { - - "use strict"; - - if ( typeof module === "object" && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var flat = arr.flat ? function( array ) { - return arr.flat.call( array ); -} : function( array ) { - return arr.concat.apply( [], array ); -}; - - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 - // Plus for old WebKit, typeof returns "function" for HTML collections - // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) - return typeof obj === "function" && typeof obj.nodeType !== "number" && - typeof obj.item !== "function"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - -var document = window.document; - - - - var preservedScriptAttributes = { - type: true, - src: true, - nonce: true, - noModule: true - }; - - function DOMEval( code, node, doc ) { - doc = doc || document; - - var i, val, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - - // Support: Firefox 64+, Edge 18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.6.0", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - even: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return ( i + 1 ) % 2; - } ) ); - }, - - odd: function() { - return this.pushStack( jQuery.grep( this, function( _elem, i ) { - return i % 2; - } ) ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - copy = options[ name ]; - - // Prevent Object.prototype pollution - // Prevent never-ending loop - if ( name === "__proto__" || target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - src = target[ name ]; - - // Ensure proper type for the source value - if ( copyIsArray && !Array.isArray( src ) ) { - clone = []; - } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { - clone = {}; - } else { - clone = src; - } - copyIsArray = false; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a provided context; falls back to the global one - // if not specified. - globalEval: function( code, options, doc ) { - DOMEval( code, { nonce: options && options.nonce }, doc ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return flat( ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), - function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); - } ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.6 - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://js.foundation/ - * - * Date: 2021-02-16 - */ -( function( window ) { -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - nonnativeSelectorCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ( {} ).hasOwnProperty, - arr = [], - pop = arr.pop, - pushNative = arr.push, - push = arr.push, - slice = arr.slice, - - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[ i ] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + - "ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram - identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + - "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - - // "Attribute values must be CSS identifiers [capture 5] - // or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + - whitespace + "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + - whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + - "*" ), - rdescend = new RegExp( whitespace + "|>" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + - "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rhtml = /HTML$/i, - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), - funescape = function( escape, nonHex ) { - var high = "0x" + escape.slice( 1 ) - 0x10000; - - return nonHex ? - - // Strip the backslash prefix from a non-hex escape sequence - nonHex : - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + - ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - inDisabledFieldset = addCombinator( - function( elem ) { - return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - ( arr = slice.call( preferredDoc.childNodes ) ), - preferredDoc.childNodes - ); - - // Support: Android<4.0 - // Detect silently failing push.apply - // eslint-disable-next-line no-unused-expressions - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - pushNative.apply( target, slice.call( els ) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - - // Can't trust NodeList.length - while ( ( target[ j++ ] = els[ i++ ] ) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - setDocument( context ); - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { - - // ID selector - if ( ( m = match[ 1 ] ) ) { - - // Document context - if ( nodeType === 9 ) { - if ( ( elem = context.getElementById( m ) ) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && ( elem = newContext.getElementById( m ) ) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[ 2 ] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && - - // Support: IE 8 only - // Exclude object elements - ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { - - newSelector = selector; - newContext = context; - - // qSA considers elements outside a scoping root when evaluating child or - // descendant combinators, which is not what we want. - // In such cases, we work around the behavior by prefixing every selector in the - // list with an ID selector referencing the scope context. - // The technique has to be used as well when a leading combinator is used - // as such selectors are not recognized by querySelectorAll. - // Thanks to Andrew Dupont for this technique. - if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - - // We can use :scope instead of the ID hack if the browser - // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { - - // Capture the context ID, setting it first if necessary - if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", ( nid = expando ) ); - } - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + - toSelector( groups[ i ] ); - } - newSelector = groups.join( "," ); - } - - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - nonnativeSelectorCache( selector, true ); - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return ( cache[ key + " " ] = value ); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement( "fieldset" ); - - try { - return !!fn( el ); - } catch ( e ) { - return false; - } finally { - - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split( "|" ), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[ i ] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( ( cur = cur.nextSibling ) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return ( name === "input" || name === "button" ) && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction( function( argument ) { - argument = +argument; - return markFunction( function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ ( j = matchIndexes[ i ] ) ] ) { - seed[ j ] = !( matches[ j ] = seed[ j ] ); - } - } - } ); - } ); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var namespace = elem && elem.namespaceURI, - docElem = elem && ( elem.ownerDocument || elem ).documentElement; - - // Support: IE <=8 - // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes - // https://bugs.jquery.com/ticket/4833 - return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, - // Safari 4 - 5 only, Opera <=11.6 - 12.x only - // IE/Edge & older browsers don't support the :scope pseudo-class. - // Support: Safari 6.0 only - // Safari 6.0 supports :scope but it's an alias of :root there. - support.scope = assert( function( el ) { - docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); - return typeof el.querySelectorAll !== "undefined" && - !el.querySelectorAll( ":scope fieldset div" ).length; - } ); - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert( function( el ) { - el.className = "i"; - return !el.getAttribute( "className" ); - } ); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert( function( el ) { - el.appendChild( document.createComment( "" ) ); - return !el.getElementsByTagName( "*" ).length; - } ); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - } ); - - // ID filter and find - if ( support.getById ) { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute( "id" ) === attrId; - }; - }; - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter[ "ID" ] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode( "id" ); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find[ "ID" ] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( ( elem = elems[ i++ ] ) ) { - node = elem.getAttributeNode( "id" ); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find[ "TAG" ] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { - - var input; - - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Firefox <=3.6 - 5 only - // Old Firefox doesn't throw on a badly-escaped identifier. - el.querySelectorAll( "\\\f" ); - rbuggyQSA.push( "[\\r\\n\\f]" ); - } ); - - assert( function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll( "[name=d]" ).length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: Opera 10 - 11 only - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll( "*,:x" ); - rbuggyQSA.push( ",.*:" ); - } ); - } - - if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector ) ) ) ) { - - assert( function( el ) { - - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - } ); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); - } : - function( a, b ) { - if ( b ) { - while ( ( b = b.parentNode ) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { - - // Choose the first element that is related to our preferred document - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( a == document || a.ownerDocument == preferredDoc && - contains( preferredDoc, a ) ) { - return -1; - } - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( b == document || b.ownerDocument == preferredDoc && - contains( preferredDoc, b ) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - return a == document ? -1 : - b == document ? 1 : - /* eslint-enable eqeqeq */ - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( ( cur = cur.parentNode ) ) { - ap.unshift( cur ); - } - cur = b; - while ( ( cur = cur.parentNode ) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[ i ] === bp[ i ] ) { - i++; - } - - return i ? - - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[ i ], bp[ i ] ) : - - // Otherwise nodes in our document sort first - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - ap[ i ] == preferredDoc ? -1 : - bp[ i ] == preferredDoc ? 1 : - /* eslint-enable eqeqeq */ - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - setDocument( elem ); - - if ( support.matchesSelector && documentIsHTML && - !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch ( e ) { - nonnativeSelectorCache( expr, true ); - } - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( context.ownerDocument || context ) != document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - - // Set document vars if needed - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( ( elem.ownerDocument || elem ) != document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[ 1 ] = match[ 1 ].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || - match[ 5 ] || "" ).replace( runescape, funescape ); - - if ( match[ 2 ] === "~=" ) { - match[ 3 ] = " " + match[ 3 ] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[ 1 ] = match[ 1 ].toLowerCase(); - - if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { - - // nth-* requires argument - if ( !match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[ 4 ] = +( match[ 4 ] ? - match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); - match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - - // other types prohibit arguments - } else if ( match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[ 6 ] && match[ 2 ]; - - if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[ 3 ] ) { - match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - - // Get excess from tokenize (recursively) - ( excess = tokenize( unquoted, true ) ) && - - // advance to the next closing parenthesis - ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { - - // excess is a negative index - match[ 0 ] = match[ 0 ].slice( 0, excess ); - match[ 2 ] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { - return true; - } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - ( pattern = new RegExp( "(^|" + whitespace + - ")" + className + "(" + whitespace + "|$)" ) ) && classCache( - className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); - } ); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - /* eslint-disable max-len */ - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - /* eslint-enable max-len */ - - }; - }, - - "CHILD": function( type, what, _argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, _context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( ( node = node[ dir ] ) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( ( node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - - // Use previously-cached element index if available - if ( useCache ) { - - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - - // Use the same loop as above to seek `elem` from the start - while ( ( node = ++nodeIndex && node && node[ dir ] || - ( diff = nodeIndex = 0 ) || start.pop() ) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || - ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction( function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[ i ] ); - seed[ idx ] = !( matches[ idx ] = matched[ i ] ); - } - } ) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - - // Potentially complex pseudos - "not": markFunction( function( selector ) { - - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction( function( seed, matches, _context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( ( elem = unmatched[ i ] ) ) { - seed[ i ] = !( matches[ i ] = elem ); - } - } - } ) : - function( elem, _context, xml ) { - input[ 0 ] = elem; - matcher( input, null, xml, results ); - - // Don't keep the element (issue #299) - input[ 0 ] = null; - return !results.pop(); - }; - } ), - - "has": markFunction( function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - } ), - - "contains": markFunction( function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; - }; - } ), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - - // lang value must be a valid identifier - if ( !ridentifier.test( lang || "" ) ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( ( elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); - return false; - }; - } ), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && - ( !document.hasFocus || document.hasFocus() ) && - !!( elem.type || elem.href || ~elem.tabIndex ); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return ( nodeName === "input" && !!elem.checked ) || - ( nodeName === "option" && !!elem.selected ); - }, - - "selected": function( elem ) { - - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - // eslint-disable-next-line no-unused-expressions - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos[ "empty" ]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( ( attr = elem.getAttribute( "type" ) ) == null || - attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo( function() { - return [ 0 ]; - } ), - - "last": createPositionalPseudo( function( _matchIndexes, length ) { - return [ length - 1 ]; - } ), - - "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - } ), - - "even": createPositionalPseudo( function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "odd": createPositionalPseudo( function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? - argument + length : - argument > length ? - length : - argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ), - - "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - } ) - } -}; - -Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || ( match = rcomma.exec( soFar ) ) ) { - if ( match ) { - - // Don't consume trailing commas as valid - soFar = soFar.slice( match[ 0 ].length ) || soFar; - } - groups.push( ( tokens = [] ) ); - } - - matched = false; - - // Combinators - if ( ( match = rcombinators.exec( soFar ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - - // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || - ( match = preFilters[ type ]( match ) ) ) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[ i ].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( ( elem = elem[ dir ] ) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || - ( outerCache[ elem.uniqueID ] = {} ); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( ( oldCache = uniqueCache[ key ] ) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return ( newCache[ 2 ] = oldCache[ 2 ] ); - } else { - - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[ i ]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[ 0 ]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[ i ], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( ( elem = unmatched[ i ] ) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( - selector || "*", - context.nodeType ? [ context ] : context, - [] - ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( ( elem = temp[ i ] ) ) { - matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) ) { - - // Restore matcherIn since elem is not yet a final match - temp.push( ( matcherIn[ i ] = elem ) ); - } - } - postFinder( null, ( matcherOut = [] ), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { - - seed[ temp ] = !( results[ temp ] = elem ); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - } ); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[ 0 ].type ], - implicitRelative = leadingRelative || Expr.relative[ " " ], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - ( checkContext = context ).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[ j ].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens - .slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), - - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), - len = elems.length; - - if ( outermost ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - outermostContext = context == document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( !context && elem.ownerDocument != document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( ( matcher = elementMatchers[ j++ ] ) ) { - if ( matcher( elem, context || document, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - - // They will have gone through all possible matchers - if ( ( elem = !matcher && elem ) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( ( matcher = setMatchers[ j++ ] ) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !( unmatched[ i ] || setMatched[ i ] ) ) { - setMatched[ i ] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[ i ] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( - selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) - ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( ( selector = compiled.selector || selector ) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[ 0 ] = match[ 0 ].slice( 0 ); - if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - - context = ( Expr.find[ "ID" ]( token.matches[ 0 ] - .replace( runescape, funescape ), context ) || [] )[ 0 ]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[ i ]; - - // Abort if we hit a combinator - if ( Expr.relative[ ( type = token.type ) ] ) { - break; - } - if ( ( find = Expr.find[ type ] ) ) { - - // Search, expanding context for leading sibling combinators - if ( ( seed = find( - token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || - context - ) ) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert( function( el ) { - - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; -} ); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert( function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute( "href" ) === "#"; -} ) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - } ); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert( function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -} ) ) { - addHandle( "value", function( elem, _name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - } ); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert( function( el ) { - return el.getAttribute( "disabled" ) == null; -} ) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; - } - } ); -} - -return Sizzle; - -} )( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -} -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, _i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, _i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, _i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( elem.contentDocument != null && - - // Support: IE 11+ - // elements with no `data` attribute has an object - // `contentDocument` with a `null` prototype. - getProto( elem.contentDocument ) ) { - - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( _i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the primary Deferred - primary = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - primary.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( primary.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return primary.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); - } - - return primary.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, _key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( _all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var documentElement = document.documentElement; - - - - var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); - }, - composed = { composed: true }; - - // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only - // Check attachment across shadow DOM boundaries when possible (gh-3504) - // Support: iOS 10.0-10.2 only - // Early iOS 10 versions support `attachShadow` but not `getRootNode`, - // leading to errors. We need to check for `getRootNode`. - if ( documentElement.getRootNode ) { - isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; - }; - } -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - isAttached( elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = elem.nodeType && - ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // Support: IE <=9 only - // IE <=9 replaces "; - support.option = !!div.lastChild; -} )(); - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { - - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var notAsync, result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); - this[ type ](); - result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - - // Support: Chrome 86+ - // In Chrome, if an element having a focusout handler is blurred by - // clicking outside of it, it invokes the handler synchronously. If - // that handler calls `.remove()` on the element, the data is cleared, - // leaving `result` undefined. We need to guard against this. - return result && result.value; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { - - // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - which: true -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - // Suppress native focus or blur as it's already being fired - // in leverageNative. - _default: function() { - return true; - }, - - delegateType: delegateType - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - // - // Support: Firefox 70+ - // Only Firefox includes border widths - // in computed dimensions. (gh-4529) - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "border:1px solid"; - - // Support: Chrome 86+ - // Height set through cssText does not get applied. - // Computed height then comes back as 0. - tr.style.height = "1px"; - trChild.style.height = "9px"; - - // Support: Android 8 Chrome 86+ - // In our bodyBackground.html iframe, - // display for all div elements is set to "inline", - // which causes a problem only in Android 8 Chrome 86. - // Ensuring the div is display: block - // gets around this issue. - trChild.style.display = "block"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + - parseInt( trStyle.borderTopWidth, 10 ) + - parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml, parserErrorElem; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) {} - - parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; - if ( !xml || parserErrorElem ) { - jQuery.error( "Invalid XML: " + ( - parserErrorElem ? - jQuery.map( parserErrorElem.childNodes, function( el ) { - return el.textContent; - } ).join( "\n" ) : - data - ) ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ).filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ).map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - -originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script but not if jsonp - if ( !isSuccess && - jQuery.inArray( "script", s.dataTypes ) > -1 && - jQuery.inArray( "json", s.dataTypes ) < 0 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( " @@ -148,12 +148,12 @@ def test_nav_markup(): """\