From 9af50a81e22e4e8e8f8dab3948c816baec0ec38f Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Sat, 13 May 2023 22:16:04 -0400 Subject: [PATCH 01/14] init --- openbb_terminal/core/plots/plotly_helper.py | 8 ++++---- .../plotly_ta/plugins/custom_indicators_plugin.py | 8 ++++---- .../plots/plotly_ta/plugins/momentum_plugin.py | 14 +++++++------- .../core/plots/plotly_ta/plugins/overlap_plugin.py | 4 ++-- .../plots/plotly_ta/plugins/volatility_plugin.py | 14 +++++++------- openbb_terminal/core/plots/plotly_ta/ta_class.py | 9 ++++----- openbb_terminal/forex/forex_helper.py | 4 ++-- openbb_terminal/stocks/stocks_helper.py | 4 ++-- 8 files changed, 32 insertions(+), 33 deletions(-) diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index a74589d5a7fe..659eb9aaa539 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -933,11 +933,11 @@ def add_inchart_volume( row=row, col=col, opacity=0.7, - secondary_y=False, + secondary_y=True, ) ticksize = 13 - (self.subplots_kwargs["rows"] // 2) self.update_layout( - yaxis=dict( + yaxis2=dict( fixedrange=True, side="left", nticks=10, @@ -947,15 +947,15 @@ def add_inchart_volume( showline=False, zeroline=False, tickfont=dict(size=ticksize), + overlaying="y", ), - yaxis2=dict( + yaxis=dict( autorange=True, automargin=True, side="right", fixedrange=False, anchor="x", layer="above traces", - overlaying="y", ), ) diff --git a/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py b/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py index 79775c2dbf09..5ea0cbe26153 100644 --- a/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py +++ b/openbb_terminal/core/plots/plotly_ta/plugins/custom_indicators_plugin.py @@ -94,7 +94,7 @@ def is_resistance(df, i): showlegend=False, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) elif is_resistance(df_ta2, i): lv = df_ta2["High"][i] @@ -117,7 +117,7 @@ def is_resistance(df, i): showlegend=False, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) return fig @@ -160,7 +160,7 @@ def plot_fib(self, fig: OpenBBFigure, df_ta: pd.DataFrame): showlegend=False, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) df_ta2 = df_ta.copy() interval = 1440 @@ -201,7 +201,7 @@ def plot_fib(self, fig: OpenBBFigure, df_ta: pd.DataFrame): showlegend=False, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) return fig diff --git a/openbb_terminal/core/plots/plotly_ta/plugins/momentum_plugin.py b/openbb_terminal/core/plots/plotly_ta/plugins/momentum_plugin.py index 7472d2caa260..327a2aaaa4df 100644 --- a/openbb_terminal/core/plots/plotly_ta/plugins/momentum_plugin.py +++ b/openbb_terminal/core/plots/plotly_ta/plugins/momentum_plugin.py @@ -158,7 +158,7 @@ def plot_clenow(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int line=dict(color=self.inchart_colors[inchart_index], width=2), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_annotation( xref="paper", @@ -205,7 +205,7 @@ def plot_demark(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int textfont=dict(color=theme.down_color, size=14.5), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_scatter( x=high.index, @@ -217,7 +217,7 @@ def plot_demark(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int textfont=dict(color=theme.up_color, size=14.5), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_annotation( @@ -554,7 +554,7 @@ def plot_ichimoku(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: i y=conversion_line, line=dict(color="orange", width=1), name="Tenkan-sen", - secondary_y=self.show_volume, + secondary_y=False, showlegend=True, opacity=1, ) @@ -563,7 +563,7 @@ def plot_ichimoku(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: i y=base_line, line=dict(color="blue", width=1), name="Kijun-sen", - secondary_y=self.show_volume, + secondary_y=False, showlegend=True, opacity=1, ) @@ -576,7 +576,7 @@ def plot_ichimoku(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: i fill="tonexty", fillcolor="rgba(0, 150, 0, 0.1)", name="Senkou Span A", - secondary_y=self.show_volume, + secondary_y=False, showlegend=False, opacity=0.2, ) @@ -588,7 +588,7 @@ def plot_ichimoku(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: i fillcolor="rgba(200, 0, 0, 0.1)", name="Senkou Span B", showlegend=False, - secondary_y=self.show_volume, + secondary_y=False, opacity=0.2, ) diff --git a/openbb_terminal/core/plots/plotly_ta/plugins/overlap_plugin.py b/openbb_terminal/core/plots/plotly_ta/plugins/overlap_plugin.py index 2256a937cb03..85ea403ec6d7 100644 --- a/openbb_terminal/core/plots/plotly_ta/plugins/overlap_plugin.py +++ b/openbb_terminal/core/plots/plotly_ta/plugins/overlap_plugin.py @@ -42,7 +42,7 @@ def plot_ma(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int): connectgaps=True, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_annotation( xref="paper", @@ -76,7 +76,7 @@ def plot_vwap(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int): opacity=0.8, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_annotation( xref="paper", diff --git a/openbb_terminal/core/plots/plotly_ta/plugins/volatility_plugin.py b/openbb_terminal/core/plots/plotly_ta/plugins/volatility_plugin.py index 253db26802ab..a9a8b58c7927 100644 --- a/openbb_terminal/core/plots/plotly_ta/plugins/volatility_plugin.py +++ b/openbb_terminal/core/plots/plotly_ta/plugins/volatility_plugin.py @@ -59,7 +59,7 @@ def plot_bbands(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int line=dict(width=1, color=theme.up_color), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_scatter( name=f"{columns_regex(df_ta, 'BBL')[0]}", @@ -70,7 +70,7 @@ def plot_bbands(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int line=dict(width=1, color=theme.down_color), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_scatter( name=f"{columns_regex(df_ta, 'BBM')[0]}", @@ -81,7 +81,7 @@ def plot_bbands(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int line=dict(width=1, color=theme.get_colors()[1], dash="dash"), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) bbands_text = ( columns_regex(df_ta, "BBL")[0].replace("BBL_", "BB").replace("_", ",") @@ -124,7 +124,7 @@ def plot_donchian(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: i line=dict(width=0.3, color="#EF6689"), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_scatter( name=f"{columns_regex(df_ta, 'DCL')[0]}", @@ -137,7 +137,7 @@ def plot_donchian(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: i fillcolor=fillcolor, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) donchian_text = ( @@ -184,7 +184,7 @@ def plot_kc(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int): line=dict(width=0.3, color="#EF6689"), row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.add_scatter( name=f"{columns_regex(df_ta, 'KCL')[0]}", @@ -197,7 +197,7 @@ def plot_kc(self, fig: OpenBBFigure, df_ta: pd.DataFrame, inchart_index: int): fillcolor=fillcolor, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) kctext = ( columns_regex(df_ta, "KCL")[0] diff --git a/openbb_terminal/core/plots/plotly_ta/ta_class.py b/openbb_terminal/core/plots/plotly_ta/ta_class.py index eec80c986ac5..b11b6aa6161c 100644 --- a/openbb_terminal/core/plots/plotly_ta/ta_class.py +++ b/openbb_terminal/core/plots/plotly_ta/ta_class.py @@ -377,7 +377,7 @@ def init_plot(self, symbol: str = "", candles: bool = True) -> OpenBBFigure: showlegend=False, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) else: fig.add_scatter( @@ -387,7 +387,7 @@ def init_plot(self, symbol: str = "", candles: bool = True) -> OpenBBFigure: connectgaps=True, row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, ) fig.update_layout(yaxis=dict(nticks=15)) self.inchart_colors = theme.get_colors()[1:] @@ -486,7 +486,7 @@ def plot_fig( figure.update_yaxes( row=1, col=1, - secondary_y=self.show_volume, + secondary_y=False, nticks=15 if subplot_row < 3 else 10, tickfont=dict(size=16), ) @@ -553,8 +553,7 @@ def process_fig(self, fig: OpenBBFigure, volume_ticks_x: int = 7) -> OpenBBFigur for trace in fig.select_traces(): xref, yref = trace.xaxis, trace.yaxis row, col = subplots[xref][yref][0] - secondary_y = not row > 1 if self.show_volume else False - new_subplot.add_trace(trace, row=row, col=col, secondary_y=secondary_y) + new_subplot.add_trace(trace, row=row, col=col, secondary_y=False) fig_json = fig.to_plotly_json()["layout"] for layout in fig_json: diff --git a/openbb_terminal/forex/forex_helper.py b/openbb_terminal/forex/forex_helper.py index 396f1e3d257c..47402ec4f9c7 100644 --- a/openbb_terminal/forex/forex_helper.py +++ b/openbb_terminal/forex/forex_helper.py @@ -269,9 +269,9 @@ def display_candle( data.name = f"{from_symbol}/{to_symbol}" fig = PlotlyTA.plot(data, dict(rma=dict(length=ma)), volume=has_volume) if add_trend: - fig.add_trend(data, secondary_y=has_volume) + fig.add_trend(data, secondary_y=False) - fig.update_yaxes(type=yscale, row=1, col=1, nticks=20, secondary_y=has_volume) + fig.update_yaxes(type=yscale, row=1, col=1, nticks=20, secondary_y=False) return fig.show(external=external_axes) diff --git a/openbb_terminal/stocks/stocks_helper.py b/openbb_terminal/stocks/stocks_helper.py index afb51468ffb3..1f34541dea3d 100644 --- a/openbb_terminal/stocks/stocks_helper.py +++ b/openbb_terminal/stocks/stocks_helper.py @@ -687,9 +687,9 @@ def display_candle( fig = PlotlyTA.plot(data, dict(**kwargs), prepost=prepost) if add_trend: - fig.add_trend(data, secondary_y=True) + fig.add_trend(data, secondary_y=False) - fig.update_layout(yaxis2=dict(type=yscale)) + fig.update_layout(yaxis=dict(type=yscale)) return fig.show(external=external_axes) From 162f74a216b986bd1efb37e29c16271da0568a2f Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Sun, 14 May 2023 16:52:19 -0400 Subject: [PATCH 02/14] fix tables save --- frontend-components/plotly/src/utils/utils.ts | 650 +++++++++--------- frontend-components/tables/src/utils/utils.ts | 525 +++++++------- openbb_terminal/core/plots/plotly.html | 4 +- openbb_terminal/core/plots/table.html | 112 +-- 4 files changed, 649 insertions(+), 642 deletions(-) diff --git a/frontend-components/plotly/src/utils/utils.ts b/frontend-components/plotly/src/utils/utils.ts index d5aea8d6bb01..80146f0fc75e 100644 --- a/frontend-components/plotly/src/utils/utils.ts +++ b/frontend-components/plotly/src/utils/utils.ts @@ -1,377 +1,381 @@ // @ts-nocheck import domtoimage from "dom-to-image"; -import { Figure } from "react-plotly.js"; import * as Plotly from "plotly.js-dist-min"; +import { Figure } from "react-plotly.js"; const exportNativeFileSystem = async ({ - fileHandle, - blob, + fileHandle, + blob, }: { - fileHandle?: FileSystemFileHandle | null; - blob: Blob; + fileHandle?: FileSystemFileHandle | null; + blob: Blob; }) => { - if (!fileHandle) { - return; - } + if (!fileHandle) { + return; + } - return writeFileHandler({ fileHandle, blob }); + return writeFileHandler({ fileHandle, blob }); }; const writeFileHandler = async ({ - fileHandle, - blob, + fileHandle, + blob, }: { - fileHandle: FileSystemFileHandle; - blob: Blob; + fileHandle: FileSystemFileHandle; + blob: Blob; }) => { - const writer = await fileHandle.createWritable(); - await writer.write(blob); - await writer.close(); + const writer = await fileHandle.createWritable(); + await writer.write(blob); + await writer.close(); }; const IMAGE_TYPE: FilePickerAcceptType[] = [ - { - description: "PNG Image", - accept: { - "image/png": [".png"], - }, - }, - { - description: "JPEG Image", - accept: { - "image/jpeg": [".jpeg"], - }, - }, - { - description: "SVG Image", - accept: { - "image/svg+xml": [".svg"], - }, - }, + { + description: "PNG Image", + accept: { + "image/png": [".png"], + }, + }, + { + description: "JPEG Image", + accept: { + "image/jpeg": [".jpeg"], + }, + }, + { + description: "SVG Image", + accept: { + "image/svg+xml": [".svg"], + }, + }, ]; const getNewFileHandle = ({ - filename, - is_image, + filename, + is_image, }: { - filename: string; - is_image?: boolean; + filename: string; + is_image?: boolean; }): Promise => { - if ("showSaveFilePicker" in window) { - const opts: SaveFilePickerOptions = { - suggestedName: filename, - types: is_image - ? IMAGE_TYPE - : [ - { - description: "CSV File", - accept: { - "image/csv": [".csv"], - }, - }, - ], - excludeAcceptAllOption: true, - }; - - return showSaveFilePicker(opts); - } - - return new Promise((resolve) => { - resolve(null); - }); + try { + if ("showSaveFilePicker" in window) { + const opts: SaveFilePickerOptions = { + suggestedName: filename, + types: is_image + ? IMAGE_TYPE + : [ + { + description: "CSV File", + accept: { + "image/csv": [".csv"], + }, + }, + ], + excludeAcceptAllOption: true, + }; + + return showSaveFilePicker(opts); + } + } catch (error) { + console.error(error); + } + + return new Promise((resolve) => { + resolve(null); + }); }; export const saveToFile = ( - blob: Blob, - fileName: string, - fileHandle?: FileSystemFileHandle | null + blob: Blob, + fileName: string, + fileHandle?: FileSystemFileHandle | null, ) => { - try { - if (fileHandle === null) { - throw new Error("Cannot access filesystem"); - } - return exportNativeFileSystem({ fileHandle, blob }); - } catch (error) { - console.error("oops, something went wrong!", error); - const url = URL.createObjectURL(blob); - const link = document.createElement("a"); - link.setAttribute("href", url); - link.setAttribute("download", fileName); - link.style.visibility = "hidden"; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } - return new Promise((resolve) => { - resolve(true); - }); + try { + if (fileHandle === null) { + throw new Error("Cannot access filesystem"); + } + return exportNativeFileSystem({ fileHandle, blob }); + } catch (error) { + console.error("oops, something went wrong!", error); + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + link.setAttribute("href", url); + link.setAttribute("download", fileName); + link.style.visibility = "hidden"; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + return new Promise((resolve) => { + resolve(true); + }); }; export async function downloadCSV( - gd: Figure, - downloadFinished: (change: boolean) => void + gd: Figure, + downloadFinished: (change: boolean) => void, ) { - let data = gd.data; - let columns: string[] = []; - let rows: any[] = []; - - let xaxis = - "title" in gd.layout["xaxis"] && - gd.layout["xaxis"]["title"]["text"] != undefined - ? gd.layout["xaxis"]["title"]["text"] - : "x"; - - let yaxis = - "title" in gd.layout["yaxis"] && - gd.layout["yaxis"]["title"]["text"] != undefined - ? gd.layout["yaxis"]["title"]["text"] - : "y"; - - data.forEach(function (trace) { - if (trace.type == "candlestick") { - if (columns.length == 0) { - columns = ["Date", "Open", "High", "Low", "Close"]; - } - trace.x.forEach(function (x, i) { - rows.push([ - x, - trace.open[i], - trace.high[i], - trace.low[i], - trace.close[i], - ]); - }); - } - - if (trace.type == "scatter") { - if (columns.length == 0) { - columns.push(xaxis); - } - columns.push(trace.name != undefined ? trace.name : yaxis); - trace.x.forEach(function (x, i) { - if (rows[i] == undefined) { - rows[i] = [x]; - } - rows[i].push(trace.y[i]); - }); - } - }); - - return await downloadData(columns, rows, downloadFinished); + const data = gd.data; + let columns: string[] = []; + const rows: any[] = []; + + const xaxis = + "title" in gd.layout["xaxis"] && + gd.layout["xaxis"]["title"]["text"] !== undefined + ? gd.layout["xaxis"]["title"]["text"] + : "x"; + + const yaxis = + "title" in gd.layout["yaxis"] && + gd.layout["yaxis"]["title"]["text"] !== undefined + ? gd.layout["yaxis"]["title"]["text"] + : "y"; + + data.forEach(function (trace) { + if (trace.type === "candlestick") { + if (columns.length === 0) { + columns = ["Date", "Open", "High", "Low", "Close"]; + } + trace.x.forEach(function (x, i) { + rows.push([ + x, + trace.open[i], + trace.high[i], + trace.low[i], + trace.close[i], + ]); + }); + } + + if (trace.type === "scatter") { + if (columns.length === 0) { + columns.push(xaxis); + } + columns.push(trace.name !== undefined ? trace.name : yaxis); + trace.x.forEach(function (x, i) { + if (rows[i] === undefined) { + rows[i] = [x]; + } + rows[i].push(trace.y[i]); + }); + } + }); + + return await downloadData(columns, rows, downloadFinished); } export async function downloadData( - columns: any, - data: any, - downloadFinished: (change: boolean) => void + columns: any, + data: any, + downloadFinished: (change: boolean) => void, ) { - const headers = columns; - const rows = data.map((row: any) => - row.map((cell: any) => { - if (cell == null) { - return ""; - } else if (typeof cell === "object") { - return JSON.stringify(cell); - } else { - return cell.toString().replace(/"/g, '""'); - } - }) - ); - const csvData = [headers, ...rows]; - - const csvContent = csvData.map((e) => e.join(",")).join("\n"); - const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" }); - const filename = `${window.title}.csv`; - try { - let fileHandle = await getNewFileHandle({ - filename: filename, - }); - - await loadingOverlay("Saving CSV"); - - non_blocking(async function () { - // @ts-ignore - saveToFile(blob, filename, fileHandle).then(async function () { - await new Promise((resolve) => setTimeout(resolve, 1500)); - if (!fileHandle) { - downloadFinished(true); - } - await loadingOverlay("", true); - }); - }, 2)(); - } catch (error) { - console.error(error); - } + const headers = columns; + const rows = data.map((row: any) => + row.map((cell: any) => { + if (cell == null) { + return ""; + } else if (typeof cell === "object") { + return JSON.stringify(cell); + } else { + return cell.toString().replace(/"/g, '""'); + } + }), + ); + const csvData = [headers, ...rows]; + + const csvContent = csvData.map((e) => e.join(",")).join("\n"); + const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" }); + const filename = `${window.title}.csv`; + try { + const fileHandle = await getNewFileHandle({ + filename: filename, + }); + + await loadingOverlay("Saving CSV"); + + non_blocking(async function () { + // @ts-ignore + saveToFile(blob, filename, fileHandle).then(async function () { + await new Promise((resolve) => setTimeout(resolve, 1500)); + if (!fileHandle) { + downloadFinished(true); + } + await loadingOverlay("", true); + }); + }, 2)(); + } catch (error) { + console.error(error); + } } function loadingOverlay(message?: string, is_close?: boolean) { - const loading = window.document.getElementById("loading") as HTMLElement; - const loading_text = window.document.getElementById( - "loading_text" - ) as HTMLElement; - return new Promise((resolve) => { - if (is_close) { - loading.classList.remove("show"); - } else { - // @ts-ignore - loading_text.innerHTML = message; - loading.classList.add("show"); - } - - let is_loaded = setInterval(function () { - if ( - is_close - ? !loading.classList.contains("show") - : loading.classList.contains("show") - ) { - clearInterval(is_loaded); - resolve(true); - } - }, 0.01); - }); + const loading = window.document.getElementById("loading") as HTMLElement; + const loading_text = window.document.getElementById( + "loading_text", + ) as HTMLElement; + return new Promise((resolve) => { + if (is_close) { + loading.classList.remove("show"); + } else { + // @ts-ignore + loading_text.innerHTML = message; + loading.classList.add("show"); + } + + const is_loaded = setInterval(function () { + if ( + is_close + ? !loading.classList.contains("show") + : loading.classList.contains("show") + ) { + clearInterval(is_loaded); + resolve(true); + } + }, 0.01); + }); } export const non_blocking = (func: Function, delay: number) => { - let timeout: number; - return function () { - // @ts-ignore - const context = this; - const args = arguments; - clearTimeout(timeout); - timeout = setTimeout(() => func.apply(context, args), delay); - }; + let timeout: number; + return function () { + // @ts-ignore + const context = this; + const args = arguments; + clearTimeout(timeout); + timeout = setTimeout(() => func.apply(context, args), delay); + }; }; const openbb_watermark = { - yref: "paper", - xref: "paper", - x: 1, - y: 0, - text: "OpenBB Terminal", - font_size: 17, - font_color: "gray", - opacity: 0.5, - xanchor: "right", - yanchor: "bottom", - yshift: -80, - xshift: 40, + yref: "paper", + xref: "paper", + x: 1, + y: 0, + text: "OpenBB Terminal", + font_size: 17, + font_color: "gray", + opacity: 0.5, + xanchor: "right", + yanchor: "bottom", + yshift: -80, + xshift: 40, }; async function setWatermarks(margin, old_index, init = false) { - const chart = document.getElementById("plotlyChart") as HTMLElement; - - if (init) { - chart.layout.annotations.push(openbb_watermark); - if ( - chart.globals.cmd_idx != undefined && - chart.globals.cmd_src != undefined - ) { - chart.layout.annotations[chart.globals.cmd_idx].text = - chart.globals.cmd_src; - } - - Plotly.relayout(chart, { - "title.text": chart.globals.title, - margin: chart.globals.old_margin, - }); - } - - if (!init) { - if ( - chart.globals.cmd_idx != undefined && - chart.globals.cmd_src != undefined - ) { - chart.layout.annotations[chart.globals.cmd_idx].text = ""; - } - chart.layout.annotations.splice(old_index, 1); - - Plotly.relayout(chart, { - "title.text": "", - margin: margin, - }); - } + const chart = document.getElementById("plotlyChart") as HTMLElement; + + if (init) { + chart.layout.annotations.push(openbb_watermark); + if ( + chart.globals.cmd_idx !== undefined && + chart.globals.cmd_src !== undefined + ) { + chart.layout.annotations[chart.globals.cmd_idx].text = + chart.globals.cmd_src; + } + + Plotly.relayout(chart, { + "title.text": chart.globals.title, + margin: chart.globals.old_margin, + }); + } + + if (!init) { + if ( + chart.globals.cmd_idx !== undefined && + chart.globals.cmd_src !== undefined + ) { + chart.layout.annotations[chart.globals.cmd_idx].text = ""; + } + chart.layout.annotations.splice(old_index, 1); + + Plotly.relayout(chart, { + "title.text": "", + margin: margin, + }); + } } export async function saveImage( - id: string, - filename: string, - extension: string + id: string, + filename: string, + extension: string, ) { - const chart = document.getElementById(id) as HTMLElement; - - if (["svg", "pdf"].includes(extension)) { - const chart = document.getElementById("plotlyChart") as HTMLElement; - const margin = chart.layout.margin; - const old_index = chart.layout.annotations.length; - - await setWatermarks(margin, old_index, true); - - Plotly.downloadImage(chart, { - format: "svg", - height: chart.clientHeight, - width: chart.clientWidth, - filename: window.title, - }); - - await setWatermarks(margin, old_index, false); - await loadingOverlay("", true); - return; - } - - non_blocking(async function () { - domtoimage.toBlob(chart).then(function (blob: Blob) { - saveToFile(blob, filename, null); - }); - }, 2)(); + const chart = document.getElementById(id) as HTMLElement; + + if (["svg", "pdf"].includes(extension)) { + const chart = document.getElementById("plotlyChart") as HTMLElement; + const margin = chart.layout.margin; + const old_index = chart.layout.annotations.length; + + await setWatermarks(margin, old_index, true); + + Plotly.downloadImage(chart, { + format: "svg", + height: chart.clientHeight, + width: chart.clientWidth, + filename: window.title, + }); + + await setWatermarks(margin, old_index, false); + await loadingOverlay("", true); + return; + } + + non_blocking(async function () { + domtoimage.toBlob(chart).then(function (blob: Blob) { + saveToFile(blob, filename, null); + }); + }, 2)(); } export async function downloadImage( - id: string, - hidemodebar: () => void, - loading: (bool: boolean) => void, - downloadFinished: (bool: boolean) => void + id: string, + hidemodebar: () => void, + loading: (bool: boolean) => void, + downloadFinished: (bool: boolean) => void, ) { - const chart = document.getElementById(id) as HTMLElement; - const filename = `${window.title}.png`; - - try { - loading(true); - let fileHandle = await getNewFileHandle({ - filename: filename, - is_image: true, - }); - let extension: string = "png"; - if (fileHandle !== null) { - // @ts-ignore - extension = fileHandle.name.split(".").pop(); - } - await loadingOverlay(`Saving ${extension.toUpperCase()}`); - - if (["svg", "pdf"].includes(extension)) { - await saveImage(id, filename, extension); - hidemodebar(false); - loading(false); - if (!fileHandle) { - downloadFinished(true); - } - return; - } - - non_blocking(async function () { - domtoimage.toBlob(chart).then(function (blob: Blob) { - saveToFile(blob, filename, fileHandle).then(async function () { - await loadingOverlay("", true); - hidemodebar(false); - loading(false); - if (!fileHandle) { - downloadFinished(true); - } - }); - }); - }, 2)(); - } catch (error) { - console.error(error); - hidemodebar(false); - loading(false); - } + const chart = document.getElementById(id) as HTMLElement; + const filename = `${window.title}.png`; + + try { + loading(true); + const fileHandle = await getNewFileHandle({ + filename: filename, + is_image: true, + }); + let extension = "png"; + if (fileHandle !== null) { + // @ts-ignore + extension = fileHandle.name.split(".").pop(); + } + await loadingOverlay(`Saving ${extension.toUpperCase()}`); + + if (["svg", "pdf"].includes(extension)) { + await saveImage(id, filename, extension); + hidemodebar(false); + loading(false); + if (!fileHandle) { + downloadFinished(true); + } + return; + } + + non_blocking(async function () { + domtoimage.toBlob(chart).then(function (blob: Blob) { + saveToFile(blob, filename, fileHandle).then(async function () { + await loadingOverlay("", true); + hidemodebar(false); + loading(false); + if (!fileHandle) { + downloadFinished(true); + } + }); + }); + }, 2)(); + } catch (error) { + console.error(error); + hidemodebar(false); + loading(false); + } } diff --git a/frontend-components/tables/src/utils/utils.ts b/frontend-components/tables/src/utils/utils.ts index 29abcb2f030c..370f533d200b 100644 --- a/frontend-components/tables/src/utils/utils.ts +++ b/frontend-components/tables/src/utils/utils.ts @@ -2,317 +2,320 @@ import { rankItem } from "@tanstack/match-sorter-utils"; import domtoimage from "dom-to-image"; import { utils, writeFile } from "xlsx"; -export function formatNumberNoMagnitude(number: number | string) { - if (typeof number === "string") { - const suffix = number.replace(/[^a-zA-Z]/g, "").trim(); - const magnitude = ["", "K", "M", "B", "T"].indexOf( - suffix.replace(/\s/g, "") - ); - number = - Number(number.replace(/[^0-9.]/g, "").trim()) * - Math.pow(10, magnitude * 3); - } - - return number; +export function formatNumberNoMagnitude(value: number | string) { + if (typeof value === "string") { + const suffix = value.replace(/[^a-zA-Z]/g, "").trim(); + const magnitude = ["", "K", "M", "B", "T"].indexOf( + suffix.replace(/\s/g, ""), + ); + value = + Number(value.replace(/[^0-9.]/g, "").trim()) * + Math.pow(10, magnitude * 3); + } + + return value; } -export function formatNumberMagnitude( - number: number | string, - column?: string -) { - if (typeof number === "string") { - number = Number(formatNumberNoMagnitude(number)); - } - - if (number % 1 !== 0) { - const decimalPlaces = Math.max( - 2, - number.toString().split(".")[1]?.length || 0 - ); - const toFixed = Math.min(4, decimalPlaces); - if (number < 1000) { - return number.toFixed(toFixed) || 0; - } - } - - if (number > 1000 && !includesPriceNames(column || "")) { - const magnitude = Math.min(4, Math.floor(Math.log10(Math.abs(number)) / 3)); - const suffix = ["", "K", "M", "B", "T"][magnitude]; - const formatted = (number / 10 ** (magnitude * 3)).toFixed(2); - return `${formatted} ${suffix}`; - } - - if (number > 1000) { - return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); - } - - return number; +export function formatNumberMagnitude(value: number | string, column?: string) { + if (typeof value === "string") { + value = Number(formatNumberNoMagnitude(value)); + } + + if (value % 1 !== 0) { + const decimalPlaces = Math.max( + 2, + value.toString().split(".")[1]?.length || 0, + ); + const toFixed = Math.min(4, decimalPlaces); + if (value < 1000) { + return value.toFixed(toFixed) || 0; + } + } + + if (value > 100_000 && !includesPriceNames(column || "")) { + const magnitude = Math.min(4, Math.floor(Math.log10(Math.abs(value)) / 3)); + const suffix = ["", "K", "M", "B", "T"][magnitude]; + const formatted = (value / 10 ** (magnitude * 3)).toFixed(2); + return `${formatted} ${suffix}`; + } + + if (value > 1000) { + return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + } + + return value; } export function includesDateNames(column: string) { - return ["date", "day", "time", "timestamp", "year"].some((dateName) => - column?.toLowerCase().includes(dateName) - ); + return ["date", "day", "time", "timestamp", "year"].some((dateName) => + column?.toLowerCase().includes(dateName), + ); } export function includesPriceNames(column: string) { - return ["price", "open", "close", "high", "low"].some((priceName) => - column?.toLowerCase().includes(priceName) - ); + return ["price", "open", "close", "high", "low"].some((priceName) => + column?.toLowerCase().includes(priceName), + ); } function loadingOverlay(message?: string, is_close?: boolean) { - const loading = window.document.getElementById("loading") as HTMLElement; - const loading_text = window.document.getElementById( - "loading_text" - ) as HTMLElement; - return new Promise((resolve) => { - if (is_close) { - loading.classList.remove("show"); - } else { - // @ts-ignore - loading_text.innerHTML = message; - loading.classList.add("show"); - } - - let is_loaded = setInterval(function () { - if ( - is_close - ? !loading.classList.contains("show") - : loading.classList.contains("show") - ) { - clearInterval(is_loaded); - resolve(true); - } - }, 0.01); - }); + const loading = window.document.getElementById("loading") as HTMLElement; + const loading_text = window.document.getElementById( + "loading_text", + ) as HTMLElement; + return new Promise((resolve) => { + if (is_close) { + loading.classList.remove("show"); + } else { + // @ts-ignore + loading_text.innerHTML = message; + loading.classList.add("show"); + } + + const is_loaded = setInterval(function () { + if ( + is_close + ? !loading.classList.contains("show") + : loading.classList.contains("show") + ) { + clearInterval(is_loaded); + resolve(true); + } + }, 0.01); + }); } export function isEqual(a: any, b: any) { - if (a === b) return true; - if (a == null || b == null) return false; - if (a?.length !== b?.length) return false; - - for (var i = 0; i < a?.length; ++i) { - if (a[i] !== b[i]) return false; - } - return true; + if (a === b) return true; + if (a == null || b == null) return false; + if (a?.length !== b?.length) return false; + + for (let i = 0; i < a?.length; ++i) { + if (a[i] !== b[i]) return false; + } + return true; } export const fuzzyFilter = ( - row: any, - columnId: string, - value: string, - addMeta: any + row: any, + columnId: string, + value: string, + addMeta: any, ): any => { - const itemRank = rankItem(row.getValue(columnId), value); - addMeta(itemRank); - return itemRank; + const itemRank = rankItem(row.getValue(columnId), value); + addMeta(itemRank); + return itemRank; }; const exportNativeFileSystem = async ({ - fileHandle, - blob, + fileHandle, + blob, }: { - fileHandle?: FileSystemFileHandle | null; - blob: Blob; + fileHandle?: FileSystemFileHandle | null; + blob: Blob; }) => { - if (!fileHandle) { - return; - } + if (!fileHandle) { + return; + } - await writeFileHandler({ fileHandle, blob }); + await writeFileHandler({ fileHandle, blob }); }; const writeFileHandler = async ({ - fileHandle, - blob, + fileHandle, + blob, }: { - fileHandle: FileSystemFileHandle; - blob: Blob; + fileHandle: FileSystemFileHandle; + blob: Blob; }) => { - const writer = await fileHandle.createWritable(); - await writer.write(blob); - await writer.close(); + const writer = await fileHandle.createWritable(); + await writer.write(blob); + await writer.close(); }; const IMAGE_TYPE: FilePickerAcceptType[] = [ - { - description: "PNG Image", - accept: { - "image/png": [".png"], - }, - }, - { - description: "JPEG Image", - accept: { - "image/jpeg": [".jpeg"], - }, - }, + { + description: "PNG Image", + accept: { + "image/png": [".png"], + }, + }, + { + description: "JPEG Image", + accept: { + "image/jpeg": [".jpeg"], + }, + }, ]; const getNewFileHandle = ({ - filename, - is_image, + filename, + is_image, }: { - filename: string; - is_image?: boolean; + filename: string; + is_image?: boolean; }): Promise => { - if ("showSaveFilePicker" in window) { - const opts: SaveFilePickerOptions = { - suggestedName: filename, - types: is_image - ? IMAGE_TYPE - : [ - { - description: "CSV File", - accept: { - "image/csv": [".csv"], - }, - }, - ], - excludeAcceptAllOption: true, - }; - - return showSaveFilePicker(opts); - } - - return new Promise((resolve) => { - resolve(null); - }); + try { + if ("showSaveFilePicker" in window) { + const opts: SaveFilePickerOptions = { + suggestedName: filename, + types: is_image + ? IMAGE_TYPE + : [ + { + description: "CSV File", + accept: { + "image/csv": [".csv"], + }, + }, + ], + excludeAcceptAllOption: true, + }; + + return showSaveFilePicker(opts); + } + } catch (error) { + console.error(error); + } + + return new Promise((resolve) => { + resolve(null); + }); }; export const saveToFile = ( - blob: Blob, - fileName: string, - fileHandle?: FileSystemFileHandle + blob: Blob, + fileName: string, + fileHandle?: FileSystemFileHandle, ) => { - try { - if (fileHandle === null) { - throw new Error("Cannot access filesystem"); - } - exportNativeFileSystem({ fileHandle, blob }); - } catch (error) { - const url = URL.createObjectURL(blob); - const link = document.createElement("a"); - link.setAttribute("href", url); - link.setAttribute("download", fileName); - link.style.visibility = "hidden"; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - } - - return new Promise((resolve) => { - resolve(true); - }); + try { + if (fileHandle === null) { + throw new Error("Cannot access filesystem"); + } + exportNativeFileSystem({ fileHandle, blob }); + } catch (error) { + console.error("oops, something went wrong!", error); + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + link.setAttribute("href", url); + link.setAttribute("download", fileName); + link.style.visibility = "hidden"; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + + return new Promise((resolve) => { + resolve(true); + }); }; export async function downloadData( - type: "csv" | "xlsx", - columns: any, - data: any, - downloadFinished: (changed: boolean) => void + type: "csv" | "xlsx", + columns: any, + data: any, + downloadFinished: (changed: boolean) => void, ) { - const headers = columns; - const rows = data.map((row: any) => - headers.map((column: any) => row[column]) - ); - const csvData = [headers, ...rows]; - - if (type === "csv") { - const csvContent = csvData.map((e) => e.join(",")).join("\n"); - const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" }); - const filename = `${window.title}.csv`; - - try { - let fileHandle = await getNewFileHandle({ - filename: filename, - }); - let ext: string = "csv"; - - if (fileHandle !== null) { - // @ts-ignore - ext = fileHandle.name.split(".").pop(); - } - - await loadingOverlay(`Saving ${ext.toUpperCase()}`); - - // @ts-ignore - non_blocking(async function () { - // @ts-ignore - saveToFile(blob, filename, fileHandle).then(async function () { - await new Promise((resolve) => setTimeout(resolve, 1500)); - await loadingOverlay("", true); - if (!fileHandle) { - downloadFinished(true); - } - }); - }, 2)(); - } catch (error) { - console.error(error); - } - - return; - } - - const wb = utils.book_new(); - const ws = utils.aoa_to_sheet(csvData); - utils.book_append_sheet(wb, ws, "Sheet1"); - await loadingOverlay(`Saving XLSX`); - non_blocking(async function () { - // @ts-ignore - // timeout to allow loading overlay to show - await new Promise((resolve) => setTimeout(resolve, 1500)); - writeFile(wb, `${window.title}.xlsx`); - await loadingOverlay("", true); - downloadFinished && downloadFinished(true); - }, 2)(); + const headers = columns; + const rows = data.map((row: any) => + headers.map((column: any) => row[column]), + ); + const csvData = [headers, ...rows]; + + if (type === "csv") { + const csvContent = csvData.map((e) => e.join(",")).join("\n"); + const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" }); + const filename = `${window.title}.csv`; + + try { + const fileHandle = await getNewFileHandle({ + filename: filename, + }); + let ext = "csv"; + + if (fileHandle !== null) { + // @ts-ignore + ext = fileHandle.name.split(".").pop(); + } + + await loadingOverlay(`Saving ${ext.toUpperCase()}`); + + // @ts-ignore + non_blocking(async function () { + // @ts-ignore + saveToFile(blob, filename, fileHandle).then(async function () { + await new Promise((resolve) => setTimeout(resolve, 1500)); + await loadingOverlay("", true); + if (!fileHandle) { + downloadFinished(true); + } + }); + }, 2)(); + } catch (error) { + console.error(error); + } + + return; + } + + const wb = utils.book_new(); + const ws = utils.aoa_to_sheet(csvData); + utils.book_append_sheet(wb, ws, "Sheet1"); + await loadingOverlay("Saving XLSX"); + non_blocking(async function () { + // @ts-ignore + // timeout to allow loading overlay to show + await new Promise((resolve) => setTimeout(resolve, 1500)); + writeFile(wb, `${window.title}.xlsx`); + await loadingOverlay("", true); + downloadFinished?.(true); + }, 2)(); } export async function downloadImage( - id: string, - downloadFinished: (change: boolean) => void + id: string, + downloadFinished: (change: boolean) => void, ) { - const table = document.getElementById(id); - const filename = `${window.title}.png`; - try { - let fileHandle = await getNewFileHandle({ - filename: filename, - is_image: true, - }); - let extension: string = "png"; - if (fileHandle !== null) { - // @ts-ignore - extension = fileHandle.name.split(".").pop(); - } - await loadingOverlay(`Saving ${extension.toUpperCase()}`); - - non_blocking(async function () { - // @ts-ignore - domtoimage.toBlob(table).then(function (blob: Blob) { - // @ts-ignore - saveToFile(blob, filename, fileHandle).then(async function () { - await new Promise((resolve) => setTimeout(resolve, 1500)); - await loadingOverlay("", true); - if (!fileHandle) { - downloadFinished(true); - } - }); - }); - }, 2)(); - } catch (error) { - console.error(error); - } + const table = document.getElementById(id); + const filename = `${window.title}.png`; + try { + const fileHandle = await getNewFileHandle({ + filename: filename, + is_image: true, + }); + let extension = "png"; + if (fileHandle !== null) { + // @ts-ignore + extension = fileHandle.name.split(".").pop(); + } + await loadingOverlay(`Saving ${extension.toUpperCase()}`); + + non_blocking(async function () { + // @ts-ignore + domtoimage.toBlob(table).then(function (blob: Blob) { + // @ts-ignore + saveToFile(blob, filename, fileHandle).then(async function () { + await new Promise((resolve) => setTimeout(resolve, 1500)); + await loadingOverlay("", true); + if (!fileHandle) { + downloadFinished(true); + } + }); + }); + }, 2)(); + } catch (error) { + console.error(error); + } } export const non_blocking = (func: Function, delay: number) => { - let timeout: number; - return function () { - // @ts-ignore - const context = this; - const args = arguments; - clearTimeout(timeout); - timeout = setTimeout(() => func.apply(context, args), delay); - }; + let timeout: number; + return function () { + // @ts-ignore + const context = this; + // rome-ignore lint/style/noArguments: + const args = arguments; + clearTimeout(timeout); + timeout = setTimeout(() => func.apply(context, args), delay); + }; }; diff --git a/openbb_terminal/core/plots/plotly.html b/openbb_terminal/core/plots/plotly.html index eac4e29f79bc..3552fff98388 100644 --- a/openbb_terminal/core/plots/plotly.html +++ b/openbb_terminal/core/plots/plotly.html @@ -3697,8 +3697,8 @@ `)},l7=0,Df=[];function u7(P){var F=Un.useRef([]),J=Un.useRef([0,0]),ce=Un.useRef(),Pe=Un.useState(l7++)[0],D=Un.useState(function(){return Tw()})[0],E=Un.useRef(P);Un.useEffect(function(){E.current=P},[P]),Un.useEffect(function(){if(P.inert){document.body.classList.add("block-interactivity-".concat(Pe));var t=Pk([P.lockRef.current],(P.shards||[]).map(Rb),!0).filter(Boolean);return t.forEach(function(i){return i.classList.add("allow-interactivity-".concat(Pe))}),function(){document.body.classList.remove("block-interactivity-".concat(Pe)),t.forEach(function(i){return i.classList.remove("allow-interactivity-".concat(Pe))})}}},[P.inert,P.lockRef.current,P.shards]);var e=Un.useCallback(function(t,i){if("touches"in t&&t.touches.length===2)return!E.current.allowPinchZoom;var r=Qd(t),n=J.current,o="deltaX"in t?t.deltaX:n[0]-r[0],a="deltaY"in t?t.deltaY:n[1]-r[1],u,p=t.target,c=Math.abs(o)>Math.abs(a)?"h":"v";if("touches"in t&&c==="h"&&p.type==="range")return!1;var b=Ob(c,p);if(!b)return!0;if(b?u=c:(u=c==="v"?"h":"v",b=Ob(c,p)),!b)return!1;if(!ce.current&&"changedTouches"in t&&(o||a)&&(ce.current=u),!u)return!0;var d=ce.current||u;return a7(d,i,t,d==="h"?o:a,!0)},[]),_=Un.useCallback(function(t){var i=t;if(!(!Df.length||Df[Df.length-1]!==D)){var r="deltaY"in i?Ib(i):Qd(i),n=F.current.filter(function(u){return u.name===i.type&&u.target===i.target&&o7(u.delta,r)})[0];if(n&&n.should){i.cancelable&&i.preventDefault();return}if(!n){var o=(E.current.shards||[]).map(Rb).filter(Boolean).filter(function(u){return u.contains(i.target)}),a=o.length>0?e(i,o[0]):!E.current.noIsolation;a&&i.cancelable&&i.preventDefault()}}},[]),w=Un.useCallback(function(t,i,r,n){var o={name:t,delta:i,target:r,should:n};F.current.push(o),setTimeout(function(){F.current=F.current.filter(function(a){return a!==o})},1)},[]),s=Un.useCallback(function(t){J.current=Qd(t),ce.current=void 0},[]),T=Un.useCallback(function(t){w(t.type,Ib(t),t.target,e(t,P.lockRef.current))},[]),y=Un.useCallback(function(t){w(t.type,Qd(t),t.target,e(t,P.lockRef.current))},[]);Un.useEffect(function(){return Df.push(D),P.setCallbacks({onScrollCapture:T,onWheelCapture:T,onTouchMoveCapture:y}),document.addEventListener("wheel",_,zf),document.addEventListener("touchmove",_,zf),document.addEventListener("touchstart",s,zf),function(){Df=Df.filter(function(t){return t!==D}),document.removeEventListener("wheel",_,zf),document.removeEventListener("touchmove",_,zf),document.removeEventListener("touchstart",s,zf)}},[]);var f=P.removeScrollBar,l=P.inert;return Un.createElement(Un.Fragment,null,l?Un.createElement(D,{styles:s7(Pe)}):null,f?Un.createElement(Kk,{gapMode:"margin"}):null)}const c7=jk(ww,u7);var Sw=Un.forwardRef(function(P,F){return Un.createElement(f1,iu({},P,{ref:F,sideCar:c7}))});Sw.classNames=f1.classNames;const f7=Sw;var h7=function(P){if(typeof document>"u")return null;var F=Array.isArray(P)?P[0]:P;return F.ownerDocument.body},Ff=new WeakMap,e0=new WeakMap,t0={},Fg=0,Ew=function(P){return P&&(P.host||Ew(P.parentNode))},p7=function(P,F){return F.map(function(J){if(P.contains(J))return J;var ce=Ew(J);return ce&&P.contains(ce)?ce:(console.error("aria-hidden",J,"in not contained inside",P,". Doing nothing"),null)}).filter(function(J){return!!J})},d7=function(P,F,J,ce){var Pe=p7(F,Array.isArray(P)?P:[P]);t0[J]||(t0[J]=new WeakMap);var D=t0[J],E=[],e=new Set,_=new Set(Pe),w=function(T){!T||e.has(T)||(e.add(T),w(T.parentNode))};Pe.forEach(w);var s=function(T){!T||_.has(T)||Array.prototype.forEach.call(T.children,function(y){if(e.has(y))s(y);else{var f=y.getAttribute(ce),l=f!==null&&f!=="false",t=(Ff.get(y)||0)+1,i=(D.get(y)||0)+1;Ff.set(y,t),D.set(y,i),E.push(y),t===1&&l&&e0.set(y,!0),i===1&&y.setAttribute(J,"true"),l||y.setAttribute(ce,"true")}})};return s(F),e.clear(),Fg++,function(){E.forEach(function(T){var y=Ff.get(T)-1,f=D.get(T)-1;Ff.set(T,y),D.set(T,f),y||(e0.has(T)||T.removeAttribute(ce),e0.delete(T)),f||T.removeAttribute(J)}),Fg--,Fg||(Ff=new WeakMap,Ff=new WeakMap,e0=new WeakMap,t0={})}},g7=function(P,F,J){J===void 0&&(J="data-aria-hidden");var ce=Array.from(Array.isArray(P)?P:[P]),Pe=F||h7(P);return Pe?(ce.push.apply(ce,Array.from(Pe.querySelectorAll("[aria-live]"))),d7(ce,Pe,J,"aria-hidden")):function(){return null}};const Cw="Dialog",[Lw,m9]=rk(Cw),[v7,ju]=Lw(Cw),m7=P=>{const{__scopeDialog:F,children:J,open:ce,defaultOpen:Pe,onOpenChange:D,modal:E=!0}=P,e=Un.useRef(null),_=Un.useRef(null),[w=!1,s]=sk({prop:ce,defaultProp:Pe,onChange:D});return Un.createElement(v7,{scope:F,triggerRef:e,contentRef:_,contentId:Pg(),titleId:Pg(),descriptionId:Pg(),open:w,onOpenChange:s,onOpenToggle:Un.useCallback(()=>s(T=>!T),[s]),modal:E},J)},y7="DialogPortal",[y9,Pw]=Lw(y7,{forceMount:void 0}),Gv="DialogOverlay",x7=Un.forwardRef((P,F)=>{const J=Pw(Gv,P.__scopeDialog),{forceMount:ce=J.forceMount,...Pe}=P,D=ju(Gv,P.__scopeDialog);return D.modal?Un.createElement(ey,{present:ce||D.open},Un.createElement(b7,Io({},Pe,{ref:F}))):null}),b7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(Gv,J);return Un.createElement(f7,{as:Qm,allowPinchZoom:!0,shards:[Pe.contentRef]},Un.createElement(gh.div,Io({"data-state":Iw(Pe.open)},ce,{ref:F,style:{pointerEvents:"auto",...ce.style}})))}),Fp="DialogContent",_7=Un.forwardRef((P,F)=>{const J=Pw(Fp,P.__scopeDialog),{forceMount:ce=J.forceMount,...Pe}=P,D=ju(Fp,P.__scopeDialog);return Un.createElement(ey,{present:ce||D.open},D.modal?Un.createElement(w7,Io({},Pe,{ref:F})):Un.createElement(T7,Io({},Pe,{ref:F})))}),w7=Un.forwardRef((P,F)=>{const J=ju(Fp,P.__scopeDialog),ce=Un.useRef(null),Pe=Yp(F,J.contentRef,ce);return Un.useEffect(()=>{const D=ce.current;if(D)return g7(D)},[]),Un.createElement(Ow,Io({},P,{ref:Pe,trapFocus:J.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rf(P.onCloseAutoFocus,D=>{var E;D.preventDefault(),(E=J.triggerRef.current)===null||E===void 0||E.focus()}),onPointerDownOutside:rf(P.onPointerDownOutside,D=>{const E=D.detail.originalEvent,e=E.button===0&&E.ctrlKey===!0;(E.button===2||e)&&D.preventDefault()}),onFocusOutside:rf(P.onFocusOutside,D=>D.preventDefault())}))}),T7=Un.forwardRef((P,F)=>{const J=ju(Fp,P.__scopeDialog),ce=Un.useRef(!1);return Un.createElement(Ow,Io({},P,{ref:F,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:Pe=>{var D;if((D=P.onCloseAutoFocus)===null||D===void 0||D.call(P,Pe),!Pe.defaultPrevented){var E;ce.current||(E=J.triggerRef.current)===null||E===void 0||E.focus(),Pe.preventDefault()}ce.current=!1},onInteractOutside:Pe=>{var D,E;(D=P.onInteractOutside)===null||D===void 0||D.call(P,Pe),Pe.defaultPrevented||(ce.current=!0);const e=Pe.target;((E=J.triggerRef.current)===null||E===void 0?void 0:E.contains(e))&&Pe.preventDefault()}}))}),Ow=Un.forwardRef((P,F)=>{const{__scopeDialog:J,trapFocus:ce,onOpenAutoFocus:Pe,onCloseAutoFocus:D,...E}=P,e=ju(Fp,J),_=Un.useRef(null),w=Yp(F,_);return Lk(),Un.createElement(Un.Fragment,null,Un.createElement(_k,{asChild:!0,loop:!0,trapped:ce,onMountAutoFocus:Pe,onUnmountAutoFocus:D},Un.createElement(yk,Io({role:"dialog",id:e.contentId,"aria-describedby":e.descriptionId,"aria-labelledby":e.titleId,"data-state":Iw(e.open)},E,{ref:w,onDismiss:()=>e.onOpenChange(!1)}))),!1)}),k7="DialogTitle",A7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(k7,J);return Un.createElement(gh.h2,Io({id:Pe.titleId},ce,{ref:F}))}),M7="DialogDescription",S7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(M7,J);return Un.createElement(gh.p,Io({id:Pe.descriptionId},ce,{ref:F}))}),E7="DialogClose",C7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(E7,J);return Un.createElement(gh.button,Io({type:"button"},ce,{ref:F,onClick:rf(P.onClick,()=>Pe.onOpenChange(!1))}))});function Iw(P){return P?"open":"closed"}const L7=m7,P7=x7,O7=_7,I7=A7,R7=S7,zb=C7,Db=({title:P,titleId:F,...J})=>br("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,...J,children:br("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Rw={margin:"2px 0px 2px 10px",padding:"5px 2px 2px 5px"};function h1({open:P,close:F,title:J,description:ce,children:Pe}){return ni(L7,{open:P,onOpenChange:F,children:[br(P7,{onClick:F,className:"_modal-overlay"}),ni(O7,{className:"_modal",children:[br(I7,{className:"_modal-title",children:J}),br(R7,{className:"_modal_description",children:ce}),br(zb,{children:br(Db,{})}),Pe,br(zb,{className:"_modal-close",onClick:F,children:br(Db,{className:"w-6 h-6"})})]})]})}const Fb=new FileReader,z7={overlaying:"y",side:"left",tickfont:{size:12},tickpadding:5,showgrid:!1,showline:!1,showticklabels:!0,showlegend:!0,zeroline:!1,anchor:"x",type:"linear",autorange:!0};function D7({open:P,close:F,setLoading:J,addOverlay:ce,plotlyData:Pe}){const[D,E]=Un.useState("scatter"),[e,_]=Un.useState("#FFDD00"),[w,s]=Un.useState("#00ACFF"),[T,y]=Un.useState("#FF0000"),[f,l]=Un.useState(""),[t,i]=Un.useState([]),[r,n]=Un.useState([]),[o,a]=Un.useState({}),[u,p]=Un.useState({}),c=["x","open","high","low","close"];let b={scatter:"Scatter (Line)",candlestick:"Candlestick",bar:"Bar"};const[d,v]=Un.useState({});function x(){F(),E("scatter"),l(""),i([]),n([]),a({}),v({})}function g(){var k,h;if(t.length==0){(k=document.getElementById("csv_file"))==null||k.focus(),(h=document.getElementById("csv_file"))==null||h.style.setProperty("border","1px solid red"),document.getElementById("csv_file_warning").style.display="block";return}const m=F7({csvData:t,plotlyData:Pe,yaxisOptions:u,traceType:D,traceColor:e,traceName:f,options:d,increasingColor:w,decreasingColor:T});ce(m),x()}return br(h1,{title:"Overlay Chart",description:"Upload a CSV file to overlay a chart on the main chart.",open:P,close:F,children:ni("div",{id:"popup_csv",className:"popup_content",children:[ni("div",{children:[ni("label",{htmlFor:"csv_file",children:[br("b",{children:"CSV file:"}),br("div",{id:"csv_file_warning",className:"popup_warning",style:{marginLeft:"80px",marginBottom:"10px"},children:"CSV file is required."})]}),br("input",{onChange:m=>{var k,h;if(m.target.files){if(m.target.files[0].type!=="text/csv"){(k=document.getElementById("csv_file"))==null||k.focus(),(h=document.getElementById("csv_file"))==null||h.style.setProperty("border","1px solid red"),document.getElementById("csv_file_warning").style.display="block";return}}else return;r.length>0&&(n([]),a({}),v({}),E("scatter")),Fb.onload=M=>{var G;if(!((G=M.target)!=null&&G.result)||typeof M.target.result!="string")return;let A=M.target.result.split(` `).map(N=>N.replace(/\r/g,""));const C=A[0].split(","),L=C.map(N=>N.trim().toLowerCase());let O={};for(let N=0;NL.includes(N))&&E("candlestick"),L.includes("close")&&(v({...d,y:C[L.indexOf("close")]}),O.y=C[L.indexOf("close")]);let U=[];for(let N=1;N2&&(j.test(N[0])?N.splice(0,2):j.test(N[N.length-2])&&N.splice(N.length-2,2),B=N.join("_").replace(/openbb_/g,""))}}catch(N){console.log(N)}l(B),v(O),n(C),i(U)},Fb.readAsText(m.target.files[0])},type:"file",id:"csv_file",accept:".csv",style:{marginLeft:10}})]}),ni("div",{style:{marginTop:15},children:[br("label",{htmlFor:"csv_trace_type",children:br("b",{children:"Display data type:"})}),ni("select",{onChange:m=>{E(m.target.value)},id:"csv_trace_type",style:Rw,defaultValue:b[D],children:[D&&br("option",{value:D,children:b[D]},D),Object.keys(b).map(m=>D!==m&&br("option",{value:m,children:b[m]},m))]})]}),ni("div",{style:{marginTop:12},children:[br("label",{htmlFor:"csv_name",children:br("b",{children:"Trace Name:"})}),br("textarea",{id:"csv_name",value:f,onChange:m=>{l(m.target.value)},style:{padding:"5px 2px 2px 5px",width:"100%",maxWidth:"100%",maxHeight:200,marginTop:2},rows:2,cols:20,placeholder:"Enter a name to give this trace"})]}),r.length>0&&ni(tg,{children:[["scatter","bar"].includes(D)&&br("div",{style:{marginTop:15,marginBottom:10},id:"csv_columns",className:"csv_column_container",children:["x","y"].map(m=>ni("div",{style:{marginTop:10,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[ni("label",{htmlFor:`csv_${m}`,style:{width:"100px"},children:[m.toUpperCase()," Axis"]}),ni("select",{onChange:k=>{a({...o,[m]:k.target.value}),v({...d,[m]:k.target.value})},id:`csv_${m}`,style:{width:"100%"},defaultValue:d[m],children:[d[m]&&br("option",{value:d[m],children:d[m]},m),r.map(k=>br("option",{value:k,children:k},k))]})]},m))}),D==="candlestick"&&br("div",{id:"csv_columns",className:"csv_column_container",style:{marginTop:15},children:["x","open","high","low","close"].map(m=>ni("div",{style:{marginTop:10,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[br("label",{htmlFor:`csv_${m}`,style:{width:"100px"},children:m.charAt(0).toUpperCase()+m.slice(1)}),ni("select",{onChange:k=>{a({...o,[m]:k.target.value}),v({...d,[m]:k.target.value})},id:`csv_${m}`,style:{width:"100%"},children:[d[m]&&br("option",{value:d[m],children:d[m]},m),r.map(k=>k!=d[k]&&br("option",{value:k,children:k},k))]})]},m))}),ni("div",{style:{marginTop:20},id:"csv_colors",children:[["scatter","bar"].includes(D)&&ni("div",{children:[br("label",{htmlFor:"csv_color",children:`${D.charAt(0).toUpperCase()}${D.slice(1)} color`}),br("input",{type:"color",id:"csv_color",defaultValue:"#FFDD00",style:{margin:"2px 2px 2px 10px"},onChange:m=>{console.log(m.target.value),_(m.target.value)}})]}),D==="candlestick"&&ni(tg,{children:[br("label",{htmlFor:"csv_increasing",children:"Increasing color"}),br("input",{type:"color",id:"csv_increasing",defaultValue:"#00ACFF",style:{margin:"2px 0px 2px 10px"},onChange:m=>{s(m.target.value)}}),br("label",{htmlFor:"csv_decreasing",style:{marginLeft:15},children:"Decreasing color"}),br("input",{style:{margin:"2px 0px 2px 10px"},type:"color",id:"csv_decreasing",defaultValue:"#FF0000",onChange:m=>{y(m.target.value)}})]})]}),ni("div",{style:{marginTop:20},id:"csv_plot_yaxis_options",children:[D!=="candlestick"&&ni(tg,{children:[br("input",{type:"checkbox",id:"csv_percent_change",name:"csv_plot_yaxis_check",style:{marginBottom:2},onChange:m=>{p({...u,percentChange:m.target.checked,sameYaxis:!1})},checked:!u.sameYaxis&&u.percentChange}),br("label",{htmlFor:"csv_percent_change",style:{marginLeft:5},children:"Plot as percent change from first value"}),br("br",{})]}),br("input",{style:{marginTop:2},type:"checkbox",id:"csv_same_yaxis",name:"csv_plot_yaxis_check",onChange:m=>{p({...u,sameYaxis:m.target.checked,percentChange:!1})},checked:!u.percentChange&&u.sameYaxis}),br("label",{htmlFor:"csv_same_yaxis",style:{marginLeft:5},children:"Share Y-axis"}),D==="bar"&&ni("div",{style:{marginTop:2},id:"csv_bar_orientation",children:[br("input",{type:"checkbox",id:"csv_bar_horizontal",onChange:m=>{v({...d,orientation:m.target.checked?"h":"v"})}}),br("label",{htmlFor:"csv_bar_horizontal",style:{marginLeft:5},children:"Plot horizontally"})]})]})]}),br("br",{}),ni("div",{style:{float:"right",marginTop:20},children:[br("button",{className:"_btn-tertiary",id:"csv_cancel",onClick:x,children:"Cancel"}),br("button",{className:"_btn",id:"csv_submit",onClick:g,children:"Submit"})]})]})})}function F7({csvData:P,plotlyData:F,yaxisOptions:J,traceType:ce,traceColor:Pe,traceName:D,options:E,increasingColor:e,decreasingColor:_}){let w=F.data[0];w.xaxis==null&&(w.xaxis="x"),w.yaxis==null&&(w.yaxis="y");let s=w.yaxis,T,f=Object.keys(F.layout).filter(r=>r.startsWith("yaxis")).map(r=>F.layout[r]).filter(r=>r.side=="left"&&(r.overlaying=="y"||r.fixedrange!=null&&r.fixedrange==!0)).length>0?" ":"";if(J.sameYaxis!==!0){const r=Object.keys(F.layout).filter(n=>n.startsWith("yaxis")).map(n=>F.layout[n]);T=`y${r.length+1}`,s=`yaxis${r.length+1}`,console.log(`yaxis: ${T} ${s}`),F.layout[s]={...z7,title:{text:D,font:{size:14},standoff:0},ticksuffix:f,layer:"below traces"}}else T=w.yaxis.replace("yaxis","y");const l={type:ce,name:D,showlegend:!0,yaxis:T};let t={};if(["scatter","bar"].includes(ce)){const r=P.findIndex(n=>n[E.y]!=null&&n[E.y]!=0);t={...l,x:P.map(n=>n[E.x]),y:P.map(function(n){return J.percentChange&&ce==="scatter"?(n[E.y]-P[r][E.y])/P[r][E.y]:n[E.y]}),customdata:P.map(n=>n[E.y]),hovertemplate:"%{customdata:.2f}",connectgaps:!0,marker:{color:Pe}},ce==="bar"&&(t.orientation=E.orientation,t.marker.opacity=.7,delete t.connectgaps,delete t.hovertemplate,delete t.customdata)}else ce==="candlestick"&&(t={...l,x:P.map(r=>r[E.x]),open:P.map(r=>r[E.open]),high:P.map(r=>r[E.high]),low:P.map(r=>r[E.low]),close:P.map(r=>r[E.close]),increasing:{line:{color:e}},decreasing:{line:{color:_}}});return{...F,data:[...F.data,t]}}function B7({plotlyData:P,open:F,close:J,defaultTitle:ce,updateTitle:Pe,updateAxesTitles:D}){const[E,e]=Un.useState(ce),_=Object.keys(P.layout||{}).filter(y=>y.startsWith("yaxis")&&P.layout[y].range!=null),w=Object.keys(P.layout||{}).filter(y=>{var f;return y.startsWith("xaxis")&&P.layout[y].showticklabels!=null&&((f=P.layout[y])==null?void 0:f.anchor)}),[s,T]=Un.useState({});return br(h1,{title:"Chart Titles",description:"Change the titles on the chart.",open:F,close:J,children:ni("div",{id:"popup_title",className:"popup_content",children:[ni("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[ni("div",{children:[br("label",{htmlFor:"title_text",children:br("b",{children:"Title:"})}),br("textarea",{id:"title_text",style:{...Rw,width:"100%",maxWidth:"100%",maxHeight:"200px",marginTop:"8px",marginLeft:"0px"},rows:2,cols:20,value:E,onChange:y=>e(y.target.value)})]}),br("div",{id:"xaxis_div",className:"csv_column_container",style:{marginTop:5,marginBottom:-5},children:w.map((y,f)=>{var l,t;return ni("div",{style:{marginTop:5,marginBottom:5},children:[br("label",{htmlFor:`title_${y}`,children:f===0?br("b",{children:"X axis:"}):ni("b",{children:["X axis ",f+1,":"]})}),br("input",{id:`title_${y}`,style:{marginLeft:"0px",padding:"5px 2px 2px 5px"},type:"text",defaultValue:((t=(l=P==null?void 0:P.layout[y])==null?void 0:l.title)==null?void 0:t.text)||"",onChange:i=>{T({...s,[y]:i.target.value})}})]},y)})}),br("div",{id:"yaxis_div",className:"csv_column_container",style:{marginTop:5,marginBottom:5},children:_.map((y,f)=>{var l,t;return ni("div",{style:{marginTop:10},children:[br("label",{htmlFor:`title_${y}`,children:f===0?br("b",{children:"Y axis:"}):ni("b",{children:["Y axis ",f+1,":"]})}),br("input",{id:`title_${y}`,style:{marginLeft:"0px",padding:"5px 2px 2px 5px"},type:"text",defaultValue:((t=(l=P==null?void 0:P.layout[y])==null?void 0:l.title)==null?void 0:t.text)||"",onChange:i=>{T({...s,[y]:i.target.value})}})]},y)})})]}),ni("div",{style:{float:"right",marginTop:20},children:[br("button",{className:"_btn-tertiary ph-capture",id:"title_cancel",onClick:J,children:"Cancel"}),br("button",{className:"_btn ph-capture",id:"title_submit",onClick:()=>{Pe(E),D(s),J()},children:"Submit"})]})]})})}const Bb={padding:"5px 2px 2px 5px",margin:"2px 0"};function N7({open:P,close:F,addAnnotation:J,deleteAnnotation:ce,popupData:Pe}){var l,t,i,r,n;const D={text:"",color:"#0088CC",size:18,bordercolor:"#822661",yanchor:"above"},[E,e]=Un.useState(D),[_,w]=Un.useState(D);Pe&&Pe!==E&&Pe.annotation&&(Pe.annotation=(Pe==null?void 0:Pe.annotation)||{},e(Pe),w(Pe));function s(){console.log("closing"),e(D),w(D),F()}function T(o){console.log(o.target.id.replace("addtext_",""),o.target.value);const a=o.target.id.replace("addtext_",""),u=o.target.value;w({..._,[a]:u})}function y(){console.log("submitting",_),_.text!==""?(E!=null&&E.annotation&&w({..._,annotation:E.annotation}),J(_),F()):(document.getElementById("popup_textarea_warning").style.display="block",document.getElementById("addtext_text").style.border="1px solid red")}function f(){ce(E),s()}return br(h1,{title:"Add Text to Chart",description:"Change the titles on the chart.",open:P,close:s,children:ni("div",{id:"popup_title",className:"popup_content",children:[ni("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[ni("div",{style:{marginBottom:20},children:[ni("label",{htmlFor:"popup_text",children:[br("b",{children:"Text:"}),br("div",{id:"popup_textarea_warning",className:"popup_warning",children:"Text is required"})]}),br("textarea",{id:"addtext_text",style:{...Bb,width:"100%",maxWidth:"100%",maxHeight:"200px",marginTop:"8px"},rows:4,cols:50,placeholder:"Enter text here",onChange:T,defaultValue:((l=E==null?void 0:E.annotation)==null?void 0:l.text)||(_==null?void 0:_.text)})]}),ni("div",{style:{display:"flex",gap:15,alignItems:"center",flexWrap:"wrap",columnCount:2,justifyContent:"space-between",marginBottom:20},children:[br("label",{htmlFor:"addtext_color",children:br("b",{children:"Font color"})}),br("input",{type:"color",id:"addtext_color",style:{margin:"2px 2px 2px 15px"},defaultValue:((t=E==null?void 0:E.annotation)==null?void 0:t.color)||(_==null?void 0:_.color),onChange:T}),br("label",{htmlFor:"addtext_bordercolor",style:{marginLeft:20},children:br("b",{children:"Border color"})}),br("input",{type:"color",id:"addtext_bordercolor",style:{margin:"2px 2px 10px 15px"},defaultValue:((i=E==null?void 0:E.annotation)==null?void 0:i.bordercolor)||(_==null?void 0:_.bordercolor),onChange:T}),br("label",{htmlFor:"addtext_size",children:br("b",{children:"Font size"})}),br("input",{style:{...Bb,width:"52px",margin:"0px 0px 0px 2px"},type:"number",id:"addtext_size",onChange:T,defaultValue:((r=E==null?void 0:E.annotation)==null?void 0:r.size)||(_==null?void 0:_.size)}),ni("div",{children:[br("label",{htmlFor:"addtext_yanchor",style:{marginRight:31},children:br("b",{children:"Position"})}),ni("select",{id:"addtext_yanchor",name:"yanchor",style:{width:"100px"},defaultValue:((n=E==null?void 0:E.annotation)==null?void 0:n.yanchor)||(_==null?void 0:_.yanchor),onChange:T,children:[br("option",{value:"above",children:"Above"}),br("option",{value:"below",children:"Below"})]})]})]})]}),ni("div",{style:{float:"right",marginTop:20},children:[br("button",{className:"_btn-tertiary ph-capture",id:"title_cancel",onClick:s,children:"Cancel"}),br("button",{className:"_btn ph-capture",id:"title_delete",onClick:f,children:"Delete"}),br("button",{className:"_btn ph-capture",id:"title_submit",onClick:y,children:"Submit"})]})]})})}function j7({plotData:P,popup_data:F,current_text:J}){var _;let ce=F.x,Pe=F.y,D=F.yref,E=((_=P==null?void 0:P.layout)==null?void 0:_.annotations)||[],e=-1;for(let w=0;wx!=null)),P.layout.dragmode="pan",J({...P,...a.update}),s.removeAllListeners("plotly_click")};F.text=F.text.replace(/\n/g,"
");let y,f=!1;if(F.annotation){console.log("data",F),y={x:F.annotation.x,y:F.annotation.y,yref:F.annotation.yref,yanchor:F.annotation.yi.x==F.annotation.x&&i.y==F.annotation.y&&i.yref==F.annotation.yref);console.log("ohlcAnnotationIndex",t),t==-1?_([...e,l.annotation]):(e[t]=l.annotation,_(e))}D([...w,l.annotation].filter(t=>t!=null)),P.layout.dragmode="pan",J({...P,...l.update}),Pe({});return}s.on("plotly_clickannotation",l=>{console.log("plotly_clickannotation",l);let t=l.annotation;if(t.text==null){console.log("annotation.text is undefined");return}console.log("annotation.text",t.text),t.text=t.text.replace(/
/g,` `);let i={x:t.x,y:t.y,high:(t==null?void 0:t.high)??void 0,low:(t==null?void 0:t.low)??void 0,yanchor:t.y'),!0):F?P.some(function(J){return F.includes(J)})||P.includes("*"):!0}var X7=function(F,J,ce){ce===void 0&&(ce=!1);var Pe=J.alt,D=J.meta,E=J.mod,e=J.shift,_=J.ctrl,w=J.keys,s=F.key,T=F.code,y=F.ctrlKey,f=F.metaKey,l=F.shiftKey,t=F.altKey,i=sc(T),r=s.toLowerCase();if(!ce){if(Pe===!t&&r!=="alt"||e===!l&&r!=="shift")return!1;if(E){if(!f&&!y)return!1}else if(D===!f&&r!=="meta"&&r!=="os"||_===!y&&r!=="ctrl"&&r!=="control")return!1}return w&&w.length===1&&(w.includes(r)||w.includes(i))?!0:w?q7(w):!w},$7=Un.createContext(void 0),J7=function(){return Un.useContext($7)};function Nw(P,F){return P&&F&&typeof P=="object"&&typeof F=="object"?Object.keys(P).length===Object.keys(F).length&&Object.keys(P).reduce(function(J,ce){return J&&Nw(P[ce],F[ce])},!0):P===F}var K7=Un.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Q7=function(){return Un.useContext(K7)};function e9(P){var F=Un.useRef(void 0);return Nw(F.current,P)||(F.current=P),F.current}var jb=function(F){F.stopPropagation(),F.preventDefault(),F.stopImmediatePropagation()},t9=typeof window<"u"?Un.useLayoutEffect:Un.useEffect;function Ku(P,F,J,ce){var Pe=Un.useRef(null),D=Un.useRef(!1),E=J instanceof Array?ce instanceof Array?void 0:ce:J,e=P instanceof Array?P.join(E==null?void 0:E.splitKey):P,_=J instanceof Array?J:ce instanceof Array?ce:void 0,w=Un.useCallback(F,_??[]),s=Un.useRef(w);_?s.current=w:s.current=F;var T=e9(E),y=Q7(),f=y.enabledScopes,l=J7();return t9(function(){if(!((T==null?void 0:T.enabled)===!1||!Y7(f,T==null?void 0:T.scopes))){var t=function(a,u){var p;if(u===void 0&&(u=!1),!(Z7(a)&&!Bw(a,T==null?void 0:T.enableOnFormTags))&&!(T!=null&&T.ignoreEventWhen!=null&&T.ignoreEventWhen(a))){if(Pe.current!==null&&document.activeElement!==Pe.current&&!Pe.current.contains(document.activeElement)){jb(a);return}(p=a.target)!=null&&p.isContentEditable&&!(T!=null&&T.enableOnContentEditable)||Bg(e,T==null?void 0:T.splitKey).forEach(function(c){var b,d=Ng(c,T==null?void 0:T.combinationKey);if(X7(a,d,T==null?void 0:T.ignoreModifiers)||(b=d.keys)!=null&&b.includes("*")){if(u&&D.current)return;if(G7(a,d,T==null?void 0:T.preventDefault),!W7(a,d,T==null?void 0:T.enabled)){jb(a);return}s.current(a,d),u||(D.current=!0)}})}},i=function(a){a.key!==void 0&&(Dw(sc(a.code)),((T==null?void 0:T.keydown)===void 0&&(T==null?void 0:T.keyup)!==!0||T!=null&&T.keydown)&&t(a))},r=function(a){a.key!==void 0&&(Fw(sc(a.code)),D.current=!1,T!=null&&T.keyup&&t(a,!0))},n=Pe.current||(E==null?void 0:E.document)||document;return n.addEventListener("keyup",r),n.addEventListener("keydown",i),l&&Bg(e,T==null?void 0:T.splitKey).forEach(function(o){return l.addHotkey(Ng(o,T==null?void 0:T.combinationKey,T==null?void 0:T.description))}),function(){n.removeEventListener("keyup",r),n.removeEventListener("keydown",i),l&&Bg(e,T==null?void 0:T.splitKey).forEach(function(o){return l.removeHotkey(Ng(o,T==null?void 0:T.combinationKey,T==null?void 0:T.description))})}}},[e,T,f]),Pe}var jw={exports:{}};(function(P){(function(F){var J=o(),ce=a(),Pe=u(),D=p(),E={imagePlaceholder:void 0,cacheBust:!1},e={toSvg:_,toPng:s,toJpeg:T,toBlob:y,toPixelData:w,impl:{fontFaces:Pe,images:D,util:J,inliner:ce,options:{}}};P.exports=e;function _(c,b){return b=b||{},f(b),Promise.resolve(c).then(function(v){return t(v,b.filter,!0)}).then(i).then(r).then(d).then(function(v){return n(v,b.width||J.width(c),b.height||J.height(c))});function d(v){return b.bgcolor&&(v.style.backgroundColor=b.bgcolor),b.width&&(v.style.width=b.width+"px"),b.height&&(v.style.height=b.height+"px"),b.style&&Object.keys(b.style).forEach(function(x){v.style[x]=b.style[x]}),v}}function w(c,b){return l(c,b||{}).then(function(d){return d.getContext("2d").getImageData(0,0,J.width(c),J.height(c)).data})}function s(c,b){return l(c,b||{}).then(function(d){return d.toDataURL()})}function T(c,b){return b=b||{},l(c,b).then(function(d){return d.toDataURL("image/jpeg",b.quality||1)})}function y(c,b){return l(c,b||{}).then(J.canvasToBlob)}function f(c){typeof c.imagePlaceholder>"u"?e.impl.options.imagePlaceholder=E.imagePlaceholder:e.impl.options.imagePlaceholder=c.imagePlaceholder,typeof c.cacheBust>"u"?e.impl.options.cacheBust=E.cacheBust:e.impl.options.cacheBust=c.cacheBust}function l(c,b){return _(c,b).then(J.makeImage).then(J.delay(100)).then(function(v){var x=d(c);return x.getContext("2d").drawImage(v,0,0),x});function d(v){var x=document.createElement("canvas");if(x.width=b.width||J.width(v),x.height=b.height||J.height(v),b.bgcolor){var g=x.getContext("2d");g.fillStyle=b.bgcolor,g.fillRect(0,0,x.width,x.height)}return x}}function t(c,b,d){if(!d&&b&&!b(c))return Promise.resolve();return Promise.resolve(c).then(v).then(function(m){return x(c,m,b)}).then(function(m){return g(c,m)});function v(m){return m instanceof HTMLCanvasElement?J.makeImage(m.toDataURL()):m.cloneNode(!1)}function x(m,k,h){var M=m.childNodes;if(M.length===0)return Promise.resolve(k);return A(k,J.asArray(M),h).then(function(){return k});function A(C,L,O){var I=Promise.resolve();return L.forEach(function(R){I=I.then(function(){return t(R,O)}).then(function(U){U&&C.appendChild(U)})}),I}}function g(m,k){if(!(k instanceof Element))return k;return Promise.resolve().then(h).then(M).then(A).then(C).then(function(){return k});function h(){L(window.getComputedStyle(m),k.style);function L(O,I){O.cssText?I.cssText=O.cssText:R(O,I);function R(U,B){J.asArray(U).forEach(function(G){B.setProperty(G,U.getPropertyValue(G),U.getPropertyPriority(G))})}}}function M(){[":before",":after"].forEach(function(O){L(O)});function L(O){var I=window.getComputedStyle(m,O),R=I.getPropertyValue("content");if(R===""||R==="none")return;var U=J.uid();k.className=k.className+" "+U;var B=document.createElement("style");B.appendChild(G(U,O,I)),k.appendChild(B);function G(N,j,V){var H="."+N+":"+j,ee=V.cssText?Q(V):X(V);return document.createTextNode(H+"{"+ee+"}");function Q(Y){var K=Y.getPropertyValue("content");return Y.cssText+" content: "+K+";"}function X(Y){return J.asArray(Y).map(K).join("; ")+";";function K(te){return te+": "+Y.getPropertyValue(te)+(Y.getPropertyPriority(te)?" !important":"")}}}}}function A(){m instanceof HTMLTextAreaElement&&(k.innerHTML=m.value),m instanceof HTMLInputElement&&k.setAttribute("value",m.value)}function C(){k instanceof SVGElement&&(k.setAttribute("xmlns","http://www.w3.org/2000/svg"),k instanceof SVGRectElement&&["width","height"].forEach(function(L){var O=k.getAttribute(L);O&&k.style.setProperty(L,O)}))}}}function i(c){return Pe.resolveAll().then(function(b){var d=document.createElement("style");return c.appendChild(d),d.appendChild(document.createTextNode(b)),c})}function r(c){return D.inlineAll(c).then(function(){return c})}function n(c,b,d){return Promise.resolve(c).then(function(v){return v.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(v)}).then(J.escapeXhtml).then(function(v){return''+v+""}).then(function(v){return''+v+""}).then(function(v){return"data:image/svg+xml;charset=utf-8,"+v})}function o(){return{escape:C,parseExtension:b,mimeType:d,dataAsUrl:A,isDataUrl:v,canvasToBlob:g,resolveUrl:m,getAndEncode:M,uid:k(),delay:L,asArray:O,escapeXhtml:I,makeImage:h,width:R,height:U};function c(){var G="application/font-woff",N="image/jpeg";return{woff:G,woff2:G,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:N,jpeg:N,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}function b(G){var N=/\.([^\.\/]*?)$/g.exec(G);return N?N[1]:""}function d(G){var N=b(G).toLowerCase();return c()[N]||""}function v(G){return G.search(/^(data:)/)!==-1}function x(G){return new Promise(function(N){for(var j=window.atob(G.toDataURL().split(",")[1]),V=j.length,H=new Uint8Array(V),ee=0;ee{if(P)return i9({fileHandle:P,blob:F})},i9=async({fileHandle:P,blob:F})=>{const J=await P.createWritable();await J.write(F),await J.close()},a9=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}},{description:"SVG Image",accept:{"image/svg+xml":[".svg"]}}],Vw=({filename:P,is_image:F})=>{if("showSaveFilePicker"in window){const J={suggestedName:P,types:F?a9:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(J)}return new Promise(J=>{J(null)})},ty=(P,F,J)=>{try{if(J===null)throw new Error("Cannot access filesystem");return r9({fileHandle:J,blob:P})}catch(ce){console.error("oops, something went wrong!",ce);const Pe=URL.createObjectURL(P),D=document.createElement("a");D.setAttribute("href",Pe),D.setAttribute("download",F),D.style.visibility="hidden",document.body.appendChild(D),D.click(),document.body.removeChild(D)}return new Promise(ce=>{ce(!0)})};async function Ub(P,F){let J=P.data,ce=[],Pe=[],D="title"in P.layout.xaxis&&P.layout.xaxis.title.text!=null?P.layout.xaxis.title.text:"x",E="title"in P.layout.yaxis&&P.layout.yaxis.title.text!=null?P.layout.yaxis.title.text:"y";return J.forEach(function(e){e.type=="candlestick"&&(ce.length==0&&(ce=["Date","Open","High","Low","Close"]),e.x.forEach(function(_,w){Pe.push([_,e.open[w],e.high[w],e.low[w],e.close[w]])})),e.type=="scatter"&&(ce.length==0&&ce.push(D),ce.push(e.name!=null?e.name:E),e.x.forEach(function(_,w){Pe[w]==null&&(Pe[w]=[_]),Pe[w].push(e.y[w])}))}),await o9(ce,Pe,F)}async function o9(P,F,J){const ce=P,Pe=F.map(w=>w.map(s=>s==null?"":typeof s=="object"?JSON.stringify(s):s.toString().replace(/"/g,'""'))),E=[ce,...Pe].map(w=>w.join(",")).join(` -`),e=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=`${window.title}.csv`;try{let w=await Vw({filename:_});await Bp("Saving CSV"),Np(async function(){ty(e,_,w).then(async function(){await new Promise(s=>setTimeout(s,1500)),w||J(!0),await Bp("",!0)})},2)()}catch(w){console.error(w)}}function Bp(P,F){const J=window.document.getElementById("loading"),ce=window.document.getElementById("loading_text");return new Promise(Pe=>{F?J.classList.remove("show"):(ce.innerHTML=P,J.classList.add("show"));let D=setInterval(function(){(F?!J.classList.contains("show"):J.classList.contains("show"))&&(clearInterval(D),Pe(!0))},.01)})}const Np=(P,F)=>{let J;return function(){const ce=this,Pe=arguments;clearTimeout(J),J=setTimeout(()=>P.apply(ce,Pe),F)}},s9={yref:"paper",xref:"paper",x:1,y:0,text:"OpenBB Terminal",font_size:17,font_color:"gray",opacity:.5,xanchor:"right",yanchor:"bottom",yshift:-80,xshift:40};async function Vb(P,F,J=!1){const ce=document.getElementById("plotlyChart");J&&(ce.layout.annotations.push(s9),ce.globals.cmd_idx!=null&&ce.globals.cmd_src!=null&&(ce.layout.annotations[ce.globals.cmd_idx].text=ce.globals.cmd_src),Gs.relayout(ce,{"title.text":ce.globals.title,margin:ce.globals.old_margin})),J||(ce.globals.cmd_idx!=null&&ce.globals.cmd_src!=null&&(ce.layout.annotations[ce.globals.cmd_idx].text=""),ce.layout.annotations.splice(F,1),Gs.relayout(ce,{"title.text":"",margin:P}))}async function Hw(P,F,J){const ce=document.getElementById(P);if(["svg","pdf"].includes(J)){const Pe=document.getElementById("plotlyChart"),D=Pe.layout.margin,E=Pe.layout.annotations.length;await Vb(D,E,!0),Gs.downloadImage(Pe,{format:"svg",height:Pe.clientHeight,width:Pe.clientWidth,filename:window.title}),await Vb(D,E,!1),await Bp("",!0);return}Np(async function(){Uw.toBlob(ce).then(function(Pe){ty(Pe,F,null)})},2)()}async function Hb(P,F,J,ce){const Pe=document.getElementById(P),D=`${window.title}.png`;try{J(!0);let E=await Vw({filename:D,is_image:!0}),e="png";if(E!==null&&(e=E.name.split(".").pop()),await Bp(`Saving ${e.toUpperCase()}`),["svg","pdf"].includes(e)){await Hw(P,D,e),F(!1),J(!1),E||ce(!0);return}Np(async function(){Uw.toBlob(Pe).then(function(_){ty(_,D,E).then(async function(){await Bp("",!0),F(!1),J(!1),E||ce(!0)})})},2)()}catch(E){console.error(E),F(!1),J(!1)}}function rc(P=!0){return new Promise(F=>{window.MODEBAR||(window.MODEBAR=window.document.getElementsByClassName("modebar-container")[0],window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`),window.MODEBAR&&(window.MODEBAR.style.cssText.includes("display: none")&&!P?window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`:window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:none;`,F(!0))})}function l9({setModal:P,changeTheme:F,autoScaling:J,Loading:ce,changeColor:Pe,downloadFinished:D}){return Ku("ctrl+shift+t",()=>{P({name:"titleDialog"})},{preventDefault:!0}),Ku("ctrl+t",()=>{P({name:"textDialog"})},{preventDefault:!0}),Ku("ctrl+o",()=>{P({name:"overlayChart"})},{preventDefault:!0}),Ku("ctrl+shift+h",()=>{rc()},{preventDefault:!0}),Ku("ctrl+e",()=>{Pe(!0)},{preventDefault:!0}),Ku("ctrl+shift+s",async()=>{P({name:"downloadCsv"}),await Ub(document.getElementById("plotlyChart"),D)},{preventDefault:!0}),Ku("ctrl+s",async()=>{rc(),Hb("MainChart",rc,ce,D)},{preventDefault:!0}),Ku("ctrl+w",()=>{window.close()},{preventDefault:!0}),{plotGlPixelRatio:1,scrollZoom:!0,responsive:!0,displaylogo:!1,displayModeBar:!0,modeBarButtonsToRemove:["lasso2d","select2d","downloadImage"],modeBarButtons:[[{name:"Download CSV (Ctrl+Shift+S)",icon:Pu.downloadCsv,click:async function(e){await Ub(e,D)}},{name:"Download Chart as Image (Ctrl+S)",icon:Pu.downloadImage,click:async function(){rc(),await Hb("MainChart",rc,ce,D)}}],[{name:"Edit Color (Ctrl+E)",icon:Pu.changeColor,click:function(){Pe(!0)}},"drawline","drawopenpath","drawcircle","drawrect","eraseshape"],[{name:"Overlay chart from CSV (Ctrl+O)",icon:Pu.plotCsv,click:function(){P({name:"overlayChart"})}},{name:"Add Text (Ctrl+T)",icon:Pu.addText,click:function(){P({name:"textDialog",data:{text:""}})}},{name:"Change Titles (Ctrl+Shift+T)",icon:Pu.changeTitle,click:function(){P({name:"titleDialog"})}},{name:"Change Theme",icon:Pu.sunIcon,click:function(){F(!0)}}],["hoverClosestCartesian","hoverCompareCartesian","toggleSpikelines"],[{name:"Auto Scale (Ctrl+Shift+A)",icon:Gs.Icons.autoscale,click:function(){J(!0)}},"zoomIn2d","zoomOut2d","autoScale2d","zoom2d","pan2d"]]}}async function u9(P,F){try{if(P["xaxis.range[0]"]!=null){const J=P["xaxis.range[0]"],ce=P["xaxis.range[1]"];let Pe={},D,E;const e=F.data.filter(s=>s.yaxis!=null),_=[...new Set(e.map(s=>s.yaxis||s.y!=null||s.type=="candlestick"))],w=s=>F.data.filter(T=>T.yaxis==s&&(T.y||T.type=="candlestick"));return _.forEach(s=>{if(typeof s!="string")return;let T="yaxis"+s.replace("y",""),y=[],f=[],l=F.layout[T].type=="log";w(s).forEach(r=>{let n=r.x;l=F.layout[T].type=="log";let o=r.y!=null?r.y:[],a=r.type=="candlestick"?r.low:[],u=r.type=="candlestick"?r.high:[];l&&(o=o.map(Math.log10),r.type=="candlestick"&&(a=r.low.map(Math.log10),u=r.high.map(Math.log10)));let p=n.map((c,b)=>{let d=null;return c>=J&&c<=ce&&(r.y!=null&&(d=o[b]),r.type=="candlestick"&&(y.push(a[b]),y.push(u[b]))),d});f=f.concat(p)}),f=f.filter(r=>r!=null&&r!=null),D=Math.min(...f),E=Math.max(...f),y.length>0&&(y=y.filter(r=>r!=null&&r!=null),D=Math.min(...y),E=Math.max(...y));let t=E,i=F.layout[T].fixedrange!=null&&F.layout[T].fixedrange==!0;if(D!=null&&E!=null){let r=E-D,n=.15;if(y.length>0&&(n=.3),D-=r*n,E+=r*n,i){if(F.layout[T].tickvals!=null){let a=t,u=-3,p=Math.round(a*.2,u),c=[2,5,6,7,8,9,10],b=[1,4,5,6,7,8,9];for(let x=0;xc[x]&&(u=-b[x],p=Math.round(a*.2,u));let d=[Math.floor(p),Math.floor(p*2),Math.floor(p*3),Math.floor(p*4)],v=[0,Math.floor(a*7)];Pe[T+".tickvals"]=d,Pe[T+".range"]=v,Pe[T+".tickformat"]=".2s";return}D=0,E=F.layout[T].range[1]}Pe[T+".range"]=[D,E]}}),Pe}}catch(J){console.log(`Error in AutoScaling: ${J}`)}return{}}async function c9({plotData:P,volumeBars:F,setMaximizePlot:J}){const ce=Object.keys(P.layout).filter(s=>s.startsWith("xaxis")).filter(s=>P.layout[s].showticklabels||P.layout[s].matches==null),Pe=P.data.filter(s=>{var T;return(T=s==null?void 0:s.name)==null?void 0:T.startsWith("Volume")});let D={},E=F||{old_nticks:{}};const e=window.innerWidth,_=window.innerHeight;let w=_>420&&e<920?8:_>420&&e<500?9:7;return e<750?(Pe.forEach(s=>{s.type=="bar"&&(s.opacity=1,s.marker.line.width=.09,F.yaxis==null&&(E.yaxis="yaxis"+s.yaxis.replace("y",""),D[E.yaxis+".tickfont.size"]=w,E.tickfont=P.layout[E.yaxis].tickfont||{},P.layout.margin.l-=40))}),ce.forEach(s=>{var T;((T=F.old_nticks)==null?void 0:T[s])==null&&(D[s+".nticks"]=6,E.old_nticks[s]=P.layout[s].nticks||10)}),J(!0),await rc()):window.MODEBAR.style.cssText.includes("display: none")&&(await rc(!1),J(!1),F.old_nticks!=null&&ce.forEach(s=>{F.old_nticks[s]!=null&&(D[s+".nticks"]=E.old_nticks[s],E.old_nticks[s]=void 0)}),F.yaxis!=null&&Pe.forEach(s=>{s.type=="bar"&&(s.opacity=.5,s.marker.line.width=.2,D[E.yaxis+".tickfont.size"]=E.tickfont.size+3,P.layout.margin.l+=40,E.yaxis=void 0)})),{volume_update:E,layout_update:D,plotData:P}}function f9({open:P,onColorChange:F}){const[J,ce]=Un.useState(!1);function Pe(D){F(D)}return P&&!J&&ce(!0),!P&&J&&ce(!1),Un.useEffect(()=>{if(J){let D=function(e){let _=0,w=0,s=0,T=0;document.getElementById(e.id+"_header")?document.getElementById(e.id+"_header").onmousedown=y:e.onmousedown=y;function y(t){t=t||window.event,t.preventDefault(),s=t.clientX,T=t.clientY,document.onmouseup=l,document.onmousemove=f}function f(t){t=t||window.event,t.preventDefault(),_=s-t.clientX,w=T-t.clientY,s=t.clientX,T=t.clientY,e.style.top=e.offsetTop-w+"px",e.style.left=e.offsetLeft-_+"px"}function l(){document.onmouseup=null,document.onmousemove=null}},E=document.getElementById("changecolor");E.style.display="block",E.style.width=null,D(E)}else document.getElementById("changecolor").style.display="none"},[J]),br("div",{id:"changecolor",children:br("div",{id:"changecolor_header",children:br("input",{type:"color",id:"picked_color",value:"#00ACFF",onChange:D=>{let E=D.target.value;Pe(E)}})})})}function qw(P){var F,J,ce="";if(typeof P=="string"||typeof P=="number")ce+=P;else if(typeof P=="object")if(Array.isArray(P))for(F=0;F{ce.preventDefault(),window.pywry.open_file(J)},children:J})]})})}),br("div",{style:{float:"right",marginTop:20},children:br("button",{className:"_btn",style:{padding:"8px 16px",width:"100%"},onClick:F,children:"Close"})})]})})}const d9=QT(ZT);function g9({json:P,date:F,cmd:J,title:ce,globals:Pe,info:D}){var se,fe;const E=GT();Un.useEffect(()=>{E&&E.capture("chart",D)},[]),delete P.layout.width,delete P.layout.height,(fe=(se=P.layout)==null?void 0:se.title)!=null&&fe.text&&(P.layout.title.text="");const[e,_]=Un.useState({}),[w,s]=Un.useState(!1),[T,y]=Un.useState(ce),[f,l]=Un.useState({}),[t,i]=Un.useState(!1),[r,n]=Un.useState({name:""}),[o,a]=Un.useState(!1),[u,p]=Un.useState(null),[c,b]=Un.useState({old_nticks:{}}),[d,v]=Un.useState(!1),[x,g]=Un.useState(!1),[m,k]=Un.useState(P),[h,M]=Un.useState([]),[A,C]=Un.useState(!1),[L,O]=Un.useState(!0),[I,R]=Un.useState(!1),[U,B]=Un.useState(!1),[G,N]=Un.useState(!1),[j,V]=Un.useState({}),[H,ee]=Un.useState([]),Q=()=>n({name:""});function X(ye){var de,he,xe,Re,we;console.log("onDeleteAnnotation",ye);const pe=(he=(de=m==null?void 0:m.layout)==null?void 0:de.annotations)==null?void 0:he.findIndex(Ae=>Ae.text===ye.text);console.log("index",pe),pe>-1&&((Re=(xe=m==null?void 0:m.layout)==null?void 0:xe.annotations)==null||Re.splice(pe,1),k({...m}),M((we=m==null?void 0:m.layout)==null?void 0:we.annotations))}function Y(ye){U7({plotData:m,popupData:ye,setPlotData:k,setModal:n,setOnAnnotationClick:V,setAnnotations:M,onAnnotationClick:j,ohlcAnnotation:H,setOhlcAnnotation:ee,annotations:h,plotDiv:u})}Un.useEffect(()=>{x&&(n({name:"downloadFinished"}),g(!1))},[x]),Un.useEffect(()=>{f&&Object.keys(f).length>0&&(Object.keys(f).forEach(ye=>{m.layout[ye].title={...m.layout[ye].title||{},text:f[ye]},m.layout[ye].showticklabels=!0}),l({}))},[f]);function K(ye){let pe=u.layout.shapes;if(!pe||pe.length==0)return;let de=pe[pe.length-1];de.line.color=ye,Gs.update(u,{},{shapes:pe})}function te(ye,pe=!1){let de=e[ye]||document.querySelector(`[data-title="${ye}"]`);pe?(de.style.border="transparent",de.style.boxShadow="none"):(de.style.border="1px solid rgba(0, 151, 222, 1.0)",de.style.borderRadius="5px",de.style.borderpadding="5px",de.style.boxShadow="0 0 5px rgba(0, 151, 222, 1.0)"),_({...e,[ye]:de})}function ae(){let ye="Auto Scale (Ctrl+Shift+A)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"?(de=!1,u.on("plotly_relayout",Np(async function(he){if(he["xaxis.range[0]"]==null)return;let xe=await u9(he,u);Gs.update(u,{},xe)},100))):u.removeAllListeners("plotly_relayout"),te(ye,de)}function oe(){let ye="Edit Color (Ctrl+E)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"&&(de=!1),N(!de),te(ye,de)}return Un.useEffect(()=>{I&&(console.log("activateAutoScale",!I),ae(),R(!1))},[I]),Un.useEffect(()=>{U&&(oe(),B(!1))},[U]),Un.useEffect(()=>{if(A)try{console.log("changeTheme",A);const ye=m==null?void 0:m.data.filter(xe=>{var Re;return(Re=xe==null?void 0:xe.name)==null?void 0:Re.startsWith("Volume")});let pe=!L;window.document.body.style.backgroundColor=pe?"#000":"#fff",m.layout.font={...m.layout.font||{},color:pe?"#fff":"#000"};const de=pe?Pu.sunIcon:Pu.moonIcon;document.querySelector('[data-title="Change Theme"]').getElementsByTagName("path")[0].setAttribute("d",de.path),document.querySelector('[data-title="Change Theme"]').getElementsByTagName("svg")[0].setAttribute("viewBox",de.viewBox);const he={"#e4003a":"#c80000","#00ACFF":"#009600","#009600":"#00ACFF","#c80000":"#e4003a"};ye.forEach(xe=>{xe.type=="bar"&&(xe.marker.color=xe.marker.color.map(Re=>he[Re]||Re))}),m.layout.template=pe?ek:tk,k({...m}),Gs.react(u,m.data,m.layout),O(pe),C(!1)}catch(ye){console.log("error",ye)}},[A]),Un.useEffect(()=>{if(t){O(!0),R(!1);const ye=["Download CSV","Download Chart as Image","Overlay chart from CSV","Add Text","Change Titles","Auto Scale (Ctrl+Shift+A)","Reset Axes"],pe=document.querySelector('[data-title="Autoscale"]');pe&&(pe.getElementsByTagName("path")[0].setAttribute("d",Gs.Icons.home.path),pe.setAttribute("data-title","Reset Axes")),window.MODEBAR=document.getElementsByClassName("modebar-container")[0];const de=window.MODEBAR.getElementsByClassName("modebar-btn");if(window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`,de){let he={};for(let xe=0;xe0&&(k(Re),b(we),Gs.relayout(u,xe))})}},[t]),ni("div",{className:"relative h-full",children:[o&&br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})}),ni("div",{id:"loading",className:"saving",children:[br("div",{id:"loading_text",className:"loading_text"}),br("div",{id:"loader",className:"loader"})]}),br(D7,{addOverlay:ye=>{console.log(ye),m.layout.showlegend=!0,k(ye),i(!1)},plotlyData:m,setLoading:a,open:r.name==="overlayChart",close:Q}),br(B7,{updateTitle:ye=>y(ye),updateAxesTitles:ye=>l(ye),defaultTitle:T,plotlyData:m,open:r.name==="titleDialog",close:Q}),br(N7,{popupData:r.name==="textDialog"?r==null?void 0:r.data:null,open:r.name==="textDialog",close:Q,addAnnotation:ye=>Y(ye),deleteAnnotation:ye=>X(ye)}),br(f9,{open:G,onColorChange:K}),br(p9,{open:r.name==="downloadFinished",close:Q}),ni("div",{className:"relative h-full",id:"MainChart",children:[ni("div",{className:"_header relative gap-4 py-2 text-center text-xs flex items-center justify-between px-4 text-white",children:[br("div",{className:"w-1/3",children:br("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"40",fill:"none",viewBox:"0 0 64 40",children:br("path",{fill:"#fff",d:"M61.283 3.965H33.608v27.757h25.699V19.826H37.561v-3.965H63.26V3.965h-1.977zM39.538 23.792h15.815v3.965H37.561v-3.965h1.977zM59.306 9.913v1.983H37.561V7.931h21.745v1.982zM33.606 0h-3.954v3.965H33.606V0zM25.7 3.966H0V15.86h25.7v3.965H3.953v11.896h25.7V3.966h-3.955zm0 21.808v1.983H7.907v-3.965h17.791v1.982zm0-15.86v1.982H3.953V7.931h21.745v1.982zM37.039 35.693v2.952l-.246-.246-.245-.245-.245-.247-.245-.246-.246-.246-.245-.245-.245-.247-.247-.246-.245-.246-.245-.246-.245-.246-.246-.246h-.49v3.936h.49v-3.198l.246.246.245.246.245.246.245.246.246.246.246.246.245.247.246.245.245.246.245.247.245.246.246.245.245.246h.245v-3.936h-.49zM44.938 37.17h-.491v-1.477h-2.944v3.937h3.93v-2.46h-.495zm-2.944-.246v-.739h1.962v.984h-1.962v-.245zm2.944.984v1.23h-2.944V37.66h2.944v.247zM52.835 37.17h-.49v-1.477h-2.946v3.937h3.925v-2.46h-.489zm-2.944-.246v-.739h1.963v.984h-1.965l.002-.245zm2.944.984v1.23H49.89V37.66h2.946v.247zM29.174 35.693H25.739v3.936H29.663v-.491H26.229v-.984h2.943v-.493H26.229v-1.476h3.434v-.492h-.489zM13.37 35.693H9.934v3.937h3.925v-3.937h-.49zm0 .738v2.709h-2.945v-2.955h2.943l.001.246zM21.276 35.693h-3.435v3.937h.491v-1.476h3.434v-2.461h-.49zm0 .738v1.23h-2.944v-1.476h2.944v.246z"})})}),br("p",{className:"font-bold w-1/3 flex flex-col gap-0.5 items-center",children:T}),ni("p",{className:"w-1/3 text-right text-xs",children:[new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"long"}).format(F).replace(/:\d\d /," "),br("br",{}),br("span",{className:"text-grey-400",children:J})]})]}),br("div",{className:h9("w-full sm:pb-12",{"h-[calc(100%-10px)]":d,"h-[calc(100%-50px)]":!d}),children:br(d9,{onInitialized:()=>{if(!u){const ye=document.getElementById("plotlyChart");console.log("plot",ye),ye&&p(ye),ye.globals=Pe}t||i(!0)},className:"w-full h-full",divId:"plotlyChart",data:m.data,layout:m.layout,config:l9({setModal:n,changeTheme:C,autoScaling:R,Loading:a,changeColor:B,downloadFinished:g})})})]})]})}function v9(){const[P,F]=Un.useState(null),[J,ce]=Un.useState({});Un.useEffect(()=>{{const E=setInterval(()=>{if(window.json_data){const e=window.json_data;console.log(e),F(e),clearInterval(E)}},100);return()=>clearInterval(E)}},[]);const D=(E=>{var y,f,l,t;if(!E)return null;let e={added_traces:[],csv_yaxis_id:null,cmd_src_idx:null,cmd_idx:null,cmd_src:"",old_margin:null,title:""},_=(f=(y=E.layout)==null?void 0:y.title)==null?void 0:f.text.replace(/|<\/b>/g,"").replace(/ /g,"_"),w=new Date().toISOString().slice(0,10).replace(/-/g,""),s=new Date().toISOString().slice(11,19).replace(/:/g,"");window.title=`openbb_${_}_${w}_${s}`,E.layout.annotations!=null&&E.layout.annotations.forEach(function(i){if(i.text!=null&&i.text[0]=="/"){e.cmd_src=i.text,e.cmd_idx=E.layout.annotations.indexOf(i),i.text="";let r=E.layout.margin;e.old_margin={...r},r.t!=null&&r.t>40&&(r.t=40),E.cmd=="/stocks/candle"&&(r.r-=50)}}),E.data.forEach(function(i){if(i.name!=null){const r=i.name.length;i.name=i.name+" ",i.hoverlabel={namelength:r}}});let T=((t=(l=E.layout)==null?void 0:l.title)==null?void 0:t.text)||"Interactive Chart";return e.title=T,{data:E,date:new Date,globals:e,cmd:E.command_location,posthog:E.posthog,python_version:E.python_version,pywry_version:E.pywry_version,terminal_version:E.terminal_version,title:T}})(P);if(D){D.posthog.collect_logs&&!J&&ce({api_host:"https://app.posthog.com",autocapture:{css_selector_allowlist:[".ph-capture"]},capture_pageview:!1,loaded:function(w){const s=(D==null?void 0:D.log_id)||"";s!=""&&s!="REPLACE_ME"&&w.identify(s),w.onFeatureFlags(function(){w.isFeatureEnabled("record-pywry",{send_event:!1})||w.stopSessionRecording(),w.isFeatureEnabled("collect-logs-pywry",{send_event:!1})?w.has_opted_out_capturing()&&w.opt_in_capturing():w.opt_out_capturing()})}});const E={INFO:{command:D.cmd,title:D.title,date:D.date,python_version:D.python_version,pywry_version:D.pywry_version,terminal_version:D.terminal_version}},e=br(g9,{json:D.data,date:D.date,cmd:D.cmd,title:D.title,globals:D.globals,info:E});return D.posthog.collect_logs&&J?br(qT,{apiKey:"phc_vhssDAMod5qIplznQ75Kdgz4aB1qPFmeVmfEOZ4hkRw",options:J,children:e}):e}else return br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})})}z8.render(br(s_.StrictMode,{children:br(v9,{})}),document.getElementById("root")); +`)})}function b(){return Promise.resolve(J.asArray(document.styleSheets)).then(v).then(d).then(function(g){return g.map(x)});function d(g){return g.filter(function(m){return m.type===CSSRule.FONT_FACE_RULE}).filter(function(m){return ce.shouldProcess(m.style.getPropertyValue("src"))})}function v(g){var m=[];return g.forEach(function(k){try{J.asArray(k.cssRules||[]).forEach(m.push.bind(m))}catch(h){console.log("Error while reading CSS rules from "+k.href,h.toString())}}),m}function x(g){return{resolve:function(){var k=(g.parentStyleSheet||{}).href;return ce.inlineAll(g.cssText,k)},src:function(){return g.style.getPropertyValue("src")}}}}}function p(){return{inlineAll:b,impl:{newImage:c}};function c(d){return{inline:v};function v(x){return J.isDataUrl(d.src)?Promise.resolve():Promise.resolve(d.src).then(x||J.getAndEncode).then(function(g){return J.dataAsUrl(g,J.mimeType(d.src))}).then(function(g){return new Promise(function(m,k){d.onload=m,d.onerror=k,d.src=g})})}}function b(d){if(!(d instanceof Element))return Promise.resolve(d);return v(d).then(function(){return d instanceof HTMLImageElement?c(d).inline():Promise.all(J.asArray(d.childNodes).map(function(x){return b(x)}))});function v(x){var g=x.style.getPropertyValue("background");return g?ce.inlineAll(g).then(function(m){x.style.setProperty("background",m,x.style.getPropertyPriority("background"))}).then(function(){return x}):Promise.resolve(x)}}}})()})(jw);var n9=jw.exports;const Uw=jp(n9),r9=async({fileHandle:P,blob:F})=>{if(P)return i9({fileHandle:P,blob:F})},i9=async({fileHandle:P,blob:F})=>{const J=await P.createWritable();await J.write(F),await J.close()},a9=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}},{description:"SVG Image",accept:{"image/svg+xml":[".svg"]}}],Vw=({filename:P,is_image:F})=>{try{if("showSaveFilePicker"in window){const J={suggestedName:P,types:F?a9:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(J)}}catch(J){console.error(J)}return new Promise(J=>{J(null)})},ty=(P,F,J)=>{try{if(J===null)throw new Error("Cannot access filesystem");return r9({fileHandle:J,blob:P})}catch(ce){console.error("oops, something went wrong!",ce);const Pe=URL.createObjectURL(P),D=document.createElement("a");D.setAttribute("href",Pe),D.setAttribute("download",F),D.style.visibility="hidden",document.body.appendChild(D),D.click(),document.body.removeChild(D)}return new Promise(ce=>{ce(!0)})};async function Ub(P,F){const J=P.data;let ce=[];const Pe=[],D="title"in P.layout.xaxis&&P.layout.xaxis.title.text!==void 0?P.layout.xaxis.title.text:"x",E="title"in P.layout.yaxis&&P.layout.yaxis.title.text!==void 0?P.layout.yaxis.title.text:"y";return J.forEach(function(e){e.type==="candlestick"&&(ce.length===0&&(ce=["Date","Open","High","Low","Close"]),e.x.forEach(function(_,w){Pe.push([_,e.open[w],e.high[w],e.low[w],e.close[w]])})),e.type==="scatter"&&(ce.length===0&&ce.push(D),ce.push(e.name!==void 0?e.name:E),e.x.forEach(function(_,w){Pe[w]===void 0&&(Pe[w]=[_]),Pe[w].push(e.y[w])}))}),await o9(ce,Pe,F)}async function o9(P,F,J){const ce=P,Pe=F.map(w=>w.map(s=>s==null?"":typeof s=="object"?JSON.stringify(s):s.toString().replace(/"/g,'""'))),E=[ce,...Pe].map(w=>w.join(",")).join(` +`),e=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=`${window.title}.csv`;try{const w=await Vw({filename:_});await Bp("Saving CSV"),Np(async function(){ty(e,_,w).then(async function(){await new Promise(s=>setTimeout(s,1500)),w||J(!0),await Bp("",!0)})},2)()}catch(w){console.error(w)}}function Bp(P,F){const J=window.document.getElementById("loading"),ce=window.document.getElementById("loading_text");return new Promise(Pe=>{F?J.classList.remove("show"):(ce.innerHTML=P,J.classList.add("show"));const D=setInterval(function(){(F?!J.classList.contains("show"):J.classList.contains("show"))&&(clearInterval(D),Pe(!0))},.01)})}const Np=(P,F)=>{let J;return function(){const ce=this,Pe=arguments;clearTimeout(J),J=setTimeout(()=>P.apply(ce,Pe),F)}},s9={yref:"paper",xref:"paper",x:1,y:0,text:"OpenBB Terminal",font_size:17,font_color:"gray",opacity:.5,xanchor:"right",yanchor:"bottom",yshift:-80,xshift:40};async function Vb(P,F,J=!1){const ce=document.getElementById("plotlyChart");J&&(ce.layout.annotations.push(s9),ce.globals.cmd_idx!==void 0&&ce.globals.cmd_src!==void 0&&(ce.layout.annotations[ce.globals.cmd_idx].text=ce.globals.cmd_src),Gs.relayout(ce,{"title.text":ce.globals.title,margin:ce.globals.old_margin})),J||(ce.globals.cmd_idx!==void 0&&ce.globals.cmd_src!==void 0&&(ce.layout.annotations[ce.globals.cmd_idx].text=""),ce.layout.annotations.splice(F,1),Gs.relayout(ce,{"title.text":"",margin:P}))}async function Hw(P,F,J){const ce=document.getElementById(P);if(["svg","pdf"].includes(J)){const Pe=document.getElementById("plotlyChart"),D=Pe.layout.margin,E=Pe.layout.annotations.length;await Vb(D,E,!0),Gs.downloadImage(Pe,{format:"svg",height:Pe.clientHeight,width:Pe.clientWidth,filename:window.title}),await Vb(D,E,!1),await Bp("",!0);return}Np(async function(){Uw.toBlob(ce).then(function(Pe){ty(Pe,F,null)})},2)()}async function Hb(P,F,J,ce){const Pe=document.getElementById(P),D=`${window.title}.png`;try{J(!0);const E=await Vw({filename:D,is_image:!0});let e="png";if(E!==null&&(e=E.name.split(".").pop()),await Bp(`Saving ${e.toUpperCase()}`),["svg","pdf"].includes(e)){await Hw(P,D,e),F(!1),J(!1),E||ce(!0);return}Np(async function(){Uw.toBlob(Pe).then(function(_){ty(_,D,E).then(async function(){await Bp("",!0),F(!1),J(!1),E||ce(!0)})})},2)()}catch(E){console.error(E),F(!1),J(!1)}}function rc(P=!0){return new Promise(F=>{window.MODEBAR||(window.MODEBAR=window.document.getElementsByClassName("modebar-container")[0],window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`),window.MODEBAR&&(window.MODEBAR.style.cssText.includes("display: none")&&!P?window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`:window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:none;`,F(!0))})}function l9({setModal:P,changeTheme:F,autoScaling:J,Loading:ce,changeColor:Pe,downloadFinished:D}){return Ku("ctrl+shift+t",()=>{P({name:"titleDialog"})},{preventDefault:!0}),Ku("ctrl+t",()=>{P({name:"textDialog"})},{preventDefault:!0}),Ku("ctrl+o",()=>{P({name:"overlayChart"})},{preventDefault:!0}),Ku("ctrl+shift+h",()=>{rc()},{preventDefault:!0}),Ku("ctrl+e",()=>{Pe(!0)},{preventDefault:!0}),Ku("ctrl+shift+s",async()=>{P({name:"downloadCsv"}),await Ub(document.getElementById("plotlyChart"),D)},{preventDefault:!0}),Ku("ctrl+s",async()=>{rc(),Hb("MainChart",rc,ce,D)},{preventDefault:!0}),Ku("ctrl+w",()=>{window.close()},{preventDefault:!0}),{plotGlPixelRatio:1,scrollZoom:!0,responsive:!0,displaylogo:!1,displayModeBar:!0,modeBarButtonsToRemove:["lasso2d","select2d","downloadImage"],modeBarButtons:[[{name:"Download CSV (Ctrl+Shift+S)",icon:Pu.downloadCsv,click:async function(e){await Ub(e,D)}},{name:"Download Chart as Image (Ctrl+S)",icon:Pu.downloadImage,click:async function(){rc(),await Hb("MainChart",rc,ce,D)}}],[{name:"Edit Color (Ctrl+E)",icon:Pu.changeColor,click:function(){Pe(!0)}},"drawline","drawopenpath","drawcircle","drawrect","eraseshape"],[{name:"Overlay chart from CSV (Ctrl+O)",icon:Pu.plotCsv,click:function(){P({name:"overlayChart"})}},{name:"Add Text (Ctrl+T)",icon:Pu.addText,click:function(){P({name:"textDialog",data:{text:""}})}},{name:"Change Titles (Ctrl+Shift+T)",icon:Pu.changeTitle,click:function(){P({name:"titleDialog"})}},{name:"Change Theme",icon:Pu.sunIcon,click:function(){F(!0)}}],["hoverClosestCartesian","hoverCompareCartesian","toggleSpikelines"],[{name:"Auto Scale (Ctrl+Shift+A)",icon:Gs.Icons.autoscale,click:function(){J(!0)}},"zoomIn2d","zoomOut2d","autoScale2d","zoom2d","pan2d"]]}}async function u9(P,F){try{if(P["xaxis.range[0]"]!=null){const J=P["xaxis.range[0]"],ce=P["xaxis.range[1]"];let Pe={},D,E;const e=F.data.filter(s=>s.yaxis!=null),_=[...new Set(e.map(s=>s.yaxis||s.y!=null||s.type=="candlestick"))],w=s=>F.data.filter(T=>T.yaxis==s&&(T.y||T.type=="candlestick"));return _.forEach(s=>{if(typeof s!="string")return;let T="yaxis"+s.replace("y",""),y=[],f=[],l=F.layout[T].type=="log";w(s).forEach(r=>{let n=r.x;l=F.layout[T].type=="log";let o=r.y!=null?r.y:[],a=r.type=="candlestick"?r.low:[],u=r.type=="candlestick"?r.high:[];l&&(o=o.map(Math.log10),r.type=="candlestick"&&(a=r.low.map(Math.log10),u=r.high.map(Math.log10)));let p=n.map((c,b)=>{let d=null;return c>=J&&c<=ce&&(r.y!=null&&(d=o[b]),r.type=="candlestick"&&(y.push(a[b]),y.push(u[b]))),d});f=f.concat(p)}),f=f.filter(r=>r!=null&&r!=null),D=Math.min(...f),E=Math.max(...f),y.length>0&&(y=y.filter(r=>r!=null&&r!=null),D=Math.min(...y),E=Math.max(...y));let t=E,i=F.layout[T].fixedrange!=null&&F.layout[T].fixedrange==!0;if(D!=null&&E!=null){let r=E-D,n=.15;if(y.length>0&&(n=.3),D-=r*n,E+=r*n,i){if(F.layout[T].tickvals!=null){let a=t,u=-3,p=Math.round(a*.2,u),c=[2,5,6,7,8,9,10],b=[1,4,5,6,7,8,9];for(let x=0;xc[x]&&(u=-b[x],p=Math.round(a*.2,u));let d=[Math.floor(p),Math.floor(p*2),Math.floor(p*3),Math.floor(p*4)],v=[0,Math.floor(a*7)];Pe[T+".tickvals"]=d,Pe[T+".range"]=v,Pe[T+".tickformat"]=".2s";return}D=0,E=F.layout[T].range[1]}Pe[T+".range"]=[D,E]}}),Pe}}catch(J){console.log(`Error in AutoScaling: ${J}`)}return{}}async function c9({plotData:P,volumeBars:F,setMaximizePlot:J}){const ce=Object.keys(P.layout).filter(s=>s.startsWith("xaxis")).filter(s=>P.layout[s].showticklabels||P.layout[s].matches==null),Pe=P.data.filter(s=>{var T;return(T=s==null?void 0:s.name)==null?void 0:T.startsWith("Volume")});let D={},E=F||{old_nticks:{}};const e=window.innerWidth,_=window.innerHeight;let w=_>420&&e<920?8:_>420&&e<500?9:7;return e<750?(Pe.forEach(s=>{s.type=="bar"&&(s.opacity=1,s.marker.line.width=.09,F.yaxis==null&&(E.yaxis="yaxis"+s.yaxis.replace("y",""),D[E.yaxis+".tickfont.size"]=w,E.tickfont=P.layout[E.yaxis].tickfont||{},P.layout.margin.l-=40))}),ce.forEach(s=>{var T;((T=F.old_nticks)==null?void 0:T[s])==null&&(D[s+".nticks"]=6,E.old_nticks[s]=P.layout[s].nticks||10)}),J(!0),await rc()):window.MODEBAR.style.cssText.includes("display: none")&&(await rc(!1),J(!1),F.old_nticks!=null&&ce.forEach(s=>{F.old_nticks[s]!=null&&(D[s+".nticks"]=E.old_nticks[s],E.old_nticks[s]=void 0)}),F.yaxis!=null&&Pe.forEach(s=>{s.type=="bar"&&(s.opacity=.5,s.marker.line.width=.2,D[E.yaxis+".tickfont.size"]=E.tickfont.size+3,P.layout.margin.l+=40,E.yaxis=void 0)})),{volume_update:E,layout_update:D,plotData:P}}function f9({open:P,onColorChange:F}){const[J,ce]=Un.useState(!1);function Pe(D){F(D)}return P&&!J&&ce(!0),!P&&J&&ce(!1),Un.useEffect(()=>{if(J){let D=function(e){let _=0,w=0,s=0,T=0;document.getElementById(e.id+"_header")?document.getElementById(e.id+"_header").onmousedown=y:e.onmousedown=y;function y(t){t=t||window.event,t.preventDefault(),s=t.clientX,T=t.clientY,document.onmouseup=l,document.onmousemove=f}function f(t){t=t||window.event,t.preventDefault(),_=s-t.clientX,w=T-t.clientY,s=t.clientX,T=t.clientY,e.style.top=e.offsetTop-w+"px",e.style.left=e.offsetLeft-_+"px"}function l(){document.onmouseup=null,document.onmousemove=null}},E=document.getElementById("changecolor");E.style.display="block",E.style.width=null,D(E)}else document.getElementById("changecolor").style.display="none"},[J]),br("div",{id:"changecolor",children:br("div",{id:"changecolor_header",children:br("input",{type:"color",id:"picked_color",value:"#00ACFF",onChange:D=>{let E=D.target.value;Pe(E)}})})})}function qw(P){var F,J,ce="";if(typeof P=="string"||typeof P=="number")ce+=P;else if(typeof P=="object")if(Array.isArray(P))for(F=0;F{ce.preventDefault(),window.pywry.open_file(J)},children:J})]})})}),br("div",{style:{float:"right",marginTop:20},children:br("button",{className:"_btn",style:{padding:"8px 16px",width:"100%"},onClick:F,children:"Close"})})]})})}const d9=QT(ZT);function g9({json:P,date:F,cmd:J,title:ce,globals:Pe,info:D}){var se,fe;const E=GT();Un.useEffect(()=>{E&&E.capture("chart",D)},[]),delete P.layout.width,delete P.layout.height,(fe=(se=P.layout)==null?void 0:se.title)!=null&&fe.text&&(P.layout.title.text="");const[e,_]=Un.useState({}),[w,s]=Un.useState(!1),[T,y]=Un.useState(ce),[f,l]=Un.useState({}),[t,i]=Un.useState(!1),[r,n]=Un.useState({name:""}),[o,a]=Un.useState(!1),[u,p]=Un.useState(null),[c,b]=Un.useState({old_nticks:{}}),[d,v]=Un.useState(!1),[x,g]=Un.useState(!1),[m,k]=Un.useState(P),[h,M]=Un.useState([]),[A,C]=Un.useState(!1),[L,O]=Un.useState(!0),[I,R]=Un.useState(!1),[U,B]=Un.useState(!1),[G,N]=Un.useState(!1),[j,V]=Un.useState({}),[H,ee]=Un.useState([]),Q=()=>n({name:""});function X(ye){var de,he,xe,Re,we;console.log("onDeleteAnnotation",ye);const pe=(he=(de=m==null?void 0:m.layout)==null?void 0:de.annotations)==null?void 0:he.findIndex(Ae=>Ae.text===ye.text);console.log("index",pe),pe>-1&&((Re=(xe=m==null?void 0:m.layout)==null?void 0:xe.annotations)==null||Re.splice(pe,1),k({...m}),M((we=m==null?void 0:m.layout)==null?void 0:we.annotations))}function Y(ye){U7({plotData:m,popupData:ye,setPlotData:k,setModal:n,setOnAnnotationClick:V,setAnnotations:M,onAnnotationClick:j,ohlcAnnotation:H,setOhlcAnnotation:ee,annotations:h,plotDiv:u})}Un.useEffect(()=>{x&&(n({name:"downloadFinished"}),g(!1))},[x]),Un.useEffect(()=>{f&&Object.keys(f).length>0&&(Object.keys(f).forEach(ye=>{m.layout[ye].title={...m.layout[ye].title||{},text:f[ye]},m.layout[ye].showticklabels=!0}),l({}))},[f]);function K(ye){let pe=u.layout.shapes;if(!pe||pe.length==0)return;let de=pe[pe.length-1];de.line.color=ye,Gs.update(u,{},{shapes:pe})}function te(ye,pe=!1){let de=e[ye]||document.querySelector(`[data-title="${ye}"]`);pe?(de.style.border="transparent",de.style.boxShadow="none"):(de.style.border="1px solid rgba(0, 151, 222, 1.0)",de.style.borderRadius="5px",de.style.borderpadding="5px",de.style.boxShadow="0 0 5px rgba(0, 151, 222, 1.0)"),_({...e,[ye]:de})}function ae(){let ye="Auto Scale (Ctrl+Shift+A)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"?(de=!1,u.on("plotly_relayout",Np(async function(he){if(he["xaxis.range[0]"]==null)return;let xe=await u9(he,u);Gs.update(u,{},xe)},100))):u.removeAllListeners("plotly_relayout"),te(ye,de)}function oe(){let ye="Edit Color (Ctrl+E)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"&&(de=!1),N(!de),te(ye,de)}return Un.useEffect(()=>{I&&(console.log("activateAutoScale",!I),ae(),R(!1))},[I]),Un.useEffect(()=>{U&&(oe(),B(!1))},[U]),Un.useEffect(()=>{if(A)try{console.log("changeTheme",A);const ye=m==null?void 0:m.data.filter(xe=>{var Re;return(Re=xe==null?void 0:xe.name)==null?void 0:Re.startsWith("Volume")});let pe=!L;window.document.body.style.backgroundColor=pe?"#000":"#fff",m.layout.font={...m.layout.font||{},color:pe?"#fff":"#000"};const de=pe?Pu.sunIcon:Pu.moonIcon;document.querySelector('[data-title="Change Theme"]').getElementsByTagName("path")[0].setAttribute("d",de.path),document.querySelector('[data-title="Change Theme"]').getElementsByTagName("svg")[0].setAttribute("viewBox",de.viewBox);const he={"#e4003a":"#c80000","#00ACFF":"#009600","#009600":"#00ACFF","#c80000":"#e4003a"};ye.forEach(xe=>{xe.type=="bar"&&(xe.marker.color=xe.marker.color.map(Re=>he[Re]||Re))}),m.layout.template=pe?ek:tk,k({...m}),Gs.react(u,m.data,m.layout),O(pe),C(!1)}catch(ye){console.log("error",ye)}},[A]),Un.useEffect(()=>{if(t){O(!0),R(!1);const ye=["Download CSV","Download Chart as Image","Overlay chart from CSV","Add Text","Change Titles","Auto Scale (Ctrl+Shift+A)","Reset Axes"],pe=document.querySelector('[data-title="Autoscale"]');pe&&(pe.getElementsByTagName("path")[0].setAttribute("d",Gs.Icons.home.path),pe.setAttribute("data-title","Reset Axes")),window.MODEBAR=document.getElementsByClassName("modebar-container")[0];const de=window.MODEBAR.getElementsByClassName("modebar-btn");if(window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`,de){let he={};for(let xe=0;xe0&&(k(Re),b(we),Gs.relayout(u,xe))})}},[t]),ni("div",{className:"relative h-full",children:[o&&br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})}),ni("div",{id:"loading",className:"saving",children:[br("div",{id:"loading_text",className:"loading_text"}),br("div",{id:"loader",className:"loader"})]}),br(D7,{addOverlay:ye=>{console.log(ye),m.layout.showlegend=!0,k(ye),i(!1)},plotlyData:m,setLoading:a,open:r.name==="overlayChart",close:Q}),br(B7,{updateTitle:ye=>y(ye),updateAxesTitles:ye=>l(ye),defaultTitle:T,plotlyData:m,open:r.name==="titleDialog",close:Q}),br(N7,{popupData:r.name==="textDialog"?r==null?void 0:r.data:null,open:r.name==="textDialog",close:Q,addAnnotation:ye=>Y(ye),deleteAnnotation:ye=>X(ye)}),br(f9,{open:G,onColorChange:K}),br(p9,{open:r.name==="downloadFinished",close:Q}),ni("div",{className:"relative h-full",id:"MainChart",children:[ni("div",{className:"_header relative gap-4 py-2 text-center text-xs flex items-center justify-between px-4 text-white",children:[br("div",{className:"w-1/3",children:br("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"40",fill:"none",viewBox:"0 0 64 40",children:br("path",{fill:"#fff",d:"M61.283 3.965H33.608v27.757h25.699V19.826H37.561v-3.965H63.26V3.965h-1.977zM39.538 23.792h15.815v3.965H37.561v-3.965h1.977zM59.306 9.913v1.983H37.561V7.931h21.745v1.982zM33.606 0h-3.954v3.965H33.606V0zM25.7 3.966H0V15.86h25.7v3.965H3.953v11.896h25.7V3.966h-3.955zm0 21.808v1.983H7.907v-3.965h17.791v1.982zm0-15.86v1.982H3.953V7.931h21.745v1.982zM37.039 35.693v2.952l-.246-.246-.245-.245-.245-.247-.245-.246-.246-.246-.245-.245-.245-.247-.247-.246-.245-.246-.245-.246-.245-.246-.246-.246h-.49v3.936h.49v-3.198l.246.246.245.246.245.246.245.246.246.246.246.246.245.247.246.245.245.246.245.247.245.246.246.245.245.246h.245v-3.936h-.49zM44.938 37.17h-.491v-1.477h-2.944v3.937h3.93v-2.46h-.495zm-2.944-.246v-.739h1.962v.984h-1.962v-.245zm2.944.984v1.23h-2.944V37.66h2.944v.247zM52.835 37.17h-.49v-1.477h-2.946v3.937h3.925v-2.46h-.489zm-2.944-.246v-.739h1.963v.984h-1.965l.002-.245zm2.944.984v1.23H49.89V37.66h2.946v.247zM29.174 35.693H25.739v3.936H29.663v-.491H26.229v-.984h2.943v-.493H26.229v-1.476h3.434v-.492h-.489zM13.37 35.693H9.934v3.937h3.925v-3.937h-.49zm0 .738v2.709h-2.945v-2.955h2.943l.001.246zM21.276 35.693h-3.435v3.937h.491v-1.476h3.434v-2.461h-.49zm0 .738v1.23h-2.944v-1.476h2.944v.246z"})})}),br("p",{className:"font-bold w-1/3 flex flex-col gap-0.5 items-center",children:T}),ni("p",{className:"w-1/3 text-right text-xs",children:[new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"long"}).format(F).replace(/:\d\d /," "),br("br",{}),br("span",{className:"text-grey-400",children:J})]})]}),br("div",{className:h9("w-full sm:pb-12",{"h-[calc(100%-10px)]":d,"h-[calc(100%-50px)]":!d}),children:br(d9,{onInitialized:()=>{if(!u){const ye=document.getElementById("plotlyChart");console.log("plot",ye),ye&&p(ye),ye.globals=Pe}t||i(!0)},className:"w-full h-full",divId:"plotlyChart",data:m.data,layout:m.layout,config:l9({setModal:n,changeTheme:C,autoScaling:R,Loading:a,changeColor:B,downloadFinished:g})})})]})]})}function v9(){const[P,F]=Un.useState(null),[J,ce]=Un.useState({});Un.useEffect(()=>{{const E=setInterval(()=>{if(window.json_data){const e=window.json_data;console.log(e),F(e),clearInterval(E)}},100);return()=>clearInterval(E)}},[]);const D=(E=>{var y,f,l,t;if(!E)return null;let e={added_traces:[],csv_yaxis_id:null,cmd_src_idx:null,cmd_idx:null,cmd_src:"",old_margin:null,title:""},_=(f=(y=E.layout)==null?void 0:y.title)==null?void 0:f.text.replace(/|<\/b>/g,"").replace(/ /g,"_"),w=new Date().toISOString().slice(0,10).replace(/-/g,""),s=new Date().toISOString().slice(11,19).replace(/:/g,"");window.title=`openbb_${_}_${w}_${s}`,E.layout.annotations!=null&&E.layout.annotations.forEach(function(i){if(i.text!=null&&i.text[0]=="/"){e.cmd_src=i.text,e.cmd_idx=E.layout.annotations.indexOf(i),i.text="";let r=E.layout.margin;e.old_margin={...r},r.t!=null&&r.t>40&&(r.t=40),E.cmd=="/stocks/candle"&&(r.r-=50)}}),E.data.forEach(function(i){if(i.name!=null){const r=i.name.length;i.name=i.name+" ",i.hoverlabel={namelength:r}}});let T=((t=(l=E.layout)==null?void 0:l.title)==null?void 0:t.text)||"Interactive Chart";return e.title=T,{data:E,date:new Date,globals:e,cmd:E.command_location,posthog:E.posthog,python_version:E.python_version,pywry_version:E.pywry_version,terminal_version:E.terminal_version,title:T}})(P);if(D){D.posthog.collect_logs&&!J&&ce({api_host:"https://app.posthog.com",autocapture:{css_selector_allowlist:[".ph-capture"]},capture_pageview:!1,loaded:function(w){const s=(D==null?void 0:D.log_id)||"";s!=""&&s!="REPLACE_ME"&&w.identify(s),w.onFeatureFlags(function(){w.isFeatureEnabled("record-pywry",{send_event:!1})||w.stopSessionRecording(),w.isFeatureEnabled("collect-logs-pywry",{send_event:!1})?w.has_opted_out_capturing()&&w.opt_in_capturing():w.opt_out_capturing()})}});const E={INFO:{command:D.cmd,title:D.title,date:D.date,python_version:D.python_version,pywry_version:D.pywry_version,terminal_version:D.terminal_version}},e=br(g9,{json:D.data,date:D.date,cmd:D.cmd,title:D.title,globals:D.globals,info:E});return D.posthog.collect_logs&&J?br(qT,{apiKey:"phc_vhssDAMod5qIplznQ75Kdgz4aB1qPFmeVmfEOZ4hkRw",options:J,children:e}):e}else return br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})})}z8.render(br(s_.StrictMode,{children:br(v9,{})}),document.getElementById("root")); '];return t.cellXfs.forEach(function(n,i){var o=[];o.push(le("NumberFormat",null,{"ss:Format":Le(et[n.numFmtId])}));var a={"ss:ID":"s"+(21+i)};r.push(le("Style",o.join(""),a))}),le("Styles",r.join(""))}function Tw(e){return le("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+Ld(e.Ref,{r:0,c:0})})}function M6(e){if(!((e||{}).Workbook||{}).Names)return"";for(var t=e.Workbook.Names,r=[],n=0;n"),e["!margins"].header&&i.push(le("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&i.push(le("Footer",null,{"x:Margin":e["!margins"].footer})),i.push(le("PageMargins",null,{"x:Bottom":e["!margins"].bottom||"0.75","x:Left":e["!margins"].left||"0.7","x:Right":e["!margins"].right||"0.7","x:Top":e["!margins"].top||"0.75"})),i.push("")),n&&n.Workbook&&n.Workbook.Sheets&&n.Workbook.Sheets[r])if(n.Workbook.Sheets[r].Hidden)i.push(le("Visible",n.Workbook.Sheets[r].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var o=0;o")}return((((n||{}).Workbook||{}).Views||[])[0]||{}).RTL&&i.push(""),e["!protect"]&&(i.push(vt("ProtectContents","True")),e["!protect"].objects&&i.push(vt("ProtectObjects","True")),e["!protect"].scenarios&&i.push(vt("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?i.push(vt("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&i.push(vt("EnableSelection","UnlockedCells")),[["formatCells","AllowFormatCells"],["formatColumns","AllowSizeCols"],["formatRows","AllowSizeRows"],["insertColumns","AllowInsertCols"],["insertRows","AllowInsertRows"],["insertHyperlinks","AllowInsertHyperlinks"],["deleteColumns","AllowDeleteCols"],["deleteRows","AllowDeleteRows"],["sort","AllowSort"],["autoFilter","AllowFilter"],["pivotTables","AllowUsePivotTables"]].forEach(function(a){e["!protect"][a[0]]&&i.push("<"+a[1]+"/>")})),i.length==0?"":le("WorksheetOptions",i.join(""),{xmlns:Yt.x})}function U6(e){return e.map(function(t){var r=z4(t.t||""),n=le("ss:Data",r,{xmlns:"http://www.w3.org/TR/REC-html40"});return le("Comment",n,{"ss:Author":t.a})}).join("")}function H6(e,t,r,n,i,o,a){if(!e||e.v==null&&e.f==null)return"";var s={};if(e.f&&(s["ss:Formula"]="="+Le(Ld(e.f,a))),e.F&&e.F.slice(0,t.length)==t){var l=ut(e.F.slice(t.length+1));s["ss:ArrayRange"]="RC:R"+(l.r==a.r?"":"["+(l.r-a.r)+"]")+"C"+(l.c==a.c?"":"["+(l.c-a.c)+"]")}if(e.l&&e.l.Target&&(s["ss:HRef"]=Le(e.l.Target),e.l.Tooltip&&(s["x:HRefScreenTip"]=Le(e.l.Tooltip))),r["!merges"])for(var u=r["!merges"],c=0;c!=u.length;++c)u[c].s.c!=a.c||u[c].s.r!=a.r||(u[c].e.c>u[c].s.c&&(s["ss:MergeAcross"]=u[c].e.c-u[c].s.c),u[c].e.r>u[c].s.r&&(s["ss:MergeDown"]=u[c].e.r-u[c].s.r));var f="",d="";switch(e.t){case"z":if(!n.sheetStubs)return"";break;case"n":f="Number",d=String(e.v);break;case"b":f="Boolean",d=e.v?"1":"0";break;case"e":f="Error",d=es[e.v];break;case"d":f="DateTime",d=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||et[14]);break;case"s":f="String",d=W4(e.v||"");break}var h=Un(n.cellXfs,e,n);s["ss:StyleID"]="s"+(21+h),s["ss:Index"]=a.c+1;var m=e.v!=null?d:"",p=e.t=="z"?"":''+m+"";return(e.c||[]).length>0&&(p+=U6(e.c)),le("Cell",p,s)}function V6(e,t){var r='"}function W6(e,t,r,n){if(!e["!ref"])return"";var i=Ge(e["!ref"]),o=e["!merges"]||[],a=0,s=[];e["!cols"]&&e["!cols"].forEach(function(g,x){Nd(g);var w=!!g.width,y=Tu(x,g),_={"ss:Index":x+1};w&&(_["ss:Width"]=Ul(y.width)),g.hidden&&(_["ss:Hidden"]="1"),s.push(le("Column",null,_))});for(var l=Array.isArray(e),u=i.s.r;u<=i.e.r;++u){for(var c=[V6(u,(e["!rows"]||[])[u])],f=i.s.c;f<=i.e.c;++f){var d=!1;for(a=0;a!=o.length;++a)if(!(o[a].s.c>f)&&!(o[a].s.r>u)&&!(o[a].e.c"),c.length>2&&s.push(c.join(""))}return s.join("")}function z6(e,t,r){var n=[],i=r.SheetNames[e],o=r.Sheets[i],a=o?L6(o,t,e,r):"";return a.length>0&&n.push(""+a+""),a=o?W6(o,t,e,r):"",a.length>0&&n.push(""+a+"
"),n.push(B6(o,t,e,r)),n.join("")}function G6(e,t){t||(t={}),e.SSF||(e.SSF=Gt(et)),e.SSF&&(wu(),xu(e.SSF),t.revssf=yu(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],Un(t.cellXfs,{},{revssf:{General:0}}));var r=[];r.push(k6(e,t)),r.push($6()),r.push(""),r.push("");for(var n=0;n-1||Gx.indexOf(i[o][0])>-1||i[o][1]!=null&&u.push(i[o]);n.length&&Ue.utils.cfb_add(t,"/SummaryInformation",Lg(n,Oc.SI,l,bg)),(r.length||u.length)&&Ue.utils.cfb_add(t,"/DocumentSummaryInformation",Lg(r,Oc.DSI,s,Ig,u.length?u:null,Oc.UDI))}function X6(e,t){var r=t||{},n=Ue.utils.cfb_new({root:"R"}),i="/Workbook";switch(r.bookType||"xls"){case"xls":r.bookType="biff8";case"xla":r.bookType||(r.bookType="xla");case"biff8":i="/Workbook",r.biff=8;break;case"biff5":i="/Book",r.biff=5;break;default:throw new Error("invalid type "+r.bookType+" for XLS CFB")}return Ue.utils.cfb_add(n,i,Cw(e,r)),r.biff==8&&(e.Props||e.Custprops)&&j6(e,n),r.biff==8&&e.vbaraw&&fR(n,Ue.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),n}var K6={0:{f:QO},1:{f:oF},2:{f:CF},3:{f:hF},4:{f:uF},5:{f:EF},6:{f:DF},7:{f:vF},8:{f:MF},9:{f:NF},10:{f:kF},11:{f:$F},12:{f:sF},13:{f:RF},14:{f:gF},15:{f:fF},16:{f:SF},17:{f:IF},18:{f:wF},19:{f:Id},20:{},21:{},22:{},23:{},24:{},25:{},26:{},27:{},28:{},29:{},30:{},31:{},32:{},33:{},34:{},35:{T:1},36:{T:-1},37:{T:1},38:{T:-1},39:{f:_6},40:{},42:{},43:{f:DA},44:{f:OA},45:{f:bA},46:{f:$A},47:{f:kA},48:{},49:{f:s3},50:{},51:{f:QA},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:lA},62:{f:FF},63:{f:nR},64:{f:JF},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:br,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:YF},138:{T:-1},139:{T:1},140:{T:-1},141:{T:1},142:{T:-1},143:{T:1},144:{T:-1},145:{T:1},146:{T:-1},147:{f:nF},148:{f:eF,p:16},151:{f:WF},152:{},153:{f:y6},154:{},155:{},156:{f:x6},157:{},158:{},159:{T:1,f:xA},160:{T:-1},161:{T:1,f:yi},162:{T:-1},163:{T:1},164:{T:-1},165:{T:1},166:{T:-1},167:{},168:{},169:{},170:{},171:{},172:{T:1},173:{T:-1},174:{},175:{},176:{f:LF},177:{T:1},178:{T:-1},179:{T:1},180:{T:-1},181:{T:1},182:{T:-1},183:{T:1},184:{T:-1},185:{T:1},186:{T:-1},187:{T:1},188:{T:-1},189:{T:1},190:{T:-1},191:{T:1},192:{T:-1},193:{T:1},194:{T:-1},195:{T:1},196:{T:-1},197:{T:1},198:{T:-1},199:{T:1},200:{T:-1},201:{T:1},202:{T:-1},203:{T:1},204:{T:-1},205:{T:1},206:{T:-1},207:{T:1},208:{T:-1},209:{T:1},210:{T:-1},211:{T:1},212:{T:-1},213:{T:1},214:{T:-1},215:{T:1},216:{T:-1},217:{T:1},218:{T:-1},219:{T:1},220:{T:-1},221:{T:1},222:{T:-1},223:{T:1},224:{T:-1},225:{T:1},226:{T:-1},227:{T:1},228:{T:-1},229:{T:1},230:{T:-1},231:{T:1},232:{T:-1},233:{T:1},234:{T:-1},235:{T:1},236:{T:-1},237:{T:1},238:{T:-1},239:{T:1},240:{T:-1},241:{T:1},242:{T:-1},243:{T:1},244:{T:-1},245:{T:1},246:{T:-1},247:{T:1},248:{T:-1},249:{T:1},250:{T:-1},251:{T:1},252:{T:-1},253:{T:1},254:{T:-1},255:{T:1},256:{T:-1},257:{T:1},258:{T:-1},259:{T:1},260:{T:-1},261:{T:1},262:{T:-1},263:{T:1},264:{T:-1},265:{T:1},266:{T:-1},267:{T:1},268:{T:-1},269:{T:1},270:{T:-1},271:{T:1},272:{T:-1},273:{T:1},274:{T:-1},275:{T:1},276:{T:-1},277:{},278:{T:1},279:{T:-1},280:{T:1},281:{T:-1},282:{T:1},283:{T:1},284:{T:-1},285:{T:1},286:{T:-1},287:{T:1},288:{T:-1},289:{T:1},290:{T:-1},291:{T:1},292:{T:-1},293:{T:1},294:{T:-1},295:{T:1},296:{T:-1},297:{T:1},298:{T:-1},299:{T:1},300:{T:-1},301:{T:1},302:{T:-1},303:{T:1},304:{T:-1},305:{T:1},306:{T:-1},307:{T:1},308:{T:-1},309:{T:1},310:{T:-1},311:{T:1},312:{T:-1},313:{T:-1},314:{T:1},315:{T:-1},316:{T:1},317:{T:-1},318:{T:1},319:{T:-1},320:{T:1},321:{T:-1},322:{T:1},323:{T:-1},324:{T:1},325:{T:-1},326:{T:1},327:{T:-1},328:{T:1},329:{T:-1},330:{T:1},331:{T:-1},332:{T:1},333:{T:-1},334:{T:1},335:{f:YA},336:{T:-1},337:{f:eR,T:1},338:{T:-1},339:{T:1},340:{T:-1},341:{T:1},342:{T:-1},343:{T:1},344:{T:-1},345:{T:1},346:{T:-1},347:{T:1},348:{T:-1},349:{T:1},350:{T:-1},351:{},352:{},353:{T:1},354:{T:-1},355:{f:jf},357:{},358:{},359:{},360:{T:1},361:{},362:{f:rA},363:{},364:{},366:{},367:{},368:{},369:{},370:{},371:{},372:{T:1},373:{T:-1},374:{T:1},375:{T:-1},376:{T:1},377:{T:-1},378:{T:1},379:{T:-1},380:{T:1},381:{T:-1},382:{T:1},383:{T:-1},384:{T:1},385:{T:-1},386:{T:1},387:{T:-1},388:{T:1},389:{T:-1},390:{T:1},391:{T:-1},392:{T:1},393:{T:-1},394:{T:1},395:{T:-1},396:{},397:{},398:{},399:{},400:{},401:{T:1},403:{},404:{},405:{},406:{},407:{},408:{},409:{},410:{},411:{},412:{},413:{},414:{},415:{},416:{},417:{},418:{},419:{},420:{},421:{},422:{T:1},423:{T:1},424:{T:-1},425:{T:-1},426:{f:zF},427:{f:GF},428:{},429:{T:1},430:{T:-1},431:{T:1},432:{T:-1},433:{T:1},434:{T:-1},435:{T:1},436:{T:-1},437:{T:1},438:{T:-1},439:{T:1},440:{T:-1},441:{T:1},442:{T:-1},443:{T:1},444:{T:-1},445:{T:1},446:{T:-1},447:{T:1},448:{T:-1},449:{T:1},450:{T:-1},451:{T:1},452:{T:-1},453:{T:1},454:{T:-1},455:{T:1},456:{T:-1},457:{T:1},458:{T:-1},459:{T:1},460:{T:-1},461:{T:1},462:{T:-1},463:{T:1},464:{T:-1},465:{T:1},466:{T:-1},467:{T:1},468:{T:-1},469:{T:1},470:{T:-1},471:{},472:{},473:{T:1},474:{T:-1},475:{},476:{f:XF},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:rF},486:{T:1},487:{T:-1},488:{T:1},489:{T:-1},490:{T:1},491:{T:-1},492:{T:1},493:{T:-1},494:{f:HF},495:{T:1},496:{T:-1},497:{T:1},498:{T:-1},499:{},500:{T:1},501:{T:-1},502:{T:1},503:{T:-1},504:{},505:{T:1},506:{T:-1},507:{},508:{T:1},509:{T:-1},510:{T:1},511:{T:-1},512:{},513:{},514:{T:1},515:{T:-1},516:{T:1},517:{T:-1},518:{T:1},519:{T:-1},520:{T:1},521:{T:-1},522:{},523:{},524:{},525:{},526:{},527:{},528:{T:1},529:{T:-1},530:{T:1},531:{T:-1},532:{T:1},533:{T:-1},534:{},535:{},536:{},537:{},538:{T:1},539:{T:-1},540:{T:1},541:{T:-1},542:{T:1},548:{},549:{},550:{f:jf},551:{},552:{},553:{},554:{T:1},555:{T:-1},556:{T:1},557:{T:-1},558:{T:1},559:{T:-1},560:{T:1},561:{T:-1},562:{},564:{},565:{T:1},566:{T:-1},569:{T:1},570:{T:-1},572:{},573:{T:1},574:{T:-1},577:{},578:{},579:{},580:{},581:{},582:{},583:{},584:{},585:{},586:{},587:{},588:{T:-1},589:{},590:{T:1},591:{T:-1},592:{T:1},593:{T:-1},594:{T:1},595:{T:-1},596:{},597:{T:1},598:{T:-1},599:{T:1},600:{T:-1},601:{T:1},602:{T:-1},603:{T:1},604:{T:-1},605:{T:1},606:{T:-1},607:{},608:{T:1},609:{T:-1},610:{},611:{T:1},612:{T:-1},613:{T:1},614:{T:-1},615:{T:1},616:{T:-1},617:{T:1},618:{T:-1},619:{T:1},620:{T:-1},625:{},626:{T:1},627:{T:-1},628:{T:1},629:{T:-1},630:{T:1},631:{T:-1},632:{f:lR},633:{T:1},634:{T:-1},635:{T:1,f:aR},636:{T:-1},637:{f:f3},638:{T:1},639:{},640:{T:-1},641:{T:1},642:{T:-1},643:{T:1},644:{},645:{T:-1},646:{T:1},648:{T:1},649:{},650:{T:-1},651:{f:d6},652:{},653:{T:1},654:{T:-1},655:{T:1},656:{T:-1},657:{T:1},658:{T:-1},659:{},660:{T:1},661:{},662:{T:-1},663:{},664:{T:1},665:{},666:{T:-1},667:{},668:{},669:{},671:{T:1},672:{T:-1},673:{T:1},674:{T:-1},675:{},676:{},677:{},678:{},679:{},680:{},681:{},1024:{},1025:{},1026:{T:1},1027:{T:-1},1028:{T:1},1029:{T:-1},1030:{},1031:{T:1},1032:{T:-1},1033:{T:1},1034:{T:-1},1035:{},1036:{},1037:{},1038:{T:1},1039:{T:-1},1040:{},1041:{T:1},1042:{T:-1},1043:{},1044:{},1045:{},1046:{T:1},1047:{T:-1},1048:{T:1},1049:{T:-1},1050:{},1051:{T:1},1052:{T:1},1053:{f:e6},1054:{T:1},1055:{},1056:{T:1},1057:{T:-1},1058:{T:1},1059:{T:-1},1061:{},1062:{T:1},1063:{T:-1},1064:{T:1},1065:{T:-1},1066:{T:1},1067:{T:-1},1068:{T:1},1069:{T:-1},1070:{T:1},1071:{T:-1},1072:{T:1},1073:{T:-1},1075:{T:1},1076:{T:-1},1077:{T:1},1078:{T:-1},1079:{T:1},1080:{T:-1},1081:{T:1},1082:{T:-1},1083:{T:1},1084:{T:-1},1085:{},1086:{T:1},1087:{T:-1},1088:{T:1},1089:{T:-1},1090:{T:1},1091:{T:-1},1092:{T:1},1093:{T:-1},1094:{T:1},1095:{T:-1},1096:{},1097:{T:1},1098:{},1099:{T:-1},1100:{T:1},1101:{T:-1},1102:{},1103:{},1104:{},1105:{},1111:{},1112:{},1113:{T:1},1114:{T:-1},1115:{T:1},1116:{T:-1},1117:{},1118:{T:1},1119:{T:-1},1120:{T:1},1121:{T:-1},1122:{T:1},1123:{T:-1},1124:{T:1},1125:{T:-1},1126:{},1128:{T:1},1129:{T:-1},1130:{},1131:{T:1},1132:{T:-1},1133:{T:1},1134:{T:-1},1135:{T:1},1136:{T:-1},1137:{T:1},1138:{T:-1},1139:{T:1},1140:{T:-1},1141:{},1142:{T:1},1143:{T:-1},1144:{T:1},1145:{T:-1},1146:{},1147:{T:1},1148:{T:-1},1149:{T:1},1150:{T:-1},1152:{T:1},1153:{T:-1},1154:{T:-1},1155:{T:-1},1156:{T:-1},1157:{T:1},1158:{T:-1},1159:{T:1},1160:{T:-1},1161:{T:1},1162:{T:-1},1163:{T:1},1164:{T:-1},1165:{T:1},1166:{T:-1},1167:{T:1},1168:{T:-1},1169:{T:1},1170:{T:-1},1171:{},1172:{T:1},1173:{T:-1},1177:{},1178:{T:1},1180:{},1181:{},1182:{},2048:{T:1},2049:{T:-1},2050:{},2051:{T:1},2052:{T:-1},2053:{},2054:{},2055:{T:1},2056:{T:-1},2057:{T:1},2058:{T:-1},2060:{},2067:{},2068:{T:1},2069:{T:-1},2070:{},2071:{},2072:{T:1},2073:{T:-1},2075:{},2076:{},2077:{T:1},2078:{T:-1},2079:{},2080:{T:1},2081:{T:-1},2082:{},2083:{T:1},2084:{T:-1},2085:{T:1},2086:{T:-1},2087:{T:1},2088:{T:-1},2089:{T:1},2090:{T:-1},2091:{},2092:{},2093:{T:1},2094:{T:-1},2095:{},2096:{T:1},2097:{T:-1},2098:{T:1},2099:{T:-1},2100:{T:1},2101:{T:-1},2102:{},2103:{T:1},2104:{T:-1},2105:{},2106:{T:1},2107:{T:-1},2108:{},2109:{T:1},2110:{T:-1},2111:{T:1},2112:{T:-1},2113:{T:1},2114:{T:-1},2115:{},2116:{},2117:{},2118:{T:1},2119:{T:-1},2120:{},2121:{T:1},2122:{T:-1},2123:{T:1},2124:{T:-1},2125:{},2126:{T:1},2127:{T:-1},2128:{},2129:{T:1},2130:{T:-1},2131:{T:1},2132:{T:-1},2133:{T:1},2134:{},2135:{},2136:{},2137:{T:1},2138:{T:-1},2139:{T:1},2140:{T:-1},2141:{},3072:{},3073:{},4096:{T:1},4097:{T:-1},5002:{T:1},5003:{T:-1},5081:{T:1},5082:{T:-1},5083:{},5084:{T:1},5085:{T:-1},5086:{T:1},5087:{T:-1},5088:{},5089:{},5090:{},5092:{T:1},5093:{T:-1},5094:{},5095:{T:1},5096:{T:-1},5097:{},5099:{},65535:{n:""}};function ue(e,t,r,n){var i=t;if(!isNaN(i)){var o=n||(r||[]).length||0,a=e.next(4);a.write_shift(2,i),a.write_shift(2,o),o>0&&Fd(r)&&e.push(r)}}function Y6(e,t,r,n){var i=n||(r||[]).length||0;if(i<=8224)return ue(e,t,r,i);var o=t;if(!isNaN(o)){for(var a=r.parts||[],s=0,l=0,u=0;u+(a[s]||8224)<=8224;)u+=a[s]||8224,s++;var c=e.next(4);for(c.write_shift(2,o),c.write_shift(2,u),e.push(r.slice(l,l+u)),l+=u;l=0&&i<65536?ue(e,2,dA(r,n,i)):ue(e,3,fA(r,n,i));return;case"b":case"e":ue(e,5,q6(r,n,t.v,t.t));return;case"s":case"str":ue(e,4,Q6(r,n,(t.v||"").slice(0,255)));return}ue(e,1,rs(null,r,n))}function J6(e,t,r,n){var i=Array.isArray(t),o=Ge(t["!ref"]||"A1"),a,s="",l=[];if(o.e.c>255||o.e.r>16383){if(n.WTF)throw new Error("Range "+(t["!ref"]||"A1")+" exceeds format limit A1:IV16384");o.e.c=Math.min(o.e.c,255),o.e.r=Math.min(o.e.c,16383),a=nt(o)}for(var u=o.s.r;u<=o.e.r;++u){s=wt(u);for(var c=o.s.c;c<=o.e.c;++c){u===o.s.r&&(l[c]=Rt(c)),a=l[c]+s;var f=i?(t[u]||[])[c]:t[a];f&&Z6(e,f,u,c)}}}function eD(e,t){for(var r=t||{},n=Wt(),i=0,o=0;o255||h.e.r>=m){if(t.WTF)throw new Error("Range "+(o["!ref"]||"A1")+" exceeds format limit A1:IV16384");h.e.c=Math.min(h.e.c,255),h.e.r=Math.min(h.e.c,m-1)}ue(n,2057,$d(r,16,t)),ue(n,13,ir(1)),ue(n,12,ir(100)),ue(n,15,It(!0)),ue(n,17,It(!1)),ue(n,16,ai(.001)),ue(n,95,It(!0)),ue(n,42,It(!1)),ue(n,43,It(!1)),ue(n,130,ir(1)),ue(n,128,J3([0,0])),ue(n,131,It(!1)),ue(n,132,It(!1)),u&&aD(n,o["!cols"]),ue(n,512,Z3(h,t)),u&&(o["!links"]=[]);for(var p=h.s.r;p<=h.e.r;++p){f=wt(p);for(var g=h.s.c;g<=h.e.c;++g){p===h.s.r&&(d[g]=Rt(g)),c=d[g]+f;var x=l?(o[p]||[])[g]:o[c];x&&(sD(n,x,p,g,t),u&&x.l&&o["!links"].push([c,x.l]))}}var w=s.CodeName||s.name||i;return u&&ue(n,574,X3((a.Views||[])[0])),u&&(o["!merges"]||[]).length&&ue(n,229,iA(o["!merges"])),u&&oD(n,o),ue(n,442,Zx(w)),u&&nD(n,o),ue(n,10),n.end()}function uD(e,t,r){var n=Wt(),i=(e||{}).Workbook||{},o=i.Sheets||[],a=i.WBProps||{},s=r.biff==8,l=r.biff==5;if(ue(n,2057,$d(e,5,r)),r.bookType=="xla"&&ue(n,135),ue(n,225,s?ir(1200):null),ue(n,193,k3(2)),l&&ue(n,191),l&&ue(n,192),ue(n,226),ue(n,92,W3("SheetJS",r)),ue(n,66,ir(s?1200:1252)),s&&ue(n,353,ir(0)),s&&ue(n,448),ue(n,317,cA(e.SheetNames.length)),s&&e.vbaraw&&ue(n,211),s&&e.vbaraw){var u=a.CodeName||"ThisWorkbook";ue(n,442,Zx(u))}ue(n,156,ir(17)),ue(n,25,It(!1)),ue(n,18,It(!1)),ue(n,19,ir(0)),s&&ue(n,431,It(!1)),s&&ue(n,444,ir(0)),ue(n,61,j3()),ue(n,64,It(!1)),ue(n,141,ir(0)),ue(n,34,It(p6(e)=="true")),ue(n,14,It(!0)),s&&ue(n,439,It(!1)),ue(n,218,ir(0)),tD(n,e,r),rD(n,e.SSF,r),iD(n,r),s&&ue(n,352,It(!1));var c=n.end(),f=Wt();s&&ue(f,140,sA()),s&&r.Strings&&Y6(f,252,G3(r.Strings)),ue(f,10);var d=f.end(),h=Wt(),m=0,p=0;for(p=0;p255&&typeof console<"u"&&console.error&&console.error("Worksheet '"+e.SheetNames[r]+"' extends beyond column IV (255). Data may be lost.")}}var o=t||{};switch(o.biff||2){case 8:case 5:return cD(e,t);case 4:case 3:case 2:return eD(e,t)}throw new Error("invalid type "+o.bookType+" for BIFF")}function fD(e,t,r,n){for(var i=e["!merges"]||[],o=[],a=t.s.c;a<=t.e.c;++a){for(var s=0,l=0,u=0;ur||i[u].s.c>a)&&!(i[u].e.r1&&(h.rowspan=s),l>1&&(h.colspan=l),n.editable?d=''+d+"":f&&(h["data-t"]=f&&f.t||"z",f.v!=null&&(h["data-v"]=f.v),f.z!=null&&(h["data-z"]=f.z),f.l&&(f.l.Target||"#").charAt(0)!="#"&&(d=''+d+"")),h.id=(n.id||"sjs")+"-"+c,o.push(le("td",d,h))}}var m="";return m+o.join("")+""}var dD='SheetJS Table Export',hD="";function pD(e,t,r){var n=[];return n.join("")+""}function Aw(e,t){var r=t||{},n=r.header!=null?r.header:dD,i=r.footer!=null?r.footer:hD,o=[n],a=Zt(e["!ref"]);r.dense=Array.isArray(e),o.push(pD(e,a,r));for(var s=a.s.r;s<=a.e.r;++s)o.push(fD(e,a,s,r));return o.push(""+i),o.join("")}function Rw(e,t,r){var n=r||{},i=0,o=0;if(n.origin!=null)if(typeof n.origin=="number")i=n.origin;else{var a=typeof n.origin=="string"?ut(n.origin):n.origin;i=a.r,o=a.c}var s=t.getElementsByTagName("tr"),l=Math.min(n.sheetRows||1e7,s.length),u={s:{r:0,c:0},e:{r:i,c:o}};if(e["!ref"]){var c=Zt(e["!ref"]);u.s.r=Math.min(u.s.r,c.s.r),u.s.c=Math.min(u.s.c,c.s.c),u.e.r=Math.max(u.e.r,c.e.r),u.e.c=Math.max(u.e.c,c.e.c),i==-1&&(u.e.r=i=c.e.r+1)}var f=[],d=0,h=e["!rows"]||(e["!rows"]=[]),m=0,p=0,g=0,x=0,w=0,y=0;for(e["!cols"]||(e["!cols"]=[]);m1||y>1)&&f.push({s:{r:p+i,c:x+o},e:{r:p+i+(w||1)-1,c:x+o+(y||1)-1}});var L={t:"s",v:S},V=N.getAttribute("data-t")||N.getAttribute("t")||"";S!=null&&(S.length==0?L.t=V||"z":n.raw||S.trim().length==0||V=="s"||(S==="TRUE"?L={t:"b",v:!0}:S==="FALSE"?L={t:"b",v:!1}:isNaN(Qr(S))?isNaN(Ma(S).getDate())||(L={t:"d",v:$t(S)},n.cellDates||(L={t:"n",v:zt(L.v)}),L.z=n.dateNF||et[14]):L={t:"n",v:Qr(S)})),L.z===void 0&&A!=null&&(L.z=A);var U="",W=N.getElementsByTagName("A");if(W&&W.length)for(var Y=0;Y=l&&(e["!fullref"]=nt((u.e.r=s.length-m+p-1+i,u))),e}function Ow(e,t){var r=t||{},n=r.dense?[]:{};return Rw(n,e,t)}function gD(e,t){return mi(Ow(e,t),t)}function Xg(e){var t="",r=mD(e);return r&&(t=r(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function mD(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}var vD=function(){var e=["",'',"",'',"",'',"",""].join(""),t=""+e+"";return function(){return it+t}}(),Kg=function(){var e=function(o){return Le(o).replace(/ +/g,function(a){return''}).replace(/\t/g,"").replace(/\n/g,"").replace(/^ /,"").replace(/ $/,"")},t=` +`;t.push(yt("t",Be(a)))}t.push("")}),t.push(""),t.length>2&&(t[t.length]="",t[1]=t[1].replace("/>",">")),t.join("")}function vR(e,t,r){var n=[at,ue("ThreadedComments",null,{xmlns:ft.TCMNT}).replace(/[\/]>/,">")];return e.forEach(function(i){var o="";(i[1]||[]).forEach(function(a,s){if(!a.T){delete a.ID;return}a.a&&t.indexOf(a.a)==-1&&t.push(a.a);var l={ref:i[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+r.tcid++).slice(-12)+"}"};s==0?o=l.id:l.parentId=o,a.ID=l.id,a.a&&(l.personId="{54EE7950-7262-4200-6969-"+("000000000000"+t.indexOf(a.a)).slice(-12)+"}"),n.push(ue("threadedComment",yt("text",a.t||""),l))})}),n.push(""),n.join("")}function xR(e){var t=[at,ue("personList",null,{xmlns:ft.TCMNT,"xmlns:x":_o[0]}).replace(/[\/]>/,">")];return e.forEach(function(r,n){t.push(ue("person",null,{displayName:r,id:"{54EE7950-7262-4200-6969-"+("000000000000"+n).slice(-12)+"}",userId:r,providerId:"None"}))}),t.push(""),t.join("")}function wR(e){var t={};t.iauthor=e.read_shift(4);var r=yi(e);return t.rfx=r.s,t.ref=Ue(r.s),e.l+=16,t}function yR(e,t){return t==null&&(t=Z(36)),t.write_shift(4,e[1].iauthor),To(e[0],t),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t}var ER=Dt;function _R(e){return ht(e.slice(0,54))}function SR(e){var t=Gt(),r=[];return re(t,628),re(t,630),e.forEach(function(n){n[1].forEach(function(i){r.indexOf(i.a)>-1||(r.push(i.a.slice(0,54)),re(t,632,_R(i.a)))})}),re(t,631),re(t,633),e.forEach(function(n){n[1].forEach(function(i){i.iauthor=r.indexOf(i.a);var o={s:dt(n[0]),e:dt(n[0])};re(t,635,yR([o,i])),i.t&&i.t.length>0&&re(t,637,C3(i)),re(t,636),delete i.iauthor})}),re(t,634),re(t,629),t.end()}function TR(e,t){t.FullPaths.forEach(function(r,n){if(n!=0){var i=r.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");i.slice(-1)!=="/"&&He.utils.cfb_add(e,i,t.FileIndex[n].content)}})}var Ew=["xlsb","xlsm","xlam","biff8","xla"],CR=function(){var e=/(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g,t={r:0,c:0};function r(n,i,o,a){var s=!1,l=!1;o.length==0?l=!0:o.charAt(0)=="["&&(l=!0,o=o.slice(1,-1)),a.length==0?s=!0:a.charAt(0)=="["&&(s=!0,a=a.slice(1,-1));var u=o.length>0?parseInt(o,10)|0:0,c=a.length>0?parseInt(a,10)|0:0;return s?c+=t.c:--c,l?u+=t.r:--u,i+(s?"":"$")+Ft(c)+(l?"":"$")+_t(u)}return function(i,o){return t=o,i.replace(e,r)}}(),Hd=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g,Vd=function(){return function(t,r){return t.replace(Hd,function(n,i,o,a,s,l){var u=$d(a)-(o?0:r.c),c=kd(l)-(s?0:r.r),f=c==0?"":s?c+1:"["+c+"]",d=u==0?"":o?u+1:"["+u+"]";return i+"R"+f+"C"+d})}}();function AR(e,t){return e.replace(Hd,function(r,n,i,o,a,s){return n+(i=="$"?i+o:Ft($d(o)+t.c))+(a=="$"?a+s:_t(kd(s)+t.r))})}function RR(e){return e.length!=1}function it(e){e.l+=1}function $n(e,t){var r=e.read_shift(t==1?1:2);return[r&16383,r>>14&1,r>>15&1]}function _w(e,t,r){var n=2;if(r){if(r.biff>=2&&r.biff<=5)return Sw(e);r.biff==12&&(n=4)}var i=e.read_shift(n),o=e.read_shift(n),a=$n(e,2),s=$n(e,2);return{s:{r:i,c:a[0],cRel:a[1],rRel:a[2]},e:{r:o,c:s[0],cRel:s[1],rRel:s[2]}}}function Sw(e){var t=$n(e,2),r=$n(e,2),n=e.read_shift(1),i=e.read_shift(1);return{s:{r:t[0],c:n,cRel:t[1],rRel:t[2]},e:{r:r[0],c:i,cRel:r[1],rRel:r[2]}}}function OR(e,t,r){if(r.biff<8)return Sw(e);var n=e.read_shift(r.biff==12?4:2),i=e.read_shift(r.biff==12?4:2),o=$n(e,2),a=$n(e,2);return{s:{r:n,c:o[0],cRel:o[1],rRel:o[2]},e:{r:i,c:a[0],cRel:a[1],rRel:a[2]}}}function Tw(e,t,r){if(r&&r.biff>=2&&r.biff<=5)return FR(e);var n=e.read_shift(r&&r.biff==12?4:2),i=$n(e,2);return{r:n,c:i[0],cRel:i[1],rRel:i[2]}}function FR(e){var t=$n(e,2),r=e.read_shift(1);return{r:t[0],c:r,cRel:t[1],rRel:t[2]}}function DR(e){var t=e.read_shift(2),r=e.read_shift(2);return{r:t,c:r&255,fQuoted:!!(r&16384),cRel:r>>15,rRel:r>>15}}function PR(e,t,r){var n=r&&r.biff?r.biff:8;if(n>=2&&n<=5)return IR(e);var i=e.read_shift(n>=12?4:2),o=e.read_shift(2),a=(o&16384)>>14,s=(o&32768)>>15;if(o&=16383,s==1)for(;i>524287;)i-=1048576;if(a==1)for(;o>8191;)o=o-16384;return{r:i,c:o,cRel:a,rRel:s}}function IR(e){var t=e.read_shift(2),r=e.read_shift(1),n=(t&32768)>>15,i=(t&16384)>>14;return t&=16383,n==1&&t>=8192&&(t=t-16384),i==1&&r>=128&&(r=r-256),{r:t,c:r,cRel:i,rRel:n}}function bR(e,t,r){var n=(e[e.l++]&96)>>5,i=_w(e,r.biff>=2&&r.biff<=5?6:8,r);return[n,i]}function kR(e,t,r){var n=(e[e.l++]&96)>>5,i=e.read_shift(2,"i"),o=8;if(r)switch(r.biff){case 5:e.l+=12,o=6;break;case 12:o=12;break}var a=_w(e,o,r);return[n,i,a]}function $R(e,t,r){var n=(e[e.l++]&96)>>5;return e.l+=r&&r.biff>8?12:r.biff<8?6:8,[n]}function NR(e,t,r){var n=(e[e.l++]&96)>>5,i=e.read_shift(2),o=8;if(r)switch(r.biff){case 5:e.l+=12,o=6;break;case 12:o=12;break}return e.l+=o,[n,i]}function MR(e,t,r){var n=(e[e.l++]&96)>>5,i=OR(e,t-1,r);return[n,i]}function LR(e,t,r){var n=(e[e.l++]&96)>>5;return e.l+=r.biff==2?6:r.biff==12?14:7,[n]}function Yg(e){var t=e[e.l+1]&1,r=1;return e.l+=4,[t,r]}function BR(e,t,r){e.l+=2;for(var n=e.read_shift(r&&r.biff==2?1:2),i=[],o=0;o<=n;++o)i.push(e.read_shift(r&&r.biff==2?1:2));return i}function UR(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(r&&r.biff==2?1:2)]}function HR(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(r&&r.biff==2?1:2)]}function VR(e){var t=e[e.l+1]&255?1:0;return e.l+=2,[t,e.read_shift(2)]}function WR(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=r&&r.biff==2?3:4,[n]}function Cw(e){var t=e.read_shift(1),r=e.read_shift(1);return[t,r]}function zR(e){return e.read_shift(2),Cw(e)}function GR(e){return e.read_shift(2),Cw(e)}function jR(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var i=Tw(e,0,r);return[n,i]}function XR(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var i=PR(e,0,r);return[n,i]}function KR(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var i=e.read_shift(2);r&&r.biff==5&&(e.l+=12);var o=Tw(e,0,r);return[n,i,o]}function YR(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var i=e.read_shift(r&&r.biff<=3?1:2);return[YO[i],Ow[i],n]}function qR(e,t,r){var n=e[e.l++],i=e.read_shift(1),o=r&&r.biff<=3?[n==88?-1:0,e.read_shift(1)]:QR(e);return[i,(o[0]===0?Ow:KO)[o[1]]]}function QR(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function ZR(e,t,r){e.l+=r&&r.biff==2?3:4}function JR(e,t,r){if(e.l++,r&&r.biff==12)return[e.read_shift(4,"i"),0];var n=e.read_shift(2),i=e.read_shift(r&&r.biff==2?1:2);return[n,i]}function eO(e){return e.l++,es[e.read_shift(1)]}function tO(e){return e.l++,e.read_shift(2)}function rO(e){return e.l++,e.read_shift(1)!==0}function nO(e){return e.l++,Co(e)}function iO(e,t,r){return e.l++,sw(e,t-1,r)}function oO(e,t){var r=[e.read_shift(1)];if(t==12)switch(r[0]){case 2:r[0]=4;break;case 4:r[0]=16;break;case 0:r[0]=1;break;case 1:r[0]=2;break}switch(r[0]){case 4:r[1]=K3(e,1)?"TRUE":"FALSE",t!=12&&(e.l+=7);break;case 37:case 16:r[1]=es[e[e.l]],e.l+=t==12?4:8;break;case 0:e.l+=8;break;case 1:r[1]=Co(e);break;case 2:r[1]=Z3(e,0,{biff:t>0&&t<8?2:t});break;default:throw new Error("Bad SerAr: "+r[0])}return r}function aO(e,t,r){for(var n=e.read_shift(r.biff==12?4:2),i=[],o=0;o!=n;++o)i.push((r.biff==12?yi:tA)(e));return i}function sO(e,t,r){var n=0,i=0;r.biff==12?(n=e.read_shift(4),i=e.read_shift(4)):(i=1+e.read_shift(1),n=1+e.read_shift(2)),r.biff>=2&&r.biff<8&&(--n,--i==0&&(i=256));for(var o=0,a=[];o!=n&&(a[o]=[]);++o)for(var s=0;s!=i;++s)a[o][s]=oO(e,r.biff);return a}function lO(e,t,r){var n=e.read_shift(1)>>>5&3,i=!r||r.biff>=8?4:2,o=e.read_shift(i);switch(r.biff){case 2:e.l+=5;break;case 3:case 4:e.l+=8;break;case 5:e.l+=12;break}return[n,0,o]}function uO(e,t,r){if(r.biff==5)return cO(e);var n=e.read_shift(1)>>>5&3,i=e.read_shift(2),o=e.read_shift(4);return[n,i,o]}function cO(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2,"i");e.l+=8;var n=e.read_shift(2);return e.l+=12,[t,r,n]}function fO(e,t,r){var n=e.read_shift(1)>>>5&3;e.l+=r&&r.biff==2?3:4;var i=e.read_shift(r&&r.biff==2?1:2);return[n,i]}function dO(e,t,r){var n=e.read_shift(1)>>>5&3,i=e.read_shift(r&&r.biff==2?1:2);return[n,i]}function hO(e,t,r){var n=e.read_shift(1)>>>5&3;return e.l+=4,r.biff<8&&e.l--,r.biff==12&&(e.l+=2),[n]}function pO(e,t,r){var n=(e[e.l++]&96)>>5,i=e.read_shift(2),o=4;if(r)switch(r.biff){case 5:o=15;break;case 12:o=6;break}return e.l+=o,[n,i]}var gO=$r,mO=$r,vO=$r;function ts(e,t,r){return e.l+=2,[DR(e)]}function Wd(e){return e.l+=6,[]}var xO=ts,wO=Wd,yO=Wd,EO=ts;function Aw(e){return e.l+=2,[ow(e),e.read_shift(2)&1]}var _O=ts,SO=Aw,TO=Wd,CO=ts,AO=ts,RO=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function OO(e){e.l+=2;var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(4),i=e.read_shift(2),o=e.read_shift(2),a=RO[r>>2&31];return{ixti:t,coltype:r&3,rt:a,idx:n,c:i,C:o}}function FO(e){return e.l+=2,[e.read_shift(4)]}function DO(e,t,r){return e.l+=5,e.l+=2,e.l+=r.biff==2?1:4,["PTGSHEET"]}function PO(e,t,r){return e.l+=r.biff==2?4:5,["PTGENDSHEET"]}function IO(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function bO(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function kO(e){return e.l+=4,[0,0]}var qg={1:{n:"PtgExp",f:JR},2:{n:"PtgTbl",f:vO},3:{n:"PtgAdd",f:it},4:{n:"PtgSub",f:it},5:{n:"PtgMul",f:it},6:{n:"PtgDiv",f:it},7:{n:"PtgPower",f:it},8:{n:"PtgConcat",f:it},9:{n:"PtgLt",f:it},10:{n:"PtgLe",f:it},11:{n:"PtgEq",f:it},12:{n:"PtgGe",f:it},13:{n:"PtgGt",f:it},14:{n:"PtgNe",f:it},15:{n:"PtgIsect",f:it},16:{n:"PtgUnion",f:it},17:{n:"PtgRange",f:it},18:{n:"PtgUplus",f:it},19:{n:"PtgUminus",f:it},20:{n:"PtgPercent",f:it},21:{n:"PtgParen",f:it},22:{n:"PtgMissArg",f:it},23:{n:"PtgStr",f:iO},26:{n:"PtgSheet",f:DO},27:{n:"PtgEndSheet",f:PO},28:{n:"PtgErr",f:eO},29:{n:"PtgBool",f:rO},30:{n:"PtgInt",f:tO},31:{n:"PtgNum",f:nO},32:{n:"PtgArray",f:LR},33:{n:"PtgFunc",f:YR},34:{n:"PtgFuncVar",f:qR},35:{n:"PtgName",f:lO},36:{n:"PtgRef",f:jR},37:{n:"PtgArea",f:bR},38:{n:"PtgMemArea",f:fO},39:{n:"PtgMemErr",f:gO},40:{n:"PtgMemNoMem",f:mO},41:{n:"PtgMemFunc",f:dO},42:{n:"PtgRefErr",f:hO},43:{n:"PtgAreaErr",f:$R},44:{n:"PtgRefN",f:XR},45:{n:"PtgAreaN",f:MR},46:{n:"PtgMemAreaN",f:IO},47:{n:"PtgMemNoMemN",f:bO},57:{n:"PtgNameX",f:uO},58:{n:"PtgRef3d",f:KR},59:{n:"PtgArea3d",f:kR},60:{n:"PtgRefErr3d",f:pO},61:{n:"PtgAreaErr3d",f:NR},255:{}},$O={64:32,96:32,65:33,97:33,66:34,98:34,67:35,99:35,68:36,100:36,69:37,101:37,70:38,102:38,71:39,103:39,72:40,104:40,73:41,105:41,74:42,106:42,75:43,107:43,76:44,108:44,77:45,109:45,78:46,110:46,79:47,111:47,88:34,120:34,89:57,121:57,90:58,122:58,91:59,123:59,92:60,124:60,93:61,125:61},NO={1:{n:"PtgElfLel",f:Aw},2:{n:"PtgElfRw",f:CO},3:{n:"PtgElfCol",f:xO},6:{n:"PtgElfRwV",f:AO},7:{n:"PtgElfColV",f:EO},10:{n:"PtgElfRadical",f:_O},11:{n:"PtgElfRadicalS",f:TO},13:{n:"PtgElfColS",f:wO},15:{n:"PtgElfColSV",f:yO},16:{n:"PtgElfRadicalLel",f:SO},25:{n:"PtgList",f:OO},29:{n:"PtgSxName",f:FO},255:{}},MO={0:{n:"PtgAttrNoop",f:kO},1:{n:"PtgAttrSemi",f:WR},2:{n:"PtgAttrIf",f:HR},4:{n:"PtgAttrChoose",f:BR},8:{n:"PtgAttrGoto",f:UR},16:{n:"PtgAttrSum",f:ZR},32:{n:"PtgAttrBaxcel",f:Yg},33:{n:"PtgAttrBaxcel",f:Yg},64:{n:"PtgAttrSpace",f:zR},65:{n:"PtgAttrSpaceSemi",f:GR},128:{n:"PtgAttrIfError",f:VR},255:{}};function LO(e,t,r,n){if(n.biff<8)return $r(e,t);for(var i=e.l+t,o=[],a=0;a!==r.length;++a)switch(r[a][0]){case"PtgArray":r[a][1]=sO(e,0,n),o.push(r[a][1]);break;case"PtgMemArea":r[a][2]=aO(e,r[a][1],n),o.push(r[a][2]);break;case"PtgExp":n&&n.biff==12&&(r[a][1][1]=e.read_shift(4),o.push(r[a][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+r[a][0]}return t=i-e.l,t!==0&&o.push($r(e,t)),o}function BO(e,t,r){for(var n=e.l+t,i,o,a=[];n!=e.l;)t=n-e.l,o=e[e.l],i=qg[o]||qg[$O[o]],(o===24||o===25)&&(i=(o===24?NO:MO)[e[e.l+1]]),!i||!i.f?$r(e,t):a.push([i.n,i.f(e,t,r)]);return a}function UO(e){for(var t=[],r=0;r=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function VO(e,t){if(!e&&!(t&&t.biff<=5&&t.biff>=2))throw new Error("empty sheet name");return/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(e)?"'"+e+"'":e}function Rw(e,t,r){if(!e)return"SH33TJSERR0";if(r.biff>8&&(!e.XTI||!e.XTI[t]))return e.SheetNames[t];if(!e.XTI)return"SH33TJSERR6";var n=e.XTI[t];if(r.biff<8)return t>1e4&&(t-=65536),t<0&&(t=-t),t==0?"":e.XTI[t-1];if(!n)return"SH33TJSERR1";var i="";if(r.biff>8)switch(e[n[0]][0]){case 357:return i=n[1]==-1?"#REF":e.SheetNames[n[1]],n[1]==n[2]?i:i+":"+e.SheetNames[n[2]];case 358:return r.SID!=null?e.SheetNames[r.SID]:"SH33TJSSAME"+e[n[0]][0];case 355:default:return"SH33TJSSRC"+e[n[0]][0]}switch(e[n[0]][0][0]){case 1025:return i=n[1]==-1?"#REF":e.SheetNames[n[1]]||"SH33TJSERR3",n[1]==n[2]?i:i+":"+e.SheetNames[n[2]];case 14849:return e[n[0]].slice(1).map(function(o){return o.Name}).join(";;");default:return e[n[0]][0][3]?(i=n[1]==-1?"#REF":e[n[0]][0][3][n[1]]||"SH33TJSERR4",n[1]==n[2]?i:i+":"+e[n[0]][0][3][n[2]]):"SH33TJSERR2"}}function Qg(e,t,r){var n=Rw(e,t,r);return n=="#REF"?n:VO(n,r)}function fo(e,t,r,n,i){var o=i&&i.biff||8,a={s:{c:0,r:0},e:{c:0,r:0}},s=[],l,u,c,f=0,d=0,h,m="";if(!e[0]||!e[0][0])return"";for(var p=-1,g="",x=0,w=e[0].length;x=0){switch(e[0][p][1][0]){case 0:g=Je(" ",e[0][p][1][1]);break;case 1:g=Je("\r",e[0][p][1][1]);break;default:if(g="",i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}u=u+g,p=-1}s.push(u+HO[y[0]]+l);break;case"PtgIsect":l=s.pop(),u=s.pop(),s.push(u+" "+l);break;case"PtgUnion":l=s.pop(),u=s.pop(),s.push(u+","+l);break;case"PtgRange":l=s.pop(),u=s.pop(),s.push(u+":"+l);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":c=ga(y[1][1],a,i),s.push(ma(c,o));break;case"PtgRefN":c=r?ga(y[1][1],r,i):y[1][1],s.push(ma(c,o));break;case"PtgRef3d":f=y[1][1],c=ga(y[1][2],a,i),m=Qg(n,f,i),s.push(m+"!"+ma(c,o));break;case"PtgFunc":case"PtgFuncVar":var _=y[1][0],N=y[1][1];_||(_=0),_&=127;var M=_==0?[]:s.slice(-_);s.length-=_,N==="User"&&(N=M.shift()),s.push(N+"("+M.join(",")+")");break;case"PtgBool":s.push(y[1]?"TRUE":"FALSE");break;case"PtgInt":s.push(y[1]);break;case"PtgNum":s.push(String(y[1]));break;case"PtgStr":s.push('"'+y[1].replace(/"/g,'""')+'"');break;case"PtgErr":s.push(y[1]);break;case"PtgAreaN":h=$g(y[1][1],r?{s:r}:a,i),s.push(Cc(h,i));break;case"PtgArea":h=$g(y[1][1],a,i),s.push(Cc(h,i));break;case"PtgArea3d":f=y[1][1],h=y[1][2],m=Qg(n,f,i),s.push(m+"!"+Cc(h,i));break;case"PtgAttrSum":s.push("SUM("+s.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":d=y[1][2];var S=(n.names||[])[d-1]||(n[0]||[])[d],C=S?S.Name:"SH33TJSNAME"+String(d);C&&C.slice(0,6)=="_xlfn."&&!i.xlfn&&(C=C.slice(6)),s.push(C);break;case"PtgNameX":var A=y[1][1];d=y[1][2];var L;if(i.biff<=5)A<0&&(A=-A),n[A]&&(L=n[A][d]);else{var H="";if(((n[A]||[])[0]||[])[0]==14849||(((n[A]||[])[0]||[])[0]==1025?n[A][d]&&n[A][d].itab>0&&(H=n.SheetNames[n[A][d].itab-1]+"!"):H=n.SheetNames[d-1]+"!"),n[A]&&n[A][d])H+=n[A][d].Name;else if(n[0]&&n[0][d])H+=n[0][d].Name;else{var B=(Rw(n,A,i)||"").split(";;");B[d-1]?H=B[d-1]:H+="SH33TJSERRX"}s.push(H);break}L||(L={Name:"SH33TJSERRY"}),s.push(L.Name);break;case"PtgParen":var V="(",Q=")";if(p>=0){switch(g="",e[0][p][1][0]){case 2:V=Je(" ",e[0][p][1][1])+V;break;case 3:V=Je("\r",e[0][p][1][1])+V;break;case 4:Q=Je(" ",e[0][p][1][1])+Q;break;case 5:Q=Je("\r",e[0][p][1][1])+Q;break;default:if(i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}p=-1}s.push(V+s.pop()+Q);break;case"PtgRefErr":s.push("#REF!");break;case"PtgRefErr3d":s.push("#REF!");break;case"PtgExp":c={c:y[1][1],r:y[1][0]};var ne={c:r.c,r:r.r};if(n.sharedf[Ue(c)]){var ye=n.sharedf[Ue(c)];s.push(fo(ye,a,ne,n,i))}else{var ve=!1;for(l=0;l!=n.arrayf.length;++l)if(u=n.arrayf[l],!(c.cu[0].e.c)&&!(c.ru[0].e.r)){s.push(fo(u[1],a,ne,n,i)),ve=!0;break}ve||s.push(y[1])}break;case"PtgArray":s.push("{"+UO(y[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":p=x;break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":s.push("");break;case"PtgAreaErr":s.push("#REF!");break;case"PtgAreaErr3d":s.push("#REF!");break;case"PtgList":s.push("Table"+y[1].idx+"[#"+y[1].rt+"]");break;case"PtgMemAreaN":case"PtgMemNoMemN":case"PtgAttrNoop":case"PtgSheet":case"PtgEndSheet":break;case"PtgMemFunc":break;case"PtgMemNoMem":break;case"PtgElfCol":case"PtgElfColS":case"PtgElfColSV":case"PtgElfColV":case"PtgElfLel":case"PtgElfRadical":case"PtgElfRadicalLel":case"PtgElfRadicalS":case"PtgElfRw":case"PtgElfRwV":throw new Error("Unsupported ELFs");case"PtgSxName":throw new Error("Unrecognized Formula Token: "+String(y));default:throw new Error("Unrecognized Formula Token: "+String(y))}var Ce=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(i.biff!=3&&p>=0&&Ce.indexOf(e[0][x][0])==-1){y=e[0][p];var ie=!0;switch(y[1][0]){case 4:ie=!1;case 0:g=Je(" ",y[1][1]);break;case 5:ie=!1;case 1:g=Je("\r",y[1][1]);break;default:if(g="",i.WTF)throw new Error("Unexpected PtgAttrSpaceType "+y[1][0])}s.push((ie?g:"")+s.pop()+(ie?"":g)),p=-1}}if(s.length>1&&i.WTF)throw new Error("bad formula stack");return s[0]}function WO(e){if(e==null){var t=Z(8);return t.write_shift(1,3),t.write_shift(1,0),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(2,65535),t}else if(typeof e=="number")return oi(e);return oi(0)}function zO(e,t,r,n,i){var o=ai(t,r,i),a=WO(e.v),s=Z(6),l=33;s.write_shift(2,l),s.write_shift(4,0);for(var u=Z(e.bf.length),c=0;c0?LO(e,o,i,r):null;return[i,a]}var GO=_u,Su=_u,jO=_u,XO=_u,KO={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE.PUBLISHER",218:"SUBSCRIBE.TO",219:"ATTRIBUTES",220:"SHOW.TOOLBAR",222:"PRINT.PREVIEW",223:"EDIT.COLOR",224:"SHOW.LEVELS",225:"FORMAT.MAIN",226:"FORMAT.OVERLAY",227:"ON.RECALC",228:"EDIT.SERIES",229:"DEFINE.STYLE",240:"LINE.PRINT",243:"ENTER.DATA",249:"GALLERY.RADAR",250:"MERGE.STYLES",251:"EDITION.OPTIONS",252:"PASTE.PICTURE",253:"PASTE.PICTURE.LINK",254:"SPELLING",256:"ZOOM",259:"INSERT.OBJECT",260:"WINDOW.MINIMIZE",265:"SOUND.NOTE",266:"SOUND.PLAY",267:"FORMAT.SHAPE",268:"EXTEND.POLYGON",269:"FORMAT.AUTO",272:"GALLERY.3D.BAR",273:"GALLERY.3D.SURFACE",274:"FILL.AUTO",276:"CUSTOMIZE.TOOLBAR",277:"ADD.TOOL",278:"EDIT.OBJECT",279:"ON.DOUBLECLICK",280:"ON.ENTRY",281:"WORKBOOK.ADD",282:"WORKBOOK.MOVE",283:"WORKBOOK.COPY",284:"WORKBOOK.OPTIONS",285:"SAVE.WORKSPACE",288:"CHART.WIZARD",289:"DELETE.TOOL",290:"MOVE.TOOL",291:"WORKBOOK.SELECT",292:"WORKBOOK.ACTIVATE",293:"ASSIGN.TO.TOOL",295:"COPY.TOOL",296:"RESET.TOOL",297:"CONSTRAIN.NUMERIC",298:"PASTE.TOOL",302:"WORKBOOK.NEW",305:"SCENARIO.CELLS",306:"SCENARIO.DELETE",307:"SCENARIO.ADD",308:"SCENARIO.EDIT",309:"SCENARIO.SHOW",310:"SCENARIO.SHOW.NEXT",311:"SCENARIO.SUMMARY",312:"PIVOT.TABLE.WIZARD",313:"PIVOT.FIELD.PROPERTIES",314:"PIVOT.FIELD",315:"PIVOT.ITEM",316:"PIVOT.ADD.FIELDS",318:"OPTIONS.CALCULATION",319:"OPTIONS.EDIT",320:"OPTIONS.VIEW",321:"ADDIN.MANAGER",322:"MENU.EDITOR",323:"ATTACH.TOOLBARS",324:"VBAActivate",325:"OPTIONS.CHART",328:"VBA.INSERT.FILE",330:"VBA.PROCEDURE.DEFINITION",336:"ROUTING.SLIP",338:"ROUTE.DOCUMENT",339:"MAIL.LOGON",342:"INSERT.PICTURE",343:"EDIT.TOOL",344:"GALLERY.DOUGHNUT",350:"CHART.TREND",352:"PIVOT.ITEM.PROPERTIES",354:"WORKBOOK.INSERT",355:"OPTIONS.TRANSITION",356:"OPTIONS.GENERAL",370:"FILTER.ADVANCED",373:"MAIL.ADD.MAILER",374:"MAIL.DELETE.MAILER",375:"MAIL.REPLY",376:"MAIL.REPLY.ALL",377:"MAIL.FORWARD",378:"MAIL.NEXT.LETTER",379:"DATA.LABEL",380:"INSERT.TITLE",381:"FONT.PROPERTIES",382:"MACRO.OPTIONS",383:"WORKBOOK.HIDE",384:"WORKBOOK.UNHIDE",385:"WORKBOOK.DELETE",386:"WORKBOOK.NAME",388:"GALLERY.CUSTOM",390:"ADD.CHART.AUTOFORMAT",391:"DELETE.CHART.AUTOFORMAT",392:"CHART.ADD.DATA",393:"AUTO.OUTLINE",394:"TAB.ORDER",395:"SHOW.DIALOG",396:"SELECT.ALL",397:"UNGROUP.SHEETS",398:"SUBTOTAL.CREATE",399:"SUBTOTAL.REMOVE",400:"RENAME.OBJECT",412:"WORKBOOK.SCROLL",413:"WORKBOOK.NEXT",414:"WORKBOOK.PREV",415:"WORKBOOK.TAB.SPLIT",416:"FULL.SCREEN",417:"WORKBOOK.PROTECT",420:"SCROLLBAR.PROPERTIES",421:"PIVOT.SHOW.PAGES",422:"TEXT.TO.COLUMNS",423:"FORMAT.CHARTTYPE",424:"LINK.FORMAT",425:"TRACER.DISPLAY",430:"TRACER.NAVIGATE",431:"TRACER.CLEAR",432:"TRACER.ERROR",433:"PIVOT.FIELD.GROUP",434:"PIVOT.FIELD.UNGROUP",435:"CHECKBOX.PROPERTIES",436:"LABEL.PROPERTIES",437:"LISTBOX.PROPERTIES",438:"EDITBOX.PROPERTIES",439:"PIVOT.REFRESH",440:"LINK.COMBO",441:"OPEN.TEXT",442:"HIDE.DIALOG",443:"SET.DIALOG.FOCUS",444:"ENABLE.OBJECT",445:"PUSHBUTTON.PROPERTIES",446:"SET.DIALOG.DEFAULT",447:"FILTER",448:"FILTER.SHOW.ALL",449:"CLEAR.OUTLINE",450:"FUNCTION.WIZARD",451:"ADD.LIST.ITEM",452:"SET.LIST.ITEM",453:"REMOVE.LIST.ITEM",454:"SELECT.LIST.ITEM",455:"SET.CONTROL.VALUE",456:"SAVE.COPY.AS",458:"OPTIONS.LISTS.ADD",459:"OPTIONS.LISTS.DELETE",460:"SERIES.AXES",461:"SERIES.X",462:"SERIES.Y",463:"ERRORBAR.X",464:"ERRORBAR.Y",465:"FORMAT.CHART",466:"SERIES.ORDER",467:"MAIL.LOGOFF",468:"CLEAR.ROUTING.SLIP",469:"APP.ACTIVATE.MICROSOFT",470:"MAIL.EDIT.MAILER",471:"ON.SHEET",472:"STANDARD.WIDTH",473:"SCENARIO.MERGE",474:"SUMMARY.INFO",475:"FIND.FILE",476:"ACTIVE.CELL.FONT",477:"ENABLE.TIPWIZARD",478:"VBA.MAKE.ADDIN",480:"INSERTDATATABLE",481:"WORKGROUP.OPTIONS",482:"MAIL.SEND.MAILER",485:"AUTOCORRECT",489:"POST.DOCUMENT",491:"PICKLIST",493:"VIEW.SHOW",494:"VIEW.DEFINE",495:"VIEW.DELETE",509:"SHEET.BACKGROUND",510:"INSERT.MAP.OBJECT",511:"OPTIONS.MENONO",517:"MSOCHECKS",518:"NORMAL",519:"LAYOUT",520:"RM.PRINT.AREA",521:"CLEAR.PRINT.AREA",522:"ADD.PRINT.AREA",523:"MOVE.BRK",545:"HIDECURR.NOTE",546:"HIDEALL.NOTES",547:"DELETE.NOTE",548:"TRAVERSE.NOTES",549:"ACTIVATE.NOTES",620:"PROTECT.REVISIONS",621:"UNPROTECT.REVISIONS",647:"OPTIONS.ME",653:"WEB.PUBLISH",667:"NEWWEBQUERY",673:"PIVOT.TABLE.CHART",753:"OPTIONS.SAVE",755:"OPTIONS.SPELL",808:"HIDEALL.INKANNOTS"},Ow={0:"COUNT",1:"IF",2:"ISNA",3:"ISERROR",4:"SUM",5:"AVERAGE",6:"MIN",7:"MAX",8:"ROW",9:"COLUMN",10:"NA",11:"NPV",12:"STDEV",13:"DOLLAR",14:"FIXED",15:"SIN",16:"COS",17:"TAN",18:"ATAN",19:"PI",20:"SQRT",21:"EXP",22:"LN",23:"LOG10",24:"ABS",25:"INT",26:"SIGN",27:"ROUND",28:"LOOKUP",29:"INDEX",30:"REPT",31:"MID",32:"LEN",33:"VALUE",34:"TRUE",35:"FALSE",36:"AND",37:"OR",38:"NOT",39:"MOD",40:"DCOUNT",41:"DSUM",42:"DAVERAGE",43:"DMIN",44:"DMAX",45:"DSTDEV",46:"VAR",47:"DVAR",48:"TEXT",49:"LINEST",50:"TREND",51:"LOGEST",52:"GROWTH",53:"GOTO",54:"HALT",55:"RETURN",56:"PV",57:"FV",58:"NPER",59:"PMT",60:"RATE",61:"MIRR",62:"IRR",63:"RAND",64:"MATCH",65:"DATE",66:"TIME",67:"DAY",68:"MONTH",69:"YEAR",70:"WEEKDAY",71:"HOUR",72:"MINUTE",73:"SECOND",74:"NOW",75:"AREAS",76:"ROWS",77:"COLUMNS",78:"OFFSET",79:"ABSREF",80:"RELREF",81:"ARGUMENT",82:"SEARCH",83:"TRANSPOSE",84:"ERROR",85:"STEP",86:"TYPE",87:"ECHO",88:"SET.NAME",89:"CALLER",90:"DEREF",91:"WINDOWS",92:"SERIES",93:"DOCUMENTS",94:"ACTIVE.CELL",95:"SELECTION",96:"RESULT",97:"ATAN2",98:"ASIN",99:"ACOS",100:"CHOOSE",101:"HLOOKUP",102:"VLOOKUP",103:"LINKS",104:"INPUT",105:"ISREF",106:"GET.FORMULA",107:"GET.NAME",108:"SET.VALUE",109:"LOG",110:"EXEC",111:"CHAR",112:"LOWER",113:"UPPER",114:"PROPER",115:"LEFT",116:"RIGHT",117:"EXACT",118:"TRIM",119:"REPLACE",120:"SUBSTITUTE",121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD",380:"CUBEVALUE",381:"CUBEMEMBER",382:"CUBEMEMBERPROPERTY",383:"CUBERANKEDMEMBER",384:"HEX2BIN",385:"HEX2DEC",386:"HEX2OCT",387:"DEC2BIN",388:"DEC2HEX",389:"DEC2OCT",390:"OCT2BIN",391:"OCT2HEX",392:"OCT2DEC",393:"BIN2DEC",394:"BIN2OCT",395:"BIN2HEX",396:"IMSUB",397:"IMDIV",398:"IMPOWER",399:"IMABS",400:"IMSQRT",401:"IMLN",402:"IMLOG2",403:"IMLOG10",404:"IMSIN",405:"IMCOS",406:"IMEXP",407:"IMARGUMENT",408:"IMCONJUGATE",409:"IMAGINARY",410:"IMREAL",411:"COMPLEX",412:"IMSUM",413:"IMPRODUCT",414:"SERIESSUM",415:"FACTDOUBLE",416:"SQRTPI",417:"QUOTIENT",418:"DELTA",419:"GESTEP",420:"ISEVEN",421:"ISODD",422:"MROUND",423:"ERF",424:"ERFC",425:"BESSELJ",426:"BESSELK",427:"BESSELY",428:"BESSELI",429:"XIRR",430:"XNPV",431:"PRICEMAT",432:"YIELDMAT",433:"INTRATE",434:"RECEIVED",435:"DISC",436:"PRICEDISC",437:"YIELDDISC",438:"TBILLEQ",439:"TBILLPRICE",440:"TBILLYIELD",441:"PRICE",442:"YIELD",443:"DOLLARDE",444:"DOLLARFR",445:"NOMINAL",446:"EFFECT",447:"CUMPRINC",448:"CUMIPMT",449:"EDATE",450:"EOMONTH",451:"YEARFRAC",452:"COUPDAYBS",453:"COUPDAYS",454:"COUPDAYSNC",455:"COUPNCD",456:"COUPNUM",457:"COUPPCD",458:"DURATION",459:"MDURATION",460:"ODDLPRICE",461:"ODDLYIELD",462:"ODDFPRICE",463:"ODDFYIELD",464:"RANDBETWEEN",465:"WEEKNUM",466:"AMORDEGRC",467:"AMORLINC",468:"CONVERT",724:"SHEETJS",469:"ACCRINT",470:"ACCRINTM",471:"WORKDAY",472:"NETWORKDAYS",473:"GCD",474:"MULTINOMIAL",475:"LCM",476:"FVSCHEDULE",477:"CUBEKPIMEMBER",478:"CUBESET",479:"CUBESETCOUNT",480:"IFERROR",481:"COUNTIFS",482:"SUMIFS",483:"AVERAGEIF",484:"AVERAGEIFS"},YO={2:1,3:1,10:0,15:1,16:1,17:1,18:1,19:0,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:2,30:2,31:3,32:1,33:1,34:0,35:0,38:1,39:2,40:3,41:3,42:3,43:3,44:3,45:3,47:3,48:2,53:1,61:3,63:0,65:3,66:3,67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:0,75:1,76:1,77:1,79:2,80:2,83:1,85:0,86:1,89:0,90:1,94:0,95:0,97:2,98:1,99:1,101:3,102:3,105:1,106:1,108:2,111:1,112:1,113:1,114:1,117:2,118:1,119:4,121:1,126:1,127:1,128:1,129:1,130:1,131:1,133:1,134:1,135:1,136:2,137:2,138:2,140:1,141:1,142:3,143:4,144:4,161:1,162:1,163:1,164:1,165:2,172:1,175:2,176:2,177:3,178:2,179:1,184:1,186:1,189:3,190:1,195:3,196:3,197:1,198:1,199:3,201:1,207:4,210:3,211:1,212:2,213:2,214:1,215:1,225:0,229:1,230:1,231:1,232:1,233:1,234:1,235:3,244:1,247:4,252:2,257:1,261:1,271:1,273:4,274:2,275:2,276:2,277:3,278:3,279:1,280:3,281:3,282:3,283:1,284:1,285:2,286:4,287:3,288:2,289:4,290:3,291:3,292:3,293:4,294:1,295:3,296:1,297:3,298:1,299:2,300:3,301:3,302:4,303:2,304:2,305:2,306:2,307:2,308:2,309:3,310:2,311:2,312:2,313:2,314:2,315:2,316:4,325:2,326:2,327:2,328:2,331:2,332:2,337:2,342:1,343:1,346:2,347:1,350:4,351:3,352:1,353:2,360:1,368:1,369:1,370:1,371:1,372:1,373:1,374:1,375:1,376:1,377:1,378:1,382:3,385:1,392:1,393:1,396:2,397:2,398:2,399:1,400:1,401:1,402:1,403:1,404:1,405:1,406:1,407:1,408:1,409:1,410:1,414:4,415:1,416:1,417:2,420:1,421:1,422:2,424:1,425:2,426:2,427:2,428:2,430:3,438:3,439:3,440:3,443:2,444:2,445:2,446:2,447:6,448:6,449:2,450:2,464:2,468:3,476:2,479:1,480:2,65535:0};function qO(e){var t="of:="+e.replace(Hd,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return t.replace(/;/g,"|").replace(/,/g,";")}function QO(e){return e.replace(/\./,"!")}var va=typeof Map<"u";function zd(e,t,r){var n=0,i=e.length;if(r){if(va?r.has(t):Object.prototype.hasOwnProperty.call(r,t)){for(var o=va?r.get(t):r[t];n-1?(r.width=Gf(n),r.customWidth=1):t.width!=null&&(r.width=t.width),t.hidden&&(r.hidden=!0),t.level!=null&&(r.outlineLevel=r.level=t.level),r}function Fw(e,t){if(e){var r=[.7,.7,.75,.75,.3,.3];t=="xlml"&&(r=[1,1,1,1,.5,.5]),e.left==null&&(e.left=r[0]),e.right==null&&(e.right=r[1]),e.top==null&&(e.top=r[2]),e.bottom==null&&(e.bottom=r[3]),e.header==null&&(e.header=r[4]),e.footer==null&&(e.footer=r[5])}}function Bn(e,t,r){var n=r.revssf[t.z!=null?t.z:"General"],i=60,o=e.length;if(n==null&&r.ssf){for(;i<392;++i)if(r.ssf[i]==null){Tx(t.z,i),r.ssf[i]=t.z,r.revssf[t.z]=n=i;break}}for(i=0;i!=o;++i)if(e[i].numFmtId===n)return i;return e[o]={numFmtId:n,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},o}function ZO(e,t,r){if(e&&e["!ref"]){var n=Ke(e["!ref"]);if(n.e.c',r=0;r!=e.length;++r)t+='';return t+""}function eF(e,t,r,n,i){var o=!1,a={},s=null;if(n.bookType!=="xlsx"&&t.vbaraw){var l=t.SheetNames[r];try{t.Workbook&&(l=t.Workbook.Sheets[r].CodeName||l)}catch{}o=!0,a.codeName=Gr(Be(l))}if(e&&e["!outline"]){var u={summaryBelow:1,summaryRight:1};e["!outline"].above&&(u.summaryBelow=0),e["!outline"].left&&(u.summaryRight=0),s=(s||"")+ue("outlinePr",null,u)}!o&&!s||(i[i.length]=ue("sheetPr",s,a))}var tF=["objects","scenarios","selectLockedCells","selectUnlockedCells"],rF=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function nF(e){var t={sheet:1};return tF.forEach(function(r){e[r]!=null&&e[r]&&(t[r]="1")}),rF.forEach(function(r){e[r]!=null&&!e[r]&&(t[r]="0")}),e.password&&(t.password=dw(e.password).toString(16).toUpperCase()),ue("sheetProtection",null,t)}function iF(e){return Fw(e),ue("pageMargins",null,e)}function oF(e,t){for(var r=[""],n,i=0;i!=t.length;++i)(n=t[i])&&(r[r.length]=ue("col",null,Tu(i,n)));return r[r.length]="",r.join("")}function aF(e,t,r,n){var i=typeof e.ref=="string"?e.ref:ot(e.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var o=r.Workbook.Names,a=Jt(i);a.s.r==a.e.r&&(a.e.r=Jt(t["!ref"]).e.r,i=ot(a));for(var s=0;s"u"&&(e.z=rt[14]);break;default:i=e.v;break}var s=yt("v",Be(i)),l={r:t},u=Bn(n.cellXfs,e,n);switch(u!==0&&(l.s=u),e.t){case"n":break;case"d":l.t="d";break;case"b":l.t="b";break;case"e":l.t="e";break;case"z":break;default:if(e.v==null){delete e.t;break}if(e.v.length>32767)throw new Error("Text length must not exceed 32767 characters");if(n&&n.bookSST){s=yt("v",""+zd(n.Strings,e.v,n.revStrings)),l.t="s";break}l.t="str";break}if(e.t!=o&&(e.t=o,e.v=a),typeof e.f=="string"&&e.f){var c=e.F&&e.F.slice(0,t.length)==t?{t:"array",ref:e.F}:null;s=ue("f",Be(e.f),c)+(e.v!=null?s:"")}return e.l&&r["!links"].push([t,e.l]),e.D&&(l.cm=1),ue("c",s,l)}function uF(e,t,r,n){var i=[],o=[],a=Ke(e["!ref"]),s="",l,u="",c=[],f=0,d=0,h=e["!rows"],m=Array.isArray(e),p={r:u},g,x=-1;for(d=a.s.c;d<=a.e.c;++d)c[d]=Ft(d);for(f=a.s.r;f<=a.e.r;++f){for(o=[],u=_t(f),d=a.s.c;d<=a.e.c;++d){l=c[d]+u;var w=m?(e[f]||[])[d]:e[l];w!==void 0&&(s=lF(w,l,e,t))!=null&&o.push(s)}(o.length>0||h&&h[f])&&(p={r:u},h&&h[f]&&(g=h[f],g.hidden&&(p.hidden=1),x=-1,g.hpx?x=Vl(g.hpx):g.hpt&&(x=g.hpt),x>-1&&(p.ht=x,p.customHeight=1),g.level&&(p.outlineLevel=g.level)),i[i.length]=ue("row",o.join(""),p))}if(h)for(;f-1&&(p.ht=x,p.customHeight=1),g.level&&(p.outlineLevel=g.level),i[i.length]=ue("row","",p));return i.join("")}function Dw(e,t,r,n){var i=[at,ue("worksheet",null,{xmlns:_o[0],"xmlns:r":ft.r})],o=r.SheetNames[e],a=0,s="",l=r.Sheets[o];l==null&&(l={});var u=l["!ref"]||"A1",c=Ke(u);if(c.e.c>16383||c.e.r>1048575){if(t.WTF)throw new Error("Range "+u+" exceeds format limit A1:XFD1048576");c.e.c=Math.min(c.e.c,16383),c.e.r=Math.min(c.e.c,1048575),u=ot(c)}n||(n={}),l["!comments"]=[];var f=[];eF(l,r,e,t,i),i[i.length]=ue("dimension",null,{ref:u}),i[i.length]=sF(l,t,e,r),t.sheetFormat&&(i[i.length]=ue("sheetFormatPr",null,{defaultRowHeight:t.sheetFormat.defaultRowHeight||"16",baseColWidth:t.sheetFormat.baseColWidth||"10",outlineLevelRow:t.sheetFormat.outlineLevelRow||"7"})),l["!cols"]!=null&&l["!cols"].length>0&&(i[i.length]=oF(l,l["!cols"])),i[a=i.length]="",l["!links"]=[],l["!ref"]!=null&&(s=uF(l,t),s.length>0&&(i[i.length]=s)),i.length>a+1&&(i[i.length]="",i[a]=i[a].replace("/>",">")),l["!protect"]&&(i[i.length]=nF(l["!protect"])),l["!autofilter"]!=null&&(i[i.length]=aF(l["!autofilter"],l,r,e)),l["!merges"]!=null&&l["!merges"].length>0&&(i[i.length]=JO(l["!merges"]));var d=-1,h,m=-1;return l["!links"].length>0&&(i[i.length]="",l["!links"].forEach(function(p){p[1].Target&&(h={ref:p[0]},p[1].Target.charAt(0)!="#"&&(m=Le(n,-1,Be(p[1].Target).replace(/#.*$/,""),$e.HLINK),h["r:id"]="rId"+m),(d=p[1].Target.indexOf("#"))>-1&&(h.location=Be(p[1].Target.slice(d+1))),p[1].Tooltip&&(h.tooltip=Be(p[1].Tooltip)),i[i.length]=ue("hyperlink",null,h))}),i[i.length]=""),delete l["!links"],l["!margins"]!=null&&(i[i.length]=iF(l["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&(i[i.length]=yt("ignoredErrors",ue("ignoredError",null,{numberStoredAsText:1,sqref:u}))),f.length>0&&(m=Le(n,-1,"../drawings/drawing"+(e+1)+".xml",$e.DRAW),i[i.length]=ue("drawing",null,{"r:id":"rId"+m}),l["!drawing"]=f),l["!comments"].length>0&&(m=Le(n,-1,"../drawings/vmlDrawing"+(e+1)+".vml",$e.VML),i[i.length]=ue("legacyDrawing",null,{"r:id":"rId"+m}),l["!legacy"]=m),i.length>1&&(i[i.length]="",i[1]=i[1].replace("/>",">")),i.join("")}function cF(e,t){var r={},n=e.l+t;r.r=e.read_shift(4),e.l+=4;var i=e.read_shift(2);e.l+=1;var o=e.read_shift(1);return e.l=n,o&7&&(r.level=o&7),o&16&&(r.hidden=!0),o&32&&(r.hpt=i/20),r}function fF(e,t,r){var n=Z(145),i=(r["!rows"]||[])[e]||{};n.write_shift(4,e),n.write_shift(4,0);var o=320;i.hpx?o=Vl(i.hpx)*20:i.hpt&&(o=i.hpt*20),n.write_shift(2,o),n.write_shift(1,0);var a=0;i.level&&(a|=i.level),i.hidden&&(a|=16),(i.hpx||i.hpt)&&(a|=32),n.write_shift(1,a),n.write_shift(1,0);var s=0,l=n.l;n.l+=4;for(var u={r:e,c:0},c=0;c<16;++c)if(!(t.s.c>c+1<<10||t.e.cn.l?n.slice(0,n.l):n}function dF(e,t,r,n){var i=fF(n,r,t);(i.length>17||(t["!rows"]||[])[n])&&re(e,0,i)}var hF=yi,pF=To;function gF(){}function mF(e,t){var r={},n=e[e.l];return++e.l,r.above=!(n&64),r.left=!(n&128),e.l+=18,r.name=A3(e),r}function vF(e,t,r){r==null&&(r=Z(84+4*e.length));var n=192;t&&(t.above&&(n&=-65),t.left&&(n&=-129)),r.write_shift(1,n);for(var i=1;i<3;++i)r.write_shift(1,0);return Ll({auto:1},r),r.write_shift(-4,-1),r.write_shift(-4,-1),Gx(e,r),r.slice(0,r.l)}function xF(e){var t=pr(e);return[t]}function wF(e,t,r){return r==null&&(r=Z(8)),vi(t,r)}function yF(e){var t=xi(e);return[t]}function EF(e,t,r){return r==null&&(r=Z(4)),wi(t,r)}function _F(e){var t=pr(e),r=e.read_shift(1);return[t,r,"b"]}function SF(e,t,r){return r==null&&(r=Z(9)),vi(t,r),r.write_shift(1,e.v?1:0),r}function TF(e){var t=xi(e),r=e.read_shift(1);return[t,r,"b"]}function CF(e,t,r){return r==null&&(r=Z(5)),wi(t,r),r.write_shift(1,e.v?1:0),r}function AF(e){var t=pr(e),r=e.read_shift(1);return[t,r,"e"]}function RF(e,t,r){return r==null&&(r=Z(9)),vi(t,r),r.write_shift(1,e.v),r}function OF(e){var t=xi(e),r=e.read_shift(1);return[t,r,"e"]}function FF(e,t,r){return r==null&&(r=Z(8)),wi(t,r),r.write_shift(1,e.v),r.write_shift(2,0),r.write_shift(1,0),r}function DF(e){var t=pr(e),r=e.read_shift(4);return[t,r,"s"]}function PF(e,t,r){return r==null&&(r=Z(12)),vi(t,r),r.write_shift(4,t.v),r}function IF(e){var t=xi(e),r=e.read_shift(4);return[t,r,"s"]}function bF(e,t,r){return r==null&&(r=Z(8)),wi(t,r),r.write_shift(4,t.v),r}function kF(e){var t=pr(e),r=Co(e);return[t,r,"n"]}function $F(e,t,r){return r==null&&(r=Z(16)),vi(t,r),oi(e.v,r),r}function NF(e){var t=xi(e),r=Co(e);return[t,r,"n"]}function MF(e,t,r){return r==null&&(r=Z(12)),wi(t,r),oi(e.v,r),r}function LF(e){var t=pr(e),r=jx(e);return[t,r,"n"]}function BF(e,t,r){return r==null&&(r=Z(12)),vi(t,r),Xx(e.v,r),r}function UF(e){var t=xi(e),r=jx(e);return[t,r,"n"]}function HF(e,t,r){return r==null&&(r=Z(8)),wi(t,r),Xx(e.v,r),r}function VF(e){var t=pr(e),r=Nd(e);return[t,r,"is"]}function WF(e){var t=pr(e),r=Dt(e);return[t,r,"str"]}function zF(e,t,r){return r==null&&(r=Z(12+4*e.v.length)),vi(t,r),ht(e.v,r),r.length>r.l?r.slice(0,r.l):r}function GF(e){var t=xi(e),r=Dt(e);return[t,r,"str"]}function jF(e,t,r){return r==null&&(r=Z(8+4*e.v.length)),wi(t,r),ht(e.v,r),r.length>r.l?r.slice(0,r.l):r}function XF(e,t,r){var n=e.l+t,i=pr(e);i.r=r["!row"];var o=e.read_shift(1),a=[i,o,"b"];if(r.cellFormula){e.l+=2;var s=Su(e,n-e.l,r);a[3]=fo(s,null,i,r.supbooks,r)}else e.l=n;return a}function KF(e,t,r){var n=e.l+t,i=pr(e);i.r=r["!row"];var o=e.read_shift(1),a=[i,o,"e"];if(r.cellFormula){e.l+=2;var s=Su(e,n-e.l,r);a[3]=fo(s,null,i,r.supbooks,r)}else e.l=n;return a}function YF(e,t,r){var n=e.l+t,i=pr(e);i.r=r["!row"];var o=Co(e),a=[i,o,"n"];if(r.cellFormula){e.l+=2;var s=Su(e,n-e.l,r);a[3]=fo(s,null,i,r.supbooks,r)}else e.l=n;return a}function qF(e,t,r){var n=e.l+t,i=pr(e);i.r=r["!row"];var o=Dt(e),a=[i,o,"str"];if(r.cellFormula){e.l+=2;var s=Su(e,n-e.l,r);a[3]=fo(s,null,i,r.supbooks,r)}else e.l=n;return a}var QF=yi,ZF=To;function JF(e,t){return t==null&&(t=Z(4)),t.write_shift(4,e),t}function e6(e,t){var r=e.l+t,n=yi(e),i=Md(e),o=Dt(e),a=Dt(e),s=Dt(e);e.l=r;var l={rfx:n,relId:i,loc:o,display:s};return a&&(l.Tooltip=a),l}function t6(e,t){var r=Z(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));To({s:dt(e[0]),e:dt(e[0])},r),Ld("rId"+t,r);var n=e[1].Target.indexOf("#"),i=n==-1?"":e[1].Target.slice(n+1);return ht(i||"",r),ht(e[1].Tooltip||"",r),ht("",r),r.slice(0,r.l)}function r6(){}function n6(e,t,r){var n=e.l+t,i=Kx(e),o=e.read_shift(1),a=[i];if(a[2]=o,r.cellFormula){var s=GO(e,n-e.l,r);a[1]=s}else e.l=n;return a}function i6(e,t,r){var n=e.l+t,i=yi(e),o=[i];if(r.cellFormula){var a=XO(e,n-e.l,r);o[1]=a,e.l=n}else e.l=n;return o}function o6(e,t,r){r==null&&(r=Z(18));var n=Tu(e,t);r.write_shift(-4,e),r.write_shift(-4,e),r.write_shift(4,(n.width||10)*256),r.write_shift(4,0);var i=0;return t.hidden&&(i|=1),typeof n.width=="number"&&(i|=2),t.level&&(i|=t.level<<8),r.write_shift(2,i),r}var Pw=["left","right","top","bottom","header","footer"];function a6(e){var t={};return Pw.forEach(function(r){t[r]=Co(e)}),t}function s6(e,t){return t==null&&(t=Z(6*8)),Fw(e),Pw.forEach(function(r){oi(e[r],t)}),t}function l6(e){var t=e.read_shift(2);return e.l+=28,{RTL:t&32}}function u6(e,t,r){r==null&&(r=Z(30));var n=924;return(((t||{}).Views||[])[0]||{}).RTL&&(n|=32),r.write_shift(2,n),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(2,0),r.write_shift(2,100),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(4,0),r}function c6(e){var t=Z(24);return t.write_shift(4,4),t.write_shift(4,1),To(e,t),t}function f6(e,t){return t==null&&(t=Z(16*4+2)),t.write_shift(2,e.password?dw(e.password):0),t.write_shift(4,1),[["objects",!1],["scenarios",!1],["formatCells",!0],["formatColumns",!0],["formatRows",!0],["insertColumns",!0],["insertRows",!0],["insertHyperlinks",!0],["deleteColumns",!0],["deleteRows",!0],["selectLockedCells",!1],["sort",!0],["autoFilter",!0],["pivotTables",!0],["selectUnlockedCells",!1]].forEach(function(r){r[1]?t.write_shift(4,e[r[0]]!=null&&!e[r[0]]?1:0):t.write_shift(4,e[r[0]]!=null&&e[r[0]]?0:1)}),t}function d6(){}function h6(){}function p6(e,t,r,n,i,o,a){if(t.v===void 0)return!1;var s="";switch(t.t){case"b":s=t.v?"1":"0";break;case"d":t=Xt(t),t.z=t.z||rt[14],t.v=jt(Lt(t.v)),t.t="n";break;case"n":case"e":s=""+t.v;break;default:s=t.v;break}var l={r,c:n};switch(l.s=Bn(i.cellXfs,t,i),t.l&&o["!links"].push([Ue(l),t.l]),t.c&&o["!comments"].push([Ue(l),t.c]),t.t){case"s":case"str":return i.bookSST?(s=zd(i.Strings,t.v,i.revStrings),l.t="s",l.v=s,a?re(e,18,bF(t,l)):re(e,7,PF(t,l))):(l.t="str",a?re(e,17,jF(t,l)):re(e,6,zF(t,l))),!0;case"n":return t.v==(t.v|0)&&t.v>-1e3&&t.v<1e3?a?re(e,13,HF(t,l)):re(e,2,BF(t,l)):a?re(e,16,MF(t,l)):re(e,5,$F(t,l)),!0;case"b":return l.t="b",a?re(e,15,CF(t,l)):re(e,4,SF(t,l)),!0;case"e":return l.t="e",a?re(e,14,FF(t,l)):re(e,3,RF(t,l)),!0}return a?re(e,12,EF(t,l)):re(e,1,wF(t,l)),!0}function g6(e,t,r,n){var i=Ke(t["!ref"]||"A1"),o,a="",s=[];re(e,145);var l=Array.isArray(t),u=i.e.r;t["!rows"]&&(u=Math.max(i.e.r,t["!rows"].length-1));for(var c=i.s.r;c<=u;++c){a=_t(c),dF(e,t,i,c);var f=!1;if(c<=i.e.r)for(var d=i.s.c;d<=i.e.c;++d){c===i.s.r&&(s[d]=Ft(d)),o=s[d]+a;var h=l?(t[c]||[])[d]:t[o];if(!h){f=!1;continue}f=p6(e,h,c,d,n,t,f)}}re(e,146)}function m6(e,t){!t||!t["!merges"]||(re(e,177,JF(t["!merges"].length)),t["!merges"].forEach(function(r){re(e,176,ZF(r))}),re(e,178))}function v6(e,t){!t||!t["!cols"]||(re(e,390),t["!cols"].forEach(function(r,n){r&&re(e,60,o6(n,r))}),re(e,391))}function x6(e,t){!t||!t["!ref"]||(re(e,648),re(e,649,c6(Ke(t["!ref"]))),re(e,650))}function w6(e,t,r){t["!links"].forEach(function(n){if(n[1].Target){var i=Le(r,-1,n[1].Target.replace(/#.*$/,""),$e.HLINK);re(e,494,t6(n,i))}}),delete t["!links"]}function y6(e,t,r,n){if(t["!comments"].length>0){var i=Le(n,-1,"../drawings/vmlDrawing"+(r+1)+".vml",$e.VML);re(e,551,Ld("rId"+i)),t["!legacy"]=i}}function E6(e,t,r,n){if(t["!autofilter"]){var i=t["!autofilter"],o=typeof i.ref=="string"?i.ref:ot(i.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var a=r.Workbook.Names,s=Jt(o);s.s.r==s.e.r&&(s.e.r=Jt(t["!ref"]).e.r,o=ot(s));for(var l=0;l16383||l.e.r>1048575){if(t.WTF)throw new Error("Range "+(a["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");l.e.c=Math.min(l.e.c,16383),l.e.r=Math.min(l.e.c,1048575)}return a["!links"]=[],a["!comments"]=[],re(i,129),(r.vbaraw||a["!outline"])&&re(i,147,vF(s,a["!outline"])),re(i,148,pF(l)),_6(i,a,r.Workbook),v6(i,a),g6(i,a,e,t),S6(i,a),E6(i,a,r,e),m6(i,a),w6(i,a,n),a["!margins"]&&re(i,476,s6(a["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&x6(i,a),y6(i,a,e,n),re(i,130),i.end()}function C6(e,t){e.l+=10;var r=Dt(e);return{name:r}}var A6=[["allowRefreshQuery",!1,"bool"],["autoCompressPictures",!0,"bool"],["backupFile",!1,"bool"],["checkCompatibility",!1,"bool"],["CodeName",""],["date1904",!1,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",!1,"bool"],["hidePivotFieldList",!1,"bool"],["promptedSolutions",!1,"bool"],["publishItems",!1,"bool"],["refreshAllConnections",!1,"bool"],["saveExternalLinkValues",!0,"bool"],["showBorderUnselectedTables",!0,"bool"],["showInkAnnotation",!0,"bool"],["showObjects","all"],["showPivotChartFilter",!1,"bool"],["updateLinks","userSet"]];function R6(e){return!e.Workbook||!e.Workbook.WBProps?"false":i3(e.Workbook.WBProps.date1904)?"true":"false"}var O6="][*?/\\".split("");function Iw(e,t){if(e.length>31){if(t)return!1;throw new Error("Sheet names cannot exceed 31 chars")}var r=!0;return O6.forEach(function(n){if(e.indexOf(n)!=-1){if(!t)throw new Error("Sheet name cannot contain : \\ / ? * [ ]");r=!1}}),r}function F6(e,t,r){e.forEach(function(n,i){Iw(n);for(var o=0;o22)throw new Error("Bad Code Name: Worksheet"+a)}})}function D6(e){if(!e||!e.SheetNames||!e.Sheets)throw new Error("Invalid Workbook");if(!e.SheetNames.length)throw new Error("Workbook is empty");var t=e.Workbook&&e.Workbook.Sheets||[];F6(e.SheetNames,t,!!e.vbaraw);for(var r=0;r0,n={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(A6.forEach(function(s){e.Workbook.WBProps[s[0]]!=null&&e.Workbook.WBProps[s[0]]!=s[1]&&(n[s[0]]=e.Workbook.WBProps[s[0]])}),e.Workbook.WBProps.CodeName&&(n.codeName=e.Workbook.WBProps.CodeName,delete n.CodeName)),t[t.length]=ue("workbookPr",null,n);var i=e.Workbook&&e.Workbook.Sheets||[],o=0;if(i&&i[0]&&i[0].Hidden){for(t[t.length]="",o=0;o!=e.SheetNames.length&&!(!i[o]||!i[o].Hidden);++o);o==e.SheetNames.length&&(o=0),t[t.length]='',t[t.length]=""}for(t[t.length]="",o=0;o!=e.SheetNames.length;++o){var a={name:Be(e.SheetNames[o].slice(0,31))};if(a.sheetId=""+(o+1),a["r:id"]="rId"+(o+1),i[o])switch(i[o].Hidden){case 1:a.state="hidden";break;case 2:a.state="veryHidden";break}t[t.length]=ue("sheet",null,a)}return t[t.length]="",r&&(t[t.length]="",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(s){var l={name:s.Name};s.Comment&&(l.comment=s.Comment),s.Sheet!=null&&(l.localSheetId=""+s.Sheet),s.Hidden&&(l.hidden="1"),s.Ref&&(t[t.length]=ue("definedName",Be(s.Ref),l))}),t[t.length]=""),t.length>2&&(t[t.length]="",t[1]=t[1].replace("/>",">")),t.join("")}function P6(e,t){var r={};return r.Hidden=e.read_shift(4),r.iTabID=e.read_shift(4),r.strRelID=zf(e),r.name=Dt(e),r}function I6(e,t){return t||(t=Z(127)),t.write_shift(4,e.Hidden),t.write_shift(4,e.iTabID),Ld(e.strRelID,t),ht(e.name.slice(0,31),t),t.length>t.l?t.slice(0,t.l):t}function b6(e,t){var r={},n=e.read_shift(4);r.defaultThemeVersion=e.read_shift(4);var i=t>8?Dt(e):"";return i.length>0&&(r.CodeName=i),r.autoCompressPictures=!!(n&65536),r.backupFile=!!(n&64),r.checkCompatibility=!!(n&4096),r.date1904=!!(n&1),r.filterPrivacy=!!(n&8),r.hidePivotFieldList=!!(n&1024),r.promptedSolutions=!!(n&16),r.publishItems=!!(n&2048),r.refreshAllConnections=!!(n&262144),r.saveExternalLinkValues=!!(n&128),r.showBorderUnselectedTables=!!(n&4),r.showInkAnnotation=!!(n&32),r.showObjects=["all","placeholders","none"][n>>13&3],r.showPivotChartFilter=!!(n&32768),r.updateLinks=["userSet","never","always"][n>>8&3],r}function k6(e,t){t||(t=Z(72));var r=0;return e&&e.filterPrivacy&&(r|=8),t.write_shift(4,r),t.write_shift(4,0),Gx(e&&e.CodeName||"ThisWorkbook",t),t.slice(0,t.l)}function $6(e,t,r){var n=e.l+t;e.l+=4,e.l+=1;var i=e.read_shift(4),o=R3(e),a=jO(e,0,r),s=Md(e);e.l=n;var l={Name:o,Ptg:a};return i<268435455&&(l.Sheet=i),s&&(l.Comment=s),l}function N6(e,t){re(e,143);for(var r=0;r!=t.SheetNames.length;++r){var n=t.Workbook&&t.Workbook.Sheets&&t.Workbook.Sheets[r]&&t.Workbook.Sheets[r].Hidden||0,i={Hidden:n,iTabID:r+1,strRelID:"rId"+(r+1),name:t.SheetNames[r]};re(e,156,I6(i))}re(e,144)}function M6(e,t){t||(t=Z(127));for(var r=0;r!=4;++r)t.write_shift(4,0);return ht("SheetJS",t),ht(Pl.version,t),ht(Pl.version,t),ht("7262",t),t.length>t.l?t.slice(0,t.l):t}function L6(e,t){t||(t=Z(29)),t.write_shift(-4,0),t.write_shift(-4,460),t.write_shift(4,28800),t.write_shift(4,17600),t.write_shift(4,500),t.write_shift(4,e),t.write_shift(4,e);var r=120;return t.write_shift(1,r),t.length>t.l?t.slice(0,t.l):t}function B6(e,t){if(!(!t.Workbook||!t.Workbook.Sheets)){for(var r=t.Workbook.Sheets,n=0,i=-1,o=-1;ni||(re(e,135),re(e,158,L6(i)),re(e,136))}}function U6(e,t){var r=Gt();return re(r,131),re(r,128,M6()),re(r,153,k6(e.Workbook&&e.Workbook.WBProps||null)),B6(r,e),N6(r,e),re(r,132),r.end()}function H6(e,t,r){return(t.slice(-4)===".bin"?U6:bw)(e)}function V6(e,t,r,n,i){return(t.slice(-4)===".bin"?T6:Dw)(e,r,n,i)}function W6(e,t,r){return(t.slice(-4)===".bin"?sR:gw)(e,r)}function z6(e,t,r){return(t.slice(-4)===".bin"?kA:fw)(e,r)}function G6(e,t,r){return(t.slice(-4)===".bin"?SR:yw)(e)}function j6(e){return(e.slice(-4)===".bin"?gR:xw)()}function X6(e,t){var r=[];return e.Props&&r.push(W3(e.Props,t)),e.Custprops&&r.push(z3(e.Props,e.Custprops)),r.join("")}function K6(){return""}function Y6(e,t){var r=[''];return t.cellXfs.forEach(function(n,i){var o=[];o.push(ue("NumberFormat",null,{"ss:Format":Be(rt[n.numFmtId])}));var a={"ss:ID":"s"+(21+i)};r.push(ue("Style",o.join(""),a))}),ue("Styles",r.join(""))}function kw(e){return ue("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+Vd(e.Ref,{r:0,c:0})})}function q6(e){if(!((e||{}).Workbook||{}).Names)return"";for(var t=e.Workbook.Names,r=[],n=0;n"),e["!margins"].header&&i.push(ue("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&i.push(ue("Footer",null,{"x:Margin":e["!margins"].footer})),i.push(ue("PageMargins",null,{"x:Bottom":e["!margins"].bottom||"0.75","x:Left":e["!margins"].left||"0.7","x:Right":e["!margins"].right||"0.7","x:Top":e["!margins"].top||"0.75"})),i.push("")),n&&n.Workbook&&n.Workbook.Sheets&&n.Workbook.Sheets[r])if(n.Workbook.Sheets[r].Hidden)i.push(ue("Visible",n.Workbook.Sheets[r].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var o=0;o")}return((((n||{}).Workbook||{}).Views||[])[0]||{}).RTL&&i.push(""),e["!protect"]&&(i.push(yt("ProtectContents","True")),e["!protect"].objects&&i.push(yt("ProtectObjects","True")),e["!protect"].scenarios&&i.push(yt("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?i.push(yt("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&i.push(yt("EnableSelection","UnlockedCells")),[["formatCells","AllowFormatCells"],["formatColumns","AllowSizeCols"],["formatRows","AllowSizeRows"],["insertColumns","AllowInsertCols"],["insertRows","AllowInsertRows"],["insertHyperlinks","AllowInsertHyperlinks"],["deleteColumns","AllowDeleteCols"],["deleteRows","AllowDeleteRows"],["sort","AllowSort"],["autoFilter","AllowFilter"],["pivotTables","AllowUsePivotTables"]].forEach(function(a){e["!protect"][a[0]]&&i.push("<"+a[1]+"/>")})),i.length==0?"":ue("WorksheetOptions",i.join(""),{xmlns:qt.x})}function J6(e){return e.map(function(t){var r=n3(t.t||""),n=ue("ss:Data",r,{xmlns:"http://www.w3.org/TR/REC-html40"});return ue("Comment",n,{"ss:Author":t.a})}).join("")}function eD(e,t,r,n,i,o,a){if(!e||e.v==null&&e.f==null)return"";var s={};if(e.f&&(s["ss:Formula"]="="+Be(Vd(e.f,a))),e.F&&e.F.slice(0,t.length)==t){var l=dt(e.F.slice(t.length+1));s["ss:ArrayRange"]="RC:R"+(l.r==a.r?"":"["+(l.r-a.r)+"]")+"C"+(l.c==a.c?"":"["+(l.c-a.c)+"]")}if(e.l&&e.l.Target&&(s["ss:HRef"]=Be(e.l.Target),e.l.Tooltip&&(s["x:HRefScreenTip"]=Be(e.l.Tooltip))),r["!merges"])for(var u=r["!merges"],c=0;c!=u.length;++c)u[c].s.c!=a.c||u[c].s.r!=a.r||(u[c].e.c>u[c].s.c&&(s["ss:MergeAcross"]=u[c].e.c-u[c].s.c),u[c].e.r>u[c].s.r&&(s["ss:MergeDown"]=u[c].e.r-u[c].s.r));var f="",d="";switch(e.t){case"z":if(!n.sheetStubs)return"";break;case"n":f="Number",d=String(e.v);break;case"b":f="Boolean",d=e.v?"1":"0";break;case"e":f="Error",d=es[e.v];break;case"d":f="DateTime",d=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||rt[14]);break;case"s":f="String",d=r3(e.v||"");break}var h=Bn(n.cellXfs,e,n);s["ss:StyleID"]="s"+(21+h),s["ss:Index"]=a.c+1;var m=e.v!=null?d:"",p=e.t=="z"?"":''+m+"";return(e.c||[]).length>0&&(p+=J6(e.c)),ue("Cell",p,s)}function tD(e,t){var r='"}function rD(e,t,r,n){if(!e["!ref"])return"";var i=Ke(e["!ref"]),o=e["!merges"]||[],a=0,s=[];e["!cols"]&&e["!cols"].forEach(function(g,x){Ud(g);var w=!!g.width,y=Tu(x,g),_={"ss:Index":x+1};w&&(_["ss:Width"]=Ul(y.width)),g.hidden&&(_["ss:Hidden"]="1"),s.push(ue("Column",null,_))});for(var l=Array.isArray(e),u=i.s.r;u<=i.e.r;++u){for(var c=[tD(u,(e["!rows"]||[])[u])],f=i.s.c;f<=i.e.c;++f){var d=!1;for(a=0;a!=o.length;++a)if(!(o[a].s.c>f)&&!(o[a].s.r>u)&&!(o[a].e.c"),c.length>2&&s.push(c.join(""))}return s.join("")}function nD(e,t,r){var n=[],i=r.SheetNames[e],o=r.Sheets[i],a=o?Q6(o,t,e,r):"";return a.length>0&&n.push(""+a+""),a=o?rD(o,t,e,r):"",a.length>0&&n.push(""+a+"
"),n.push(Z6(o,t,e,r)),n.join("")}function iD(e,t){t||(t={}),e.SSF||(e.SSF=Xt(rt)),e.SSF&&(wu(),xu(e.SSF),t.revssf=yu(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],Bn(t.cellXfs,{},{revssf:{General:0}}));var r=[];r.push(X6(e,t)),r.push(K6()),r.push(""),r.push("");for(var n=0;n-1||tw.indexOf(i[o][0])>-1||i[o][1]!=null&&u.push(i[o]);n.length&&He.utils.cfb_add(t,"/SummaryInformation",Wg(n,Oc.SI,l,Lg)),(r.length||u.length)&&He.utils.cfb_add(t,"/DocumentSummaryInformation",Wg(r,Oc.DSI,s,Mg,u.length?u:null,Oc.UDI))}function aD(e,t){var r=t||{},n=He.utils.cfb_new({root:"R"}),i="/Workbook";switch(r.bookType||"xls"){case"xls":r.bookType="biff8";case"xla":r.bookType||(r.bookType="xla");case"biff8":i="/Workbook",r.biff=8;break;case"biff5":i="/Book",r.biff=5;break;default:throw new Error("invalid type "+r.bookType+" for XLS CFB")}return He.utils.cfb_add(n,i,$w(e,r)),r.biff==8&&(e.Props||e.Custprops)&&oD(e,n),r.biff==8&&e.vbaraw&&TR(n,He.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),n}var sD={0:{f:cF},1:{f:xF},2:{f:LF},3:{f:AF},4:{f:_F},5:{f:kF},6:{f:WF},7:{f:DF},8:{f:qF},9:{f:YF},10:{f:XF},11:{f:KF},12:{f:yF},13:{f:UF},14:{f:OF},15:{f:TF},16:{f:NF},17:{f:GF},18:{f:IF},19:{f:Nd},20:{},21:{},22:{},23:{},24:{},25:{},26:{},27:{},28:{},29:{},30:{},31:{},32:{},33:{},34:{},35:{T:1},36:{T:-1},37:{T:1},38:{T:-1},39:{f:$6},40:{},42:{},43:{f:WA},44:{f:HA},45:{f:jA},46:{f:KA},47:{f:XA},48:{},49:{f:y3},50:{},51:{f:cR},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:EA},62:{f:VF},63:{f:mR},64:{f:d6},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:$r,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:l6},138:{T:-1},139:{T:1},140:{T:-1},141:{T:1},142:{T:-1},143:{T:1},144:{T:-1},145:{T:1},146:{T:-1},147:{f:mF},148:{f:hF,p:16},151:{f:r6},152:{},153:{f:b6},154:{},155:{},156:{f:P6},157:{},158:{},159:{T:1,f:PA},160:{T:-1},161:{T:1,f:yi},162:{T:-1},163:{T:1},164:{T:-1},165:{T:1},166:{T:-1},167:{},168:{},169:{},170:{},171:{},172:{T:1},173:{T:-1},174:{},175:{},176:{f:QF},177:{T:1},178:{T:-1},179:{T:1},180:{T:-1},181:{T:1},182:{T:-1},183:{T:1},184:{T:-1},185:{T:1},186:{T:-1},187:{T:1},188:{T:-1},189:{T:1},190:{T:-1},191:{T:1},192:{T:-1},193:{T:1},194:{T:-1},195:{T:1},196:{T:-1},197:{T:1},198:{T:-1},199:{T:1},200:{T:-1},201:{T:1},202:{T:-1},203:{T:1},204:{T:-1},205:{T:1},206:{T:-1},207:{T:1},208:{T:-1},209:{T:1},210:{T:-1},211:{T:1},212:{T:-1},213:{T:1},214:{T:-1},215:{T:1},216:{T:-1},217:{T:1},218:{T:-1},219:{T:1},220:{T:-1},221:{T:1},222:{T:-1},223:{T:1},224:{T:-1},225:{T:1},226:{T:-1},227:{T:1},228:{T:-1},229:{T:1},230:{T:-1},231:{T:1},232:{T:-1},233:{T:1},234:{T:-1},235:{T:1},236:{T:-1},237:{T:1},238:{T:-1},239:{T:1},240:{T:-1},241:{T:1},242:{T:-1},243:{T:1},244:{T:-1},245:{T:1},246:{T:-1},247:{T:1},248:{T:-1},249:{T:1},250:{T:-1},251:{T:1},252:{T:-1},253:{T:1},254:{T:-1},255:{T:1},256:{T:-1},257:{T:1},258:{T:-1},259:{T:1},260:{T:-1},261:{T:1},262:{T:-1},263:{T:1},264:{T:-1},265:{T:1},266:{T:-1},267:{T:1},268:{T:-1},269:{T:1},270:{T:-1},271:{T:1},272:{T:-1},273:{T:1},274:{T:-1},275:{T:1},276:{T:-1},277:{},278:{T:1},279:{T:-1},280:{T:1},281:{T:-1},282:{T:1},283:{T:1},284:{T:-1},285:{T:1},286:{T:-1},287:{T:1},288:{T:-1},289:{T:1},290:{T:-1},291:{T:1},292:{T:-1},293:{T:1},294:{T:-1},295:{T:1},296:{T:-1},297:{T:1},298:{T:-1},299:{T:1},300:{T:-1},301:{T:1},302:{T:-1},303:{T:1},304:{T:-1},305:{T:1},306:{T:-1},307:{T:1},308:{T:-1},309:{T:1},310:{T:-1},311:{T:1},312:{T:-1},313:{T:-1},314:{T:1},315:{T:-1},316:{T:1},317:{T:-1},318:{T:1},319:{T:-1},320:{T:1},321:{T:-1},322:{T:1},323:{T:-1},324:{T:1},325:{T:-1},326:{T:1},327:{T:-1},328:{T:1},329:{T:-1},330:{T:1},331:{T:-1},332:{T:1},333:{T:-1},334:{T:1},335:{f:lR},336:{T:-1},337:{f:hR,T:1},338:{T:-1},339:{T:1},340:{T:-1},341:{T:1},342:{T:-1},343:{T:1},344:{T:-1},345:{T:1},346:{T:-1},347:{T:1},348:{T:-1},349:{T:1},350:{T:-1},351:{},352:{},353:{T:1},354:{T:-1},355:{f:zf},357:{},358:{},359:{},360:{T:1},361:{},362:{f:gA},363:{},364:{},366:{},367:{},368:{},369:{},370:{},371:{},372:{T:1},373:{T:-1},374:{T:1},375:{T:-1},376:{T:1},377:{T:-1},378:{T:1},379:{T:-1},380:{T:1},381:{T:-1},382:{T:1},383:{T:-1},384:{T:1},385:{T:-1},386:{T:1},387:{T:-1},388:{T:1},389:{T:-1},390:{T:1},391:{T:-1},392:{T:1},393:{T:-1},394:{T:1},395:{T:-1},396:{},397:{},398:{},399:{},400:{},401:{T:1},403:{},404:{},405:{},406:{},407:{},408:{},409:{},410:{},411:{},412:{},413:{},414:{},415:{},416:{},417:{},418:{},419:{},420:{},421:{},422:{T:1},423:{T:1},424:{T:-1},425:{T:-1},426:{f:n6},427:{f:i6},428:{},429:{T:1},430:{T:-1},431:{T:1},432:{T:-1},433:{T:1},434:{T:-1},435:{T:1},436:{T:-1},437:{T:1},438:{T:-1},439:{T:1},440:{T:-1},441:{T:1},442:{T:-1},443:{T:1},444:{T:-1},445:{T:1},446:{T:-1},447:{T:1},448:{T:-1},449:{T:1},450:{T:-1},451:{T:1},452:{T:-1},453:{T:1},454:{T:-1},455:{T:1},456:{T:-1},457:{T:1},458:{T:-1},459:{T:1},460:{T:-1},461:{T:1},462:{T:-1},463:{T:1},464:{T:-1},465:{T:1},466:{T:-1},467:{T:1},468:{T:-1},469:{T:1},470:{T:-1},471:{},472:{},473:{T:1},474:{T:-1},475:{},476:{f:a6},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:gF},486:{T:1},487:{T:-1},488:{T:1},489:{T:-1},490:{T:1},491:{T:-1},492:{T:1},493:{T:-1},494:{f:e6},495:{T:1},496:{T:-1},497:{T:1},498:{T:-1},499:{},500:{T:1},501:{T:-1},502:{T:1},503:{T:-1},504:{},505:{T:1},506:{T:-1},507:{},508:{T:1},509:{T:-1},510:{T:1},511:{T:-1},512:{},513:{},514:{T:1},515:{T:-1},516:{T:1},517:{T:-1},518:{T:1},519:{T:-1},520:{T:1},521:{T:-1},522:{},523:{},524:{},525:{},526:{},527:{},528:{T:1},529:{T:-1},530:{T:1},531:{T:-1},532:{T:1},533:{T:-1},534:{},535:{},536:{},537:{},538:{T:1},539:{T:-1},540:{T:1},541:{T:-1},542:{T:1},548:{},549:{},550:{f:zf},551:{},552:{},553:{},554:{T:1},555:{T:-1},556:{T:1},557:{T:-1},558:{T:1},559:{T:-1},560:{T:1},561:{T:-1},562:{},564:{},565:{T:1},566:{T:-1},569:{T:1},570:{T:-1},572:{},573:{T:1},574:{T:-1},577:{},578:{},579:{},580:{},581:{},582:{},583:{},584:{},585:{},586:{},587:{},588:{T:-1},589:{},590:{T:1},591:{T:-1},592:{T:1},593:{T:-1},594:{T:1},595:{T:-1},596:{},597:{T:1},598:{T:-1},599:{T:1},600:{T:-1},601:{T:1},602:{T:-1},603:{T:1},604:{T:-1},605:{T:1},606:{T:-1},607:{},608:{T:1},609:{T:-1},610:{},611:{T:1},612:{T:-1},613:{T:1},614:{T:-1},615:{T:1},616:{T:-1},617:{T:1},618:{T:-1},619:{T:1},620:{T:-1},625:{},626:{T:1},627:{T:-1},628:{T:1},629:{T:-1},630:{T:1},631:{T:-1},632:{f:ER},633:{T:1},634:{T:-1},635:{T:1,f:wR},636:{T:-1},637:{f:T3},638:{T:1},639:{},640:{T:-1},641:{T:1},642:{T:-1},643:{T:1},644:{},645:{T:-1},646:{T:1},648:{T:1},649:{},650:{T:-1},651:{f:C6},652:{},653:{T:1},654:{T:-1},655:{T:1},656:{T:-1},657:{T:1},658:{T:-1},659:{},660:{T:1},661:{},662:{T:-1},663:{},664:{T:1},665:{},666:{T:-1},667:{},668:{},669:{},671:{T:1},672:{T:-1},673:{T:1},674:{T:-1},675:{},676:{},677:{},678:{},679:{},680:{},681:{},1024:{},1025:{},1026:{T:1},1027:{T:-1},1028:{T:1},1029:{T:-1},1030:{},1031:{T:1},1032:{T:-1},1033:{T:1},1034:{T:-1},1035:{},1036:{},1037:{},1038:{T:1},1039:{T:-1},1040:{},1041:{T:1},1042:{T:-1},1043:{},1044:{},1045:{},1046:{T:1},1047:{T:-1},1048:{T:1},1049:{T:-1},1050:{},1051:{T:1},1052:{T:1},1053:{f:h6},1054:{T:1},1055:{},1056:{T:1},1057:{T:-1},1058:{T:1},1059:{T:-1},1061:{},1062:{T:1},1063:{T:-1},1064:{T:1},1065:{T:-1},1066:{T:1},1067:{T:-1},1068:{T:1},1069:{T:-1},1070:{T:1},1071:{T:-1},1072:{T:1},1073:{T:-1},1075:{T:1},1076:{T:-1},1077:{T:1},1078:{T:-1},1079:{T:1},1080:{T:-1},1081:{T:1},1082:{T:-1},1083:{T:1},1084:{T:-1},1085:{},1086:{T:1},1087:{T:-1},1088:{T:1},1089:{T:-1},1090:{T:1},1091:{T:-1},1092:{T:1},1093:{T:-1},1094:{T:1},1095:{T:-1},1096:{},1097:{T:1},1098:{},1099:{T:-1},1100:{T:1},1101:{T:-1},1102:{},1103:{},1104:{},1105:{},1111:{},1112:{},1113:{T:1},1114:{T:-1},1115:{T:1},1116:{T:-1},1117:{},1118:{T:1},1119:{T:-1},1120:{T:1},1121:{T:-1},1122:{T:1},1123:{T:-1},1124:{T:1},1125:{T:-1},1126:{},1128:{T:1},1129:{T:-1},1130:{},1131:{T:1},1132:{T:-1},1133:{T:1},1134:{T:-1},1135:{T:1},1136:{T:-1},1137:{T:1},1138:{T:-1},1139:{T:1},1140:{T:-1},1141:{},1142:{T:1},1143:{T:-1},1144:{T:1},1145:{T:-1},1146:{},1147:{T:1},1148:{T:-1},1149:{T:1},1150:{T:-1},1152:{T:1},1153:{T:-1},1154:{T:-1},1155:{T:-1},1156:{T:-1},1157:{T:1},1158:{T:-1},1159:{T:1},1160:{T:-1},1161:{T:1},1162:{T:-1},1163:{T:1},1164:{T:-1},1165:{T:1},1166:{T:-1},1167:{T:1},1168:{T:-1},1169:{T:1},1170:{T:-1},1171:{},1172:{T:1},1173:{T:-1},1177:{},1178:{T:1},1180:{},1181:{},1182:{},2048:{T:1},2049:{T:-1},2050:{},2051:{T:1},2052:{T:-1},2053:{},2054:{},2055:{T:1},2056:{T:-1},2057:{T:1},2058:{T:-1},2060:{},2067:{},2068:{T:1},2069:{T:-1},2070:{},2071:{},2072:{T:1},2073:{T:-1},2075:{},2076:{},2077:{T:1},2078:{T:-1},2079:{},2080:{T:1},2081:{T:-1},2082:{},2083:{T:1},2084:{T:-1},2085:{T:1},2086:{T:-1},2087:{T:1},2088:{T:-1},2089:{T:1},2090:{T:-1},2091:{},2092:{},2093:{T:1},2094:{T:-1},2095:{},2096:{T:1},2097:{T:-1},2098:{T:1},2099:{T:-1},2100:{T:1},2101:{T:-1},2102:{},2103:{T:1},2104:{T:-1},2105:{},2106:{T:1},2107:{T:-1},2108:{},2109:{T:1},2110:{T:-1},2111:{T:1},2112:{T:-1},2113:{T:1},2114:{T:-1},2115:{},2116:{},2117:{},2118:{T:1},2119:{T:-1},2120:{},2121:{T:1},2122:{T:-1},2123:{T:1},2124:{T:-1},2125:{},2126:{T:1},2127:{T:-1},2128:{},2129:{T:1},2130:{T:-1},2131:{T:1},2132:{T:-1},2133:{T:1},2134:{},2135:{},2136:{},2137:{T:1},2138:{T:-1},2139:{T:1},2140:{T:-1},2141:{},3072:{},3073:{},4096:{T:1},4097:{T:-1},5002:{T:1},5003:{T:-1},5081:{T:1},5082:{T:-1},5083:{},5084:{T:1},5085:{T:-1},5086:{T:1},5087:{T:-1},5088:{},5089:{},5090:{},5092:{T:1},5093:{T:-1},5094:{},5095:{T:1},5096:{T:-1},5097:{},5099:{},65535:{n:""}};function ce(e,t,r,n){var i=t;if(!isNaN(i)){var o=n||(r||[]).length||0,a=e.next(4);a.write_shift(2,i),a.write_shift(2,o),o>0&&bd(r)&&e.push(r)}}function lD(e,t,r,n){var i=n||(r||[]).length||0;if(i<=8224)return ce(e,t,r,i);var o=t;if(!isNaN(o)){for(var a=r.parts||[],s=0,l=0,u=0;u+(a[s]||8224)<=8224;)u+=a[s]||8224,s++;var c=e.next(4);for(c.write_shift(2,o),c.write_shift(2,u),e.push(r.slice(l,l+u)),l+=u;l=0&&i<65536?ce(e,2,CA(r,n,i)):ce(e,3,TA(r,n,i));return;case"b":case"e":ce(e,5,uD(r,n,t.v,t.t));return;case"s":case"str":ce(e,4,cD(r,n,(t.v||"").slice(0,255)));return}ce(e,1,rs(null,r,n))}function dD(e,t,r,n){var i=Array.isArray(t),o=Ke(t["!ref"]||"A1"),a,s="",l=[];if(o.e.c>255||o.e.r>16383){if(n.WTF)throw new Error("Range "+(t["!ref"]||"A1")+" exceeds format limit A1:IV16384");o.e.c=Math.min(o.e.c,255),o.e.r=Math.min(o.e.c,16383),a=ot(o)}for(var u=o.s.r;u<=o.e.r;++u){s=_t(u);for(var c=o.s.c;c<=o.e.c;++c){u===o.s.r&&(l[c]=Ft(c)),a=l[c]+s;var f=i?(t[u]||[])[c]:t[a];f&&fD(e,f,u,c)}}}function hD(e,t){for(var r=t||{},n=Gt(),i=0,o=0;o255||h.e.r>=m){if(t.WTF)throw new Error("Range "+(o["!ref"]||"A1")+" exceeds format limit A1:IV16384");h.e.c=Math.min(h.e.c,255),h.e.r=Math.min(h.e.c,m-1)}ce(n,2057,Bd(r,16,t)),ce(n,13,or(1)),ce(n,12,or(100)),ce(n,15,$t(!0)),ce(n,17,$t(!1)),ce(n,16,oi(.001)),ce(n,95,$t(!0)),ce(n,42,$t(!1)),ce(n,43,$t(!1)),ce(n,130,or(1)),ce(n,128,dA([0,0])),ce(n,131,$t(!1)),ce(n,132,$t(!1)),u&&wD(n,o["!cols"]),ce(n,512,fA(h,t)),u&&(o["!links"]=[]);for(var p=h.s.r;p<=h.e.r;++p){f=_t(p);for(var g=h.s.c;g<=h.e.c;++g){p===h.s.r&&(d[g]=Ft(g)),c=d[g]+f;var x=l?(o[p]||[])[g]:o[c];x&&(yD(n,x,p,g,t),u&&x.l&&o["!links"].push([c,x.l]))}}var w=s.CodeName||s.name||i;return u&&ce(n,574,aA((a.Views||[])[0])),u&&(o["!merges"]||[]).length&&ce(n,229,vA(o["!merges"])),u&&xD(n,o),ce(n,442,lw(w)),u&&mD(n,o),ce(n,10),n.end()}function _D(e,t,r){var n=Gt(),i=(e||{}).Workbook||{},o=i.Sheets||[],a=i.WBProps||{},s=r.biff==8,l=r.biff==5;if(ce(n,2057,Bd(e,5,r)),r.bookType=="xla"&&ce(n,135),ce(n,225,s?or(1200):null),ce(n,193,X3(2)),l&&ce(n,191),l&&ce(n,192),ce(n,226),ce(n,92,rA("SheetJS",r)),ce(n,66,or(s?1200:1252)),s&&ce(n,353,or(0)),s&&ce(n,448),ce(n,317,SA(e.SheetNames.length)),s&&e.vbaraw&&ce(n,211),s&&e.vbaraw){var u=a.CodeName||"ThisWorkbook";ce(n,442,lw(u))}ce(n,156,or(17)),ce(n,25,$t(!1)),ce(n,18,$t(!1)),ce(n,19,or(0)),s&&ce(n,431,$t(!1)),s&&ce(n,444,or(0)),ce(n,61,oA()),ce(n,64,$t(!1)),ce(n,141,or(0)),ce(n,34,$t(R6(e)=="true")),ce(n,14,$t(!0)),s&&ce(n,439,$t(!1)),ce(n,218,or(0)),pD(n,e,r),gD(n,e.SSF,r),vD(n,r),s&&ce(n,352,$t(!1));var c=n.end(),f=Gt();s&&ce(f,140,yA()),s&&r.Strings&&lD(f,252,iA(r.Strings)),ce(f,10);var d=f.end(),h=Gt(),m=0,p=0;for(p=0;p255&&typeof console<"u"&&console.error&&console.error("Worksheet '"+e.SheetNames[r]+"' extends beyond column IV (255). Data may be lost.")}}var o=t||{};switch(o.biff||2){case 8:case 5:return SD(e,t);case 4:case 3:case 2:return hD(e,t)}throw new Error("invalid type "+o.bookType+" for BIFF")}function TD(e,t,r,n){for(var i=e["!merges"]||[],o=[],a=t.s.c;a<=t.e.c;++a){for(var s=0,l=0,u=0;ur||i[u].s.c>a)&&!(i[u].e.r1&&(h.rowspan=s),l>1&&(h.colspan=l),n.editable?d=''+d+"":f&&(h["data-t"]=f&&f.t||"z",f.v!=null&&(h["data-v"]=f.v),f.z!=null&&(h["data-z"]=f.z),f.l&&(f.l.Target||"#").charAt(0)!="#"&&(d=''+d+"")),h.id=(n.id||"sjs")+"-"+c,o.push(ue("td",d,h))}}var m="";return m+o.join("")+""}var CD='SheetJS Table Export',AD="";function RD(e,t,r){var n=[];return n.join("")+""}function Nw(e,t){var r=t||{},n=r.header!=null?r.header:CD,i=r.footer!=null?r.footer:AD,o=[n],a=Jt(e["!ref"]);r.dense=Array.isArray(e),o.push(RD(e,a,r));for(var s=a.s.r;s<=a.e.r;++s)o.push(TD(e,a,s,r));return o.push(""+i),o.join("")}function Mw(e,t,r){var n=r||{},i=0,o=0;if(n.origin!=null)if(typeof n.origin=="number")i=n.origin;else{var a=typeof n.origin=="string"?dt(n.origin):n.origin;i=a.r,o=a.c}var s=t.getElementsByTagName("tr"),l=Math.min(n.sheetRows||1e7,s.length),u={s:{r:0,c:0},e:{r:i,c:o}};if(e["!ref"]){var c=Jt(e["!ref"]);u.s.r=Math.min(u.s.r,c.s.r),u.s.c=Math.min(u.s.c,c.s.c),u.e.r=Math.max(u.e.r,c.e.r),u.e.c=Math.max(u.e.c,c.e.c),i==-1&&(u.e.r=i=c.e.r+1)}var f=[],d=0,h=e["!rows"]||(e["!rows"]=[]),m=0,p=0,g=0,x=0,w=0,y=0;for(e["!cols"]||(e["!cols"]=[]);m1||y>1)&&f.push({s:{r:p+i,c:x+o},e:{r:p+i+(w||1)-1,c:x+o+(y||1)-1}});var L={t:"s",v:S},H=M.getAttribute("data-t")||M.getAttribute("t")||"";S!=null&&(S.length==0?L.t=H||"z":n.raw||S.trim().length==0||H=="s"||(S==="TRUE"?L={t:"b",v:!0}:S==="FALSE"?L={t:"b",v:!1}:isNaN(Qr(S))?isNaN(Na(S).getDate())||(L={t:"d",v:Lt(S)},n.cellDates||(L={t:"n",v:jt(L.v)}),L.z=n.dateNF||rt[14]):L={t:"n",v:Qr(S)})),L.z===void 0&&C!=null&&(L.z=C);var B="",V=M.getElementsByTagName("A");if(V&&V.length)for(var Q=0;Q=l&&(e["!fullref"]=ot((u.e.r=s.length-m+p-1+i,u))),e}function Lw(e,t){var r=t||{},n=r.dense?[]:{};return Mw(n,e,t)}function OD(e,t){return mi(Lw(e,t),t)}function Zg(e){var t="",r=FD(e);return r&&(t=r(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function FD(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}var DD=function(){var e=["",'',"",'',"",'',"",""].join(""),t=""+e+"";return function(){return at+t}}(),Jg=function(){var e=function(o){return Be(o).replace(/ +/g,function(a){return''}).replace(/\t/g,"").replace(/\n/g,"
").replace(/^ /,"").replace(/ $/,"")},t=` `,r=` -`,n=function(o,a,s){var l=[];l.push(' -`);var u=0,c=0,f=Zt(o["!ref"]||"A1"),d=o["!merges"]||[],h=0,m=Array.isArray(o);if(o["!cols"])for(c=0;c<=f.e.c;++c)l.push(" +`,n=function(o,a,s){var l=[];l.push(' +`);var u=0,c=0,f=Jt(o["!ref"]||"A1"),d=o["!merges"]||[],h=0,m=Array.isArray(o);if(o["!cols"])for(c=0;c<=f.e.c;++c)l.push(" `);var p="",g=o["!rows"]||[];for(u=0;u `);for(;u<=f.e.r;++u){for(p=g[u]?' table:style-name="ro'+g[u].ods+'"':"",l.push(" -`),c=0;cc)&&!(d[h].s.r>u)&&!(d[h].e.cc)&&!(d[h].s.r>u)&&!(d[h].e.c `)}return l.push(` `),l.join("")},i=function(o,a){o.push(` @@ -270,7 +270,7 @@ `),o.push(` / `),o.push(` `),o.push(` -`);var s=0;a.SheetNames.map(function(u){return a.Sheets[u]}).forEach(function(u){if(u&&u["!cols"]){for(var c=0;c +`);var s=0;a.SheetNames.map(function(u){return a.Sheets[u]}).forEach(function(u){if(u&&u["!cols"]){for(var c=0;c `),o.push(' `),o.push(` `),++s}}});var l=0;a.SheetNames.map(function(u){return a.Sheets[u]}).forEach(function(u){if(u&&u["!rows"]){for(var c=0;c @@ -281,22 +281,22 @@ `),o.push(` `),o.push(` `),o.push(` -`)};return function(a,s){var l=[it],u=La({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:meta":"urn:oasis:names:tc:opendocument:xmlns:meta:1.0","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:presentation":"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:chart":"urn:oasis:names:tc:opendocument:xmlns:chart:1.0","xmlns:dr3d":"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0","xmlns:math":"http://www.w3.org/1998/Math/MathML","xmlns:form":"urn:oasis:names:tc:opendocument:xmlns:form:1.0","xmlns:script":"urn:oasis:names:tc:opendocument:xmlns:script:1.0","xmlns:ooo":"http://openoffice.org/2004/office","xmlns:ooow":"http://openoffice.org/2004/writer","xmlns:oooc":"http://openoffice.org/2004/calc","xmlns:dom":"http://www.w3.org/2001/xml-events","xmlns:xforms":"http://www.w3.org/2002/xforms","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:sheet":"urn:oasis:names:tc:opendocument:sh33tjs:1.0","xmlns:rpt":"http://openoffice.org/2005/report","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","xmlns:xhtml":"http://www.w3.org/1999/xhtml","xmlns:grddl":"http://www.w3.org/2003/g/data-view#","xmlns:tableooo":"http://openoffice.org/2009/table","xmlns:drawooo":"http://openoffice.org/2010/draw","xmlns:calcext":"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0","xmlns:loext":"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0","xmlns:field":"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0","xmlns:formx":"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0","xmlns:css3t":"http://www.w3.org/TR/css3-text/","office:version":"1.2"}),c=La({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});s.bookType=="fods"?(l.push(" -`),l.push(Wx().replace(/office:document-meta/g,"office:meta"))):l.push(" +`)};return function(a,s){var l=[at],u=Ma({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:meta":"urn:oasis:names:tc:opendocument:xmlns:meta:1.0","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:presentation":"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:chart":"urn:oasis:names:tc:opendocument:xmlns:chart:1.0","xmlns:dr3d":"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0","xmlns:math":"http://www.w3.org/1998/Math/MathML","xmlns:form":"urn:oasis:names:tc:opendocument:xmlns:form:1.0","xmlns:script":"urn:oasis:names:tc:opendocument:xmlns:script:1.0","xmlns:ooo":"http://openoffice.org/2004/office","xmlns:ooow":"http://openoffice.org/2004/writer","xmlns:oooc":"http://openoffice.org/2004/calc","xmlns:dom":"http://www.w3.org/2001/xml-events","xmlns:xforms":"http://www.w3.org/2002/xforms","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:sheet":"urn:oasis:names:tc:opendocument:sh33tjs:1.0","xmlns:rpt":"http://openoffice.org/2005/report","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","xmlns:xhtml":"http://www.w3.org/1999/xhtml","xmlns:grddl":"http://www.w3.org/2003/g/data-view#","xmlns:tableooo":"http://openoffice.org/2009/table","xmlns:drawooo":"http://openoffice.org/2010/draw","xmlns:calcext":"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0","xmlns:loext":"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0","xmlns:field":"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0","xmlns:formx":"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0","xmlns:css3t":"http://www.w3.org/TR/css3-text/","office:version":"1.2"}),c=Ma({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});s.bookType=="fods"?(l.push(" +`),l.push(Jx().replace(/office:document-meta/g,"office:meta"))):l.push(" `),i(l,a),l.push(` `),l.push(` `);for(var f=0;f!=a.SheetNames.length;++f)l.push(n(a.Sheets[a.SheetNames[f]],a,f));return l.push(` `),l.push(` -`),s.bookType=="fods"?l.push(""):l.push(""),l.join("")}}();function Fw(e,t){if(t.bookType=="fods")return Kg(e,t);var r=Cd(),n="",i=[],o=[];return n="mimetype",Pe(r,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",Pe(r,n,Kg(e,t)),i.push([n,"text/xml"]),o.push([n,"ContentFile"]),n="styles.xml",Pe(r,n,vD(e,t)),i.push([n,"text/xml"]),o.push([n,"StylesFile"]),n="meta.xml",Pe(r,n,it+Wx()),i.push([n,"text/xml"]),o.push([n,"MetadataFile"]),n="manifest.rdf",Pe(r,n,F3(o)),i.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",Pe(r,n,R3(i)),r}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function Wl(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function xD(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):wr(Gr(e))}function wD(e,t){e:for(var r=0;r<=e.length-t.length;++r){for(var n=0;n>7,e[t+14]|=(n&127)<<1;for(var o=0;i>=1;++o,i/=256)e[t+o]=i&255;e[t+15]|=r>=0?0:128}function Ba(e,t){var r=t?t[0]:0,n=e[r]&127;e:if(e[r++]>=128&&(n|=(e[r]&127)<<7,e[r++]<128||(n|=(e[r]&127)<<14,e[r++]<128)||(n|=(e[r]&127)<<21,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,28),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,35),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,42),++r,e[r++]<128)))break e;return t&&(t[0]=r),n}function Ne(e){var t=new Uint8Array(7);t[0]=e&127;var r=1;e:if(e>127){if(t[r-1]|=128,t[r]=e>>7&127,++r,e<=16383||(t[r-1]|=128,t[r]=e>>14&127,++r,e<=2097151)||(t[r-1]|=128,t[r]=e>>21&127,++r,e<=268435455)||(t[r-1]|=128,t[r]=e/256>>>21&127,++r,e<=34359738367)||(t[r-1]|=128,t[r]=e/65536>>>21&127,++r,e<=4398046511103))break e;t[r-1]|=128,t[r]=e/16777216>>>21&127,++r}return t.slice(0,r)}function no(e){var t=0,r=e[t]&127;e:if(e[t++]>=128){if(r|=(e[t]&127)<<7,e[t++]<128||(r|=(e[t]&127)<<14,e[t++]<128)||(r|=(e[t]&127)<<21,e[t++]<128))break e;r|=(e[t]&127)<<28}return r}function ot(e){for(var t=[],r=[0];r[0]=128;);s=e.slice(l,r[0])}break;case 5:a=4,s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 1:a=8,s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 2:a=Ba(e,r),s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 3:case 4:default:throw new Error("PB Type ".concat(o," for Field ").concat(i," at offset ").concat(n))}var u={data:s,type:o};t[i]==null?t[i]=[u]:t[i].push(u)}return t}function dt(e){var t=[];return e.forEach(function(r,n){r.forEach(function(i){i.data&&(t.push(Ne(n*8+i.type)),i.type==2&&t.push(Ne(i.data.length)),t.push(i.data))})}),Mn(t)}function gr(e){for(var t,r=[],n=[0];n[0]>>0>0),r.push(a)}return r}function Di(e){var t=[];return e.forEach(function(r){var n=[];n[1]=[{data:Ne(r.id),type:0}],n[2]=[],r.merge!=null&&(n[3]=[{data:Ne(+!!r.merge),type:0}]);var i=[];r.messages.forEach(function(a){i.push(a.data),a.meta[3]=[{type:0,data:Ne(a.data.length)}],n[2].push({data:dt(a.meta),type:2})});var o=dt(n);t.push(Ne(o.length)),t.push(o),i.forEach(function(a){return t.push(a)})}),Mn(t)}function ED(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var r=[0],n=Ba(t,r),i=[];r[0]>2;if(a<60)++a;else{var s=a-59;a=t[r[0]],s>1&&(a|=t[r[0]+1]<<8),s>2&&(a|=t[r[0]+2]<<16),s>3&&(a|=t[r[0]+3]<<24),a>>>=0,a++,r[0]+=s}i.push(t.slice(r[0],r[0]+a)),r[0]+=a;continue}else{var l=0,u=0;if(o==1?(u=(t[r[0]]>>2&7)+4,l=(t[r[0]++]&224)<<3,l|=t[r[0]++]):(u=(t[r[0]++]>>2)+1,o==2?(l=t[r[0]]|t[r[0]+1]<<8,r[0]+=2):(l=(t[r[0]]|t[r[0]+1]<<8|t[r[0]+2]<<16|t[r[0]+3]<<24)>>>0,r[0]+=4)),i=[Mn(i)],l==0)throw new Error("Invalid offset 0");if(l>i[0].length)throw new Error("Invalid offset beyond length");if(u>=l)for(i.push(i[0].slice(-l)),u-=l;u>=i[i.length-1].length;)i.push(i[i.length-1]),u-=i[i.length-1].length;i.push(i[0].slice(-l,-l+u))}}var c=Mn(i);if(c.length!=n)throw new Error("Unexpected length: ".concat(c.length," != ").concat(n));return c}function mr(e){for(var t=[],r=0;r>8&255]))):n<=16777216?(a+=4,t.push(new Uint8Array([248,n-1&255,n-1>>8&255,n-1>>16&255]))):n<=4294967296&&(a+=5,t.push(new Uint8Array([252,n-1&255,n-1>>8&255,n-1>>16&255,n-1>>>24&255]))),t.push(e.slice(r,r+n)),a+=n,i[0]=0,i[1]=a&255,i[2]=a>>8&255,i[3]=a>>16&255,r+=n}return Mn(t)}function Fc(e,t){var r=new Uint8Array(32),n=Wl(r),i=12,o=0;switch(r[0]=5,e.t){case"n":r[1]=2,yD(r,i,e.v),o|=1,i+=16;break;case"b":r[1]=6,n.setFloat64(i,e.v?1:0,!0),o|=2,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[1]=3,n.setUint32(i,t.indexOf(e.v),!0),o|=8,i+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(8,o,!0),r.slice(0,i)}function Dc(e,t){var r=new Uint8Array(32),n=Wl(r),i=12,o=0;switch(r[0]=3,e.t){case"n":r[2]=2,n.setFloat64(i,e.v,!0),o|=32,i+=8;break;case"b":r[2]=6,n.setFloat64(i,e.v?1:0,!0),o|=32,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[2]=3,n.setUint32(i,t.indexOf(e.v),!0),o|=16,i+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(4,o,!0),r.slice(0,i)}function ln(e){var t=ot(e);return Ba(t[1][0].data)}function _D(e,t,r){var n,i,o,a;if(!((n=e[6])!=null&&n[0])||!((i=e[7])!=null&&i[0]))throw"Mutation only works on post-BNC storages!";var s=((a=(o=e[8])==null?void 0:o[0])==null?void 0:a.data)&&no(e[8][0].data)>0||!1;if(s)throw"Math only works with normal offsets";for(var l=0,u=Wl(e[7][0].data),c=0,f=[],d=Wl(e[4][0].data),h=0,m=[],p=0;p1&&console.error("The Numbers writer currently writes only the first table");var n=Zt(r["!ref"]);n.s.r=n.s.c=0;var i=!1;n.e.c>9&&(i=!0,n.e.c=9),n.e.r>49&&(i=!0,n.e.r=49),i&&console.error("The Numbers writer is currently limited to ".concat(nt(n)));var o=zl(r,{range:n,header:1}),a=["~Sh33tJ5~"];o.forEach(function(M){return M.forEach(function(b){typeof b=="string"&&a.push(b)})});var s={},l=[],u=Ue.read(t.numbers,{type:"base64"});u.FileIndex.map(function(M,b){return[M,u.FullPaths[b]]}).forEach(function(M){var b=M[0],T=M[1];if(b.type==2&&b.name.match(/\.iwa/)){var B=b.content,H=mr(B),Q=gr(H);Q.forEach(function(ee){l.push(ee.id),s[ee.id]={deps:[],location:T,type:no(ee.messages[0].meta[1][0].data)}})}}),l.sort(function(M,b){return M-b});var c=l.filter(function(M){return M>1}).map(function(M){return[M,Ne(M)]});u.FileIndex.map(function(M,b){return[M,u.FullPaths[b]]}).forEach(function(M){var b=M[0];if(M[1],!!b.name.match(/\.iwa/)){var T=gr(mr(b.content));T.forEach(function(B){B.messages.forEach(function(H){c.forEach(function(Q){B.messages.some(function(ee){return no(ee.meta[1][0].data)!=11006&&wD(ee.data,Q[1])})&&s[Q[0]].deps.push(B.id)})})})}});for(var f=Ue.find(u,s[1].location),d=gr(mr(f.content)),h,m=0;m-1,i=Ux();Hd(t=t||{});var o=Cd(),a="",s=0;if(t.cellXfs=[],Un(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),a="docProps/core.xml",Pe(o,a,zx(e.Props,t)),i.coreprops.push(a),Me(t.rels,2,a,ke.CORE_PROPS),a="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],u=0;u0&&(a="docProps/custom.xml",Pe(o,a,Xx(e.Custprops)),i.custprops.push(a),Me(t.rels,4,a,ke.CUST_PROPS)),s=1;s<=e.SheetNames.length;++s){var c={"!id":{}},f=e.Sheets[e.SheetNames[s-1]],d=(f||{})["!type"]||"sheet";switch(d){case"chart":default:a="xl/worksheets/sheet"+s+"."+r,Pe(o,a,F6(s-1,a,t,e,c)),i.sheets.push(a),Me(t.wbrels,-1,"worksheets/sheet"+s+"."+r,ke.WS[0])}if(f){var h=f["!comments"],m=!1,p="";h&&h.length>0&&(p="xl/comments"+s+"."+r,Pe(o,p,I6(h,p)),i.comments.push(p),Me(c,-1,"../comments"+s+"."+r,ke.CMNT),m=!0),f["!legacy"]&&m&&Pe(o,"xl/drawings/vmlDrawing"+s+".vml",uw(s,f["!comments"])),delete f["!comments"],delete f["!legacy"]}c["!id"].rId1&&Pe(o,Vx(a),to(c))}return t.Strings!=null&&t.Strings.length>0&&(a="xl/sharedStrings."+r,Pe(o,a,P6(t.Strings,a,t)),i.strs.push(a),Me(t.wbrels,-1,"sharedStrings."+r,ke.SST)),a="xl/workbook."+r,Pe(o,a,O6(e,a)),i.workbooks.push(a),Me(t.rels,1,a,ke.WB),a="xl/theme/theme1.xml",Pe(o,a,sw(e.Themes,t)),i.themes.push(a),Me(t.wbrels,-1,"theme/theme1.xml",ke.THEME),a="xl/styles."+r,Pe(o,a,D6(e,a,t)),i.styles.push(a),Me(t.wbrels,-1,"styles."+r,ke.STY),e.vbaraw&&n&&(a="xl/vbaProject.bin",Pe(o,a,e.vbaraw),i.vba.push(a),Me(t.wbrels,-1,"vbaProject.bin",ke.VBA)),a="xl/metadata."+r,Pe(o,a,b6(a)),i.metadata.push(a),Me(t.wbrels,-1,"metadata."+r,ke.XLMETA),Pe(o,"[Content_Types].xml",Hx(i,t)),Pe(o,"_rels/.rels",to(t.rels)),Pe(o,"xl/_rels/workbook."+r+".rels",to(t.wbrels)),delete t.revssf,delete t.ssf,o}function RD(e,t){Wi=1024,e&&!e.SSF&&(e.SSF=Gt(et)),e&&e.SSF&&(wu(),xu(e.SSF),t.revssf=yu(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,va?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r="xml",n=fw.indexOf(t.bookType)>-1,i=Ux();Hd(t=t||{});var o=Cd(),a="",s=0;if(t.cellXfs=[],Un(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),a="docProps/core.xml",Pe(o,a,zx(e.Props,t)),i.coreprops.push(a),Me(t.rels,2,a,ke.CORE_PROPS),a="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],u=0;u0&&(a="docProps/custom.xml",Pe(o,a,Xx(e.Custprops)),i.custprops.push(a),Me(t.rels,4,a,ke.CUST_PROPS));var c=["SheetJ5"];for(t.tcid=0,s=1;s<=e.SheetNames.length;++s){var f={"!id":{}},d=e.Sheets[e.SheetNames[s-1]],h=(d||{})["!type"]||"sheet";switch(h){case"chart":default:a="xl/worksheets/sheet"+s+"."+r,Pe(o,a,yw(s-1,t,e,f)),i.sheets.push(a),Me(t.wbrels,-1,"worksheets/sheet"+s+"."+r,ke.WS[0])}if(d){var m=d["!comments"],p=!1,g="";if(m&&m.length>0){var x=!1;m.forEach(function(w){w[1].forEach(function(y){y.T==!0&&(x=!0)})}),x&&(g="xl/threadedComments/threadedComment"+s+"."+r,Pe(o,g,iR(m,c,t)),i.threadedcomments.push(g),Me(f,-1,"../threadedComments/threadedComment"+s+"."+r,ke.TCMNT)),g="xl/comments"+s+"."+r,Pe(o,g,cw(m)),i.comments.push(g),Me(f,-1,"../comments"+s+"."+r,ke.CMNT),p=!0}d["!legacy"]&&p&&Pe(o,"xl/drawings/vmlDrawing"+s+".vml",uw(s,d["!comments"])),delete d["!comments"],delete d["!legacy"]}f["!id"].rId1&&Pe(o,Vx(a),to(f))}return t.Strings!=null&&t.Strings.length>0&&(a="xl/sharedStrings."+r,Pe(o,a,tw(t.Strings,t)),i.strs.push(a),Me(t.wbrels,-1,"sharedStrings."+r,ke.SST)),a="xl/workbook."+r,Pe(o,a,Sw(e)),i.workbooks.push(a),Me(t.rels,1,a,ke.WB),a="xl/theme/theme1.xml",Pe(o,a,sw(e.Themes,t)),i.themes.push(a),Me(t.wbrels,-1,"theme/theme1.xml",ke.THEME),a="xl/styles."+r,Pe(o,a,ow(e,t)),i.styles.push(a),Me(t.wbrels,-1,"styles."+r,ke.STY),e.vbaraw&&n&&(a="xl/vbaProject.bin",Pe(o,a,e.vbaraw),i.vba.push(a),Me(t.wbrels,-1,"vbaProject.bin",ke.VBA)),a="xl/metadata."+r,Pe(o,a,lw()),i.metadata.push(a),Me(t.wbrels,-1,"metadata."+r,ke.XLMETA),c.length>1&&(a="xl/persons/person.xml",Pe(o,a,oR(c)),i.people.push(a),Me(t.wbrels,-1,"persons/person.xml",ke.PEOPLE)),Pe(o,"[Content_Types].xml",Hx(i,t)),Pe(o,"_rels/.rels",to(t.rels)),Pe(o,"xl/_rels/workbook."+r+".rels",to(t.wbrels)),delete t.revssf,delete t.ssf,o}function OD(e,t){var r="";switch((t||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":r=tn(e.slice(0,12));break;case"binary":r=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(t&&t.type||"undefined"))}return[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3),r.charCodeAt(4),r.charCodeAt(5),r.charCodeAt(6),r.charCodeAt(7)]}function Dw(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return Za(t.file,Ue.write(e,{type:$e?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return Ue.write(e,t)}function FD(e,t){var r=Gt(t||{}),n=CD(e,r);return DD(n,r)}function DD(e,t){var r={},n=$e?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(t.compression&&(r.compression="DEFLATE"),t.password)r.type=n;else switch(t.type){case"base64":r.type="base64";break;case"binary":r.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":r.type=n;break;default:throw new Error("Unrecognized type "+t.type)}var i=e.FullPaths?Ue.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[r.type]||r.type,compression:!!t.compression}):e.generate(r);if(typeof Deno<"u"&&typeof i=="string"){if(t.type=="binary"||t.type=="base64")return i;i=new Uint8Array(vu(i))}return t.password&&typeof encrypt_agile<"u"?Dw(encrypt_agile(i,t.password),t):t.type==="file"?Za(t.file,i):t.type=="string"?ha(i):i}function PD(e,t){var r=t||{},n=X6(e,r);return Dw(n,r)}function Cr(e,t,r){r||(r="");var n=r+e;switch(t.type){case"base64":return Na(Gr(n));case"binary":return Gr(n);case"string":return e;case"file":return Za(t.file,n,"utf8");case"buffer":return $e?sn(n,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(n):Cr(n,{type:"binary"}).split("").map(function(i){return i.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function ID(e,t){switch(t.type){case"base64":return Na(e);case"binary":return e;case"string":return e;case"file":return Za(t.file,e,"binary");case"buffer":return $e?sn(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function bs(e,t){switch(t.type){case"string":case"base64":case"binary":for(var r="",n=0;n0&&(i=0);var f=wt(l.s.r),d=[],h=[],m=0,p=0,g=Array.isArray(e),x=l.s.r,w=0,y={};g&&!e[x]&&(e[x]=[]);var _=u.skipHidden&&e["!cols"]||[],k=u.skipHidden&&e["!rows"]||[];for(w=l.s.c;w<=l.e.c;++w)if(!(_[w]||{}).hidden)switch(d[w]=Rt(w),r=g?e[x][w]:e[d[w]+f],n){case 1:o[w]=w-l.s.c;break;case 2:o[w]=d[w];break;case 3:o[w]=u.header[w-l.s.c];break;default:if(r==null&&(r={w:"__EMPTY",t:"s"}),s=a=rn(r,null,u),p=y[a]||0,!p)y[a]=1;else{do s=a+"_"+p++;while(y[s]);y[a]=p,y[s]=1}o[w]=s}for(x=l.s.r+i;x<=l.e.r;++x)if(!(k[x]||{}).hidden){var N=$D(e,l,x,d,n,o,g,u);(N.isempty===!1||(n===1?u.blankrows!==!1:u.blankrows))&&(h[m++]=N.row)}return h.length=m,h}var Yg=/"/g;function ND(e,t,r,n,i,o,a,s){for(var l=!0,u=[],c="",f=wt(r),d=t.s.c;d<=t.e.c;++d)if(n[d]){var h=s.dense?(e[r]||[])[d]:e[n[d]+f];if(h==null)c="";else if(h.v!=null){l=!1,c=""+(s.rawNumbers&&h.t=="n"?h.v:rn(h,null,s));for(var m=0,p=0;m!==c.length;++m)if((p=c.charCodeAt(m))===i||p===o||p===34||s.forceQuotes){c='"'+c.replace(Yg,'""')+'"';break}c=="ID"&&(c='"ID"')}else h.f!=null&&!h.F?(l=!1,c="="+h.f,c.indexOf(",")>=0&&(c='"'+c.replace(Yg,'""')+'"')):c="";u.push(c)}return s.blankrows===!1&&l?null:u.join(a)}function Vd(e,t){var r=[],n=t??{};if(e==null||e["!ref"]==null)return"";var i=Ge(e["!ref"]),o=n.FS!==void 0?n.FS:",",a=o.charCodeAt(0),s=n.RS!==void 0?n.RS:` -`,l=s.charCodeAt(0),u=new RegExp((o=="|"?"\\|":o)+"+$"),c="",f=[];n.dense=Array.isArray(e);for(var d=n.skipHidden&&e["!cols"]||[],h=n.skipHidden&&e["!rows"]||[],m=i.s.c;m<=i.e.c;++m)(d[m]||{}).hidden||(f[m]=Rt(m));for(var p=0,g=i.s.r;g<=i.e.r;++g)(h[g]||{}).hidden||(c=ND(e,i,g,f,a,l,o,n),c!=null&&(n.strip&&(c=c.replace(u,"")),(c||n.blankrows!==!1)&&r.push((p++?s:"")+c)));return delete n.dense,r.join("")}function Iw(e,t){t||(t={}),t.FS=" ",t.RS=` -`;var r=Vd(e,t);return r}function MD(e){var t="",r,n="";if(e==null||e["!ref"]==null)return[];var i=Ge(e["!ref"]),o="",a=[],s,l=[],u=Array.isArray(e);for(s=i.s.c;s<=i.e.c;++s)a[s]=Rt(s);for(var c=i.s.r;c<=i.e.r;++c)for(o=wt(c),s=i.s.c;s<=i.e.c;++s)if(t=a[s]+o,r=u?(e[c]||[])[s]:e[t],n="",r!==void 0){if(r.F!=null){if(t=r.F,!r.f)continue;n=r.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(r.f!=null)n=r.f;else{if(r.t=="z")continue;if(r.t=="n"&&r.v!=null)n=""+r.v;else if(r.t=="b")n=r.v?"TRUE":"FALSE";else if(r.w!==void 0)n="'"+r.w;else{if(r.v===void 0)continue;r.t=="s"?n="'"+r.v:n=""+r.v}}l[l.length]=t+"="+n}return l}function bw(e,t,r){var n=r||{},i=+!n.skipHeader,o=e||{},a=0,s=0;if(o&&n.origin!=null)if(typeof n.origin=="number")a=n.origin;else{var l=typeof n.origin=="string"?ut(n.origin):n.origin;a=l.r,s=l.c}var u,c={s:{c:0,r:0},e:{c:s,r:a+t.length-1+i}};if(o["!ref"]){var f=Ge(o["!ref"]);c.e.c=Math.max(c.e.c,f.e.c),c.e.r=Math.max(c.e.r,f.e.r),a==-1&&(a=f.e.r+1,c.e.r=a+t.length-1+i)}else a==-1&&(a=0,c.e.r=t.length-1+i);var d=n.header||[],h=0;t.forEach(function(p,g){Et(p).forEach(function(x){(h=d.indexOf(x))==-1&&(d[h=d.length]=x);var w=p[x],y="z",_="",k=Be({c:s+h,r:a+g+i});u=Ua(o,k),w&&typeof w=="object"&&!(w instanceof Date)?o[k]=w:(typeof w=="number"?y="n":typeof w=="boolean"?y="b":typeof w=="string"?y="s":w instanceof Date?(y="d",n.cellDates||(y="n",w=zt(w)),_=n.dateNF||et[14]):w===null&&n.nullError&&(y="e",w=0),u?(u.t=y,u.v=w,delete u.w,delete u.R,_&&(u.z=_)):o[k]=u={t:y,v:w},_&&(u.z=_))})}),c.e.c=Math.max(c.e.c,s+d.length-1);var m=wt(a);if(i)for(h=0;h=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}else if(typeof t=="string"){var r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function UD(){return{SheetNames:[],Sheets:{}}}function HD(e,t,r,n){var i=1;if(!r)for(;i<=65535&&e.SheetNames.indexOf(r="Sheet"+i)!=-1;++i,r=void 0);if(!r||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(r)>=0){var o=r.match(/(^.*?)(\d+)$/);i=o&&+o[2]||0;var a=o&&o[1]||r;for(++i;i<=65535&&e.SheetNames.indexOf(r=a+i)!=-1;++i);}if(_w(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function VD(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=BD(e,t);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[n].Hidden=r}function WD(e,t){return e.z=t,e}function kw(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function zD(e,t,r){return kw(e,"#"+t,r)}function GD(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function jD(e,t,r,n){for(var i=typeof t!="string"?t:Ge(t),o=typeof t=="string"?t:nt(t),a=i.s.r;a<=i.e.r;++a)for(var s=i.s.c;s<=i.e.c;++s){var l=Ua(e,a,s);l.t="n",l.F=o,delete l.v,a==i.s.r&&s==i.s.c&&(l.f=r,n&&(l.D=!0))}return e}var Pc={encode_col:Rt,encode_row:wt,encode_cell:Be,encode_range:nt,decode_col:Pd,decode_row:Dd,split_cell:a3,decode_cell:ut,decode_range:Zt,format_cell:rn,sheet_add_aoa:kx,sheet_add_json:bw,sheet_add_dom:Rw,aoa_to_sheet:So,json_to_sheet:LD,table_to_sheet:Ow,table_to_book:gD,sheet_to_csv:Vd,sheet_to_txt:Iw,sheet_to_json:zl,sheet_to_html:Aw,sheet_to_formulae:MD,sheet_to_row_object_array:zl,sheet_get_cell:Ua,book_new:UD,book_append_sheet:HD,book_set_sheet_visibility:VD,cell_set_number_format:WD,cell_set_hyperlink:kw,cell_set_internal_link:zD,cell_add_comment:GD,sheet_set_array_formula:jD,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};function XD(e){if(e%1!==0){const t=Math.max(2,e.toString().split(".")[1].length),r=Math.min(4,t);if(e<1e3)return e.toFixed(r)||0}if(e>1e3){const t=Math.min(4,Math.floor(Math.log10(Math.abs(e))/3)),r=["","K","M","B","T"][t];return`${(e/10**(t*3)).toFixed(2)} ${r}`}return e}function Wd(e){return["date","day","time","timestamp","year"].some(t=>e.toLowerCase().includes(t))}function KD(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(var r=0;r{const i=YC(e.getValue(t),r);return n(i),i},qD=async({fileHandle:e,blob:t})=>{if(!e)throw new Error("Cannot access filesystem");await QD({fileHandle:e,blob:t})},QD=async({fileHandle:e,blob:t})=>{const r=await e.createWritable();await r.write(t),await r.close()},ZD=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}}],$w=({filename:e,is_image:t})=>{if("showSaveFilePicker"in window){const r={suggestedName:e,types:t?ZD:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(r)}return new Promise(r=>{r(null)})},Nw=(e,t,r)=>{try{qD({fileHandle:r,blob:e})}catch(n){console.error("oops, something went wrong!",n);const i=URL.createObjectURL(e),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",t),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o)}},qg=(e,t,r)=>{const n=t,i=r.map(l=>n.map(u=>l[u])),o=[n,...i];if(e==="csv"){const l=o.map(f=>f.join(",")).join(` -`),u=new Blob([l],{type:"text/csv;charset=utf-8;"}),c=`${window.title}.csv`;$w({filename:c}).then(f=>{Nw(u,c,f)});return}const a=Pc.book_new(),s=Pc.aoa_to_sheet(o);Pc.book_append_sheet(a,s,"Sheet1"),kD(a,`${window.title}.xlsx`)},JD=e=>{const t=document.getElementById(e),r=`${window.title}.png`;$w({filename:r,is_image:!0}).then(n=>{r4.toBlob(t).then(function(i){Nw(i,r,n)})})},Mw=v.createContext({dragDropManager:void 0});function tr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Qg=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ic=function(){return Math.random().toString(36).substring(7).split("").join(".")},Zg={INIT:"@@redux/INIT"+Ic(),REPLACE:"@@redux/REPLACE"+Ic(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ic()}};function eP(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Lw(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(tr(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(tr(1));return r(Lw)(e,t)}if(typeof e!="function")throw new Error(tr(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(tr(3));return o}function f(p){if(typeof p!="function")throw new Error(tr(4));if(l)throw new Error(tr(5));var g=!0;return u(),s.push(p),function(){if(g){if(l)throw new Error(tr(6));g=!1,u();var w=s.indexOf(p);s.splice(w,1),a=null}}}function d(p){if(!eP(p))throw new Error(tr(7));if(typeof p.type>"u")throw new Error(tr(8));if(l)throw new Error(tr(9));try{l=!0,o=i(o,p)}finally{l=!1}for(var g=a=s,x=0;xn&&n[i]?n[i]:r||null,e)}function nP(e,t){return e.filter(r=>r!==t)}function Bw(e){return typeof e=="object"}function iP(e,t){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function oP(e,t){return e.filter(r=>t.indexOf(r)>-1)}const zd="dnd-core/INIT_COORDS",Cu="dnd-core/BEGIN_DRAG",Gd="dnd-core/PUBLISH_DRAG_SOURCE",Au="dnd-core/HOVER",Ru="dnd-core/DROP",Ou="dnd-core/END_DRAG";function Jg(e,t){return{type:zd,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const aP={type:zd,payload:{clientOffset:null,sourceClientOffset:null}};function sP(e){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,s=e.getMonitor(),l=e.getRegistry();e.dispatch(Jg(o)),lP(r,s,l);const u=fP(r,s);if(u==null){e.dispatch(aP);return}let c=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");uP(a),c=a(u)}e.dispatch(Jg(o,c));const d=l.getSource(u).beginDrag(s,u);if(d==null)return;cP(d),l.pinSource(u);const h=l.getSourceType(u);return{type:Cu,payload:{itemType:h,item:d,sourceId:u,clientOffset:o||null,sourceClientOffset:c||null,isSourcePublic:!!i}}}}function lP(e,t,r){Fe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){Fe(r.getSource(n),"Expected sourceIds to be registered.")})}function uP(e){Fe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function cP(e){Fe(Bw(e),"Item must be an object.")}function fP(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function dP(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hP(e){for(var t=1;t{const l=mP(a,s,i,n),u={type:Ru,payload:{dropResult:hP({},r,l)}};e.dispatch(u)})}}function gP(e){Fe(e.isDragging(),"Cannot call drop while not dragging."),Fe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function mP(e,t,r,n){const i=r.getTarget(e);let o=i?i.drop(n,e):void 0;return vP(o),typeof o>"u"&&(o=t===0?{}:n.getDropResult()),o}function vP(e){Fe(typeof e>"u"||Bw(e),"Drop result must either be an object or undefined.")}function xP(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function wP(e){return function(){const r=e.getMonitor(),n=e.getRegistry();yP(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:Ou}}}function yP(e){Fe(e.isDragging(),"Cannot call endDrag while not dragging.")}function Kf(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function EP(e){return function(r,{clientOffset:n}={}){_P(r);const i=r.slice(0),o=e.getMonitor(),a=e.getRegistry(),s=o.getItemType();return TP(i,a,s),SP(i,o,a),CP(i,o,a),{type:Au,payload:{targetIds:i,clientOffset:n||null}}}}function _P(e){Fe(Array.isArray(e),"Expected targetIds to be an array.")}function SP(e,t,r){Fe(t.isDragging(),"Cannot call hover while not dragging."),Fe(!t.didDrop(),"Cannot call hover after drop.");for(let n=0;n=0;n--){const i=e[n],o=t.getTargetType(i);Kf(o,r)||e.splice(n,1)}}function CP(e,t,r){e.forEach(function(n){r.getTarget(n).hover(t,n)})}function AP(e){return function(){if(e.getMonitor().isDragging())return{type:Gd}}}function RP(e){return{beginDrag:sP(e),publishDragSource:AP(e),hover:EP(e),drop:pP(e),endDrag:wP(e)}}class OP{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const s=o.apply(t,a);typeof s<"u"&&r(s)}}const i=RP(this);return Object.keys(i).reduce((o,a)=>{const s=i[a];return o[a]=n(s),o},{})}dispatch(t){this.store.dispatch(t)}constructor(t,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}}function FP(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Uw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function DP(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return!t||!r||!n?null:Uw(FP(t,n),r)}function PP(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:Uw(t,r)}const xa=[],jd=[];xa.__IS_NONE__=!0;jd.__IS_ALL__=!0;function IP(e,t){return e===xa?!1:e===jd||typeof t>"u"?!0:oP(t,e).length>0}class bP{subscribeToStateChange(t,r={}){const{handlerIds:n}=r;Fe(typeof t=="function","listener must be a function."),Fe(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),s=a.stateId;try{s===i||s===i+1&&!IP(a.dirtyHandlerIds,n)||t()}finally{i=s}};return this.store.subscribe(o)}subscribeToOffsetChange(t){Fe(typeof t=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,t())};return this.store.subscribe(n)}canDragSource(t){if(!t)return!1;const r=this.registry.getSource(t);return Fe(r,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:r.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const r=this.registry.getTarget(t);if(Fe(r,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(t),i=this.getItemType();return Kf(n,i)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(Fe(r,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(t),i=this.getItemType();return n!==i?!1:r.isDragging(this,t)}isOverTarget(t,r={shallow:!1}){if(!t)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(t),o=this.getItemType();if(o&&!Kf(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const s=a.indexOf(t);return n?s===a.length-1:s>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return DP(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return PP(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const e1=typeof global<"u"?global:self,Hw=e1.MutationObserver||e1.WebKitMutationObserver;function Vw(e){return function(){const r=setTimeout(i,0),n=setInterval(i,50);function i(){clearTimeout(r),clearInterval(n),e()}}}function kP(e){let t=1;const r=new Hw(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const $P=typeof Hw=="function"?kP:Vw;class NP{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.indexthis.capacity){for(let n=0,i=t.length-this.index;n{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=$P(this.flush),this.requestErrorThrow=Vw(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class MP{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class LP{create(t){const r=this.freeTasks,n=r.length?r.pop():new MP(this.onError,i=>r[r.length]=i);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const Ww=new NP,BP=new LP(Ww.registerPendingError);function UP(e){Ww.enqueueTask(BP.create(e))}const Xd="dnd-core/ADD_SOURCE",Kd="dnd-core/ADD_TARGET",Yd="dnd-core/REMOVE_SOURCE",Fu="dnd-core/REMOVE_TARGET";function HP(e){return{type:Xd,payload:{sourceId:e}}}function VP(e){return{type:Kd,payload:{targetId:e}}}function WP(e){return{type:Yd,payload:{sourceId:e}}}function zP(e){return{type:Fu,payload:{targetId:e}}}function GP(e){Fe(typeof e.canDrag=="function","Expected canDrag to be a function."),Fe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Fe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function jP(e){Fe(typeof e.canDrop=="function","Expected canDrop to be a function."),Fe(typeof e.hover=="function","Expected hover to be a function."),Fe(typeof e.drop=="function","Expected beginDrag to be a function.")}function Yf(e,t){if(t&&Array.isArray(e)){e.forEach(r=>Yf(r,!1));return}Fe(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var or;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(or||(or={}));let XP=0;function KP(){return XP++}function YP(e){const t=KP().toString();switch(e){case or.SOURCE:return`S${t}`;case or.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function t1(e){switch(e[0]){case"S":return or.SOURCE;case"T":return or.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function r1(e,t){const r=e.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===t)return!0;n=!!i}while(!n);return!1}class qP{addSource(t,r){Yf(t),GP(r);const n=this.addHandler(or.SOURCE,t,r);return this.store.dispatch(HP(n)),n}addTarget(t,r){Yf(t,!0),jP(r);const n=this.addHandler(or.TARGET,t,r);return this.store.dispatch(VP(n)),n}containsHandler(t){return r1(this.dragSources,t)||r1(this.dropTargets,t)}getSource(t,r=!1){return Fe(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return Fe(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return Fe(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return Fe(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return t1(t)===or.SOURCE}isTargetId(t){return t1(t)===or.TARGET}removeSource(t){Fe(this.getSource(t),"Expected an existing source."),this.store.dispatch(WP(t)),UP(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){Fe(this.getTarget(t),"Expected an existing target."),this.store.dispatch(zP(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);Fe(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){Fe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,n){const i=YP(t);return this.types.set(i,r),t===or.SOURCE?this.dragSources.set(i,n):t===or.TARGET&&this.dropTargets.set(i,n),i}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const QP=(e,t)=>e===t;function ZP(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function JP(e,t,r=QP){if(e.length!==t.length)return!1;for(let n=0;n0||!JP(r,n)))return xa;const a=n[n.length-1],s=r[r.length-1];return a!==s&&(a&&i.push(a),s&&i.push(s)),i}function tI(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rI(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function gI(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,o;for(o=0;o=0)&&(r[i]=e[i]);return r}let i1=0;const el=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var mI=v.memo(function(t){var{children:r}=t,n=pI(t,["children"]);const[i,o]=vI(n);return v.useEffect(()=>{if(o){const a=zw();return++i1,()=>{--i1===0&&(a[el]=null)}}},[]),q(Mw.Provider,{value:i,children:r})});function vI(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=xI(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function xI(e,t=zw(),r,n){const i=t;return i[el]||(i[el]={dragDropManager:dI(e,t,r,n)}),i[el]}function zw(){return typeof global<"u"?global:window}var wI=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r};const li=typeof window<"u"?v.useLayoutEffect:v.useEffect;function yI(e,t,r){const[n,i]=v.useState(()=>t(e)),o=v.useCallback(()=>{const a=t(e);wI(n,a)||(i(a),r&&r())},[n,e,r]);return li(o),[n,o]}function EI(e,t,r){const[n,i]=yI(e,t,r);return li(function(){const a=e.getHandlerId();if(a!=null)return e.subscribeToStateChange(i,{handlerIds:[a]})},[e,i]),n}function Gw(e,t,r){return EI(t,e||(()=>({})),()=>r.reconnect())}function jw(e,t){const r=[...t||[]];return t==null&&typeof e!="function"&&r.push(e),v.useMemo(()=>typeof e=="function"?e():e,r)}function _I(e){return v.useMemo(()=>e.hooks.dragSource(),[e])}function SI(e){return v.useMemo(()=>e.hooks.dragPreview(),[e])}let bc=!1,kc=!1;class TI{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){Fe(!bc,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return bc=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{bc=!1}}isDragging(){if(!this.sourceId)return!1;Fe(!kc,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return kc=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{kc=!1}}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,r){return this.internalMonitor.isOverTarget(t,r)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let $c=!1;class CI{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;Fe(!$c,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return $c=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{$c=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function AI(e,t,r){const n=r.getRegistry(),i=n.addTarget(e,t);return[i,()=>n.removeTarget(i)]}function RI(e,t,r){const n=r.getRegistry(),i=n.addSource(e,t);return[i,()=>n.removeSource(i)]}function qf(e,t,r,n){let i=r?r.call(n,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let l=0;l, or turn it into a drag source or a drop target itself.`)}function FI(e){return(t=null,r=null)=>{if(!v.isValidElement(t)){const o=t;return e(o,r),o}const n=t;return OI(n),DI(n,r?o=>e(o,r):e)}}function Xw(e){const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const i=FI(n);t[r]=()=>i}}),t}function o1(e,t){typeof e=="function"?e(t):e.current=t}function DI(e,t){const r=e.ref;return Fe(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?v.cloneElement(e,{ref:n=>{o1(r,n),o1(t,n)}}):v.cloneElement(e,{ref:t})}class PI{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,r=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return r&&this.disconnectDragSource(),this.handlerId?t?(r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),r):(this.lastConnectedDragSource=t,r):r}reconnectDragPreview(t=!1){const r=this.dragPreview,n=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!qf(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!qf(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=Xw({dragSource:(r,n)=>{this.clearDragSource(),this.dragSourceOptions=n||null,Qf(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,n)=>{this.clearDragPreview(),this.dragPreviewOptions=n||null,Qf(r)?this.dragPreviewRef=r:this.dragPreviewNode=r,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class II{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const r=this.dropTarget;if(this.handlerId){if(!r){this.lastConnectedDropTarget=r;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=r,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,r,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!qf(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=Xw({dropTarget:(r,n)=>{this.clearDropTarget(),this.dropTargetOptions=n,Qf(r)?this.dropTargetRef=r:this.dropTargetNode=r,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function Ao(){const{dragDropManager:e}=v.useContext(Mw);return Fe(e!=null,"Expected drag drop context"),e}function bI(e,t){const r=Ao(),n=v.useMemo(()=>new PI(r.getBackend()),[r]);return li(()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource()),[n,e]),li(()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview()),[n,t]),n}function kI(){const e=Ao();return v.useMemo(()=>new TI(e),[e])}class $I{beginDrag(){const t=this.spec,r=this.monitor;let n=null;return typeof t.item=="object"?n=t.item:typeof t.item=="function"?n=t.item(r):n={},n??null}canDrag(){const t=this.spec,r=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(r):!0}isDragging(t,r){const n=this.spec,i=this.monitor,{isDragging:o}=n;return o?o(i):r===t.getSourceId()}endDrag(){const t=this.spec,r=this.monitor,n=this.connector,{end:i}=t;i&&i(r.getItem(),r),n.reconnect()}constructor(t,r,n){this.spec=t,this.monitor=r,this.connector=n}}function NI(e,t,r){const n=v.useMemo(()=>new $I(e,t,r),[t,r]);return v.useEffect(()=>{n.spec=e},[e]),n}function MI(e){return v.useMemo(()=>{const t=e.type;return Fe(t!=null,"spec.type must be defined"),t},[e])}function LI(e,t,r){const n=Ao(),i=NI(e,t,r),o=MI(e);li(function(){if(o!=null){const[s,l]=RI(o,i,n);return t.receiveHandlerId(s),r.receiveHandlerId(s),l}},[n,t,r,i,o])}function BI(e,t){const r=jw(e,t);Fe(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=kI(),i=bI(r.options,r.previewOptions);return LI(r,n,i),[Gw(r.collect,n,i),_I(i),SI(i)]}function UI(e){return v.useMemo(()=>e.hooks.dropTarget(),[e])}function HI(e){const t=Ao(),r=v.useMemo(()=>new II(t.getBackend()),[t]);return li(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function VI(){const e=Ao();return v.useMemo(()=>new CI(e),[e])}function WI(e){const{accept:t}=e;return v.useMemo(()=>(Fe(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class zI{canDrop(){const t=this.spec,r=this.monitor;return t.canDrop?t.canDrop(r.getItem(),r):!0}hover(){const t=this.spec,r=this.monitor;t.hover&&t.hover(r.getItem(),r)}drop(){const t=this.spec,r=this.monitor;if(t.drop)return t.drop(r.getItem(),r)}constructor(t,r){this.spec=t,this.monitor=r}}function GI(e,t){const r=v.useMemo(()=>new zI(e,t),[t]);return v.useEffect(()=>{r.spec=e},[e]),r}function jI(e,t,r){const n=Ao(),i=GI(e,t),o=WI(e);li(function(){const[s,l]=AI(o,i,n);return t.receiveHandlerId(s),r.receiveHandlerId(s),l},[n,t,i,r,o.map(a=>a.toString()).join("|")])}function XI(e,t){const r=jw(e,t),n=VI(),i=HI(r.options);return jI(r,n,i),[Gw(r.collect,n,i),UI(i)]}function KI(e,t){return v.useReducer((r,n)=>{const i=t[r][n];return i??r},e)}const Ei=e=>{const{present:t,children:r}=e,n=YI(t),i=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),o=He(n.ref,i.ref);return typeof r=="function"||n.isPresent?v.cloneElement(i,{ref:o}):null};Ei.displayName="Presence";function YI(e){const[t,r]=v.useState(),n=v.useRef({}),i=v.useRef(e),o=v.useRef("none"),a=e?"mounted":"unmounted",[s,l]=KI(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=ks(n.current);o.current=s==="mounted"?u:"none"},[s]),xt(()=>{const u=n.current,c=i.current;if(c!==e){const d=o.current,h=ks(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),xt(()=>{if(t){const u=f=>{const h=ks(n.current).includes(f.animationName);f.target===t&&h&&Jr.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(o.current=ks(n.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:v.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function ks(e){return(e==null?void 0:e.animationName)||"none"}const Nc="rovingFocusGroup.onEntryFocus",qI={bubbles:!1,cancelable:!0},qd="RovingFocusGroup",[Zf,Kw,QI]=su(qd),[ZI,Yw]=on(qd,[QI]),[JI,e5]=ZI(qd),t5=v.forwardRef((e,t)=>v.createElement(Zf.Provider,{scope:e.__scopeRovingFocusGroup},v.createElement(Zf.Slot,{scope:e.__scopeRovingFocusGroup},v.createElement(r5,de({},e,{ref:t}))))),r5=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,...c}=e,f=v.useRef(null),d=He(t,f),h=ud(o),[m=null,p]=lo({prop:a,defaultProp:s,onChange:l}),[g,x]=v.useState(!1),w=Dt(u),y=Kw(r),_=v.useRef(!1),[k,N]=v.useState(0);return v.useEffect(()=>{const S=f.current;if(S)return S.addEventListener(Nc,w),()=>S.removeEventListener(Nc,w)},[w]),v.createElement(JI,{scope:r,orientation:n,dir:h,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(S=>p(S),[p]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(S=>S+1),[]),onFocusableItemRemove:v.useCallback(()=>N(S=>S-1),[])},v.createElement(Ie.div,de({tabIndex:g||k===0?-1:0,"data-orientation":n},c,{ref:d,style:{outline:"none",...e.style},onMouseDown:Ee(e.onMouseDown,()=>{_.current=!0}),onFocus:Ee(e.onFocus,S=>{const A=!_.current;if(S.target===S.currentTarget&&A&&!g){const R=new CustomEvent(Nc,qI);if(S.currentTarget.dispatchEvent(R),!R.defaultPrevented){const L=y().filter(re=>re.focusable),V=L.find(re=>re.active),U=L.find(re=>re.id===m),Y=[V,U,...L].filter(Boolean).map(re=>re.ref.current);qw(Y)}}_.current=!1}),onBlur:Ee(e.onBlur,()=>x(!1))})))}),n5="RovingFocusGroupItem",i5=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,...a}=e,s=Xr(),l=o||s,u=e5(n5,r),c=u.currentTabStopId===l,f=Kw(r),{onFocusableItemAdd:d,onFocusableItemRemove:h}=u;return v.useEffect(()=>{if(n)return d(),()=>h()},[n,d,h]),v.createElement(Zf.ItemSlot,{scope:r,id:l,focusable:n,active:i},v.createElement(Ie.span,de({tabIndex:c?0:-1,"data-orientation":u.orientation},a,{ref:t,onMouseDown:Ee(e.onMouseDown,m=>{n?u.onItemFocus(l):m.preventDefault()}),onFocus:Ee(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Ee(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){u.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const p=s5(m,u.orientation,u.dir);if(p!==void 0){m.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(p==="last")x.reverse();else if(p==="prev"||p==="next"){p==="prev"&&x.reverse();const w=x.indexOf(m.currentTarget);x=u.loop?l5(x,w+1):x.slice(w+1)}setTimeout(()=>qw(x))}})})))}),o5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function a5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function s5(e,t,r){const n=a5(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return o5[n]}function qw(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function l5(e,t){return e.map((r,n)=>e[(t+n)%e.length])}const u5=t5,c5=i5,f5=["Enter"," "],d5=["ArrowDown","PageUp","Home"],Qw=["ArrowUp","PageDown","End"],h5=[...d5,...Qw],Du="Menu",[Jf,p5,g5]=su(Du),[_i,Pu]=on(Du,[g5,fu,Yw]),Qd=fu(),Zw=Yw(),[m5,ns]=_i(Du),[v5,Zd]=_i(Du),x5=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:o,modal:a=!0}=e,s=Qd(t),[l,u]=v.useState(null),c=v.useRef(!1),f=Dt(o),d=ud(i);return v.useEffect(()=>{const h=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),v.createElement(Nv,s,v.createElement(m5,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:u},v.createElement(v5,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:c,dir:d,modal:a},n)))},w5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=Qd(r);return v.createElement(Mv,de({},i,n,{ref:t}))}),Jw="MenuPortal",[y5,E5]=_i(Jw,{forceMount:void 0}),_5=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,o=ns(Jw,t);return v.createElement(y5,{scope:t,forceMount:r},v.createElement(Ei,{present:r||o.open},v.createElement(du,{asChild:!0,container:i},n)))},Rn="MenuContent",[S5,e2]=_i(Rn),T5=v.forwardRef((e,t)=>{const r=E5(Rn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=ns(Rn,e.__scopeMenu),a=Zd(Rn,e.__scopeMenu);return v.createElement(Jf.Provider,{scope:e.__scopeMenu},v.createElement(Ei,{present:n||o.open},v.createElement(Jf.Slot,{scope:e.__scopeMenu},a.modal?v.createElement(C5,de({},i,{ref:t})):v.createElement(A5,de({},i,{ref:t})))))}),C5=v.forwardRef((e,t)=>{const r=ns(Rn,e.__scopeMenu),n=v.useRef(null),i=He(t,n);return v.useEffect(()=>{const o=n.current;if(o)return vd(o)},[]),v.createElement(t2,de({},e,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)}))}),A5=v.forwardRef((e,t)=>{const r=ns(Rn,e.__scopeMenu);return v.createElement(t2,de({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)}))}),t2=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:d,onDismiss:h,disableOutsideScroll:m,...p}=e,g=ns(Rn,r),x=Zd(Rn,r),w=Qd(r),y=Zw(r),_=p5(r),[k,N]=v.useState(null),S=v.useRef(null),A=He(t,S,g.onContentChange),R=v.useRef(0),L=v.useRef(""),V=v.useRef(0),U=v.useRef(null),W=v.useRef("right"),Y=v.useRef(0),re=m?xd:v.Fragment,ye=m?{as:ii,allowPinchZoom:!0}:void 0,ge=ie=>{var we,Z;const F=L.current+ie,M=_().filter(ee=>!ee.disabled),b=document.activeElement,T=(we=M.find(ee=>ee.ref.current===b))===null||we===void 0?void 0:we.textValue,B=M.map(ee=>ee.textValue),H=M5(B,F,T),Q=(Z=M.find(ee=>ee.textValue===H))===null||Z===void 0?void 0:Z.ref.current;(function ee(K){L.current=K,window.clearTimeout(R.current),K!==""&&(R.current=window.setTimeout(()=>ee(""),1e3))})(F),Q&&setTimeout(()=>Q.focus())};v.useEffect(()=>()=>window.clearTimeout(R.current),[]),fd();const Se=v.useCallback(ie=>{var we,Z;return W.current===((we=U.current)===null||we===void 0?void 0:we.side)&&B5(ie,(Z=U.current)===null||Z===void 0?void 0:Z.area)},[]);return v.createElement(S5,{scope:r,searchRef:L,onItemEnter:v.useCallback(ie=>{Se(ie)&&ie.preventDefault()},[Se]),onItemLeave:v.useCallback(ie=>{var we;Se(ie)||((we=S.current)===null||we===void 0||we.focus(),N(null))},[Se]),onTriggerLeave:v.useCallback(ie=>{Se(ie)&&ie.preventDefault()},[Se]),pointerGraceTimerRef:V,onPointerGraceIntentChange:v.useCallback(ie=>{U.current=ie},[])},v.createElement(re,ye,v.createElement(dd,{asChild:!0,trapped:i,onMountAutoFocus:Ee(o,ie=>{var we;ie.preventDefault(),(we=S.current)===null||we===void 0||we.focus()}),onUnmountAutoFocus:a},v.createElement(lu,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:d,onDismiss:h},v.createElement(u5,de({asChild:!0},y,{dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:N,onEntryFocus:Ee(l,ie=>{x.isUsingKeyboardRef.current||ie.preventDefault()})}),v.createElement(Lv,de({role:"menu","aria-orientation":"vertical","data-state":k5(g.open),"data-radix-menu-content":"",dir:x.dir},w,p,{ref:A,style:{outline:"none",...p.style},onKeyDown:Ee(p.onKeyDown,ie=>{const Z=ie.target.closest("[data-radix-menu-content]")===ie.currentTarget,F=ie.ctrlKey||ie.altKey||ie.metaKey,M=ie.key.length===1;Z&&(ie.key==="Tab"&&ie.preventDefault(),!F&&M&&ge(ie.key));const b=S.current;if(ie.target!==b||!h5.includes(ie.key))return;ie.preventDefault();const B=_().filter(H=>!H.disabled).map(H=>H.ref.current);Qw.includes(ie.key)&&B.reverse(),$5(B)}),onBlur:Ee(e.onBlur,ie=>{ie.currentTarget.contains(ie.target)||(window.clearTimeout(R.current),L.current="")}),onPointerMove:Ee(e.onPointerMove,t0(ie=>{const we=ie.target,Z=Y.current!==ie.clientX;if(ie.currentTarget.contains(we)&&Z){const F=ie.clientX>Y.current?"right":"left";W.current=F,Y.current=ie.clientX}}))})))))))}),R5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return v.createElement(Ie.div,de({role:"group"},n,{ref:t}))}),O5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return v.createElement(Ie.div,de({},n,{ref:t}))}),e0="MenuItem",a1="menu.itemSelect",F5=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,o=v.useRef(null),a=Zd(e0,e.__scopeMenu),s=e2(e0,e.__scopeMenu),l=He(t,o),u=v.useRef(!1),c=()=>{const f=o.current;if(!r&&f){const d=new CustomEvent(a1,{bubbles:!0,cancelable:!0});f.addEventListener(a1,h=>n==null?void 0:n(h),{once:!0}),cd(f,d),d.defaultPrevented?u.current=!1:a.onClose()}};return v.createElement(D5,de({},i,{ref:l,disabled:r,onClick:Ee(e.onClick,c),onPointerDown:f=>{var d;(d=e.onPointerDown)===null||d===void 0||d.call(e,f),u.current=!0},onPointerUp:Ee(e.onPointerUp,f=>{var d;u.current||(d=f.currentTarget)===null||d===void 0||d.click()}),onKeyDown:Ee(e.onKeyDown,f=>{const d=s.searchRef.current!=="";r||d&&f.key===" "||f5.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),D5=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...o}=e,a=e2(e0,r),s=Zw(r),l=v.useRef(null),u=He(t,l),[c,f]=v.useState(!1),[d,h]=v.useState("");return v.useEffect(()=>{const m=l.current;if(m){var p;h(((p=m.textContent)!==null&&p!==void 0?p:"").trim())}},[o.children]),v.createElement(Jf.ItemSlot,{scope:r,disabled:n,textValue:i??d},v.createElement(c5,de({asChild:!0},s,{focusable:!n}),v.createElement(Ie.div,de({role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0},o,{ref:u,onPointerMove:Ee(e.onPointerMove,t0(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus())})),onPointerLeave:Ee(e.onPointerLeave,t0(m=>a.onItemLeave(m))),onFocus:Ee(e.onFocus,()=>f(!0)),onBlur:Ee(e.onBlur,()=>f(!1))}))))}),P5="MenuRadioGroup";_i(P5,{value:void 0,onValueChange:()=>{}});const I5="MenuItemIndicator";_i(I5,{checked:!1});const b5="MenuSub";_i(b5);function k5(e){return e?"open":"closed"}function $5(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function N5(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function M5(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let a=N5(e,Math.max(o,0));i.length===1&&(a=a.filter(u=>u!==r));const l=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}function L5(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,a=t.length-1;on!=c>n&&r<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function B5(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return L5(r,t)}function t0(e){return t=>t.pointerType==="mouse"?e(t):void 0}const r2=x5,n2=w5,i2=_5,o2=T5,U5=R5,H5=O5,V5=F5,a2="ContextMenu",[W5,Uk]=on(a2,[Pu]),Iu=Pu(),[z5,s2]=W5(a2),G5=e=>{const{__scopeContextMenu:t,children:r,onOpenChange:n,dir:i,modal:o=!0}=e,[a,s]=v.useState(!1),l=Iu(t),u=Dt(n),c=v.useCallback(f=>{s(f),u(f)},[u]);return v.createElement(z5,{scope:t,open:a,onOpenChange:c,modal:o},v.createElement(r2,de({},l,{dir:i,open:a,onOpenChange:c,modal:o}),r))},j5="ContextMenuTrigger",X5=v.forwardRef((e,t)=>{const{__scopeContextMenu:r,disabled:n=!1,...i}=e,o=s2(j5,r),a=Iu(r),s=v.useRef({x:0,y:0}),l=v.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=v.useRef(0),c=v.useCallback(()=>window.clearTimeout(u.current),[]),f=d=>{s.current={x:d.clientX,y:d.clientY},o.onOpenChange(!0)};return v.useEffect(()=>c,[c]),v.useEffect(()=>void(n&&c()),[n,c]),v.createElement(v.Fragment,null,v.createElement(n2,de({},a,{virtualRef:l})),v.createElement(Ie.span,de({"data-state":o.open?"open":"closed","data-disabled":n?"":void 0},i,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Ee(e.onContextMenu,d=>{c(),f(d),d.preventDefault()}),onPointerDown:n?e.onPointerDown:Ee(e.onPointerDown,$s(d=>{c(),u.current=window.setTimeout(()=>f(d),700)})),onPointerMove:n?e.onPointerMove:Ee(e.onPointerMove,$s(c)),onPointerCancel:n?e.onPointerCancel:Ee(e.onPointerCancel,$s(c)),onPointerUp:n?e.onPointerUp:Ee(e.onPointerUp,$s(c))})))}),K5=e=>{const{__scopeContextMenu:t,...r}=e,n=Iu(t);return v.createElement(i2,de({},n,r))},Y5="ContextMenuContent",q5=v.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,i=s2(Y5,r),o=Iu(r),a=v.useRef(!1);return v.createElement(o2,de({},o,n,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:s=>{var l;(l=e.onCloseAutoFocus)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&a.current&&s.preventDefault(),a.current=!1},onInteractOutside:s=>{var l;(l=e.onInteractOutside)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&!i.modal&&(a.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))});function $s(e){return t=>t.pointerType!=="mouse"?e(t):void 0}const Q5=G5,Z5=X5,J5=K5,e8=q5;function t8({column:e,table:t,numberOfColumns:r}){const n=t.getPreFilteredRowModel().flatRows.map(u=>u.getValue(e.id)),i=n.every(u=>typeof u=="string"||u===null),o=n.every(u=>typeof u=="number"||u===null),a=n.some(u=>typeof u=="string"&&u.includes(" ")),s=e.getFilterValue();if(n.every(u=>typeof u!="string"?!1:u.replace(/[^0-9]/g,"").length>=4&&(Wd(e.id)||e.id.toLowerCase()==="index"&&!a))){let u=function(c){if(!c)return null;const f=new Date(c),d=f.getFullYear(),h=f.getMonth()+1>9?f.getMonth()+1:`0${f.getMonth()+1}`,m=f.getDate()>9?f.getDate():`0${f.getDate()}`;return`${d}-${h}-${m}`};return Te("div",{className:"flex gap-2 h-10",children:[q("input",{type:"datetime-local",value:u(s==null?void 0:s[0])??"",onChange:c=>{const f=new Date(c.target.value).getTime();e.setFilterValue(d=>[f,d==null?void 0:d[1]])},placeholder:"Start date",className:"_input"}),q("input",{type:"datetime-local",value:u(s==null?void 0:s[1])??"",onChange:c=>{const f=new Date(c.target.value).getTime();e.setFilterValue(d=>[d==null?void 0:d[0],f])},placeholder:"End date",className:"_input"})]})}return o?Te("div",{className:"flex gap-0.5 h-10",children:[q("input",{type:"number",value:(s==null?void 0:s[0])??"",onChange:u=>e.setFilterValue(c=>[u.target.value,c==null?void 0:c[1]]),placeholder:"Min",className:"_input p-0.5"}),q("input",{type:"number",value:(s==null?void 0:s[1])??"",onChange:u=>e.setFilterValue(c=>[c==null?void 0:c[0],u.target.value]),placeholder:"Max",className:"_input p-0.5"})]}):i?q("div",{className:"h-10",children:q("input",{type:"text",value:s??"",onChange:u=>e.setFilterValue(u.target.value),placeholder:"Search...",className:"_input"})}):q("div",{className:"h-10"})}const r8=(e,t,r)=>(r.splice(r.indexOf(t),0,r.splice(r.indexOf(e),1)[0]),[...r]),n8=({header:e,table:t,advanced:r,idx:n,lockFirstColumn:i,setLockFirstColumn:o})=>{const{getState:a,setColumnOrder:s}=t,{columnOrder:l}=a(),{column:u}=e,[,c]=XI({accept:"column",drop:p=>{const g=r8(p.id,u.id,l);s(g)}}),[{isDragging:f},d,h]=BI({collect:p=>({isDragging:p.isDragging()}),item:()=>u,type:"column"}),m=()=>q("div",{ref:h,className:"flex gap-1 flex-col",children:e.isPlaceholder?null:Te($1,{children:[Te("div",{className:"font-bold uppercase text-grey-700 dark:text-white tracking-widest flex gap-2 whitespace-nowrap justify-between",children:[Te("div",{onClick:u.getToggleSortingHandler(),className:bt("flex gap-1",{"cursor-pointer select-none":u.getCanSort()}),children:[bf(u.columnDef.header,e.getContext()),u.getCanSort()&&Te("div",{className:"flex flex-col gap-0.5 items-center justify-center",children:[q("button",{className:bt({"text-[#669DCB]":u.getIsSorted()==="asc","text-grey-600":u.getIsSorted()!=="asc"}),children:q("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"4",fill:"none",viewBox:"0 0 11 5",children:q("path",{fill:"currentColor",d:"M10.333 5l-5-5-5 5"})})}),q("button",{className:bt({"text-[#669DCB]":e.column.getIsSorted()==="desc","text-grey-600":e.column.getIsSorted()!=="desc"}),children:q("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"4",fill:"none",viewBox:"0 0 11 5",children:q("path",{fill:"currentColor",d:"M.333 0l5 5 5-5"})})})]})]}),r&&u.id!=="select"&&q("button",{ref:d,className:"text-grey-600 hover:text-grey-800 dark:hover:text-white",children:q("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",fill:"none",viewBox:"0 0 17 16",children:q("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M3.667 6l-2 2 2 2M6.333 3.333l2-2 2 2M10.333 12.667l-2 2-2-2M13 6l2 2-2 2M1.667 8H15M8.333 1.333v13.334"})})})]}),r&&u.getCanFilter()?q("div",{children:q(t8,{column:u,table:t,numberOfColumns:l.length})}):null]})});return Te("th",{className:bt("h-[70px] p-4 sticky",{"left-0 z-50 bg-white dark:bg-grey-900":n===0&&i}),colSpan:e.colSpan,style:{width:e.getSize(),opacity:f?.5:1},ref:c,children:[n===0?Te(Q5,{children:[q(Z5,{asChild:!0,children:m()}),q(J5,{children:q(e8,{className:"bg-white text-black dark:text-white dark:bg-grey-900 border border-grey-200 dark:border-grey-800 rounded-md shadow-lg p-2 z-50 text-xs",children:q("div",{className:"flex flex-col gap-2",children:Te("button",{onClick:()=>{o(!i)},className:"hover:bg-grey-300 dark:hover:bg-grey-800 rounded-md p-2",children:[i?"Unlock":"Lock"," first column"]})})})})]}):m(),q("button",{className:"resizer bg-grey-300/20 dark:hover:bg-white absolute top-0 right-0 w-0.5 h-full",onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler()})]})};function l2(e){return typeof e!="number"?typeof e=="string"&&e.includes("All")?e:o0:e<1?o0:e}function i8({table:e,currentPage:t,setCurrentPage:r}){const n=e.getFilteredRowModel().rows.length;return Te("div",{className:"hidden md:flex items-center gap-8",children:[q(Vi,{value:t,onChange:i=>{const o=l2(i);r(o),o.toString().includes("All")?e.setPageSize(n):e.setPageSize(o)},labelType:"row",label:"Rows per page",placeholder:"Select rows per page",groups:[{label:"Rows per page",items:[10,20,30,40,50,`All (${n})`].map(i=>({label:`${i}`,value:i}))}]}),Te("span",{className:"flex items-center gap-1",children:[q("strong",{children:e.getState().pagination.pageIndex+1}),"of",q("strong",{children:e.getPageCount()})]}),Te("div",{className:"hidden lg:block",children:[q("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanPreviousPage(),"dark:text-white":e.getCanPreviousPage()}),onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:"<<"}),q("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanPreviousPage(),"dark:text-white":e.getCanPreviousPage()}),onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:"<"}),q("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanNextPage(),"dark:text-white":e.getCanNextPage()}),onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:">"}),q("button",{className:bt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanNextPage(),"dark:text-white":e.getCanNextPage()}),onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:">>"})]})]})}function o8({columns:e,data:t,type:r,setType:n}){const i=()=>{switch(r){case"csv":qg("csv",e,t);break;case"xlsx":qg("xlsx",e,t);break;case"png":JD("table");break}};return Te("div",{className:"flex gap-6 items-center",children:[q(Vi,{labelType:"row",value:r,onChange:o=>{n(o)},label:"Type",placeholder:"Select type",groups:[{label:"Type",items:a0.map(o=>({label:o,value:o}))}]}),q("button",{onClick:i,className:"_btn",children:"Export"})]})}const u2="DropdownMenu",[a8,Hk]=on(u2,[Pu]),Si=Pu(),[s8,c2]=a8(u2),l8=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=Si(t),u=v.useRef(null),[c=!1,f]=lo({prop:i,defaultProp:o,onChange:a});return v.createElement(s8,{scope:t,triggerId:Xr(),triggerRef:u,contentId:Xr(),open:c,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(d=>!d),[f]),modal:s},v.createElement(r2,de({},l,{open:c,onOpenChange:f,dir:n,modal:s}),r))},u8="DropdownMenuTrigger",c8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,o=c2(u8,r),a=Si(r);return v.createElement(n2,de({asChild:!0},a),v.createElement(Ie.button,de({type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n},i,{ref:ld(t,o.triggerRef),onPointerDown:Ee(e.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(o.onOpenToggle(),o.open||s.preventDefault())}),onKeyDown:Ee(e.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&o.onOpenToggle(),s.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})))}),f8=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Si(t);return v.createElement(i2,de({},n,r))},d8="DropdownMenuContent",h8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=c2(d8,r),o=Si(r),a=v.useRef(!1);return v.createElement(o2,de({id:i.contentId,"aria-labelledby":i.triggerId},o,n,{ref:t,onCloseAutoFocus:Ee(e.onCloseAutoFocus,s=>{var l;a.current||(l=i.triggerRef.current)===null||l===void 0||l.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:Ee(e.onInteractOutside,s=>{const l=s.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;(!i.modal||c)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),p8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(U5,de({},i,n,{ref:t}))}),g8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(H5,de({},i,n,{ref:t}))}),m8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(V5,de({},i,n,{ref:t}))}),v8=l8,s1=c8,x8=f8,w8=h8,y8=p8,E8=g8,Mc=m8;function _8(e,t){v.useEffect(()=>{const r=n=>{!e.current||e.current.contains(n.target)||t(n)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}},[e,t])}function l1({label:e,table:t,onlyIconTrigger:r=!1}){const[n,i]=v.useState(!1),o=v.useRef(null);_8(o,()=>i(!1)),v.useEffect(()=>{const s=l=>{l.key==="Escape"&&i(!1)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[]);function a(){t.resetColumnFilters(),i(!1)}return Te(v8,{open:n,children:[r?q(s1,{title:"Filter columns",onClick:()=>i(!n),children:q("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-7 h-7",children:q("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"})})}):Te(y8,{className:"flex flex-row items-center gap-2",children:[q(E8,{className:"whitespace-nowrap",children:e}),Te(s1,{onClick:()=>i(!n),className:"bg-white text-black dark:bg-grey-900 dark:text-white whitespace-nowrap h-[36px] border-[1.5px] border-grey-700 rounded p-3 inline-flex items-center justify-center leading-none gap-[5px] shadow-[0_2px_10px] shadow-black/10 focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-white outline-none","aria-label":e,children:[q("span",{children:"Filter columns"}),q(Vf,{className:bt({"transform rotate-180 duration-200 transition":n})})]})]}),q(x8,{children:Te(w8,{sideOffset:10,ref:o,className:"z-50 bg-white/80 dark:bg-grey-900/80 backdrop-filter backdrop-blur flex flex-col gap-4 overflow-auto border-[1.5px] border-grey-700 rounded p-3 max-h-[500px] text-black dark:text-white",children:[q(Mc,{children:q("button",{className:"_btn w-full",onClick:a,children:"Clear Filters"})}),q(Mc,{children:Te("label",{className:"flex items-center gap-2",children:[q("input",{type:"checkbox",checked:t.getIsAllColumnsVisible(),onChange:t.getToggleAllColumnsVisibilityHandler()}),"Toggle All"]})}),t.getAllLeafColumns().filter(s=>s.id!=="select").map(s=>q(Mc,{children:Te("label",{className:"flex items-center gap-2",children:[q("input",{type:"checkbox",checked:s.getIsVisible(),onChange:s.getToggleVisibilityHandler()}),s.id]})},s.id))]})})]})}var Gl={},S8={get exports(){return Gl},set exports(e){Gl=e}},qe={},fo={},T8={get exports(){return fo},set exports(e){fo=e}},Ti={};function f2(){var e={};return e["align-content"]=!1,e["align-items"]=!1,e["align-self"]=!1,e["alignment-adjust"]=!1,e["alignment-baseline"]=!1,e.all=!1,e["anchor-point"]=!1,e.animation=!1,e["animation-delay"]=!1,e["animation-direction"]=!1,e["animation-duration"]=!1,e["animation-fill-mode"]=!1,e["animation-iteration-count"]=!1,e["animation-name"]=!1,e["animation-play-state"]=!1,e["animation-timing-function"]=!1,e.azimuth=!1,e["backface-visibility"]=!1,e.background=!0,e["background-attachment"]=!0,e["background-clip"]=!0,e["background-color"]=!0,e["background-image"]=!0,e["background-origin"]=!0,e["background-position"]=!0,e["background-repeat"]=!0,e["background-size"]=!0,e["baseline-shift"]=!1,e.binding=!1,e.bleed=!1,e["bookmark-label"]=!1,e["bookmark-level"]=!1,e["bookmark-state"]=!1,e.border=!0,e["border-bottom"]=!0,e["border-bottom-color"]=!0,e["border-bottom-left-radius"]=!0,e["border-bottom-right-radius"]=!0,e["border-bottom-style"]=!0,e["border-bottom-width"]=!0,e["border-collapse"]=!0,e["border-color"]=!0,e["border-image"]=!0,e["border-image-outset"]=!0,e["border-image-repeat"]=!0,e["border-image-slice"]=!0,e["border-image-source"]=!0,e["border-image-width"]=!0,e["border-left"]=!0,e["border-left-color"]=!0,e["border-left-style"]=!0,e["border-left-width"]=!0,e["border-radius"]=!0,e["border-right"]=!0,e["border-right-color"]=!0,e["border-right-style"]=!0,e["border-right-width"]=!0,e["border-spacing"]=!0,e["border-style"]=!0,e["border-top"]=!0,e["border-top-color"]=!0,e["border-top-left-radius"]=!0,e["border-top-right-radius"]=!0,e["border-top-style"]=!0,e["border-top-width"]=!0,e["border-width"]=!0,e.bottom=!1,e["box-decoration-break"]=!0,e["box-shadow"]=!0,e["box-sizing"]=!0,e["box-snap"]=!0,e["box-suppress"]=!0,e["break-after"]=!0,e["break-before"]=!0,e["break-inside"]=!0,e["caption-side"]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e["clip-path"]=!1,e["clip-rule"]=!1,e.color=!0,e["color-interpolation-filters"]=!0,e["column-count"]=!1,e["column-fill"]=!1,e["column-gap"]=!1,e["column-rule"]=!1,e["column-rule-color"]=!1,e["column-rule-style"]=!1,e["column-rule-width"]=!1,e["column-span"]=!1,e["column-width"]=!1,e.columns=!1,e.contain=!1,e.content=!1,e["counter-increment"]=!1,e["counter-reset"]=!1,e["counter-set"]=!1,e.crop=!1,e.cue=!1,e["cue-after"]=!1,e["cue-before"]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e["display-inside"]=!0,e["display-list"]=!0,e["display-outside"]=!0,e["dominant-baseline"]=!1,e.elevation=!1,e["empty-cells"]=!1,e.filter=!1,e.flex=!1,e["flex-basis"]=!1,e["flex-direction"]=!1,e["flex-flow"]=!1,e["flex-grow"]=!1,e["flex-shrink"]=!1,e["flex-wrap"]=!1,e.float=!1,e["float-offset"]=!1,e["flood-color"]=!1,e["flood-opacity"]=!1,e["flow-from"]=!1,e["flow-into"]=!1,e.font=!0,e["font-family"]=!0,e["font-feature-settings"]=!0,e["font-kerning"]=!0,e["font-language-override"]=!0,e["font-size"]=!0,e["font-size-adjust"]=!0,e["font-stretch"]=!0,e["font-style"]=!0,e["font-synthesis"]=!0,e["font-variant"]=!0,e["font-variant-alternates"]=!0,e["font-variant-caps"]=!0,e["font-variant-east-asian"]=!0,e["font-variant-ligatures"]=!0,e["font-variant-numeric"]=!0,e["font-variant-position"]=!0,e["font-weight"]=!0,e.grid=!1,e["grid-area"]=!1,e["grid-auto-columns"]=!1,e["grid-auto-flow"]=!1,e["grid-auto-rows"]=!1,e["grid-column"]=!1,e["grid-column-end"]=!1,e["grid-column-start"]=!1,e["grid-row"]=!1,e["grid-row-end"]=!1,e["grid-row-start"]=!1,e["grid-template"]=!1,e["grid-template-areas"]=!1,e["grid-template-columns"]=!1,e["grid-template-rows"]=!1,e["hanging-punctuation"]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e["image-orientation"]=!1,e["image-resolution"]=!1,e["ime-mode"]=!1,e["initial-letters"]=!1,e["inline-box-align"]=!1,e["justify-content"]=!1,e["justify-items"]=!1,e["justify-self"]=!1,e.left=!1,e["letter-spacing"]=!0,e["lighting-color"]=!0,e["line-box-contain"]=!1,e["line-break"]=!1,e["line-grid"]=!1,e["line-height"]=!1,e["line-snap"]=!1,e["line-stacking"]=!1,e["line-stacking-ruby"]=!1,e["line-stacking-shift"]=!1,e["line-stacking-strategy"]=!1,e["list-style"]=!0,e["list-style-image"]=!0,e["list-style-position"]=!0,e["list-style-type"]=!0,e.margin=!0,e["margin-bottom"]=!0,e["margin-left"]=!0,e["margin-right"]=!0,e["margin-top"]=!0,e["marker-offset"]=!1,e["marker-side"]=!1,e.marks=!1,e.mask=!1,e["mask-box"]=!1,e["mask-box-outset"]=!1,e["mask-box-repeat"]=!1,e["mask-box-slice"]=!1,e["mask-box-source"]=!1,e["mask-box-width"]=!1,e["mask-clip"]=!1,e["mask-image"]=!1,e["mask-origin"]=!1,e["mask-position"]=!1,e["mask-repeat"]=!1,e["mask-size"]=!1,e["mask-source-type"]=!1,e["mask-type"]=!1,e["max-height"]=!0,e["max-lines"]=!1,e["max-width"]=!0,e["min-height"]=!0,e["min-width"]=!0,e["move-to"]=!1,e["nav-down"]=!1,e["nav-index"]=!1,e["nav-left"]=!1,e["nav-right"]=!1,e["nav-up"]=!1,e["object-fit"]=!1,e["object-position"]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e["outline-color"]=!1,e["outline-offset"]=!1,e["outline-style"]=!1,e["outline-width"]=!1,e.overflow=!1,e["overflow-wrap"]=!1,e["overflow-x"]=!1,e["overflow-y"]=!1,e.padding=!0,e["padding-bottom"]=!0,e["padding-left"]=!0,e["padding-right"]=!0,e["padding-top"]=!0,e.page=!1,e["page-break-after"]=!1,e["page-break-before"]=!1,e["page-break-inside"]=!1,e["page-policy"]=!1,e.pause=!1,e["pause-after"]=!1,e["pause-before"]=!1,e.perspective=!1,e["perspective-origin"]=!1,e.pitch=!1,e["pitch-range"]=!1,e["play-during"]=!1,e.position=!1,e["presentation-level"]=!1,e.quotes=!1,e["region-fragment"]=!1,e.resize=!1,e.rest=!1,e["rest-after"]=!1,e["rest-before"]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e["rotation-point"]=!1,e["ruby-align"]=!1,e["ruby-merge"]=!1,e["ruby-position"]=!1,e["shape-image-threshold"]=!1,e["shape-outside"]=!1,e["shape-margin"]=!1,e.size=!1,e.speak=!1,e["speak-as"]=!1,e["speak-header"]=!1,e["speak-numeral"]=!1,e["speak-punctuation"]=!1,e["speech-rate"]=!1,e.stress=!1,e["string-set"]=!1,e["tab-size"]=!1,e["table-layout"]=!1,e["text-align"]=!0,e["text-align-last"]=!0,e["text-combine-upright"]=!0,e["text-decoration"]=!0,e["text-decoration-color"]=!0,e["text-decoration-line"]=!0,e["text-decoration-skip"]=!0,e["text-decoration-style"]=!0,e["text-emphasis"]=!0,e["text-emphasis-color"]=!0,e["text-emphasis-position"]=!0,e["text-emphasis-style"]=!0,e["text-height"]=!0,e["text-indent"]=!0,e["text-justify"]=!0,e["text-orientation"]=!0,e["text-overflow"]=!0,e["text-shadow"]=!0,e["text-space-collapse"]=!0,e["text-transform"]=!0,e["text-underline-position"]=!0,e["text-wrap"]=!0,e.top=!1,e.transform=!1,e["transform-origin"]=!1,e["transform-style"]=!1,e.transition=!1,e["transition-delay"]=!1,e["transition-duration"]=!1,e["transition-property"]=!1,e["transition-timing-function"]=!1,e["unicode-bidi"]=!1,e["vertical-align"]=!1,e.visibility=!1,e["voice-balance"]=!1,e["voice-duration"]=!1,e["voice-family"]=!1,e["voice-pitch"]=!1,e["voice-range"]=!1,e["voice-rate"]=!1,e["voice-stress"]=!1,e["voice-volume"]=!1,e.volume=!1,e["white-space"]=!1,e.widows=!1,e.width=!0,e["will-change"]=!1,e["word-break"]=!0,e["word-spacing"]=!0,e["word-wrap"]=!0,e["wrap-flow"]=!1,e["wrap-through"]=!1,e["writing-mode"]=!1,e["z-index"]=!1,e}function C8(e,t,r){}function A8(e,t,r){}var R8=/javascript\s*\:/img;function O8(e,t){return R8.test(t)?"":t}Ti.whiteList=f2();Ti.getDefaultWhiteList=f2;Ti.onAttr=C8;Ti.onIgnoreAttr=A8;Ti.safeAttrValue=O8;var F8={indexOf:function(e,t){var r,n;if(Array.prototype.indexOf)return e.indexOf(t);for(r=0,n=e.length;r/g,z8=/"/g,G8=/"/g,j8=/&#([a-zA-Z0-9]*);?/gim,X8=/:?/gim,K8=/&newline;?/gim,Ms=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,c1=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,f1=/u\s*r\s*l\s*\(.*/gi;function m2(e){return e.replace(z8,""")}function v2(e){return e.replace(G8,'"')}function x2(e){return e.replace(j8,function(r,n){return n[0]==="x"||n[0]==="X"?String.fromCharCode(parseInt(n.substr(1),16)):String.fromCharCode(parseInt(n,10))})}function w2(e){return e.replace(X8,":").replace(K8," ")}function y2(e){for(var t="",r=0,n=e.length;r",n);if(i===-1)break;r=i+3}return t}function Z8(e){var t=e.split("");return t=t.filter(function(r){var n=r.charCodeAt(0);return n===127?!1:n<=31?n===10||n===13:!0}),t.join("")}qe.whiteList=h2();qe.getDefaultWhiteList=h2;qe.onTag=M8;qe.onIgnoreTag=L8;qe.onTagAttr=B8;qe.onIgnoreTagAttr=U8;qe.safeAttrValue=H8;qe.escapeHtml=g2;qe.escapeQuote=m2;qe.unescapeQuote=v2;qe.escapeHtmlEntities=x2;qe.escapeDangerHtml5Entities=w2;qe.clearNonPrintableCharacter=y2;qe.friendlyAttrValue=E2;qe.escapeAttrValue=_2;qe.onIgnoreTagStripAll=Y8;qe.StripTagBody=q8;qe.stripCommentTag=Q8;qe.stripBlankChar=Z8;qe.cssFilter=p2;qe.getDefaultCSSWhiteList=N8;var bu={},cn=Jd;function J8(e){var t=cn.spaceIndex(e),r;return t===-1?r=e.slice(1,-1):r=e.slice(1,t+1),r=cn.trim(r).toLowerCase(),r.slice(0,1)==="/"&&(r=r.slice(1)),r.slice(-1)==="/"&&(r=r.slice(0,-1)),r}function eb(e){return e.slice(0,2)===""||s===l-1){n+=r(e.slice(i,o)),c=e.slice(o,s+1),u=J8(c),n+=t(o,n.length,u,c,eb(c)),i=s+1,o=!1;continue}if(f==='"'||f==="'")for(var d=1,h=e.charAt(s-d);h.trim()===""||h==="=";){if(h==="="){a=f;continue e}h=e.charAt(s-++d)}}else if(f===a){a=!1;continue}}return i0;t--){var r=e[t];if(r!==" ")return r==="="?t:-1}}function sb(e){return e[0]==='"'&&e[e.length-1]==='"'||e[0]==="'"&&e[e.length-1]==="'"}function d1(e){return sb(e)?e.substr(1,e.length-2):e}bu.parseTag=tb;bu.parseAttr=nb;var lb=fo.FilterCSS,xr=qe,S2=bu,ub=S2.parseTag,cb=S2.parseAttr,tl=Jd;function Ls(e){return e==null}function fb(e){var t=tl.spaceIndex(e);if(t===-1)return{html:"",closing:e[e.length-2]==="/"};e=tl.trim(e.slice(t+1,-1));var r=e[e.length-1]==="/";return r&&(e=tl.trim(e.slice(0,-1))),{html:e,closing:r}}function db(e){var t={};for(var r in e)t[r]=e[r];return t}function hb(e){var t={};for(var r in e)Array.isArray(e[r])?t[r.toLowerCase()]=e[r].map(function(n){return n.toLowerCase()}):t[r.toLowerCase()]=e[r];return t}function T2(e){e=db(e||{}),e.stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=xr.onIgnoreTagStripAll),e.whiteList||e.allowList?e.whiteList=hb(e.whiteList||e.allowList):e.whiteList=xr.whiteList,e.onTag=e.onTag||xr.onTag,e.onTagAttr=e.onTagAttr||xr.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||xr.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||xr.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||xr.safeAttrValue,e.escapeHtml=e.escapeHtml||xr.escapeHtml,this.options=e,e.css===!1?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new lb(e.css))}T2.prototype.process=function(e){if(e=e||"",e=e.toString(),!e)return"";var t=this,r=t.options,n=r.whiteList,i=r.onTag,o=r.onIgnoreTag,a=r.onTagAttr,s=r.onIgnoreTagAttr,l=r.safeAttrValue,u=r.escapeHtml,c=t.cssFilter;r.stripBlankChar&&(e=xr.stripBlankChar(e)),r.allowCommentTag||(e=xr.stripCommentTag(e));var f=!1;r.stripIgnoreTagBody&&(f=xr.StripTagBody(r.stripIgnoreTagBody,o),o=f.onIgnoreTag);var d=ub(e,function(h,m,p,g,x){var w={sourcePosition:h,position:m,isClosing:x,isWhite:Object.prototype.hasOwnProperty.call(n,p)},y=i(p,g,w);if(!Ls(y))return y;if(w.isWhite){if(w.isClosing)return"";var _=fb(g),k=n[p],N=cb(_.html,function(S,A){var R=tl.indexOf(k,S)!==-1,L=a(p,S,A,R);return Ls(L)?R?(A=l(p,S,A,c),A?S+'="'+A+'"':S):(L=s(p,S,A,R),Ls(L)?void 0:L):L});return g="<"+p,N&&(g+=" "+N),_.closing&&(g+=" /"),g+=">",g}else return y=o(p,g,w),Ls(y)?u(g):y},u);return f&&(d=f.remove(d)),d};var pb=T2;(function(e,t){var r=qe,n=bu,i=pb;function o(s,l){var u=new i(l);return u.process(s)}t=e.exports=o,t.filterXSS=o,t.FilterXSS=i,function(){for(var s in r)t[s]=r[s];for(var l in n)t[l]=n[l]}(),typeof window<"u"&&(window.filterXSS=e.exports);function a(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}a()&&(self.filterXSS=e.exports)})(S8,Gl);const gb=Gl;function jo(e,t,r){const[n,i]=v.useState(()=>{if(typeof window>"u")return t;try{const a=window.localStorage.getItem(e);return a?r?r(JSON.parse(a)):JSON.parse(a):t}catch(a){return console.log(a),t}});return[n,a=>{try{const s=a instanceof Function?a(n):a;i(s),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(s))}catch(s){console.log(s)}}]}const C2="ToastProvider",[eh,mb,vb]=su("Toast"),[A2,Vk]=on("Toast",[vb]),[xb,ku]=A2(C2),R2=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:a}=e,[s,l]=v.useState(null),[u,c]=v.useState(0),f=v.useRef(!1),d=v.useRef(!1);return v.createElement(eh.Provider,{scope:t},v.createElement(xb,{scope:t,label:r,duration:n,swipeDirection:i,swipeThreshold:o,toastCount:u,viewport:s,onViewportChange:l,onToastAdd:v.useCallback(()=>c(h=>h+1),[]),onToastRemove:v.useCallback(()=>c(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:d},a))};R2.propTypes={label(e){if(e.label&&typeof e.label=="string"&&!e.label.trim()){const t=`Invalid prop \`label\` supplied to \`${C2}\`. Expected non-empty \`string\`.`;return new Error(t)}return null}};const wb="ToastViewport",yb=["F8"],r0="toast.viewportPause",n0="toast.viewportResume",Eb=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=yb,label:i="Notifications ({hotkey})",...o}=e,a=ku(wb,r),s=mb(r),l=v.useRef(null),u=v.useRef(null),c=v.useRef(null),f=v.useRef(null),d=He(t,f,a.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=a.toastCount>0;v.useEffect(()=>{const g=x=>{var w;n.every(_=>x[_]||x.code===_)&&((w=f.current)===null||w===void 0||w.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]),v.useEffect(()=>{const g=l.current,x=f.current;if(m&&g&&x){const w=()=>{if(!a.isClosePausedRef.current){const N=new CustomEvent(r0);x.dispatchEvent(N),a.isClosePausedRef.current=!0}},y=()=>{if(a.isClosePausedRef.current){const N=new CustomEvent(n0);x.dispatchEvent(N),a.isClosePausedRef.current=!1}},_=N=>{!g.contains(N.relatedTarget)&&y()},k=()=>{g.contains(document.activeElement)||y()};return g.addEventListener("focusin",w),g.addEventListener("focusout",_),g.addEventListener("pointermove",w),g.addEventListener("pointerleave",k),window.addEventListener("blur",w),window.addEventListener("focus",y),()=>{g.removeEventListener("focusin",w),g.removeEventListener("focusout",_),g.removeEventListener("pointermove",w),g.removeEventListener("pointerleave",k),window.removeEventListener("blur",w),window.removeEventListener("focus",y)}}},[m,a.isClosePausedRef]);const p=v.useCallback(({tabbingDirection:g})=>{const w=s().map(y=>{const _=y.ref.current,k=[_,...Lb(_)];return g==="forwards"?k:k.reverse()});return(g==="forwards"?w.reverse():w).flat()},[s]);return v.useEffect(()=>{const g=f.current;if(g){const x=w=>{const y=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!y){const A=document.activeElement,R=w.shiftKey;if(w.target===g&&R){var k;(k=u.current)===null||k===void 0||k.focus();return}const U=p({tabbingDirection:R?"backwards":"forwards"}),W=U.findIndex(Y=>Y===A);if(Lc(U.slice(W+1)))w.preventDefault();else{var N,S;R?(N=u.current)===null||N===void 0||N.focus():(S=c.current)===null||S===void 0||S.focus()}}};return g.addEventListener("keydown",x),()=>g.removeEventListener("keydown",x)}},[s,p]),v.createElement(TS,{ref:l,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:m?void 0:"none"}},m&&v.createElement(h1,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});Lc(g)}}),v.createElement(eh.Slot,{scope:r},v.createElement(Ie.ol,de({tabIndex:-1},o,{ref:d}))),m&&v.createElement(h1,{ref:c,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});Lc(g)}}))}),_b="ToastFocusProxy",h1=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...i}=e,o=ku(_b,r);return v.createElement(md,de({"aria-hidden":!0,tabIndex:0},i,{ref:t,style:{position:"fixed"},onFocus:a=>{var s;const l=a.relatedTarget;!((s=o.viewport)!==null&&s!==void 0&&s.contains(l))&&n()}}))}),$u="Toast",Sb="toast.swipeStart",Tb="toast.swipeMove",Cb="toast.swipeCancel",Ab="toast.swipeEnd",Rb=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:i,onOpenChange:o,...a}=e,[s=!0,l]=lo({prop:n,defaultProp:i,onChange:o});return v.createElement(Ei,{present:r||s},v.createElement(O2,de({open:s},a,{ref:t,onClose:()=>l(!1),onPause:Dt(e.onPause),onResume:Dt(e.onResume),onSwipeStart:Ee(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ee(e.onSwipeMove,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:Ee(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ee(e.onSwipeEnd,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})))}),[Ob,Fb]=A2($u,{onClose(){}}),O2=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:i,open:o,onClose:a,onEscapeKeyDown:s,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:f,onSwipeCancel:d,onSwipeEnd:h,...m}=e,p=ku($u,r),[g,x]=v.useState(null),w=He(t,Y=>x(Y)),y=v.useRef(null),_=v.useRef(null),k=i||p.duration,N=v.useRef(0),S=v.useRef(k),A=v.useRef(0),{onToastAdd:R,onToastRemove:L}=p,V=Dt(()=>{var Y;(g==null?void 0:g.contains(document.activeElement))&&((Y=p.viewport)===null||Y===void 0||Y.focus()),a()}),U=v.useCallback(Y=>{!Y||Y===1/0||(window.clearTimeout(A.current),N.current=new Date().getTime(),A.current=window.setTimeout(V,Y))},[V]);v.useEffect(()=>{const Y=p.viewport;if(Y){const re=()=>{U(S.current),u==null||u()},ye=()=>{const ge=new Date().getTime()-N.current;S.current=S.current-ge,window.clearTimeout(A.current),l==null||l()};return Y.addEventListener(r0,ye),Y.addEventListener(n0,re),()=>{Y.removeEventListener(r0,ye),Y.removeEventListener(n0,re)}}},[p.viewport,k,l,u,U]),v.useEffect(()=>{o&&!p.isClosePausedRef.current&&U(k)},[o,k,p.isClosePausedRef,U]),v.useEffect(()=>(R(),()=>L()),[R,L]);const W=v.useMemo(()=>g?P2(g):null,[g]);return p.viewport?v.createElement(v.Fragment,null,W&&v.createElement(Db,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0},W),v.createElement(Ob,{scope:r,onClose:V},Jr.createPortal(v.createElement(eh.ItemSlot,{scope:r},v.createElement(SS,{asChild:!0,onEscapeKeyDown:Ee(s,()=>{p.isFocusedToastEscapeKeyDownRef.current||V(),p.isFocusedToastEscapeKeyDownRef.current=!1})},v.createElement(Ie.li,de({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":p.swipeDirection},m,{ref:w,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ee(e.onKeyDown,Y=>{Y.key==="Escape"&&(s==null||s(Y.nativeEvent),Y.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,V()))}),onPointerDown:Ee(e.onPointerDown,Y=>{Y.button===0&&(y.current={x:Y.clientX,y:Y.clientY})}),onPointerMove:Ee(e.onPointerMove,Y=>{if(!y.current)return;const re=Y.clientX-y.current.x,ye=Y.clientY-y.current.y,ge=!!_.current,Se=["left","right"].includes(p.swipeDirection),ie=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,we=Se?ie(0,re):0,Z=Se?0:ie(0,ye),F=Y.pointerType==="touch"?10:2,M={x:we,y:Z},b={originalEvent:Y,delta:M};ge?(_.current=M,Bs(Tb,f,b,{discrete:!1})):p1(M,p.swipeDirection,F)?(_.current=M,Bs(Sb,c,b,{discrete:!1}),Y.target.setPointerCapture(Y.pointerId)):(Math.abs(re)>F||Math.abs(ye)>F)&&(y.current=null)}),onPointerUp:Ee(e.onPointerUp,Y=>{const re=_.current,ye=Y.target;if(ye.hasPointerCapture(Y.pointerId)&&ye.releasePointerCapture(Y.pointerId),_.current=null,y.current=null,re){const ge=Y.currentTarget,Se={originalEvent:Y,delta:re};p1(re,p.swipeDirection,p.swipeThreshold)?Bs(Ab,h,Se,{discrete:!0}):Bs(Cb,d,Se,{discrete:!0}),ge.addEventListener("click",ie=>ie.preventDefault(),{once:!0})}})})))),p.viewport))):null});O2.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){const t=`Invalid prop \`type\` supplied to \`${$u}\`. Expected \`foreground | background\`.`;return new Error(t)}return null}};const Db=e=>{const{__scopeToast:t,children:r,...n}=e,i=ku($u,t),[o,a]=v.useState(!1),[s,l]=v.useState(!1);return Nb(()=>a(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),s?null:v.createElement(du,{asChild:!0},v.createElement(md,n,o&&v.createElement(v.Fragment,null,i.label," ",r)))},Pb=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.createElement(Ie.div,de({},n,{ref:t}))}),Ib=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.createElement(Ie.div,de({},n,{ref:t}))}),bb="ToastAction",kb=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r?v.createElement(D2,{altText:r,asChild:!0},v.createElement(F2,de({},n,{ref:t}))):null});kb.propTypes={altText(e){return e.altText?null:new Error(`Missing prop \`altText\` expected on \`${bb}\``)}};const $b="ToastClose",F2=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,i=Fb($b,r);return v.createElement(D2,{asChild:!0},v.createElement(Ie.button,de({type:"button"},n,{ref:t,onClick:Ee(e.onClick,i.onClose)})))}),D2=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...i}=e;return v.createElement(Ie.div,de({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0},i,{ref:t}))});function P2(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),Mb(n)){const i=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const a=n.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...P2(n))}}),t}function Bs(e,t,r,{discrete:n}){const i=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?cd(i,o):i.dispatchEvent(o)}const p1=(e,t,r=0)=>{const n=Math.abs(e.x),i=Math.abs(e.y),o=n>i;return t==="left"||t==="right"?o&&n>r:!o&&i>r};function Nb(e=()=>{}){const t=Dt(e);xt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function Mb(e){return e.nodeType===e.ELEMENT_NODE}function Lb(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Lc(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}const Bb=R2,Ub=Eb,Hb=Rb,Vb=Pb,Wb=Ib,zb=F2,I2=({title:e,titleId:t,...r})=>q("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,...r,children:q("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Gb=({title:e,titleId:t,...r})=>Te("svg",{viewBox:"0 0 18 18",width:18,height:18,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?q("title",{id:t,children:e}):null,q("path",{d:"M9 16.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15ZM11.25 6.75l-4.5 4.5M6.75 6.75l4.5 4.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),jb=({title:e,titleId:t,...r})=>Te("svg",{viewBox:"0 0 24 24",width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?q("title",{id:t,children:e}):null,q("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM12 16v-4M12 8h.01",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),Xb=({title:e,titleId:t,...r})=>Te("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?q("title",{id:t,children:e}):null,q("path",{d:"M16.5 8.31V9a7.5 7.5 0 1 1-4.447-6.855",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),q("path",{d:"M16.5 3 9 10.508l-2.25-2.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),Kb=({title:e,titleId:t,...r})=>Te("svg",{viewBox:"0 0 18 18",width:18,height:18,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?q("title",{id:t,children:e}):null,q("path",{d:"M7.718 2.895 1.366 13.5a1.5 1.5 0 0 0 1.282 2.25h12.705a1.5 1.5 0 0 0 1.283-2.25L10.283 2.895a1.5 1.5 0 0 0-2.565 0v0ZM9 6.75v3M9 12.75h.008",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),Yb=({toast:e,open:t,setOpen:r})=>Te(Bb,{children:[Te(Hb,{open:t,onOpenChange:n=>{e.preventClose||r(n)},className:bt("z-50 fixed bottom-4 md:left-1/2 md:-translate-x-[50%] inset-x-4 w-auto shadow-lg md:max-w-[658px] duration-300","radix-state-open:animate-fade-in","radix-state-closed:animate-toast-hide","radix-swipe-end:animate-toast-swipe-out","translate-x-radix-toast-swipe-move-x","radix-swipe-cancel:translate-x-0 radix-swipe-cancel:duration-200 radix-swipe-cancel:ease-[ease]","px-[40px] md:px-[58px] py-6 flex flex-col border rounded-[4px]",{"bg-green-100 text-green-600 border-green-600":e.status==="success","bg-red-200 text-red-600 border-red-600":e.status==="error","bg-blue-100 text-blue-700 border-blue-600":e.status==="info","bg-orange-200 text-orange-600 border-orange-600":e.status==="warning"},{"h-[72px]":!e.description}),children:[e.status==="success"?q(Xb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):e.status==="warning"?q(Kb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):e.status==="error"?q(Gb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):q(jb,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}),q(Vb,{className:"text-grey-900 font-bold text-sm",children:e.title}),e.description&&q(Wb,{className:"mt-2 text-[10px] md:text-xs text-grey-800",children:e.description}),q(zb,{className:"absolute top-7 right-5 md:right-7",children:q(I2,{className:"w-4 h-4 text-grey-900"})})]}),q(Ub,{})]});function qb(e){const[t,r]=v.useState(e),n=t==="dark"?"light":"dark";return v.useEffect(()=>{const i=window.document.documentElement;i.classList.remove(n),i.classList.add(t)},[t,n]),[n,r]}const b2="Dialog",[k2,Wk]=on(b2),[Qb,$r]=k2(b2),Zb=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,s=v.useRef(null),l=v.useRef(null),[u=!1,c]=lo({prop:n,defaultProp:i,onChange:o});return v.createElement(Qb,{scope:t,triggerRef:s,contentRef:l,contentId:Xr(),titleId:Xr(),descriptionId:Xr(),open:u,onOpenChange:c,onOpenToggle:v.useCallback(()=>c(f=>!f),[c]),modal:a},r)},Jb="DialogTrigger",ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(Jb,r),o=He(t,i.triggerRef);return v.createElement(Ie.button,de({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":th(i.open)},n,{ref:o,onClick:Ee(e.onClick,i.onOpenToggle)}))}),$2="DialogPortal",[tk,N2]=k2($2,{forceMount:void 0}),rk=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,o=$r($2,t);return v.createElement(tk,{scope:t,forceMount:r},v.Children.map(n,a=>v.createElement(Ei,{present:r||o.open},v.createElement(du,{asChild:!0,container:i},a))))},i0="DialogOverlay",nk=v.forwardRef((e,t)=>{const r=N2(i0,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=$r(i0,e.__scopeDialog);return o.modal?v.createElement(Ei,{present:n||o.open},v.createElement(ik,de({},i,{ref:t}))):null}),ik=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(i0,r);return v.createElement(xd,{as:ii,allowPinchZoom:!0,shards:[i.contentRef]},v.createElement(Ie.div,de({"data-state":th(i.open)},n,{ref:t,style:{pointerEvents:"auto",...n.style}})))}),Ha="DialogContent",ok=v.forwardRef((e,t)=>{const r=N2(Ha,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=$r(Ha,e.__scopeDialog);return v.createElement(Ei,{present:n||o.open},o.modal?v.createElement(ak,de({},i,{ref:t})):v.createElement(sk,de({},i,{ref:t})))}),ak=v.forwardRef((e,t)=>{const r=$r(Ha,e.__scopeDialog),n=v.useRef(null),i=He(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return vd(o)},[]),v.createElement(M2,de({},e,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=r.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,o=>o.preventDefault())}))}),sk=v.forwardRef((e,t)=>{const r=$r(Ha,e.__scopeDialog),n=v.useRef(!1);return v.createElement(M2,de({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o;if((o=e.onCloseAutoFocus)===null||o===void 0||o.call(e,i),!i.defaultPrevented){var a;n.current||(a=r.triggerRef.current)===null||a===void 0||a.focus(),i.preventDefault()}n.current=!1},onInteractOutside:i=>{var o,a;(o=e.onInteractOutside)===null||o===void 0||o.call(e,i),i.defaultPrevented||(n.current=!0);const s=i.target;((a=r.triggerRef.current)===null||a===void 0?void 0:a.contains(s))&&i.preventDefault()}}))}),M2=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...a}=e,s=$r(Ha,r),l=v.useRef(null),u=He(t,l);return fd(),v.createElement(v.Fragment,null,v.createElement(dd,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o},v.createElement(lu,de({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":th(s.open)},a,{ref:u,onDismiss:()=>s.onOpenChange(!1)}))),!1)}),lk="DialogTitle",uk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(lk,r);return v.createElement(Ie.h2,de({id:i.titleId},n,{ref:t}))}),ck="DialogClose",fk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=$r(ck,r);return v.createElement(Ie.button,de({type:"button"},n,{ref:t,onClick:Ee(e.onClick,()=>i.onOpenChange(!1))}))});function th(e){return e?"open":"closed"}const dk=Zb,hk=ek,pk=rk,gk=nk,mk=ok,vk=uk,xk=fk,wk=new Date,yk=50,o0=30;function Ek(e,t){try{const r=e.hasOwnProperty("index")?"index":e.hasOwnProperty("Index")?"Index":null,n=r?e[r]:null,i=e[t],o=typeof i,s=(i==null?void 0:i.toString().replace(/[^0-9]/g,"")).length>=4&&(Wd(t)||t.toLowerCase()==="index"||n&&n&&typeof n=="string"&&(n.toLowerCase().includes("date")||n.toLowerCase().includes("day")||n.toLowerCase().includes("time")||n.toLowerCase().includes("timestamp")||n.toLowerCase().includes("year")||n.toLowerCase().includes("month")||n.toLowerCase().includes("week")||n.toLowerCase().includes("hour")||n.toLowerCase().includes("minute")));if(o==="string"&&i.startsWith("http"))return(i==null?void 0:i.toString().length)??0;if(s){if(typeof i=="string")return(i==null?void 0:i.toString().length)??0;try{const u=new Date(i);let c="";return u.getUTCHours()===0&&u.getUTCMinutes()===0&&u.getUTCSeconds()===0&&u.getMilliseconds()===0?c=u.toISOString().split("T")[0]:(c=u.toISOString(),c=c.split("T")[0]+" "+c.split("T")[1].split(".")[0]),(c==null?void 0:c.toString().length)??0}catch{return(i==null?void 0:i.toString().length)??0}}return(i==null?void 0:i.toString().length)??0}catch{return 0}}const a0=["csv","xlsx","png"];function _k({data:e,columns:t,title:r,initialTheme:n,cmd:i=""}){const[o,a]=jo("exportType",a0[0]),[s,l]=qb(n),[u,c]=v.useState(s==="dark"),f=T=>{l(s),c(T)},[d,h]=jo("rowsPerPage",o0,l2),[m,p]=jo("advanced",!1),[g,x]=jo("colors",!1),[w,y]=v.useState([]),[_,k]=v.useState(""),[N,S]=jo("fontSize","1"),[A,R]=v.useState(!1),L=t.reduce((T,B,H)=>(T[B]=H{const K=Math.max(...T.map(ve=>Ek(ve,B)),H.length+8);return Math.min(200,K*12)},Y=v.useMemo(()=>[...t.map((T,B)=>({accessorKey:T,id:T,header:T,size:W(e,T,T),footer:T,cell:({row:H})=>{var je;const Q=H.original.hasOwnProperty("index")?"index":H.original.hasOwnProperty("Index")?"Index":t[0],ee=Q?H.original[Q]:null,K=H.original[T],ve=typeof K,De=(K==null?void 0:K.toString().replace(/[^0-9]/g,"")).length>=4&&(Wd(T)||T.toLowerCase()==="index"||ee&&typeof ee=="string"&&(ee.toLowerCase().includes("date")||ee.toLowerCase().includes("time")||ee.toLowerCase().includes("timestamp")||ee.toLowerCase().includes("year")));if(ve==="string"&&K.startsWith("http"))return q("a",{className:"_hyper-link",href:K,target:"_blank",rel:"noreferrer",children:K.length>25?K.substring(0,25)+"...":K});if(De){if(typeof K=="string"){const Re=K.split("T")[0],ce=(je=K.split("T")[1])==null?void 0:je.split(".")[0];return ce==="00:00:00"?q("p",{children:Re}):Te("p",{children:[Re," ",ce]})}if(typeof K=="number"&&K<1e12)return q("p",{children:K});try{const Re=new Date(K);let ce="";return Re.getUTCHours()===0&&Re.getUTCMinutes()===0&&Re.getUTCSeconds()===0&&Re.getMilliseconds()===0?ce=Re.toISOString().split("T")[0]:(ce=Re.toISOString(),ce=ce.split("T")[0]+" "+ce.split("T")[1].split(".")[0]),q("p",{children:ce})}catch{return q("p",{children:K})}}if(ve==="number"){const Re=XD(K);return q("p",{className:bt("whitespace-nowrap",{"text-black dark:text-white":!g,"text-[#16A34A]":K>0&&g,"text-[#F87171]":K<0&&g,"text-[#404040]":K===0&&g}),children:K!==0?K>0?`${Re}`:`${Re}`:Re})}else if(ve==="string")return q("div",{dangerouslySetInnerHTML:{__html:gb(K)}});return q("p",{children:K})}}))],[m,g]),[re,ye]=v.useState(!1),[ge,Se]=v.useState(Y.map(T=>T.id)),ie=()=>Se(t.map(T=>T.id)),we=v.useMemo(()=>{const T=ge.map(H=>H),B=Y.map(H=>H.id);return!KD(T,B)},[ge,Y]),Z=uS({data:e,columns:Y,getCoreRowModel:Z_(),getSortedRowModel:nS(),getFilteredRowModel:rS(),getPaginationRowModel:oS(),columnResizeMode:"onChange",onColumnVisibilityChange:U,onColumnOrderChange:Se,onSortingChange:y,onGlobalFilterChange:k,globalFilterFn:YD,state:{sorting:w,globalFilter:_,columnOrder:ge,columnVisibility:V},initialState:{pagination:{pageIndex:0,pageSize:typeof d=="string"?d.includes("All")?e.length:parseInt(d):d}}}),F=v.useRef(null),{rows:M}=Z.getRowModel(),b=Z.getVisibleFlatColumns();return Te($1,{children:[q(Yb,{toast:{id:"max-columns",title:"Max 12 columns are visible by default",description:"You can change this by clicking on advanced and then top right 'Filter' button",status:"info"},open:A,setOpen:R}),Te("div",{ref:F,className:bt("overflow-x-hidden h-screen"),children:[Te("div",{className:"relative p-4",id:"table",children:[q("div",{className:"absolute -inset-0.5 bg-gradient-to-r rounded-md blur-md from-[#072e49]/30 via-[#0d345f]/30 to-[#0d3362]/30"}),Te("div",{className:"border border-grey-500/60 dark:border-grey-200/60 bg-white dark:bg-grey-900 rounded overflow-hidden relative z-20",children:[Te("div",{className:"_header relative gap-4 py-2 text-center text-xs flex items-center justify-between px-4 text-white",style:{fontSize:`${Number(N)*100}%`},children:[q("div",{className:"w-1/3",children:q("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"40",fill:"none",viewBox:"0 0 64 40",children:q("path",{fill:"#fff",d:"M61.283 3.965H33.608v27.757h25.699V19.826H37.561v-3.965H63.26V3.965h-1.977zM39.538 23.792h15.815v3.965H37.561v-3.965h1.977zM59.306 9.913v1.983H37.561V7.931h21.745v1.982zM33.606 0h-3.954v3.965H33.606V0zM25.7 3.966H0V15.86h25.7v3.965H3.953v11.896h25.7V3.966h-3.955zm0 21.808v1.983H7.907v-3.965h17.791v1.982zm0-15.86v1.982H3.953V7.931h21.745v1.982zM37.039 35.693v2.952l-.246-.246-.245-.245-.245-.247-.245-.246-.246-.246-.245-.245-.245-.247-.247-.246-.245-.246-.245-.246-.245-.246-.246-.246h-.49v3.936h.49v-3.198l.246.246.245.246.245.246.245.246.246.246.246.246.245.247.246.245.245.246.245.247.245.246.246.245.245.246h.245v-3.936h-.49zM44.938 37.17h-.491v-1.477h-2.944v3.937h3.93v-2.46h-.495zm-2.944-.246v-.739h1.962v.984h-1.962v-.245zm2.944.984v1.23h-2.944V37.66h2.944v.247zM52.835 37.17h-.49v-1.477h-2.946v3.937h3.925v-2.46h-.489zm-2.944-.246v-.739h1.963v.984h-1.965l.002-.245zm2.944.984v1.23H49.89V37.66h2.946v.247zM29.174 35.693H25.739v3.936H29.663v-.491H26.229v-.984h2.943v-.493H26.229v-1.476h3.434v-.492h-.489zM13.37 35.693H9.934v3.937h3.925v-3.937h-.49zm0 .738v2.709h-2.945v-2.955h2.943l.001.246zM21.276 35.693h-3.435v3.937h.491v-1.476h3.434v-2.461h-.49zm0 .738v1.23h-2.944v-1.476h2.944v.246z"})})}),q("p",{className:"font-bold w-1/3 flex flex-col gap-0.5 items-center",children:r}),Te("p",{className:"w-1/3 text-right text-xs",children:[new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"long"}).format(wk).replace(/:\d\d /," "),q("br",{}),q("span",{className:"text-grey-400",children:i})]})]}),q("div",{className:"overflow-auto max-h-[calc(100vh-160px)] smh:max-h-[calc(100vh-95px)]",children:Te("table",{className:"text-sm relative",style:{fontSize:`${Number(N)*100}%`},children:[q("thead",{className:"sticky top-0 bg-white dark:bg-grey-900",children:Z.getHeaderGroups().map((T,B)=>q("tr",{children:T.headers.map((H,Q)=>q(n8,{setLockFirstColumn:ye,lockFirstColumn:re,idx:Q,advanced:m,header:H,table:Z},H.id))},T.id))}),q("tbody",{children:Z.getRowModel().rows.map((T,B)=>q("tr",{className:"!h-[64px] border-b border-grey-400",children:T.getVisibleCells().map((H,Q)=>q("td",{className:bt("whitespace-normal p-4 text-black dark:text-white",{"bg-white dark:bg-grey-850":B%2===0,"bg-grey-100 dark:bg-[#202020]":B%2===1,"sticky left-0 z-10":Q===0&&re}),style:{width:H.column.getSize()},children:bf(H.column.columnDef.cell,H.getContext())},H.id))},T.id))}),M.length>30&&b.length>4&&q("tfoot",{children:Z.getFooterGroups().map(T=>q("tr",{children:T.headers.map(B=>q("th",{colSpan:B.colSpan,className:"text-grey-500 bg-grey-100 dark:bg-grey-850 font-normal text-left text-sm h-10 p-4",style:{width:B.getSize()},children:B.isPlaceholder?null:bf(B.column.columnDef.footer,B.getContext())},B.id))},T.id))})]})})]})]}),Te("div",{className:"smh:hidden flex max-h-[68px] overflow-x-auto bg-white/70 dark:bg-grey-900/70 backdrop-filter backdrop-blur z-20 bottom-0 left-0 w-full gap-10 justify-between py-4 px-4 text-sm",children:[Te("div",{className:"flex items-center gap-10",children:[Te(dk,{children:[q(hk,{className:"_btn",children:"Settings"}),Te(pk,{children:[q(gk,{className:"_modal-overlay"}),Te(mk,{className:"_modal",children:[q(xk,{className:"absolute top-[40px] right-[46px] text-grey-200 hover:text-white rounded-[4px] focus:outline focus:outline-2 focus:outline-grey-500",children:q(I2,{className:"w-6 h-6"})}),q(vk,{className:"uppercase font-bold tracking-widest",children:"Settings"}),Te("div",{className:"grid grid-cols-2 gap-4 mt-10 text-sm",children:[we&&q("button",{onClick:()=>ie(),className:"_btn h-9",children:"Reset Order"}),q(Vi,{labelType:"row",value:u?"light":"dark",onChange:T=>{f(T!=="dark")},label:"Theme",placeholder:"Select theme",groups:[{label:"Theme",items:[{label:"Dark",value:"dark"},{label:"Light",value:"light"}]}]}),q(Vi,{labelType:"row",value:o,onChange:T=>{a(T)},label:"Export type",placeholder:"Select export type",groups:[{label:"Export type",items:a0.map(T=>({label:T,value:T}))}]}),q(Vi,{labelType:"row",value:N,onChange:S,label:"Font size",placeholder:"Select font size",groups:[{label:"Font size",items:[{label:"50%",value:"0.5"},{label:"75%",value:"0.75"},{label:"100%",value:"1"},{label:"125%",value:"1.25"},{label:"150%",value:"1.5"},{label:"175%",value:"1.75"},{label:"200%",value:"2"}]}]}),q(l1,{table:Z,label:"Filter"}),q("div",{className:"flex gap-2 items-center",children:q(Vi,{labelType:"row",value:m?"advanced":"simple",onChange:T=>{p(T==="advanced")},label:"Type",placeholder:"Select type",groups:[{label:"Type",items:[{label:"Simple",value:"simple"},{label:"Advanced",value:"advanced"}]}]})}),Te("div",{className:"flex gap-2 items-center",children:[q("label",{htmlFor:"colors",children:"Colors"}),q("input",{id:"colors",type:"checkbox",checked:g,onChange:()=>x(!g)})]})]})]})]})]}),q(l1,{onlyIconTrigger:!0,table:Z,label:""})]}),q(i8,{currentPage:d,setCurrentPage:h,table:Z}),q(o8,{setType:a,type:o,columns:t,data:e})]})]})]})}function L2(e){let t=null;return()=>(t==null&&(t=e()),t)}function Sk(e,t){return e.filter(r=>r!==t)}function Tk(e,t){const r=new Set,n=o=>r.add(o);e.forEach(n),t.forEach(n);const i=[];return r.forEach(o=>i.push(o)),i}class Ck{enter(t){const r=this.entered.length,n=i=>this.isNodeInDocument(i)&&(!i.contains||i.contains(t));return this.entered=Tk(this.entered.filter(n),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=Sk(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class Ak{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const r={};Object.keys(this.config.exposeProperties).forEach(n=>{const i=this.config.exposeProperties[n];i!=null&&(r[n]={value:i(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,r)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,r){return r===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const B2="__NATIVE_FILE__",U2="__NATIVE_URL__",H2="__NATIVE_TEXT__",V2="__NATIVE_HTML__",g1=Object.freeze(Object.defineProperty({__proto__:null,FILE:B2,HTML:V2,TEXT:H2,URL:U2},Symbol.toStringTag,{value:"Module"}));function Bc(e,t,r){const n=t.reduce((i,o)=>i||e.getData(o),"");return n??r}const s0={[B2]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[V2]:{exposeProperties:{html:(e,t)=>Bc(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[U2]:{exposeProperties:{urls:(e,t)=>Bc(e,t,"").split(` -`),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[H2]:{exposeProperties:{text:(e,t)=>Bc(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Rk(e,t){const r=s0[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new Ak(r);return n.loadDataTransfer(t),n}function Uc(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(s0).filter(r=>{const n=s0[r];return n!=null&&n.matchesTypes?n.matchesTypes.some(i=>t.indexOf(i)>-1):!1})[0]||null}const Ok=L2(()=>/firefox/i.test(navigator.userAgent)),W2=L2(()=>!!window.safari);class m1{interpolate(t){const{xs:r,ys:n,c1s:i,c2s:o,c3s:a}=this;let s=r.length-1;if(t===r[s])return n[s];let l=0,u=a.length-1,c;for(;l<=u;){c=Math.floor(.5*(l+u));const h=r[c];if(ht)u=c-1;else return n[c]}s=Math.max(0,u);const f=t-r[s],d=f*f;return n[s]+i[s]*f+o[s]*d+a[s]*f*d}constructor(t,r){const{length:n}=t,i=[];for(let h=0;ht[h]{let N=new m1([0,.5,1],[l.y,l.y/c*m,l.y+m-c]).interpolate(d);return W2()&&o&&(N+=(window.devicePixelRatio-1)*m),N},g=()=>new m1([0,.5,1],[l.x,l.x/u*h,l.x+h-u]).interpolate(f),{offsetX:x,offsetY:w}=i,y=x===0||x,_=w===0||w;return{x:y?x:g(),y:_?w:p()}}class bk{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,r){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=r}}function kk(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v1(e){for(var t=1;t{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,r,n){this.sourceNodes.set(t,r),this.sourceNodeOptions.set(t,n);const i=a=>this.handleDragStart(a,t),o=a=>this.handleSelectStart(a);return r.setAttribute("draggable","true"),r.addEventListener("dragstart",i),r.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),r.removeEventListener("dragstart",i),r.removeEventListener("selectstart",o),r.setAttribute("draggable","false")}}connectDropTarget(t,r){const n=a=>this.handleDragEnter(a,t),i=a=>this.handleDragOver(a,t),o=a=>this.handleDrop(a,t);return r.addEventListener("dragenter",n),r.addEventListener("dragover",i),r.addEventListener("drop",o),()=>{r.removeEventListener("dragenter",n),r.removeEventListener("dragover",i),r.removeEventListener("drop",o)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(t);return v1({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(t);return v1({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(g1).some(r=>g1[r]===t)}beginDragNativeItem(t,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=Rk(t,r),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const r=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var n;return(n=this.rootElement)===null||n===void 0?void 0:n.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},r)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,r){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}handleDragEnter(t,r){this.dragEnterTargetIds.unshift(r)}handleDragOver(t,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}handleDrop(t,r){this.dropTargetIds.unshift(r)}constructor(t,r,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=i=>{const o=this.sourceNodes.get(i);return o&&z2(o)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=i=>!!(i&&this.document&&this.document.body&&this.document.body.contains(i)),this.endDragIfSourceWasRemovedFromDOM=()=>{const i=this.currentDragSourceNode;i==null||this.isNodeInDocument(i)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=i=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(i||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=i=>{if(i.defaultPrevented)return;const{dragStartSourceIds:o}=this;this.dragStartSourceIds=null;const a=Us(i);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:a});const{dataTransfer:s}=i,l=Uc(s);if(this.monitor.isDragging()){if(s&&typeof s.setDragImage=="function"){const c=this.monitor.getSourceId(),f=this.sourceNodes.get(c),d=this.sourcePreviewNodes.get(c)||f;if(d){const{anchorX:h,anchorY:m,offsetX:p,offsetY:g}=this.getCurrentSourcePreviewNodeOptions(),y=Ik(f,d,a,{anchorX:h,anchorY:m},{offsetX:p,offsetY:g});s.setDragImage(d,y.x,y.y)}}try{s==null||s.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(i.target);const{captureDraggingState:u}=this.getCurrentSourcePreviewNodeOptions();u?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(l)this.beginDragNativeItem(l);else{if(s&&!s.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=i=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}if(!this.enterLeaveCounter.enter(i.target)||this.monitor.isDragging())return;const{dataTransfer:s}=i,l=Uc(s);l&&this.beginDragNativeItem(l,s)},this.handleTopDragEnter=i=>{const{dragEnterTargetIds:o}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=i.altKey,o.length>0&&this.actions.hover(o,{clientOffset:Us(i)}),o.some(s=>this.monitor.canDropOnTarget(s))&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=i=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}},this.handleTopDragOver=i=>{const{dragOverTargetIds:o}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}this.altKeyPressed=i.altKey,this.lastClientOffset=Us(i),this.scheduleHover(o),(o||[]).some(s=>this.monitor.canDropOnTarget(s))?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=i=>{this.isDraggingNativeItem()&&i.preventDefault(),this.enterLeaveCounter.leave(i.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=i=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var o;i.preventDefault(),(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Uc(i.dataTransfer)&&i.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=i=>{const{dropTargetIds:o}=this;this.dropTargetIds=[],this.actions.hover(o,{clientOffset:Us(i)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=i=>{const o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))},this.options=new bk(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new Ck(this.isNodeInDocument)}}const Nk=function(t,r,n){return new $k(t,r,n)};function Mk(){const[e,t]=v.useState(null),[r,n]=v.useState("Interactive Table");v.useEffect(()=>{const a=setInterval(()=>{if(window.json_data){const s=JSON.parse(window.json_data);console.log(s),t(s),s.title&&typeof s.title=="string"&&n(s.title),clearInterval(a)}},100);return()=>clearInterval(a)},[]);const o=(a=>{var h;if(!a)return null;let s=(h=a.title)==null?void 0:h.replace(/|<\/b>/g,"").replace(/ /g,"_"),l=new Date().toISOString().slice(0,10).replace(/-/g,""),u=new Date().toISOString().slice(11,19).replace(/:/g,"");window.title=`openbb_${s}_${l}_${u}`;const c=a.columns;a.index;const d=a.data.map((m,p)=>{const g={};return m.forEach((x,w)=>{g[c[w]]=x||""}),g});return{columns:c,data:d}})(e);return q("div",{className:"relative h-full bg-white dark:bg-black text-black dark:text-white",children:q(mI,{backend:Nk,children:o&&q(_k,{title:r,data:o.data,columns:o.columns,initialTheme:e.theme&&typeof e.theme=="string"&&e.theme==="dark"?"dark":"light",cmd:(e==null?void 0:e.command_location)??""})})})}cv.render(q(nr.StrictMode,{children:q(Mk,{})}),document.getElementById("root")); +`),s.bookType=="fods"?l.push(""):l.push(""),l.join("")}}();function Bw(e,t){if(t.bookType=="fods")return Jg(e,t);var r=Fd(),n="",i=[],o=[];return n="mimetype",De(r,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",De(r,n,Jg(e,t)),i.push([n,"text/xml"]),o.push([n,"ContentFile"]),n="styles.xml",De(r,n,DD(e,t)),i.push([n,"text/xml"]),o.push([n,"StylesFile"]),n="meta.xml",De(r,n,at+Jx()),i.push([n,"text/xml"]),o.push([n,"MetadataFile"]),n="manifest.rdf",De(r,n,V3(o)),i.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",De(r,n,U3(i)),r}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function Wl(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function PD(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Er(Gr(e))}function ID(e,t){e:for(var r=0;r<=e.length-t.length;++r){for(var n=0;n>7,e[t+14]|=(n&127)<<1;for(var o=0;i>=1;++o,i/=256)e[t+o]=i&255;e[t+15]|=r>=0?0:128}function La(e,t){var r=t?t[0]:0,n=e[r]&127;e:if(e[r++]>=128&&(n|=(e[r]&127)<<7,e[r++]<128||(n|=(e[r]&127)<<14,e[r++]<128)||(n|=(e[r]&127)<<21,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,28),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,35),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,42),++r,e[r++]<128)))break e;return t&&(t[0]=r),n}function Me(e){var t=new Uint8Array(7);t[0]=e&127;var r=1;e:if(e>127){if(t[r-1]|=128,t[r]=e>>7&127,++r,e<=16383||(t[r-1]|=128,t[r]=e>>14&127,++r,e<=2097151)||(t[r-1]|=128,t[r]=e>>21&127,++r,e<=268435455)||(t[r-1]|=128,t[r]=e/256>>>21&127,++r,e<=34359738367)||(t[r-1]|=128,t[r]=e/65536>>>21&127,++r,e<=4398046511103))break e;t[r-1]|=128,t[r]=e/16777216>>>21&127,++r}return t.slice(0,r)}function io(e){var t=0,r=e[t]&127;e:if(e[t++]>=128){if(r|=(e[t]&127)<<7,e[t++]<128||(r|=(e[t]&127)<<14,e[t++]<128)||(r|=(e[t]&127)<<21,e[t++]<128))break e;r|=(e[t]&127)<<28}return r}function lt(e){for(var t=[],r=[0];r[0]=128;);s=e.slice(l,r[0])}break;case 5:a=4,s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 1:a=8,s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 2:a=La(e,r),s=e.slice(r[0],r[0]+a),r[0]+=a;break;case 3:case 4:default:throw new Error("PB Type ".concat(o," for Field ").concat(i," at offset ").concat(n))}var u={data:s,type:o};t[i]==null?t[i]=[u]:t[i].push(u)}return t}function gt(e){var t=[];return e.forEach(function(r,n){r.forEach(function(i){i.data&&(t.push(Me(n*8+i.type)),i.type==2&&t.push(Me(i.data.length)),t.push(i.data))})}),Nn(t)}function vr(e){for(var t,r=[],n=[0];n[0]>>0>0),r.push(a)}return r}function Di(e){var t=[];return e.forEach(function(r){var n=[];n[1]=[{data:Me(r.id),type:0}],n[2]=[],r.merge!=null&&(n[3]=[{data:Me(+!!r.merge),type:0}]);var i=[];r.messages.forEach(function(a){i.push(a.data),a.meta[3]=[{type:0,data:Me(a.data.length)}],n[2].push({data:gt(a.meta),type:2})});var o=gt(n);t.push(Me(o.length)),t.push(o),i.forEach(function(a){return t.push(a)})}),Nn(t)}function kD(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var r=[0],n=La(t,r),i=[];r[0]>2;if(a<60)++a;else{var s=a-59;a=t[r[0]],s>1&&(a|=t[r[0]+1]<<8),s>2&&(a|=t[r[0]+2]<<16),s>3&&(a|=t[r[0]+3]<<24),a>>>=0,a++,r[0]+=s}i.push(t.slice(r[0],r[0]+a)),r[0]+=a;continue}else{var l=0,u=0;if(o==1?(u=(t[r[0]]>>2&7)+4,l=(t[r[0]++]&224)<<3,l|=t[r[0]++]):(u=(t[r[0]++]>>2)+1,o==2?(l=t[r[0]]|t[r[0]+1]<<8,r[0]+=2):(l=(t[r[0]]|t[r[0]+1]<<8|t[r[0]+2]<<16|t[r[0]+3]<<24)>>>0,r[0]+=4)),i=[Nn(i)],l==0)throw new Error("Invalid offset 0");if(l>i[0].length)throw new Error("Invalid offset beyond length");if(u>=l)for(i.push(i[0].slice(-l)),u-=l;u>=i[i.length-1].length;)i.push(i[i.length-1]),u-=i[i.length-1].length;i.push(i[0].slice(-l,-l+u))}}var c=Nn(i);if(c.length!=n)throw new Error("Unexpected length: ".concat(c.length," != ").concat(n));return c}function xr(e){for(var t=[],r=0;r>8&255]))):n<=16777216?(a+=4,t.push(new Uint8Array([248,n-1&255,n-1>>8&255,n-1>>16&255]))):n<=4294967296&&(a+=5,t.push(new Uint8Array([252,n-1&255,n-1>>8&255,n-1>>16&255,n-1>>>24&255]))),t.push(e.slice(r,r+n)),a+=n,i[0]=0,i[1]=a&255,i[2]=a>>8&255,i[3]=a>>16&255,r+=n}return Nn(t)}function Fc(e,t){var r=new Uint8Array(32),n=Wl(r),i=12,o=0;switch(r[0]=5,e.t){case"n":r[1]=2,bD(r,i,e.v),o|=1,i+=16;break;case"b":r[1]=6,n.setFloat64(i,e.v?1:0,!0),o|=2,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[1]=3,n.setUint32(i,t.indexOf(e.v),!0),o|=8,i+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(8,o,!0),r.slice(0,i)}function Dc(e,t){var r=new Uint8Array(32),n=Wl(r),i=12,o=0;switch(r[0]=3,e.t){case"n":r[2]=2,n.setFloat64(i,e.v,!0),o|=32,i+=8;break;case"b":r[2]=6,n.setFloat64(i,e.v?1:0,!0),o|=32,i+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[2]=3,n.setUint32(i,t.indexOf(e.v),!0),o|=16,i+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(4,o,!0),r.slice(0,i)}function sn(e){var t=lt(e);return La(t[1][0].data)}function $D(e,t,r){var n,i,o,a;if(!((n=e[6])!=null&&n[0])||!((i=e[7])!=null&&i[0]))throw"Mutation only works on post-BNC storages!";var s=((a=(o=e[8])==null?void 0:o[0])==null?void 0:a.data)&&io(e[8][0].data)>0||!1;if(s)throw"Math only works with normal offsets";for(var l=0,u=Wl(e[7][0].data),c=0,f=[],d=Wl(e[4][0].data),h=0,m=[],p=0;p1&&console.error("The Numbers writer currently writes only the first table");var n=Jt(r["!ref"]);n.s.r=n.s.c=0;var i=!1;n.e.c>9&&(i=!0,n.e.c=9),n.e.r>49&&(i=!0,n.e.r=49),i&&console.error("The Numbers writer is currently limited to ".concat(ot(n)));var o=zl(r,{range:n,header:1}),a=["~Sh33tJ5~"];o.forEach(function(k){return k.forEach(function(b){typeof b=="string"&&a.push(b)})});var s={},l=[],u=He.read(t.numbers,{type:"base64"});u.FileIndex.map(function(k,b){return[k,u.FullPaths[b]]}).forEach(function(k){var b=k[0],D=k[1];if(b.type==2&&b.name.match(/\.iwa/)){var U=b.content,G=xr(U),J=vr(G);J.forEach(function(W){l.push(W.id),s[W.id]={deps:[],location:D,type:io(W.messages[0].meta[1][0].data)}})}}),l.sort(function(k,b){return k-b});var c=l.filter(function(k){return k>1}).map(function(k){return[k,Me(k)]});u.FileIndex.map(function(k,b){return[k,u.FullPaths[b]]}).forEach(function(k){var b=k[0];if(k[1],!!b.name.match(/\.iwa/)){var D=vr(xr(b.content));D.forEach(function(U){U.messages.forEach(function(G){c.forEach(function(J){U.messages.some(function(W){return io(W.meta[1][0].data)!=11006&&ID(W.data,J[1])})&&s[J[0]].deps.push(U.id)})})})}});for(var f=He.find(u,s[1].location),d=vr(xr(f.content)),h,m=0;m-1,i=qx();Gd(t=t||{});var o=Fd(),a="",s=0;if(t.cellXfs=[],Bn(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),a="docProps/core.xml",De(o,a,ew(e.Props,t)),i.coreprops.push(a),Le(t.rels,2,a,$e.CORE_PROPS),a="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],u=0;u0&&(a="docProps/custom.xml",De(o,a,nw(e.Custprops)),i.custprops.push(a),Le(t.rels,4,a,$e.CUST_PROPS)),s=1;s<=e.SheetNames.length;++s){var c={"!id":{}},f=e.Sheets[e.SheetNames[s-1]],d=(f||{})["!type"]||"sheet";switch(d){case"chart":default:a="xl/worksheets/sheet"+s+"."+r,De(o,a,V6(s-1,a,t,e,c)),i.sheets.push(a),Le(t.wbrels,-1,"worksheets/sheet"+s+"."+r,$e.WS[0])}if(f){var h=f["!comments"],m=!1,p="";h&&h.length>0&&(p="xl/comments"+s+"."+r,De(o,p,G6(h,p)),i.comments.push(p),Le(c,-1,"../comments"+s+"."+r,$e.CMNT),m=!0),f["!legacy"]&&m&&De(o,"xl/drawings/vmlDrawing"+s+".vml",ww(s,f["!comments"])),delete f["!comments"],delete f["!legacy"]}c["!id"].rId1&&De(o,Zx(a),ro(c))}return t.Strings!=null&&t.Strings.length>0&&(a="xl/sharedStrings."+r,De(o,a,z6(t.Strings,a,t)),i.strs.push(a),Le(t.wbrels,-1,"sharedStrings."+r,$e.SST)),a="xl/workbook."+r,De(o,a,H6(e,a)),i.workbooks.push(a),Le(t.rels,1,a,$e.WB),a="xl/theme/theme1.xml",De(o,a,vw(e.Themes,t)),i.themes.push(a),Le(t.wbrels,-1,"theme/theme1.xml",$e.THEME),a="xl/styles."+r,De(o,a,W6(e,a,t)),i.styles.push(a),Le(t.wbrels,-1,"styles."+r,$e.STY),e.vbaraw&&n&&(a="xl/vbaProject.bin",De(o,a,e.vbaraw),i.vba.push(a),Le(t.wbrels,-1,"vbaProject.bin",$e.VBA)),a="xl/metadata."+r,De(o,a,j6(a)),i.metadata.push(a),Le(t.wbrels,-1,"metadata."+r,$e.XLMETA),De(o,"[Content_Types].xml",Qx(i,t)),De(o,"_rels/.rels",ro(t.rels)),De(o,"xl/_rels/workbook."+r+".rels",ro(t.wbrels)),delete t.revssf,delete t.ssf,o}function UD(e,t){Wi=1024,e&&!e.SSF&&(e.SSF=Xt(rt)),e&&e.SSF&&(wu(),xu(e.SSF),t.revssf=yu(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,va?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r="xml",n=Ew.indexOf(t.bookType)>-1,i=qx();Gd(t=t||{});var o=Fd(),a="",s=0;if(t.cellXfs=[],Bn(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),a="docProps/core.xml",De(o,a,ew(e.Props,t)),i.coreprops.push(a),Le(t.rels,2,a,$e.CORE_PROPS),a="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var l=[],u=0;u0&&(a="docProps/custom.xml",De(o,a,nw(e.Custprops)),i.custprops.push(a),Le(t.rels,4,a,$e.CUST_PROPS));var c=["SheetJ5"];for(t.tcid=0,s=1;s<=e.SheetNames.length;++s){var f={"!id":{}},d=e.Sheets[e.SheetNames[s-1]],h=(d||{})["!type"]||"sheet";switch(h){case"chart":default:a="xl/worksheets/sheet"+s+"."+r,De(o,a,Dw(s-1,t,e,f)),i.sheets.push(a),Le(t.wbrels,-1,"worksheets/sheet"+s+"."+r,$e.WS[0])}if(d){var m=d["!comments"],p=!1,g="";if(m&&m.length>0){var x=!1;m.forEach(function(w){w[1].forEach(function(y){y.T==!0&&(x=!0)})}),x&&(g="xl/threadedComments/threadedComment"+s+"."+r,De(o,g,vR(m,c,t)),i.threadedcomments.push(g),Le(f,-1,"../threadedComments/threadedComment"+s+"."+r,$e.TCMNT)),g="xl/comments"+s+"."+r,De(o,g,yw(m)),i.comments.push(g),Le(f,-1,"../comments"+s+"."+r,$e.CMNT),p=!0}d["!legacy"]&&p&&De(o,"xl/drawings/vmlDrawing"+s+".vml",ww(s,d["!comments"])),delete d["!comments"],delete d["!legacy"]}f["!id"].rId1&&De(o,Zx(a),ro(f))}return t.Strings!=null&&t.Strings.length>0&&(a="xl/sharedStrings."+r,De(o,a,fw(t.Strings,t)),i.strs.push(a),Le(t.wbrels,-1,"sharedStrings."+r,$e.SST)),a="xl/workbook."+r,De(o,a,bw(e)),i.workbooks.push(a),Le(t.rels,1,a,$e.WB),a="xl/theme/theme1.xml",De(o,a,vw(e.Themes,t)),i.themes.push(a),Le(t.wbrels,-1,"theme/theme1.xml",$e.THEME),a="xl/styles."+r,De(o,a,gw(e,t)),i.styles.push(a),Le(t.wbrels,-1,"styles."+r,$e.STY),e.vbaraw&&n&&(a="xl/vbaProject.bin",De(o,a,e.vbaraw),i.vba.push(a),Le(t.wbrels,-1,"vbaProject.bin",$e.VBA)),a="xl/metadata."+r,De(o,a,xw()),i.metadata.push(a),Le(t.wbrels,-1,"metadata."+r,$e.XLMETA),c.length>1&&(a="xl/persons/person.xml",De(o,a,xR(c)),i.people.push(a),Le(t.wbrels,-1,"persons/person.xml",$e.PEOPLE)),De(o,"[Content_Types].xml",Qx(i,t)),De(o,"_rels/.rels",ro(t.rels)),De(o,"xl/_rels/workbook."+r+".rels",ro(t.wbrels)),delete t.revssf,delete t.ssf,o}function HD(e,t){var r="";switch((t||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":r=en(e.slice(0,12));break;case"binary":r=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(t&&t.type||"undefined"))}return[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3),r.charCodeAt(4),r.charCodeAt(5),r.charCodeAt(6),r.charCodeAt(7)]}function Uw(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return Za(t.file,He.write(e,{type:Ne?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return He.write(e,t)}function VD(e,t){var r=Xt(t||{}),n=LD(e,r);return WD(n,r)}function WD(e,t){var r={},n=Ne?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(t.compression&&(r.compression="DEFLATE"),t.password)r.type=n;else switch(t.type){case"base64":r.type="base64";break;case"binary":r.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":r.type=n;break;default:throw new Error("Unrecognized type "+t.type)}var i=e.FullPaths?He.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[r.type]||r.type,compression:!!t.compression}):e.generate(r);if(typeof Deno<"u"&&typeof i=="string"){if(t.type=="binary"||t.type=="base64")return i;i=new Uint8Array(vu(i))}return t.password&&typeof encrypt_agile<"u"?Uw(encrypt_agile(i,t.password),t):t.type==="file"?Za(t.file,i):t.type=="string"?ha(i):i}function zD(e,t){var r=t||{},n=aD(e,r);return Uw(n,r)}function Rr(e,t,r){r||(r="");var n=r+e;switch(t.type){case"base64":return $a(Gr(n));case"binary":return Gr(n);case"string":return e;case"file":return Za(t.file,n,"utf8");case"buffer":return Ne?an(n,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(n):Rr(n,{type:"binary"}).split("").map(function(i){return i.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function GD(e,t){switch(t.type){case"base64":return $a(e);case"binary":return e;case"string":return e;case"file":return Za(t.file,e,"binary");case"buffer":return Ne?an(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function bs(e,t){switch(t.type){case"string":case"base64":case"binary":for(var r="",n=0;n0&&(i=0);var f=_t(l.s.r),d=[],h=[],m=0,p=0,g=Array.isArray(e),x=l.s.r,w=0,y={};g&&!e[x]&&(e[x]=[]);var _=u.skipHidden&&e["!cols"]||[],N=u.skipHidden&&e["!rows"]||[];for(w=l.s.c;w<=l.e.c;++w)if(!(_[w]||{}).hidden)switch(d[w]=Ft(w),r=g?e[x][w]:e[d[w]+f],n){case 1:o[w]=w-l.s.c;break;case 2:o[w]=d[w];break;case 3:o[w]=u.header[w-l.s.c];break;default:if(r==null&&(r={w:"__EMPTY",t:"s"}),s=a=tn(r,null,u),p=y[a]||0,!p)y[a]=1;else{do s=a+"_"+p++;while(y[s]);y[a]=p,y[s]=1}o[w]=s}for(x=l.s.r+i;x<=l.e.r;++x)if(!(N[x]||{}).hidden){var M=KD(e,l,x,d,n,o,g,u);(M.isempty===!1||(n===1?u.blankrows!==!1:u.blankrows))&&(h[m++]=M.row)}return h.length=m,h}var e1=/"/g;function YD(e,t,r,n,i,o,a,s){for(var l=!0,u=[],c="",f=_t(r),d=t.s.c;d<=t.e.c;++d)if(n[d]){var h=s.dense?(e[r]||[])[d]:e[n[d]+f];if(h==null)c="";else if(h.v!=null){l=!1,c=""+(s.rawNumbers&&h.t=="n"?h.v:tn(h,null,s));for(var m=0,p=0;m!==c.length;++m)if((p=c.charCodeAt(m))===i||p===o||p===34||s.forceQuotes){c='"'+c.replace(e1,'""')+'"';break}c=="ID"&&(c='"ID"')}else h.f!=null&&!h.F?(l=!1,c="="+h.f,c.indexOf(",")>=0&&(c='"'+c.replace(e1,'""')+'"')):c="";u.push(c)}return s.blankrows===!1&&l?null:u.join(a)}function jd(e,t){var r=[],n=t??{};if(e==null||e["!ref"]==null)return"";var i=Ke(e["!ref"]),o=n.FS!==void 0?n.FS:",",a=o.charCodeAt(0),s=n.RS!==void 0?n.RS:` +`,l=s.charCodeAt(0),u=new RegExp((o=="|"?"\\|":o)+"+$"),c="",f=[];n.dense=Array.isArray(e);for(var d=n.skipHidden&&e["!cols"]||[],h=n.skipHidden&&e["!rows"]||[],m=i.s.c;m<=i.e.c;++m)(d[m]||{}).hidden||(f[m]=Ft(m));for(var p=0,g=i.s.r;g<=i.e.r;++g)(h[g]||{}).hidden||(c=YD(e,i,g,f,a,l,o,n),c!=null&&(n.strip&&(c=c.replace(u,"")),(c||n.blankrows!==!1)&&r.push((p++?s:"")+c)));return delete n.dense,r.join("")}function Vw(e,t){t||(t={}),t.FS=" ",t.RS=` +`;var r=jd(e,t);return r}function qD(e){var t="",r,n="";if(e==null||e["!ref"]==null)return[];var i=Ke(e["!ref"]),o="",a=[],s,l=[],u=Array.isArray(e);for(s=i.s.c;s<=i.e.c;++s)a[s]=Ft(s);for(var c=i.s.r;c<=i.e.r;++c)for(o=_t(c),s=i.s.c;s<=i.e.c;++s)if(t=a[s]+o,r=u?(e[c]||[])[s]:e[t],n="",r!==void 0){if(r.F!=null){if(t=r.F,!r.f)continue;n=r.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(r.f!=null)n=r.f;else{if(r.t=="z")continue;if(r.t=="n"&&r.v!=null)n=""+r.v;else if(r.t=="b")n=r.v?"TRUE":"FALSE";else if(r.w!==void 0)n="'"+r.w;else{if(r.v===void 0)continue;r.t=="s"?n="'"+r.v:n=""+r.v}}l[l.length]=t+"="+n}return l}function Ww(e,t,r){var n=r||{},i=+!n.skipHeader,o=e||{},a=0,s=0;if(o&&n.origin!=null)if(typeof n.origin=="number")a=n.origin;else{var l=typeof n.origin=="string"?dt(n.origin):n.origin;a=l.r,s=l.c}var u,c={s:{c:0,r:0},e:{c:s,r:a+t.length-1+i}};if(o["!ref"]){var f=Ke(o["!ref"]);c.e.c=Math.max(c.e.c,f.e.c),c.e.r=Math.max(c.e.r,f.e.r),a==-1&&(a=f.e.r+1,c.e.r=a+t.length-1+i)}else a==-1&&(a=0,c.e.r=t.length-1+i);var d=n.header||[],h=0;t.forEach(function(p,g){Tt(p).forEach(function(x){(h=d.indexOf(x))==-1&&(d[h=d.length]=x);var w=p[x],y="z",_="",N=Ue({c:s+h,r:a+g+i});u=Ba(o,N),w&&typeof w=="object"&&!(w instanceof Date)?o[N]=w:(typeof w=="number"?y="n":typeof w=="boolean"?y="b":typeof w=="string"?y="s":w instanceof Date?(y="d",n.cellDates||(y="n",w=jt(w)),_=n.dateNF||rt[14]):w===null&&n.nullError&&(y="e",w=0),u?(u.t=y,u.v=w,delete u.w,delete u.R,_&&(u.z=_)):o[N]=u={t:y,v:w},_&&(u.z=_))})}),c.e.c=Math.max(c.e.c,s+d.length-1);var m=_t(a);if(i)for(h=0;h=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}else if(typeof t=="string"){var r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function JD(){return{SheetNames:[],Sheets:{}}}function eP(e,t,r,n){var i=1;if(!r)for(;i<=65535&&e.SheetNames.indexOf(r="Sheet"+i)!=-1;++i,r=void 0);if(!r||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(r)>=0){var o=r.match(/(^.*?)(\d+)$/);i=o&&+o[2]||0;var a=o&&o[1]||r;for(++i;i<=65535&&e.SheetNames.indexOf(r=a+i)!=-1;++i);}if(Iw(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function tP(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=ZD(e,t);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[n].Hidden=r}function rP(e,t){return e.z=t,e}function zw(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function nP(e,t,r){return zw(e,"#"+t,r)}function iP(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function oP(e,t,r,n){for(var i=typeof t!="string"?t:Ke(t),o=typeof t=="string"?t:ot(t),a=i.s.r;a<=i.e.r;++a)for(var s=i.s.c;s<=i.e.c;++s){var l=Ba(e,a,s);l.t="n",l.F=o,delete l.v,a==i.s.r&&s==i.s.c&&(l.f=r,n&&(l.D=!0))}return e}var Pc={encode_col:Ft,encode_row:_t,encode_cell:Ue,encode_range:ot,decode_col:$d,decode_row:kd,split_cell:w3,decode_cell:dt,decode_range:Jt,format_cell:tn,sheet_add_aoa:zx,sheet_add_json:Ww,sheet_add_dom:Mw,aoa_to_sheet:So,json_to_sheet:QD,table_to_sheet:Lw,table_to_book:OD,sheet_to_csv:jd,sheet_to_txt:Vw,sheet_to_json:zl,sheet_to_html:Nw,sheet_to_formulae:qD,sheet_to_row_object_array:zl,sheet_get_cell:Ba,book_new:JD,book_append_sheet:eP,book_set_sheet_visibility:tP,cell_set_number_format:rP,cell_set_hyperlink:zw,cell_set_internal_link:nP,cell_add_comment:iP,sheet_set_array_formula:oP,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};function jf(e){if(typeof e=="string"){const t=e.replace(/[^a-zA-Z]/g,"").trim(),r=["","K","M","B","T"].indexOf(t.replace(/\s/g,""));e=Number(e.replace(/[^0-9.]/g,"").trim())*Math.pow(10,r*3)}return e}function aP(e,t){var r;if(typeof e=="string"&&(e=Number(jf(e))),e%1!==0){const n=Math.max(2,((r=e.toString().split(".")[1])==null?void 0:r.length)||0),i=Math.min(4,n);if(e<1e3)return e.toFixed(i)||0}if(e>1e5&&!Gw(t||"")){const n=Math.min(4,Math.floor(Math.log10(Math.abs(e))/3)),i=["","K","M","B","T"][n];return`${(e/10**(n*3)).toFixed(2)} ${i}`}return e>1e3?e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","):e}function Xd(e){return["date","day","time","timestamp","year"].some(t=>e==null?void 0:e.toLowerCase().includes(t))}function Gw(e){return["price","open","close","high","low"].some(t=>e==null?void 0:e.toLowerCase().includes(t))}function zi(e,t){const r=window.document.getElementById("loading"),n=window.document.getElementById("loading_text");return new Promise(i=>{t?r.classList.remove("show"):(n.innerHTML=e,r.classList.add("show"));const o=setInterval(function(){(t?!r.classList.contains("show"):r.classList.contains("show"))&&(clearInterval(o),i(!0))},.01)})}function sP(e,t){if(e===t)return!0;if(e==null||t==null||(e==null?void 0:e.length)!==(t==null?void 0:t.length))return!1;for(let r=0;r<(e==null?void 0:e.length);++r)if(e[r]!==t[r])return!1;return!0}const lP=(e,t,r,n)=>{const i=l4(e.getValue(t),r);return n(i),i},uP=async({fileHandle:e,blob:t})=>{e&&await cP({fileHandle:e,blob:t})},cP=async({fileHandle:e,blob:t})=>{const r=await e.createWritable();await r.write(t),await r.close()},fP=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}}],jw=({filename:e,is_image:t})=>{try{if("showSaveFilePicker"in window){const r={suggestedName:e,types:t?fP:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(r)}}catch(r){console.error(r)}return new Promise(r=>{r(null)})},Xw=(e,t,r)=>{try{if(r===null)throw new Error("Cannot access filesystem");uP({fileHandle:r,blob:e})}catch(n){console.error("oops, something went wrong!",n);const i=URL.createObjectURL(e),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",t),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o)}return new Promise(n=>{n(!0)})};async function t1(e,t,r,n){const i=t,o=r.map(u=>i.map(c=>u[c])),a=[i,...o];if(e==="csv"){const u=a.map(d=>d.join(",")).join(` +`),c=new Blob([u],{type:"text/csv;charset=utf-8;"}),f=`${window.title}.csv`;try{const d=await jw({filename:f});let h="csv";d!==null&&(h=d.name.split(".").pop()),await zi(`Saving ${h.toUpperCase()}`),Xf(async function(){Xw(c,f,d).then(async function(){await new Promise(m=>setTimeout(m,1500)),await zi("",!0),d||n(!0)})},2)()}catch(d){console.error(d)}return}const s=Pc.book_new(),l=Pc.aoa_to_sheet(a);Pc.book_append_sheet(s,l,"Sheet1"),await zi("Saving XLSX"),Xf(async function(){await new Promise(u=>setTimeout(u,1500)),XD(s,`${window.title}.xlsx`),await zi("",!0),n==null||n(!0)},2)()}async function dP(e,t){const r=document.getElementById(e),n=`${window.title}.png`;try{const i=await jw({filename:n,is_image:!0});let o="png";i!==null&&(o=i.name.split(".").pop()),await zi(`Saving ${o.toUpperCase()}`),Xf(async function(){g4.toBlob(r).then(function(a){Xw(a,n,i).then(async function(){await new Promise(s=>setTimeout(s,1500)),await zi("",!0),i||t(!0)})})},2)()}catch(i){console.error(i)}}const Xf=(e,t)=>{let r;return function(){const n=this,i=arguments;clearTimeout(r),r=setTimeout(()=>e.apply(n,i),t)}},Kw=v.createContext({dragDropManager:void 0});function rr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var r1=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Ic=function(){return Math.random().toString(36).substring(7).split("").join(".")},n1={INIT:"@@redux/INIT"+Ic(),REPLACE:"@@redux/REPLACE"+Ic(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ic()}};function hP(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Yw(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(rr(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(rr(1));return r(Yw)(e,t)}if(typeof e!="function")throw new Error(rr(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(rr(3));return o}function f(p){if(typeof p!="function")throw new Error(rr(4));if(l)throw new Error(rr(5));var g=!0;return u(),s.push(p),function(){if(g){if(l)throw new Error(rr(6));g=!1,u();var w=s.indexOf(p);s.splice(w,1),a=null}}}function d(p){if(!hP(p))throw new Error(rr(7));if(typeof p.type>"u")throw new Error(rr(8));if(l)throw new Error(rr(9));try{l=!0,o=i(o,p)}finally{l=!1}for(var g=a=s,x=0;xn&&n[i]?n[i]:r||null,e)}function mP(e,t){return e.filter(r=>r!==t)}function qw(e){return typeof e=="object"}function vP(e,t){const r=new Map,n=o=>{r.set(o,r.has(o)?r.get(o)+1:1)};e.forEach(n),t.forEach(n);const i=[];return r.forEach((o,a)=>{o===1&&i.push(a)}),i}function xP(e,t){return e.filter(r=>t.indexOf(r)>-1)}const Kd="dnd-core/INIT_COORDS",Cu="dnd-core/BEGIN_DRAG",Yd="dnd-core/PUBLISH_DRAG_SOURCE",Au="dnd-core/HOVER",Ru="dnd-core/DROP",Ou="dnd-core/END_DRAG";function i1(e,t){return{type:Kd,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const wP={type:Kd,payload:{clientOffset:null,sourceClientOffset:null}};function yP(e){return function(r=[],n={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:a}=n,s=e.getMonitor(),l=e.getRegistry();e.dispatch(i1(o)),EP(r,s,l);const u=TP(r,s);if(u==null){e.dispatch(wP);return}let c=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");_P(a),c=a(u)}e.dispatch(i1(o,c));const d=l.getSource(u).beginDrag(s,u);if(d==null)return;SP(d),l.pinSource(u);const h=l.getSourceType(u);return{type:Cu,payload:{itemType:h,item:d,sourceId:u,clientOffset:o||null,sourceClientOffset:c||null,isSourcePublic:!!i}}}}function EP(e,t,r){Fe(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(n){Fe(r.getSource(n),"Expected sourceIds to be registered.")})}function _P(e){Fe(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function SP(e){Fe(qw(e),"Item must be an object.")}function TP(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function CP(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AP(e){for(var t=1;t{const l=FP(a,s,i,n),u={type:Ru,payload:{dropResult:AP({},r,l)}};e.dispatch(u)})}}function OP(e){Fe(e.isDragging(),"Cannot call drop while not dragging."),Fe(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function FP(e,t,r,n){const i=r.getTarget(e);let o=i?i.drop(n,e):void 0;return DP(o),typeof o>"u"&&(o=t===0?{}:n.getDropResult()),o}function DP(e){Fe(typeof e>"u"||qw(e),"Drop result must either be an object or undefined.")}function PP(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function IP(e){return function(){const r=e.getMonitor(),n=e.getRegistry();bP(r);const i=r.getSourceId();return i!=null&&(n.getSource(i,!0).endDrag(r,i),n.unpinSource()),{type:Ou}}}function bP(e){Fe(e.isDragging(),"Cannot call endDrag while not dragging.")}function Kf(e,t){return t===null?e===null:Array.isArray(e)?e.some(r=>r===t):e===t}function kP(e){return function(r,{clientOffset:n}={}){$P(r);const i=r.slice(0),o=e.getMonitor(),a=e.getRegistry(),s=o.getItemType();return MP(i,a,s),NP(i,o,a),LP(i,o,a),{type:Au,payload:{targetIds:i,clientOffset:n||null}}}}function $P(e){Fe(Array.isArray(e),"Expected targetIds to be an array.")}function NP(e,t,r){Fe(t.isDragging(),"Cannot call hover while not dragging."),Fe(!t.didDrop(),"Cannot call hover after drop.");for(let n=0;n=0;n--){const i=e[n],o=t.getTargetType(i);Kf(o,r)||e.splice(n,1)}}function LP(e,t,r){e.forEach(function(n){r.getTarget(n).hover(t,n)})}function BP(e){return function(){if(e.getMonitor().isDragging())return{type:Yd}}}function UP(e){return{beginDrag:yP(e),publishDragSource:BP(e),hover:kP(e),drop:RP(e),endDrag:IP(e)}}class HP{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:r}=this.store;function n(o){return(...a)=>{const s=o.apply(t,a);typeof s<"u"&&r(s)}}const i=UP(this);return Object.keys(i).reduce((o,a)=>{const s=i[a];return o[a]=n(s),o},{})}dispatch(t){this.store.dispatch(t)}constructor(t,r){this.isSetUp=!1,this.handleRefCountChange=()=>{const n=this.store.getState().refCount>0;this.backend&&(n&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!n&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=r,t.subscribe(this.handleRefCountChange)}}function VP(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Qw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function WP(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return!t||!r||!n?null:Qw(VP(t,n),r)}function zP(e){const{clientOffset:t,initialClientOffset:r}=e;return!t||!r?null:Qw(t,r)}const xa=[],qd=[];xa.__IS_NONE__=!0;qd.__IS_ALL__=!0;function GP(e,t){return e===xa?!1:e===qd||typeof t>"u"?!0:xP(t,e).length>0}class jP{subscribeToStateChange(t,r={}){const{handlerIds:n}=r;Fe(typeof t=="function","listener must be a function."),Fe(typeof n>"u"||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const a=this.store.getState(),s=a.stateId;try{s===i||s===i+1&&!GP(a.dirtyHandlerIds,n)||t()}finally{i=s}};return this.store.subscribe(o)}subscribeToOffsetChange(t){Fe(typeof t=="function","listener must be a function.");let r=this.store.getState().dragOffset;const n=()=>{const i=this.store.getState().dragOffset;i!==r&&(r=i,t())};return this.store.subscribe(n)}canDragSource(t){if(!t)return!1;const r=this.registry.getSource(t);return Fe(r,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:r.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const r=this.registry.getTarget(t);if(Fe(r,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const n=this.registry.getTargetType(t),i=this.getItemType();return Kf(n,i)&&r.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const r=this.registry.getSource(t,!0);if(Fe(r,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const n=this.registry.getSourceType(t),i=this.getItemType();return n!==i?!1:r.isDragging(this,t)}isOverTarget(t,r={shallow:!1}){if(!t)return!1;const{shallow:n}=r;if(!this.isDragging())return!1;const i=this.registry.getTargetType(t),o=this.getItemType();if(o&&!Kf(i,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const s=a.indexOf(t);return n?s===a.length-1:s>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return WP(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return zP(this.store.getState().dragOffset)}constructor(t,r){this.store=t,this.registry=r}}const o1=typeof global<"u"?global:self,Zw=o1.MutationObserver||o1.WebKitMutationObserver;function Jw(e){return function(){const r=setTimeout(i,0),n=setInterval(i,50);function i(){clearTimeout(r),clearInterval(n),e()}}}function XP(e){let t=1;const r=new Zw(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}const KP=typeof Zw=="function"?XP:Jw;class YP{enqueueTask(t){const{queue:r,requestFlush:n}=this;r.length||(n(),this.flushing=!0),r[r.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.indexthis.capacity){for(let n=0,i=t.length-this.index;n{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=KP(this.flush),this.requestErrorThrow=Jw(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class qP{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,r){this.onError=t,this.release=r,this.task=null}}class QP{create(t){const r=this.freeTasks,n=r.length?r.pop():new qP(this.onError,i=>r[r.length]=i);return n.task=t,n}constructor(t){this.onError=t,this.freeTasks=[]}}const e2=new YP,ZP=new QP(e2.registerPendingError);function JP(e){e2.enqueueTask(ZP.create(e))}const Qd="dnd-core/ADD_SOURCE",Zd="dnd-core/ADD_TARGET",Jd="dnd-core/REMOVE_SOURCE",Fu="dnd-core/REMOVE_TARGET";function eI(e){return{type:Qd,payload:{sourceId:e}}}function tI(e){return{type:Zd,payload:{targetId:e}}}function rI(e){return{type:Jd,payload:{sourceId:e}}}function nI(e){return{type:Fu,payload:{targetId:e}}}function iI(e){Fe(typeof e.canDrag=="function","Expected canDrag to be a function."),Fe(typeof e.beginDrag=="function","Expected beginDrag to be a function."),Fe(typeof e.endDrag=="function","Expected endDrag to be a function.")}function oI(e){Fe(typeof e.canDrop=="function","Expected canDrop to be a function."),Fe(typeof e.hover=="function","Expected hover to be a function."),Fe(typeof e.drop=="function","Expected beginDrag to be a function.")}function Yf(e,t){if(t&&Array.isArray(e)){e.forEach(r=>Yf(r,!1));return}Fe(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var ar;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(ar||(ar={}));let aI=0;function sI(){return aI++}function lI(e){const t=sI().toString();switch(e){case ar.SOURCE:return`S${t}`;case ar.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function a1(e){switch(e[0]){case"S":return ar.SOURCE;case"T":return ar.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function s1(e,t){const r=e.entries();let n=!1;do{const{done:i,value:[,o]}=r.next();if(o===t)return!0;n=!!i}while(!n);return!1}class uI{addSource(t,r){Yf(t),iI(r);const n=this.addHandler(ar.SOURCE,t,r);return this.store.dispatch(eI(n)),n}addTarget(t,r){Yf(t,!0),oI(r);const n=this.addHandler(ar.TARGET,t,r);return this.store.dispatch(tI(n)),n}containsHandler(t){return s1(this.dragSources,t)||s1(this.dropTargets,t)}getSource(t,r=!1){return Fe(this.isSourceId(t),"Expected a valid source ID."),r&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return Fe(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return Fe(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return Fe(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return a1(t)===ar.SOURCE}isTargetId(t){return a1(t)===ar.TARGET}removeSource(t){Fe(this.getSource(t),"Expected an existing source."),this.store.dispatch(rI(t)),JP(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){Fe(this.getTarget(t),"Expected an existing target."),this.store.dispatch(nI(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const r=this.getSource(t);Fe(r,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=r}unpinSource(){Fe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,r,n){const i=lI(t);return this.types.set(i,r),t===ar.SOURCE?this.dragSources.set(i,n):t===ar.TARGET&&this.dropTargets.set(i,n),i}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const cI=(e,t)=>e===t;function fI(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function dI(e,t,r=cI){if(e.length!==t.length)return!1;for(let n=0;n0||!dI(r,n)))return xa;const a=n[n.length-1],s=r[r.length-1];return a!==s&&(a&&i.push(a),s&&i.push(s)),i}function pI(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gI(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function OI(e,t){if(e==null)return{};var r={},n=Object.keys(e),i,o;for(o=0;o=0)&&(r[i]=e[i]);return r}let u1=0;const el=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var FI=v.memo(function(t){var{children:r}=t,n=RI(t,["children"]);const[i,o]=DI(n);return v.useEffect(()=>{if(o){const a=t2();return++u1,()=>{--u1===0&&(a[el]=null)}}},[]),K(Kw.Provider,{value:i,children:r})});function DI(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=PI(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}function PI(e,t=t2(),r,n){const i=t;return i[el]||(i[el]={dragDropManager:CI(e,t,r,n)}),i[el]}function t2(){return typeof global<"u"?global:window}var II=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r};const bI=Ha(II),si=typeof window<"u"?v.useLayoutEffect:v.useEffect;function kI(e,t,r){const[n,i]=v.useState(()=>t(e)),o=v.useCallback(()=>{const a=t(e);bI(n,a)||(i(a),r&&r())},[n,e,r]);return si(o),[n,o]}function $I(e,t,r){const[n,i]=kI(e,t,r);return si(function(){const a=e.getHandlerId();if(a!=null)return e.subscribeToStateChange(i,{handlerIds:[a]})},[e,i]),n}function r2(e,t,r){return $I(t,e||(()=>({})),()=>r.reconnect())}function n2(e,t){const r=[...t||[]];return t==null&&typeof e!="function"&&r.push(e),v.useMemo(()=>typeof e=="function"?e():e,r)}function NI(e){return v.useMemo(()=>e.hooks.dragSource(),[e])}function MI(e){return v.useMemo(()=>e.hooks.dragPreview(),[e])}let bc=!1,kc=!1;class LI{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){Fe(!bc,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return bc=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{bc=!1}}isDragging(){if(!this.sourceId)return!1;Fe(!kc,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return kc=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{kc=!1}}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,r){return this.internalMonitor.isOverTarget(t,r)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let $c=!1;class BI{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,r){return this.internalMonitor.subscribeToStateChange(t,r)}canDrop(){if(!this.targetId)return!1;Fe(!$c,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return $c=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{$c=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function UI(e,t,r){const n=r.getRegistry(),i=n.addTarget(e,t);return[i,()=>n.removeTarget(i)]}function HI(e,t,r){const n=r.getRegistry(),i=n.addSource(e,t);return[i,()=>n.removeSource(i)]}function qf(e,t,r,n){let i=r?r.call(n,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let l=0;l, or turn it into a drag source or a drop target itself.`)}function WI(e){return(t=null,r=null)=>{if(!v.isValidElement(t)){const o=t;return e(o,r),o}const n=t;return VI(n),zI(n,r?o=>e(o,r):e)}}function i2(e){const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const i=WI(n);t[r]=()=>i}}),t}function c1(e,t){typeof e=="function"?e(t):e.current=t}function zI(e,t){const r=e.ref;return Fe(typeof r!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?v.cloneElement(e,{ref:n=>{c1(r,n),c1(t,n)}}):v.cloneElement(e,{ref:t})}class GI{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,r=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return r&&this.disconnectDragSource(),this.handlerId?t?(r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),r):(this.lastConnectedDragSource=t,r):r}reconnectDragPreview(t=!1){const r=this.dragPreview,n=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(n&&this.disconnectDragPreview(),!!this.handlerId){if(!r){this.lastConnectedDragPreview=r;return}n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=r,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,r,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!qf(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!qf(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=i2({dragSource:(r,n)=>{this.clearDragSource(),this.dragSourceOptions=n||null,Qf(r)?this.dragSourceRef=r:this.dragSourceNode=r,this.reconnectDragSource()},dragPreview:(r,n)=>{this.clearDragPreview(),this.dragPreviewOptions=n||null,Qf(r)?this.dragPreviewRef=r:this.dragPreviewNode=r,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class jI{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const r=this.dropTarget;if(this.handlerId){if(!r){this.lastConnectedDropTarget=r;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=r,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,r,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!qf(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=i2({dropTarget:(r,n)=>{this.clearDropTarget(),this.dropTargetOptions=n,Qf(r)?this.dropTargetRef=r:this.dropTargetNode=r,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function Ao(){const{dragDropManager:e}=v.useContext(Kw);return Fe(e!=null,"Expected drag drop context"),e}function XI(e,t){const r=Ao(),n=v.useMemo(()=>new GI(r.getBackend()),[r]);return si(()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource()),[n,e]),si(()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview()),[n,t]),n}function KI(){const e=Ao();return v.useMemo(()=>new LI(e),[e])}class YI{beginDrag(){const t=this.spec,r=this.monitor;let n=null;return typeof t.item=="object"?n=t.item:typeof t.item=="function"?n=t.item(r):n={},n??null}canDrag(){const t=this.spec,r=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(r):!0}isDragging(t,r){const n=this.spec,i=this.monitor,{isDragging:o}=n;return o?o(i):r===t.getSourceId()}endDrag(){const t=this.spec,r=this.monitor,n=this.connector,{end:i}=t;i&&i(r.getItem(),r),n.reconnect()}constructor(t,r,n){this.spec=t,this.monitor=r,this.connector=n}}function qI(e,t,r){const n=v.useMemo(()=>new YI(e,t,r),[t,r]);return v.useEffect(()=>{n.spec=e},[e]),n}function QI(e){return v.useMemo(()=>{const t=e.type;return Fe(t!=null,"spec.type must be defined"),t},[e])}function ZI(e,t,r){const n=Ao(),i=qI(e,t,r),o=QI(e);si(function(){if(o!=null){const[s,l]=HI(o,i,n);return t.receiveHandlerId(s),r.receiveHandlerId(s),l}},[n,t,r,i,o])}function JI(e,t){const r=n2(e,t);Fe(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=KI(),i=XI(r.options,r.previewOptions);return ZI(r,n,i),[r2(r.collect,n,i),NI(i),MI(i)]}function e5(e){return v.useMemo(()=>e.hooks.dropTarget(),[e])}function t5(e){const t=Ao(),r=v.useMemo(()=>new jI(t.getBackend()),[t]);return si(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}function r5(){const e=Ao();return v.useMemo(()=>new BI(e),[e])}function n5(e){const{accept:t}=e;return v.useMemo(()=>(Fe(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class i5{canDrop(){const t=this.spec,r=this.monitor;return t.canDrop?t.canDrop(r.getItem(),r):!0}hover(){const t=this.spec,r=this.monitor;t.hover&&t.hover(r.getItem(),r)}drop(){const t=this.spec,r=this.monitor;if(t.drop)return t.drop(r.getItem(),r)}constructor(t,r){this.spec=t,this.monitor=r}}function o5(e,t){const r=v.useMemo(()=>new i5(e,t),[t]);return v.useEffect(()=>{r.spec=e},[e]),r}function a5(e,t,r){const n=Ao(),i=o5(e,t),o=n5(e);si(function(){const[s,l]=UI(o,i,n);return t.receiveHandlerId(s),r.receiveHandlerId(s),l},[n,t,i,r,o.map(a=>a.toString()).join("|")])}function s5(e,t){const r=n2(e,t),n=r5(),i=t5(r.options);return a5(r,n,i),[r2(r.collect,n,i),e5(i)]}function l5(e,t){return v.useReducer((r,n)=>{const i=t[r][n];return i??r},e)}const Ei=e=>{const{present:t,children:r}=e,n=u5(t),i=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),o=Ve(n.ref,i.ref);return typeof r=="function"||n.isPresent?v.cloneElement(i,{ref:o}):null};Ei.displayName="Presence";function u5(e){const[t,r]=v.useState(),n=v.useRef({}),i=v.useRef(e),o=v.useRef("none"),a=e?"mounted":"unmounted",[s,l]=l5(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=ks(n.current);o.current=s==="mounted"?u:"none"},[s]),Et(()=>{const u=n.current,c=i.current;if(c!==e){const d=o.current,h=ks(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(c&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Et(()=>{if(t){const u=f=>{const h=ks(n.current).includes(f.animationName);f.target===t&&h&&di.flushSync(()=>l("ANIMATION_END"))},c=f=>{f.target===t&&(o.current=ks(n.current))};return t.addEventListener("animationstart",c),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",c),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:v.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function ks(e){return(e==null?void 0:e.animationName)||"none"}const Nc="rovingFocusGroup.onEntryFocus",c5={bubbles:!1,cancelable:!0},eh="RovingFocusGroup",[Zf,o2,f5]=su(eh),[d5,a2]=nn(eh,[f5]),[h5,p5]=d5(eh),g5=v.forwardRef((e,t)=>v.createElement(Zf.Provider,{scope:e.__scopeRovingFocusGroup},v.createElement(Zf.Slot,{scope:e.__scopeRovingFocusGroup},v.createElement(m5,pe({},e,{ref:t}))))),m5=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,...c}=e,f=v.useRef(null),d=Ve(t,f),h=hd(o),[m=null,p]=uo({prop:a,defaultProp:s,onChange:l}),[g,x]=v.useState(!1),w=It(u),y=o2(r),_=v.useRef(!1),[N,M]=v.useState(0);return v.useEffect(()=>{const S=f.current;if(S)return S.addEventListener(Nc,w),()=>S.removeEventListener(Nc,w)},[w]),v.createElement(h5,{scope:r,orientation:n,dir:h,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(S=>p(S),[p]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>M(S=>S+1),[]),onFocusableItemRemove:v.useCallback(()=>M(S=>S-1),[])},v.createElement(Pe.div,pe({tabIndex:g||N===0?-1:0,"data-orientation":n},c,{ref:d,style:{outline:"none",...e.style},onMouseDown:_e(e.onMouseDown,()=>{_.current=!0}),onFocus:_e(e.onFocus,S=>{const C=!_.current;if(S.target===S.currentTarget&&C&&!g){const A=new CustomEvent(Nc,c5);if(S.currentTarget.dispatchEvent(A),!A.defaultPrevented){const L=y().filter(ne=>ne.focusable),H=L.find(ne=>ne.active),B=L.find(ne=>ne.id===m),Q=[H,B,...L].filter(Boolean).map(ne=>ne.ref.current);s2(Q)}}_.current=!1}),onBlur:_e(e.onBlur,()=>x(!1))})))}),v5="RovingFocusGroupItem",x5=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:o,...a}=e,s=Xr(),l=o||s,u=p5(v5,r),c=u.currentTabStopId===l,f=o2(r),{onFocusableItemAdd:d,onFocusableItemRemove:h}=u;return v.useEffect(()=>{if(n)return d(),()=>h()},[n,d,h]),v.createElement(Zf.ItemSlot,{scope:r,id:l,focusable:n,active:i},v.createElement(Pe.span,pe({tabIndex:c?0:-1,"data-orientation":u.orientation},a,{ref:t,onMouseDown:_e(e.onMouseDown,m=>{n?u.onItemFocus(l):m.preventDefault()}),onFocus:_e(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:_e(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){u.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const p=E5(m,u.orientation,u.dir);if(p!==void 0){m.preventDefault();let x=f().filter(w=>w.focusable).map(w=>w.ref.current);if(p==="last")x.reverse();else if(p==="prev"||p==="next"){p==="prev"&&x.reverse();const w=x.indexOf(m.currentTarget);x=u.loop?_5(x,w+1):x.slice(w+1)}setTimeout(()=>s2(x))}})})))}),w5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function y5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function E5(e,t,r){const n=y5(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return w5[n]}function s2(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function _5(e,t){return e.map((r,n)=>e[(t+n)%e.length])}const S5=g5,T5=x5,C5=["Enter"," "],A5=["ArrowDown","PageUp","Home"],l2=["ArrowUp","PageDown","End"],R5=[...A5,...l2],Du="Menu",[Jf,O5,F5]=su(Du),[_i,Pu]=nn(Du,[F5,fu,a2]),th=fu(),u2=a2(),[D5,ns]=_i(Du),[P5,rh]=_i(Du),I5=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:o,modal:a=!0}=e,s=th(t),[l,u]=v.useState(null),c=v.useRef(!1),f=It(o),d=hd(i);return v.useEffect(()=>{const h=()=>{c.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>c.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),v.createElement(Gv,s,v.createElement(D5,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:u},v.createElement(P5,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:c,dir:d,modal:a},n)))},b5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=th(r);return v.createElement(jv,pe({},i,n,{ref:t}))}),c2="MenuPortal",[k5,$5]=_i(c2,{forceMount:void 0}),N5=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,o=ns(c2,t);return v.createElement(k5,{scope:t,forceMount:r},v.createElement(Ei,{present:r||o.open},v.createElement(du,{asChild:!0,container:i},n)))},An="MenuContent",[M5,f2]=_i(An),L5=v.forwardRef((e,t)=>{const r=$5(An,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,o=ns(An,e.__scopeMenu),a=rh(An,e.__scopeMenu);return v.createElement(Jf.Provider,{scope:e.__scopeMenu},v.createElement(Ei,{present:n||o.open},v.createElement(Jf.Slot,{scope:e.__scopeMenu},a.modal?v.createElement(B5,pe({},i,{ref:t})):v.createElement(U5,pe({},i,{ref:t})))))}),B5=v.forwardRef((e,t)=>{const r=ns(An,e.__scopeMenu),n=v.useRef(null),i=Ve(t,n);return v.useEffect(()=>{const o=n.current;if(o)return Ed(o)},[]),v.createElement(d2,pe({},e,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:_e(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)}))}),U5=v.forwardRef((e,t)=>{const r=ns(An,e.__scopeMenu);return v.createElement(d2,pe({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)}))}),d2=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:d,onDismiss:h,disableOutsideScroll:m,...p}=e,g=ns(An,r),x=rh(An,r),w=th(r),y=u2(r),_=O5(r),[N,M]=v.useState(null),S=v.useRef(null),C=Ve(t,S,g.onContentChange),A=v.useRef(0),L=v.useRef(""),H=v.useRef(0),B=v.useRef(null),V=v.useRef("right"),Q=v.useRef(0),ne=m?_d:v.Fragment,ye=m?{as:ni,allowPinchZoom:!0}:void 0,ve=ie=>{var Ee,ee;const O=L.current+ie,k=_().filter(W=>!W.disabled),b=document.activeElement,D=(Ee=k.find(W=>W.ref.current===b))===null||Ee===void 0?void 0:Ee.textValue,U=k.map(W=>W.textValue),G=Q5(U,O,D),J=(ee=k.find(W=>W.textValue===G))===null||ee===void 0?void 0:ee.ref.current;(function W(q){L.current=q,window.clearTimeout(A.current),q!==""&&(A.current=window.setTimeout(()=>W(""),1e3))})(O),J&&setTimeout(()=>J.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),gd();const Ce=v.useCallback(ie=>{var Ee,ee;return V.current===((Ee=B.current)===null||Ee===void 0?void 0:Ee.side)&&J5(ie,(ee=B.current)===null||ee===void 0?void 0:ee.area)},[]);return v.createElement(M5,{scope:r,searchRef:L,onItemEnter:v.useCallback(ie=>{Ce(ie)&&ie.preventDefault()},[Ce]),onItemLeave:v.useCallback(ie=>{var Ee;Ce(ie)||((Ee=S.current)===null||Ee===void 0||Ee.focus(),M(null))},[Ce]),onTriggerLeave:v.useCallback(ie=>{Ce(ie)&&ie.preventDefault()},[Ce]),pointerGraceTimerRef:H,onPointerGraceIntentChange:v.useCallback(ie=>{B.current=ie},[])},v.createElement(ne,ye,v.createElement(md,{asChild:!0,trapped:i,onMountAutoFocus:_e(o,ie=>{var Ee;ie.preventDefault(),(Ee=S.current)===null||Ee===void 0||Ee.focus()}),onUnmountAutoFocus:a},v.createElement(lu,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:d,onDismiss:h},v.createElement(S5,pe({asChild:!0},y,{dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:N,onCurrentTabStopIdChange:M,onEntryFocus:_e(l,ie=>{x.isUsingKeyboardRef.current||ie.preventDefault()})}),v.createElement(Xv,pe({role:"menu","aria-orientation":"vertical","data-state":K5(g.open),"data-radix-menu-content":"",dir:x.dir},w,p,{ref:C,style:{outline:"none",...p.style},onKeyDown:_e(p.onKeyDown,ie=>{const ee=ie.target.closest("[data-radix-menu-content]")===ie.currentTarget,O=ie.ctrlKey||ie.altKey||ie.metaKey,k=ie.key.length===1;ee&&(ie.key==="Tab"&&ie.preventDefault(),!O&&k&&ve(ie.key));const b=S.current;if(ie.target!==b||!R5.includes(ie.key))return;ie.preventDefault();const U=_().filter(G=>!G.disabled).map(G=>G.ref.current);l2.includes(ie.key)&&U.reverse(),Y5(U)}),onBlur:_e(e.onBlur,ie=>{ie.currentTarget.contains(ie.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:_e(e.onPointerMove,t0(ie=>{const Ee=ie.target,ee=Q.current!==ie.clientX;if(ie.currentTarget.contains(Ee)&&ee){const O=ie.clientX>Q.current?"right":"left";V.current=O,Q.current=ie.clientX}}))})))))))}),H5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return v.createElement(Pe.div,pe({role:"group"},n,{ref:t}))}),V5=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return v.createElement(Pe.div,pe({},n,{ref:t}))}),e0="MenuItem",f1="menu.itemSelect",W5=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,o=v.useRef(null),a=rh(e0,e.__scopeMenu),s=f2(e0,e.__scopeMenu),l=Ve(t,o),u=v.useRef(!1),c=()=>{const f=o.current;if(!r&&f){const d=new CustomEvent(f1,{bubbles:!0,cancelable:!0});f.addEventListener(f1,h=>n==null?void 0:n(h),{once:!0}),pd(f,d),d.defaultPrevented?u.current=!1:a.onClose()}};return v.createElement(z5,pe({},i,{ref:l,disabled:r,onClick:_e(e.onClick,c),onPointerDown:f=>{var d;(d=e.onPointerDown)===null||d===void 0||d.call(e,f),u.current=!0},onPointerUp:_e(e.onPointerUp,f=>{var d;u.current||(d=f.currentTarget)===null||d===void 0||d.click()}),onKeyDown:_e(e.onKeyDown,f=>{const d=s.searchRef.current!=="";r||d&&f.key===" "||C5.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),z5=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...o}=e,a=f2(e0,r),s=u2(r),l=v.useRef(null),u=Ve(t,l),[c,f]=v.useState(!1),[d,h]=v.useState("");return v.useEffect(()=>{const m=l.current;if(m){var p;h(((p=m.textContent)!==null&&p!==void 0?p:"").trim())}},[o.children]),v.createElement(Jf.ItemSlot,{scope:r,disabled:n,textValue:i??d},v.createElement(T5,pe({asChild:!0},s,{focusable:!n}),v.createElement(Pe.div,pe({role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0},o,{ref:u,onPointerMove:_e(e.onPointerMove,t0(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus())})),onPointerLeave:_e(e.onPointerLeave,t0(m=>a.onItemLeave(m))),onFocus:_e(e.onFocus,()=>f(!0)),onBlur:_e(e.onBlur,()=>f(!1))}))))}),G5="MenuRadioGroup";_i(G5,{value:void 0,onValueChange:()=>{}});const j5="MenuItemIndicator";_i(j5,{checked:!1});const X5="MenuSub";_i(X5);function K5(e){return e?"open":"closed"}function Y5(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function q5(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function Q5(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let a=q5(e,Math.max(o,0));i.length===1&&(a=a.filter(u=>u!==r));const l=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}function Z5(e,t){const{x:r,y:n}=e;let i=!1;for(let o=0,a=t.length-1;on!=c>n&&r<(u-s)*(n-l)/(c-l)+s&&(i=!i)}return i}function J5(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return Z5(r,t)}function t0(e){return t=>t.pointerType==="mouse"?e(t):void 0}const h2=I5,p2=b5,g2=N5,m2=L5,e8=H5,t8=V5,r8=W5,v2="ContextMenu",[n8,Yk]=nn(v2,[Pu]),Iu=Pu(),[i8,x2]=n8(v2),o8=e=>{const{__scopeContextMenu:t,children:r,onOpenChange:n,dir:i,modal:o=!0}=e,[a,s]=v.useState(!1),l=Iu(t),u=It(n),c=v.useCallback(f=>{s(f),u(f)},[u]);return v.createElement(i8,{scope:t,open:a,onOpenChange:c,modal:o},v.createElement(h2,pe({},l,{dir:i,open:a,onOpenChange:c,modal:o}),r))},a8="ContextMenuTrigger",s8=v.forwardRef((e,t)=>{const{__scopeContextMenu:r,disabled:n=!1,...i}=e,o=x2(a8,r),a=Iu(r),s=v.useRef({x:0,y:0}),l=v.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),u=v.useRef(0),c=v.useCallback(()=>window.clearTimeout(u.current),[]),f=d=>{s.current={x:d.clientX,y:d.clientY},o.onOpenChange(!0)};return v.useEffect(()=>c,[c]),v.useEffect(()=>void(n&&c()),[n,c]),v.createElement(v.Fragment,null,v.createElement(p2,pe({},a,{virtualRef:l})),v.createElement(Pe.span,pe({"data-state":o.open?"open":"closed","data-disabled":n?"":void 0},i,{ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:_e(e.onContextMenu,d=>{c(),f(d),d.preventDefault()}),onPointerDown:n?e.onPointerDown:_e(e.onPointerDown,$s(d=>{c(),u.current=window.setTimeout(()=>f(d),700)})),onPointerMove:n?e.onPointerMove:_e(e.onPointerMove,$s(c)),onPointerCancel:n?e.onPointerCancel:_e(e.onPointerCancel,$s(c)),onPointerUp:n?e.onPointerUp:_e(e.onPointerUp,$s(c))})))}),l8=e=>{const{__scopeContextMenu:t,...r}=e,n=Iu(t);return v.createElement(g2,pe({},n,r))},u8="ContextMenuContent",c8=v.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,i=x2(u8,r),o=Iu(r),a=v.useRef(!1);return v.createElement(m2,pe({},o,n,{ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:s=>{var l;(l=e.onCloseAutoFocus)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&a.current&&s.preventDefault(),a.current=!1},onInteractOutside:s=>{var l;(l=e.onInteractOutside)===null||l===void 0||l.call(e,s),!s.defaultPrevented&&!i.modal&&(a.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))});function $s(e){return t=>t.pointerType!=="mouse"?e(t):void 0}const f8=o8,d8=s8,h8=l8,p8=c8,w2=new RegExp("^([0-9]+)(\\s)([kKmMbBtT])$");function g8({column:e,table:t,numberOfColumns:r}){const n=t.getPreFilteredRowModel().flatRows.map(u=>u.getValue(e.id)),i=n.every(u=>typeof u=="string"||u===null),o=n.every(u=>typeof u=="number"||w2.test(u)||u===null||u===""),a=n.some(u=>typeof u=="string"&&u.includes(" ")),s=e.getFilterValue();if(n.every(u=>{if(typeof u!="string")return!1;const c=u==null?void 0:u.replace(/[^0-9]/g,"").trim();return(c==null?void 0:c.length)>=4&&(Xd(e.id)||e.id.toLowerCase()==="index"&&!a)})){let u=function(c){if(!c)return null;const f=new Date(c),d=f.getFullYear(),h=f.getMonth()+1>9?f.getMonth()+1:`0${f.getMonth()+1}`,m=f.getDate()>9?f.getDate():`0${f.getDate()}`;return`${d}-${h}-${m}`};return Se("div",{className:"flex gap-2 h-10",children:[K("input",{type:"datetime-local",value:u(s==null?void 0:s[0])??"",onChange:c=>{const f=new Date(c.target.value).getTime();e.setFilterValue(d=>[f,d==null?void 0:d[1]])},placeholder:"Start date",className:"_input"}),K("input",{type:"datetime-local",value:u(s==null?void 0:s[1])??"",onChange:c=>{const f=new Date(c.target.value).getTime();e.setFilterValue(d=>[d==null?void 0:d[0],f])},placeholder:"End date",className:"_input"})]})}return o?Se("div",{className:"flex gap-0.5 h-10",children:[K("input",{type:"number",value:(s==null?void 0:s[0])??"",onChange:u=>e.setFilterValue(c=>[u.target.value,c==null?void 0:c[1]]),placeholder:"Min",className:"_input p-0.5"}),K("input",{type:"number",value:(s==null?void 0:s[1])??"",onChange:u=>e.setFilterValue(c=>[c==null?void 0:c[0],u.target.value]),placeholder:"Max",className:"_input p-0.5"})]}):i?K("div",{className:"h-10",children:K("input",{type:"text",value:s??"",onChange:u=>e.setFilterValue(u.target.value),placeholder:"Search...",className:"_input"})}):K("div",{className:"h-10"})}const m8=(e,t,r)=>(r.splice(r.indexOf(t),0,r.splice(r.indexOf(e),1)[0]),[...r]),v8=({header:e,table:t,advanced:r,idx:n,lockFirstColumn:i,setLockFirstColumn:o})=>{const{getState:a,setColumnOrder:s}=t,{columnOrder:l}=a(),{column:u}=e,[,c]=s5({accept:"column",drop:p=>{const g=m8(p.id,u.id,l);s(g)}}),[{isDragging:f},d,h]=JI({collect:p=>({isDragging:p.isDragging()}),item:()=>u,type:"column"}),m=()=>K("div",{ref:h,className:"flex gap-1 flex-col",children:e.isPlaceholder?null:Se(H1,{children:[Se("div",{className:"font-bold uppercase text-grey-700 dark:text-white tracking-widest flex gap-2 whitespace-nowrap justify-between",children:[Se("div",{onClick:u.getToggleSortingHandler(),className:Nt("flex gap-1",{"cursor-pointer select-none":u.getCanSort()}),children:[If(u.columnDef.header,e.getContext()),u.getCanSort()&&Se("div",{className:"flex flex-col gap-0.5 items-center justify-center",children:[K("button",{className:Nt({"text-[#669DCB]":u.getIsSorted()==="asc","text-grey-600":u.getIsSorted()!=="asc"}),children:K("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"4",fill:"none",viewBox:"0 0 11 5",children:K("path",{fill:"currentColor",d:"M10.333 5l-5-5-5 5"})})}),K("button",{className:Nt({"text-[#669DCB]":e.column.getIsSorted()==="desc","text-grey-600":e.column.getIsSorted()!=="desc"}),children:K("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"4",fill:"none",viewBox:"0 0 11 5",children:K("path",{fill:"currentColor",d:"M.333 0l5 5 5-5"})})})]})]}),r&&u.id!=="select"&&K("button",{ref:d,className:"text-grey-600 hover:text-grey-800 dark:hover:text-white",children:K("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",fill:"none",viewBox:"0 0 17 16",children:K("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M3.667 6l-2 2 2 2M6.333 3.333l2-2 2 2M10.333 12.667l-2 2-2-2M13 6l2 2-2 2M1.667 8H15M8.333 1.333v13.334"})})})]}),r&&u.getCanFilter()?K("div",{children:K(g8,{column:u,table:t,numberOfColumns:(l==null?void 0:l.length)??0})}):null]})});return Se("th",{className:Nt("h-[70px] p-4 sticky",{"left-0 z-50 bg-white dark:bg-grey-900":n===0&&i}),colSpan:e.colSpan,style:{width:e.getSize(),opacity:f?.5:1},ref:c,children:[n===0?Se(f8,{children:[K(d8,{asChild:!0,children:m()}),K(h8,{children:K(p8,{className:"bg-white text-black dark:text-white dark:bg-grey-900 border border-grey-200 dark:border-grey-800 rounded-md shadow-lg p-2 z-50 text-xs",children:K("div",{className:"flex flex-col gap-2",children:Se("button",{onClick:()=>{o(!i)},className:"hover:bg-grey-300 dark:hover:bg-grey-800 rounded-md p-2",children:[i?"Unlock":"Lock"," first column"]})})})})]}):m(),K("button",{className:"resizer bg-grey-300/20 dark:hover:bg-white absolute top-0 right-0 w-0.5 h-full",onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler()})]})};function y2(e){return typeof e!="number"?typeof e=="string"&&e.includes("All")?e:l0:e<1?l0:e}function x8({table:e,currentPage:t,setCurrentPage:r}){const n=e.getFilteredRowModel().rows.length||0;return Se("div",{className:"hidden md:flex items-center gap-8",children:[K(Vi,{value:t,onChange:i=>{const o=y2(i);r(o),o.toString().includes("All")?e.setPageSize(n):e.setPageSize(o)},labelType:"row",label:"Rows per page",placeholder:"Select rows per page",groups:[{label:"Rows per page",items:[10,20,30,40,50,`All (${n})`].map(i=>({label:`${i}`,value:i}))}]}),Se("span",{className:"flex items-center gap-1",children:[K("strong",{children:e.getState().pagination.pageIndex+1}),"of",K("strong",{children:e.getPageCount()})]}),Se("div",{className:"hidden lg:block",children:[K("button",{className:Nt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanPreviousPage(),"dark:text-white":e.getCanPreviousPage()}),onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:"<<"}),K("button",{className:Nt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanPreviousPage(),"dark:text-white":e.getCanPreviousPage()}),onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:"<"}),K("button",{className:Nt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanNextPage(),"dark:text-white":e.getCanNextPage()}),onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:">"}),K("button",{className:Nt("px-2",{"text-grey-400 dark:text-grey-700":!e.getCanNextPage(),"dark:text-white":e.getCanNextPage()}),onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:">>"})]})]})}function w8({columns:e,data:t,type:r,setType:n,downloadFinished:i}){const o=()=>{switch(r){case"csv":t1("csv",e,t,i);break;case"xlsx":t1("xlsx",e,t,i);break;case"png":dP("table",i);break}};return Se("div",{className:"flex gap-6 items-center",children:[K(Vi,{labelType:"row",value:r,onChange:a=>{n(a)},label:"Type",placeholder:"Select type",groups:[{label:"Type",items:u0.map(a=>({label:a,value:a}))}]}),K("button",{onClick:o,className:"_btn",children:"Export"})]})}const E2="DropdownMenu",[y8,qk]=nn(E2,[Pu]),Si=Pu(),[E8,_2]=y8(E2),_8=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=Si(t),u=v.useRef(null),[c=!1,f]=uo({prop:i,defaultProp:o,onChange:a});return v.createElement(E8,{scope:t,triggerId:Xr(),triggerRef:u,contentId:Xr(),open:c,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(d=>!d),[f]),modal:s},v.createElement(h2,pe({},l,{open:c,onOpenChange:f,dir:n,modal:s}),r))},S8="DropdownMenuTrigger",T8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,o=_2(S8,r),a=Si(r);return v.createElement(p2,pe({asChild:!0},a),v.createElement(Pe.button,pe({type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n},i,{ref:dd(t,o.triggerRef),onPointerDown:_e(e.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(o.onOpenToggle(),o.open||s.preventDefault())}),onKeyDown:_e(e.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&o.onOpenToggle(),s.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})))}),C8=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Si(t);return v.createElement(g2,pe({},n,r))},A8="DropdownMenuContent",R8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=_2(A8,r),o=Si(r),a=v.useRef(!1);return v.createElement(m2,pe({id:i.contentId,"aria-labelledby":i.triggerId},o,n,{ref:t,onCloseAutoFocus:_e(e.onCloseAutoFocus,s=>{var l;a.current||(l=i.triggerRef.current)===null||l===void 0||l.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:_e(e.onInteractOutside,s=>{const l=s.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,c=l.button===2||u;(!i.modal||c)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),O8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(e8,pe({},i,n,{ref:t}))}),F8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(t8,pe({},i,n,{ref:t}))}),D8=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Si(r);return v.createElement(r8,pe({},i,n,{ref:t}))}),P8=_8,d1=T8,I8=C8,b8=R8,k8=O8,$8=F8,Mc=D8;function N8(e,t){v.useEffect(()=>{const r=n=>{!e.current||e.current.contains(n.target)||t(n)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}},[e,t])}function h1({label:e,table:t,onlyIconTrigger:r=!1}){const[n,i]=v.useState(!1),o=v.useRef(null);N8(o,()=>i(!1)),v.useEffect(()=>{const s=l=>{l.key==="Escape"&&i(!1)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[]);function a(){t.resetColumnFilters(),i(!1)}return Se(P8,{open:n,children:[r?K(d1,{title:"Filter columns",onClick:()=>i(!n),children:K("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-7 h-7",children:K("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"})})}):Se(k8,{className:"flex flex-row items-center gap-2",children:[K($8,{className:"whitespace-nowrap",children:e}),Se(d1,{onClick:()=>i(!n),className:"bg-white text-black dark:bg-grey-900 dark:text-white whitespace-nowrap h-[36px] border-[1.5px] border-grey-700 rounded p-3 inline-flex items-center justify-center leading-none gap-[5px] shadow-[0_2px_10px] shadow-black/10 focus:shadow-[0_0_0_2px] focus:shadow-black data-[placeholder]:text-white outline-none","aria-label":e,children:[K("span",{children:"Filter columns"}),K(Hf,{className:Nt({"transform rotate-180 duration-200 transition":n})})]})]}),K(I8,{children:Se(b8,{sideOffset:10,ref:o,className:"z-50 bg-white/80 dark:bg-grey-900/80 backdrop-filter backdrop-blur flex flex-col gap-4 overflow-auto border-[1.5px] border-grey-700 rounded p-3 max-h-[500px] text-black dark:text-white",children:[K(Mc,{children:K("button",{className:"_btn w-full",onClick:a,children:"Clear Filters"})}),K(Mc,{children:Se("label",{className:"flex items-center gap-2",children:[K("input",{type:"checkbox",checked:t.getIsAllColumnsVisible(),onChange:t.getToggleAllColumnsVisibilityHandler()}),"Toggle All"]})}),t.getAllLeafColumns().filter(s=>s.id!=="select").map(s=>K(Mc,{children:Se("label",{className:"flex items-center gap-2",children:[K("input",{type:"checkbox",checked:s.getIsVisible(),onChange:s.getToggleVisibilityHandler()}),s.id]})},s.id))]})})]})}var r0={exports:{}},Ze={},n0={exports:{}},Ti={};function S2(){var e={};return e["align-content"]=!1,e["align-items"]=!1,e["align-self"]=!1,e["alignment-adjust"]=!1,e["alignment-baseline"]=!1,e.all=!1,e["anchor-point"]=!1,e.animation=!1,e["animation-delay"]=!1,e["animation-direction"]=!1,e["animation-duration"]=!1,e["animation-fill-mode"]=!1,e["animation-iteration-count"]=!1,e["animation-name"]=!1,e["animation-play-state"]=!1,e["animation-timing-function"]=!1,e.azimuth=!1,e["backface-visibility"]=!1,e.background=!0,e["background-attachment"]=!0,e["background-clip"]=!0,e["background-color"]=!0,e["background-image"]=!0,e["background-origin"]=!0,e["background-position"]=!0,e["background-repeat"]=!0,e["background-size"]=!0,e["baseline-shift"]=!1,e.binding=!1,e.bleed=!1,e["bookmark-label"]=!1,e["bookmark-level"]=!1,e["bookmark-state"]=!1,e.border=!0,e["border-bottom"]=!0,e["border-bottom-color"]=!0,e["border-bottom-left-radius"]=!0,e["border-bottom-right-radius"]=!0,e["border-bottom-style"]=!0,e["border-bottom-width"]=!0,e["border-collapse"]=!0,e["border-color"]=!0,e["border-image"]=!0,e["border-image-outset"]=!0,e["border-image-repeat"]=!0,e["border-image-slice"]=!0,e["border-image-source"]=!0,e["border-image-width"]=!0,e["border-left"]=!0,e["border-left-color"]=!0,e["border-left-style"]=!0,e["border-left-width"]=!0,e["border-radius"]=!0,e["border-right"]=!0,e["border-right-color"]=!0,e["border-right-style"]=!0,e["border-right-width"]=!0,e["border-spacing"]=!0,e["border-style"]=!0,e["border-top"]=!0,e["border-top-color"]=!0,e["border-top-left-radius"]=!0,e["border-top-right-radius"]=!0,e["border-top-style"]=!0,e["border-top-width"]=!0,e["border-width"]=!0,e.bottom=!1,e["box-decoration-break"]=!0,e["box-shadow"]=!0,e["box-sizing"]=!0,e["box-snap"]=!0,e["box-suppress"]=!0,e["break-after"]=!0,e["break-before"]=!0,e["break-inside"]=!0,e["caption-side"]=!1,e.chains=!1,e.clear=!0,e.clip=!1,e["clip-path"]=!1,e["clip-rule"]=!1,e.color=!0,e["color-interpolation-filters"]=!0,e["column-count"]=!1,e["column-fill"]=!1,e["column-gap"]=!1,e["column-rule"]=!1,e["column-rule-color"]=!1,e["column-rule-style"]=!1,e["column-rule-width"]=!1,e["column-span"]=!1,e["column-width"]=!1,e.columns=!1,e.contain=!1,e.content=!1,e["counter-increment"]=!1,e["counter-reset"]=!1,e["counter-set"]=!1,e.crop=!1,e.cue=!1,e["cue-after"]=!1,e["cue-before"]=!1,e.cursor=!1,e.direction=!1,e.display=!0,e["display-inside"]=!0,e["display-list"]=!0,e["display-outside"]=!0,e["dominant-baseline"]=!1,e.elevation=!1,e["empty-cells"]=!1,e.filter=!1,e.flex=!1,e["flex-basis"]=!1,e["flex-direction"]=!1,e["flex-flow"]=!1,e["flex-grow"]=!1,e["flex-shrink"]=!1,e["flex-wrap"]=!1,e.float=!1,e["float-offset"]=!1,e["flood-color"]=!1,e["flood-opacity"]=!1,e["flow-from"]=!1,e["flow-into"]=!1,e.font=!0,e["font-family"]=!0,e["font-feature-settings"]=!0,e["font-kerning"]=!0,e["font-language-override"]=!0,e["font-size"]=!0,e["font-size-adjust"]=!0,e["font-stretch"]=!0,e["font-style"]=!0,e["font-synthesis"]=!0,e["font-variant"]=!0,e["font-variant-alternates"]=!0,e["font-variant-caps"]=!0,e["font-variant-east-asian"]=!0,e["font-variant-ligatures"]=!0,e["font-variant-numeric"]=!0,e["font-variant-position"]=!0,e["font-weight"]=!0,e.grid=!1,e["grid-area"]=!1,e["grid-auto-columns"]=!1,e["grid-auto-flow"]=!1,e["grid-auto-rows"]=!1,e["grid-column"]=!1,e["grid-column-end"]=!1,e["grid-column-start"]=!1,e["grid-row"]=!1,e["grid-row-end"]=!1,e["grid-row-start"]=!1,e["grid-template"]=!1,e["grid-template-areas"]=!1,e["grid-template-columns"]=!1,e["grid-template-rows"]=!1,e["hanging-punctuation"]=!1,e.height=!0,e.hyphens=!1,e.icon=!1,e["image-orientation"]=!1,e["image-resolution"]=!1,e["ime-mode"]=!1,e["initial-letters"]=!1,e["inline-box-align"]=!1,e["justify-content"]=!1,e["justify-items"]=!1,e["justify-self"]=!1,e.left=!1,e["letter-spacing"]=!0,e["lighting-color"]=!0,e["line-box-contain"]=!1,e["line-break"]=!1,e["line-grid"]=!1,e["line-height"]=!1,e["line-snap"]=!1,e["line-stacking"]=!1,e["line-stacking-ruby"]=!1,e["line-stacking-shift"]=!1,e["line-stacking-strategy"]=!1,e["list-style"]=!0,e["list-style-image"]=!0,e["list-style-position"]=!0,e["list-style-type"]=!0,e.margin=!0,e["margin-bottom"]=!0,e["margin-left"]=!0,e["margin-right"]=!0,e["margin-top"]=!0,e["marker-offset"]=!1,e["marker-side"]=!1,e.marks=!1,e.mask=!1,e["mask-box"]=!1,e["mask-box-outset"]=!1,e["mask-box-repeat"]=!1,e["mask-box-slice"]=!1,e["mask-box-source"]=!1,e["mask-box-width"]=!1,e["mask-clip"]=!1,e["mask-image"]=!1,e["mask-origin"]=!1,e["mask-position"]=!1,e["mask-repeat"]=!1,e["mask-size"]=!1,e["mask-source-type"]=!1,e["mask-type"]=!1,e["max-height"]=!0,e["max-lines"]=!1,e["max-width"]=!0,e["min-height"]=!0,e["min-width"]=!0,e["move-to"]=!1,e["nav-down"]=!1,e["nav-index"]=!1,e["nav-left"]=!1,e["nav-right"]=!1,e["nav-up"]=!1,e["object-fit"]=!1,e["object-position"]=!1,e.opacity=!1,e.order=!1,e.orphans=!1,e.outline=!1,e["outline-color"]=!1,e["outline-offset"]=!1,e["outline-style"]=!1,e["outline-width"]=!1,e.overflow=!1,e["overflow-wrap"]=!1,e["overflow-x"]=!1,e["overflow-y"]=!1,e.padding=!0,e["padding-bottom"]=!0,e["padding-left"]=!0,e["padding-right"]=!0,e["padding-top"]=!0,e.page=!1,e["page-break-after"]=!1,e["page-break-before"]=!1,e["page-break-inside"]=!1,e["page-policy"]=!1,e.pause=!1,e["pause-after"]=!1,e["pause-before"]=!1,e.perspective=!1,e["perspective-origin"]=!1,e.pitch=!1,e["pitch-range"]=!1,e["play-during"]=!1,e.position=!1,e["presentation-level"]=!1,e.quotes=!1,e["region-fragment"]=!1,e.resize=!1,e.rest=!1,e["rest-after"]=!1,e["rest-before"]=!1,e.richness=!1,e.right=!1,e.rotation=!1,e["rotation-point"]=!1,e["ruby-align"]=!1,e["ruby-merge"]=!1,e["ruby-position"]=!1,e["shape-image-threshold"]=!1,e["shape-outside"]=!1,e["shape-margin"]=!1,e.size=!1,e.speak=!1,e["speak-as"]=!1,e["speak-header"]=!1,e["speak-numeral"]=!1,e["speak-punctuation"]=!1,e["speech-rate"]=!1,e.stress=!1,e["string-set"]=!1,e["tab-size"]=!1,e["table-layout"]=!1,e["text-align"]=!0,e["text-align-last"]=!0,e["text-combine-upright"]=!0,e["text-decoration"]=!0,e["text-decoration-color"]=!0,e["text-decoration-line"]=!0,e["text-decoration-skip"]=!0,e["text-decoration-style"]=!0,e["text-emphasis"]=!0,e["text-emphasis-color"]=!0,e["text-emphasis-position"]=!0,e["text-emphasis-style"]=!0,e["text-height"]=!0,e["text-indent"]=!0,e["text-justify"]=!0,e["text-orientation"]=!0,e["text-overflow"]=!0,e["text-shadow"]=!0,e["text-space-collapse"]=!0,e["text-transform"]=!0,e["text-underline-position"]=!0,e["text-wrap"]=!0,e.top=!1,e.transform=!1,e["transform-origin"]=!1,e["transform-style"]=!1,e.transition=!1,e["transition-delay"]=!1,e["transition-duration"]=!1,e["transition-property"]=!1,e["transition-timing-function"]=!1,e["unicode-bidi"]=!1,e["vertical-align"]=!1,e.visibility=!1,e["voice-balance"]=!1,e["voice-duration"]=!1,e["voice-family"]=!1,e["voice-pitch"]=!1,e["voice-range"]=!1,e["voice-rate"]=!1,e["voice-stress"]=!1,e["voice-volume"]=!1,e.volume=!1,e["white-space"]=!1,e.widows=!1,e.width=!0,e["will-change"]=!1,e["word-break"]=!0,e["word-spacing"]=!0,e["word-wrap"]=!0,e["wrap-flow"]=!1,e["wrap-through"]=!1,e["writing-mode"]=!1,e["z-index"]=!1,e}function M8(e,t,r){}function L8(e,t,r){}var B8=/javascript\s*\:/img;function U8(e,t){return B8.test(t)?"":t}Ti.whiteList=S2();Ti.getDefaultWhiteList=S2;Ti.onAttr=M8;Ti.onIgnoreAttr=L8;Ti.safeAttrValue=U8;var H8={indexOf:function(e,t){var r,n;if(Array.prototype.indexOf)return e.indexOf(t);for(r=0,n=e.length;r/g,rb=/"/g,nb=/"/g,ib=/&#([a-zA-Z0-9]*);?/gim,ob=/:?/gim,ab=/&newline;?/gim,Ms=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,g1=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,m1=/u\s*r\s*l\s*\(.*/gi;function O2(e){return e.replace(rb,""")}function F2(e){return e.replace(nb,'"')}function D2(e){return e.replace(ib,function(r,n){return n[0]==="x"||n[0]==="X"?String.fromCharCode(parseInt(n.substr(1),16)):String.fromCharCode(parseInt(n,10))})}function P2(e){return e.replace(ob,":").replace(ab," ")}function I2(e){for(var t="",r=0,n=e.length;r",n);if(i===-1)break;r=i+3}return t}function cb(e){var t=e.split("");return t=t.filter(function(r){var n=r.charCodeAt(0);return n===127?!1:n<=31?n===10||n===13:!0}),t.join("")}Ze.whiteList=C2();Ze.getDefaultWhiteList=C2;Ze.onTag=Y8;Ze.onIgnoreTag=q8;Ze.onTagAttr=Q8;Ze.onIgnoreTagAttr=Z8;Ze.safeAttrValue=J8;Ze.escapeHtml=R2;Ze.escapeQuote=O2;Ze.unescapeQuote=F2;Ze.escapeHtmlEntities=D2;Ze.escapeDangerHtml5Entities=P2;Ze.clearNonPrintableCharacter=I2;Ze.friendlyAttrValue=b2;Ze.escapeAttrValue=k2;Ze.onIgnoreTagStripAll=sb;Ze.StripTagBody=lb;Ze.stripCommentTag=ub;Ze.stripBlankChar=cb;Ze.cssFilter=A2;Ze.getDefaultCSSWhiteList=K8;var bu={},un=ih;function fb(e){var t=un.spaceIndex(e),r;return t===-1?r=e.slice(1,-1):r=e.slice(1,t+1),r=un.trim(r).toLowerCase(),r.slice(0,1)==="/"&&(r=r.slice(1)),r.slice(-1)==="/"&&(r=r.slice(0,-1)),r}function db(e){return e.slice(0,2)===""||s===l-1){n+=r(e.slice(i,o)),c=e.slice(o,s+1),u=fb(c),n+=t(o,n.length,u,c,db(c)),i=s+1,o=!1;continue}if(f==='"'||f==="'")for(var d=1,h=e.charAt(s-d);h.trim()===""||h==="=";){if(h==="="){a=f;continue e}h=e.charAt(s-++d)}}else if(f===a){a=!1;continue}}return i0;t--){var r=e[t];if(r!==" ")return r==="="?t:-1}}function wb(e){return e[0]==='"'&&e[e.length-1]==='"'||e[0]==="'"&&e[e.length-1]==="'"}function v1(e){return wb(e)?e.substr(1,e.length-2):e}bu.parseTag=hb;bu.parseAttr=gb;var yb=nh.FilterCSS,yr=Ze,$2=bu,Eb=$2.parseTag,_b=$2.parseAttr,tl=ih;function Ls(e){return e==null}function Sb(e){var t=tl.spaceIndex(e);if(t===-1)return{html:"",closing:e[e.length-2]==="/"};e=tl.trim(e.slice(t+1,-1));var r=e[e.length-1]==="/";return r&&(e=tl.trim(e.slice(0,-1))),{html:e,closing:r}}function Tb(e){var t={};for(var r in e)t[r]=e[r];return t}function Cb(e){var t={};for(var r in e)Array.isArray(e[r])?t[r.toLowerCase()]=e[r].map(function(n){return n.toLowerCase()}):t[r.toLowerCase()]=e[r];return t}function N2(e){e=Tb(e||{}),e.stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=yr.onIgnoreTagStripAll),e.whiteList||e.allowList?e.whiteList=Cb(e.whiteList||e.allowList):e.whiteList=yr.whiteList,e.onTag=e.onTag||yr.onTag,e.onTagAttr=e.onTagAttr||yr.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||yr.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||yr.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||yr.safeAttrValue,e.escapeHtml=e.escapeHtml||yr.escapeHtml,this.options=e,e.css===!1?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new yb(e.css))}N2.prototype.process=function(e){if(e=e||"",e=e.toString(),!e)return"";var t=this,r=t.options,n=r.whiteList,i=r.onTag,o=r.onIgnoreTag,a=r.onTagAttr,s=r.onIgnoreTagAttr,l=r.safeAttrValue,u=r.escapeHtml,c=t.cssFilter;r.stripBlankChar&&(e=yr.stripBlankChar(e)),r.allowCommentTag||(e=yr.stripCommentTag(e));var f=!1;r.stripIgnoreTagBody&&(f=yr.StripTagBody(r.stripIgnoreTagBody,o),o=f.onIgnoreTag);var d=Eb(e,function(h,m,p,g,x){var w={sourcePosition:h,position:m,isClosing:x,isWhite:Object.prototype.hasOwnProperty.call(n,p)},y=i(p,g,w);if(!Ls(y))return y;if(w.isWhite){if(w.isClosing)return"";var _=Sb(g),N=n[p],M=_b(_.html,function(S,C){var A=tl.indexOf(N,S)!==-1,L=a(p,S,C,A);return Ls(L)?A?(C=l(p,S,C,c),C?S+'="'+C+'"':S):(L=s(p,S,C,A),Ls(L)?void 0:L):L});return g="<"+p,M&&(g+=" "+M),_.closing&&(g+=" /"),g+=">",g}else return y=o(p,g,w),Ls(y)?u(g):y},u);return f&&(d=f.remove(d)),d};var Ab=N2;(function(e,t){var r=Ze,n=bu,i=Ab;function o(s,l){var u=new i(l);return u.process(s)}t=e.exports=o,t.filterXSS=o,t.FilterXSS=i,function(){for(var s in r)t[s]=r[s];for(var l in n)t[l]=n[l]}(),typeof window<"u"&&(window.filterXSS=e.exports);function a(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}a()&&(self.filterXSS=e.exports)})(r0,r0.exports);var Rb=r0.exports;const Ob=Ha(Rb);function jo(e,t,r){const[n,i]=v.useState(()=>{if(typeof window>"u")return t;try{const a=window.localStorage.getItem(e);return a?r?r(JSON.parse(a)):JSON.parse(a):t}catch(a){return console.log(a),t}});return[n,a=>{try{const s=a instanceof Function?a(n):a;i(s),typeof window<"u"&&window.localStorage.setItem(e,JSON.stringify(s))}catch(s){console.log(s)}}]}const M2="ToastProvider",[oh,Fb,Db]=su("Toast"),[L2,Qk]=nn("Toast",[Db]),[Pb,ku]=L2(M2),B2=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:a}=e,[s,l]=v.useState(null),[u,c]=v.useState(0),f=v.useRef(!1),d=v.useRef(!1);return v.createElement(oh.Provider,{scope:t},v.createElement(Pb,{scope:t,label:r,duration:n,swipeDirection:i,swipeThreshold:o,toastCount:u,viewport:s,onViewportChange:l,onToastAdd:v.useCallback(()=>c(h=>h+1),[]),onToastRemove:v.useCallback(()=>c(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:d},a))};B2.propTypes={label(e){if(e.label&&typeof e.label=="string"&&!e.label.trim()){const t=`Invalid prop \`label\` supplied to \`${M2}\`. Expected non-empty \`string\`.`;return new Error(t)}return null}};const Ib="ToastViewport",bb=["F8"],i0="toast.viewportPause",o0="toast.viewportResume",kb=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=bb,label:i="Notifications ({hotkey})",...o}=e,a=ku(Ib,r),s=Fb(r),l=v.useRef(null),u=v.useRef(null),c=v.useRef(null),f=v.useRef(null),d=Ve(t,f,a.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=a.toastCount>0;v.useEffect(()=>{const g=x=>{var w;n.every(_=>x[_]||x.code===_)&&((w=f.current)===null||w===void 0||w.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]),v.useEffect(()=>{const g=l.current,x=f.current;if(m&&g&&x){const w=()=>{if(!a.isClosePausedRef.current){const M=new CustomEvent(i0);x.dispatchEvent(M),a.isClosePausedRef.current=!0}},y=()=>{if(a.isClosePausedRef.current){const M=new CustomEvent(o0);x.dispatchEvent(M),a.isClosePausedRef.current=!1}},_=M=>{!g.contains(M.relatedTarget)&&y()},N=()=>{g.contains(document.activeElement)||y()};return g.addEventListener("focusin",w),g.addEventListener("focusout",_),g.addEventListener("pointermove",w),g.addEventListener("pointerleave",N),window.addEventListener("blur",w),window.addEventListener("focus",y),()=>{g.removeEventListener("focusin",w),g.removeEventListener("focusout",_),g.removeEventListener("pointermove",w),g.removeEventListener("pointerleave",N),window.removeEventListener("blur",w),window.removeEventListener("focus",y)}}},[m,a.isClosePausedRef]);const p=v.useCallback(({tabbingDirection:g})=>{const w=s().map(y=>{const _=y.ref.current,N=[_,...Qb(_)];return g==="forwards"?N:N.reverse()});return(g==="forwards"?w.reverse():w).flat()},[s]);return v.useEffect(()=>{const g=f.current;if(g){const x=w=>{const y=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!y){const C=document.activeElement,A=w.shiftKey;if(w.target===g&&A){var N;(N=u.current)===null||N===void 0||N.focus();return}const B=p({tabbingDirection:A?"backwards":"forwards"}),V=B.findIndex(Q=>Q===C);if(Lc(B.slice(V+1)))w.preventDefault();else{var M,S;A?(M=u.current)===null||M===void 0||M.focus():(S=c.current)===null||S===void 0||S.focus()}}};return g.addEventListener("keydown",x),()=>g.removeEventListener("keydown",x)}},[s,p]),v.createElement(MS,{ref:l,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:m?void 0:"none"}},m&&v.createElement(x1,{ref:u,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"forwards"});Lc(g)}}),v.createElement(oh.Slot,{scope:r},v.createElement(Pe.ol,pe({tabIndex:-1},o,{ref:d}))),m&&v.createElement(x1,{ref:c,onFocusFromOutsideViewport:()=>{const g=p({tabbingDirection:"backwards"});Lc(g)}}))}),$b="ToastFocusProxy",x1=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...i}=e,o=ku($b,r);return v.createElement(yd,pe({"aria-hidden":!0,tabIndex:0},i,{ref:t,style:{position:"fixed"},onFocus:a=>{var s;const l=a.relatedTarget;!((s=o.viewport)!==null&&s!==void 0&&s.contains(l))&&n()}}))}),$u="Toast",Nb="toast.swipeStart",Mb="toast.swipeMove",Lb="toast.swipeCancel",Bb="toast.swipeEnd",Ub=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:i,onOpenChange:o,...a}=e,[s=!0,l]=uo({prop:n,defaultProp:i,onChange:o});return v.createElement(Ei,{present:r||s},v.createElement(U2,pe({open:s},a,{ref:t,onClose:()=>l(!1),onPause:It(e.onPause),onResume:It(e.onResume),onSwipeStart:_e(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:_e(e.onSwipeMove,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:_e(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:_e(e.onSwipeEnd,u=>{const{x:c,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${c}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})))}),[Hb,Vb]=L2($u,{onClose(){}}),U2=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:i,open:o,onClose:a,onEscapeKeyDown:s,onPause:l,onResume:u,onSwipeStart:c,onSwipeMove:f,onSwipeCancel:d,onSwipeEnd:h,...m}=e,p=ku($u,r),[g,x]=v.useState(null),w=Ve(t,Q=>x(Q)),y=v.useRef(null),_=v.useRef(null),N=i||p.duration,M=v.useRef(0),S=v.useRef(N),C=v.useRef(0),{onToastAdd:A,onToastRemove:L}=p,H=It(()=>{var Q;(g==null?void 0:g.contains(document.activeElement))&&((Q=p.viewport)===null||Q===void 0||Q.focus()),a()}),B=v.useCallback(Q=>{!Q||Q===1/0||(window.clearTimeout(C.current),M.current=new Date().getTime(),C.current=window.setTimeout(H,Q))},[H]);v.useEffect(()=>{const Q=p.viewport;if(Q){const ne=()=>{B(S.current),u==null||u()},ye=()=>{const ve=new Date().getTime()-M.current;S.current=S.current-ve,window.clearTimeout(C.current),l==null||l()};return Q.addEventListener(i0,ye),Q.addEventListener(o0,ne),()=>{Q.removeEventListener(i0,ye),Q.removeEventListener(o0,ne)}}},[p.viewport,N,l,u,B]),v.useEffect(()=>{o&&!p.isClosePausedRef.current&&B(N)},[o,N,p.isClosePausedRef,B]),v.useEffect(()=>(A(),()=>L()),[A,L]);const V=v.useMemo(()=>g?W2(g):null,[g]);return p.viewport?v.createElement(v.Fragment,null,V&&v.createElement(Wb,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0},V),v.createElement(Hb,{scope:r,onClose:H},di.createPortal(v.createElement(oh.ItemSlot,{scope:r},v.createElement(NS,{asChild:!0,onEscapeKeyDown:_e(s,()=>{p.isFocusedToastEscapeKeyDownRef.current||H(),p.isFocusedToastEscapeKeyDownRef.current=!1})},v.createElement(Pe.li,pe({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":p.swipeDirection},m,{ref:w,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:_e(e.onKeyDown,Q=>{Q.key==="Escape"&&(s==null||s(Q.nativeEvent),Q.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,H()))}),onPointerDown:_e(e.onPointerDown,Q=>{Q.button===0&&(y.current={x:Q.clientX,y:Q.clientY})}),onPointerMove:_e(e.onPointerMove,Q=>{if(!y.current)return;const ne=Q.clientX-y.current.x,ye=Q.clientY-y.current.y,ve=!!_.current,Ce=["left","right"].includes(p.swipeDirection),ie=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,Ee=Ce?ie(0,ne):0,ee=Ce?0:ie(0,ye),O=Q.pointerType==="touch"?10:2,k={x:Ee,y:ee},b={originalEvent:Q,delta:k};ve?(_.current=k,Bs(Mb,f,b,{discrete:!1})):w1(k,p.swipeDirection,O)?(_.current=k,Bs(Nb,c,b,{discrete:!1}),Q.target.setPointerCapture(Q.pointerId)):(Math.abs(ne)>O||Math.abs(ye)>O)&&(y.current=null)}),onPointerUp:_e(e.onPointerUp,Q=>{const ne=_.current,ye=Q.target;if(ye.hasPointerCapture(Q.pointerId)&&ye.releasePointerCapture(Q.pointerId),_.current=null,y.current=null,ne){const ve=Q.currentTarget,Ce={originalEvent:Q,delta:ne};w1(ne,p.swipeDirection,p.swipeThreshold)?Bs(Bb,h,Ce,{discrete:!0}):Bs(Lb,d,Ce,{discrete:!0}),ve.addEventListener("click",ie=>ie.preventDefault(),{once:!0})}})})))),p.viewport))):null});U2.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){const t=`Invalid prop \`type\` supplied to \`${$u}\`. Expected \`foreground | background\`.`;return new Error(t)}return null}};const Wb=e=>{const{__scopeToast:t,children:r,...n}=e,i=ku($u,t),[o,a]=v.useState(!1),[s,l]=v.useState(!1);return Yb(()=>a(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),s?null:v.createElement(du,{asChild:!0},v.createElement(yd,n,o&&v.createElement(v.Fragment,null,i.label," ",r)))},zb=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.createElement(Pe.div,pe({},n,{ref:t}))}),Gb=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.createElement(Pe.div,pe({},n,{ref:t}))}),jb="ToastAction",Xb=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r?v.createElement(V2,{altText:r,asChild:!0},v.createElement(H2,pe({},n,{ref:t}))):null});Xb.propTypes={altText(e){return e.altText?null:new Error(`Missing prop \`altText\` expected on \`${jb}\``)}};const Kb="ToastClose",H2=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,i=Vb(Kb,r);return v.createElement(V2,{asChild:!0},v.createElement(Pe.button,pe({type:"button"},n,{ref:t,onClick:_e(e.onClick,i.onClose)})))}),V2=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...i}=e;return v.createElement(Pe.div,pe({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0},i,{ref:t}))});function W2(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),qb(n)){const i=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const a=n.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...W2(n))}}),t}function Bs(e,t,r,{discrete:n}){const i=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&i.addEventListener(e,t,{once:!0}),n?pd(i,o):i.dispatchEvent(o)}const w1=(e,t,r=0)=>{const n=Math.abs(e.x),i=Math.abs(e.y),o=n>i;return t==="left"||t==="right"?o&&n>r:!o&&i>r};function Yb(e=()=>{}){const t=It(e);Et(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function qb(e){return e.nodeType===e.ELEMENT_NODE}function Qb(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Lc(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}const Zb=B2,Jb=kb,ek=Ub,tk=zb,rk=Gb,nk=H2,jl=({title:e,titleId:t,...r})=>K("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,...r,children:K("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),ik=({title:e,titleId:t,...r})=>Se("svg",{viewBox:"0 0 18 18",width:18,height:18,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?K("title",{id:t,children:e}):null,K("path",{d:"M9 16.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15ZM11.25 6.75l-4.5 4.5M6.75 6.75l4.5 4.5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),ok=({title:e,titleId:t,...r})=>Se("svg",{viewBox:"0 0 24 24",width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?K("title",{id:t,children:e}):null,K("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM12 16v-4M12 8h.01",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),ak=({title:e,titleId:t,...r})=>Se("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?K("title",{id:t,children:e}):null,K("path",{d:"M16.5 8.31V9a7.5 7.5 0 1 1-4.447-6.855",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),K("path",{d:"M16.5 3 9 10.508l-2.25-2.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),sk=({title:e,titleId:t,...r})=>Se("svg",{viewBox:"0 0 18 18",width:18,height:18,fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":t,...r,children:[e?K("title",{id:t,children:e}):null,K("path",{d:"M7.718 2.895 1.366 13.5a1.5 1.5 0 0 0 1.282 2.25h12.705a1.5 1.5 0 0 0 1.283-2.25L10.283 2.895a1.5 1.5 0 0 0-2.565 0v0ZM9 6.75v3M9 12.75h.008",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})]}),lk=({toast:e,open:t,setOpen:r})=>Se(Zb,{children:[Se(ek,{open:t,onOpenChange:n=>{e.preventClose||r(n)},className:Nt("z-50 fixed bottom-4 md:left-1/2 md:-translate-x-[50%] inset-x-4 w-auto shadow-lg md:max-w-[658px] duration-300","radix-state-open:animate-fade-in","radix-state-closed:animate-toast-hide","radix-swipe-end:animate-toast-swipe-out","translate-x-radix-toast-swipe-move-x","radix-swipe-cancel:translate-x-0 radix-swipe-cancel:duration-200 radix-swipe-cancel:ease-[ease]","px-[40px] md:px-[58px] py-6 flex flex-col border rounded-[4px]",{"bg-green-100 text-green-600 border-green-600":e.status==="success","bg-red-200 text-red-600 border-red-600":e.status==="error","bg-blue-100 text-blue-700 border-blue-600":e.status==="info","bg-orange-200 text-orange-600 border-orange-600":e.status==="warning"},{"h-[72px]":!e.description}),children:[e.status==="success"?K(ak,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):e.status==="warning"?K(sk,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):e.status==="error"?K(ik,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}):K(ok,{className:"absolute left-[8px] md:left-[25px] top-[25px]"}),K(tk,{className:"text-grey-900 font-bold text-sm",children:e.title}),e.description&&K(rk,{className:"mt-2 text-[10px] md:text-xs text-grey-800",children:e.description}),K(nk,{className:"absolute top-7 right-5 md:right-7",children:K(jl,{className:"w-4 h-4 text-grey-900"})})]}),K(Jb,{})]});function uk(e){const[t,r]=v.useState(e),n=t==="dark"?"light":"dark";return v.useEffect(()=>{const i=window.document.documentElement;i.classList.remove(n),i.classList.add(t)},[t,n]),[n,r]}const z2="Dialog",[G2,Zk]=nn(z2),[ck,Mr]=G2(z2),fk=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,s=v.useRef(null),l=v.useRef(null),[u=!1,c]=uo({prop:n,defaultProp:i,onChange:o});return v.createElement(ck,{scope:t,triggerRef:s,contentRef:l,contentId:Xr(),titleId:Xr(),descriptionId:Xr(),open:u,onOpenChange:c,onOpenToggle:v.useCallback(()=>c(f=>!f),[c]),modal:a},r)},dk="DialogTrigger",hk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Mr(dk,r),o=Ve(t,i.triggerRef);return v.createElement(Pe.button,pe({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ah(i.open)},n,{ref:o,onClick:_e(e.onClick,i.onOpenToggle)}))}),j2="DialogPortal",[pk,X2]=G2(j2,{forceMount:void 0}),gk=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:i}=e,o=Mr(j2,t);return v.createElement(pk,{scope:t,forceMount:r},v.Children.map(n,a=>v.createElement(Ei,{present:r||o.open},v.createElement(du,{asChild:!0,container:i},a))))},a0="DialogOverlay",mk=v.forwardRef((e,t)=>{const r=X2(a0,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=Mr(a0,e.__scopeDialog);return o.modal?v.createElement(Ei,{present:n||o.open},v.createElement(vk,pe({},i,{ref:t}))):null}),vk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Mr(a0,r);return v.createElement(_d,{as:ni,allowPinchZoom:!0,shards:[i.contentRef]},v.createElement(Pe.div,pe({"data-state":ah(i.open)},n,{ref:t,style:{pointerEvents:"auto",...n.style}})))}),Ua="DialogContent",xk=v.forwardRef((e,t)=>{const r=X2(Ua,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,o=Mr(Ua,e.__scopeDialog);return v.createElement(Ei,{present:n||o.open},o.modal?v.createElement(wk,pe({},i,{ref:t})):v.createElement(yk,pe({},i,{ref:t})))}),wk=v.forwardRef((e,t)=>{const r=Mr(Ua,e.__scopeDialog),n=v.useRef(null),i=Ve(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return Ed(o)},[]),v.createElement(K2,pe({},e,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_e(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=r.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:_e(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:_e(e.onFocusOutside,o=>o.preventDefault())}))}),yk=v.forwardRef((e,t)=>{const r=Mr(Ua,e.__scopeDialog),n=v.useRef(!1);return v.createElement(K2,pe({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o;if((o=e.onCloseAutoFocus)===null||o===void 0||o.call(e,i),!i.defaultPrevented){var a;n.current||(a=r.triggerRef.current)===null||a===void 0||a.focus(),i.preventDefault()}n.current=!1},onInteractOutside:i=>{var o,a;(o=e.onInteractOutside)===null||o===void 0||o.call(e,i),i.defaultPrevented||(n.current=!0);const s=i.target;((a=r.triggerRef.current)===null||a===void 0?void 0:a.contains(s))&&i.preventDefault()}}))}),K2=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:o,...a}=e,s=Mr(Ua,r),l=v.useRef(null),u=Ve(t,l);return gd(),v.createElement(v.Fragment,null,v.createElement(md,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:o},v.createElement(lu,pe({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ah(s.open)},a,{ref:u,onDismiss:()=>s.onOpenChange(!1)}))),!1)}),Ek="DialogTitle",_k=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Mr(Ek,r);return v.createElement(Pe.h2,pe({id:i.titleId},n,{ref:t}))}),Sk="DialogClose",Tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,i=Mr(Sk,r);return v.createElement(Pe.button,pe({type:"button"},n,{ref:t,onClick:_e(e.onClick,()=>i.onOpenChange(!1))}))});function ah(e){return e?"open":"closed"}const Y2=fk,Ck=hk,Ak=gk,q2=mk,Q2=xk,Z2=_k,s0=Tk;function Rk({open:e,close:t}){const r=window.download_path||"~/OpenBBUserData/exports";return Se(Y2,{open:e,onOpenChange:t,children:[Se("div",{id:"loading",className:"saving",children:[K("div",{id:"loading_text",className:"loading_text"}),K("div",{id:"loader",className:"loader"})]}),K(q2,{onClick:t,className:"_modal-overlay"}),Se(Q2,{className:"_modal",children:[K(s0,{children:K(jl,{})}),K(s0,{className:"_modal-close",onClick:t,style:{float:"right",marginTop:20},children:K(jl,{className:"w-6 h-6"})}),K(Z2,{className:"_modal-title",children:"Success"}),Se("div",{id:"popup_title",className:"popup_content",style:{padding:"0px 2px 2px 5px",marginTop:5},children:[K("div",{style:{display:"flex",flexDirection:"column",gap:0,fontSize:14},children:K("div",{children:Se("label",{htmlFor:"title_text",children:[K("b",{children:window.title})," has been downloaded to",K("br",{}),K("br",{}),K("a",{style:{color:"#FFDD00",marginTop:15},href:`${r}`,onClick:n=>{n.preventDefault(),window.pywry.open_file(r)},children:r})]})})}),K("div",{style:{float:"right",marginTop:20},children:K("button",{className:"_btn",style:{padding:"8px 16px",width:"100%"},onClick:t,children:"Close"})})]})]})]})}const Ok=new Date,Fk=50,l0=30;function Dk(e,t){try{const r=e.hasOwnProperty("index")?"index":e.hasOwnProperty("Index")?"Index":null,n=r?e[r]:null,i=e[t],o=typeof i,a=i==null?void 0:i.toString().replace(/[^0-9]/g,""),s=(a==null?void 0:a.length)>=4&&(Xd(t)||t.toLowerCase()==="index"||n&&n&&typeof n=="string"&&(n.toLowerCase().includes("date")||n.toLowerCase().includes("day")||n.toLowerCase().includes("time")||n.toLowerCase().includes("timestamp")||n.toLowerCase().includes("year")||n.toLowerCase().includes("month")||n.toLowerCase().includes("week")||n.toLowerCase().includes("hour")||n.toLowerCase().includes("minute")));if(o==="string"&&i.startsWith("http"))return(i==null?void 0:i.toString().length)??0;if(s){if(typeof i=="string")return(i==null?void 0:i.toString().length)??0;try{const u=new Date(i);let c="";return u.getUTCHours()===0&&u.getUTCMinutes()===0&&u.getUTCSeconds()===0&&u.getMilliseconds()===0?c=u.toISOString().split("T")[0]:(c=u.toISOString(),c=c.split("T")[0]+" "+c.split("T")[1].split(".")[0]),(c==null?void 0:c.toString().length)??0}catch{return(i==null?void 0:i.toString().length)??0}}return(i==null?void 0:i.toString().length)??0}catch{return 0}}const u0=["csv","xlsx","png"];function Pk({data:e,columns:t,title:r,initialTheme:n,cmd:i=""}){const[o,a]=jo("exportType",u0[0]),[s,l]=v.useState(!1),[u,c]=uk(n),[f,d]=v.useState(u==="dark"),h=W=>{c(u),d(W)},[m,p]=jo("rowsPerPage",l0,y2),[g,x]=jo("advanced",!1),[w,y]=jo("colors",!1),[_,N]=v.useState([]),[M,S]=v.useState(""),[C,A]=jo("fontSize","1"),[L,H]=v.useState(!1),B=t.reduce((W,q,le)=>(W[q]=le{const fe=Math.max(...W.map(We=>Dk(We,q)),le!=null&&le.length?(le==null?void 0:le.length)+8:0);return Math.min(200,fe*12)},ye=v.useMemo(()=>[...t.map((W,q)=>({accessorKey:W,id:W,header:W,size:ne(e,W,W),footer:W,cell:({row:le})=>{var st;const he=le.original.hasOwnProperty("index")?"index":le.original.hasOwnProperty("Index")?"Index":t[0],Te=he?le.original[he]:null,fe=le.original[W],We=typeof fe,be=(fe==null?void 0:fe.toString().replace(/[^0-9]/g,""))??"",ge=(be==null?void 0:be.length)>=4&&(Xd(W)||W.toLowerCase()==="index"||Te&&typeof Te=="string"&&(Te.toLowerCase().includes("date")||Te.toLowerCase().includes("time")||Te.toLowerCase().includes("timestamp")||Te.toLowerCase().includes("year")));if(We==="string"&&fe.startsWith("http"))return K("a",{className:"_hyper-link",href:fe,target:"_blank",rel:"noreferrer",children:(fe==null?void 0:fe.length)>25?fe.substring(0,25)+"...":fe});if(ge&&typeof fe!="number"){if(typeof fe=="string"){const ke=fe.split("T")[0],Ge=(st=fe.split("T")[1])==null?void 0:st.split(".")[0];return Ge==="00:00:00"?K("p",{children:ke}):Se("p",{children:[ke," ",Ge]})}try{const ke=new Date(fe);let Ge="";return ke.getUTCHours()===0&&ke.getUTCMinutes()===0&&ke.getUTCSeconds()===0&&ke.getMilliseconds()===0?Ge=ke.toISOString().split("T")[0]:(Ge=ke.toISOString(),Ge=Ge.split("T")[0]+" "+Ge.split("T")[1].split(".")[0]),K("p",{children:Ge})}catch{return K("p",{children:fe})}}if(We==="number"||w2.test(fe==null?void 0:fe.toString())){let ke=aP(fe,W);const Ge=Number(jf(fe));if(typeof Te=="string"&&Gw(Te)){ke=Number(jf(fe));const gr=ke<2?4:2;ke=ke.toLocaleString("en-US",{maximumFractionDigits:gr,minimumFractionDigits:2})}return K("p",{className:Nt("whitespace-nowrap",{"text-black dark:text-white":!w,"text-[#16A34A]":Ge>0&&w,"text-[#F87171]":Ge<0&&w,"text-[#404040]":Ge===0&&w}),children:Ge!==0?Ge>0?`${ke}`:`${ke}`:ke})}else if(We==="string")return K("div",{dangerouslySetInnerHTML:{__html:Ob(fe)}});return K("p",{children:fe})}}))],[g,w]),[ve,Ce]=v.useState(!1),[ie,Ee]=v.useState(ye.map(W=>W.id)),ee=()=>Ee(t.map(W=>W.id)),O=v.useMemo(()=>{const W=ie.map(le=>le),q=ye.map(le=>le.id);return!sP(W,q)},[ie,ye]),k=_S({data:e,columns:ye,getCoreRowModel:fS(),getSortedRowModel:mS(),getFilteredRowModel:gS(),getPaginationRowModel:xS(),columnResizeMode:"onChange",onColumnVisibilityChange:Q,onColumnOrderChange:Ee,onSortingChange:N,onGlobalFilterChange:S,globalFilterFn:lP,state:{sorting:_,globalFilter:M,columnOrder:ie,columnVisibility:V},initialState:{pagination:{pageIndex:0,pageSize:typeof m=="string"?m.includes("All")?e==null?void 0:e.length:parseInt(m):m}}}),b=v.useRef(null),{rows:D}=k.getRowModel(),U=k.getVisibleFlatColumns(),[G,J]=v.useState(!1);return v.useEffect(()=>{s&&(l(!1),J(!0))},[s]),Se(H1,{children:[K(lk,{toast:{id:"max-columns",title:"Max 12 columns are visible by default",description:"You can change this by clicking on advanced and then top right 'Filter' button",status:"info"},open:L,setOpen:H}),K(Rk,{open:G,close:()=>J(!1)}),Se("div",{ref:b,className:Nt("overflow-x-hidden h-screen"),children:[Se("div",{className:"relative p-4",id:"table",children:[K("div",{className:"absolute -inset-0.5 bg-gradient-to-r rounded-md blur-md from-[#072e49]/30 via-[#0d345f]/30 to-[#0d3362]/30"}),Se("div",{className:"border border-grey-500/60 dark:border-grey-200/60 bg-white dark:bg-grey-900 rounded overflow-hidden relative z-20",children:[Se("div",{className:"_header relative gap-4 py-2 text-center text-xs flex items-center justify-between px-4 text-white",style:{fontSize:`${Number(C)*100}%`},children:[K("div",{className:"w-1/3",children:K("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"40",fill:"none",viewBox:"0 0 64 40",children:K("path",{fill:"#fff",d:"M61.283 3.965H33.608v27.757h25.699V19.826H37.561v-3.965H63.26V3.965h-1.977zM39.538 23.792h15.815v3.965H37.561v-3.965h1.977zM59.306 9.913v1.983H37.561V7.931h21.745v1.982zM33.606 0h-3.954v3.965H33.606V0zM25.7 3.966H0V15.86h25.7v3.965H3.953v11.896h25.7V3.966h-3.955zm0 21.808v1.983H7.907v-3.965h17.791v1.982zm0-15.86v1.982H3.953V7.931h21.745v1.982zM37.039 35.693v2.952l-.246-.246-.245-.245-.245-.247-.245-.246-.246-.246-.245-.245-.245-.247-.247-.246-.245-.246-.245-.246-.245-.246-.246-.246h-.49v3.936h.49v-3.198l.246.246.245.246.245.246.245.246.246.246.246.246.245.247.246.245.245.246.245.247.245.246.246.245.245.246h.245v-3.936h-.49zM44.938 37.17h-.491v-1.477h-2.944v3.937h3.93v-2.46h-.495zm-2.944-.246v-.739h1.962v.984h-1.962v-.245zm2.944.984v1.23h-2.944V37.66h2.944v.247zM52.835 37.17h-.49v-1.477h-2.946v3.937h3.925v-2.46h-.489zm-2.944-.246v-.739h1.963v.984h-1.965l.002-.245zm2.944.984v1.23H49.89V37.66h2.946v.247zM29.174 35.693H25.739v3.936H29.663v-.491H26.229v-.984h2.943v-.493H26.229v-1.476h3.434v-.492h-.489zM13.37 35.693H9.934v3.937h3.925v-3.937h-.49zm0 .738v2.709h-2.945v-2.955h2.943l.001.246zM21.276 35.693h-3.435v3.937h.491v-1.476h3.434v-2.461h-.49zm0 .738v1.23h-2.944v-1.476h2.944v.246z"})})}),K("p",{className:"font-bold w-1/3 flex flex-col gap-0.5 items-center",children:r}),Se("p",{className:"w-1/3 text-right text-xs",children:[new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"long"}).format(Ok).replace(/:\d\d /," "),K("br",{}),K("span",{className:"text-grey-400",children:i})]})]}),K("div",{className:"overflow-auto max-h-[calc(100vh-160px)] smh:max-h-[calc(100vh-95px)]",children:Se("table",{className:"text-sm relative",style:{fontSize:`${Number(C)*100}%`},children:[K("thead",{className:"sticky top-0 bg-white dark:bg-grey-900",children:k.getHeaderGroups().map((W,q)=>K("tr",{children:W.headers.map((le,he)=>K(v8,{setLockFirstColumn:Ce,lockFirstColumn:ve,idx:he,advanced:g,header:le,table:k},le.id))},W.id))}),K("tbody",{children:k.getRowModel().rows.map((W,q)=>K("tr",{className:"!h-[64px] border-b border-grey-400",children:W.getVisibleCells().map((le,he)=>K("td",{className:Nt("whitespace-normal p-4 text-black dark:text-white",{"bg-white dark:bg-grey-850":q%2===0,"bg-grey-100 dark:bg-[#202020]":q%2===1,"sticky left-0 z-10":he===0&&ve}),style:{width:le.column.getSize()},children:If(le.column.columnDef.cell,le.getContext())},le.id))},W.id))}),(D==null?void 0:D.length)>30&&(U==null?void 0:U.length)>4&&K("tfoot",{children:k.getFooterGroups().map(W=>K("tr",{children:W.headers.map(q=>K("th",{colSpan:q.colSpan,className:"text-grey-500 bg-grey-100 dark:bg-grey-850 font-normal text-left text-sm h-10 p-4",style:{width:q.getSize()},children:q.isPlaceholder?null:If(q.column.columnDef.footer,q.getContext())},q.id))},W.id))})]})})]})]}),Se("div",{className:"smh:hidden flex max-h-[68px] overflow-x-auto bg-white/70 dark:bg-grey-900/70 backdrop-filter backdrop-blur z-20 bottom-0 left-0 w-full gap-10 justify-between py-4 px-4 text-sm",children:[Se("div",{className:"flex items-center gap-10",children:[Se(Y2,{children:[K(Ck,{className:"_btn",children:"Settings"}),Se(Ak,{children:[K(q2,{className:"_modal-overlay"}),Se(Q2,{className:"_modal",children:[K(s0,{className:"absolute top-[40px] right-[46px] text-grey-200 hover:text-white rounded-[4px] focus:outline focus:outline-2 focus:outline-grey-500",children:K(jl,{className:"w-6 h-6"})}),K(Z2,{className:"uppercase font-bold tracking-widest",children:"Settings"}),Se("div",{className:"grid grid-cols-2 gap-4 mt-10 text-sm",children:[O&&K("button",{onClick:()=>ee(),className:"_btn h-9",children:"Reset Order"}),K(Vi,{labelType:"row",value:f?"light":"dark",onChange:W=>{h(W!=="dark")},label:"Theme",placeholder:"Select theme",groups:[{label:"Theme",items:[{label:"Dark",value:"dark"},{label:"Light",value:"light"}]}]}),K(Vi,{labelType:"row",value:o,onChange:W=>{a(W)},label:"Export type",placeholder:"Select export type",groups:[{label:"Export type",items:u0.map(W=>({label:W,value:W}))}]}),K(Vi,{labelType:"row",value:C,onChange:A,label:"Font size",placeholder:"Select font size",groups:[{label:"Font size",items:[{label:"50%",value:"0.5"},{label:"75%",value:"0.75"},{label:"100%",value:"1"},{label:"125%",value:"1.25"},{label:"150%",value:"1.5"},{label:"175%",value:"1.75"},{label:"200%",value:"2"}]}]}),K(h1,{table:k,label:"Filter"}),K("div",{className:"flex gap-2 items-center",children:K(Vi,{labelType:"row",value:g?"advanced":"simple",onChange:W=>{x(W==="advanced")},label:"Type",placeholder:"Select type",groups:[{label:"Type",items:[{label:"Simple",value:"simple"},{label:"Advanced",value:"advanced"}]}]})}),Se("div",{className:"flex gap-2 items-center",children:[K("label",{htmlFor:"colors",children:"Colors"}),K("input",{id:"colors",type:"checkbox",checked:w,onChange:()=>y(!w)})]})]})]})]})]}),K(h1,{onlyIconTrigger:!0,table:k,label:""})]}),K(x8,{currentPage:m,setCurrentPage:p,table:k}),K(w8,{setType:a,type:o,columns:t,data:e,downloadFinished:l})]})]})]})}function J2(e){let t=null;return()=>(t==null&&(t=e()),t)}function Ik(e,t){return e.filter(r=>r!==t)}function bk(e,t){const r=new Set,n=o=>r.add(o);e.forEach(n),t.forEach(n);const i=[];return r.forEach(o=>i.push(o)),i}class kk{enter(t){const r=this.entered.length,n=i=>this.isNodeInDocument(i)&&(!i.contains||i.contains(t));return this.entered=bk(this.entered.filter(n),[t]),r===0&&this.entered.length>0}leave(t){const r=this.entered.length;return this.entered=Ik(this.entered.filter(this.isNodeInDocument),t),r>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class $k{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const r={};Object.keys(this.config.exposeProperties).forEach(n=>{const i=this.config.exposeProperties[n];i!=null&&(r[n]={value:i(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,r)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,r){return r===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const ey="__NATIVE_FILE__",ty="__NATIVE_URL__",ry="__NATIVE_TEXT__",ny="__NATIVE_HTML__",y1=Object.freeze(Object.defineProperty({__proto__:null,FILE:ey,HTML:ny,TEXT:ry,URL:ty},Symbol.toStringTag,{value:"Module"}));function Bc(e,t,r){const n=t.reduce((i,o)=>i||e.getData(o),"");return n??r}const c0={[ey]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[ny]:{exposeProperties:{html:(e,t)=>Bc(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[ty]:{exposeProperties:{urls:(e,t)=>Bc(e,t,"").split(` +`),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[ry]:{exposeProperties:{text:(e,t)=>Bc(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Nk(e,t){const r=c0[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new $k(r);return n.loadDataTransfer(t),n}function Uc(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(c0).filter(r=>{const n=c0[r];return n!=null&&n.matchesTypes?n.matchesTypes.some(i=>t.indexOf(i)>-1):!1})[0]||null}const Mk=J2(()=>/firefox/i.test(navigator.userAgent)),iy=J2(()=>!!window.safari);class E1{interpolate(t){const{xs:r,ys:n,c1s:i,c2s:o,c3s:a}=this;let s=r.length-1;if(t===r[s])return n[s];let l=0,u=a.length-1,c;for(;l<=u;){c=Math.floor(.5*(l+u));const h=r[c];if(ht)u=c-1;else return n[c]}s=Math.max(0,u);const f=t-r[s],d=f*f;return n[s]+i[s]*f+o[s]*d+a[s]*f*d}constructor(t,r){const{length:n}=t,i=[];for(let h=0;ht[h]{let M=new E1([0,.5,1],[l.y,l.y/c*m,l.y+m-c]).interpolate(d);return iy()&&o&&(M+=(window.devicePixelRatio-1)*m),M},g=()=>new E1([0,.5,1],[l.x,l.x/u*h,l.x+h-u]).interpolate(f),{offsetX:x,offsetY:w}=i,y=x===0||x,_=w===0||w;return{x:y?x:g(),y:_?w:p()}}class Vk{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,r){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=r}}function Wk(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _1(e){for(var t=1;t{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,r,n){this.sourceNodes.set(t,r),this.sourceNodeOptions.set(t,n);const i=a=>this.handleDragStart(a,t),o=a=>this.handleSelectStart(a);return r.setAttribute("draggable","true"),r.addEventListener("dragstart",i),r.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),r.removeEventListener("dragstart",i),r.removeEventListener("selectstart",o),r.setAttribute("draggable","false")}}connectDropTarget(t,r){const n=a=>this.handleDragEnter(a,t),i=a=>this.handleDragOver(a,t),o=a=>this.handleDrop(a,t);return r.addEventListener("dragenter",n),r.addEventListener("dragover",i),r.addEventListener("drop",o),()=>{r.removeEventListener("dragenter",n),r.removeEventListener("dragover",i),r.removeEventListener("drop",o)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourceNodeOptions.get(t);return _1({dropEffect:this.altKeyPressed?"copy":"move"},r||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),r=this.sourcePreviewNodeOptions.get(t);return _1({anchorX:.5,anchorY:.5,captureDraggingState:!1},r||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(y1).some(r=>y1[r]===t)}beginDragNativeItem(t,r){this.clearCurrentDragSourceNode(),this.currentNativeSource=Nk(t,r),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const r=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var n;return(n=this.rootElement)===null||n===void 0?void 0:n.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},r)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,r){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(r))}handleDragEnter(t,r){this.dragEnterTargetIds.unshift(r)}handleDragOver(t,r){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(r)}handleDrop(t,r){this.dropTargetIds.unshift(r)}constructor(t,r,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=i=>{const o=this.sourceNodes.get(i);return o&&oy(o)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=i=>!!(i&&this.document&&this.document.body&&this.document.body.contains(i)),this.endDragIfSourceWasRemovedFromDOM=()=>{const i=this.currentDragSourceNode;i==null||this.isNodeInDocument(i)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=i=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(i||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=i=>{if(i.defaultPrevented)return;const{dragStartSourceIds:o}=this;this.dragStartSourceIds=null;const a=Us(i);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:a});const{dataTransfer:s}=i,l=Uc(s);if(this.monitor.isDragging()){if(s&&typeof s.setDragImage=="function"){const c=this.monitor.getSourceId(),f=this.sourceNodes.get(c),d=this.sourcePreviewNodes.get(c)||f;if(d){const{anchorX:h,anchorY:m,offsetX:p,offsetY:g}=this.getCurrentSourcePreviewNodeOptions(),y=Hk(f,d,a,{anchorX:h,anchorY:m},{offsetX:p,offsetY:g});s.setDragImage(d,y.x,y.y)}}try{s==null||s.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(i.target);const{captureDraggingState:u}=this.getCurrentSourcePreviewNodeOptions();u?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(l)this.beginDragNativeItem(l);else{if(s&&!s.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=i=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}if(!this.enterLeaveCounter.enter(i.target)||this.monitor.isDragging())return;const{dataTransfer:s}=i,l=Uc(s);l&&this.beginDragNativeItem(l,s)},this.handleTopDragEnter=i=>{const{dragEnterTargetIds:o}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=i.altKey,o.length>0&&this.actions.hover(o,{clientOffset:Us(i)}),o.some(s=>this.monitor.canDropOnTarget(s))&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=i=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}},this.handleTopDragOver=i=>{const{dragOverTargetIds:o}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}this.altKeyPressed=i.altKey,this.lastClientOffset=Us(i),this.scheduleHover(o),(o||[]).some(s=>this.monitor.canDropOnTarget(s))?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=i=>{this.isDraggingNativeItem()&&i.preventDefault(),this.enterLeaveCounter.leave(i.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=i=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var o;i.preventDefault(),(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else Uc(i.dataTransfer)&&i.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=i=>{const{dropTargetIds:o}=this;this.dropTargetIds=[],this.actions.hover(o,{clientOffset:Us(i)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=i=>{const o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))},this.options=new Vk(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new kk(this.isNodeInDocument)}}const Gk=function(t,r,n){return new zk(t,r,n)};function jk(){const[e,t]=v.useState(null),[r,n]=v.useState("Interactive Table");v.useEffect(()=>{const a=setInterval(()=>{if(window.json_data){const s=JSON.parse(window.json_data);console.log(s),t(s),s.title&&typeof s.title=="string"&&n(s.title),clearInterval(a)}},100);return()=>clearInterval(a)},[]);const o=(a=>{var h;if(!a)return null;let s=(h=a.title)==null?void 0:h.replace(/|<\/b>/g,"").replace(/ /g,"_"),l=new Date().toISOString().slice(0,10).replace(/-/g,""),u=new Date().toISOString().slice(11,19).replace(/:/g,"");window.title=`openbb_${s}_${l}_${u}`;const c=a.columns;a.index;const d=a.data.map((m,p)=>{const g={};return m.forEach((x,w)=>{g[c[w]]=x||""}),g});return{columns:c,data:d}})(e);return K("div",{className:"relative h-full bg-white dark:bg-black text-black dark:text-white",children:K(FI,{backend:Gk,children:o&&K(Pk,{title:r,data:o.data,columns:o.columns,initialTheme:e.theme&&typeof e.theme=="string"&&e.theme==="dark"?"dark":"light",cmd:(e==null?void 0:e.command_location)??""})})})}wv.render(K(ir.StrictMode,{children:K(jk,{})}),document.getElementById("root")); From f7ab7a7ff01dfcc883c2e9ff6637ce1ac158a3d2 Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Sun, 14 May 2023 16:53:21 -0400 Subject: [PATCH 03/14] Update .gitignore --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 72ffeb44fe7c..e3616f955db9 100644 --- a/.gitignore +++ b/.gitignore @@ -41,9 +41,8 @@ website/functions website/terminaltest !build/docker/compose.env openbb_terminal/core/plots/assets/plotly*.js -openbb_terminal/core/plots/plotly_temp.html -openbb_terminal/core/plots/table_temp.html .dccache +*rome.json # pyinstaller artifacts *.pyo From 7a362a865f99a8a38b4525c05eaab30e66fa8d39 Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Sun, 14 May 2023 16:57:34 -0400 Subject: [PATCH 04/14] Update utils.ts --- frontend-components/tables/src/utils/utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend-components/tables/src/utils/utils.ts b/frontend-components/tables/src/utils/utils.ts index 370f533d200b..ce949cfbac22 100644 --- a/frontend-components/tables/src/utils/utils.ts +++ b/frontend-components/tables/src/utils/utils.ts @@ -313,7 +313,6 @@ export const non_blocking = (func: Function, delay: number) => { return function () { // @ts-ignore const context = this; - // rome-ignore lint/style/noArguments: const args = arguments; clearTimeout(timeout); timeout = setTimeout(() => func.apply(context, args), delay); From 535a3fae7a91f9e2fce07ec74df2da343c97c2a7 Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Sun, 14 May 2023 20:01:56 -0400 Subject: [PATCH 05/14] add volume to csv, fix `-` filename --- frontend-components/plotly/src/App.tsx | 2 ++ frontend-components/plotly/src/utils/utils.ts | 3 ++- openbb_terminal/core/plots/plotly.html | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend-components/plotly/src/App.tsx b/frontend-components/plotly/src/App.tsx index c2e7e60a5ef1..87c4e8f7c77b 100644 --- a/frontend-components/plotly/src/App.tsx +++ b/frontend-components/plotly/src/App.tsx @@ -50,6 +50,8 @@ function App() { title: "", }; let filename = data.layout?.title?.text + .replace(/ -/g, "") + .replace(/-/g, "") .replace(/|<\/b>/g, "") .replace(/ /g, "_"); let date = new Date().toISOString().slice(0, 10).replace(/-/g, ""); diff --git a/frontend-components/plotly/src/utils/utils.ts b/frontend-components/plotly/src/utils/utils.ts index 80146f0fc75e..c1710524977d 100644 --- a/frontend-components/plotly/src/utils/utils.ts +++ b/frontend-components/plotly/src/utils/utils.ts @@ -147,7 +147,7 @@ export async function downloadCSV( }); } - if (trace.type === "scatter") { + if (["scatter", "bar"].includes(trace.type)) { if (columns.length === 0) { columns.push(xaxis); } @@ -378,4 +378,5 @@ export async function downloadImage( hidemodebar(false); loading(false); } + loading(false); } diff --git a/openbb_terminal/core/plots/plotly.html b/openbb_terminal/core/plots/plotly.html index 3552fff98388..30ee83b46b37 100644 --- a/openbb_terminal/core/plots/plotly.html +++ b/openbb_terminal/core/plots/plotly.html @@ -3697,8 +3697,8 @@ `)},l7=0,Df=[];function u7(P){var F=Un.useRef([]),J=Un.useRef([0,0]),ce=Un.useRef(),Pe=Un.useState(l7++)[0],D=Un.useState(function(){return Tw()})[0],E=Un.useRef(P);Un.useEffect(function(){E.current=P},[P]),Un.useEffect(function(){if(P.inert){document.body.classList.add("block-interactivity-".concat(Pe));var t=Pk([P.lockRef.current],(P.shards||[]).map(Rb),!0).filter(Boolean);return t.forEach(function(i){return i.classList.add("allow-interactivity-".concat(Pe))}),function(){document.body.classList.remove("block-interactivity-".concat(Pe)),t.forEach(function(i){return i.classList.remove("allow-interactivity-".concat(Pe))})}}},[P.inert,P.lockRef.current,P.shards]);var e=Un.useCallback(function(t,i){if("touches"in t&&t.touches.length===2)return!E.current.allowPinchZoom;var r=Qd(t),n=J.current,o="deltaX"in t?t.deltaX:n[0]-r[0],a="deltaY"in t?t.deltaY:n[1]-r[1],u,p=t.target,c=Math.abs(o)>Math.abs(a)?"h":"v";if("touches"in t&&c==="h"&&p.type==="range")return!1;var b=Ob(c,p);if(!b)return!0;if(b?u=c:(u=c==="v"?"h":"v",b=Ob(c,p)),!b)return!1;if(!ce.current&&"changedTouches"in t&&(o||a)&&(ce.current=u),!u)return!0;var d=ce.current||u;return a7(d,i,t,d==="h"?o:a,!0)},[]),_=Un.useCallback(function(t){var i=t;if(!(!Df.length||Df[Df.length-1]!==D)){var r="deltaY"in i?Ib(i):Qd(i),n=F.current.filter(function(u){return u.name===i.type&&u.target===i.target&&o7(u.delta,r)})[0];if(n&&n.should){i.cancelable&&i.preventDefault();return}if(!n){var o=(E.current.shards||[]).map(Rb).filter(Boolean).filter(function(u){return u.contains(i.target)}),a=o.length>0?e(i,o[0]):!E.current.noIsolation;a&&i.cancelable&&i.preventDefault()}}},[]),w=Un.useCallback(function(t,i,r,n){var o={name:t,delta:i,target:r,should:n};F.current.push(o),setTimeout(function(){F.current=F.current.filter(function(a){return a!==o})},1)},[]),s=Un.useCallback(function(t){J.current=Qd(t),ce.current=void 0},[]),T=Un.useCallback(function(t){w(t.type,Ib(t),t.target,e(t,P.lockRef.current))},[]),y=Un.useCallback(function(t){w(t.type,Qd(t),t.target,e(t,P.lockRef.current))},[]);Un.useEffect(function(){return Df.push(D),P.setCallbacks({onScrollCapture:T,onWheelCapture:T,onTouchMoveCapture:y}),document.addEventListener("wheel",_,zf),document.addEventListener("touchmove",_,zf),document.addEventListener("touchstart",s,zf),function(){Df=Df.filter(function(t){return t!==D}),document.removeEventListener("wheel",_,zf),document.removeEventListener("touchmove",_,zf),document.removeEventListener("touchstart",s,zf)}},[]);var f=P.removeScrollBar,l=P.inert;return Un.createElement(Un.Fragment,null,l?Un.createElement(D,{styles:s7(Pe)}):null,f?Un.createElement(Kk,{gapMode:"margin"}):null)}const c7=jk(ww,u7);var Sw=Un.forwardRef(function(P,F){return Un.createElement(f1,iu({},P,{ref:F,sideCar:c7}))});Sw.classNames=f1.classNames;const f7=Sw;var h7=function(P){if(typeof document>"u")return null;var F=Array.isArray(P)?P[0]:P;return F.ownerDocument.body},Ff=new WeakMap,e0=new WeakMap,t0={},Fg=0,Ew=function(P){return P&&(P.host||Ew(P.parentNode))},p7=function(P,F){return F.map(function(J){if(P.contains(J))return J;var ce=Ew(J);return ce&&P.contains(ce)?ce:(console.error("aria-hidden",J,"in not contained inside",P,". Doing nothing"),null)}).filter(function(J){return!!J})},d7=function(P,F,J,ce){var Pe=p7(F,Array.isArray(P)?P:[P]);t0[J]||(t0[J]=new WeakMap);var D=t0[J],E=[],e=new Set,_=new Set(Pe),w=function(T){!T||e.has(T)||(e.add(T),w(T.parentNode))};Pe.forEach(w);var s=function(T){!T||_.has(T)||Array.prototype.forEach.call(T.children,function(y){if(e.has(y))s(y);else{var f=y.getAttribute(ce),l=f!==null&&f!=="false",t=(Ff.get(y)||0)+1,i=(D.get(y)||0)+1;Ff.set(y,t),D.set(y,i),E.push(y),t===1&&l&&e0.set(y,!0),i===1&&y.setAttribute(J,"true"),l||y.setAttribute(ce,"true")}})};return s(F),e.clear(),Fg++,function(){E.forEach(function(T){var y=Ff.get(T)-1,f=D.get(T)-1;Ff.set(T,y),D.set(T,f),y||(e0.has(T)||T.removeAttribute(ce),e0.delete(T)),f||T.removeAttribute(J)}),Fg--,Fg||(Ff=new WeakMap,Ff=new WeakMap,e0=new WeakMap,t0={})}},g7=function(P,F,J){J===void 0&&(J="data-aria-hidden");var ce=Array.from(Array.isArray(P)?P:[P]),Pe=F||h7(P);return Pe?(ce.push.apply(ce,Array.from(Pe.querySelectorAll("[aria-live]"))),d7(ce,Pe,J,"aria-hidden")):function(){return null}};const Cw="Dialog",[Lw,m9]=rk(Cw),[v7,ju]=Lw(Cw),m7=P=>{const{__scopeDialog:F,children:J,open:ce,defaultOpen:Pe,onOpenChange:D,modal:E=!0}=P,e=Un.useRef(null),_=Un.useRef(null),[w=!1,s]=sk({prop:ce,defaultProp:Pe,onChange:D});return Un.createElement(v7,{scope:F,triggerRef:e,contentRef:_,contentId:Pg(),titleId:Pg(),descriptionId:Pg(),open:w,onOpenChange:s,onOpenToggle:Un.useCallback(()=>s(T=>!T),[s]),modal:E},J)},y7="DialogPortal",[y9,Pw]=Lw(y7,{forceMount:void 0}),Gv="DialogOverlay",x7=Un.forwardRef((P,F)=>{const J=Pw(Gv,P.__scopeDialog),{forceMount:ce=J.forceMount,...Pe}=P,D=ju(Gv,P.__scopeDialog);return D.modal?Un.createElement(ey,{present:ce||D.open},Un.createElement(b7,Io({},Pe,{ref:F}))):null}),b7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(Gv,J);return Un.createElement(f7,{as:Qm,allowPinchZoom:!0,shards:[Pe.contentRef]},Un.createElement(gh.div,Io({"data-state":Iw(Pe.open)},ce,{ref:F,style:{pointerEvents:"auto",...ce.style}})))}),Fp="DialogContent",_7=Un.forwardRef((P,F)=>{const J=Pw(Fp,P.__scopeDialog),{forceMount:ce=J.forceMount,...Pe}=P,D=ju(Fp,P.__scopeDialog);return Un.createElement(ey,{present:ce||D.open},D.modal?Un.createElement(w7,Io({},Pe,{ref:F})):Un.createElement(T7,Io({},Pe,{ref:F})))}),w7=Un.forwardRef((P,F)=>{const J=ju(Fp,P.__scopeDialog),ce=Un.useRef(null),Pe=Yp(F,J.contentRef,ce);return Un.useEffect(()=>{const D=ce.current;if(D)return g7(D)},[]),Un.createElement(Ow,Io({},P,{ref:Pe,trapFocus:J.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rf(P.onCloseAutoFocus,D=>{var E;D.preventDefault(),(E=J.triggerRef.current)===null||E===void 0||E.focus()}),onPointerDownOutside:rf(P.onPointerDownOutside,D=>{const E=D.detail.originalEvent,e=E.button===0&&E.ctrlKey===!0;(E.button===2||e)&&D.preventDefault()}),onFocusOutside:rf(P.onFocusOutside,D=>D.preventDefault())}))}),T7=Un.forwardRef((P,F)=>{const J=ju(Fp,P.__scopeDialog),ce=Un.useRef(!1);return Un.createElement(Ow,Io({},P,{ref:F,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:Pe=>{var D;if((D=P.onCloseAutoFocus)===null||D===void 0||D.call(P,Pe),!Pe.defaultPrevented){var E;ce.current||(E=J.triggerRef.current)===null||E===void 0||E.focus(),Pe.preventDefault()}ce.current=!1},onInteractOutside:Pe=>{var D,E;(D=P.onInteractOutside)===null||D===void 0||D.call(P,Pe),Pe.defaultPrevented||(ce.current=!0);const e=Pe.target;((E=J.triggerRef.current)===null||E===void 0?void 0:E.contains(e))&&Pe.preventDefault()}}))}),Ow=Un.forwardRef((P,F)=>{const{__scopeDialog:J,trapFocus:ce,onOpenAutoFocus:Pe,onCloseAutoFocus:D,...E}=P,e=ju(Fp,J),_=Un.useRef(null),w=Yp(F,_);return Lk(),Un.createElement(Un.Fragment,null,Un.createElement(_k,{asChild:!0,loop:!0,trapped:ce,onMountAutoFocus:Pe,onUnmountAutoFocus:D},Un.createElement(yk,Io({role:"dialog",id:e.contentId,"aria-describedby":e.descriptionId,"aria-labelledby":e.titleId,"data-state":Iw(e.open)},E,{ref:w,onDismiss:()=>e.onOpenChange(!1)}))),!1)}),k7="DialogTitle",A7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(k7,J);return Un.createElement(gh.h2,Io({id:Pe.titleId},ce,{ref:F}))}),M7="DialogDescription",S7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(M7,J);return Un.createElement(gh.p,Io({id:Pe.descriptionId},ce,{ref:F}))}),E7="DialogClose",C7=Un.forwardRef((P,F)=>{const{__scopeDialog:J,...ce}=P,Pe=ju(E7,J);return Un.createElement(gh.button,Io({type:"button"},ce,{ref:F,onClick:rf(P.onClick,()=>Pe.onOpenChange(!1))}))});function Iw(P){return P?"open":"closed"}const L7=m7,P7=x7,O7=_7,I7=A7,R7=S7,zb=C7,Db=({title:P,titleId:F,...J})=>br("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,...J,children:br("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Rw={margin:"2px 0px 2px 10px",padding:"5px 2px 2px 5px"};function h1({open:P,close:F,title:J,description:ce,children:Pe}){return ni(L7,{open:P,onOpenChange:F,children:[br(P7,{onClick:F,className:"_modal-overlay"}),ni(O7,{className:"_modal",children:[br(I7,{className:"_modal-title",children:J}),br(R7,{className:"_modal_description",children:ce}),br(zb,{children:br(Db,{})}),Pe,br(zb,{className:"_modal-close",onClick:F,children:br(Db,{className:"w-6 h-6"})})]})]})}const Fb=new FileReader,z7={overlaying:"y",side:"left",tickfont:{size:12},tickpadding:5,showgrid:!1,showline:!1,showticklabels:!0,showlegend:!0,zeroline:!1,anchor:"x",type:"linear",autorange:!0};function D7({open:P,close:F,setLoading:J,addOverlay:ce,plotlyData:Pe}){const[D,E]=Un.useState("scatter"),[e,_]=Un.useState("#FFDD00"),[w,s]=Un.useState("#00ACFF"),[T,y]=Un.useState("#FF0000"),[f,l]=Un.useState(""),[t,i]=Un.useState([]),[r,n]=Un.useState([]),[o,a]=Un.useState({}),[u,p]=Un.useState({}),c=["x","open","high","low","close"];let b={scatter:"Scatter (Line)",candlestick:"Candlestick",bar:"Bar"};const[d,v]=Un.useState({});function x(){F(),E("scatter"),l(""),i([]),n([]),a({}),v({})}function g(){var k,h;if(t.length==0){(k=document.getElementById("csv_file"))==null||k.focus(),(h=document.getElementById("csv_file"))==null||h.style.setProperty("border","1px solid red"),document.getElementById("csv_file_warning").style.display="block";return}const m=F7({csvData:t,plotlyData:Pe,yaxisOptions:u,traceType:D,traceColor:e,traceName:f,options:d,increasingColor:w,decreasingColor:T});ce(m),x()}return br(h1,{title:"Overlay Chart",description:"Upload a CSV file to overlay a chart on the main chart.",open:P,close:F,children:ni("div",{id:"popup_csv",className:"popup_content",children:[ni("div",{children:[ni("label",{htmlFor:"csv_file",children:[br("b",{children:"CSV file:"}),br("div",{id:"csv_file_warning",className:"popup_warning",style:{marginLeft:"80px",marginBottom:"10px"},children:"CSV file is required."})]}),br("input",{onChange:m=>{var k,h;if(m.target.files){if(m.target.files[0].type!=="text/csv"){(k=document.getElementById("csv_file"))==null||k.focus(),(h=document.getElementById("csv_file"))==null||h.style.setProperty("border","1px solid red"),document.getElementById("csv_file_warning").style.display="block";return}}else return;r.length>0&&(n([]),a({}),v({}),E("scatter")),Fb.onload=M=>{var G;if(!((G=M.target)!=null&&G.result)||typeof M.target.result!="string")return;let A=M.target.result.split(` `).map(N=>N.replace(/\r/g,""));const C=A[0].split(","),L=C.map(N=>N.trim().toLowerCase());let O={};for(let N=0;NL.includes(N))&&E("candlestick"),L.includes("close")&&(v({...d,y:C[L.indexOf("close")]}),O.y=C[L.indexOf("close")]);let U=[];for(let N=1;N2&&(j.test(N[0])?N.splice(0,2):j.test(N[N.length-2])&&N.splice(N.length-2,2),B=N.join("_").replace(/openbb_/g,""))}}catch(N){console.log(N)}l(B),v(O),n(C),i(U)},Fb.readAsText(m.target.files[0])},type:"file",id:"csv_file",accept:".csv",style:{marginLeft:10}})]}),ni("div",{style:{marginTop:15},children:[br("label",{htmlFor:"csv_trace_type",children:br("b",{children:"Display data type:"})}),ni("select",{onChange:m=>{E(m.target.value)},id:"csv_trace_type",style:Rw,defaultValue:b[D],children:[D&&br("option",{value:D,children:b[D]},D),Object.keys(b).map(m=>D!==m&&br("option",{value:m,children:b[m]},m))]})]}),ni("div",{style:{marginTop:12},children:[br("label",{htmlFor:"csv_name",children:br("b",{children:"Trace Name:"})}),br("textarea",{id:"csv_name",value:f,onChange:m=>{l(m.target.value)},style:{padding:"5px 2px 2px 5px",width:"100%",maxWidth:"100%",maxHeight:200,marginTop:2},rows:2,cols:20,placeholder:"Enter a name to give this trace"})]}),r.length>0&&ni(tg,{children:[["scatter","bar"].includes(D)&&br("div",{style:{marginTop:15,marginBottom:10},id:"csv_columns",className:"csv_column_container",children:["x","y"].map(m=>ni("div",{style:{marginTop:10,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[ni("label",{htmlFor:`csv_${m}`,style:{width:"100px"},children:[m.toUpperCase()," Axis"]}),ni("select",{onChange:k=>{a({...o,[m]:k.target.value}),v({...d,[m]:k.target.value})},id:`csv_${m}`,style:{width:"100%"},defaultValue:d[m],children:[d[m]&&br("option",{value:d[m],children:d[m]},m),r.map(k=>br("option",{value:k,children:k},k))]})]},m))}),D==="candlestick"&&br("div",{id:"csv_columns",className:"csv_column_container",style:{marginTop:15},children:["x","open","high","low","close"].map(m=>ni("div",{style:{marginTop:10,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[br("label",{htmlFor:`csv_${m}`,style:{width:"100px"},children:m.charAt(0).toUpperCase()+m.slice(1)}),ni("select",{onChange:k=>{a({...o,[m]:k.target.value}),v({...d,[m]:k.target.value})},id:`csv_${m}`,style:{width:"100%"},children:[d[m]&&br("option",{value:d[m],children:d[m]},m),r.map(k=>k!=d[k]&&br("option",{value:k,children:k},k))]})]},m))}),ni("div",{style:{marginTop:20},id:"csv_colors",children:[["scatter","bar"].includes(D)&&ni("div",{children:[br("label",{htmlFor:"csv_color",children:`${D.charAt(0).toUpperCase()}${D.slice(1)} color`}),br("input",{type:"color",id:"csv_color",defaultValue:"#FFDD00",style:{margin:"2px 2px 2px 10px"},onChange:m=>{console.log(m.target.value),_(m.target.value)}})]}),D==="candlestick"&&ni(tg,{children:[br("label",{htmlFor:"csv_increasing",children:"Increasing color"}),br("input",{type:"color",id:"csv_increasing",defaultValue:"#00ACFF",style:{margin:"2px 0px 2px 10px"},onChange:m=>{s(m.target.value)}}),br("label",{htmlFor:"csv_decreasing",style:{marginLeft:15},children:"Decreasing color"}),br("input",{style:{margin:"2px 0px 2px 10px"},type:"color",id:"csv_decreasing",defaultValue:"#FF0000",onChange:m=>{y(m.target.value)}})]})]}),ni("div",{style:{marginTop:20},id:"csv_plot_yaxis_options",children:[D!=="candlestick"&&ni(tg,{children:[br("input",{type:"checkbox",id:"csv_percent_change",name:"csv_plot_yaxis_check",style:{marginBottom:2},onChange:m=>{p({...u,percentChange:m.target.checked,sameYaxis:!1})},checked:!u.sameYaxis&&u.percentChange}),br("label",{htmlFor:"csv_percent_change",style:{marginLeft:5},children:"Plot as percent change from first value"}),br("br",{})]}),br("input",{style:{marginTop:2},type:"checkbox",id:"csv_same_yaxis",name:"csv_plot_yaxis_check",onChange:m=>{p({...u,sameYaxis:m.target.checked,percentChange:!1})},checked:!u.percentChange&&u.sameYaxis}),br("label",{htmlFor:"csv_same_yaxis",style:{marginLeft:5},children:"Share Y-axis"}),D==="bar"&&ni("div",{style:{marginTop:2},id:"csv_bar_orientation",children:[br("input",{type:"checkbox",id:"csv_bar_horizontal",onChange:m=>{v({...d,orientation:m.target.checked?"h":"v"})}}),br("label",{htmlFor:"csv_bar_horizontal",style:{marginLeft:5},children:"Plot horizontally"})]})]})]}),br("br",{}),ni("div",{style:{float:"right",marginTop:20},children:[br("button",{className:"_btn-tertiary",id:"csv_cancel",onClick:x,children:"Cancel"}),br("button",{className:"_btn",id:"csv_submit",onClick:g,children:"Submit"})]})]})})}function F7({csvData:P,plotlyData:F,yaxisOptions:J,traceType:ce,traceColor:Pe,traceName:D,options:E,increasingColor:e,decreasingColor:_}){let w=F.data[0];w.xaxis==null&&(w.xaxis="x"),w.yaxis==null&&(w.yaxis="y");let s=w.yaxis,T,f=Object.keys(F.layout).filter(r=>r.startsWith("yaxis")).map(r=>F.layout[r]).filter(r=>r.side=="left"&&(r.overlaying=="y"||r.fixedrange!=null&&r.fixedrange==!0)).length>0?" ":"";if(J.sameYaxis!==!0){const r=Object.keys(F.layout).filter(n=>n.startsWith("yaxis")).map(n=>F.layout[n]);T=`y${r.length+1}`,s=`yaxis${r.length+1}`,console.log(`yaxis: ${T} ${s}`),F.layout[s]={...z7,title:{text:D,font:{size:14},standoff:0},ticksuffix:f,layer:"below traces"}}else T=w.yaxis.replace("yaxis","y");const l={type:ce,name:D,showlegend:!0,yaxis:T};let t={};if(["scatter","bar"].includes(ce)){const r=P.findIndex(n=>n[E.y]!=null&&n[E.y]!=0);t={...l,x:P.map(n=>n[E.x]),y:P.map(function(n){return J.percentChange&&ce==="scatter"?(n[E.y]-P[r][E.y])/P[r][E.y]:n[E.y]}),customdata:P.map(n=>n[E.y]),hovertemplate:"%{customdata:.2f}",connectgaps:!0,marker:{color:Pe}},ce==="bar"&&(t.orientation=E.orientation,t.marker.opacity=.7,delete t.connectgaps,delete t.hovertemplate,delete t.customdata)}else ce==="candlestick"&&(t={...l,x:P.map(r=>r[E.x]),open:P.map(r=>r[E.open]),high:P.map(r=>r[E.high]),low:P.map(r=>r[E.low]),close:P.map(r=>r[E.close]),increasing:{line:{color:e}},decreasing:{line:{color:_}}});return{...F,data:[...F.data,t]}}function B7({plotlyData:P,open:F,close:J,defaultTitle:ce,updateTitle:Pe,updateAxesTitles:D}){const[E,e]=Un.useState(ce),_=Object.keys(P.layout||{}).filter(y=>y.startsWith("yaxis")&&P.layout[y].range!=null),w=Object.keys(P.layout||{}).filter(y=>{var f;return y.startsWith("xaxis")&&P.layout[y].showticklabels!=null&&((f=P.layout[y])==null?void 0:f.anchor)}),[s,T]=Un.useState({});return br(h1,{title:"Chart Titles",description:"Change the titles on the chart.",open:F,close:J,children:ni("div",{id:"popup_title",className:"popup_content",children:[ni("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[ni("div",{children:[br("label",{htmlFor:"title_text",children:br("b",{children:"Title:"})}),br("textarea",{id:"title_text",style:{...Rw,width:"100%",maxWidth:"100%",maxHeight:"200px",marginTop:"8px",marginLeft:"0px"},rows:2,cols:20,value:E,onChange:y=>e(y.target.value)})]}),br("div",{id:"xaxis_div",className:"csv_column_container",style:{marginTop:5,marginBottom:-5},children:w.map((y,f)=>{var l,t;return ni("div",{style:{marginTop:5,marginBottom:5},children:[br("label",{htmlFor:`title_${y}`,children:f===0?br("b",{children:"X axis:"}):ni("b",{children:["X axis ",f+1,":"]})}),br("input",{id:`title_${y}`,style:{marginLeft:"0px",padding:"5px 2px 2px 5px"},type:"text",defaultValue:((t=(l=P==null?void 0:P.layout[y])==null?void 0:l.title)==null?void 0:t.text)||"",onChange:i=>{T({...s,[y]:i.target.value})}})]},y)})}),br("div",{id:"yaxis_div",className:"csv_column_container",style:{marginTop:5,marginBottom:5},children:_.map((y,f)=>{var l,t;return ni("div",{style:{marginTop:10},children:[br("label",{htmlFor:`title_${y}`,children:f===0?br("b",{children:"Y axis:"}):ni("b",{children:["Y axis ",f+1,":"]})}),br("input",{id:`title_${y}`,style:{marginLeft:"0px",padding:"5px 2px 2px 5px"},type:"text",defaultValue:((t=(l=P==null?void 0:P.layout[y])==null?void 0:l.title)==null?void 0:t.text)||"",onChange:i=>{T({...s,[y]:i.target.value})}})]},y)})})]}),ni("div",{style:{float:"right",marginTop:20},children:[br("button",{className:"_btn-tertiary ph-capture",id:"title_cancel",onClick:J,children:"Cancel"}),br("button",{className:"_btn ph-capture",id:"title_submit",onClick:()=>{Pe(E),D(s),J()},children:"Submit"})]})]})})}const Bb={padding:"5px 2px 2px 5px",margin:"2px 0"};function N7({open:P,close:F,addAnnotation:J,deleteAnnotation:ce,popupData:Pe}){var l,t,i,r,n;const D={text:"",color:"#0088CC",size:18,bordercolor:"#822661",yanchor:"above"},[E,e]=Un.useState(D),[_,w]=Un.useState(D);Pe&&Pe!==E&&Pe.annotation&&(Pe.annotation=(Pe==null?void 0:Pe.annotation)||{},e(Pe),w(Pe));function s(){console.log("closing"),e(D),w(D),F()}function T(o){console.log(o.target.id.replace("addtext_",""),o.target.value);const a=o.target.id.replace("addtext_",""),u=o.target.value;w({..._,[a]:u})}function y(){console.log("submitting",_),_.text!==""?(E!=null&&E.annotation&&w({..._,annotation:E.annotation}),J(_),F()):(document.getElementById("popup_textarea_warning").style.display="block",document.getElementById("addtext_text").style.border="1px solid red")}function f(){ce(E),s()}return br(h1,{title:"Add Text to Chart",description:"Change the titles on the chart.",open:P,close:s,children:ni("div",{id:"popup_title",className:"popup_content",children:[ni("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[ni("div",{style:{marginBottom:20},children:[ni("label",{htmlFor:"popup_text",children:[br("b",{children:"Text:"}),br("div",{id:"popup_textarea_warning",className:"popup_warning",children:"Text is required"})]}),br("textarea",{id:"addtext_text",style:{...Bb,width:"100%",maxWidth:"100%",maxHeight:"200px",marginTop:"8px"},rows:4,cols:50,placeholder:"Enter text here",onChange:T,defaultValue:((l=E==null?void 0:E.annotation)==null?void 0:l.text)||(_==null?void 0:_.text)})]}),ni("div",{style:{display:"flex",gap:15,alignItems:"center",flexWrap:"wrap",columnCount:2,justifyContent:"space-between",marginBottom:20},children:[br("label",{htmlFor:"addtext_color",children:br("b",{children:"Font color"})}),br("input",{type:"color",id:"addtext_color",style:{margin:"2px 2px 2px 15px"},defaultValue:((t=E==null?void 0:E.annotation)==null?void 0:t.color)||(_==null?void 0:_.color),onChange:T}),br("label",{htmlFor:"addtext_bordercolor",style:{marginLeft:20},children:br("b",{children:"Border color"})}),br("input",{type:"color",id:"addtext_bordercolor",style:{margin:"2px 2px 10px 15px"},defaultValue:((i=E==null?void 0:E.annotation)==null?void 0:i.bordercolor)||(_==null?void 0:_.bordercolor),onChange:T}),br("label",{htmlFor:"addtext_size",children:br("b",{children:"Font size"})}),br("input",{style:{...Bb,width:"52px",margin:"0px 0px 0px 2px"},type:"number",id:"addtext_size",onChange:T,defaultValue:((r=E==null?void 0:E.annotation)==null?void 0:r.size)||(_==null?void 0:_.size)}),ni("div",{children:[br("label",{htmlFor:"addtext_yanchor",style:{marginRight:31},children:br("b",{children:"Position"})}),ni("select",{id:"addtext_yanchor",name:"yanchor",style:{width:"100px"},defaultValue:((n=E==null?void 0:E.annotation)==null?void 0:n.yanchor)||(_==null?void 0:_.yanchor),onChange:T,children:[br("option",{value:"above",children:"Above"}),br("option",{value:"below",children:"Below"})]})]})]})]}),ni("div",{style:{float:"right",marginTop:20},children:[br("button",{className:"_btn-tertiary ph-capture",id:"title_cancel",onClick:s,children:"Cancel"}),br("button",{className:"_btn ph-capture",id:"title_delete",onClick:f,children:"Delete"}),br("button",{className:"_btn ph-capture",id:"title_submit",onClick:y,children:"Submit"})]})]})})}function j7({plotData:P,popup_data:F,current_text:J}){var _;let ce=F.x,Pe=F.y,D=F.yref,E=((_=P==null?void 0:P.layout)==null?void 0:_.annotations)||[],e=-1;for(let w=0;wx!=null)),P.layout.dragmode="pan",J({...P,...a.update}),s.removeAllListeners("plotly_click")};F.text=F.text.replace(/\n/g,"
");let y,f=!1;if(F.annotation){console.log("data",F),y={x:F.annotation.x,y:F.annotation.y,yref:F.annotation.yref,yanchor:F.annotation.yi.x==F.annotation.x&&i.y==F.annotation.y&&i.yref==F.annotation.yref);console.log("ohlcAnnotationIndex",t),t==-1?_([...e,l.annotation]):(e[t]=l.annotation,_(e))}D([...w,l.annotation].filter(t=>t!=null)),P.layout.dragmode="pan",J({...P,...l.update}),Pe({});return}s.on("plotly_clickannotation",l=>{console.log("plotly_clickannotation",l);let t=l.annotation;if(t.text==null){console.log("annotation.text is undefined");return}console.log("annotation.text",t.text),t.text=t.text.replace(/
/g,` `);let i={x:t.x,y:t.y,high:(t==null?void 0:t.high)??void 0,low:(t==null?void 0:t.low)??void 0,yanchor:t.y'),!0):F?P.some(function(J){return F.includes(J)})||P.includes("*"):!0}var X7=function(F,J,ce){ce===void 0&&(ce=!1);var Pe=J.alt,D=J.meta,E=J.mod,e=J.shift,_=J.ctrl,w=J.keys,s=F.key,T=F.code,y=F.ctrlKey,f=F.metaKey,l=F.shiftKey,t=F.altKey,i=sc(T),r=s.toLowerCase();if(!ce){if(Pe===!t&&r!=="alt"||e===!l&&r!=="shift")return!1;if(E){if(!f&&!y)return!1}else if(D===!f&&r!=="meta"&&r!=="os"||_===!y&&r!=="ctrl"&&r!=="control")return!1}return w&&w.length===1&&(w.includes(r)||w.includes(i))?!0:w?q7(w):!w},$7=Un.createContext(void 0),J7=function(){return Un.useContext($7)};function Nw(P,F){return P&&F&&typeof P=="object"&&typeof F=="object"?Object.keys(P).length===Object.keys(F).length&&Object.keys(P).reduce(function(J,ce){return J&&Nw(P[ce],F[ce])},!0):P===F}var K7=Un.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Q7=function(){return Un.useContext(K7)};function e9(P){var F=Un.useRef(void 0);return Nw(F.current,P)||(F.current=P),F.current}var jb=function(F){F.stopPropagation(),F.preventDefault(),F.stopImmediatePropagation()},t9=typeof window<"u"?Un.useLayoutEffect:Un.useEffect;function Ku(P,F,J,ce){var Pe=Un.useRef(null),D=Un.useRef(!1),E=J instanceof Array?ce instanceof Array?void 0:ce:J,e=P instanceof Array?P.join(E==null?void 0:E.splitKey):P,_=J instanceof Array?J:ce instanceof Array?ce:void 0,w=Un.useCallback(F,_??[]),s=Un.useRef(w);_?s.current=w:s.current=F;var T=e9(E),y=Q7(),f=y.enabledScopes,l=J7();return t9(function(){if(!((T==null?void 0:T.enabled)===!1||!Y7(f,T==null?void 0:T.scopes))){var t=function(a,u){var p;if(u===void 0&&(u=!1),!(Z7(a)&&!Bw(a,T==null?void 0:T.enableOnFormTags))&&!(T!=null&&T.ignoreEventWhen!=null&&T.ignoreEventWhen(a))){if(Pe.current!==null&&document.activeElement!==Pe.current&&!Pe.current.contains(document.activeElement)){jb(a);return}(p=a.target)!=null&&p.isContentEditable&&!(T!=null&&T.enableOnContentEditable)||Bg(e,T==null?void 0:T.splitKey).forEach(function(c){var b,d=Ng(c,T==null?void 0:T.combinationKey);if(X7(a,d,T==null?void 0:T.ignoreModifiers)||(b=d.keys)!=null&&b.includes("*")){if(u&&D.current)return;if(G7(a,d,T==null?void 0:T.preventDefault),!W7(a,d,T==null?void 0:T.enabled)){jb(a);return}s.current(a,d),u||(D.current=!0)}})}},i=function(a){a.key!==void 0&&(Dw(sc(a.code)),((T==null?void 0:T.keydown)===void 0&&(T==null?void 0:T.keyup)!==!0||T!=null&&T.keydown)&&t(a))},r=function(a){a.key!==void 0&&(Fw(sc(a.code)),D.current=!1,T!=null&&T.keyup&&t(a,!0))},n=Pe.current||(E==null?void 0:E.document)||document;return n.addEventListener("keyup",r),n.addEventListener("keydown",i),l&&Bg(e,T==null?void 0:T.splitKey).forEach(function(o){return l.addHotkey(Ng(o,T==null?void 0:T.combinationKey,T==null?void 0:T.description))}),function(){n.removeEventListener("keyup",r),n.removeEventListener("keydown",i),l&&Bg(e,T==null?void 0:T.splitKey).forEach(function(o){return l.removeHotkey(Ng(o,T==null?void 0:T.combinationKey,T==null?void 0:T.description))})}}},[e,T,f]),Pe}var jw={exports:{}};(function(P){(function(F){var J=o(),ce=a(),Pe=u(),D=p(),E={imagePlaceholder:void 0,cacheBust:!1},e={toSvg:_,toPng:s,toJpeg:T,toBlob:y,toPixelData:w,impl:{fontFaces:Pe,images:D,util:J,inliner:ce,options:{}}};P.exports=e;function _(c,b){return b=b||{},f(b),Promise.resolve(c).then(function(v){return t(v,b.filter,!0)}).then(i).then(r).then(d).then(function(v){return n(v,b.width||J.width(c),b.height||J.height(c))});function d(v){return b.bgcolor&&(v.style.backgroundColor=b.bgcolor),b.width&&(v.style.width=b.width+"px"),b.height&&(v.style.height=b.height+"px"),b.style&&Object.keys(b.style).forEach(function(x){v.style[x]=b.style[x]}),v}}function w(c,b){return l(c,b||{}).then(function(d){return d.getContext("2d").getImageData(0,0,J.width(c),J.height(c)).data})}function s(c,b){return l(c,b||{}).then(function(d){return d.toDataURL()})}function T(c,b){return b=b||{},l(c,b).then(function(d){return d.toDataURL("image/jpeg",b.quality||1)})}function y(c,b){return l(c,b||{}).then(J.canvasToBlob)}function f(c){typeof c.imagePlaceholder>"u"?e.impl.options.imagePlaceholder=E.imagePlaceholder:e.impl.options.imagePlaceholder=c.imagePlaceholder,typeof c.cacheBust>"u"?e.impl.options.cacheBust=E.cacheBust:e.impl.options.cacheBust=c.cacheBust}function l(c,b){return _(c,b).then(J.makeImage).then(J.delay(100)).then(function(v){var x=d(c);return x.getContext("2d").drawImage(v,0,0),x});function d(v){var x=document.createElement("canvas");if(x.width=b.width||J.width(v),x.height=b.height||J.height(v),b.bgcolor){var g=x.getContext("2d");g.fillStyle=b.bgcolor,g.fillRect(0,0,x.width,x.height)}return x}}function t(c,b,d){if(!d&&b&&!b(c))return Promise.resolve();return Promise.resolve(c).then(v).then(function(m){return x(c,m,b)}).then(function(m){return g(c,m)});function v(m){return m instanceof HTMLCanvasElement?J.makeImage(m.toDataURL()):m.cloneNode(!1)}function x(m,k,h){var M=m.childNodes;if(M.length===0)return Promise.resolve(k);return A(k,J.asArray(M),h).then(function(){return k});function A(C,L,O){var I=Promise.resolve();return L.forEach(function(R){I=I.then(function(){return t(R,O)}).then(function(U){U&&C.appendChild(U)})}),I}}function g(m,k){if(!(k instanceof Element))return k;return Promise.resolve().then(h).then(M).then(A).then(C).then(function(){return k});function h(){L(window.getComputedStyle(m),k.style);function L(O,I){O.cssText?I.cssText=O.cssText:R(O,I);function R(U,B){J.asArray(U).forEach(function(G){B.setProperty(G,U.getPropertyValue(G),U.getPropertyPriority(G))})}}}function M(){[":before",":after"].forEach(function(O){L(O)});function L(O){var I=window.getComputedStyle(m,O),R=I.getPropertyValue("content");if(R===""||R==="none")return;var U=J.uid();k.className=k.className+" "+U;var B=document.createElement("style");B.appendChild(G(U,O,I)),k.appendChild(B);function G(N,j,V){var H="."+N+":"+j,ee=V.cssText?Q(V):X(V);return document.createTextNode(H+"{"+ee+"}");function Q(Y){var K=Y.getPropertyValue("content");return Y.cssText+" content: "+K+";"}function X(Y){return J.asArray(Y).map(K).join("; ")+";";function K(te){return te+": "+Y.getPropertyValue(te)+(Y.getPropertyPriority(te)?" !important":"")}}}}}function A(){m instanceof HTMLTextAreaElement&&(k.innerHTML=m.value),m instanceof HTMLInputElement&&k.setAttribute("value",m.value)}function C(){k instanceof SVGElement&&(k.setAttribute("xmlns","http://www.w3.org/2000/svg"),k instanceof SVGRectElement&&["width","height"].forEach(function(L){var O=k.getAttribute(L);O&&k.style.setProperty(L,O)}))}}}function i(c){return Pe.resolveAll().then(function(b){var d=document.createElement("style");return c.appendChild(d),d.appendChild(document.createTextNode(b)),c})}function r(c){return D.inlineAll(c).then(function(){return c})}function n(c,b,d){return Promise.resolve(c).then(function(v){return v.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(v)}).then(J.escapeXhtml).then(function(v){return''+v+""}).then(function(v){return''+v+""}).then(function(v){return"data:image/svg+xml;charset=utf-8,"+v})}function o(){return{escape:C,parseExtension:b,mimeType:d,dataAsUrl:A,isDataUrl:v,canvasToBlob:g,resolveUrl:m,getAndEncode:M,uid:k(),delay:L,asArray:O,escapeXhtml:I,makeImage:h,width:R,height:U};function c(){var G="application/font-woff",N="image/jpeg";return{woff:G,woff2:G,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:N,jpeg:N,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}function b(G){var N=/\.([^\.\/]*?)$/g.exec(G);return N?N[1]:""}function d(G){var N=b(G).toLowerCase();return c()[N]||""}function v(G){return G.search(/^(data:)/)!==-1}function x(G){return new Promise(function(N){for(var j=window.atob(G.toDataURL().split(",")[1]),V=j.length,H=new Uint8Array(V),ee=0;ee{if(P)return i9({fileHandle:P,blob:F})},i9=async({fileHandle:P,blob:F})=>{const J=await P.createWritable();await J.write(F),await J.close()},a9=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}},{description:"SVG Image",accept:{"image/svg+xml":[".svg"]}}],Vw=({filename:P,is_image:F})=>{try{if("showSaveFilePicker"in window){const J={suggestedName:P,types:F?a9:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(J)}}catch(J){console.error(J)}return new Promise(J=>{J(null)})},ty=(P,F,J)=>{try{if(J===null)throw new Error("Cannot access filesystem");return r9({fileHandle:J,blob:P})}catch(ce){console.error("oops, something went wrong!",ce);const Pe=URL.createObjectURL(P),D=document.createElement("a");D.setAttribute("href",Pe),D.setAttribute("download",F),D.style.visibility="hidden",document.body.appendChild(D),D.click(),document.body.removeChild(D)}return new Promise(ce=>{ce(!0)})};async function Ub(P,F){const J=P.data;let ce=[];const Pe=[],D="title"in P.layout.xaxis&&P.layout.xaxis.title.text!==void 0?P.layout.xaxis.title.text:"x",E="title"in P.layout.yaxis&&P.layout.yaxis.title.text!==void 0?P.layout.yaxis.title.text:"y";return J.forEach(function(e){e.type==="candlestick"&&(ce.length===0&&(ce=["Date","Open","High","Low","Close"]),e.x.forEach(function(_,w){Pe.push([_,e.open[w],e.high[w],e.low[w],e.close[w]])})),e.type==="scatter"&&(ce.length===0&&ce.push(D),ce.push(e.name!==void 0?e.name:E),e.x.forEach(function(_,w){Pe[w]===void 0&&(Pe[w]=[_]),Pe[w].push(e.y[w])}))}),await o9(ce,Pe,F)}async function o9(P,F,J){const ce=P,Pe=F.map(w=>w.map(s=>s==null?"":typeof s=="object"?JSON.stringify(s):s.toString().replace(/"/g,'""'))),E=[ce,...Pe].map(w=>w.join(",")).join(` -`),e=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=`${window.title}.csv`;try{const w=await Vw({filename:_});await Bp("Saving CSV"),Np(async function(){ty(e,_,w).then(async function(){await new Promise(s=>setTimeout(s,1500)),w||J(!0),await Bp("",!0)})},2)()}catch(w){console.error(w)}}function Bp(P,F){const J=window.document.getElementById("loading"),ce=window.document.getElementById("loading_text");return new Promise(Pe=>{F?J.classList.remove("show"):(ce.innerHTML=P,J.classList.add("show"));const D=setInterval(function(){(F?!J.classList.contains("show"):J.classList.contains("show"))&&(clearInterval(D),Pe(!0))},.01)})}const Np=(P,F)=>{let J;return function(){const ce=this,Pe=arguments;clearTimeout(J),J=setTimeout(()=>P.apply(ce,Pe),F)}},s9={yref:"paper",xref:"paper",x:1,y:0,text:"OpenBB Terminal",font_size:17,font_color:"gray",opacity:.5,xanchor:"right",yanchor:"bottom",yshift:-80,xshift:40};async function Vb(P,F,J=!1){const ce=document.getElementById("plotlyChart");J&&(ce.layout.annotations.push(s9),ce.globals.cmd_idx!==void 0&&ce.globals.cmd_src!==void 0&&(ce.layout.annotations[ce.globals.cmd_idx].text=ce.globals.cmd_src),Gs.relayout(ce,{"title.text":ce.globals.title,margin:ce.globals.old_margin})),J||(ce.globals.cmd_idx!==void 0&&ce.globals.cmd_src!==void 0&&(ce.layout.annotations[ce.globals.cmd_idx].text=""),ce.layout.annotations.splice(F,1),Gs.relayout(ce,{"title.text":"",margin:P}))}async function Hw(P,F,J){const ce=document.getElementById(P);if(["svg","pdf"].includes(J)){const Pe=document.getElementById("plotlyChart"),D=Pe.layout.margin,E=Pe.layout.annotations.length;await Vb(D,E,!0),Gs.downloadImage(Pe,{format:"svg",height:Pe.clientHeight,width:Pe.clientWidth,filename:window.title}),await Vb(D,E,!1),await Bp("",!0);return}Np(async function(){Uw.toBlob(ce).then(function(Pe){ty(Pe,F,null)})},2)()}async function Hb(P,F,J,ce){const Pe=document.getElementById(P),D=`${window.title}.png`;try{J(!0);const E=await Vw({filename:D,is_image:!0});let e="png";if(E!==null&&(e=E.name.split(".").pop()),await Bp(`Saving ${e.toUpperCase()}`),["svg","pdf"].includes(e)){await Hw(P,D,e),F(!1),J(!1),E||ce(!0);return}Np(async function(){Uw.toBlob(Pe).then(function(_){ty(_,D,E).then(async function(){await Bp("",!0),F(!1),J(!1),E||ce(!0)})})},2)()}catch(E){console.error(E),F(!1),J(!1)}}function rc(P=!0){return new Promise(F=>{window.MODEBAR||(window.MODEBAR=window.document.getElementsByClassName("modebar-container")[0],window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`),window.MODEBAR&&(window.MODEBAR.style.cssText.includes("display: none")&&!P?window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`:window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:none;`,F(!0))})}function l9({setModal:P,changeTheme:F,autoScaling:J,Loading:ce,changeColor:Pe,downloadFinished:D}){return Ku("ctrl+shift+t",()=>{P({name:"titleDialog"})},{preventDefault:!0}),Ku("ctrl+t",()=>{P({name:"textDialog"})},{preventDefault:!0}),Ku("ctrl+o",()=>{P({name:"overlayChart"})},{preventDefault:!0}),Ku("ctrl+shift+h",()=>{rc()},{preventDefault:!0}),Ku("ctrl+e",()=>{Pe(!0)},{preventDefault:!0}),Ku("ctrl+shift+s",async()=>{P({name:"downloadCsv"}),await Ub(document.getElementById("plotlyChart"),D)},{preventDefault:!0}),Ku("ctrl+s",async()=>{rc(),Hb("MainChart",rc,ce,D)},{preventDefault:!0}),Ku("ctrl+w",()=>{window.close()},{preventDefault:!0}),{plotGlPixelRatio:1,scrollZoom:!0,responsive:!0,displaylogo:!1,displayModeBar:!0,modeBarButtonsToRemove:["lasso2d","select2d","downloadImage"],modeBarButtons:[[{name:"Download CSV (Ctrl+Shift+S)",icon:Pu.downloadCsv,click:async function(e){await Ub(e,D)}},{name:"Download Chart as Image (Ctrl+S)",icon:Pu.downloadImage,click:async function(){rc(),await Hb("MainChart",rc,ce,D)}}],[{name:"Edit Color (Ctrl+E)",icon:Pu.changeColor,click:function(){Pe(!0)}},"drawline","drawopenpath","drawcircle","drawrect","eraseshape"],[{name:"Overlay chart from CSV (Ctrl+O)",icon:Pu.plotCsv,click:function(){P({name:"overlayChart"})}},{name:"Add Text (Ctrl+T)",icon:Pu.addText,click:function(){P({name:"textDialog",data:{text:""}})}},{name:"Change Titles (Ctrl+Shift+T)",icon:Pu.changeTitle,click:function(){P({name:"titleDialog"})}},{name:"Change Theme",icon:Pu.sunIcon,click:function(){F(!0)}}],["hoverClosestCartesian","hoverCompareCartesian","toggleSpikelines"],[{name:"Auto Scale (Ctrl+Shift+A)",icon:Gs.Icons.autoscale,click:function(){J(!0)}},"zoomIn2d","zoomOut2d","autoScale2d","zoom2d","pan2d"]]}}async function u9(P,F){try{if(P["xaxis.range[0]"]!=null){const J=P["xaxis.range[0]"],ce=P["xaxis.range[1]"];let Pe={},D,E;const e=F.data.filter(s=>s.yaxis!=null),_=[...new Set(e.map(s=>s.yaxis||s.y!=null||s.type=="candlestick"))],w=s=>F.data.filter(T=>T.yaxis==s&&(T.y||T.type=="candlestick"));return _.forEach(s=>{if(typeof s!="string")return;let T="yaxis"+s.replace("y",""),y=[],f=[],l=F.layout[T].type=="log";w(s).forEach(r=>{let n=r.x;l=F.layout[T].type=="log";let o=r.y!=null?r.y:[],a=r.type=="candlestick"?r.low:[],u=r.type=="candlestick"?r.high:[];l&&(o=o.map(Math.log10),r.type=="candlestick"&&(a=r.low.map(Math.log10),u=r.high.map(Math.log10)));let p=n.map((c,b)=>{let d=null;return c>=J&&c<=ce&&(r.y!=null&&(d=o[b]),r.type=="candlestick"&&(y.push(a[b]),y.push(u[b]))),d});f=f.concat(p)}),f=f.filter(r=>r!=null&&r!=null),D=Math.min(...f),E=Math.max(...f),y.length>0&&(y=y.filter(r=>r!=null&&r!=null),D=Math.min(...y),E=Math.max(...y));let t=E,i=F.layout[T].fixedrange!=null&&F.layout[T].fixedrange==!0;if(D!=null&&E!=null){let r=E-D,n=.15;if(y.length>0&&(n=.3),D-=r*n,E+=r*n,i){if(F.layout[T].tickvals!=null){let a=t,u=-3,p=Math.round(a*.2,u),c=[2,5,6,7,8,9,10],b=[1,4,5,6,7,8,9];for(let x=0;xc[x]&&(u=-b[x],p=Math.round(a*.2,u));let d=[Math.floor(p),Math.floor(p*2),Math.floor(p*3),Math.floor(p*4)],v=[0,Math.floor(a*7)];Pe[T+".tickvals"]=d,Pe[T+".range"]=v,Pe[T+".tickformat"]=".2s";return}D=0,E=F.layout[T].range[1]}Pe[T+".range"]=[D,E]}}),Pe}}catch(J){console.log(`Error in AutoScaling: ${J}`)}return{}}async function c9({plotData:P,volumeBars:F,setMaximizePlot:J}){const ce=Object.keys(P.layout).filter(s=>s.startsWith("xaxis")).filter(s=>P.layout[s].showticklabels||P.layout[s].matches==null),Pe=P.data.filter(s=>{var T;return(T=s==null?void 0:s.name)==null?void 0:T.startsWith("Volume")});let D={},E=F||{old_nticks:{}};const e=window.innerWidth,_=window.innerHeight;let w=_>420&&e<920?8:_>420&&e<500?9:7;return e<750?(Pe.forEach(s=>{s.type=="bar"&&(s.opacity=1,s.marker.line.width=.09,F.yaxis==null&&(E.yaxis="yaxis"+s.yaxis.replace("y",""),D[E.yaxis+".tickfont.size"]=w,E.tickfont=P.layout[E.yaxis].tickfont||{},P.layout.margin.l-=40))}),ce.forEach(s=>{var T;((T=F.old_nticks)==null?void 0:T[s])==null&&(D[s+".nticks"]=6,E.old_nticks[s]=P.layout[s].nticks||10)}),J(!0),await rc()):window.MODEBAR.style.cssText.includes("display: none")&&(await rc(!1),J(!1),F.old_nticks!=null&&ce.forEach(s=>{F.old_nticks[s]!=null&&(D[s+".nticks"]=E.old_nticks[s],E.old_nticks[s]=void 0)}),F.yaxis!=null&&Pe.forEach(s=>{s.type=="bar"&&(s.opacity=.5,s.marker.line.width=.2,D[E.yaxis+".tickfont.size"]=E.tickfont.size+3,P.layout.margin.l+=40,E.yaxis=void 0)})),{volume_update:E,layout_update:D,plotData:P}}function f9({open:P,onColorChange:F}){const[J,ce]=Un.useState(!1);function Pe(D){F(D)}return P&&!J&&ce(!0),!P&&J&&ce(!1),Un.useEffect(()=>{if(J){let D=function(e){let _=0,w=0,s=0,T=0;document.getElementById(e.id+"_header")?document.getElementById(e.id+"_header").onmousedown=y:e.onmousedown=y;function y(t){t=t||window.event,t.preventDefault(),s=t.clientX,T=t.clientY,document.onmouseup=l,document.onmousemove=f}function f(t){t=t||window.event,t.preventDefault(),_=s-t.clientX,w=T-t.clientY,s=t.clientX,T=t.clientY,e.style.top=e.offsetTop-w+"px",e.style.left=e.offsetLeft-_+"px"}function l(){document.onmouseup=null,document.onmousemove=null}},E=document.getElementById("changecolor");E.style.display="block",E.style.width=null,D(E)}else document.getElementById("changecolor").style.display="none"},[J]),br("div",{id:"changecolor",children:br("div",{id:"changecolor_header",children:br("input",{type:"color",id:"picked_color",value:"#00ACFF",onChange:D=>{let E=D.target.value;Pe(E)}})})})}function qw(P){var F,J,ce="";if(typeof P=="string"||typeof P=="number")ce+=P;else if(typeof P=="object")if(Array.isArray(P))for(F=0;F{ce.preventDefault(),window.pywry.open_file(J)},children:J})]})})}),br("div",{style:{float:"right",marginTop:20},children:br("button",{className:"_btn",style:{padding:"8px 16px",width:"100%"},onClick:F,children:"Close"})})]})})}const d9=QT(ZT);function g9({json:P,date:F,cmd:J,title:ce,globals:Pe,info:D}){var se,fe;const E=GT();Un.useEffect(()=>{E&&E.capture("chart",D)},[]),delete P.layout.width,delete P.layout.height,(fe=(se=P.layout)==null?void 0:se.title)!=null&&fe.text&&(P.layout.title.text="");const[e,_]=Un.useState({}),[w,s]=Un.useState(!1),[T,y]=Un.useState(ce),[f,l]=Un.useState({}),[t,i]=Un.useState(!1),[r,n]=Un.useState({name:""}),[o,a]=Un.useState(!1),[u,p]=Un.useState(null),[c,b]=Un.useState({old_nticks:{}}),[d,v]=Un.useState(!1),[x,g]=Un.useState(!1),[m,k]=Un.useState(P),[h,M]=Un.useState([]),[A,C]=Un.useState(!1),[L,O]=Un.useState(!0),[I,R]=Un.useState(!1),[U,B]=Un.useState(!1),[G,N]=Un.useState(!1),[j,V]=Un.useState({}),[H,ee]=Un.useState([]),Q=()=>n({name:""});function X(ye){var de,he,xe,Re,we;console.log("onDeleteAnnotation",ye);const pe=(he=(de=m==null?void 0:m.layout)==null?void 0:de.annotations)==null?void 0:he.findIndex(Ae=>Ae.text===ye.text);console.log("index",pe),pe>-1&&((Re=(xe=m==null?void 0:m.layout)==null?void 0:xe.annotations)==null||Re.splice(pe,1),k({...m}),M((we=m==null?void 0:m.layout)==null?void 0:we.annotations))}function Y(ye){U7({plotData:m,popupData:ye,setPlotData:k,setModal:n,setOnAnnotationClick:V,setAnnotations:M,onAnnotationClick:j,ohlcAnnotation:H,setOhlcAnnotation:ee,annotations:h,plotDiv:u})}Un.useEffect(()=>{x&&(n({name:"downloadFinished"}),g(!1))},[x]),Un.useEffect(()=>{f&&Object.keys(f).length>0&&(Object.keys(f).forEach(ye=>{m.layout[ye].title={...m.layout[ye].title||{},text:f[ye]},m.layout[ye].showticklabels=!0}),l({}))},[f]);function K(ye){let pe=u.layout.shapes;if(!pe||pe.length==0)return;let de=pe[pe.length-1];de.line.color=ye,Gs.update(u,{},{shapes:pe})}function te(ye,pe=!1){let de=e[ye]||document.querySelector(`[data-title="${ye}"]`);pe?(de.style.border="transparent",de.style.boxShadow="none"):(de.style.border="1px solid rgba(0, 151, 222, 1.0)",de.style.borderRadius="5px",de.style.borderpadding="5px",de.style.boxShadow="0 0 5px rgba(0, 151, 222, 1.0)"),_({...e,[ye]:de})}function ae(){let ye="Auto Scale (Ctrl+Shift+A)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"?(de=!1,u.on("plotly_relayout",Np(async function(he){if(he["xaxis.range[0]"]==null)return;let xe=await u9(he,u);Gs.update(u,{},xe)},100))):u.removeAllListeners("plotly_relayout"),te(ye,de)}function oe(){let ye="Edit Color (Ctrl+E)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"&&(de=!1),N(!de),te(ye,de)}return Un.useEffect(()=>{I&&(console.log("activateAutoScale",!I),ae(),R(!1))},[I]),Un.useEffect(()=>{U&&(oe(),B(!1))},[U]),Un.useEffect(()=>{if(A)try{console.log("changeTheme",A);const ye=m==null?void 0:m.data.filter(xe=>{var Re;return(Re=xe==null?void 0:xe.name)==null?void 0:Re.startsWith("Volume")});let pe=!L;window.document.body.style.backgroundColor=pe?"#000":"#fff",m.layout.font={...m.layout.font||{},color:pe?"#fff":"#000"};const de=pe?Pu.sunIcon:Pu.moonIcon;document.querySelector('[data-title="Change Theme"]').getElementsByTagName("path")[0].setAttribute("d",de.path),document.querySelector('[data-title="Change Theme"]').getElementsByTagName("svg")[0].setAttribute("viewBox",de.viewBox);const he={"#e4003a":"#c80000","#00ACFF":"#009600","#009600":"#00ACFF","#c80000":"#e4003a"};ye.forEach(xe=>{xe.type=="bar"&&(xe.marker.color=xe.marker.color.map(Re=>he[Re]||Re))}),m.layout.template=pe?ek:tk,k({...m}),Gs.react(u,m.data,m.layout),O(pe),C(!1)}catch(ye){console.log("error",ye)}},[A]),Un.useEffect(()=>{if(t){O(!0),R(!1);const ye=["Download CSV","Download Chart as Image","Overlay chart from CSV","Add Text","Change Titles","Auto Scale (Ctrl+Shift+A)","Reset Axes"],pe=document.querySelector('[data-title="Autoscale"]');pe&&(pe.getElementsByTagName("path")[0].setAttribute("d",Gs.Icons.home.path),pe.setAttribute("data-title","Reset Axes")),window.MODEBAR=document.getElementsByClassName("modebar-container")[0];const de=window.MODEBAR.getElementsByClassName("modebar-btn");if(window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`,de){let he={};for(let xe=0;xe0&&(k(Re),b(we),Gs.relayout(u,xe))})}},[t]),ni("div",{className:"relative h-full",children:[o&&br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})}),ni("div",{id:"loading",className:"saving",children:[br("div",{id:"loading_text",className:"loading_text"}),br("div",{id:"loader",className:"loader"})]}),br(D7,{addOverlay:ye=>{console.log(ye),m.layout.showlegend=!0,k(ye),i(!1)},plotlyData:m,setLoading:a,open:r.name==="overlayChart",close:Q}),br(B7,{updateTitle:ye=>y(ye),updateAxesTitles:ye=>l(ye),defaultTitle:T,plotlyData:m,open:r.name==="titleDialog",close:Q}),br(N7,{popupData:r.name==="textDialog"?r==null?void 0:r.data:null,open:r.name==="textDialog",close:Q,addAnnotation:ye=>Y(ye),deleteAnnotation:ye=>X(ye)}),br(f9,{open:G,onColorChange:K}),br(p9,{open:r.name==="downloadFinished",close:Q}),ni("div",{className:"relative h-full",id:"MainChart",children:[ni("div",{className:"_header relative gap-4 py-2 text-center text-xs flex items-center justify-between px-4 text-white",children:[br("div",{className:"w-1/3",children:br("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"40",fill:"none",viewBox:"0 0 64 40",children:br("path",{fill:"#fff",d:"M61.283 3.965H33.608v27.757h25.699V19.826H37.561v-3.965H63.26V3.965h-1.977zM39.538 23.792h15.815v3.965H37.561v-3.965h1.977zM59.306 9.913v1.983H37.561V7.931h21.745v1.982zM33.606 0h-3.954v3.965H33.606V0zM25.7 3.966H0V15.86h25.7v3.965H3.953v11.896h25.7V3.966h-3.955zm0 21.808v1.983H7.907v-3.965h17.791v1.982zm0-15.86v1.982H3.953V7.931h21.745v1.982zM37.039 35.693v2.952l-.246-.246-.245-.245-.245-.247-.245-.246-.246-.246-.245-.245-.245-.247-.247-.246-.245-.246-.245-.246-.245-.246-.246-.246h-.49v3.936h.49v-3.198l.246.246.245.246.245.246.245.246.246.246.246.246.245.247.246.245.245.246.245.247.245.246.246.245.245.246h.245v-3.936h-.49zM44.938 37.17h-.491v-1.477h-2.944v3.937h3.93v-2.46h-.495zm-2.944-.246v-.739h1.962v.984h-1.962v-.245zm2.944.984v1.23h-2.944V37.66h2.944v.247zM52.835 37.17h-.49v-1.477h-2.946v3.937h3.925v-2.46h-.489zm-2.944-.246v-.739h1.963v.984h-1.965l.002-.245zm2.944.984v1.23H49.89V37.66h2.946v.247zM29.174 35.693H25.739v3.936H29.663v-.491H26.229v-.984h2.943v-.493H26.229v-1.476h3.434v-.492h-.489zM13.37 35.693H9.934v3.937h3.925v-3.937h-.49zm0 .738v2.709h-2.945v-2.955h2.943l.001.246zM21.276 35.693h-3.435v3.937h.491v-1.476h3.434v-2.461h-.49zm0 .738v1.23h-2.944v-1.476h2.944v.246z"})})}),br("p",{className:"font-bold w-1/3 flex flex-col gap-0.5 items-center",children:T}),ni("p",{className:"w-1/3 text-right text-xs",children:[new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"long"}).format(F).replace(/:\d\d /," "),br("br",{}),br("span",{className:"text-grey-400",children:J})]})]}),br("div",{className:h9("w-full sm:pb-12",{"h-[calc(100%-10px)]":d,"h-[calc(100%-50px)]":!d}),children:br(d9,{onInitialized:()=>{if(!u){const ye=document.getElementById("plotlyChart");console.log("plot",ye),ye&&p(ye),ye.globals=Pe}t||i(!0)},className:"w-full h-full",divId:"plotlyChart",data:m.data,layout:m.layout,config:l9({setModal:n,changeTheme:C,autoScaling:R,Loading:a,changeColor:B,downloadFinished:g})})})]})]})}function v9(){const[P,F]=Un.useState(null),[J,ce]=Un.useState({});Un.useEffect(()=>{{const E=setInterval(()=>{if(window.json_data){const e=window.json_data;console.log(e),F(e),clearInterval(E)}},100);return()=>clearInterval(E)}},[]);const D=(E=>{var y,f,l,t;if(!E)return null;let e={added_traces:[],csv_yaxis_id:null,cmd_src_idx:null,cmd_idx:null,cmd_src:"",old_margin:null,title:""},_=(f=(y=E.layout)==null?void 0:y.title)==null?void 0:f.text.replace(/|<\/b>/g,"").replace(/ /g,"_"),w=new Date().toISOString().slice(0,10).replace(/-/g,""),s=new Date().toISOString().slice(11,19).replace(/:/g,"");window.title=`openbb_${_}_${w}_${s}`,E.layout.annotations!=null&&E.layout.annotations.forEach(function(i){if(i.text!=null&&i.text[0]=="/"){e.cmd_src=i.text,e.cmd_idx=E.layout.annotations.indexOf(i),i.text="";let r=E.layout.margin;e.old_margin={...r},r.t!=null&&r.t>40&&(r.t=40),E.cmd=="/stocks/candle"&&(r.r-=50)}}),E.data.forEach(function(i){if(i.name!=null){const r=i.name.length;i.name=i.name+" ",i.hoverlabel={namelength:r}}});let T=((t=(l=E.layout)==null?void 0:l.title)==null?void 0:t.text)||"Interactive Chart";return e.title=T,{data:E,date:new Date,globals:e,cmd:E.command_location,posthog:E.posthog,python_version:E.python_version,pywry_version:E.pywry_version,terminal_version:E.terminal_version,title:T}})(P);if(D){D.posthog.collect_logs&&!J&&ce({api_host:"https://app.posthog.com",autocapture:{css_selector_allowlist:[".ph-capture"]},capture_pageview:!1,loaded:function(w){const s=(D==null?void 0:D.log_id)||"";s!=""&&s!="REPLACE_ME"&&w.identify(s),w.onFeatureFlags(function(){w.isFeatureEnabled("record-pywry",{send_event:!1})||w.stopSessionRecording(),w.isFeatureEnabled("collect-logs-pywry",{send_event:!1})?w.has_opted_out_capturing()&&w.opt_in_capturing():w.opt_out_capturing()})}});const E={INFO:{command:D.cmd,title:D.title,date:D.date,python_version:D.python_version,pywry_version:D.pywry_version,terminal_version:D.terminal_version}},e=br(g9,{json:D.data,date:D.date,cmd:D.cmd,title:D.title,globals:D.globals,info:E});return D.posthog.collect_logs&&J?br(qT,{apiKey:"phc_vhssDAMod5qIplznQ75Kdgz4aB1qPFmeVmfEOZ4hkRw",options:J,children:e}):e}else return br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})})}z8.render(br(s_.StrictMode,{children:br(v9,{})}),document.getElementById("root")); +`)})}function b(){return Promise.resolve(J.asArray(document.styleSheets)).then(v).then(d).then(function(g){return g.map(x)});function d(g){return g.filter(function(m){return m.type===CSSRule.FONT_FACE_RULE}).filter(function(m){return ce.shouldProcess(m.style.getPropertyValue("src"))})}function v(g){var m=[];return g.forEach(function(k){try{J.asArray(k.cssRules||[]).forEach(m.push.bind(m))}catch(h){console.log("Error while reading CSS rules from "+k.href,h.toString())}}),m}function x(g){return{resolve:function(){var k=(g.parentStyleSheet||{}).href;return ce.inlineAll(g.cssText,k)},src:function(){return g.style.getPropertyValue("src")}}}}}function p(){return{inlineAll:b,impl:{newImage:c}};function c(d){return{inline:v};function v(x){return J.isDataUrl(d.src)?Promise.resolve():Promise.resolve(d.src).then(x||J.getAndEncode).then(function(g){return J.dataAsUrl(g,J.mimeType(d.src))}).then(function(g){return new Promise(function(m,k){d.onload=m,d.onerror=k,d.src=g})})}}function b(d){if(!(d instanceof Element))return Promise.resolve(d);return v(d).then(function(){return d instanceof HTMLImageElement?c(d).inline():Promise.all(J.asArray(d.childNodes).map(function(x){return b(x)}))});function v(x){var g=x.style.getPropertyValue("background");return g?ce.inlineAll(g).then(function(m){x.style.setProperty("background",m,x.style.getPropertyPriority("background"))}).then(function(){return x}):Promise.resolve(x)}}}})()})(jw);var n9=jw.exports;const Uw=jp(n9),r9=async({fileHandle:P,blob:F})=>{if(P)return i9({fileHandle:P,blob:F})},i9=async({fileHandle:P,blob:F})=>{const J=await P.createWritable();await J.write(F),await J.close()},a9=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}},{description:"SVG Image",accept:{"image/svg+xml":[".svg"]}}],Vw=({filename:P,is_image:F})=>{try{if("showSaveFilePicker"in window){const J={suggestedName:P,types:F?a9:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(J)}}catch(J){console.error(J)}return new Promise(J=>{J(null)})},ty=(P,F,J)=>{try{if(J===null)throw new Error("Cannot access filesystem");return r9({fileHandle:J,blob:P})}catch(ce){console.error("oops, something went wrong!",ce);const Pe=URL.createObjectURL(P),D=document.createElement("a");D.setAttribute("href",Pe),D.setAttribute("download",F),D.style.visibility="hidden",document.body.appendChild(D),D.click(),document.body.removeChild(D)}return new Promise(ce=>{ce(!0)})};async function Ub(P,F){const J=P.data;let ce=[];const Pe=[],D="title"in P.layout.xaxis&&P.layout.xaxis.title.text!==void 0?P.layout.xaxis.title.text:"x",E="title"in P.layout.yaxis&&P.layout.yaxis.title.text!==void 0?P.layout.yaxis.title.text:"y";return J.forEach(function(e){e.type==="candlestick"&&(ce.length===0&&(ce=["Date","Open","High","Low","Close"]),e.x.forEach(function(_,w){Pe.push([_,e.open[w],e.high[w],e.low[w],e.close[w]])})),["scatter","bar"].includes(e.type)&&(ce.length===0&&ce.push(D),ce.push(e.name!==void 0?e.name:E),e.x.forEach(function(_,w){Pe[w]===void 0&&(Pe[w]=[_]),Pe[w].push(e.y[w])}))}),await o9(ce,Pe,F)}async function o9(P,F,J){const ce=P,Pe=F.map(w=>w.map(s=>s==null?"":typeof s=="object"?JSON.stringify(s):s.toString().replace(/"/g,'""'))),E=[ce,...Pe].map(w=>w.join(",")).join(` +`),e=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=`${window.title}.csv`;try{const w=await Vw({filename:_});await Bp("Saving CSV"),Np(async function(){ty(e,_,w).then(async function(){await new Promise(s=>setTimeout(s,1500)),w||J(!0),await Bp("",!0)})},2)()}catch(w){console.error(w)}}function Bp(P,F){const J=window.document.getElementById("loading"),ce=window.document.getElementById("loading_text");return new Promise(Pe=>{F?J.classList.remove("show"):(ce.innerHTML=P,J.classList.add("show"));const D=setInterval(function(){(F?!J.classList.contains("show"):J.classList.contains("show"))&&(clearInterval(D),Pe(!0))},.01)})}const Np=(P,F)=>{let J;return function(){const ce=this,Pe=arguments;clearTimeout(J),J=setTimeout(()=>P.apply(ce,Pe),F)}},s9={yref:"paper",xref:"paper",x:1,y:0,text:"OpenBB Terminal",font_size:17,font_color:"gray",opacity:.5,xanchor:"right",yanchor:"bottom",yshift:-80,xshift:40};async function Vb(P,F,J=!1){const ce=document.getElementById("plotlyChart");J&&(ce.layout.annotations.push(s9),ce.globals.cmd_idx!==void 0&&ce.globals.cmd_src!==void 0&&(ce.layout.annotations[ce.globals.cmd_idx].text=ce.globals.cmd_src),Gs.relayout(ce,{"title.text":ce.globals.title,margin:ce.globals.old_margin})),J||(ce.globals.cmd_idx!==void 0&&ce.globals.cmd_src!==void 0&&(ce.layout.annotations[ce.globals.cmd_idx].text=""),ce.layout.annotations.splice(F,1),Gs.relayout(ce,{"title.text":"",margin:P}))}async function Hw(P,F,J){const ce=document.getElementById(P);if(["svg","pdf"].includes(J)){const Pe=document.getElementById("plotlyChart"),D=Pe.layout.margin,E=Pe.layout.annotations.length;await Vb(D,E,!0),Gs.downloadImage(Pe,{format:"svg",height:Pe.clientHeight,width:Pe.clientWidth,filename:window.title}),await Vb(D,E,!1),await Bp("",!0);return}Np(async function(){Uw.toBlob(ce).then(function(Pe){ty(Pe,F,null)})},2)()}async function Hb(P,F,J,ce){const Pe=document.getElementById(P),D=`${window.title}.png`;try{J(!0);const E=await Vw({filename:D,is_image:!0});let e="png";if(E!==null&&(e=E.name.split(".").pop()),await Bp(`Saving ${e.toUpperCase()}`),["svg","pdf"].includes(e)){await Hw(P,D,e),F(!1),J(!1),E||ce(!0);return}Np(async function(){Uw.toBlob(Pe).then(function(_){ty(_,D,E).then(async function(){await Bp("",!0),F(!1),J(!1),E||ce(!0)})})},2)()}catch(E){console.error(E),F(!1),J(!1)}}function rc(P=!0){return new Promise(F=>{window.MODEBAR||(window.MODEBAR=window.document.getElementsByClassName("modebar-container")[0],window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`),window.MODEBAR&&(window.MODEBAR.style.cssText.includes("display: none")&&!P?window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`:window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:none;`,F(!0))})}function l9({setModal:P,changeTheme:F,autoScaling:J,Loading:ce,changeColor:Pe,downloadFinished:D}){return Ku("ctrl+shift+t",()=>{P({name:"titleDialog"})},{preventDefault:!0}),Ku("ctrl+t",()=>{P({name:"textDialog"})},{preventDefault:!0}),Ku("ctrl+o",()=>{P({name:"overlayChart"})},{preventDefault:!0}),Ku("ctrl+shift+h",()=>{rc()},{preventDefault:!0}),Ku("ctrl+e",()=>{Pe(!0)},{preventDefault:!0}),Ku("ctrl+shift+s",async()=>{P({name:"downloadCsv"}),await Ub(document.getElementById("plotlyChart"),D)},{preventDefault:!0}),Ku("ctrl+s",async()=>{rc(),Hb("MainChart",rc,ce,D)},{preventDefault:!0}),Ku("ctrl+w",()=>{window.close()},{preventDefault:!0}),{plotGlPixelRatio:1,scrollZoom:!0,responsive:!0,displaylogo:!1,displayModeBar:!0,modeBarButtonsToRemove:["lasso2d","select2d","downloadImage"],modeBarButtons:[[{name:"Download CSV (Ctrl+Shift+S)",icon:Pu.downloadCsv,click:async function(e){await Ub(e,D)}},{name:"Download Chart as Image (Ctrl+S)",icon:Pu.downloadImage,click:async function(){rc(),await Hb("MainChart",rc,ce,D)}}],[{name:"Edit Color (Ctrl+E)",icon:Pu.changeColor,click:function(){Pe(!0)}},"drawline","drawopenpath","drawcircle","drawrect","eraseshape"],[{name:"Overlay chart from CSV (Ctrl+O)",icon:Pu.plotCsv,click:function(){P({name:"overlayChart"})}},{name:"Add Text (Ctrl+T)",icon:Pu.addText,click:function(){P({name:"textDialog",data:{text:""}})}},{name:"Change Titles (Ctrl+Shift+T)",icon:Pu.changeTitle,click:function(){P({name:"titleDialog"})}},{name:"Change Theme",icon:Pu.sunIcon,click:function(){F(!0)}}],["hoverClosestCartesian","hoverCompareCartesian","toggleSpikelines"],[{name:"Auto Scale (Ctrl+Shift+A)",icon:Gs.Icons.autoscale,click:function(){J(!0)}},"zoomIn2d","zoomOut2d","autoScale2d","zoom2d","pan2d"]]}}async function u9(P,F){try{if(P["xaxis.range[0]"]!=null){const J=P["xaxis.range[0]"],ce=P["xaxis.range[1]"];let Pe={},D,E;const e=F.data.filter(s=>s.yaxis!=null),_=[...new Set(e.map(s=>s.yaxis||s.y!=null||s.type=="candlestick"))],w=s=>F.data.filter(T=>T.yaxis==s&&(T.y||T.type=="candlestick"));return _.forEach(s=>{if(typeof s!="string")return;let T="yaxis"+s.replace("y",""),y=[],f=[],l=F.layout[T].type=="log";w(s).forEach(r=>{let n=r.x;l=F.layout[T].type=="log";let o=r.y!=null?r.y:[],a=r.type=="candlestick"?r.low:[],u=r.type=="candlestick"?r.high:[];l&&(o=o.map(Math.log10),r.type=="candlestick"&&(a=r.low.map(Math.log10),u=r.high.map(Math.log10)));let p=n.map((c,b)=>{let d=null;return c>=J&&c<=ce&&(r.y!=null&&(d=o[b]),r.type=="candlestick"&&(y.push(a[b]),y.push(u[b]))),d});f=f.concat(p)}),f=f.filter(r=>r!=null&&r!=null),D=Math.min(...f),E=Math.max(...f),y.length>0&&(y=y.filter(r=>r!=null&&r!=null),D=Math.min(...y),E=Math.max(...y));let t=E,i=F.layout[T].fixedrange!=null&&F.layout[T].fixedrange==!0;if(D!=null&&E!=null){let r=E-D,n=.15;if(y.length>0&&(n=.3),D-=r*n,E+=r*n,i){if(F.layout[T].tickvals!=null){let a=t,u=-3,p=Math.round(a*.2,u),c=[2,5,6,7,8,9,10],b=[1,4,5,6,7,8,9];for(let x=0;xc[x]&&(u=-b[x],p=Math.round(a*.2,u));let d=[Math.floor(p),Math.floor(p*2),Math.floor(p*3),Math.floor(p*4)],v=[0,Math.floor(a*7)];Pe[T+".tickvals"]=d,Pe[T+".range"]=v,Pe[T+".tickformat"]=".2s";return}D=0,E=F.layout[T].range[1]}Pe[T+".range"]=[D,E]}}),Pe}}catch(J){console.log(`Error in AutoScaling: ${J}`)}return{}}async function c9({plotData:P,volumeBars:F,setMaximizePlot:J}){const ce=Object.keys(P.layout).filter(s=>s.startsWith("xaxis")).filter(s=>P.layout[s].showticklabels||P.layout[s].matches==null),Pe=P.data.filter(s=>{var T;return(T=s==null?void 0:s.name)==null?void 0:T.startsWith("Volume")});let D={},E=F||{old_nticks:{}};const e=window.innerWidth,_=window.innerHeight;let w=_>420&&e<920?8:_>420&&e<500?9:7;return e<750?(Pe.forEach(s=>{s.type=="bar"&&(s.opacity=1,s.marker.line.width=.09,F.yaxis==null&&(E.yaxis="yaxis"+s.yaxis.replace("y",""),D[E.yaxis+".tickfont.size"]=w,E.tickfont=P.layout[E.yaxis].tickfont||{},P.layout.margin.l-=40))}),ce.forEach(s=>{var T;((T=F.old_nticks)==null?void 0:T[s])==null&&(D[s+".nticks"]=6,E.old_nticks[s]=P.layout[s].nticks||10)}),J(!0),await rc()):window.MODEBAR.style.cssText.includes("display: none")&&(await rc(!1),J(!1),F.old_nticks!=null&&ce.forEach(s=>{F.old_nticks[s]!=null&&(D[s+".nticks"]=E.old_nticks[s],E.old_nticks[s]=void 0)}),F.yaxis!=null&&Pe.forEach(s=>{s.type=="bar"&&(s.opacity=.5,s.marker.line.width=.2,D[E.yaxis+".tickfont.size"]=E.tickfont.size+3,P.layout.margin.l+=40,E.yaxis=void 0)})),{volume_update:E,layout_update:D,plotData:P}}function f9({open:P,onColorChange:F}){const[J,ce]=Un.useState(!1);function Pe(D){F(D)}return P&&!J&&ce(!0),!P&&J&&ce(!1),Un.useEffect(()=>{if(J){let D=function(e){let _=0,w=0,s=0,T=0;document.getElementById(e.id+"_header")?document.getElementById(e.id+"_header").onmousedown=y:e.onmousedown=y;function y(t){t=t||window.event,t.preventDefault(),s=t.clientX,T=t.clientY,document.onmouseup=l,document.onmousemove=f}function f(t){t=t||window.event,t.preventDefault(),_=s-t.clientX,w=T-t.clientY,s=t.clientX,T=t.clientY,e.style.top=e.offsetTop-w+"px",e.style.left=e.offsetLeft-_+"px"}function l(){document.onmouseup=null,document.onmousemove=null}},E=document.getElementById("changecolor");E.style.display="block",E.style.width=null,D(E)}else document.getElementById("changecolor").style.display="none"},[J]),br("div",{id:"changecolor",children:br("div",{id:"changecolor_header",children:br("input",{type:"color",id:"picked_color",value:"#00ACFF",onChange:D=>{let E=D.target.value;Pe(E)}})})})}function qw(P){var F,J,ce="";if(typeof P=="string"||typeof P=="number")ce+=P;else if(typeof P=="object")if(Array.isArray(P))for(F=0;F{ce.preventDefault(),window.pywry.open_file(J)},children:J})]})})}),br("div",{style:{float:"right",marginTop:20},children:br("button",{className:"_btn",style:{padding:"8px 16px",width:"100%"},onClick:F,children:"Close"})})]})})}const d9=QT(ZT);function g9({json:P,date:F,cmd:J,title:ce,globals:Pe,info:D}){var se,fe;const E=GT();Un.useEffect(()=>{E&&E.capture("chart",D)},[]),delete P.layout.width,delete P.layout.height,(fe=(se=P.layout)==null?void 0:se.title)!=null&&fe.text&&(P.layout.title.text="");const[e,_]=Un.useState({}),[w,s]=Un.useState(!1),[T,y]=Un.useState(ce),[f,l]=Un.useState({}),[t,i]=Un.useState(!1),[r,n]=Un.useState({name:""}),[o,a]=Un.useState(!1),[u,p]=Un.useState(null),[c,b]=Un.useState({old_nticks:{}}),[d,v]=Un.useState(!1),[x,g]=Un.useState(!1),[m,k]=Un.useState(P),[h,M]=Un.useState([]),[A,C]=Un.useState(!1),[L,O]=Un.useState(!0),[I,R]=Un.useState(!1),[U,B]=Un.useState(!1),[G,N]=Un.useState(!1),[j,V]=Un.useState({}),[H,ee]=Un.useState([]),Q=()=>n({name:""});function X(ye){var de,he,xe,Re,we;console.log("onDeleteAnnotation",ye);const pe=(he=(de=m==null?void 0:m.layout)==null?void 0:de.annotations)==null?void 0:he.findIndex(Ae=>Ae.text===ye.text);console.log("index",pe),pe>-1&&((Re=(xe=m==null?void 0:m.layout)==null?void 0:xe.annotations)==null||Re.splice(pe,1),k({...m}),M((we=m==null?void 0:m.layout)==null?void 0:we.annotations))}function Y(ye){U7({plotData:m,popupData:ye,setPlotData:k,setModal:n,setOnAnnotationClick:V,setAnnotations:M,onAnnotationClick:j,ohlcAnnotation:H,setOhlcAnnotation:ee,annotations:h,plotDiv:u})}Un.useEffect(()=>{x&&(n({name:"downloadFinished"}),g(!1))},[x]),Un.useEffect(()=>{f&&Object.keys(f).length>0&&(Object.keys(f).forEach(ye=>{m.layout[ye].title={...m.layout[ye].title||{},text:f[ye]},m.layout[ye].showticklabels=!0}),l({}))},[f]);function K(ye){let pe=u.layout.shapes;if(!pe||pe.length==0)return;let de=pe[pe.length-1];de.line.color=ye,Gs.update(u,{},{shapes:pe})}function te(ye,pe=!1){let de=e[ye]||document.querySelector(`[data-title="${ye}"]`);pe?(de.style.border="transparent",de.style.boxShadow="none"):(de.style.border="1px solid rgba(0, 151, 222, 1.0)",de.style.borderRadius="5px",de.style.borderpadding="5px",de.style.boxShadow="0 0 5px rgba(0, 151, 222, 1.0)"),_({...e,[ye]:de})}function ae(){let ye="Auto Scale (Ctrl+Shift+A)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"?(de=!1,u.on("plotly_relayout",Np(async function(he){if(he["xaxis.range[0]"]==null)return;let xe=await u9(he,u);Gs.update(u,{},xe)},100))):u.removeAllListeners("plotly_relayout"),te(ye,de)}function oe(){let ye="Edit Color (Ctrl+E)",pe=e[ye]||document.querySelector(`[data-title="${ye}"]`),de=!0;pe.style.border=="transparent"&&(de=!1),N(!de),te(ye,de)}return Un.useEffect(()=>{I&&(console.log("activateAutoScale",!I),ae(),R(!1))},[I]),Un.useEffect(()=>{U&&(oe(),B(!1))},[U]),Un.useEffect(()=>{if(A)try{console.log("changeTheme",A);const ye=m==null?void 0:m.data.filter(xe=>{var Re;return(Re=xe==null?void 0:xe.name)==null?void 0:Re.startsWith("Volume")});let pe=!L;window.document.body.style.backgroundColor=pe?"#000":"#fff",m.layout.font={...m.layout.font||{},color:pe?"#fff":"#000"};const de=pe?Pu.sunIcon:Pu.moonIcon;document.querySelector('[data-title="Change Theme"]').getElementsByTagName("path")[0].setAttribute("d",de.path),document.querySelector('[data-title="Change Theme"]').getElementsByTagName("svg")[0].setAttribute("viewBox",de.viewBox);const he={"#e4003a":"#c80000","#00ACFF":"#009600","#009600":"#00ACFF","#c80000":"#e4003a"};ye.forEach(xe=>{xe.type=="bar"&&(xe.marker.color=xe.marker.color.map(Re=>he[Re]||Re))}),m.layout.template=pe?ek:tk,k({...m}),Gs.react(u,m.data,m.layout),O(pe),C(!1)}catch(ye){console.log("error",ye)}},[A]),Un.useEffect(()=>{if(t){O(!0),R(!1);const ye=["Download CSV","Download Chart as Image","Overlay chart from CSV","Add Text","Change Titles","Auto Scale (Ctrl+Shift+A)","Reset Axes"],pe=document.querySelector('[data-title="Autoscale"]');pe&&(pe.getElementsByTagName("path")[0].setAttribute("d",Gs.Icons.home.path),pe.setAttribute("data-title","Reset Axes")),window.MODEBAR=document.getElementsByClassName("modebar-container")[0];const de=window.MODEBAR.getElementsByClassName("modebar-btn");if(window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`,de){let he={};for(let xe=0;xe0&&(k(Re),b(we),Gs.relayout(u,xe))})}},[t]),ni("div",{className:"relative h-full",children:[o&&br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})}),ni("div",{id:"loading",className:"saving",children:[br("div",{id:"loading_text",className:"loading_text"}),br("div",{id:"loader",className:"loader"})]}),br(D7,{addOverlay:ye=>{console.log(ye),m.layout.showlegend=!0,k(ye),i(!1)},plotlyData:m,setLoading:a,open:r.name==="overlayChart",close:Q}),br(B7,{updateTitle:ye=>y(ye),updateAxesTitles:ye=>l(ye),defaultTitle:T,plotlyData:m,open:r.name==="titleDialog",close:Q}),br(N7,{popupData:r.name==="textDialog"?r==null?void 0:r.data:null,open:r.name==="textDialog",close:Q,addAnnotation:ye=>Y(ye),deleteAnnotation:ye=>X(ye)}),br(f9,{open:G,onColorChange:K}),br(p9,{open:r.name==="downloadFinished",close:Q}),ni("div",{className:"relative h-full",id:"MainChart",children:[ni("div",{className:"_header relative gap-4 py-2 text-center text-xs flex items-center justify-between px-4 text-white",children:[br("div",{className:"w-1/3",children:br("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"40",fill:"none",viewBox:"0 0 64 40",children:br("path",{fill:"#fff",d:"M61.283 3.965H33.608v27.757h25.699V19.826H37.561v-3.965H63.26V3.965h-1.977zM39.538 23.792h15.815v3.965H37.561v-3.965h1.977zM59.306 9.913v1.983H37.561V7.931h21.745v1.982zM33.606 0h-3.954v3.965H33.606V0zM25.7 3.966H0V15.86h25.7v3.965H3.953v11.896h25.7V3.966h-3.955zm0 21.808v1.983H7.907v-3.965h17.791v1.982zm0-15.86v1.982H3.953V7.931h21.745v1.982zM37.039 35.693v2.952l-.246-.246-.245-.245-.245-.247-.245-.246-.246-.246-.245-.245-.245-.247-.247-.246-.245-.246-.245-.246-.245-.246-.246-.246h-.49v3.936h.49v-3.198l.246.246.245.246.245.246.245.246.246.246.246.246.245.247.246.245.245.246.245.247.245.246.246.245.245.246h.245v-3.936h-.49zM44.938 37.17h-.491v-1.477h-2.944v3.937h3.93v-2.46h-.495zm-2.944-.246v-.739h1.962v.984h-1.962v-.245zm2.944.984v1.23h-2.944V37.66h2.944v.247zM52.835 37.17h-.49v-1.477h-2.946v3.937h3.925v-2.46h-.489zm-2.944-.246v-.739h1.963v.984h-1.965l.002-.245zm2.944.984v1.23H49.89V37.66h2.946v.247zM29.174 35.693H25.739v3.936H29.663v-.491H26.229v-.984h2.943v-.493H26.229v-1.476h3.434v-.492h-.489zM13.37 35.693H9.934v3.937h3.925v-3.937h-.49zm0 .738v2.709h-2.945v-2.955h2.943l.001.246zM21.276 35.693h-3.435v3.937h.491v-1.476h3.434v-2.461h-.49zm0 .738v1.23h-2.944v-1.476h2.944v.246z"})})}),br("p",{className:"font-bold w-1/3 flex flex-col gap-0.5 items-center",children:T}),ni("p",{className:"w-1/3 text-right text-xs",children:[new Intl.DateTimeFormat("en-GB",{dateStyle:"full",timeStyle:"long"}).format(F).replace(/:\d\d /," "),br("br",{}),br("span",{className:"text-grey-400",children:J})]})]}),br("div",{className:h9("w-full sm:pb-12",{"h-[calc(100%-10px)]":d,"h-[calc(100%-50px)]":!d}),children:br(d9,{onInitialized:()=>{if(!u){const ye=document.getElementById("plotlyChart");console.log("plot",ye),ye&&p(ye),ye.globals=Pe}t||i(!0)},className:"w-full h-full",divId:"plotlyChart",data:m.data,layout:m.layout,config:l9({setModal:n,changeTheme:C,autoScaling:R,Loading:a,changeColor:B,downloadFinished:g})})})]})]})}function v9(){const[P,F]=Un.useState(null),[J,ce]=Un.useState({});Un.useEffect(()=>{{const E=setInterval(()=>{if(window.json_data){const e=window.json_data;console.log(e),F(e),clearInterval(E)}},100);return()=>clearInterval(E)}},[]);const D=(E=>{var y,f,l,t;if(!E)return null;let e={added_traces:[],csv_yaxis_id:null,cmd_src_idx:null,cmd_idx:null,cmd_src:"",old_margin:null,title:""},_=(f=(y=E.layout)==null?void 0:y.title)==null?void 0:f.text.replace(/ -/g,"").replace(/-/g,"").replace(/|<\/b>/g,"").replace(/ /g,"_"),w=new Date().toISOString().slice(0,10).replace(/-/g,""),s=new Date().toISOString().slice(11,19).replace(/:/g,"");window.title=`openbb_${_}_${w}_${s}`,E.layout.annotations!=null&&E.layout.annotations.forEach(function(i){if(i.text!=null&&i.text[0]=="/"){e.cmd_src=i.text,e.cmd_idx=E.layout.annotations.indexOf(i),i.text="";let r=E.layout.margin;e.old_margin={...r},r.t!=null&&r.t>40&&(r.t=40),E.cmd=="/stocks/candle"&&(r.r-=50)}}),E.data.forEach(function(i){if(i.name!=null){const r=i.name.length;i.name=i.name+" ",i.hoverlabel={namelength:r}}});let T=((t=(l=E.layout)==null?void 0:l.title)==null?void 0:t.text)||"Interactive Chart";return e.title=T,{data:E,date:new Date,globals:e,cmd:E.command_location,posthog:E.posthog,python_version:E.python_version,pywry_version:E.pywry_version,terminal_version:E.terminal_version,title:T}})(P);if(D){D.posthog.collect_logs&&!J&&ce({api_host:"https://app.posthog.com",autocapture:{css_selector_allowlist:[".ph-capture"]},capture_pageview:!1,loaded:function(w){const s=(D==null?void 0:D.log_id)||"";s!=""&&s!="REPLACE_ME"&&w.identify(s),w.onFeatureFlags(function(){w.isFeatureEnabled("record-pywry",{send_event:!1})||w.stopSessionRecording(),w.isFeatureEnabled("collect-logs-pywry",{send_event:!1})?w.has_opted_out_capturing()&&w.opt_in_capturing():w.opt_out_capturing()})}});const E={INFO:{command:D.cmd,title:D.title,date:D.date,python_version:D.python_version,pywry_version:D.pywry_version,terminal_version:D.terminal_version}},e=br(g9,{json:D.data,date:D.date,cmd:D.cmd,title:D.title,globals:D.globals,info:E});return D.posthog.collect_logs&&J?br(qT,{apiKey:"phc_vhssDAMod5qIplznQ75Kdgz4aB1qPFmeVmfEOZ4hkRw",options:J,children:e}):e}else return br("div",{className:"absolute inset-0 flex items-center justify-center z-[100]",children:ni("svg",{className:"animate-spin h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[br("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),br("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]})})}z8.render(br(s_.StrictMode,{children:br(v9,{})}),document.getElementById("root"));