From 7366024fbf533b686b076ba6ff971f0166aa8339 Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Fri, 9 Jun 2023 18:34:39 -0400 Subject: [PATCH 1/2] fix tables `pd.to_numeric` --- frontend-components/tables/src/utils/utils.ts | 525 +++++++++--------- openbb_terminal/core/plots/table.html | 2 +- openbb_terminal/helper_funcs.py | 10 +- 3 files changed, 272 insertions(+), 265 deletions(-) diff --git a/frontend-components/tables/src/utils/utils.ts b/frontend-components/tables/src/utils/utils.ts index ce949cfbac22..114dc497b4ae 100644 --- a/frontend-components/tables/src/utils/utils.ts +++ b/frontend-components/tables/src/utils/utils.ts @@ -3,318 +3,321 @@ import domtoimage from "dom-to-image"; import { utils, writeFile } from "xlsx"; 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; + 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(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; + 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 || 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 || 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"); - } - - const 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 (let 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 => { - 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); - }); + 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) { - 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"); + } + 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 { - 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)(); + 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 { - 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); - } + 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; + const args = arguments; + clearTimeout(timeout); + timeout = setTimeout(() => func.apply(context, args), delay); + }; }; diff --git a/openbb_terminal/core/plots/table.html b/openbb_terminal/core/plots/table.html index 7bde603fbf5a..c4cbb5f6937d 100644 --- a/openbb_terminal/core/plots/table.html +++ b/openbb_terminal/core/plots/table.html @@ -289,7 +289,7 @@ `),l.push(` `),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(` +`;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||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<-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}){function n(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}`}const i=t.getPreFilteredRowModel().flatRows.map(c=>c.getValue(e.id)),o=i.every(c=>typeof c=="string"||c===null),a=i.every(c=>typeof c=="number"||w2.test(c)||c===null||c===""),s=i.some(c=>typeof c=="string"&&c.includes(" ")),l=e.getFilterValue();return i.every(c=>{const f=c==null?void 0:c.toString().replace(/[^0-9]/g,"").trim();return(f==null?void 0:f.length)>=4&&(Xd(e.id)||e.id.toLowerCase()==="index"&&!s)})?Se("div",{className:"flex gap-2 h-10",children:[K("input",{type:"datetime-local",value:n(l==null?void 0:l[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:n(l==null?void 0:l[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"})]}):a?Se("div",{className:"flex gap-0.5 h-10",children:[K("input",{type:"number",value:(l==null?void 0:l[0])??"",onChange:c=>e.setFilterValue(f=>[c.target.value,f==null?void 0:f[1]]),placeholder:"Min",className:"_input p-0.5"}),K("input",{type:"number",value:(l==null?void 0:l[1])??"",onChange:c=>e.setFilterValue(f=>[f==null?void 0:f[0],c.target.value]),placeholder:"Max",className:"_input p-0.5"})]}):o?K("div",{className:"h-10",children:K("input",{type:"text",value:l??"",onChange:c=>e.setFilterValue(c.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&&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){if(typeof fe=="number")return K("p",{children:fe});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;const 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||(x===0?0:"")}),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")); diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py index 38de7cc36ccc..5eb18c333a33 100644 --- a/openbb_terminal/helper_funcs.py +++ b/openbb_terminal/helper_funcs.py @@ -328,9 +328,13 @@ def print_rich_table( # eg) praw.models.reddit.subreddit.Subreddit for col in df.columns: try: - if not isinstance(df[col].iloc[0], pd.Timestamp): - pd.to_numeric(df[col].iloc[0]) - + if not any( + [ + isinstance(df[col].iloc[x], pd.Timestamp) + for x in range(min(10, len(df))) + ] + ): + df[col] = pd.to_numeric(df[col]) except (ValueError, TypeError): df[col] = df[col].astype(str) From 4ba86581fdc38672958a28e74028f9f4929e2a7e Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Sat, 10 Jun 2023 09:21:17 -0400 Subject: [PATCH 2/2] Update helper_funcs.py --- openbb_terminal/helper_funcs.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py index 5eb18c333a33..fca1c8818d21 100644 --- a/openbb_terminal/helper_funcs.py +++ b/openbb_terminal/helper_funcs.py @@ -329,10 +329,8 @@ def print_rich_table( for col in df.columns: try: if not any( - [ - isinstance(df[col].iloc[x], pd.Timestamp) - for x in range(min(10, len(df))) - ] + isinstance(df[col].iloc[x], pd.Timestamp) + for x in range(min(10, len(df))) ): df[col] = pd.to_numeric(df[col]) except (ValueError, TypeError):