@sheetxl/studio-mui 0.6.6 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/browser/cjs/{BnzLXJ_f-WnIEHA7.cjs → 0lIBM05Oo-mPaz-z.cjs} +1 -1
  2. package/browser/cjs/5JvwHMk_pfEj4cZH.cjs +42 -0
  3. package/browser/cjs/{BjuWRjBUgXPf4mv5.cjs → BOqCECEhgUXx-4kI.cjs} +2 -2
  4. package/browser/cjs/BaMk9jpFcmdBLRiR.cjs +6 -0
  5. package/browser/cjs/CCynZK017xahlNmi.cjs +18 -0
  6. package/browser/cjs/{CUT6hk38cssRLfxe.cjs → CG7Z-lZAq5czFOc4.cjs} +2 -2
  7. package/browser/cjs/CRAcvjlcqcZK3WEL.cjs +20 -0
  8. package/browser/cjs/{Ubpcm3GwuRfaaW1V.cjs → CtkBZTjdHqYp7xft.cjs} +1 -1
  9. package/browser/cjs/{BN2uLx4xGjk-OlUv.cjs → DmM-DjGh015RZXzh.cjs} +2 -2
  10. package/browser/cjs/{B6xMVH-gFKvv7HTm.cjs → U3YgQ0fN5bvp9-Kq.cjs} +2 -2
  11. package/browser/cjs/{DBqla_PwQUaZTKah.cjs → aiA3IvXgAikOrMwA.cjs} +1 -1
  12. package/browser/cjs/{L3kTnaogdAjKmBcL.cjs → dW-tltmR8b4Fnr8g.cjs} +1 -1
  13. package/browser/cjs/index.cjs +2 -2
  14. package/browser/esm/{BccWI_Pflx_rlXOP.mjs → BxFzIKTovnlqjZa-.mjs} +18 -18
  15. package/browser/esm/{Wo3zv3YCmz4f5NpR.mjs → C1aztXQ58ekuzis6.mjs} +1 -1
  16. package/browser/esm/{CGU0MsHi6xVOM3Wy.mjs → C9vgT92BfuOKSqpB.mjs} +1 -1
  17. package/browser/esm/{ChXhIK3n7tSPyfOU.mjs → COc-f5ehGeQiPNRP.mjs} +183 -183
  18. package/browser/esm/{D1Jl9RDW29udjLaD.mjs → Ck2WRaGuINSXU-Ds.mjs} +2 -2
  19. package/browser/esm/{5Ukv5-SQmOLwdH1V.mjs → DVbgcz-P2Z8D_yei.mjs} +2 -2
  20. package/browser/esm/{CrzQTch0GzxqX1Hh.mjs → Dcag5-NLJslhyfpE.mjs} +2 -2
  21. package/browser/esm/{BWwRv_4Vs3pIJHK-.mjs → DnJZFwOGICYRq_KW.mjs} +1 -1
  22. package/browser/esm/{CyT1_wFdlQtHv48w.mjs → EmQd5txQ_ErHLAeT.mjs} +2 -2
  23. package/browser/esm/MgTnV8wS66lhumxT.mjs +4482 -0
  24. package/browser/esm/{CTfL4NRMBZr5dUNM.mjs → _08whbc3oA7BY_S7.mjs} +1 -1
  25. package/browser/esm/{q95zwalhNRxfwm2I.mjs → he9qd0KA2ONjy_rM.mjs} +88 -88
  26. package/browser/esm/index.mjs +2 -2
  27. package/licenses/dependencies.txt +142 -142
  28. package/node/esm/{C4HcRU0pP7BegG2D.mjs → B5K3cjwd0usYef8w.mjs} +3 -3
  29. package/node/esm/{Dy5ZlGkkqU9eK4Mt.mjs → BAHfO9ALnEUni4Ts.mjs} +1 -1
  30. package/node/esm/{D8uH0zqPI1d50qsx.mjs → BfPfvgdZrUoZvEme.mjs} +1 -1
  31. package/node/esm/{BRsMzfYwnF3y7jL5.mjs → BqPC_rbjZN2Jy_y4.mjs} +1 -1
  32. package/node/esm/{DxhxmNkJB4A7DSHZ.mjs → CHNFCXGADLFVCwYo.mjs} +1 -1
  33. package/node/esm/{CADlYGKEEO7IDDe4.mjs → Cgxo3ZcSke1eBYVG.mjs} +1 -1
  34. package/node/esm/{Nxk8BN00peWJT0Pd.mjs → Ciwkv8DXp86zUjTb.mjs} +1 -1
  35. package/node/esm/{oP0NpP9IIAnwgsOY.mjs → DESr6vZQNH2lHWZ9.mjs} +1 -1
  36. package/node/esm/{CFBxXNyH40J__9j7.mjs → DhN2m_4WFHDBADx-.mjs} +1 -1
  37. package/node/esm/{C9HmzGWmGV2F1-iF.mjs → IID7UVIiXTHvqYHK.mjs} +1 -1
  38. package/node/esm/index.mjs +528 -485
  39. package/package.json +9 -9
  40. package/types/index.d.ts +3 -0
  41. package/browser/cjs/CtRt6b0Z9PqCHSYZ.cjs +0 -18
  42. package/browser/cjs/Dcrkgeqj3YntIuSp.cjs +0 -6
  43. package/browser/cjs/fFQ9XQWBeQc3axmM.cjs +0 -20
  44. package/browser/cjs/miraQ-Yi17yo4jmD.cjs +0 -42
  45. package/browser/esm/C1Z_BXflJEH0VdJS.mjs +0 -4439
@@ -1,4439 +0,0 @@
1
- import { Color as ft, IColor as Hr, ITheme as ps, CommonUtils as Ze, IBorder as Ce, IFont as Bt, NumberFormat as gt, IFontCollection as us, IStyle as pe, ITextFrame as ms, Table as or, IFill as kn, CoordUtils as gs, ISheet as Rt, LicenseManager as vo, Workbook as jn, TypesUtils as hs } from "@sheetxl/sdk";
2
- import { jsx as e, jsxs as z, Fragment as se } from "react/jsx-runtime";
3
- import le, { memo as K, forwardRef as J, useMemo as j, useCallback as G, isValidElement as nr, useState as U, useEffect as me, Suspense as ci, useRef as we, createElement as Pe, useReducer as rr, useImperativeHandle as fs, version as bs, useLayoutEffect as St, Component as di, createContext as xs, useContext as ys, cloneElement as ws } from "react";
4
- import { Box as A, Typography as Oe, IconButton as dt, MenuItem as pi, Divider as lo, Button as nn, SvgIcon as ar, Input as ir, FormControlLabel as Et, Checkbox as Dt, useMediaQuery as Ss, FormControl as lr, TextField as ui, InputAdornment as vs, Slider as Cs, Paper as Po, CircularProgress as ks, DialogTitle as Ts, Select as Es, Tabs as Ds, Tab as Ps, Card as Rs, CardActions as Ms, Collapse as Is, CssBaseline as Ns } from "@mui/material";
5
- import { themeIcon as P, CommandButton as F, ExhibitDivider as re, FormatIndentDecreaseIcon as Fs, FormatIndentIncreaseIcon as Os, defaultCreatePopupPanel as Se, CommandPopupButton as Re, TextVerticalTopIcon as As, TextVerticalCenterIcon as Bs, TextVerticalBottomIcon as zr, TextHorizontalOverflowIcon as Wr, TextHorizontalWrapIcon as Ls, TextHorizontalClipIcon as Hs, TextHorizontalShrinkIcon as zs, TextRotation315Icon as zo, TextRotation45Icon as jr, TextRotation90Icon as Vr, TextRotation2702Icon as $r, TextRotationCustomIcon as _r, TextRotation0Icon as Ws, InputCommandButton as js, SimpleTooltip as At, LoadingPanel as Lt, PopupButtonType as nt, ExhibitPopupIconButton as vt, ExhibitPopupMenuItem as sr, ColorizedCircleIcon as Vs, ExhibitMenuItem as pt, createStrokeShadowFilter as Ur, strokeShadowFilter as $s, ColorizedStrokeIcon as cr, ExhibitTooltip as rt, ExhibitIconButton as bt, CommandTooltip as dr, MergeAllIcon as Gr, MergeHorizontalIcon as _s, MergeVerticalIcon as Us, MergeUnMergeIcon as mi, FreezeBothIcon as Gs, FreezeRowsIcon as qs, FreezeColumnsIcon as Xs, FreezeIcon as Ks, FindIcon as qr, FindReplaceIcon as Ys, GotoIcon as Zs, TextSizeIncreaseIcon as Js, TextSizeDecreaseIcon as Qs, SelectedIcon as sn, CurrencyDollarIcon as ec, PercentIcon as tc, CommaIcon as oc, IncreaseDecimalIcon2 as nc, DecreaseDecimalIcon2 as rc, ClearAllIcon as Xr, ClearFormatsIcon as gi, ClearContentsIcon as ac, FillDownIcon as so, InsertCells as Kr, InsertRowIcon as ic, InsertColumn2Icon as Yr, BlankIcon as rn, RemoveCellsIcon as Zr, RemoveRowIcon as lc, RemoveColumn2Icon as Jr, LabelIcon as eo, SortIncreaseIcon as Vn, SortDecreaseIcon as hi, SortCustomIcon as sc, FilterToggleIcon as $n, FilterClearIcon as pr, FilterReapplyIcon as fi, RedoIcon as cc, UndoIcon as dc, TextStrikeIcon as Qr, TextSuperscriptIcon as pc, TextSubscriptIcon as uc, TextUnderlineIcon as Tn, TextUnderlineDoubleIcon as ea, TextUnderlineAccountingIcon as ta, TextUnderlineAccountingDoubleIcon as oa, PasteIcon as na, PasteValuesIcon as mc, PasteFormatsIcon as gc, PasteFormulasIcon as hc, PasteTransposeIcon as fc, PasteLinksIcon as bc, NewPresetStylesIcon as xc, PresetStylesIcon as Ro, ExhibitMenuHeader as to, ContextMenu as bi, Theme2Icon as xi, SystemDefaultDarkMode as yc, SystemDefaultLightMode as wc, GithubIcon as Sc, DiscordIcon as vc, DocumentationIcon as yi, TicketIcon as Cc, HelpIcon as kc, InsertImageIcon as Wo, WalkingCopyIcon as Tc, SimpleCommandPopupButton as ct, FunctionThinIcon as Ec, FunctionSumIcon as Dc, FormulaGroupIcon as Pc, FormulaFinancialIcon as Rc, FormulaLogicalIcon as Mc, FormulaTextIcon as Ic, FormulaDateTimeIcon as Nc, FormulaLookupReferenceIcon as Fc, FormulaMathTrigIcon as Oc, FormulaStatisticalIcon as Ac, FormulaEngineeringIcon as Bc, FormulaInformationIcon as Lc, FormulaCubeIcon as Hc, FormulaDatabaseIcon as zc, FormulaWebIcon as Wc, FormulaCustomIcon as jc, ExhibitOptionButton as Vc, SelectRangeModeIcon as $c, hexToRGB as ra, useFloatStack as oo, CellSelectionIcon as _c, CellSelectionRemoveIcon as Uc, CellSelectionEditIcon as Gc, InsertTableIcon as an, CellSelectionInsertIcon as qc, CloseErrorIcon as Xc, CheckSuccessIcon as Kc, FunctionIcon as Yc, VisibilityOffIcon as wi, elevateColor as it, ThemedIcon as Zc, ScriptNewIcon as Jc, ScriptFormulaIcon as Si, ScriptMacroIcon as ur, ScriptSaveIcon as Qc, CommandToolbar as cn, CodeIcon as ed, ScriptRunIcon as td, ColorizedTextIcon as od, ColorizedFillIcon as nd, FormatPaintIcon as rd, TextBoldIcon as ad, TextItalicIcon as id, InsertHyperlinkIcon as _n, InsertCommentIcon as Un, FullScreenOffIcon as ld, FullScreenIcon as sd, createScrollEdgeButton as cd, createScrollEndButton as dd, createScrollStartButton as pd, HideColumnIcon as ud, ShowColumnIcon as md, HideRowIcon as gd, ShowRowIcon as hd, ColumnsResizeAutoIcon as fd, RowsResizeAutoIcon as bd, CutIcon as xd, DrawAspectIcon as aa, DrawAlignLeftIcon as ia, DrawResizeIcon as la, DrawAlignDistributeVertIcon as yd, DrawAlignDistributeHorzIcon as wd, DrawAlignBottomIcon as Sd, DrawAlignMiddleIcon as vd, DrawAlignTopIcon as Cd, DrawAlignRightIcon as kd, DrawAlignCenterIcon as Td, DrawMoveBackwardIcon as Ed, DrawToBackIcon as Dd, DrawMoveForwardIcon as Pd, DrawToFrontIcon as Rd, scrollbarTheming as Md, StackTrace as Id, FileNewIcon as Nd, FileOpenIcon as Fd, FileDownloadAsCSVIcon as Od, FileDownloadAsExcelIcon as Ad, FileDownloadAsSheetIcon as Bd, useResolvedThemeMode as vi, ThemeMode as Gn, useModal as Ld, useLazyWindow as Hd, useOptionsDialog as zd, useInputDialog as Wd, AnimatedTraversingEllipsisIcon as jd, ErrorPanel as Vd, createExhibitTheme as sa, ModalProvider as $d, ErrorAlertIcon as _d } from "@sheetxl/utils-mui";
6
- import { FormatAlignLeft as ca, FormatAlignCenter as da, FormatAlignRight as Ud, FormatAlignJustify as To, Colorize as Gd, DarkMode as pa, LightMode as ua, Keyboard as qd, Remove as Xd, Add as Kd, ExpandLess as Yd, ExpandMore as Ci, Lock as dn, MoreHoriz as Zd, WebhookOutlined as ki, Close as Ti, AddCircleOutline as Jd, Menu as Qd, CancelOutlined as ep } from "@mui/icons-material";
7
- import { useCommands as He, CommandButtonType as ie, useCallbackRef as ee, ReactUtils as pn, KeyCodes as be, useCommand as Ht, useEditMode as un, useMouseDownAndHoldListener as ma, NotificationType as wt, useImperativeElement as zt, SplitPane as qn, RoundedTab as tp, SimpleCommand as Ge, Command as ye, KeyModifiers as ke, CommandGroup as mr, ToolTipPlacement as co, ScrollPane as op, useUndoManager as np } from "@sheetxl/utils-react";
8
- import { useTheme as at, alpha as he, getOverlayAlpha as De, ThemeProvider as Ei } from "@mui/material/styles";
9
- import { StyledStrokePath as rp, StaticBorderRenderer as gr, FontUtils as ap, useModelListener as _e, createCellEditStateFromCell as ip, SheetCellEditor as lp, ScriptEditor as sp, useDocThemes as hr, TabStrip as cp, SheetElement as dp, SheetScrollbar as ga, PictureEditor as pp, ChartEditor as up, EmptyFrame as mp, LogoNoPaddingIcon as gp } from "@sheetxl/react";
10
- import { alpha as Qe } from "@mui/system";
11
- import Kt, { createPortal as hp } from "react-dom";
12
- import { CommonUtils as Jt, ChainedError as Xn, PartialError as fp, UndoManager as bp } from "@sheetxl/utils";
13
- import { IOUtils as Yt } from "@sheetxl/io";
14
- /**
15
- * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.6.6
16
- *
17
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
18
- * License: The license can be found at https://www.sheetxl.com/license.
19
- */
20
- function Di(r) {
21
- var i, o, t = "";
22
- if (typeof r == "string" || typeof r == "number") t += r;
23
- else if (typeof r == "object") if (Array.isArray(r)) {
24
- var n = r.length;
25
- for (i = 0; i < n; i++) r[i] && (o = Di(r[i])) && (t && (t += " "), t += o);
26
- } else for (o in r) r[o] && (t && (t += " "), t += o);
27
- return t;
28
- }
29
- function Ae() {
30
- for (var r, i, o = 0, t = "", n = arguments.length; o < n; o++) (r = arguments[o]) && (i = Di(r)) && (t && (t += " "), t += i);
31
- return t;
32
- }
33
- const xp = K(J((r, i) => {
34
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, parentFloat: c, ...m } = r, a = He(o, ["formatAlignLeftToggle", "formatAlignCenterToggle", "formatAlignRightToggle", "formatAlignJustifyToggle", "formatAlignCenterContinuousToggle", "formatAlignFillToggle", "formatAlignDistributedHorizontalToggle"]), s = j(() => {
35
- for (let p = 0; p < a.length; p++) if (a[p]?.state()) return a[p].key();
36
- return a[0]?.key();
37
- }, [a]), u = j(() => {
38
- const p = /* @__PURE__ */ new Map();
39
- return p.set("formatAlignLeftToggle", P(e(ca, {}))), p.set("formatAlignCenterToggle", P(e(da, {}))), p.set("formatAlignRightToggle", P(e(Ud, {}))), p.set("formatAlignJustifyToggle", P(e(To, {}))), p.set("formatAlignCenterContinuousToggle", P(e(da, {}))), p.set("formatAlignFillToggle", P(e(To, {}))), p.set("formatAlignDistributedHorizontalToggle", P(e(To, {}))), p;
40
- }, []), d = j(() => {
41
- if (!t) return null;
42
- const p = { ...t };
43
- return delete p.beforeExecute, p;
44
- }, [t]), f = G((p, g) => {
45
- const y = { variant: ie.Menuitem, commandHook: t, scope: n, disabled: l }, x = z(se, { children: [e(F, { ...y, command: g.getCommand("formatAlignLeftToggle"), icon: u.get("formatAlignLeftToggle") }), e(F, { ...y, command: g.getCommand("formatAlignCenterToggle"), icon: u.get("formatAlignCenterToggle") }), e(F, { ...y, command: g.getCommand("formatAlignRightToggle"), icon: u.get("formatAlignRightToggle") }), e(F, { ...y, command: g.getCommand("formatAlignJustifyToggle"), icon: u.get("formatAlignJustifyToggle") }), e(re, { orientation: "horizontal" }), e(F, { ...y, command: g.getCommand("formatAlignCenterContinuousToggle"), icon: u.get("formatAlignCenterContinuousToggle") }), e(F, { ...y, command: g.getCommand("formatAlignFillToggle"), icon: u.get("formatAlignFillToggle") }), e(F, { ...y, command: g.getCommand("formatAlignDistributedHorizontalToggle"), icon: u.get("formatAlignDistributedHorizontalToggle") })] }), b = z(A, { sx: { className: Ae("quick-buttons"), display: "flex", alignItems: "center", justifyContent: "center" }, onClick: (w) => w.stopPropagation(), children: [e(F, { command: g.getCommand("formatIndentDecrease"), commandHook: d, scope: n, disabled: l, icon: P(e(Fs, {})) }), e(F, { command: g.getCommand("formatIndentIncrease"), commandHook: d, scope: n, disabled: l, icon: P(e(Os, {})) })] }), h = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, ...m, children: [b, e(re, { orientation: "horizontal" }), e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: x })] });
46
- return Se({ ...p, children: h });
47
- }, [l, t]);
48
- return e(Re, { ref: i, parentFloat: c, commands: o, commandHook: t, scope: n, createPopupPanel: f, label: "Horizontal Alignment", tooltip: "Configure how text is placed in the horizontal direction of the cell.", quickCommand: s, icon: u.get(s) ?? e(ca, {}), ...m });
49
- })), yp = K(J((r, i) => {
50
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = He(o, ["formatAlignTopToggle", "formatAlignMiddleToggle", "formatAlignBottomToggle", "formatAlignJustifyVerticalToggle", "formatAlignDistributedVerticalToggle"]), a = j(() => {
51
- for (let d = 0; d < m.length; d++) if (m[d]?.state()) return m[d].key();
52
- return m[0]?.key();
53
- }, [m]), s = j(() => {
54
- const d = /* @__PURE__ */ new Map();
55
- return d.set("formatAlignTopToggle", P(e(As, {}))), d.set("formatAlignMiddleToggle", P(e(Bs, {}))), d.set("formatAlignBottomToggle", P(e(zr, {}))), d.set("formatAlignJustifyVerticalToggle", P(e(To, {}))), d.set("formatAlignDistributedVerticalToggle", P(e(To, {}))), d;
56
- }, []), u = G((d, f) => {
57
- const p = { variant: ie.Menuitem, commandHook: t, scope: n, disabled: l }, g = z(se, { children: [e(F, { ...p, command: f.getCommand("formatAlignTopToggle"), icon: s.get("formatAlignTopToggle") }), e(F, { ...p, command: f.getCommand("formatAlignMiddleToggle"), icon: s.get("formatAlignMiddleToggle") }), e(F, { ...p, command: f.getCommand("formatAlignBottomToggle"), icon: s.get("formatAlignBottomToggle") }), e(re, { orientation: "horizontal" }), e(F, { ...p, command: f.getCommand("formatAlignJustifyVerticalToggle"), icon: s.get("formatAlignJustifyVerticalToggle") }), e(F, { ...p, command: f.getCommand("formatAlignDistributedVerticalToggle"), icon: s.get("formatAlignDistributedVerticalToggle") })] });
58
- return Se({ ...d, children: g });
59
- }, [l, t, s]);
60
- return e(Re, { ref: i, commands: o, commandHook: t, createPopupPanel: u, label: "Vertical Alignment", tooltip: "Configure how text is placed in the vertical direction of the cell.", icon: s.get(a) ?? P(e(zr, {})), ...c });
61
- })), wp = K(J((r, i) => {
62
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = He(o, ["formatTextOverflowVisibleToggle", "formatTextOverflowWrapToggle", "formatTextOverflowClipToggle", "formatTextOverflowShrinkToggle"]), a = j(() => {
63
- for (let d = 0; d < m.length; d++) if (m[d]?.state()) return m[d].key();
64
- return m[0]?.key();
65
- }, [m]), s = j(() => {
66
- const d = /* @__PURE__ */ new Map();
67
- return d.set("formatTextOverflowVisibleToggle", P(e(Wr, {}))), d.set("formatTextOverflowWrapToggle", P(e(Ls, {}))), d.set("formatTextOverflowClipToggle", P(e(Hs, {}))), d.set("formatTextOverflowShrinkToggle", P(e(zs, {}))), d;
68
- }, []), u = ee((d, f) => {
69
- const p = { variant: ie.Menuitem, commandHook: t, scope: n, disabled: l }, g = z(se, { children: [e(F, { ...p, command: f.getCommand("formatTextOverflowVisibleToggle"), icon: s.get("formatTextOverflowVisibleToggle") }), e(F, { ...p, command: f.getCommand("formatTextOverflowWrapToggle"), icon: s.get("formatTextOverflowWrapToggle") }), e(F, { ...p, command: f.getCommand("formatTextOverflowClipToggle"), icon: s.get("formatTextOverflowClipToggle") }), e(re, { orientation: "horizontal" }), e(F, { ...p, command: f.getCommand("formatTextOverflowShrinkToggle"), icon: s.get("formatTextOverflowShrinkToggle") })] });
70
- return Se({ ...d, children: g });
71
- }, [l, t, n]);
72
- return e(Re, { ref: i, commands: o, commandHook: t, scope: n, label: "Text Overflow", tooltip: "Configure how text behaves when it doesn't fit within a cell.", createPopupPanel: u, icon: s.get(a) ?? P(e(Wr, {})), ...c });
73
- })), Sp = K(J((r, i) => {
74
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = He(o, ["formatTextRotate0", "formatTextRotate315", "formatTextRotate45", "formatTextRotate90", "formatTextRotate270", "formatSubscriptToggle", "formatTextRotateCustom"]), a = j(() => {
75
- const f = m.length;
76
- for (let p = 0; p < f; p++) {
77
- const g = m[p];
78
- if (g?.state()) return g.key();
79
- }
80
- return m[1]?.key();
81
- }, [m]), s = j(() => {
82
- const f = /* @__PURE__ */ new Map();
83
- return f.set("formatTextRotate0", P(e(zo, {}))), f.set("formatTextRotate315", P(e(zo, {}))), f.set("formatTextRotate45", P(e(jr, {}))), f.set("formatTextRotate90", P(e(Vr, {}))), f.set("formatTextRotate270", P(e($r, {}))), f.set("formatTextRotateCustom", P(e(_r, {}))), f;
84
- }, []), u = G((f, p) => {
85
- const g = { variant: ie.Menuitem, commandHook: t, scope: n, disabled: l }, y = z(se, { children: [e(F, { ...g, command: p.getCommand("formatTextRotate0"), icon: P(e(Ws, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...g, command: p.getCommand("formatTextRotate315"), icon: P(e(zo, {})) }), e(F, { ...g, command: p.getCommand("formatTextRotate45"), icon: P(e(jr, {})) }), e(F, { ...g, command: p.getCommand("formatTextRotate90"), icon: P(e(Vr, {})) }), e(F, { ...g, command: p.getCommand("formatTextRotate270"), icon: P(e($r, {})) }), e(re, { orientation: "horizontal" }), e(js, { ...g, command: p.getCommand("formatTextRotateCustom"), icon: P(e(_r, {})), label: "Custom" })] });
86
- return Se({ ...f, children: y });
87
- }, [l, t, n, o]), d = j(() => (o.getCommand("formatTextRotateCustom")?.state() ?? 0) !== 0, [m]);
88
- return e(Re, { ref: i, commands: o, commandHook: t, scope: n, selected: d, label: "Text Orientation", tooltip: "Rotate your text diagonally or vertically. This is a great way to label narrow columns.", createPopupPanel: u, quickCommand: d ? "formatTextRotate0" : "formatTextRotate315", icon: P(s.get(a) ?? e(zo, {})), ...c });
89
- })), vp = { Preset: "preset", Custom: "custom" }, Eo = { Start: "start", End: "end" }, En = {}, Cp = (r, i, o, t) => {
90
- const n = r + "-" + i + "-" + o + (t ? "-server" : "");
91
- if (En[n]) return En[n];
92
- const l = ((c, m, a, s) => {
93
- if (typeof document > "u" && !s) return null;
94
- const u = s ? new s() : document.createElement("canvas");
95
- u.width = 2 * a, u.height = 2 * a;
96
- const d = u.getContext("2d");
97
- return d ? (d.fillStyle = c, d.fillRect(0, 0, u.width, u.height), d.fillStyle = m, d.fillRect(0, 0, a, a), d.translate(a, a), d.fillRect(0, 0, a, a), u.toDataURL()) : null;
98
- })(r, i, o, t);
99
- return En[n] = l, l;
100
- }, kp = {}, Tp = K((r) => {
101
- const { className: i, style: o = pn.EmptyCssProperties, white: t = "transparent", grey: n = "grey", size: l = 8, borderRadius: c, boxShadow: m, renderers: a = kp, children: s, ...u } = r, d = s, f = j(() => Object.assign({ borderRadius: c, boxShadow: m, position: "absolute", top: "0px", left: "0px", width: "100%", height: "100%", background: `url(${Cp(t, n, l, a?.canvas)}) center left` }, o), [t, n, l, a]);
102
- return nr(s) ? le.cloneElement(s, { ...d.props }) : e("div", { style: f, ...u });
103
- }), Ep = K((r) => {
104
- const { selectedColor: i, onSelectColor: o, onPreviewColor: t, onClick: n, onKeyDown: l, onMouseOver: c, onMouseLeave: m, onFocus: a, style: s = pn.EmptyCssProperties, children: u, alphaWhite: d, alphaGrey: f, darkMode: p, alphaCheckSize: g = 7, ...y } = r;
105
- if (!i) throw new Error("a selectedColor is required");
106
- const x = G((k) => {
107
- n?.(k), k.isDefaultPrevented() || (k.ctrlKey ? t?.(i.toRGBA()) : o?.(i.toRGBA()));
108
- }, [o, t, n, i]), b = G((k) => {
109
- c?.(k), k.isDefaultPrevented() || t?.(i.toRGBA());
110
- }, [t, c, i]), h = G((k) => {
111
- m?.(k), k.isDefaultPrevented();
112
- }, [t, m]), w = G((k) => {
113
- a?.(k), k.isDefaultPrevented() || t?.(i.toRGBA());
114
- }, [t, a, i]), v = G((k) => {
115
- l?.(k), k.isDefaultPrevented() || k.keyCode === be.Enter && o?.(i.toRGBA());
116
- }, [o, l, i]), C = j(() => i.toRGBA().alpha === 1 ? null : e(Tp, { size: g, white: d, grey: f, style: { position: "absolute", width: "calc(100% - 1.5px)", height: "calc(100% - 1.5px)", top: "0.75px", left: "0.75px" } }), [d, f, i]);
117
- return z("div", { style: { position: "absolute", height: "100%", width: "100%", top: "0px", left: "0px", cursor: "pointer", outline: "none", ...s }, tabIndex: 0, ...y, onClick: x, onKeyDown: v, onMouseOver: b, onMouseLeave: h, onFocus: w, children: [C, e("div", { style: { position: "absolute", top: "0px", left: "0px", height: "100%", width: "100%", background: i.toCSS(p) }, children: u })] });
118
- }), fr = K((r) => {
119
- const { schemeColorLookup: i, selectedColor: o, previewColor: t, colorDef: n, onSelectColorDef: l, onPreviewColorDef: c, swatchProps: m, defaultButtonSize: a = 24, isLarge: s = !1, compareRGB: u = !1, darkMode: d = !1, ...f } = r, p = new ft({ val: n.definition.val, adjs: n.definition.adjs }, (C) => i(C)), g = u ? p.toRGBA().toString() : p.toString(), y = o && (u ? o.toRGBA().toString() : o.toString()) === g, x = t && (u ? t.toRGBA().toString() : t.toString()) === g, b = [];
120
- b.push({ [Hr.AdjustmentType.Inv]: !0 }), b.push({ [Hr.AdjustmentType.Alpha]: 100 });
121
- const h = p.adjust(b), w = G(() => {
122
- l?.(n);
123
- }, [l, n]), v = G((C) => {
124
- c?.(C ? n : null);
125
- }, [c, n]);
126
- return e(At, { disableInteractive: !0, PopperProps: { style: { pointerEvents: "none" }, disablePortal: !0, popperOptions: { strategy: "fixed", modifiers: [{ name: "preventOverflow", enabled: !0, options: { boundariesElement: "viewport" } }] } }, title: n.description, placement: "bottom-start", children: e("div", { style: { width: a * (s ? 1.2 : 1) + "px", height: a * (s ? 1.2 : 1) + "px", position: "relative", boxSizing: "border-box", cursor: "pointer", outline: "none" }, ...f, children: z(Ep, { selectedColor: p, title: null, onSelectColor: w, onPreviewColor: v, alphaCheckSize: s ? 9 : void 0, darkMode: d, ...m, children: [e("div", { style: { position: "absolute", width: "100%", height: "100%", top: "0px", left: "0px", pointerEvents: "none", borderColor: h.toRGBA(d).toString(), borderWidth: "2px", borderStyle: "solid", boxSizing: "border-box", opacity: y ? "1" : "0" } }), e("div", { style: { position: "absolute", width: 0.33 * a * (s ? 1.2 : 1) + "px", height: 0.33 * a * (s ? 1.2 : 1) + "px", left: "calc(50% - 0.5px)", top: "calc(50% - 0.5px)", transform: "translate(-50%,-50%)", pointerEvents: "none", background: h.toRGBA(d).toString(), borderRadius: "50%", opacity: x ? "1" : "0" } })] }) }) });
127
- }), jo = K((r) => {
128
- const { title: i, schemeColorLookup: o, colorDefs: t, selectedColor: n, previewColor: l, onSelectColorDef: c, onPreviewColorDef: m, style: a = pn.EmptyCssProperties, compareRGB: s = !1, darkMode: u, swatchProps: d, ...f } = r;
129
- let p;
130
- if (Array.isArray(t[0])) p = t;
131
- else {
132
- p = [];
133
- for (let h = 0; h < t.length; h++) p.push([t[h]]);
134
- }
135
- const g = G((h) => {
136
- c?.(h);
137
- }, [c]), y = G((h) => {
138
- m?.(h);
139
- }, [m]), x = j(() => {
140
- let h = [];
141
- for (let w = 0; w < p.length; w++) {
142
- let v = [], C = p[w];
143
- for (let T = 0; T < C.length; T++) {
144
- let M = C[T];
145
- v.push(e(fr, { schemeColorLookup: o, colorDef: M, selectedColor: n, previewColor: l, onSelectColorDef: g, onPreviewColorDef: y, swatchProps: d, compareRGB: s, darkMode: u }, w + " " + T));
146
- }
147
- let k = e(A, { className: "button-col", sx: { display: "flex", flexDirection: "column", justifyContent: "space-between", boxShadow: (T) => T.shadows[2], borderRadius: "2px", overflow: "hidden" }, children: v }, "" + w);
148
- h.push(k);
149
- }
150
- return h;
151
- }, [p, n, l, g, y]), b = j(() => i ? e(Oe, { noWrap: !0, component: "div", sx: { display: "flex", flexShrink: "0", paddingLeft: "6px", paddingBottom: "4px", paddingTop: "0px", userSelect: "none", color: (h) => h.palette.text.secondary }, children: i }) : null, [i]);
152
- return z(A, { style: { ...a }, children: [b, e(A, { sx: { display: "flex", flexDirection: "row", gap: "6px", marginBottom: "14px", flexWrap: "wrap", justifyContent: "flex-start" }, ...f, children: x })] });
153
- }), ot = (r, i) => ({ description: r, definition: { val: i, adjs: [] } }), ze = (r, i, o, t, n, l) => {
154
- const c = ot(r, i);
155
- t?.push(c);
156
- const m = new ft({ val: c.definition.val, adjs: c.definition.adjs }, o), a = m.toString();
157
- n?.set(a, m);
158
- const s = m.toRGBA().toString();
159
- l?.set(s, m);
160
- }, Dp = le.lazy(() => import("./ChXhIK3n7tSPyfOU.mjs")), Pp = K(J((r, i) => {
161
- const { selectedColor: o = null, previewColor: t = r.selectedColor ?? null, recentColors: n, schemeLookup: l, disableAlpha: c = !1, previewDebounceTime: m = 100, initialPanelType: a, defaultButtonSize: s = 24, width: u, onElementLoad: d, onDone: f, onEyeDropStart: p, onEyeDropStop: g, onPreviewColor: y, onPreviewColorImmediate: x, onSelectColor: b, autoColor: h, autoColorLabel: w = "Automatic", autoColorPosition: v = Eo.Start, compareRGB: C = !1, darkMode: k = !1, ...T } = r, M = t || o, N = ee(y, [y]), B = ee(x, [x]), R = ee(b, [b]), S = ee(p, [p]), I = ee(g, [g]), [L, O] = U(!1), $ = at(), D = j(() => l || ft.getDefaultSchemeLookup(), [l]), E = j(() => {
162
- const H = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map(), Te = [];
163
- ze("Primary Background", "bg1", D, Te, H, oe), ze("Primary Text", "tx1", D, Te, H, oe), ze("Secondary Background", "bg2", D, Te, H, oe), ze("Secondary Text", "tx2", D, Te, H, oe), ze("Accent 1", "accent1", D, Te, H, oe), ze("Accent 2", "accent2", D, Te, H, oe), ze("Accent 3", "accent3", D, Te, H, oe), ze("Accent 4", "accent4", D, Te, H, oe), ze("Accent 5", "accent5", D, Te, H, oe), ze("Accent 6", "accent6", D, Te, H, oe);
164
- const ge = ps.buildPalette(Te, D, H, oe), fe = [];
165
- if (ze("Dark Red", "C00000", D, fe, H, oe), ze("Red", "FF0000", D, fe, H, oe), ze("Orange", "FFC000", D, fe, H, oe), ze("Yellow", "FFFF00", D, fe, H, oe), ze("Light Green", "92D050", D, fe, H, oe), ze("Green", "00B050", D, fe, H, oe), ze("Light Blue", "00B0F0", D, fe, H, oe), ze("Blue", "0070C0", D, fe, H, oe), ze("Dark Blue", "002060", D, fe, H, oe), c ? ze("Purple Is A Fruit", "7030A0", D, fe, H, oe) : ze("Transparent", "00000000", D, fe, H, oe), h) {
166
- const xe = h.toString();
167
- H.set(xe, h);
168
- }
169
- const te = /* @__PURE__ */ new Map(), ce = typeof n == "function" ? n() : n, Me = [];
170
- for (let xe = 0; ce && xe < ce.length; xe++) {
171
- const qe = ce[xe].toString();
172
- te.set(qe, ce[xe]), Me.push({ description: "Recent " + (xe + 1), definition: { val: ce[xe].toString() } });
173
- }
174
- return { primaryColors: Te, modifiedPresets: ge, standardColors: fe, recentColorsLimited: Me, mapAllPresets: H, mapAllPresetsRGB: oe, mapRecent: te };
175
- }, [D, n, c, h]);
176
- me(() => {
177
- d?.();
178
- }, []);
179
- const [Y, Z] = U(!1), X = G(() => {
180
- Z((H) => !H);
181
- }, []);
182
- me(() => {
183
- if (a) Z(a === vp.Custom);
184
- else if (o) {
185
- let H = o.toString(), oe = E.mapAllPresets.get(H);
186
- oe || (H = o.toRGBA().toString(), oe = E.mapAllPresetsRGB.get(H));
187
- const Te = E.mapRecent.get(H);
188
- Z(!oe && !Te);
189
- }
190
- }, [o, a]);
191
- const _ = G(Ze.debounce((H) => {
192
- N?.(H);
193
- }, m), [N, m]), [ne, ae] = U();
194
- me(() => {
195
- ae(t || o);
196
- }, [t, o]);
197
- const q = ee((H) => {
198
- B && (B(H), _(H));
199
- }, [B]), W = ee((H) => {
200
- q(H ? new ft({ val: H.definition.val, adjs: H.definition.adjs }, D) : null);
201
- }, [D]), Q = G((H) => {
202
- H.ctrlKey && Z(!0);
203
- }, []), ue = ee((H) => {
204
- let oe = !1;
205
- if (H) {
206
- const Te = H.toString();
207
- oe = !E.mapAllPresets.has(Te);
208
- }
209
- R?.(H, oe);
210
- }, [R, E]), Le = ee((H) => {
211
- const oe = H ? new ft({ val: H.definition.val, adjs: H.definition.adjs }, D) : null;
212
- Promise.resolve(f?.()).then(() => {
213
- ue(oe);
214
- });
215
- }, [D, f]), Fe = ee((H) => {
216
- q(H ? new ft(H, D) : null);
217
- }, [D]), Be = j(() => window.EyeDropper === void 0 ? e(se, {}) : e(dt, { "aria-label": "eye dropper", size: "small", sx: { color: (H) => H.palette.text.icon ?? H.palette.action.active }, onClick: async () => {
218
- O(!0), S?.(), await new EyeDropper().open().then((H) => {
219
- O(!1), I?.();
220
- let oe = new ft(H.sRGBHex), Te = oe.toString(), ge = E.mapAllPresets.get(Te);
221
- if (ge || (Te = oe.toRGBA().toString(), ge = E.mapAllPresetsRGB.get(Te)), !ge) {
222
- const fe = oe.toRGBA(), te = 3;
223
- let ce = 255;
224
- E.mapAllPresetsRGB.forEach((Me, xe) => {
225
- const qe = Me.toRGBA(), et = Math.abs(qe.red - fe.red) + Math.abs(qe.blue - fe.blue) + Math.abs(qe.green - fe.green);
226
- et < te && et < ce && (ge = Me);
227
- });
228
- }
229
- Z(!ge), q(ge || oe);
230
- }).catch((H) => {
231
- O(!1), H?.name !== "AbortError" && console.error(H);
232
- });
233
- }, children: e(Gd, {}) }), [E, k]), Ye = j(() => {
234
- if (!Y) return;
235
- const H = { opacity: Y ? 1 : "0", position: "absolute", top: "0px", left: "0px", width: "100%", height: "100%", boxSizing: "border-box" };
236
- return e(ci, { fallback: e("div", { style: H, children: e(Lt, {}) }), children: e(Dp, { style: H, selectedColor: M ? M.toRGBA().toString() : "transparent", onColorChange: Fe, disableAlpha: c }) });
237
- }, [Y, M]), ve = j(() => ({ onClick: Q, alphaGrey: $.palette.text.icon ?? $.palette.action.active }), [Q, $]), je = j(() => {
238
- if (!h) return null;
239
- const H = { description: w, definition: { val: h.getVal(), adjs: h.getAdjustments() } };
240
- return e(se, { children: z(pi, { sx: { display: "flex", color: (oe) => oe.palette.text.secondary }, onMouseOver: () => {
241
- W(null);
242
- }, onClick: () => {
243
- Le(null);
244
- }, children: [e(A, { sx: { flex: "none", boxShadow: (oe) => oe.shadows[2], borderRadius: (oe) => oe.spacing(0.5), overflow: "hidden" }, children: e(fr, { schemeColorLookup: D, colorDef: H, selectedColor: o === null ? h : o, previewColor: t === null ? h : t, defaultButtonSize: s, isLarge: !0, darkMode: k, compareRGB: C, swatchProps: ve }) }), e(Oe, { noWrap: !0, component: "div", style: { display: "flex", flex: "1 1 100%", marginLeft: "8px", userSelect: "none" }, children: w })] }) });
245
- }, [h, w, D, o, t]);
246
- return z(A, { ref: i, sx: { width: u, outline: "none", padding: "10px 10px", overflow: "hidden", boxSizing: "content-box" }, ...T, children: [z("div", { style: { position: "relative", display: "flex" }, children: [z("div", { style: { opacity: Y ? "0" : 1 }, children: [je && v === Eo.Start ? z(se, { children: [je, e(lo, { light: !0, style: { marginTop: "2px", marginBottom: "10px" } })] }) : null, e(jo, { title: "Theme Colors", schemeColorLookup: D, colorDefs: E.primaryColors, selectedColor: o, previewColor: t === void 0 ? o : t, swatchProps: ve, onPreviewColorDef: W, onSelectColorDef: Le, compareRGB: C, darkMode: k }), e(jo, { schemeColorLookup: D, colorDefs: E.modifiedPresets, selectedColor: o, previewColor: t === void 0 ? o : t, swatchProps: ve, onPreviewColorDef: W, onSelectColorDef: Le, compareRGB: C, darkMode: k }), e(lo, { light: !0, style: { marginBottom: "10px" } }), e(jo, { title: "Standard Colors", schemeColorLookup: D, colorDefs: E.standardColors, selectedColor: o, previewColor: t === void 0 ? o : t, swatchProps: ve, onPreviewColorDef: W, onSelectColorDef: Le, compareRGB: C, darkMode: k }), z("div", { style: { opacity: E.recentColorsLimited.length === 0 ? "0" : void 0, display: E.recentColorsLimited.length === 0 ? "none" : void 0 }, children: [e(lo, { light: !0, style: { marginBottom: "10px" } }), e(jo, { title: "Recent Colors", schemeColorLookup: D, colorDefs: E.recentColorsLimited, selectedColor: o, previewColor: t === void 0 ? o : t, swatchProps: ve, onPreviewColorDef: W, onSelectColorDef: Le, compareRGB: C, darkMode: k })] }), je && v === Eo.End ? z(se, { children: [e(lo, { light: !0, sx: { marginTop: "2px", marginBottom: "2px" } }), je, e("div", { style: { marginBottom: "2px" } })] }) : null] }), Ye] }), e(lo, { light: !0, style: { marginBottom: "10px" } }), z("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "space-around", gap: "8px", paddingLeft: "2px", paddingRight: "2px" }, children: [Be, e("div", { style: { flex: "1 1 100%", background: "pink" } }), e(nn, { style: { minWidth: "75px", maxWidth: "75px" }, value: "check", variant: "outlined", size: "small", onClick: () => {
247
- X();
248
- }, children: e("div", Y ? { children: "Preset" } : { children: "Custom" }) }), e(nn, { variant: "contained", size: "small", style: { minWidth: "75px" }, onClick: () => {
249
- Promise.resolve(f?.()).then(() => {
250
- ue(ne);
251
- });
252
- }, children: "Done" })] })] });
253
- })), Rp = e(Vs, {}), Pi = K(J((r, i) => {
254
- const { selectedColor: o, quickColor: t, icon: n = Rp, tooltip: l, label: c, onPreviewColor: m, onPreviewColorImmediate: a, onSelectColor: s, variant: u = nt.Toolbar, panelProps: d, shouldCloseFloatAll: f = !0, compareRGB: p = !1, darkMode: g = !1, ...y } = r, x = ee(m, [m]), b = ee(a, [a]), h = ee(s, [s]), [w, v] = U(() => {
255
- }), C = t || w || o || d?.autoColor, k = we(!1), T = G(() => {
256
- }, []), M = ee(() => {
257
- v(o);
258
- }, [o]), N = ee((E) => {
259
- k.current || (v(E), x?.(E));
260
- }, [x]), B = ee((E) => {
261
- k.current || (v(E), b?.(E));
262
- }, [b]), R = ee((E, Y) => {
263
- k.current || (v(void 0), h?.(E, Y));
264
- }, [h]), S = j(() => e(A, { sx: { width: "24px", height: "24px", color: "inherit", "--sxl-color-active": `${C?.toCSS(g) ?? "transparent"}`, "& .activeColor": { fill: `${C?.toCSS(g) ?? "transparent"}` }, "& .style_grey": { fill: (E) => E.palette.text.icon ?? E.palette.action.active } }, children: typeof n == "function" ? n() : n }), [C, n, g]), I = ee((E) => {
265
- h?.(t, !1);
266
- }, [h, t]), [L, O] = U(!1), $ = G((E) => {
267
- const { closeFloat: Y, closeFloatAll: Z } = E;
268
- return e(Pp, { ...d, selectedColor: o, previewColor: w, onDone: f ? Z : Y, onKeyDown: (X) => {
269
- X.which === be.Enter && (f ? Z() : Y());
270
- }, onPreviewColorImmediate: B, onPreviewColor: N, onSelectColor: R, onEyeDropStart: () => O(!0), onEyeDropStop: () => O(!1), compareRGB: p, darkMode: g });
271
- }, [o, w, f, C, d?.autoColor, g]), D = { onQuickClick: t ? I : void 0, createPopupPanel: $, popupProps: { popperProps: { resizeOnOverflow: !1 } }, onPopupOpen: M, onPopupClose: T, tooltip: l || c || "Color", label: c, icon: S, ...y };
272
- return u === nt.Toolbar ? e(vt, { ref: i, ...D }) : e(sr, { ref: i, ...D });
273
- })), tn = 82, ha = (r) => {
274
- const { styleColor: i, length: o = tn, width: t = 1, dashArray: n = null, sx: l, isDouble: c = !1, isAngled: m = !1, darkMode: a = !1, ...s } = r;
275
- return e(ar, { sx: { width: `${o}px`, height: `${t}px`, color: "inherit", overflow: "visible", "& .activeColor": { stroke: (u) => `${i ? i.toRGBA(a).toString() : u.palette.text.icon ?? u.palette.action.active}` }, "& .style_grey": { stroke: (u) => u.palette.text.icon ?? u.palette.action.active }, ...l }, height: t, width: o, viewBox: `0 0 ${o} ${t}`, ...s, children: e(rp, { length: o, width: t, dashArray: n, isDouble: c, isAngled: m, className: "activeColor" }) });
276
- }, Mp = K(J((r, i) => {
277
- const { variant: o, showLabels: t = !1, disabled: n = !1, createPopupPanel: l, styleColor: c, selectedStyle: m, onSelectStyle: a, showNone: s = !0, darkMode: u, sx: d, ...f } = r, p = ee(a, []), g = G((h) => {
278
- const { popupContainer: w, floatReference: v, closeFloat: C, ...k } = h, T = [], M = Ce.BuiltInDefinitionsArray;
279
- for (let N = 0; N < M.length; N++) {
280
- const B = M[N];
281
- if (B.description === "None" && !s) continue;
282
- const R = e(ha, { styleColor: c, length: tn, width: B.width, darkMode: u, dashArray: B.pattern, isDouble: B.description.toLowerCase().includes("double"), isAngled: B.description.toLowerCase().includes("slant") });
283
- let S = null;
284
- S = t ? z(se, { children: [e(A, { sx: { marginRight: "6px" }, children: B.description }), z(A, { sx: { marginLeft: "6px", marginRight: "6px", display: "flex", alignItems: "center", flex: "1 1 100%" }, children: [e("div", { style: { flex: "1 1 100%" } }), R] })] }) : B.description === "None" ? "None" : R, T.push(e(pt, { className: "border-stroke", tabIndex: 0, sx: { height: "28px", "& svg path.activeColor": { filter: Ur(4) }, paddingLeft: "16px", background: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` }, tooltipProps: { description: t ? "" : B.description }, icon: null, disabled: n, onMouseDown: (I) => I.preventDefault(), onMouseUp: () => {
285
- C(), p(B.style);
286
- }, onKeyDown: (I) => {
287
- I.which === be.Enter && C();
288
- }, selected: B.style === m, parentFloat: v, children: S }, N));
289
- }
290
- return e(A, { sx: { display: "flex", flexDirection: "column", paddingTop: "4px", paddingBottom: "4px" }, children: T });
291
- }, [n, s, c, m, u]), y = j(() => {
292
- const h = Ce.BuiltInDefinitions.get(m);
293
- let w;
294
- return w = h.description === "None" ? e(A, { sx: { minWidth: `${tn}px` }, children: "None" }) : e(ha, { styleColor: c, length: tn, width: h.width, dashArray: h.pattern, darkMode: u, isDouble: h.description.toLowerCase().includes("double"), isAngled: h.description.toLowerCase().includes("slant") }), e(A, { className: "border-stroke", sx: { paddingLeft: "12px", marginLeft: "4px", marginRight: "4px", height: "24px", display: "flex", alignItems: "center", "& svg path.activeColor": { filter: Ur() } }, children: w });
295
- }, [m, c]), x = j(() => Ce.BuiltInDefinitions.get(m), [m]), b = { disabled: n, icon: y, tooltip: "Border Style: " + x.description, sx: { background: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})`, ...d }, createPopupPanel: g, ...f };
296
- return o === nt.Toolbar ? e(vt, { ...b }) : e(sr, { ...b });
297
- })), Ip = K(J((r, i) => {
298
- const { autoColor: o = null, schemeLookup: t, autoStrokeStyle: n = Ce.StrokeStyle.Thin, disabled: l = !1, darkMode: c = !1, showStylingBefore: m = !0, onSelectBorder: a, onPreviewBorder: s, selectedBorder: u, createTemporaryBorder: d, ...f } = r, p = ee(a, [a]), g = ee(s, [s]), [y, x] = U(), [b, h] = U(), w = y ?? n, v = b ?? o, C = u || { bottom: { style: n, color: o?.toString() } }, k = ee((S) => {
299
- const I = {}, L = S ? Object.keys(S) : [];
300
- let O = !1;
301
- for (let ne = 0; ne < L.length; ne++) S[L[ne]]?.style && (I[L[ne]] = { style: S[L[ne]].style, color: S[L[ne]].color }, O || I[L[ne]].style === Ce.StrokeStyle.None || (O = !0));
302
- L.length < 6 && (O = !0);
303
- const $ = O ? I.left : null, D = O ? I.top : null, E = O ? I.right : null, Y = O ? I.bottom : null, Z = O ? I.vertical : null, X = O ? I.horizontal : null;
304
- let _ = "";
305
- return D || $ || (_ += "M 3,5 H 5 V 3 H 3 "), D || (_ += "M 7,5 H 9 V 3 H 7 "), D || Z || (_ += "M 11,5 h 2 V 3 h -2 "), D || (_ += "M 15,5 h 2 V 3 h -2 "), D || E || (_ += "M 19,5 h 2 V 3 h -2 "), $ || (_ += "M 3,9 H 5 V 7 H 3 "), Z || (_ += "M 11,9 h 2 V 7 h -2 "), E || (_ += "M 19,9 h 2 V 7 h -2 "), X || $ || (_ += "M 3,13 H 5 V 11 H 3 "), X || (_ += "M 7,13 H 9 V 11 H 7 "), X || Z || (_ += "M 11,13 h 2 v -2 h -2 "), X || E || (_ += "M 19,13 h 2 v -2 h -2 "), X || (_ += "M 15,13 h 2 v -2 h -2 "), $ || (_ += "M 3,17 H 5 V 15 H 3 "), Z || (_ += "M 11,17 h 2 v -2 h -2 "), E || (_ += "M 19,17 h 2 v -2 h -2 "), Y || $ || (_ += "M 3,21 H 5 V 19 H 3 "), Y || (_ += "M 7,21 H 9 V 19 H 7 "), Y || Z || (_ += "M 11,21 h 2 v -2 h -2 "), Y || (_ += "M 15,21 h 2 v -2 h -2 "), Y || E || (_ += "M 19,21 h 2 v -2 h -2 "), z("div", { style: { width: "24px", height: "24px", position: "relative" }, children: [e(ar, { sx: { position: "absolute", top: "0px", left: "0px", "& path": { opacity: "0.8", transform: "translate(-0.5px, -0.5px)" } }, children: e("path", { d: _ }) }), e(A, { sx: { width: "24px", height: "24px", display: "flex", alignItems: "center", justifyContent: "center", position: "absolute", top: "-1px", left: "-1px", "& svg path": { filter: $s } }, children: e(gr, { getBorderAt: (ne, ae) => {
306
- if (!d || L.length === 0) return null;
307
- const q = ne.rowIndex, W = ne.colIndex, Q = {};
308
- return q === 0 ? (Q.top = I.top, Q.bottom = I.horizontal) : (Q.top = I.horizontal, Q.bottom = I.bottom), W === 0 ? (Q.left = I.left, Q.right = I.vertical) : (Q.left = I.vertical, Q.right = I.right), d?.(Q);
309
- }, width: 18, height: 18, darkMode: c, style: { top: "0px", left: "0px", width: "18px", height: "18px", minWidth: "18px", minHeight: "18px", position: "relative" } }) })] });
310
- }, [v, w, c]), T = G((S, I, L) => {
311
- let O = null;
312
- if (S && S.length > 0) {
313
- let $ = null;
314
- (I || L) && ($ = { style: L, color: I?.toString() ?? null }), O = {};
315
- for (let D = 0; D < S.length; D++) O[S[D]] = $;
316
- }
317
- return O;
318
- }, []), M = G((S) => {
319
- p?.(S);
320
- }, []), N = G((S) => {
321
- g?.(S);
322
- }, []), B = G((S) => {
323
- const { closeFloatAll: I, floatReference: L } = S, O = (E, Y, Z = "bottom", X = !1) => {
324
- const _ = T(E, v ?? null, X ? Ce.StrokeStyle.None : w ?? null), ne = X ? T([], v ?? null, w ?? null) : _;
325
- return e(bt, { icon: k(ne), sx: { background: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` }, tooltipProps: { label: Y, simple: !0, placement: Z }, onClick: () => {
326
- I(), N(_), M(_);
327
- } });
328
- }, $ = z(se, { children: [z(A, { sx: { display: "flex", padding: "6px 16px", justifyContent: "center", rowGap: "2px", gap: "2px" }, children: [O([Ce.Edge.Left, Ce.Edge.Top, Ce.Edge.Right, Ce.Edge.Bottom, Ce.Edge.Horizontal, Ce.Edge.Vertical], "All Borders", "top"), O([Ce.Edge.Horizontal, Ce.Edge.Vertical], "Inner Borders", "top"), O([Ce.Edge.Horizontal], "Inside Horizontal Borders", "top"), O([Ce.Edge.Vertical], "Inside Vertical Borders", "top"), O([Ce.Edge.Left, Ce.Edge.Top, Ce.Edge.Right, Ce.Edge.Bottom], "Outside Borders", "top")] }), z(A, { sx: { display: "flex", padding: "6px 16px", justifyContent: "center", rowGap: "2px", gap: "2px" }, children: [O([Ce.Edge.Left], "Left Borders"), O([Ce.Edge.Top], "Top Borders"), O([Ce.Edge.Right], "Right Borders"), O([Ce.Edge.Bottom], "Bottom Borders"), O([Ce.Edge.Left, Ce.Edge.Top, Ce.Edge.Right, Ce.Edge.Bottom, Ce.Edge.Horizontal, Ce.Edge.Vertical, Ce.Edge.DiagonalUp, Ce.Edge.DiagonalDown], "No Borders", "bottom", !0)] })] }), D = e(se, { children: z(A, { sx: { display: "flex", padding: "6px 16px", flexDirection: "row", gap: "6px" }, children: [e(Pi, { variant: nt.Toolbar, icon: e(cr, {}), selectedColor: w === Ce.StrokeStyle.None ? new ft("transparent") : v, onPreviewColor: (E) => {
329
- h(E);
330
- }, onSelectColor: (E, Y) => {
331
- h(E);
332
- }, darkMode: c, tooltip: "Border Color", panelProps: { disableAlpha: !0, autoColor: o, schemeLookup: t }, disabled: l || w === Ce.StrokeStyle.None, parentFloat: L, shouldCloseFloatAll: !1 }), e(Mp, { selectedStyle: w, onSelectStyle: x, styleColor: v, darkMode: c, variant: nt.Toolbar, parentFloat: L })] }) });
333
- return z(A, { sx: { display: "flex", flexDirection: "column", paddingTop: "4px", paddingBottom: "4px" }, onClick: (E) => E.stopPropagation(), children: [m ? D : $, e(re, { orientation: "horizontal" }), m ? $ : D] });
334
- }, [w, v, o, t, c]), R = j(() => k(C), [C, c]);
335
- return e(vt, { ref: i, createPopupPanel: B, popupProps: { popperProps: { resizeOnOverflow: !1 } }, createTooltip: ({ children: S }, I) => e(rt, { label: "Borders", description: "Set the borders.", disabled: I, children: S }), onQuickClick: () => {
336
- p?.(C);
337
- }, quickButtonProps: { sx: {} }, disabled: l, icon: R, ...f });
338
- })), Np = K(J((r, i) => {
339
- const { commands: o, command: t, commandHook: n, variant: l = ie.Toolbar, disabled: c = !1, autoColor: m, autoStrokeStyle: a, schemeLookup: s, createTemporaryBorder: u, selectedBorder: d, onSelectBorder: f, darkMode: p, icon: g, label: y, ...x } = r, b = He(o, ["formatBorder"]), h = t ?? b[0], w = h?.context() ?? null, v = w?.autoColor ?? m, C = w?.autoStyle ?? a, k = d ?? w?.quickBorder, T = p ?? w?.darkMode, M = u ?? w?.createTemporaryBorder, N = s ?? w?.schemeLookup, B = ee((S) => {
340
- w?.onBorderSelect && w.onBorderSelect(S), f?.(S), h?.execute(S, n);
341
- }, [h, f, n]), R = G((S, I) => {
342
- const { children: L, title: O, ...$ } = S;
343
- let D = S.children;
344
- return (h?.disabled() || c) && (D = e("div", { children: D })), e(dr, { command: h, placement: l === ie.Toolbar ? "bottom-start" : "right-start", disabled: I, ...$, children: D });
345
- }, [h, c]);
346
- return e(Ip, { ref: i, autoColor: v, darkMode: T, autoStrokeStyle: C, createTemporaryBorder: M, schemeLookup: N, selectedBorder: k, onSelectBorder: B, createTooltip: R, disabled: c || !h || h.disabled(), ...x });
347
- })), Fp = K(J((r, i) => {
348
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = G((a, s) => {
349
- const u = { variant: ie.Menuitem, commandHook: t, scope: n, disabled: l }, d = z(se, { children: [e(F, { ...u, command: s.getCommand("mergeToggle"), icon: P(e(Gr, {})) }), e(F, { ...u, command: s.getCommand("mergeHorizontal"), icon: P(e(_s, {})) }), e(F, { ...u, command: s.getCommand("mergeVertical"), icon: P(e(Us, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...u, command: s.getCommand("unmerge"), icon: P(e(mi, {})) })] });
350
- return Se({ ...a, children: d });
351
- }, [l, t, n]);
352
- return e(Re, { ref: i, commands: o, quickCommand: "mergeToggle", commandHook: t, scope: n, tooltip: "Combine or split cells.", createPopupPanel: m, icon: P(e(Gr, {})), ...c });
353
- })), Op = K(J((r, i) => {
354
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = G((a, s) => {
355
- const u = { variant: ie.Menuitem, commandHook: t, scope: n, disabled: l }, d = z(se, { children: [e(F, { ...u, command: s.getCommand("freezeToggle"), icon: P(e(Gs, {})) }), e(F, { ...u, command: s.getCommand("freezeToggleHorizontal"), icon: P(e(qs, {})) }), e(F, { ...u, command: s.getCommand("freezeToggleVertical"), icon: P(e(Xs, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...u, command: s.getCommand("unfreeze"), icon: e(mi, {}) })] });
356
- return Se({ ...a, children: d });
357
- }, [l, t, n]);
358
- return e(Re, { ref: i, commands: o, commandHook: t, createPopupPanel: m, quickCommand: "freezeToggle", label: "Freeze Panes", tooltip: "Freeze a portion of the sheet to keep it visible while you scroll through the rest of the sheet.\\n\\nUseful for viewing data in other parts of your worksheet without losing your headers or labels.", icon: e(Ks, {}), ...c });
359
- })), Ap = K(J((r, i) => {
360
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = G((a, s) => {
361
- const u = { variant: ie.Menuitem, commandHook: t, scope: n, disabled: l }, d = z(se, { children: [e(F, { ...u, command: s.getCommand("find"), icon: P(e(qr, {})) }), e(F, { ...u, command: s.getCommand("findReplace"), icon: P(e(Ys, {})) }), e(F, { ...u, command: s.getCommand("goto"), icon: P(e(Zs, {})) })] });
362
- return Se({ ...a, children: d });
363
- }, [l, t, n]);
364
- return e(Re, { ref: i, commands: o, commandHook: t, createPopupPanel: m, label: "Find & Select", tooltip: "Find and replace cells or go to a specific location.", quickCommand: "find", icon: P(e(qr, {})), ...c });
365
- })), Bp = K(J((r, i) => {
366
- const { command: o, commandHook: t, showQuickButtons: n = !!r.commands, commands: l, fontSizes: c = ap.DefaultFontSizes, disabled: m = !1, parentFloat: a, icon: s, label: u, sx: d, ...f } = r;
367
- Ht(o);
368
- const p = () => o?.state()?.toString() || "11", [g, y] = U(p), x = ee(() => {
369
- const M = parseFloat(g);
370
- isNaN(M) ? y(p()) : parseFloat(p()) !== M && o.execute(M, t);
371
- }, [p, o, g, t]);
372
- me(() => {
373
- y(p());
374
- }, [o?.state()]);
375
- const b = j(() => {
376
- if (!t) return null;
377
- const M = { ...t };
378
- return delete M.beforeExecute, M;
379
- }, [t]), h = He(l, ["formatFontSizeIncrease", "formatFontSizeDecrease"]), w = j(() => h ? z(A, { className: Ae("quick-buttons", {}), sx: { display: "flex", alignItems: "center", justifyContent: "center" }, onClick: (M) => M.stopPropagation(), children: [e(F, { command: h[0], commandHook: b, icon: P(e(Js, {})) }), e(F, { command: h[1], icon: P(e(Qs, {})) })] }) : null, [h]), v = at(), C = j(() => `${Bt.getSharedMeasurer()("12.3", Math.round(v.typography.fontSize), v.typography.fontFamily).width}px`, [v]), k = G((M) => {
380
- const { onMouseDown: N, onMouseUp: B, ...R } = M;
381
- return e(dt, { component: "div", ...R, disableRipple: !0, children: e(ir, { inputMode: "numeric", disabled: m || !o || o.disabled(), inputProps: { name: "font-input", autoComplete: "off", tabIndex: 0, type: "number", maxLength: 4, max: 409, min: 2 }, sx: { "&::before": { borderBottom: "1px solid transparent" }, "&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before": { borderBottom: (S) => `1px solid ${S.palette.text.icon ?? S.palette.action.active}` }, "&:hover:not(.Mui-disabled):not(.Mui-error):before": { borderBottom: (S) => `1px solid ${S.palette.error.main}` }, "::after": { borderBottom: (S) => `1px solid ${S.palette.primary.main}` }, paddingTop: "0px", paddingBottom: "0px", paddingLeft: "0px", paddingRight: "0px", fontSize: (S) => `${Math.round(S.typography.fontSize)}px`, width: C, color: (S) => S.palette.text.secondary, input: { padding: "0 0", textAlign: "center", MozAppearance: "textfield", "&:hover:not(.Mui-disabled):not(.Mui-error)": { color: (S) => S.palette.text.primary }, "&:focus:not(.Mui-disabled):not(.Mui-error)": { color: (S) => S.palette.text.primary } }, "input::-webkit-inner-spin-button": { WebkitAppearance: "none", margin: "0" }, minHeight: "24px" }, value: g, onFocus: (S) => {
382
- S.target?.select();
383
- }, onKeyDown: (S) => {
384
- if (S.which === be.Enter) p() !== g && (S.stopPropagation(), S.preventDefault(), x());
385
- else if (S.which === be.Escape) p() !== g && (y(p()), setTimeout(() => {
386
- S.target?.select();
387
- }, 0), S.stopPropagation(), S.preventDefault());
388
- else {
389
- if (S.key.match("[-]") || S.key.match("[0-9.]") && (g + S.key).length > 4) return S.stopPropagation(), void S.preventDefault();
390
- if (S.which === be.Space) return void S.preventDefault();
391
- }
392
- }, onBlur: () => {
393
- x();
394
- }, onChange: (S) => {
395
- if (S.target.value.length > 4) return S.stopPropagation(), void S.preventDefault();
396
- y(S.target.value);
397
- } }) });
398
- }, [g, m, o]), T = G((M) => {
399
- const N = (I) => {
400
- o?.execute(I, t);
401
- }, B = o?.state(), R = [];
402
- for (let I = 0; I < c.length; I++) {
403
- const L = c[I] === B;
404
- R.push(e(pt, { selected: L, icon: L ? e(sn, {}) : void 0, disabled: m || !o || o.disabled(), onMouseDown: (O) => {
405
- O.button === 0 && O.preventDefault();
406
- }, onMouseUp: (O) => {
407
- O.button === 0 && N(c[I]);
408
- }, onKeyDown: (O) => {
409
- O.keyCode !== be.Enter && O.keyCode !== be.Space || N(c[I]);
410
- }, sx: { paddingTop: "4px", paddingBottom: "4px" }, children: e(A, { sx: { display: "flex", flex: "1 1 100%", justifyContent: "end" }, children: c[I] }) }, "fontSize-" + I));
411
- }
412
- const S = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, ...f, children: [w, e(re, { orientation: "horizontal" }), e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: R })] });
413
- return Se({ ...M, children: S });
414
- }, [m, o?.state(), t]);
415
- return e(vt, { ref: i, sx: { ...d }, tabIndex: -1, outlined: !0, disabled: m, parentFloat: a, createPopupPanel: T, createTooltip: ({ children: M }, N) => e(rt, { label: o?.label(), description: o?.description(), disabled: N || o?.disabled(), children: M }), createQuickButton: k, ...f });
416
- })), fa = K((r) => {
417
- const { selected: i, disabled: o, formattedValue: t, handleSetFormat: n, format: l, sx: c, ...m } = r;
418
- return e(pt, { sx: { maxWidth: "360px", display: "flex", "*": { lineHeight: "1.2" }, ...c }, disabled: o, selected: i, icon: i ? e(sn, {}) : void 0, onMouseDown: (a) => {
419
- a.button === 0 && a.preventDefault();
420
- }, onMouseUp: (a) => {
421
- a.button === 0 && n(l.numberFormat);
422
- }, onKeyDown: (a) => {
423
- a.keyCode !== be.Enter && a.keyCode !== be.Space || n(l.numberFormat);
424
- }, ...m, children: z(A, { sx: { display: "flex", flex: "1 1 100%", flexDirection: "column", overflow: "hidden" }, children: [z(Oe, { component: "div", children: [l.formatType, l.formatType === gt.Type.Custom ? "…" : ""] }), e(Oe, { variant: "caption", component: "div", sx: { color: (a) => Qe(a.palette.text.primary, 0.6), paddingTop: t && t.length > 0 ? "1px" : void 0, overflow: "hidden", textOverflow: "ellipsis" }, children: t && t.length > 0 ? t : " " })] }) });
425
- }), Lp = K(J((r, i) => {
426
- const { commands: o, commandHook: t, scope: n, sx: l, disabled: c = !1, parentFloat: m, ...a } = r, s = He(o, ["formatNumberFormat"])[0], u = s?.state() ? gt.Styles.lookupStyle(s?.state()).formatType : gt.Type.General, d = j(() => {
427
- if (!t) return null;
428
- const y = { ...t };
429
- return delete y.beforeExecute, y;
430
- }, [t]), f = G((y, x) => {
431
- const b = (B) => {
432
- t?.beforeExecute?.(s, s?.state()), s.execute(B, t), t?.onExecute?.(s, s?.state());
433
- }, h = s?.context()(), w = gt.Styles.lookupPrimary(), v = [];
434
- for (let B = 0; B < w.length; B++) {
435
- let R = "";
436
- if (h && !h.isEmpty()) try {
437
- R = h.getNumberFormat(w[B].numberFormat).displayText;
438
- } catch (I) {
439
- console.warn(I);
440
- }
441
- R === "" && w[B].formatType === gt.Type.General && (R = "No specific format");
442
- const S = w[B].formatType === u;
443
- v.push(e(fa, { selected: S, disabled: c || !s || s.disabled(), formattedValue: R, handleSetFormat: b, format: w[B] }, w[B].formatType));
444
- }
445
- const C = { numberFormat: "", formatType: gt.Type.Custom }, k = u === gt.Type.Custom, T = e(fa, { selected: k, disabled: c || !s || s.disabled(), formattedValue: k ? h.getNumberFormat().displayText : "", handleSetFormat: () => {
446
- t?.beforeExecute?.(s, s?.state()), x.getCommand("formatNumberDialog")?.execute(s?.state()), t?.onExecute?.(s, s?.state());
447
- }, format: C, sx: { flex: "0", width: "100%" } }, gt.Type.Custom), M = z(A, { className: "quick-buttons", sx: { display: "flex", alignItems: "center", justifyContent: "center" }, onClick: (B) => B.stopPropagation(), children: [e(F, { command: x.getCommand("formatNumberFormatAccountingStyle"), commandHook: d, scope: n, icon: e(ec, {}) }), e(F, { command: x.getCommand("formatNumberFormatPercentStyle"), commandHook: d, scope: n, icon: e(tc, {}) }), e(F, { command: x.getCommand("formatNumberFormatCommaStyle"), commandHook: d, scope: n, icon: e(oc, {}) }), e(F, { command: x.getCommand("formatNumberFormatIncreaseDecimal"), commandHook: d, scope: n, icon: P(e(nc, {})) }), e(F, { command: x.getCommand("formatNumberFormatDecreaseDecimal"), commandHook: d, scope: n, icon: P(e(rc, {})) })] }), N = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, ...a, children: [M, e(re, { orientation: "horizontal" }), e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: v }), e(re, { orientation: "horizontal" }), T] });
448
- return Se({ ...y, children: N });
449
- }, [s?.context(), s?.state(), t, n]), p = at(), g = j(() => {
450
- const y = gt.Type.MediumTime;
451
- return `${Bt.getSharedMeasurer()(y, Math.round(p.typography.fontSize), p.typography.fontFamily).width}px`;
452
- }, [p]);
453
- return e(Re, { ref: i, commands: o, sx: l, outlined: !0, disabled: c, parentFloat: m, createPopupPanel: f, createTooltip: ({ children: y }, x) => e(rt, { label: s?.label(), description: s?.description(), disabled: x, children: y }), icon: e(A, { sx: { display: "flex", paddingLeft: "4px", paddingRight: "4px", fontSize: (y) => `${Math.round(y.typography.fontSize)}px`, color: (y) => y.palette.text.secondary, fontFamily: (y) => y.typography.fontFamily, width: g }, children: e(A, { sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "pre" }, children: u }) }), ...a });
454
- })), Ri = K(J((r, i) => {
455
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = G((a, s) => {
456
- const u = { variant: ie.Menuitem, commandHook: t, scope: "clear", disabled: l }, d = z(se, { children: [e(F, { ...u, command: s.getCommand("clearAll"), icon: e(Xr, {}) }), e(F, { ...u, command: s.getCommand("clearFormats"), icon: P(e(gi, {})) }), e(F, { ...u, command: s.getCommand("clearContents"), icon: P(e(ac, {})) }), e(F, { ...u, command: s.getCommand("clearComments") }), e(F, { ...u, command: s.getCommand("clearHyperlinks") })] });
457
- return Se({ ...a, children: d });
458
- }, [l, t, n]);
459
- return e(Re, { ref: i, commands: o, disabled: l, commandHook: t, scope: n, label: "Clear", tooltip: "Clear everything in the cell, or remove just the formatting or contents.", createPopupPanel: m, icon: e(Xr, {}), ...c });
460
- })), Hp = K(J((r, i) => {
461
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = G((a, s) => {
462
- const u = { variant: ie.Menuitem, commandHook: t, scope: "fill", disabled: l }, d = z(se, { children: [e(F, { ...u, command: s.getCommand("fillDown"), icon: P(e(so, {})) }), e(F, { ...u, command: s.getCommand("fillRight"), icon: P(e(so, { sx: { transform: "rotate(270deg)" } })) }), e(F, { ...u, command: s.getCommand("fillUp"), icon: P(e(so, { sx: { transform: "rotate(180deg)" } })) }), e(F, { ...u, command: s.getCommand("fillLeft"), icon: P(e(so, { sx: { transform: "rotate(90deg)" } })) })] });
463
- return Se({ ...a, children: d });
464
- }, [l, t, n]);
465
- return e(Re, { ref: i, commands: o, disabled: l, commandHook: t, label: "Fill", tooltip: "Fill the selected cells with the value from one of the corners.", createPopupPanel: m, icon: P(e(so, {})), ...c });
466
- })), Mi = K(J((r, i) => {
467
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, disableSheet: c = !1, preferSingleMenu: m = !0, showQuickButton: a = !0, variant: s = ie.Toolbar, ...u } = r, d = ["insertCellsShiftDown", "insertCellsShiftRight", "insertRows", "insertColumns"], f = He(o, d), { singleCommand: p, allDisabled: g } = j(() => {
468
- let b = null, h = 0;
469
- for (let w = 0; w < f.length; w++) f[w] && !f[w]?.disabled() && (m && s === ie.Menuitem && (b = h === 0 ? f[w] : null), h++);
470
- return { singleCommand: b, allDisabled: h === 0 };
471
- }, [f]), y = j(() => {
472
- const b = /* @__PURE__ */ new Map();
473
- return b.set("insertCellsShiftDown", P(e(Kr, {}))), b.set("insertCellsShiftRight", P(e(Kr, { sx: { transform: "rotate(270deg)" } }))), b.set("insertRows", P(e(ic, {}))), b.set("insertColumns", P(e(Yr, {}))), b;
474
- }, []), x = G((b, h) => {
475
- let w = null;
476
- const v = { variant: ie.Menuitem, commandHook: t, scope: "insertCells", disabled: l };
477
- c || (w = z(se, { children: [e(re, { orientation: "horizontal" }), e(F, { ...v, command: h.getCommand("addSheet"), icon: P(e(rn, {})) })] }));
478
- const C = z(se, { children: [e(F, { ...v, command: f[0], icon: y.get(d[0]) }), e(F, { ...v, command: f[1], icon: y.get(d[1]) }), e(re, { orientation: "horizontal" }), e(F, { ...v, command: f[2], icon: y.get(d[2]) }), e(F, { ...v, command: f[3], icon: y.get(d[3]) }), w] });
479
- return Se({ ...b, children: C });
480
- }, [l, f, t, n, y]);
481
- return p ? e(F, { ref: i, variant: s, commandHook: t, disabled: l, command: p, icon: y.get(p.key()), ...u }) : e(Re, { ref: i, variant: s, quickCommand: "insertCells", commands: o, commandHook: t, scope: n, disabled: l || g, tooltip: z(se, { children: [e("span", { children: "Insert new cells, rows or columns to your workbook." }), e("br", {}), e("span", { children: "To insert multiple rows or columns at a time, select multiple rows or columns in the sheet and click Insert." })] }), createPopupPanel: x, icon: P(e(Yr, {})), ...u });
482
- })), Ii = K(J((r, i) => {
483
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, disableSheet: c = !1, preferSingleMenu: m = !0, showQuickButton: a = !0, variant: s = ie.Toolbar, ...u } = r, d = He(o, ["deleteCellsShiftUp", "deleteCellsShiftLeft", "deleteRows", "deleteColumns"]), { singleCommand: f, allDisabled: p } = j(() => {
484
- let x = null, b = 0;
485
- for (let h = 0; h < d.length; h++) d[h] && !d[h]?.disabled() && (m && s === ie.Menuitem && (x = b === 0 ? d[h] : null), b++);
486
- return { singleCommand: x, allDisabled: b === 0 };
487
- }, [d]), g = j(() => {
488
- const x = /* @__PURE__ */ new Map();
489
- return x.set("deleteCellsShiftUp", P(e(Zr, { sx: { transform: "rotate(0deg)" } }))), x.set("deleteCellsShiftLeft", P(e(Zr, { sx: { transform: "rotate(270deg)" } }))), x.set("deleteRows", P(e(lc, {}))), x.set("deleteColumns", P(e(Jr, {}))), x;
490
- }, []), y = G((x, b) => {
491
- const h = { variant: ie.Menuitem, commandHook: t, scope: "deleteCells", disabled: l };
492
- let w = null;
493
- c || (w = z(se, { children: [e(re, { orientation: "horizontal" }), e(F, { ...h, command: b.getCommand("deleteSheet"), icon: P(e(rn, {})) })] }));
494
- const v = z(se, { children: [e(F, { ...h, command: b.getCommand("deleteCellsShiftUp"), icon: g.get("deleteCellsShiftUp") }), e(F, { ...h, command: b.getCommand("deleteCellsShiftLeft"), icon: g.get("deleteCellsShiftLeft") }), e(re, { orientation: "horizontal" }), e(F, { ...h, command: b.getCommand("deleteRows"), icon: g.get("deleteRows") }), e(F, { ...h, command: b.getCommand("deleteColumns"), icon: g.get("deleteColumns") }), w] });
495
- return Se({ ...x, children: v });
496
- }, [l, t, n, g]);
497
- return f ? e(F, { ref: i, variant: s, commandHook: t, disabled: l, command: f, icon: g.get(f.key()), ...u }) : e(Re, { ref: i, variant: s, quickCommand: "deleteCells", commands: o, commandHook: t, scope: n, disabled: l || p, tooltip: z(se, { children: [e("span", { children: "Delete cells, rows, columns or sheets from your workbook." }), e("br", {}), e("span", { children: "To delete multiple rows or columns at a time, select multiple rows or columns in the sheet and click Delete." })] }), createPopupPanel: y, icon: P(e(Jr, {})), ...u });
498
- })), Mo = K(J((r, i) => {
499
- const { command: o, commandHook: t, onSelectColor: n, disabled: l = !1, variant: c = ie.Toolbar, quickColor: m, panelProps: a, isSplit: s = !1, darkMode: u, icon: d, ...f } = r, { autoColor: p, schemeLookup: g, recentColors: y, ...x } = a;
500
- if (f.selectedColor) throw new Error("Command selectedColor will be used. Do not try to provide one as a direct argument");
501
- Ht(o);
502
- const b = o?.context();
503
- let h = m ?? b?.quickColor;
504
- s && !h && (h = new ft("transparent"));
505
- const w = p ?? b?.autoColor, v = g ?? b?.schemeLookup, C = y ?? b?.recentColors, k = u ?? b?.darkMode, T = j(() => ({ autoColor: w, schemeLookup: v, recentColors: C, darkMode: k, ...x }), [w, v, C, k]), M = ee((B, R) => {
506
- B && R && b?.addRecentColor && b.addRecentColor(B), b?.onColorSelect && b.onColorSelect(B), n?.(B, R), o?.execute(B, t);
507
- }, [o, n, t, b]), N = G((B, R) => {
508
- const { children: S, title: I, ...L } = B;
509
- let O = B.children;
510
- return (o?.disabled() || l) && (O = e("div", { children: O })), e(dr, { command: o, placement: c === ie.Toolbar ? "bottom-start" : "right-start", disabled: R, ...L, children: O });
511
- }, [o, l]);
512
- return e(Pi, { ref: i, panelProps: T, icon: d, quickColor: h, selectedColor: o?.state(), onSelectColor: M, variant: c === ie.Menuitem ? nt.Menuitem : nt.Toolbar, createTooltip: N, label: o?.label(), disabled: l || !o || o.disabled(), compareRGB: !0, darkMode: k, ...f });
513
- }));
514
- Mo.displayName = "ColorCommandButton";
515
- const zp = K(J((r, i) => {
516
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, parentFloat: c, ...m } = r, a = He(o, ["gridlinesToggle", "sheetViewToggleGridlinesColumns", "sheetViewToggleGridlinesRows"]), s = G((u, d) => {
517
- const f = { variant: ie.Menuitem, parentFloat: u.floatReference, commandHook: t, scope: n, disabled: l }, p = z(se, { children: [e(F, { ...f, command: d.getCommand("gridlinesToggle") }), e(Mo, { ...f, command: d.getCommand("sheetViewFormatGridlinesColor"), icon: e(cr, {}), panelProps: { disableAlpha: !0 } }), e(re, { orientation: "horizontal" }), e(F, { ...f, command: d.getCommand("sheetViewToggleGridlinesColumns") }), e(F, { ...f, command: d.getCommand("sheetViewToggleGridlinesRows") })] });
518
- return Se({ ...u, children: p });
519
- }, [l, t]);
520
- return e(Re, { ref: i, parentFloat: c, quickCommand: a[0]?.key(), commands: o, commandHook: t, createPopupPanel: s, label: "Gridlines", tooltip: "Configure how the lines between rows and columns in the sheet are displayed.", icon: e(eo, { command: a[0], scope: "view" }), ...m });
521
- })), Ni = K(J((r, i) => {
522
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = G((a, s) => {
523
- const u = { variant: ie.Menuitem, commandHook: t, scope: "sort", disabled: l }, d = s.getCommand("sortCustom"), f = z(se, { children: [e(F, { ...u, command: s.getCommand("sortAscending"), icon: P(e(Vn, {})) }), e(F, { ...u, command: s.getCommand("sortDescending"), icon: P(e(hi, {})) }), d ? e(F, { ...u, command: d, icon: P(e(sc, {})) }) : null, e(re, { orientation: "horizontal" }), e(F, { ...u, scope: "filter", command: s.getCommand("autoFilterToggle"), icon: P(e($n, {})) }), e(F, { ...u, scope: "filter", command: s.getCommand("autoFilterClear"), icon: P(e(pr, {})) }), e(F, { ...u, scope: "filter", command: s.getCommand("autoFilterReapply"), icon: P(e(fi, {})) })] });
524
- return Se({ ...a, children: f });
525
- }, [l, t, n]);
526
- return e(Re, { ref: i, commands: o, commandHook: t, scope: n, disabled: l, label: "Sort", tooltip: z(se, { children: [e("span", { children: "Organize your data so it's easier to analyze." }), e("br", {}), e("span", { children: "You can sort the selected data from smallest to largest or largest to smallest." })] }), createPopupPanel: m, icon: P(e(Vn, {})), ...c });
527
- })), Hm = K(J((r, i) => {
528
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = G((a, s) => {
529
- const u = { variant: ie.Menuitem, commandHook: t, scope: "sort", disabled: l }, d = z(se, { children: [e(F, { ...u, scope: "filter", command: s.getCommand("autoFilterToggle"), icon: P(e($n, {})) }), e(F, { ...u, scope: "filter", command: s.getCommand("autoFilterClear"), icon: P(e(pr, {})) }), e(F, { ...u, scope: "filter", command: s.getCommand("autoFilterReapply"), icon: P(e(fi, {})) })] });
530
- return Se({ ...a, children: d });
531
- }, [l, t, n]);
532
- return e(Re, { ref: i, commands: o, commandHook: t, scope: n, disabled: l, label: "Filter", tooltip: z(se, { children: [e("span", { children: "Organize your data so it's easier to analyze." }), e("br", {}), e("span", { children: "You can sort the selected data from smallest to largest or largest to smallest." })] }), createPopupPanel: m, icon: P(e($n, {})), ...c });
533
- })), Fi = K(J((r, i) => {
534
- const { quickCommand: o, icon: t, isRedo: n = !1, nestRedo: l = !0, undoManager: c, scope: m, sx: a, disabled: s, commands: u, ...d } = r, f = [o];
535
- !n && l && f.push("redo");
536
- const p = He(u, f), g = p[0], y = p[1], x = c ?? g?.context?.()?.undoManager;
537
- let b = s;
538
- s || (b = !g || g.disabled(), y && !y.disabled() && (b = !1));
539
- const [h, w] = U(0), v = G((C, k) => {
540
- let T = h === 0 ? "Cancel" : `${g.label()} ${h} Action${h === 1 ? "" : "s"}`, M = !1;
541
- x || (M = !0), M || (M = l ? !x.hasRedo() && !x.hasUndo() : !x.hasRedo());
542
- const N = (O) => {
543
- g.execute(O);
544
- }, B = e(pt, { sx: { display: "flex", flex: "none", alignItems: "center", justifyContent: "center", padding: M ? void 0 : "0 0", minWidth: "180px" }, icon: null, onMouseEnter: () => {
545
- w(0);
546
- }, onMouseDown: (O) => {
547
- O.button === 0 && O.preventDefault();
548
- }, onMouseUp: (O) => {
549
- O.button === 0 && N(h);
550
- }, onKeyDown: (O) => {
551
- O.isDefaultPrevented() || O.keyCode !== be.Enter && O.keyCode !== be.Space || N(h);
552
- }, children: e(Oe, { component: "div", variant: "caption", sx: { fontSize: "0.875rem", letterSpacing: "0.01071em" }, children: T }) });
553
- if (M) return B;
554
- const R = n ? x?.getRedoDescriptions() : x?.getUndoDescriptions(), S = [];
555
- for (let O = 0; O < R.length; O++) {
556
- const $ = R[O];
557
- S.push(e(pt, { sx: { maxWidth: "360px", display: "flex" }, icon: e(rn, {}), disabled: b, selected: O < h, onMouseEnter: () => {
558
- w(O + 1);
559
- }, onMouseDown: (D) => {
560
- D.button === 0 && D.preventDefault();
561
- }, onMouseUp: (D) => {
562
- D.button === 0 && N(O + 1);
563
- }, onKeyDown: (D) => {
564
- D.isDefaultPrevented() || D.keyCode !== be.Enter && D.keyCode !== be.Space || N(O + 1);
565
- }, children: z(A, { sx: { display: "flex", flex: "1 1 100%", flexDirection: "row", alignItems: "center", overflow: "hidden" }, children: [e(Oe, { component: "div", children: $ }), e(rn, {})] }) }, `action:${O}`));
566
- }
567
- let I = null;
568
- if (!n && l) {
569
- const O = { scope: "undo", commands: k, variant: ie.Menuitem, parentFloat: C.floatReference };
570
- I = [], I.push(e(Fi, { ...O, quickCommand: "redo", isRedo: !0 }, "nested:redo")), x.hasRedo() && x.hasUndo() && I.push(e(re, { orientation: "horizontal" }, "action:redo-div"));
571
- }
572
- const L = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, onClick: () => {
573
- C.closeFloatAll();
574
- }, onMouseLeave: () => {
575
- w(0);
576
- }, children: [I, e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: S }), e(re, { orientation: "horizontal" }), B] });
577
- return Se({ ...C, children: L });
578
- }, [g?.context(), g?.state(), m, x, h, b]);
579
- return e(Re, { ref: i, commands: u, quickCommand: o, scope: m, disabled: b, label: g?.label() ?? (n ? "Redo" : "Undo"), tooltip: e(se, { children: e("span", { children: `${g?.label() ?? "No"} last actions.` }) }), createPopupPanel: v, icon: t ?? P(e(n ? cc : dc, {})), selected: !1, ...d });
580
- })), Qt = us.getFontList(), Oi = /* @__PURE__ */ new Map();
581
- for (let r = 0; r < Qt.length; r++) Oi.set(Qt[r].fontRef.getFamily(), Qt[r]);
582
- const Wp = K(J((r, i) => {
583
- const { command: o, commandHook: t, sx: n, disabled: l = !1, parentFloat: c, icon: m, label: a, ...s } = r;
584
- Ht(o);
585
- const u = o?.state(), d = at(), f = j(() => `${Bt.getSharedMeasurer()("Times New Roman", Math.round(d.typography.fontSize), d.typography.fontFamily).width}px`, [d]), p = G((g) => {
586
- const y = (w) => {
587
- o?.execute(w, t);
588
- }, x = [];
589
- for (let w = 0; w < Qt.length; w++) x.push({ key: Qt[w].fontRef.getFamily(), description: Qt[w].fontRef.getFamily() });
590
- Oi.get(u) || x.unshift({ key: u, description: u });
591
- const b = [];
592
- for (let w = 0; w < x.length; w++) {
593
- const v = x[w].key === u;
594
- b.push(e(pt, { sx: { display: "flex", paddingTop: "4px", paddingBottom: "4px" }, selected: v, disabled: l || !o || o.disabled(), icon: v ? e(sn, {}) : void 0, onMouseUp: (C) => {
595
- C.button === 0 && y(x[w].key);
596
- }, onMouseDown: (C) => {
597
- C.button === 0 && C.preventDefault();
598
- }, onKeyDown: (C) => {
599
- C.keyCode !== be.Enter && C.keyCode !== be.Space || y(x[w].key);
600
- }, children: e(A, { sx: { display: "flex", flex: "1 1 100%", flexDirection: "column", overflow: "hidden" }, children: e(Oe, { component: "div", sx: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", fontFamily: () => x[w]?.key }, children: x[w].description }) }) }, w + "" + x[w].key));
601
- }
602
- const h = e(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%" }, ...s, children: e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: b }) });
603
- return Se({ ...g, children: h });
604
- }, [l, o?.state()]);
605
- return e(vt, { ref: i, sx: { ...n }, outlined: !0, disabled: l, parentFloat: c, createPopupPanel: p, createTooltip: ({ children: g }, y) => e(rt, { label: o?.label(), description: o?.description(), disabled: y, children: g }), icon: e(A, { sx: { display: "flex", paddingLeft: "4px", paddingRight: "4px", fontSize: (g) => `${Math.round(g.typography.fontSize)}px`, fontFamily: (g) => g.typography.fontFamily, color: (g) => g.palette.text.secondary, width: f }, children: e(A, { sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "pre" }, children: u }) }), ...s });
606
- })), jp = K(J((r, i) => {
607
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = He(o, ["formatStrikeThroughToggle", "formatSuperscriptToggle", "formatSubscriptToggle"]), a = j(() => {
608
- for (let d = 0; d < m.length; d++) if (m[d]?.state()) return m[d].key();
609
- return m[0]?.key();
610
- }, [m]), s = j(() => {
611
- const d = /* @__PURE__ */ new Map();
612
- return d.set("formatStrikeThroughToggle", P(e(Qr, {}))), d.set("formatSuperscriptToggle", P(e(pc, {}))), d.set("formatSubscriptToggle", P(e(uc, {}))), d;
613
- }, []), u = G((d, f) => {
614
- const p = { variant: ie.Menuitem, commandHook: t, scope: "textEffects", disabled: l }, g = z(se, { children: [e(F, { ...p, command: f.getCommand("formatStrikeThroughToggle"), icon: s.get("formatStrikeThroughToggle") }), e(F, { ...p, command: f.getCommand("formatSuperscriptToggle"), icon: s.get("formatSuperscriptToggle") }), e(F, { ...p, command: f.getCommand("formatSubscriptToggle"), icon: s.get("formatSubscriptToggle") })] });
615
- return Se({ ...d, children: g });
616
- }, [l, t, n]);
617
- return e(Re, { ref: i, quickCommand: a, commands: o, commandHook: t, createPopupPanel: u, label: "Text Effects", tooltip: "Style your text to differentiate it.", icon: s.get(a) ?? P(e(Qr, {})), ...c });
618
- })), Vp = K(J((r, i) => {
619
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = He(o, ["formatUnderlinedToggle", "formatUnderlinedDoubleToggle", "formatUnderlinedAccountingToggle", "formatUnderlinedAccountingDoubleToggle"]), a = j(() => {
620
- for (let d = 0; d < m.length; d++) if (m[d]?.state()) return m[d].key();
621
- return m[0]?.key();
622
- }, [m]), s = j(() => {
623
- const d = /* @__PURE__ */ new Map();
624
- return d.set("formatUnderlinedToggle", P(e(Tn, {}))), d.set("formatUnderlinedDoubleToggle", P(e(ea, {}))), d.set("formatUnderlinedAccountingToggle", P(e(ta, {}))), d.set("formatUnderlinedAccountingDoubleToggle", P(e(oa, {}))), d;
625
- }, []), u = G((d, f) => {
626
- const p = { variant: ie.Menuitem, commandHook: t, scope: "underline", disabled: l }, g = z(se, { children: [e(F, { ...p, command: f.getCommand("formatUnderlinedToggle"), icon: P(e(Tn, {})) }), e(F, { ...p, command: f.getCommand("formatUnderlinedDoubleToggle"), icon: P(e(ea, {})) }), e(F, { ...p, command: f.getCommand("formatUnderlinedAccountingToggle"), commandHook: t, icon: P(e(ta, {})) }), e(F, { ...p, command: f.getCommand("formatUnderlinedAccountingDoubleToggle"), icon: P(e(oa, {})) })] });
627
- return Se({ ...d, children: g });
628
- }, [l, t, n]);
629
- return e(Re, { ref: i, quickCommand: a, commands: o, commandHook: t, label: "Underline", tooltip: "All underline stylings.", createPopupPanel: u, icon: s.get(a) ?? P(e(Tn, {})), ...c });
630
- })), Ai = K(J((r, i) => {
631
- const { command: o, commands: t, commandHook: n, scope: l, includePasteAllInPopup: c = !0, disabled: m = !1, ...a } = r, s = ee((u, d) => {
632
- const f = { variant: ie.Menuitem, commandHook: n, scope: "paste", disabled: m }, p = [];
633
- return c && (p.push(Pe(F, { ...f, command: d.getCommand("paste"), key: "paste", icon: e(na, {}) })), p.push(e(re, { orientation: "horizontal" }, "paste-div"))), p.push(Pe(F, { ...f, command: d.getCommand("pasteValues"), key: "pasteValues", icon: P(e(mc, {})) })), p.push(Pe(F, { ...f, command: d.getCommand("pasteFormats"), key: "pasteFormats", icon: P(e(gc, {})) })), p.push(Pe(F, { ...f, command: d.getCommand("pasteFormulas"), key: "pasteFormulas", icon: P(e(hc, {})) })), p.push(Pe(F, { ...f, command: d.getCommand("pasteTranspose"), key: "pasteTranspose", icon: P(e(fc, {})) })), p.push(Pe(F, { ...f, command: d.getCommand("pasteLinks"), key: "pasteLinks", icon: P(e(bc, {})) })), Se({ ...u, children: p });
634
- }, [m, n, l, c]);
635
- return e(Re, { ref: i, commands: t, commandHook: n, scope: l, createPopupPanel: s, label: "Paste", tooltip: "Add content to the clipboard to your document.", quickCommand: "paste", icon: e(na, {}), ...a });
636
- })), $p = K(J((r, i) => {
637
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, parentFloat: c, ...m } = r, a = He(o, ["sheetViewToggleShowHeadings", "sheetViewToggleShowHeadingColumns", "sheetViewToggleShowHeadingRows"]), s = G((u, d) => {
638
- const f = { variant: ie.Menuitem, parentFloat: u.floatReference, commandHook: t, scope: n, disabled: l }, p = z(se, { children: [e(F, { ...f, command: d.getCommand("sheetViewToggleShowHeadings") }), e(F, { ...f, command: d.getCommand("sheetViewToggleShowHeadingsNumeric") }), e(re, { orientation: "horizontal" }), e(F, { ...f, command: d.getCommand("sheetViewToggleShowHeadingColumns") }), e(F, { ...f, command: d.getCommand("sheetViewToggleShowHeadingRows") })] });
639
- return Se({ ...u, children: p });
640
- }, [l, t, n]);
641
- return e(Re, { ref: i, parentFloat: c, quickCommand: a[0]?.key(), commands: o, commandHook: t, createPopupPanel: s, label: "Headings", tooltip: "Configure how the column and rows headings in the sheet are displayed.", icon: e(eo, { command: a[0], scope: "view" }), ...m });
642
- })), _p = K(J((r, i) => {
643
- const { commands: o, commandHook: t, scope: n = "view", disabled: l = !1, ...c } = r, m = G((a) => {
644
- const s = { variant: ie.Menuitem, parentFloat: a.floatReference, commandHook: t, scope: n, disabled: l }, u = z(se, { children: [e(F, { ...s, command: o.getCommand("workbookViewToggleShowFormulaBar") }), e(F, { ...s, command: o.getCommand("workbookViewToggleShowTabs") }), e(F, { ...s, command: o.getCommand("workbookViewToggleShowStatusBar") }), e(re, { orientation: "horizontal" }), e(F, { ...s, command: o.getCommand("workbookViewToggleShowHorizontalScrollBar") }), e(F, { ...s, command: o.getCommand("workbookViewToggleShowVerticalScrollBar") })] });
645
- return Se({ ...a, children: u });
646
- }, [l, o, t, n]);
647
- return e(Re, { ref: i, commands: o, disabled: l, commandHook: t, scope: n, label: "Workbook View", tooltip: "Options to configure how the workbook is displayed.", createPopupPanel: m, icon: e(eo, { icon: null, label: "Workbook View" }), ...c });
648
- })), Bi = K(J((r, i) => {
649
- const { value: o, cellStyle: t, styles: n, createTemporaryCell: l, bodyStyle: c, sx: m, borderProps: a, disabled: s, ...u } = r, d = j(() => l({ value: o, style: t }), [o, t, l]), f = j(() => d.getStyle(), [d, c]), p = j(() => f.getFill().toCSS(c?.darkMode ?? !1), [f]), g = f.getInsets(), y = f.getFont(), x = G(() => f.getBorder(), [f]);
650
- return e(A, { ref: i, sx: { width: "100px", textOverflow: "ellipsis", display: "flex", alignItems: "stretch", background: c?.fill, filter: s ? "grayscale(0.4) opacity(0.8);" : "none", "& .fill": { flex: "1 1 100%", overflow: "hidden", ...p }, "& .text": { flex: "1 1 100%", ...y.toCSS(c?.darkMode ?? !1, 1), boxSizing: "border-box", padding: `${g.top}px ${g.right}px ${g.bottom}px ${g.left}px`, margin: "0px", outline: "none", resize: "none", overflow: "hidden", textOverflow: "ellipsis", verticalAlign: "baseline", textDecoration: y.toCSS().textDecoration, textAlign: ms.toCSSHorizontalTextAlign(d.getRenderHorizontalAlignment()), background: "transparent", maxHeight: "100%", whiteSpace: "pre", wordWrap: "break-word" }, ...m }, ...u, children: e(gr, { getBorderAt: x, darkMode: c?.darkMode ?? !1, rowCount: 1, columnCount: 1, style: { display: "flex", flex: "1 1 100%", width: "100%", maxWidth: "100%", justifyContent: "start", alignItems: "stretch", ...a?.style }, ...a, children: e(A, { className: "fill", sx: { paddingLeft: "4px", paddingRight: "4px", marginLeft: "-1px", marginTop: "-1px", marginRight: "-1px", marginBottom: "-1px", overflow: "hidden", display: "flex", alignItems: "center" }, children: e(A, { className: "text", children: o }) }) }) });
651
- })), Up = K((r) => {
652
- const { styles: i, namedStyle: o, selectedNamed: t, hasContextMenu: n = !0, bodyStyle: l, onSelectNamed: c, createTemporaryCell: m, parentFloat: a, commands: s, disabled: u, commandHook: d, ...f } = r, p = G((x) => {
653
- const b = { variant: ie.Menuitem, commandHook: d, context: "cellStyle" }, h = z(se, { children: [e(F, { ...b, sx: { fontWeight: 550 }, command: s.getCommand("formatCellStyle"), commandState: o, disabled: u, icon: P(e(Ro, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...b, command: s.getCommand("modifyCellStyle"), commandState: { named: o } }), e(F, { ...b, command: s.getCommand("deleteCellStyle"), commandState: o, disabled: u || o?.getName() === pe.BuiltInName.Normal })] });
654
- return Se({ ...x, children: e(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, children: e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: h }) }) });
655
- }, []), g = o?.getName() === t?.getName();
656
- let y = e(bt, { sx: { borderRadius: "2px", padding: "2px", margin: "0px 0px", display: "flex", border: (x) => `solid ${g ? x.palette.primary.dark : "transparent"} 1px` }, tooltipProps: { label: o.getName(), placement: "bottom-start" }, disabled: u, icon: null, onClick: () => {
657
- c?.(o);
658
- }, ...f, children: e(Bi, { value: o.getName(), cellStyle: { named: o.getName() }, styles: i, createTemporaryCell: m, bodyStyle: l }) }, o.getName());
659
- return n && (y = e(bi, { label: o.getName(), parentFloat: a, createPopupPanel: p, children: y })), y;
660
- }), Gp = K(J((r, i) => {
661
- const { commands: o, command: t, commandHook: n, selectedNamed: l, onSelectNamed: c, disabled: m = !1, bodyStyle: a, usePreviewIcon: s = !0, ...u } = r;
662
- Ht(t);
663
- const d = t?.context(), f = d?.styles, p = l ?? d?.named(), g = a ?? d?.bodyStyle(), y = ee((v) => {
664
- c?.(v), t?.execute(v, n);
665
- }, [t, c, n]), x = G((v, C) => {
666
- const k = { onSelectNamed: y, styles: f(), parentFloat: v.floatReference }, T = f().getCustomNamed(), M = /* @__PURE__ */ new Map(), N = [];
667
- for (let D = 0; D < T.length; D++) M.set(T[D].getName(), T[D]), f().getNamed(T[D].getName()).getBuiltInID() === null && N.push(T[D].getName());
668
- const B = (D) => {
669
- let E = M.get(D);
670
- return E || (E = f().getNamed(D)), !E || E.isHidden() ? null : e(Up, { namedStyle: E, selectedNamed: p, bodyStyle: d.bodyStyle(), createTemporaryCell: d.createTemporaryCell, commands: o, commandHook: n, ...k }, D);
671
- }, R = (D, E, Y = !0) => {
672
- const Z = [];
673
- for (let X = 0; X < E.length; X++) {
674
- const _ = B(E[X]);
675
- _ && Z.push(_);
676
- }
677
- return Z.length === 0 ? null : z(A, { children: [Y ? e(re, { orientation: "horizontal" }) : null, e(to, { children: D }, D + "-header"), e(A, { sx: { display: "flex", gap: "2px", marginBottom: "6px", flexWrap: "wrap", width: "646px", maxWidth: "100%" }, children: Z }, D + "-presets")] }, D);
678
- }, S = (D, E) => {
679
- const Y = [];
680
- for (let Z = 0; Z < E.length; Z++) {
681
- const X = B(E[Z]);
682
- X && Y.push(X);
683
- }
684
- return Y.length === 0 ? null : e(A, { sx: { display: "flex", gap: "2px", marginBottom: "6px", flexWrap: "wrap", flexDirection: "column", flex: "0 0 0%" }, children: Y }, D + "-presets");
685
- }, I = [];
686
- I.push(R("Custom", N, !1)), I.push(R("Good, Bad and Neutral", [pe.BuiltInName.Normal, pe.BuiltInName.Bad, pe.BuiltInName.Good, pe.BuiltInName.Neutral], N.length > 0)), I.push(R("Data and Model", [pe.BuiltInName.Calculation, pe.BuiltInName.CheckCell, pe.BuiltInName.ExplanatoryText, pe.BuiltInName.FollowedHyperlink, pe.BuiltInName.Hyperlink, pe.BuiltInName.Input, pe.BuiltInName.LinkedCell, pe.BuiltInName.Note, pe.BuiltInName.Output, pe.BuiltInName.WarningText])), I.push(R("Titles and Headings", [pe.BuiltInName.Heading1, pe.BuiltInName.Heading2, pe.BuiltInName.Heading3, pe.BuiltInName.Heading4, pe.BuiltInName.Title, pe.BuiltInName.Total]));
687
- let L = [];
688
- var O, $;
689
- return L.push(S("Accent 1", [pe.BuiltInName.Accent1_20, pe.BuiltInName.Accent1_40, pe.BuiltInName.Accent1_60, pe.BuiltInName.Accent1])), L.push(S("Accent 2", [pe.BuiltInName.Accent2_20, pe.BuiltInName.Accent2_40, pe.BuiltInName.Accent2_60, pe.BuiltInName.Accent2])), L.push(S("Accent 3", [pe.BuiltInName.Accent3_20, pe.BuiltInName.Accent3_40, pe.BuiltInName.Accent3_60, pe.BuiltInName.Accent3])), L.push(S("Accent 4", [pe.BuiltInName.Accent4_20, pe.BuiltInName.Accent4_40, pe.BuiltInName.Accent4_60, pe.BuiltInName.Accent4])), L.push(S("Accent 5", [pe.BuiltInName.Accent5_20, pe.BuiltInName.Accent5_40, pe.BuiltInName.Accent5_60, pe.BuiltInName.Accent5])), L.push(S("Accent 6", [pe.BuiltInName.Accent6_20, pe.BuiltInName.Accent6_40, pe.BuiltInName.Accent6_60, pe.BuiltInName.Accent6])), I.push((O = "Themed Cell Styles", $ = L, z(A, { children: [e(re, { orientation: "horizontal" }), e(to, { children: O }, O + "-header"), e(A, { sx: { display: "flex", gap: "2px", flexWrap: "wrap", alignItems: "start", flexDirection: "row" }, children: $ }, O + "-presets")] }, O))), I.push(R("Number Format", [pe.BuiltInName.Comma, pe.BuiltInName.Comma0, pe.BuiltInName.Currency, pe.BuiltInName.Currency0, pe.BuiltInName.Percent])), z(A, { sx: { display: "flex", flexDirection: "column", maxWidth: "100%", paddingTop: (D) => `${D.shape.borderRadius}px`, paddingBottom: (D) => `${D.shape.borderRadius}px` }, children: [e(A, { onContextMenu: () => {
690
- }, sx: { display: "flex", flexDirection: "column", paddingTop: "6px", paddingBottom: "0px", paddingLeft: "16px", paddingRight: "16px" }, children: I }), e(re, { orientation: "horizontal" }), e(F, { variant: ie.Menuitem, commandState: p, command: C.getCommand("newCellStyle"), context: "styles", commandHook: n, disabled: m, icon: P(e(xc, {})) })] });
691
- }, [p, f?.().getTheme(), g]), b = ee((v) => {
692
- const C = 18 / Bt.getDeviceScale(), k = d?.createTemporaryCell(v);
693
- return k.getStyle().getFont().getSize() <= C ? k : k.createTemporaryCell({ style: { font: { size: C } } });
694
- }, [d?.createTemporaryCell]), h = m || !t || t.disabled(), w = j(() => d && s ? e(Bi, { value: p?.getName() ?? "Custom", cellStyle: p ? { named: p.getName() } : void 0, styles: d.styles(), createTemporaryCell: b, bodyStyle: d.bodyStyle(), className: "outline-hover", disabled: h, sx: { maxHeight: "24px", height: "24px", marginRight: "2px", outline: (v) => `1px solid ${v.palette.action.hover}` }, borderProps: {} }) : P(e(Ro, {})), [p, g, h]);
695
- return e(Re, { ref: i, createPopupPanel: x, outlined: s, commands: o, createTooltip: ({ children: v }, C) => e(rt, { label: t?.label(), description: t?.description(), disabled: C, children: v }), selected: !1, disabled: h, label: t?.label(), icon: w, ...u });
696
- })), Li = "_sheetxl-reset_ods65_1", qp = 10, Xp = K(J((r, i) => {
697
- const { styles: o, table: t, tableStyle: n = t?.getStyle() ?? o.getDefaultTableStyle(), bodyStyle: l, sx: c, disabled: m, className: a, forceThinBorder: s, cellHeight: u = qp, isLive: d = !1, ...f } = r, p = Math.ceil(1.3 * u), [g, y] = rr((v) => v + 1, 0);
698
- me(() => {
699
- if (d && t) return t.addListeners({ onAnyChange: () => {
700
- y();
701
- } });
702
- }, [t, d]);
703
- const x = j(() => {
704
- let v = t?.toJSON() ?? {};
705
- const C = { rowStart: 0, colStart: 0, rowEnd: 4, colEnd: 4 };
706
- return v && (v.styleOptions = { ...v.styleOptions, name: n.getName() }), v.ref = C, new or({ initialAnchor: C, json: v, styles: o });
707
- }, [g, t, n, o]), b = j(() => {
708
- const v = [];
709
- for (let C = 0; C < 5; C++) for (let k = 0; k < 5; k++) {
710
- const T = x.getStyleAt({ colIndex: k, rowIndex: C });
711
- v.push(T);
712
- }
713
- return v;
714
- }, [x]), h = j(() => {
715
- const v = (k, T, M) => {
716
- let N = M.getFill().toCSS(l?.darkMode ?? !1);
717
- const B = p - (T < 4 ? 1 : 0), R = u - (k < 4 ? 1 : 0), S = M.getFont().getFill().toCSS(l?.darkMode ?? !1);
718
- return N = { ...N, position: "absolute", boxSizing: "border-box", left: T * (p - 1), top: k * (u - 1), width: B, height: R }, e("td", { className: `table-style-fill ${k}-${T}`, style: N, children: e("div", { className: `table-style-text ${k}-${T}`, style: { position: "absolute", boxSizing: "border-box", width: "6px", left: (B - 6) / 2, top: (R - 1) / 2, borderTop: `1px solid ${S}` } }) }, `${k}-${T}`);
719
- }, C = [];
720
- for (let k = 0; k < 5; k++) {
721
- const T = [];
722
- for (let M = 0; M < 5; M++) {
723
- const N = b[5 * k + M];
724
- T.push(v(k, M, N));
725
- }
726
- C.push(e("tr", { children: T }, k));
727
- }
728
- return C;
729
- }, [x, n, l]), w = G((v, C) => b[C].getBorder() ?? null, [b]);
730
- return e(A, { ref: i, className: "table-format-preview", sx: { background: l?.fill, filter: m ? "grayscale(0.4) opacity(0.8);" : "none", "& .styled-element": { position: "absolute" }, ...c }, ...f, children: e(gr, { getBorderAt: w, rowCount: 5, columnCount: 5, forceThinBorder: s, width: 5 * (p - 1) + 1, height: 5 * (u - 1) + 1, darkMode: l?.darkMode ?? !1, style: { pointerEvents: "none" }, children: e("table", { className: Ae(a, "sheetxl-table-preview", Li), style: { borderCollapse: "collapse", width: 5 * (p - 1) + 1, height: 5 * (u - 1) + 1 }, children: e("tbody", { children: h }) }) }) });
731
- })), po = (r, i, o, t, n) => {
732
- r.beginPath(), r.moveTo(i + 0.5, o + 0.5), r.lineTo(t + 0.5, n + 0.5), r.stroke();
733
- }, Kp = K(J((r, i) => {
734
- const { table: o, tableStyle: t, styles: n, bodyStyle: l, disabled: c, style: m, className: a, canvas: s, ...u } = r, d = j(() => {
735
- const g = o.toJSON(), y = { rowStart: 0, colStart: 0, rowEnd: 4, colEnd: 4 };
736
- return g.styleOptions = { ...g.styleOptions, name: t.getName() }, g.ref = y, new or({ initialAnchor: y, json: g, styles: n });
737
- }, [o, t, n]), f = j(() => {
738
- const g = [];
739
- for (let y = 0; y < 5; y++) for (let x = 0; x < 5; x++) {
740
- const b = d.getStyleAt({ colIndex: x, rowIndex: y });
741
- g.push(b);
742
- }
743
- return g;
744
- }, [d]), p = j(() => {
745
- let g = s;
746
- if (s || (g = document.createElement("canvas")), !g) return null;
747
- g.width !== 61 && (g.width = 61), g.height !== 46 && (g.height = 46);
748
- const y = g.getContext("2d", { alpha: !1 });
749
- if (!y) return null;
750
- const x = 12, b = l?.darkMode ?? !1;
751
- for (let h = 0; h < 5; h++) for (let w = 0; w < 5; w++) {
752
- const v = f[5 * h + w].getFill();
753
- let C = l?.fill;
754
- v.getType() === kn.Type.Solid ? C = v.getColor().toCSS(b, !1) : v.getType() === kn.Type.Gradient ? C = v.getStops[0]?.color.toCSS(b, !1) : v.getType() === kn.Type.Pattern && (C = v.getForeground().toCSS(b, !1)), y.fillStyle = C;
755
- const k = w * x, T = 9 * h;
756
- y.fillRect(k, T, 13, 10);
757
- }
758
- y.lineWidth = 1;
759
- for (let h = 0; h < 5; h++) for (let w = 0; w < 5; w++) {
760
- const v = f[5 * h + w], C = w * x, k = 9 * h, T = v.getBorder();
761
- if (!T.isEmpty()) {
762
- const B = T.getLeft();
763
- B.isNone() || (y.strokeStyle = B.getColor().toCSS(b, !1), po(y, C, k, C, k + 9));
764
- const R = T.getTop();
765
- R.isNone() || (y.strokeStyle = R.getColor().toCSS(b, !1), po(y, C, k, C + x, 9 * h));
766
- const S = T.getRight();
767
- S.isNone() || (y.strokeStyle = S.getColor().toCSS(b, !1), po(y, C + x, k, C + x, k + 9));
768
- const I = T.getBottom();
769
- I.isNone() || (y.strokeStyle = I.getColor().toCSS(b, !1), po(y, C, k + 9, C + x, k + 9));
770
- }
771
- y.strokeStyle = v.getFont().getFill().toCSS(b, !1);
772
- const M = 4, N = 2.5;
773
- po(y, w * x + N, 9 * h + M, w * x + N + 7, 9 * h + M);
774
- }
775
- return `url(${g.toDataURL()})`;
776
- }, [s, d, t, l]);
777
- return e("div", { ref: i, className: Ae("table-style-preview", a), style: { backgroundImage: p, width: 61, height: 46, ...m }, ...u });
778
- })), zm = K(J((r, i) => {
779
- const { styleOptions: o, onStyleOptionsChange: t, showHeaderRow: n, onShowHeaderRowChange: l, showTotalRow: c, onShowTotalRowChange: m, showFilterButton: a, onShowFilterButtonChange: s, sx: u, disabled: d, ...f } = r;
780
- return z(A, { sx: { display: "flex", flexDirection: "column", flexWrap: "wrap", userSelect: "none", pt: 1, pb: 1, "& .MuiFormControlLabel-root": { marginLeft: (p) => `${p.spacing(2)}`, marginRight: (p) => `${p.spacing(2)}` }, "& .MuiCheckbox-root": { padding: (p) => `${p.spacing(0.5)}` }, ...u }, ...f, ref: i, children: [l && e(Et, { control: e(Dt, { checked: n ?? !1, indeterminate: n == null, onChange: () => l(!n), disabled: d || n == null }), label: "Header Row", labelPlacement: "end" }), m && e(Et, { control: e(Dt, { checked: c ?? !1, indeterminate: c == null, onChange: () => m(!c), disabled: d || c == null }), label: "Total Row", labelPlacement: "end" }), e(Et, { control: e(Dt, { checked: o?.showRowStripes ?? !1, indeterminate: !o, disabled: d || !o, onChange: () => {
781
- t?.({ ...o, showRowStripes: !o?.showRowStripes });
782
- } }), label: "Banded Rows", labelPlacement: "end" }), e(Et, { control: e(Dt, { checked: o?.showFirstColumn ?? !1, indeterminate: !o, disabled: d || !o, onChange: () => {
783
- t?.({ ...o, showFirstColumn: !o?.showFirstColumn });
784
- } }), label: "First Column", labelPlacement: "end" }), e(Et, { control: e(Dt, { checked: o?.showLastColumn ?? !1, indeterminate: !o, disabled: d || !o, onChange: () => {
785
- t?.({ ...o, showLastColumn: !o?.showLastColumn });
786
- } }), label: "Last Column", labelPlacement: "end" }), e(Et, { control: e(Dt, { checked: o?.showColumnStripes ?? !1, indeterminate: !o, disabled: d || !o, onChange: () => {
787
- t?.({ ...o, showColumnStripes: !o?.showColumnStripes });
788
- } }), label: "Banded Columns", labelPlacement: "end" }), s && e(Et, { control: e(Dt, { checked: a ?? !1, indeterminate: a == null, disabled: d || !o || a == null, onChange: () => s(!a) }), label: "Filter Button", labelPlacement: "end" })] });
789
- })), Yp = K((r) => {
790
- const { table: i, tableStyle: o, selectedTableStyleName: t, onSelectTableStyleName: n, styles: l, hasContextMenu: c = !0, bodyStyle: m, parentFloat: a, commands: s, disabled: u, commandHook: d, useCanvasPreview: f = !0, canvas: p, ...g } = r, y = G((w) => {
791
- const v = { variant: ie.Menuitem, commandHook: d, context: "table" }, C = z(se, { children: [e(F, { ...v, command: s.getCommand("formatTableStyleClearCellStyles"), commandState: o, disabled: u, icon: P(e(Ro, {})) }), e(F, { ...v, sx: { fontWeight: 550 }, command: s.getCommand("formatTableStyle"), commandState: { name: o.getName() }, disabled: u, icon: P(e(Ro, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...v, command: s.getCommand("setDefaultTableStyle"), commandState: o.getName(), disabled: u }), e(re, { orientation: "horizontal" }), e(F, { ...v, command: s.getCommand("deleteTableStyle"), commandState: o?.getName(), disabled: u || !o || o.isBuiltIn() })] });
792
- return Se({ ...w, children: e(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, children: e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: C }) }) });
793
- }, [s]), x = o?.getName() === t, b = j(() => {
794
- const w = { table: i, tableStyle: o, styles: l, bodyStyle: m };
795
- return f ? e(Kp, { canvas: p, ...w }) : e(Xp, { ...w });
796
- }, [i, o, l, m]);
797
- let h = e(bt, { sx: { borderRadius: "2px", padding: "2px", margin: "0px 0px", display: "flex", border: (w) => `solid ${x ? w.palette.primary.dark : "transparent"} 1px` }, tooltipProps: { label: o.getName() ?? "None", placement: "bottom-start" }, disabled: u, icon: null, onClick: () => {
798
- n?.(o?.getName());
799
- }, ...g, children: b }, o.getName());
800
- return c && (h = e(bi, { label: i.getStyleOptions().name, parentFloat: a, createPopupPanel: y, children: h })), h;
801
- }), Zp = K(J((r, i) => {
802
- const { commands: o, command: t, commandHook: n, selectedTable: l, onSelectTableStyleName: c, disabled: m = !1, bodyStyle: a, usePreviewIcon: s = !1, ...u } = r;
803
- Ht(t);
804
- const d = t?.context(), f = d?.styles, p = l ?? d?.table?.();
805
- let g = "insertTable";
806
- p && (g = "editTable");
807
- const y = j(() => ((N, B) => {
808
- const R = { rowStart: 0, colStart: 0, rowEnd: 4, colEnd: 4 };
809
- return new or({ initialAnchor: R, styles: B, json: { name: "PreviewTable", ref: R, description: "PreviewTable", headerRowCount: 1, totalsRowCount: 0, styleOptions: N } });
810
- })(p?.getStyleOptions(), f?.()), [f?.().getDefaultTableStyle(), p?.getStyleOptions()]), x = p ?? y, [b, h] = U(x);
811
- me(() => {
812
- h(x);
813
- }, [x]);
814
- const w = a ?? d?.bodyStyle(), v = ee((N) => {
815
- c?.(N), t?.execute({ name: N }, n);
816
- }, [t, c, n]), C = we(null), k = G((N, B) => {
817
- const R = { onSelectTableStyleName: v, styles: f(), parentFloat: N.floatReference };
818
- C.current || (C.current = document.createElement("canvas"));
819
- const S = (X) => {
820
- const _ = f().getTableStyle(X);
821
- return _ ? e(Yp, { table: b, tableStyle: _, selectedTableStyleName: b.getStyleOptions().name, bodyStyle: d.bodyStyle(), commands: B, commandHook: n, canvas: C.current, ...R }, X) : null;
822
- }, I = (X, _, ne = !0) => {
823
- const ae = [];
824
- for (let q = 0; q < _.length; q++) {
825
- const W = S(_[q]);
826
- W && ae.push(W);
827
- }
828
- return ae.length === 0 ? null : z(A, { children: [ne ? e(re, { orientation: "horizontal" }) : null, e(to, { children: X }, X + "-header"), e(A, { sx: { display: "flex", gap: "2px", marginBottom: "6px", flexWrap: "wrap", width: "481px", maxWidth: "100%" }, children: ae }, X + "-presets")] }, X);
829
- }, L = [], O = f().getCustomTableStyles(), $ = [];
830
- if (O.length > 0) {
831
- for (let X = 0; X < O.length; X++) O[X].isShownInTableStyles() && $.push(O[X].getName());
832
- L.push(I("Custom", $, !1));
833
- }
834
- const D = [];
835
- p && !p.getStyleOptions().name && D.push(null);
836
- for (let X = 0; X < 21; X++) D.push("TableStyleLight" + (X + 1));
837
- L.push(I("Light", D, $.length > 0));
838
- const E = [];
839
- for (let X = 0; X < 28; X++) E.push("TableStyleMedium" + (X + 1));
840
- L.push(I("Medium", E));
841
- const Y = [];
842
- for (let X = 0; X < 11; X++) Y.push("TableStyleDark" + (X + 1));
843
- L.push(I("Dark", Y));
844
- let Z = null;
845
- return p && (Z = z(se, { children: [e(re, { orientation: "horizontal" }), e(F, { variant: ie.Menuitem, command: B.getCommand("formatTableStyleClearTableStyle"), commandHook: n, disabled: m, icon: P(e(gi, {})) })] })), z(A, { sx: { display: "flex", flexDirection: "column", maxWidth: "100%", paddingTop: (X) => `${X.shape.borderRadius}px`, paddingBottom: (X) => `${X.shape.borderRadius}px` }, children: [e(A, { onContextMenu: () => {
846
- }, sx: { display: "flex", flexDirection: "column", padding: "6px 16px" }, children: L }), Z] });
847
- }, [f, f?.().getTheme(), w, b]), T = m || !t || t.disabled(), M = j(() => {
848
- if (!d || !s) return P(e(Ro, {}));
849
- }, [b, w, T]);
850
- return e(Re, { ref: i, quickCommand: g, createPopupPanel: k, commands: o, label: t?.label(), commandState: p, commandHook: n, selected: p !== null, createTooltip: ({ children: N }, B) => e(rt, { label: t?.label(), description: t?.description(), disabled: B, children: N }), disabled: T, icon: M, ...u });
851
- })), Je = [];
852
- Je.push(ot("Primary Background", "bg1")), Je.push(ot("Primary Text", "tx1")), Je.push(ot("Secondary Background", "bg2")), Je.push(ot("Secondary Text", "tx2")), Je.push(ot("Accent 1", "accent1")), Je.push(ot("Accent 2", "accent2")), Je.push(ot("Accent 3", "accent3")), Je.push(ot("Accent 4", "accent4")), Je.push(ot("Accent 5", "accent5")), Je.push(ot("Accent 6", "accent6"));
853
- const Jp = (r) => {
854
- const { docTheme: i, onSelectTheme: o, darkMode: t, isSelected: n, outlined: l, sx: c, ...m } = r, a = at(), s = j(() => {
855
- let u = [];
856
- for (let d = 0; d < Je.length; d++) {
857
- const f = Je[d];
858
- u.push(e(fr, { schemeColorLookup: i.schemeLookup(), colorDef: f, darkMode: t, selectedColor: null }, d + "-colorDef"));
859
- }
860
- return e(A, { sx: { display: "flex", flexDirection: "row", flex: "none" }, children: e(A, { sx: { display: "flex", boxShadow: (d) => d.shadows[2] }, children: u }) });
861
- }, [i, a]);
862
- return e(bt, { sx: { borderRadius: "2px", padding: "2px", margin: "0px 0px", display: "flex", border: (u) => `solid ${n ? u.palette.text.primary : "transparent"} 1px`, "&:hover:not([disabled])": { border: (u) => `solid ${u.palette.text.primary} 1px !important` } }, icon: null, ...m, children: z(A, { sx: { border: (u) => `solid ${u.palette.divider} 1px`, minWidth: "200px", borderRadius: "2px", padding: "4px 4px", textAlign: "left", display: "flex", gap: "4px", flexDirection: "column", alignItems: "stretch", color: (u) => n ? u.palette.text.primary : void 0, "&:hover:not([disabled])": { color: (u) => u.palette.text.primary } }, children: [e(A, { sx: {}, children: i.getName() }), z(A, { sx: { paddingTop: "6px", paddingLeft: "12px", paddingRight: "12px", display: "flex", flexDirection: "column", alignItems: "stretch" }, children: [s, e(A, { sx: { flex: "1 1 100%", textOverflow: "ellipsis", overflow: "hidden", marginTop: "2px", whiteSpace: "pre", fontFamily: () => i.getFontScheme().getMajorFont() }, children: e(At, { disableInteractive: !0, PopperProps: { style: { pointerEvents: "none" }, disablePortal: !0, popperOptions: { strategy: "fixed", modifiers: [{ name: "preventOverflow", enabled: !0, options: { boundariesElement: "viewport" } }] } }, title: e("div", { style: { textOverflow: "ellipsis", overflow: "hidden", whiteSpace: "pre" }, children: `The font used for the body.
863
- The heading font is '${i.getFontScheme().getMajorFont()}'.` }), placement: "bottom-start", children: e("div", { children: i.getFontScheme().getMinorFont() }) }) })] })] }) });
864
- }, Qp = K(J((r, i) => {
865
- const { themes: o, selectedTheme: t, onSelectTheme: n, sx: l, disabled: c = !1, darkMode: m, ...a } = r, s = j(() => {
866
- const u = o?.getItems({ selected: t }) ?? [], d = [];
867
- if (u.length === 0) return e(to, { sx: { paddingLeft: "16px", paddingRight: "16px", paddingTop: "6px", paddingBottom: "6px" }, children: "No themes" });
868
- const f = u.length;
869
- for (let p = 0; p < f; p++) {
870
- const g = u[p], y = t && g?.getName() === t.getName(), x = u[p + 1];
871
- x && x.isCustom() !== g.isCustom() && d.push(e(re, { orientation: "horizontal", sx: { marginBottom: "4px" } }, `divider-${p}`)), d.push(e(Jp, { docTheme: g, onSelectTheme: () => n(g), isSelected: y, disabled: c, darkMode: m, onMouseDown: (b) => {
872
- b.button === 0 && b.preventDefault();
873
- }, onMouseUp: (b) => {
874
- b.button === 0 && n(g);
875
- }, onKeyDown: (b) => {
876
- b.keyCode !== be.Enter && b.keyCode !== be.Space || n(g);
877
- } }, g.getName()));
878
- }
879
- return d;
880
- }, [t, n, m]);
881
- return e(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%" }, ref: i, ...a, children: z(A, { sx: { display: "flex", flexDirection: "column", overflow: "hidden" }, children: [e(to, { sx: { paddingLeft: "16px", paddingRight: "16px", paddingTop: "4px", paddingBottom: "2px" }, children: "Themes" }), e(re, {}), e(A, { sx: { flex: "1 1 100%", overflow: "auto", padding: "6px 16px" }, children: s })] }) });
882
- })), eu = K(J((r, i) => {
883
- const { themes: o, selectedTheme: t, onSelectTheme: n, icon: l, tooltip: c, label: m, variant: a = nt.Toolbar, darkMode: s, panelProps: u, ...d } = r, f = l || P(e(xi, {})), p = G((y) => {
884
- const { closeFloatAll: x } = y;
885
- return e(Qp, { ...u, themes: o, selectedTheme: t, onSelectTheme: n, darkMode: s, onKeyDown: (b) => {
886
- b.which === be.Enter && x();
887
- } });
888
- }, [o, t, n, u, s]), g = { createPopupPanel: p, tooltip: c || m || "Theme", label: m, icon: f, ...d };
889
- return a === nt.Toolbar ? e(vt, { ref: i, ...g }) : e(sr, { ref: i, ...g });
890
- })), tu = K(J((r, i) => {
891
- const { command: o, commandHook: t, selectedTheme: n, onSelectTheme: l, disabled: c = !1, darkMode: m, label: a, icon: s, variant: u, ...d } = r;
892
- Ht(o);
893
- const f = o?.context()?.themes, p = n || o?.context()?.theme, g = m ?? o?.context()?.darkMode, y = c || o?.disabled(), x = ee((h) => {
894
- l?.(h), o?.execute(h, t);
895
- }, [l, t]), b = G((h, w) => {
896
- const { children: v, title: C, ...k } = h;
897
- let T = h.children;
898
- return (y || w) && (T = e("div", { children: T })), e(dr, { command: o, placement: u === ie.Toolbar ? "bottom-start" : "right-start", disabled: y || w, ...k, children: T });
899
- }, [o, y]);
900
- return e(eu, { ref: i, themes: f, selectedTheme: p, onSelectTheme: x, variant: u === ie.Menuitem ? nt.Menuitem : nt.Toolbar, createTooltip: b, disabled: y, darkMode: g, icon: P(e(xi, {})), ...d });
901
- })), ou = K(J((r, i) => {
902
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = He(o, ["themeMode"])[0], a = m?.state(), s = m?.state() !== null, u = Ss("(prefers-color-scheme: dark)"), d = a === "dark" || a === null && u, f = ee((p, g) => {
903
- const y = { variant: ie.Menuitem, commandHook: t, scope: "appearance", disabled: l }, x = z(se, { children: [e(F, { ...y, command: m, icon: P(e(d ? pa : ua, {})) }), e(F, { ...y, command: g.getCommand("defaultThemeMode"), icon: P(e(u ? yc : wc, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...y, command: g.getCommand("enableDarkGrid") }), e(F, { ...y, command: g.getCommand("enableDarkImages") })] });
904
- return Se({ ...p, children: x });
905
- }, [l, m, t, n, u, a, s]);
906
- return e(Re, { ref: i, quickCommand: "themeMode", commands: o, commandHook: t, createPopupPanel: f, label: "Appearance", tooltip: "Change the light/dark mode to match your viewing preference. This does not affect the view for others.", onQuickClick: () => {
907
- m?.execute(d ? "light" : "dark", t);
908
- }, selected: s, icon: P(e(d ? pa : ua, {})), ...c });
909
- })), nu = K(J((r, i) => {
910
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, sx: c, ...m } = r, a = G((s, u) => {
911
- const d = { variant: ie.Menuitem, scope: "help", commandHook: { ...t, beforeExecute: (p, g) => t?.beforeExecute?.(p, g) !== !1 && s.floatReference.closeAll() }, disabled: l }, f = z(se, { children: [e(F, { ...d, command: u.getCommand("showKeyboardShortcuts"), icon: P(e(qd, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...d, command: u.getCommand("gotoUrlGithub"), icon: P(e(Sc, {})) }), e(F, { ...d, command: u.getCommand("gotoUrlDiscord"), icon: P(e(vc, {})) }), e(F, { ...d, command: u.getCommand("gotoUrlDocumentation"), icon: P(e(yi, {})) }), e(F, { ...d, command: u.getCommand("gotoUrlIssue"), icon: P(e(Cc, {})) })] });
912
- return Se({ ...s, children: f });
913
- }, [l, t]);
914
- return e(Re, { ref: i, sx: c, commands: o, disabled: l, commandHook: t, scope: n, label: "Help", tooltip: "Help, feedback, and keyboard shortcuts.", createPopupPanel: a, icon: P(e(kc, { sx: { transform: "scale(0.75)" } })), ...m });
915
- })), Hi = K(J((r, i) => {
916
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, preferSingleMenu: c = !0, showQuickButton: m = !0, variant: a = ie.Toolbar, ...s } = r, u = He(o, ["insertImageFromFile", "insertImageFromURL"]), { singleMenuCommand: d, allDisabled: f } = j(() => {
917
- let g = null, y = 0;
918
- for (let x = 0; x < u.length; x++) u[x] && !u[x]?.disabled() && (c && a === ie.Menuitem && (g = y === 0 ? u[x] : null), y++);
919
- return { singleMenuCommand: g, allDisabled: y === 0 };
920
- }, [u]), p = G((g, y) => {
921
- const x = { variant: ie.Menuitem, commandHook: t, scope: "insertImage", disabled: l }, b = z(se, { children: [e(F, { ...x, command: y.getCommand("insertImageFromFile"), icon: P(e(Wo, {})) }), e(F, { ...x, command: y.getCommand("insertImageFromURL"), icon: P(e(Wo, {})) })] });
922
- return Se({ ...g, children: b });
923
- }, [l, t, n]);
924
- return d ? e(F, { ref: i, variant: a, commandHook: t, disabled: l, command: d, icon: P(e(Wo, {})), ...s }) : e(Re, { ref: i, variant: a, quickCommand: "insertImageFromFile", commands: o, commandHook: t, scope: n, disabled: l || f, tooltip: "Insert a picture from the web to complement your data.", createPopupPanel: p, icon: P(e(Wo, {})), ...s });
925
- })), br = K(J((r, i) => {
926
- const { command: o, ...t } = r, n = un(), [l, c] = U(!1), [m, a] = U("info");
927
- return me(() => {
928
- const s = n.getMode();
929
- c(s?.key === "copy" || s?.key === "cut"), a(s?.key === "cut" ? "warning" : "info");
930
- }, [n]), e(F, { ref: i, command: o, icon: P(e(Tc, { isWalking: l, themedType: m })), ...t });
931
- })), ru = K(J((r, i) => {
932
- const { ...o } = r;
933
- return e(ct, { ref: i, ...o, popupCommandKeys: ["insertFunctionSum", "insertFunctionAverage", "insertFunctionCount", "insertFunctionMax", "insertFunctionMin", null, "insertFunction"], quickCommand: "insertFunctionSum", popupScope: "insertFunction", label: "Quick Function", tooltip: "More functions.", icon: (t) => {
934
- switch (t?.key()) {
935
- case "insertFunctionSum":
936
- return P(e(Dc, {}));
937
- case "insertFunction":
938
- return P(e(Ec, {}));
939
- default:
940
- return null;
941
- }
942
- } });
943
- }));
944
- ru.displayName = "InsertFunctionSumCommandPopupButton";
945
- const ba = new Map([{ key: "financial", label: "Financial", icon: e(Rc, {}) }, { key: "logical", label: "Logical", icon: e(Mc, {}) }, { key: "text", label: "Text", icon: e(Ic, {}) }, { key: "dateTime", label: "Date & Time", categories: ["date", "time"], icon: e(Nc, {}) }, { key: "lookupReference", label: "Lookup & Reference", categories: ["lookup", "reference"], icon: e(Fc, {}) }, { key: "mathTrig", label: "Math & Trig", categories: ["math", "trig"], icon: e(Oc, {}) }, { key: "statDist", label: "Statistical", categories: ["stat", "dist"], icon: e(Ac, {}) }, { key: "engineering", label: "Engineering", categories: ["engineering"], icon: e(Bc, {}) }, { key: "information", label: "Information", categories: ["information"], icon: e(Lc, {}) }, { key: "cube", label: "Cube", icon: e(Hc, {}) }, { key: "database", label: "Database", icon: e(zc, {}) }, { key: "web", label: "Web", icon: e(Wc, {}) }, { key: "custom", label: "Custom", icon: e(jc, {}) }].map((r) => [r.key, r])), au = K((r) => {
946
- const { command: i, formulaFunction: o, commandHook: t, disabled: n = !1, parentFloat: l, handleInsert: c, icon: m, label: a, sx: s, ...u } = r;
947
- return e(pt, { sx: { maxWidth: "360px", display: "flex", "*": { lineHeight: "1.2" }, ...s }, disabled: n, onMouseDown: (d) => {
948
- d.button === 0 && d.preventDefault();
949
- }, onMouseUp: (d) => {
950
- d.button === 0 && c(o);
951
- }, onKeyDown: (d) => {
952
- d.keyCode === be.Enter || (d.keyCode, be.Space);
953
- }, ...u, children: e(A, { sx: { display: "flex", flex: "1 1 100%", flexDirection: "column", overflow: "hidden" }, children: e(Oe, { component: "div", children: "Formula Function Here" }) }) });
954
- }), iu = K(J((r, i) => {
955
- const { category: o, commands: t, commandHook: n, scope: l, sx: c, disabled: m = !1, parentFloat: a, ...s } = r, u = He(t, ["insertFunction"])[0], d = G((p, g) => {
956
- const y = (v) => {
957
- n?.beforeExecute?.(u, u?.state()), u.execute(v, n), n?.onExecute?.(u, u?.state());
958
- }, x = u.context()?.searchByCategory(o), b = [], h = x ? x.length : 0;
959
- for (let v = 0; v < h; v++) {
960
- const C = x[v];
961
- b.push(e(au, { formulaFunction: C, disabled: m || !u || u.disabled(), handleSetFormat: y }, C.getName()));
962
- }
963
- const w = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, ...s, children: [e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: b }), e(re, { orientation: "horizontal" })] });
964
- return Se({ ...p, children: w });
965
- }, [u, n, l]), f = ba.get(o);
966
- return e(Re, { ref: i, commands: t, commandHook: n, createPopupPanel: d, label: f.label ?? "Insert Function", tooltip: f.label, icon: P(ba.get(o)?.icon ?? e(Pc, {})), ...s });
967
- }));
968
- iu.displayName = "InsertFunctionCommandPopupButton";
969
- const zi = le.createContext(null);
970
- zi.displayName = "HookFormContext";
971
- const Wi = () => le.useContext(zi), lu = K(J((r, i) => {
972
- const { disabled: o, style: t, className: n, sx: l, defaultInput: c, value: m, formName: a, formOptions: s, onChangeInput: u, onValidate: d, onKeyDown: f, ...p } = r, g = Wi(), y = a && g ? g.register(a, s) : null, [x, b] = U(""), [h, w] = U(""), [v, C] = U(m);
973
- me(() => {
974
- C(m), w("");
975
- }, [m]);
976
- const k = ee((R) => {
977
- let S = "";
978
- try {
979
- C(R), d?.(R), u?.(R);
980
- } catch (I) {
981
- S = I.message ?? "Invalid Name";
982
- }
983
- a && g && (S ? g.setError(a, { message: S }) : g.clearErrors(a)), w(S);
984
- }, [m, d, u]), T = ee(async (R) => {
985
- R.keyCode === be.Escape && x !== m && (k(x), g?.setValue(a, x), g?.clearErrors(a), R.stopPropagation()), f?.(R);
986
- }, [f, x, m, g]), M = ee((R) => {
987
- b(R.target.value ?? "");
988
- }, []), N = ee((R) => {
989
- b(""), y?.onBlur(R);
990
- }, []), B = G((R) => {
991
- k(R.target.value), y?.onChange(R);
992
- }, [y]);
993
- return e(lr, { sx: { paddingTop: (R) => R.spacing(1.5), minWidth: 135, width: "100%", ...l }, size: "small", ref: i, className: Ae("named-input", n), ...p, children: e(ui, { label: "Name", placeholder: c, onFocus: M, onBlur: N, inputRef: y?.ref, disabled: o, error: !!h, helperText: h || " ", sx: { "& .MuiFormHelperText-root": { marginTop: (R) => R.spacing(0.5) } }, InputLabelProps: { shrink: !0 }, InputProps: { inputProps: { className: "autoFocus", name: a, spellCheck: !1, autoComplete: "off", readOnly: o, sx: { paddingTop: (R) => R.spacing(1.25), paddingBottom: (R) => R.spacing(0.75), backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` } } }, value: v ?? "", onChange: B, onKeyDownCapture: T, onContextMenu: (R) => {
994
- R.stopPropagation();
995
- } }) });
996
- }));
997
- lu.displayName = "NamedInput";
998
- const Vo = (r) => r === null ? "" : r.toString(), su = K(J((r, i) => {
999
- const { formName: o, formOptions: t, disabled: n, style: l, className: c, sx: m, onKeyDown: a, value: s, onChangeInput: u, resolvedAddress: d, ...f } = r, p = Wi(), g = o && p ? p.register(o, t) : null, [y, x] = U(""), [b, h] = U(!1), [w, v] = U(() => Vo(s));
1000
- me(() => {
1001
- v(Vo(s)), x(""), o && p && p.clearErrors(o), h(!1);
1002
- }, [s]);
1003
- const C = ee((S) => {
1004
- let I = "";
1005
- try {
1006
- v(S);
1007
- const L = Vo(s), O = d(S);
1008
- O.toString() !== L && u?.(O);
1009
- } catch {
1010
- I = "Invalid Range";
1011
- }
1012
- o && p && (I ? p.setError(o, { message: I }) : p.clearErrors(o)), x(I), h(!0);
1013
- }, [w, u, o, p]), k = ee(async (S) => {
1014
- if (b && S.keyCode === be.Escape) {
1015
- const I = Vo(s);
1016
- v(I), x(""), h(!1), S.stopPropagation();
1017
- }
1018
- a?.(S);
1019
- }, [s, u, a, b]), T = ee((S) => {
1020
- g?.onBlur(S);
1021
- }, [g]), M = G((S) => {
1022
- C(S.target.value), g?.onChange(S);
1023
- }, [g]), [N, B] = U(!1), R = j(() => e(vs, { tabIndex: -1, sx: { display: "flex", position: "relative", flex: "0" }, position: "end", children: e(Vc, { disabled: !0, selected: N, onSelectToggle: (S) => {
1024
- B(S);
1025
- }, label: "Select Range", icon: P(e($c, {})) }) }), [N]);
1026
- return e(lr, { sx: { paddingTop: (S) => S.spacing(1.5), minWidth: 135, width: "100%", ...m }, size: "small", ref: i, className: Ae("range-input", c), ...f, children: e(ui, { label: "Range", placeholder: "Enter Range", onBlur: T, disabled: n, error: !!y, inputRef: g?.ref, helperText: y || " ", sx: { "& .MuiFormHelperText-root": { marginTop: (S) => S.spacing(0.5) } }, InputLabelProps: { shrink: !0 }, InputProps: { inputProps: { spellCheck: !1, autoComplete: "off", readOnly: n, name: o, sx: { paddingTop: (S) => S.spacing(1.25), paddingBottom: (S) => S.spacing(0.75) } }, sx: { backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` }, endAdornment: R }, value: w ?? "", onChange: M, onKeyDownCapture: k, onContextMenu: (S) => {
1027
- S.stopPropagation();
1028
- } }) });
1029
- }));
1030
- su.displayName = "RangeInput";
1031
- const ji = K(J((r, i) => {
1032
- const { sheet: o, className: t, debounceDelay: n = 220, sx: l, ...c } = r, [m, a] = U(() => o.getView().getZoomScale()), [s, u] = U(null), d = we(0);
1033
- _e(o, { onViewChange: () => {
1034
- u(!0), d.current === 0 && a(o.getView().getZoomScale());
1035
- } }), me(() => {
1036
- d.current = 0, u(!1), a(o.getView().getZoomScale());
1037
- }, [o]), me(() => {
1038
- d.current !== 0 && Ze.debounce(() => {
1039
- m === d.current && (d.current = 0, o.getView().update({ zoomScale: m }));
1040
- }, n)();
1041
- }, [m, n]);
1042
- const f = ee((T) => {
1043
- let M = T;
1044
- T < 100 ? M = Math.round(T / (10 / 9) + 10) : T > 100 && (M = Math.round(3 * T - 200)), d.current = M, u(!0), a(M);
1045
- }, [o]), p = (T) => {
1046
- let M = T;
1047
- return T < 100 ? M = 10 / 9 * (T - 10) : T > 100 && (M = (T + 200) / 3), M;
1048
- }, g = p(m), [y, x] = U(null), b = we(null), h = G(() => {
1049
- const T = y;
1050
- T && requestAnimationFrame(() => {
1051
- b.current?.contains(document.activeElement) && T.focus();
1052
- });
1053
- }, []), w = ma(() => {
1054
- f(p(Ze.findNextStep(o.getView().getZoomScale(), !1, 10)));
1055
- }), v = ma(() => f(p(Ze.findNextStep(o.getView().getZoomScale(), !0, 10)))), C = at(), k = j(() => `${Bt.getSharedMeasurer()("100%", Math.round(C.typography.fontSize), C.typography.fontFamily).width}px`, [C]);
1056
- return z(A, { ref: i, className: Ae(t), sx: { padding: "0px 0px", display: "flex", alignItems: "center", color: (T) => T.palette.text.secondary, ...l }, onFocus: (T) => {
1057
- T.relatedTarget && !y && x(T.relatedTarget);
1058
- }, onBlur: (T) => {
1059
- y && !b?.current?.contains(T.relatedTarget) && x(null);
1060
- }, onMouseDown: (T) => {
1061
- T.button === 0 && T.preventDefault();
1062
- }, onMouseUp: (T) => {
1063
- T.button === 0 && h();
1064
- }, ...c, children: [e(At, { disableInteractive: !0, title: "Zoom Out", children: e(dt, { sx: { padding: "0", "&:hover:not([disabled])": { color: (T) => T.palette.primary.main }, "& svg": { width: "12px", height: "12px" } }, size: "small", onPointerDown: (T) => {
1065
- T.button !== 0 ? T.preventDefault() : w(T);
1066
- }, children: e(Xd, {}) }) }), e(Cs, { ref: b, sx: { flex: "1 1 100%", padding: "6px 0px !important", marginRight: "2px", marginLeft: "2px", "& .MuiSlider-thumb": { height: 14, width: 6, borderRadius: 0.75, "&.Mui-focusVisible": { boxShadow: (T) => `0px 0px 0px 3px ${ra(T.palette.primary.main, 0.16)}` }, "&:focus, &:hover, &.Mui-active": { boxShadow: (T) => `0px 0px 0px 2px ${ra(T.palette.primary.main, 0.16)}` } }, "& .MuiSlider-mark": { width: "1px", height: "8px" }, "& .MuiSlider-markActive": { backgroundColor: "currentColor" }, "& .MuiSlider-thumb:not(.MuiSlider-active)": { transition: s ? "left 260ms ease-in" : "none" } }, valueLabelDisplay: "auto", size: "small", track: !1, min: 0, step: 1, value: g, max: 200, marks: [{ value: 100 }], onAnimationEnd: () => u(!1), onWheel: (T) => {
1067
- f(p(Ze.findNextStep(o.getView().getZoomScale(), T.deltaY < 0, 10)));
1068
- }, onKeyDown: (T) => {
1069
- T.which === be.Down || T.which === be.Right ? (f(p(Ze.findNextStep(o.getView().getZoomScale(), !0, 10))), T.preventDefault()) : T.which === be.Up || T.which === be.Left ? (f(p(Ze.findNextStep(o.getView().getZoomScale(), !1, 10))), T.preventDefault()) : T.which !== be.Enter && T.which !== be.Escape || h();
1070
- }, onChange: (T, M) => {
1071
- Math.abs(M - 100) < 3 ? f(100) : f(M);
1072
- }, valueLabelFormat: (T, M) => `Zoom: ${Math.round(m)}%` }), e(At, { disableInteractive: !0, title: "Zoom In", children: e(dt, { sx: { padding: "0", "&:hover:not([disabled])": { color: (T) => T.palette.primary.main }, "& svg": { width: "12px", height: "12px" } }, size: "small", onPointerDown: (T) => {
1073
- T.button !== 0 ? T.preventDefault() : v(T);
1074
- }, children: e(Kd, {}) }) }), z(A, { sx: { display: "flex", flexDirection: "row" }, children: [e(A, { sx: { minWidth: "8px" } }), e(Oe, { noWrap: !0, component: "div", onClick: () => {
1075
- f(100);
1076
- }, sx: { cursor: "pointer", display: "flex", flex: "1 1 100%", fontSize: "0.70rem", marginLeft: "2px", marginRight: "2px", userSelect: "none", justifyContent: "center", width: k }, children: e("div", { children: Math.round(m) + "%" }) })] })] });
1077
- }));
1078
- ji.displayName = "SheetZoomScale";
1079
- const Vi = K(J((r, i) => {
1080
- const { sx: o, sheet: t, gridStyle: n, children: l, childrenEnd: c, ...m } = r;
1081
- fs(i, () => ({}));
1082
- const a = we(null);
1083
- me(() => {
1084
- const p = (g) => g.preventDefault();
1085
- return a.current?.addEventListener("wheel", p, { passive: !1 }), () => {
1086
- a.current?.removeEventListener("wheel", p);
1087
- };
1088
- }, []);
1089
- const s = un(), u = j(() => {
1090
- const p = s.getMode();
1091
- return p?.description ? p.description : "Ready";
1092
- }, [s]), [d, f] = U(!1);
1093
- return z(A, { ref: a, sx: { display: "flex", alignItems: "stretch", flexDirection: "row", flex: "0", paddingLeft: "12px", paddingRight: "12px", gap: "8px", paddingTop: "1px", minHeight: "calc(1em + 8px)", overflow: d ? "visible" : "hidden", boxShadow: `0px -1px 0px ${n.header.edgeStrokeFill}`, ...o }, onMouseOver: () => f(!0), onMouseLeave: () => f(!1), ...m, children: [l, e("div", { style: { flex: "1 1 100%", display: "flex", alignItems: "end", overflow: "hidden" }, children: e(Oe, { component: "div", sx: { userSelect: "none", whiteSpace: "pre", overflow: "hidden", textOverflow: "ellipsis", color: (p) => p.palette.text.secondary }, variant: "caption", children: u }) }), c ? e(A, { sx: { display: "flex", alignItems: "center" }, children: c }) : null, e(re, { style: { marginTop: "6px", marginBottom: "6px" } }), e(ji, { sx: { paddingLeft: "4px", minWidth: "175px" }, sheet: t })] });
1094
- }));
1095
- Vi.displayName = "StatusBar";
1096
- var Co = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1097
- function Wm(r) {
1098
- return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
1099
- }
1100
- var xa, ya, Dn, wa, Sa, $o = { exports: {} }, uo = {}, mo = { exports: {} }, va = {}, Ca = { exports: {} };
1101
- function cu() {
1102
- return ya ? xa : (ya = 1, xa = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
1103
- }
1104
- function du() {
1105
- if (wa) return Dn;
1106
- wa = 1;
1107
- var r = cu();
1108
- function i() {
1109
- }
1110
- function o() {
1111
- }
1112
- return o.resetWarningCache = i, Dn = function() {
1113
- function t(c, m, a, s, u, d) {
1114
- if (d !== r) {
1115
- var f = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
1116
- throw f.name = "Invariant Violation", f;
1117
- }
1118
- }
1119
- function n() {
1120
- return t;
1121
- }
1122
- t.isRequired = t;
1123
- var l = { array: t, bigint: t, bool: t, func: t, number: t, object: t, string: t, symbol: t, any: t, arrayOf: n, element: t, elementType: t, instanceOf: n, node: t, objectOf: n, oneOf: n, oneOfType: n, shape: n, exact: n, checkPropTypes: o, resetWarningCache: i };
1124
- return l.PropTypes = l, l;
1125
- }, Dn;
1126
- }
1127
- function mn() {
1128
- return Sa || (Sa = 1, Ca.exports = du()()), Ca.exports;
1129
- }
1130
- var ka, _o = { exports: {} }, Ta, We = {}, xt = {};
1131
- function gn() {
1132
- return Ta || (Ta = 1, Object.defineProperty(xt, "__esModule", { value: !0 }), xt.dontSetMe = function(r, i, o) {
1133
- if (r[i]) return new Error(`Invalid prop ${i} passed to ${o} - do not set this, set it on the child.`);
1134
- }, xt.findInArray = function(r, i) {
1135
- for (let o = 0, t = r.length; o < t; o++) if (i.apply(i, [r[o], o, r])) return r[o];
1136
- }, xt.int = function(r) {
1137
- return parseInt(r, 10);
1138
- }, xt.isFunction = function(r) {
1139
- return typeof r == "function" || Object.prototype.toString.call(r) === "[object Function]";
1140
- }, xt.isNum = function(r) {
1141
- return typeof r == "number" && !isNaN(r);
1142
- }), xt;
1143
- }
1144
- var Ea, Da, yt = {};
1145
- function xr() {
1146
- if (Da) return We;
1147
- Da = 1, Object.defineProperty(We, "__esModule", { value: !0 }), We.addClassName = c, We.addEvent = function(a, s, u, d) {
1148
- if (!a) return;
1149
- const f = { capture: !0, ...d };
1150
- a.addEventListener ? a.addEventListener(s, u, f) : a.attachEvent ? a.attachEvent("on" + s, u) : a["on" + s] = u;
1151
- }, We.addUserSelectStyles = function(a) {
1152
- if (!a) return;
1153
- let s = a.getElementById("react-draggable-style-el");
1154
- s || (s = a.createElement("style"), s.type = "text/css", s.id = "react-draggable-style-el", s.innerHTML = `.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
1155
- `, s.innerHTML += `.react-draggable-transparent-selection *::selection {all: inherit;}
1156
- `, a.getElementsByTagName("head")[0].appendChild(s)), a.body && c(a.body, "react-draggable-transparent-selection");
1157
- }, We.createCSSTransform = function(a, s) {
1158
- const u = n(a, s, "px");
1159
- return { [(0, i.browserPrefixToKey)("transform", i.default)]: u };
1160
- }, We.createSVGTransform = function(a, s) {
1161
- return n(a, s, "");
1162
- }, We.getTouch = function(a, s) {
1163
- return a.targetTouches && (0, r.findInArray)(a.targetTouches, (u) => s === u.identifier) || a.changedTouches && (0, r.findInArray)(a.changedTouches, (u) => s === u.identifier);
1164
- }, We.getTouchIdentifier = function(a) {
1165
- if (a.targetTouches && a.targetTouches[0]) return a.targetTouches[0].identifier;
1166
- if (a.changedTouches && a.changedTouches[0]) return a.changedTouches[0].identifier;
1167
- }, We.getTranslation = n, We.innerHeight = function(a) {
1168
- let s = a.clientHeight;
1169
- const u = a.ownerDocument.defaultView.getComputedStyle(a);
1170
- return s -= (0, r.int)(u.paddingTop), s -= (0, r.int)(u.paddingBottom), s;
1171
- }, We.innerWidth = function(a) {
1172
- let s = a.clientWidth;
1173
- const u = a.ownerDocument.defaultView.getComputedStyle(a);
1174
- return s -= (0, r.int)(u.paddingLeft), s -= (0, r.int)(u.paddingRight), s;
1175
- }, We.matchesSelector = t, We.matchesSelectorAndParentsTo = function(a, s, u) {
1176
- let d = a;
1177
- do {
1178
- if (t(d, s)) return !0;
1179
- if (d === u) return !1;
1180
- d = d.parentNode;
1181
- } while (d);
1182
- return !1;
1183
- }, We.offsetXYFromParent = function(a, s, u) {
1184
- const d = s === s.ownerDocument.body ? { left: 0, top: 0 } : s.getBoundingClientRect(), f = (a.clientX + s.scrollLeft - d.left) / u, p = (a.clientY + s.scrollTop - d.top) / u;
1185
- return { x: f, y: p };
1186
- }, We.outerHeight = function(a) {
1187
- let s = a.clientHeight;
1188
- const u = a.ownerDocument.defaultView.getComputedStyle(a);
1189
- return s += (0, r.int)(u.borderTopWidth), s += (0, r.int)(u.borderBottomWidth), s;
1190
- }, We.outerWidth = function(a) {
1191
- let s = a.clientWidth;
1192
- const u = a.ownerDocument.defaultView.getComputedStyle(a);
1193
- return s += (0, r.int)(u.borderLeftWidth), s += (0, r.int)(u.borderRightWidth), s;
1194
- }, We.removeClassName = m, We.removeEvent = function(a, s, u, d) {
1195
- if (!a) return;
1196
- const f = { capture: !0, ...d };
1197
- a.removeEventListener ? a.removeEventListener(s, u, f) : a.detachEvent ? a.detachEvent("on" + s, u) : a["on" + s] = null;
1198
- }, We.scheduleRemoveUserSelectStyles = function(a) {
1199
- window.requestAnimationFrame ? window.requestAnimationFrame(() => {
1200
- l(a);
1201
- }) : l(a);
1202
- };
1203
- var r = gn(), i = function(a, s) {
1204
- if (typeof WeakMap == "function") var u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
1205
- return function(f, p) {
1206
- if (!p && f && f.__esModule) return f;
1207
- var g, y, x = { __proto__: null, default: f };
1208
- if (f === null || typeof f != "object" && typeof f != "function") return x;
1209
- if (g = p ? d : u) {
1210
- if (g.has(f)) return g.get(f);
1211
- g.set(f, x);
1212
- }
1213
- for (const b in f) b !== "default" && {}.hasOwnProperty.call(f, b) && ((y = (g = Object.defineProperty) && Object.getOwnPropertyDescriptor(f, b)) && (y.get || y.set) ? g(x, b, y) : x[b] = f[b]);
1214
- return x;
1215
- }(a, s);
1216
- }(function() {
1217
- if (Ea) return yt;
1218
- Ea = 1, Object.defineProperty(yt, "__esModule", { value: !0 }), yt.browserPrefixToKey = u, yt.browserPrefixToStyle = function(d, f) {
1219
- return f ? `-${f.toLowerCase()}-${d}` : d;
1220
- }, yt.default = void 0, yt.getPrefix = s;
1221
- const a = ["Moz", "Webkit", "O", "ms"];
1222
- function s() {
1223
- let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
1224
- if (typeof window > "u") return "";
1225
- const f = window.document?.documentElement?.style;
1226
- if (!f || d in f) return "";
1227
- for (let p = 0; p < a.length; p++) if (u(d, a[p]) in f) return a[p];
1228
- return "";
1229
- }
1230
- function u(d, f) {
1231
- return f ? `${f}${function(p) {
1232
- let g = "", y = !0;
1233
- for (let x = 0; x < p.length; x++) y ? (g += p[x].toUpperCase(), y = !1) : p[x] === "-" ? y = !0 : g += p[x];
1234
- return g;
1235
- }(d)}` : d;
1236
- }
1237
- return yt.default = s(), yt;
1238
- }());
1239
- let o = "";
1240
- function t(a, s) {
1241
- return o || (o = (0, r.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(u) {
1242
- return (0, r.isFunction)(a[u]);
1243
- })), !!(0, r.isFunction)(a[o]) && a[o](s);
1244
- }
1245
- function n(a, s, u) {
1246
- let { x: d, y: f } = a, p = `translate(${d}${u},${f}${u})`;
1247
- return s && (p = `translate(${`${typeof s.x == "string" ? s.x : s.x + u}`}, ${`${typeof s.y == "string" ? s.y : s.y + u}`})` + p), p;
1248
- }
1249
- function l(a) {
1250
- if (a) try {
1251
- if (a.body && m(a.body, "react-draggable-transparent-selection"), a.selection) a.selection.empty();
1252
- else {
1253
- const s = (a.defaultView || window).getSelection();
1254
- s && s.type !== "Caret" && s.removeAllRanges();
1255
- }
1256
- } catch {
1257
- }
1258
- }
1259
- function c(a, s) {
1260
- a.classList ? a.classList.add(s) : a.className.match(new RegExp(`(?:^|\\s)${s}(?!\\S)`)) || (a.className += ` ${s}`);
1261
- }
1262
- function m(a, s) {
1263
- a.classList ? a.classList.remove(s) : a.className = a.className.replace(new RegExp(`(?:^|\\s)${s}(?!\\S)`, "g"), "");
1264
- }
1265
- return We;
1266
- }
1267
- var Pa, lt = {};
1268
- function $i() {
1269
- if (Pa) return lt;
1270
- Pa = 1, Object.defineProperty(lt, "__esModule", { value: !0 }), lt.canDragX = function(t) {
1271
- return t.props.axis === "both" || t.props.axis === "x";
1272
- }, lt.canDragY = function(t) {
1273
- return t.props.axis === "both" || t.props.axis === "y";
1274
- }, lt.createCoreData = function(t, n, l) {
1275
- const c = !(0, r.isNum)(t.lastX), m = o(t);
1276
- return c ? { node: m, deltaX: 0, deltaY: 0, lastX: n, lastY: l, x: n, y: l } : { node: m, deltaX: n - t.lastX, deltaY: l - t.lastY, lastX: t.lastX, lastY: t.lastY, x: n, y: l };
1277
- }, lt.createDraggableData = function(t, n) {
1278
- const l = t.props.scale;
1279
- return { node: n.node, x: t.state.x + n.deltaX / l, y: t.state.y + n.deltaY / l, deltaX: n.deltaX / l, deltaY: n.deltaY / l, lastX: t.state.x, lastY: t.state.y };
1280
- }, lt.getBoundPosition = function(t, n, l) {
1281
- if (!t.props.bounds) return [n, l];
1282
- let { bounds: c } = t.props;
1283
- c = typeof c == "string" ? c : function(a) {
1284
- return { left: a.left, top: a.top, right: a.right, bottom: a.bottom };
1285
- }(c);
1286
- const m = o(t);
1287
- if (typeof c == "string") {
1288
- const { ownerDocument: a } = m, s = a.defaultView;
1289
- let u;
1290
- if (c === "parent" ? u = m.parentNode : u = m.getRootNode().querySelector(c), !(u instanceof s.HTMLElement)) throw new Error('Bounds selector "' + c + '" could not find an element.');
1291
- const d = u, f = s.getComputedStyle(m), p = s.getComputedStyle(d);
1292
- c = { left: -m.offsetLeft + (0, r.int)(p.paddingLeft) + (0, r.int)(f.marginLeft), top: -m.offsetTop + (0, r.int)(p.paddingTop) + (0, r.int)(f.marginTop), right: (0, i.innerWidth)(d) - (0, i.outerWidth)(m) - m.offsetLeft + (0, r.int)(p.paddingRight) - (0, r.int)(f.marginRight), bottom: (0, i.innerHeight)(d) - (0, i.outerHeight)(m) - m.offsetTop + (0, r.int)(p.paddingBottom) - (0, r.int)(f.marginBottom) };
1293
- }
1294
- return (0, r.isNum)(c.right) && (n = Math.min(n, c.right)), (0, r.isNum)(c.bottom) && (l = Math.min(l, c.bottom)), (0, r.isNum)(c.left) && (n = Math.max(n, c.left)), (0, r.isNum)(c.top) && (l = Math.max(l, c.top)), [n, l];
1295
- }, lt.getControlPosition = function(t, n, l) {
1296
- const c = typeof n == "number" ? (0, i.getTouch)(t, n) : null;
1297
- if (typeof n == "number" && !c) return null;
1298
- const m = o(l), a = l.props.offsetParent || m.offsetParent || m.ownerDocument.body;
1299
- return (0, i.offsetXYFromParent)(c || t, a, l.props.scale);
1300
- }, lt.snapToGrid = function(t, n, l) {
1301
- const c = Math.round(n / t[0]) * t[0], m = Math.round(l / t[1]) * t[1];
1302
- return [c, m];
1303
- };
1304
- var r = gn(), i = xr();
1305
- function o(t) {
1306
- const n = t.findDOMNode();
1307
- if (!n) throw new Error("<DraggableCore>: Unmounted during event!");
1308
- return n;
1309
- }
1310
- return lt;
1311
- }
1312
- var Ra, Ma, Ia, Na, go = {}, Uo = {};
1313
- function _i() {
1314
- return Ra || (Ra = 1, Object.defineProperty(Uo, "__esModule", { value: !0 }), Uo.default = function() {
1315
- }), Uo;
1316
- }
1317
- function pu() {
1318
- if (Ma) return go;
1319
- Ma = 1, Object.defineProperty(go, "__esModule", { value: !0 }), go.default = void 0;
1320
- var r = function(p, g) {
1321
- if (typeof WeakMap == "function") var y = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap();
1322
- return function(b, h) {
1323
- if (!h && b && b.__esModule) return b;
1324
- var w, v, C = { __proto__: null, default: b };
1325
- if (b === null || typeof b != "object" && typeof b != "function") return C;
1326
- if (w = h ? x : y) {
1327
- if (w.has(b)) return w.get(b);
1328
- w.set(b, C);
1329
- }
1330
- for (const k in b) k !== "default" && {}.hasOwnProperty.call(b, k) && ((v = (w = Object.defineProperty) && Object.getOwnPropertyDescriptor(b, k)) && (v.get || v.set) ? w(C, k, v) : C[k] = b[k]);
1331
- return C;
1332
- }(p, g);
1333
- }(le), i = m(mn()), o = m(Kt), t = xr(), n = $i(), l = gn(), c = m(_i());
1334
- function m(p) {
1335
- return p && p.__esModule ? p : { default: p };
1336
- }
1337
- function a(p, g, y) {
1338
- return (g = function(x) {
1339
- var b = function(h, w) {
1340
- if (typeof h != "object" || !h) return h;
1341
- var v = h[Symbol.toPrimitive];
1342
- if (v !== void 0) {
1343
- var C = v.call(h, w);
1344
- if (typeof C != "object") return C;
1345
- throw new TypeError("@@toPrimitive must return a primitive value.");
1346
- }
1347
- return (w === "string" ? String : Number)(h);
1348
- }(x, "string");
1349
- return typeof b == "symbol" ? b : b + "";
1350
- }(g)) in p ? Object.defineProperty(p, g, { value: y, enumerable: !0, configurable: !0, writable: !0 }) : p[g] = y, p;
1351
- }
1352
- const s = { start: "touchstart", move: "touchmove", stop: "touchend" }, u = { start: "mousedown", move: "mousemove", stop: "mouseup" };
1353
- let d = u, f = class extends r.Component {
1354
- constructor() {
1355
- super(...arguments), a(this, "dragging", !1), a(this, "lastX", NaN), a(this, "lastY", NaN), a(this, "touchIdentifier", null), a(this, "mounted", !1), a(this, "handleDragStart", (p) => {
1356
- if (this.props.onMouseDown(p), !this.props.allowAnyClick && typeof p.button == "number" && p.button !== 0) return !1;
1357
- const g = this.findDOMNode();
1358
- if (!g || !g.ownerDocument || !g.ownerDocument.body) throw new Error("<DraggableCore> not mounted on DragStart!");
1359
- const { ownerDocument: y } = g;
1360
- if (this.props.disabled || !(p.target instanceof y.defaultView.Node) || this.props.handle && !(0, t.matchesSelectorAndParentsTo)(p.target, this.props.handle, g) || this.props.cancel && (0, t.matchesSelectorAndParentsTo)(p.target, this.props.cancel, g)) return;
1361
- p.type !== "touchstart" || this.props.allowMobileScroll || p.preventDefault();
1362
- const x = (0, t.getTouchIdentifier)(p);
1363
- this.touchIdentifier = x;
1364
- const b = (0, n.getControlPosition)(p, x, this);
1365
- if (b == null) return;
1366
- const { x: h, y: w } = b, v = (0, n.createCoreData)(this, h, w);
1367
- (0, c.default)("DraggableCore: handleDragStart: %j", v), (0, c.default)("calling", this.props.onStart), this.props.onStart(p, v) !== !1 && this.mounted !== !1 && (this.props.enableUserSelectHack && (0, t.addUserSelectStyles)(y), this.dragging = !0, this.lastX = h, this.lastY = w, (0, t.addEvent)(y, d.move, this.handleDrag), (0, t.addEvent)(y, d.stop, this.handleDragStop));
1368
- }), a(this, "handleDrag", (p) => {
1369
- const g = (0, n.getControlPosition)(p, this.touchIdentifier, this);
1370
- if (g == null) return;
1371
- let { x: y, y: x } = g;
1372
- if (Array.isArray(this.props.grid)) {
1373
- let h = y - this.lastX, w = x - this.lastY;
1374
- if ([h, w] = (0, n.snapToGrid)(this.props.grid, h, w), !h && !w) return;
1375
- y = this.lastX + h, x = this.lastY + w;
1376
- }
1377
- const b = (0, n.createCoreData)(this, y, x);
1378
- if ((0, c.default)("DraggableCore: handleDrag: %j", b), this.props.onDrag(p, b) !== !1 && this.mounted !== !1) this.lastX = y, this.lastY = x;
1379
- else try {
1380
- this.handleDragStop(new MouseEvent("mouseup"));
1381
- } catch {
1382
- const w = document.createEvent("MouseEvents");
1383
- w.initMouseEvent("mouseup", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), this.handleDragStop(w);
1384
- }
1385
- }), a(this, "handleDragStop", (p) => {
1386
- if (!this.dragging) return;
1387
- const g = (0, n.getControlPosition)(p, this.touchIdentifier, this);
1388
- if (g == null) return;
1389
- let { x: y, y: x } = g;
1390
- if (Array.isArray(this.props.grid)) {
1391
- let w = y - this.lastX || 0, v = x - this.lastY || 0;
1392
- [w, v] = (0, n.snapToGrid)(this.props.grid, w, v), y = this.lastX + w, x = this.lastY + v;
1393
- }
1394
- const b = (0, n.createCoreData)(this, y, x);
1395
- if (this.props.onStop(p, b) === !1 || this.mounted === !1) return !1;
1396
- const h = this.findDOMNode();
1397
- h && this.props.enableUserSelectHack && (0, t.scheduleRemoveUserSelectStyles)(h.ownerDocument), (0, c.default)("DraggableCore: handleDragStop: %j", b), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, h && ((0, c.default)("DraggableCore: Removing handlers"), (0, t.removeEvent)(h.ownerDocument, d.move, this.handleDrag), (0, t.removeEvent)(h.ownerDocument, d.stop, this.handleDragStop));
1398
- }), a(this, "onMouseDown", (p) => (d = u, this.handleDragStart(p))), a(this, "onMouseUp", (p) => (d = u, this.handleDragStop(p))), a(this, "onTouchStart", (p) => (d = s, this.handleDragStart(p))), a(this, "onTouchEnd", (p) => (d = s, this.handleDragStop(p)));
1399
- }
1400
- componentDidMount() {
1401
- this.mounted = !0;
1402
- const p = this.findDOMNode();
1403
- p && (0, t.addEvent)(p, s.start, this.onTouchStart, { passive: !1 });
1404
- }
1405
- componentWillUnmount() {
1406
- this.mounted = !1;
1407
- const p = this.findDOMNode();
1408
- if (p) {
1409
- const { ownerDocument: g } = p;
1410
- (0, t.removeEvent)(g, u.move, this.handleDrag), (0, t.removeEvent)(g, s.move, this.handleDrag), (0, t.removeEvent)(g, u.stop, this.handleDragStop), (0, t.removeEvent)(g, s.stop, this.handleDragStop), (0, t.removeEvent)(p, s.start, this.onTouchStart, { passive: !1 }), this.props.enableUserSelectHack && (0, t.scheduleRemoveUserSelectStyles)(g);
1411
- }
1412
- }
1413
- findDOMNode() {
1414
- return this.props?.nodeRef ? this.props?.nodeRef?.current : o.default.findDOMNode(this);
1415
- }
1416
- render() {
1417
- return r.cloneElement(r.Children.only(this.props.children), { onMouseDown: this.onMouseDown, onMouseUp: this.onMouseUp, onTouchEnd: this.onTouchEnd });
1418
- }
1419
- };
1420
- return go.default = f, a(f, "displayName", "DraggableCore"), a(f, "propTypes", { allowAnyClick: i.default.bool, allowMobileScroll: i.default.bool, children: i.default.node.isRequired, disabled: i.default.bool, enableUserSelectHack: i.default.bool, offsetParent: function(p, g) {
1421
- if (p[g] && p[g].nodeType !== 1) throw new Error("Draggable's offsetParent must be a DOM Node.");
1422
- }, grid: i.default.arrayOf(i.default.number), handle: i.default.string, cancel: i.default.string, nodeRef: i.default.object, onStart: i.default.func, onDrag: i.default.func, onStop: i.default.func, onMouseDown: i.default.func, scale: i.default.number, className: l.dontSetMe, style: l.dontSetMe, transform: l.dontSetMe }), a(f, "defaultProps", { allowAnyClick: !1, allowMobileScroll: !1, disabled: !1, enableUserSelectHack: !0, onStart: function() {
1423
- }, onDrag: function() {
1424
- }, onStop: function() {
1425
- }, onMouseDown: function() {
1426
- }, scale: 1 }), go;
1427
- }
1428
- function uu() {
1429
- return Ia || (Ia = 1, function(r) {
1430
- Object.defineProperty(r, "__esModule", { value: !0 }), Object.defineProperty(r, "DraggableCore", { enumerable: !0, get: function() {
1431
- return a.default;
1432
- } }), r.default = void 0;
1433
- var i = function(g, y) {
1434
- if (typeof WeakMap == "function") var x = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
1435
- return function(h, w) {
1436
- if (!w && h && h.__esModule) return h;
1437
- var v, C, k = { __proto__: null, default: h };
1438
- if (h === null || typeof h != "object" && typeof h != "function") return k;
1439
- if (v = w ? b : x) {
1440
- if (v.has(h)) return v.get(h);
1441
- v.set(h, k);
1442
- }
1443
- for (const T in h) T !== "default" && {}.hasOwnProperty.call(h, T) && ((C = (v = Object.defineProperty) && Object.getOwnPropertyDescriptor(h, T)) && (C.get || C.set) ? v(k, T, C) : k[T] = h[T]);
1444
- return k;
1445
- }(g, y);
1446
- }(le), o = u(mn()), t = u(Kt), n = function() {
1447
- if (ka) return _o.exports;
1448
- function g(x) {
1449
- var b, h, w = "";
1450
- if (typeof x == "string" || typeof x == "number") w += x;
1451
- else if (typeof x == "object") if (Array.isArray(x)) {
1452
- var v = x.length;
1453
- for (b = 0; b < v; b++) x[b] && (h = g(x[b])) && (w && (w += " "), w += h);
1454
- } else for (h in x) x[h] && (w && (w += " "), w += h);
1455
- return w;
1456
- }
1457
- function y() {
1458
- for (var x, b, h = 0, w = "", v = arguments.length; h < v; h++) (x = arguments[h]) && (b = g(x)) && (w && (w += " "), w += b);
1459
- return w;
1460
- }
1461
- return ka = 1, _o.exports = y, _o.exports.clsx = y, _o.exports;
1462
- }(), l = xr(), c = $i(), m = gn(), a = u(pu()), s = u(_i());
1463
- function u(g) {
1464
- return g && g.__esModule ? g : { default: g };
1465
- }
1466
- function d() {
1467
- return d = Object.assign ? Object.assign.bind() : function(g) {
1468
- for (var y = 1; y < arguments.length; y++) {
1469
- var x = arguments[y];
1470
- for (var b in x) ({}).hasOwnProperty.call(x, b) && (g[b] = x[b]);
1471
- }
1472
- return g;
1473
- }, d.apply(null, arguments);
1474
- }
1475
- function f(g, y, x) {
1476
- return (y = function(b) {
1477
- var h = function(w, v) {
1478
- if (typeof w != "object" || !w) return w;
1479
- var C = w[Symbol.toPrimitive];
1480
- if (C !== void 0) {
1481
- var k = C.call(w, v);
1482
- if (typeof k != "object") return k;
1483
- throw new TypeError("@@toPrimitive must return a primitive value.");
1484
- }
1485
- return (v === "string" ? String : Number)(w);
1486
- }(b, "string");
1487
- return typeof h == "symbol" ? h : h + "";
1488
- }(y)) in g ? Object.defineProperty(g, y, { value: x, enumerable: !0, configurable: !0, writable: !0 }) : g[y] = x, g;
1489
- }
1490
- class p extends i.Component {
1491
- static getDerivedStateFromProps(y, x) {
1492
- let { position: b } = y, { prevPropsPosition: h } = x;
1493
- return !b || h && b.x === h.x && b.y === h.y ? null : ((0, s.default)("Draggable: getDerivedStateFromProps %j", { position: b, prevPropsPosition: h }), { x: b.x, y: b.y, prevPropsPosition: { ...b } });
1494
- }
1495
- constructor(y) {
1496
- super(y), f(this, "onDragStart", (x, b) => {
1497
- if ((0, s.default)("Draggable: onDragStart: %j", b), this.props.onStart(x, (0, c.createDraggableData)(this, b)) === !1) return !1;
1498
- this.setState({ dragging: !0, dragged: !0 });
1499
- }), f(this, "onDrag", (x, b) => {
1500
- if (!this.state.dragging) return !1;
1501
- (0, s.default)("Draggable: onDrag: %j", b);
1502
- const h = (0, c.createDraggableData)(this, b), w = { x: h.x, y: h.y, slackX: 0, slackY: 0 };
1503
- if (this.props.bounds) {
1504
- const { x: v, y: C } = w;
1505
- w.x += this.state.slackX, w.y += this.state.slackY;
1506
- const [k, T] = (0, c.getBoundPosition)(this, w.x, w.y);
1507
- w.x = k, w.y = T, w.slackX = this.state.slackX + (v - w.x), w.slackY = this.state.slackY + (C - w.y), h.x = w.x, h.y = w.y, h.deltaX = w.x - this.state.x, h.deltaY = w.y - this.state.y;
1508
- }
1509
- if (this.props.onDrag(x, h) === !1) return !1;
1510
- this.setState(w);
1511
- }), f(this, "onDragStop", (x, b) => {
1512
- if (!this.state.dragging || this.props.onStop(x, (0, c.createDraggableData)(this, b)) === !1) return !1;
1513
- (0, s.default)("Draggable: onDragStop: %j", b);
1514
- const h = { dragging: !1, slackX: 0, slackY: 0 };
1515
- if (this.props.position) {
1516
- const { x: w, y: v } = this.props.position;
1517
- h.x = w, h.y = v;
1518
- }
1519
- this.setState(h);
1520
- }), this.state = { dragging: !1, dragged: !1, x: y.position ? y.position.x : y.defaultPosition.x, y: y.position ? y.position.y : y.defaultPosition.y, prevPropsPosition: { ...y.position }, slackX: 0, slackY: 0, isElementSVG: !1 }, !y.position || y.onDrag || y.onStop || console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
1521
- }
1522
- componentDidMount() {
1523
- window.SVGElement !== void 0 && this.findDOMNode() instanceof window.SVGElement && this.setState({ isElementSVG: !0 });
1524
- }
1525
- componentWillUnmount() {
1526
- this.state.dragging && this.setState({ dragging: !1 });
1527
- }
1528
- findDOMNode() {
1529
- return this.props?.nodeRef?.current ?? t.default.findDOMNode(this);
1530
- }
1531
- render() {
1532
- const { axis: y, bounds: x, children: b, defaultPosition: h, defaultClassName: w, defaultClassNameDragging: v, defaultClassNameDragged: C, position: k, positionOffset: T, scale: M, ...N } = this.props;
1533
- let B = {}, R = null;
1534
- const S = !k || this.state.dragging, I = k || h, L = { x: (0, c.canDragX)(this) && S ? this.state.x : I.x, y: (0, c.canDragY)(this) && S ? this.state.y : I.y };
1535
- this.state.isElementSVG ? R = (0, l.createSVGTransform)(L, T) : B = (0, l.createCSSTransform)(L, T);
1536
- const O = (0, n.clsx)(b.props.className || "", w, { [v]: this.state.dragging, [C]: this.state.dragged });
1537
- return i.createElement(a.default, d({}, N, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }), i.cloneElement(i.Children.only(b), { className: O, style: { ...b.props.style, ...B }, transform: R }));
1538
- }
1539
- }
1540
- r.default = p, f(p, "displayName", "Draggable"), f(p, "propTypes", { ...a.default.propTypes, axis: o.default.oneOf(["both", "x", "y", "none"]), bounds: o.default.oneOfType([o.default.shape({ left: o.default.number, right: o.default.number, top: o.default.number, bottom: o.default.number }), o.default.string, o.default.oneOf([!1])]), defaultClassName: o.default.string, defaultClassNameDragging: o.default.string, defaultClassNameDragged: o.default.string, defaultPosition: o.default.shape({ x: o.default.number, y: o.default.number }), positionOffset: o.default.shape({ x: o.default.oneOfType([o.default.number, o.default.string]), y: o.default.oneOfType([o.default.number, o.default.string]) }), position: o.default.shape({ x: o.default.number, y: o.default.number }), className: m.dontSetMe, style: m.dontSetMe, transform: m.dontSetMe }), f(p, "defaultProps", { ...a.default.defaultProps, axis: "both", bounds: !1, defaultClassName: "react-draggable", defaultClassNameDragging: "react-draggable-dragging", defaultClassNameDragged: "react-draggable-dragged", defaultPosition: { x: 0, y: 0 }, scale: 1 });
1541
- }(va)), va;
1542
- }
1543
- function Ui() {
1544
- if (Na) return mo.exports;
1545
- Na = 1;
1546
- const { default: r, DraggableCore: i } = uu();
1547
- return mo.exports = r, mo.exports.default = r, mo.exports.DraggableCore = i, mo.exports;
1548
- }
1549
- var Fa, Go = {};
1550
- function mu() {
1551
- if (Fa) return Go;
1552
- Fa = 1, Go.__esModule = !0, Go.cloneElement = function(l, c) {
1553
- return c.style && l.props.style && (c.style = t(t({}, l.props.style), c.style)), c.className && l.props.className && (c.className = l.props.className + " " + c.className), i.default.cloneElement(l, c);
1554
- };
1555
- var r, i = (r = le) && r.__esModule ? r : { default: r };
1556
- function o(l, c) {
1557
- var m = Object.keys(l);
1558
- if (Object.getOwnPropertySymbols) {
1559
- var a = Object.getOwnPropertySymbols(l);
1560
- c && (a = a.filter(function(s) {
1561
- return Object.getOwnPropertyDescriptor(l, s).enumerable;
1562
- })), m.push.apply(m, a);
1563
- }
1564
- return m;
1565
- }
1566
- function t(l) {
1567
- for (var c = 1; c < arguments.length; c++) {
1568
- var m = arguments[c] != null ? arguments[c] : {};
1569
- c % 2 ? o(Object(m), !0).forEach(function(a) {
1570
- n(l, a, m[a]);
1571
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(l, Object.getOwnPropertyDescriptors(m)) : o(Object(m)).forEach(function(a) {
1572
- Object.defineProperty(l, a, Object.getOwnPropertyDescriptor(m, a));
1573
- });
1574
- }
1575
- return l;
1576
- }
1577
- function n(l, c, m) {
1578
- return (c = function(a) {
1579
- var s = function(u, d) {
1580
- if (typeof u != "object" || u === null) return u;
1581
- var f = u[Symbol.toPrimitive];
1582
- if (f !== void 0) {
1583
- var p = f.call(u, d);
1584
- if (typeof p != "object") return p;
1585
- throw new TypeError("@@toPrimitive must return a primitive value.");
1586
- }
1587
- return (d === "string" ? String : Number)(u);
1588
- }(a, "string");
1589
- return typeof s == "symbol" ? s : String(s);
1590
- }(c)) in l ? Object.defineProperty(l, c, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : l[c] = m, l;
1591
- }
1592
- return Go;
1593
- }
1594
- var Oa, Aa, ho = {};
1595
- function Gi() {
1596
- if (Oa) return ho;
1597
- Oa = 1, ho.__esModule = !0, ho.resizableProps = void 0;
1598
- var r, i = (r = mn()) && r.__esModule ? r : { default: r };
1599
- Ui();
1600
- var o = { axis: i.default.oneOf(["both", "x", "y", "none"]), className: i.default.string, children: i.default.element.isRequired, draggableOpts: i.default.shape({ allowAnyClick: i.default.bool, cancel: i.default.string, children: i.default.node, disabled: i.default.bool, enableUserSelectHack: i.default.bool, offsetParent: i.default.node, grid: i.default.arrayOf(i.default.number), handle: i.default.string, nodeRef: i.default.object, onStart: i.default.func, onDrag: i.default.func, onStop: i.default.func, onMouseDown: i.default.func, scale: i.default.number }), height: function() {
1601
- for (var t = arguments.length, n = new Array(t), l = 0; l < t; l++) n[l] = arguments[l];
1602
- var c, m = n[0];
1603
- return m.axis === "both" || m.axis === "y" ? (c = i.default.number).isRequired.apply(c, n) : i.default.number.apply(i.default, n);
1604
- }, handle: i.default.oneOfType([i.default.node, i.default.func]), handleSize: i.default.arrayOf(i.default.number), lockAspectRatio: i.default.bool, maxConstraints: i.default.arrayOf(i.default.number), minConstraints: i.default.arrayOf(i.default.number), onResizeStop: i.default.func, onResizeStart: i.default.func, onResize: i.default.func, resizeHandles: i.default.arrayOf(i.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])), transformScale: i.default.number, width: function() {
1605
- for (var t = arguments.length, n = new Array(t), l = 0; l < t; l++) n[l] = arguments[l];
1606
- var c, m = n[0];
1607
- return m.axis === "both" || m.axis === "x" ? (c = i.default.number).isRequired.apply(c, n) : i.default.number.apply(i.default, n);
1608
- } };
1609
- return ho.resizableProps = o, ho;
1610
- }
1611
- function qi() {
1612
- if (Aa) return uo;
1613
- Aa = 1, uo.__esModule = !0, uo.default = void 0;
1614
- var r = function(f, p) {
1615
- if (f && f.__esModule) return f;
1616
- if (f === null || typeof f != "object" && typeof f != "function") return { default: f };
1617
- var g = l(p);
1618
- if (g && g.has(f)) return g.get(f);
1619
- var y = {}, x = Object.defineProperty && Object.getOwnPropertyDescriptor;
1620
- for (var b in f) if (b !== "default" && Object.prototype.hasOwnProperty.call(f, b)) {
1621
- var h = x ? Object.getOwnPropertyDescriptor(f, b) : null;
1622
- h && (h.get || h.set) ? Object.defineProperty(y, b, h) : y[b] = f[b];
1623
- }
1624
- return y.default = f, g && g.set(f, y), y;
1625
- }(le), i = Ui(), o = mu(), t = Gi(), n = ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"];
1626
- function l(f) {
1627
- if (typeof WeakMap != "function") return null;
1628
- var p = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap();
1629
- return (l = function(y) {
1630
- return y ? g : p;
1631
- })(f);
1632
- }
1633
- function c() {
1634
- return c = Object.assign ? Object.assign.bind() : function(f) {
1635
- for (var p = 1; p < arguments.length; p++) {
1636
- var g = arguments[p];
1637
- for (var y in g) Object.prototype.hasOwnProperty.call(g, y) && (f[y] = g[y]);
1638
- }
1639
- return f;
1640
- }, c.apply(this, arguments);
1641
- }
1642
- function m(f, p) {
1643
- var g = Object.keys(f);
1644
- if (Object.getOwnPropertySymbols) {
1645
- var y = Object.getOwnPropertySymbols(f);
1646
- p && (y = y.filter(function(x) {
1647
- return Object.getOwnPropertyDescriptor(f, x).enumerable;
1648
- })), g.push.apply(g, y);
1649
- }
1650
- return g;
1651
- }
1652
- function a(f) {
1653
- for (var p = 1; p < arguments.length; p++) {
1654
- var g = arguments[p] != null ? arguments[p] : {};
1655
- p % 2 ? m(Object(g), !0).forEach(function(y) {
1656
- s(f, y, g[y]);
1657
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(f, Object.getOwnPropertyDescriptors(g)) : m(Object(g)).forEach(function(y) {
1658
- Object.defineProperty(f, y, Object.getOwnPropertyDescriptor(g, y));
1659
- });
1660
- }
1661
- return f;
1662
- }
1663
- function s(f, p, g) {
1664
- return (p = function(y) {
1665
- var x = function(b, h) {
1666
- if (typeof b != "object" || b === null) return b;
1667
- var w = b[Symbol.toPrimitive];
1668
- if (w !== void 0) {
1669
- var v = w.call(b, h);
1670
- if (typeof v != "object") return v;
1671
- throw new TypeError("@@toPrimitive must return a primitive value.");
1672
- }
1673
- return (h === "string" ? String : Number)(b);
1674
- }(y, "string");
1675
- return typeof x == "symbol" ? x : String(x);
1676
- }(p)) in f ? Object.defineProperty(f, p, { value: g, enumerable: !0, configurable: !0, writable: !0 }) : f[p] = g, f;
1677
- }
1678
- function u(f, p) {
1679
- return u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(g, y) {
1680
- return g.__proto__ = y, g;
1681
- }, u(f, p);
1682
- }
1683
- var d = function(f) {
1684
- var p, g;
1685
- function y() {
1686
- for (var b, h = arguments.length, w = new Array(h), v = 0; v < h; v++) w[v] = arguments[v];
1687
- return (b = f.call.apply(f, [this].concat(w)) || this).handleRefs = {}, b.lastHandleRect = null, b.slack = null, b;
1688
- }
1689
- g = f, (p = y).prototype = Object.create(g.prototype), p.prototype.constructor = p, u(p, g);
1690
- var x = y.prototype;
1691
- return x.componentWillUnmount = function() {
1692
- this.resetData();
1693
- }, x.resetData = function() {
1694
- this.lastHandleRect = this.slack = null;
1695
- }, x.runConstraints = function(b, h) {
1696
- var w = this.props, v = w.minConstraints, C = w.maxConstraints, k = w.lockAspectRatio;
1697
- if (!v && !C && !k) return [b, h];
1698
- if (k) {
1699
- var T = this.props.width / this.props.height, M = b - this.props.width, N = h - this.props.height;
1700
- Math.abs(M) > Math.abs(N * T) ? h = b / T : b = h * T;
1701
- }
1702
- var B = b, R = h, S = this.slack || [0, 0], I = S[0], L = S[1];
1703
- return b += I, h += L, v && (b = Math.max(v[0], b), h = Math.max(v[1], h)), C && (b = Math.min(C[0], b), h = Math.min(C[1], h)), this.slack = [I + (B - b), L + (R - h)], [b, h];
1704
- }, x.resizeHandler = function(b, h) {
1705
- var w = this;
1706
- return function(v, C) {
1707
- var k = C.node, T = C.deltaX, M = C.deltaY;
1708
- b === "onResizeStart" && w.resetData();
1709
- var N = (w.props.axis === "both" || w.props.axis === "x") && h !== "n" && h !== "s", B = (w.props.axis === "both" || w.props.axis === "y") && h !== "e" && h !== "w";
1710
- if (N || B) {
1711
- var R = h[0], S = h[h.length - 1], I = k.getBoundingClientRect();
1712
- w.lastHandleRect != null && (S === "w" && (T += I.left - w.lastHandleRect.left), R === "n" && (M += I.top - w.lastHandleRect.top)), w.lastHandleRect = I, S === "w" && (T = -T), R === "n" && (M = -M);
1713
- var L = w.props.width + (N ? T / w.props.transformScale : 0), O = w.props.height + (B ? M / w.props.transformScale : 0), $ = w.runConstraints(L, O);
1714
- L = $[0], O = $[1];
1715
- var D = L !== w.props.width || O !== w.props.height, E = typeof w.props[b] == "function" ? w.props[b] : null;
1716
- E && !(b === "onResize" && !D) && (v.persist == null || v.persist(), E(v, { node: k, size: { width: L, height: O }, handle: h })), b === "onResizeStop" && w.resetData();
1717
- }
1718
- };
1719
- }, x.renderResizeHandle = function(b, h) {
1720
- var w = this.props.handle;
1721
- if (!w) return r.createElement("span", { className: "react-resizable-handle react-resizable-handle-" + b, ref: h });
1722
- if (typeof w == "function") return w(b, h);
1723
- var v = a({ ref: h }, typeof w.type == "string" ? {} : { handleAxis: b });
1724
- return r.cloneElement(w, v);
1725
- }, x.render = function() {
1726
- var b = this, h = this.props, w = h.children, v = h.className, C = h.draggableOpts;
1727
- h.width, h.height, h.handle, h.handleSize, h.lockAspectRatio, h.axis, h.minConstraints, h.maxConstraints, h.onResize, h.onResizeStop, h.onResizeStart;
1728
- var k = h.resizeHandles;
1729
- h.transformScale;
1730
- var T = function(M, N) {
1731
- if (M == null) return {};
1732
- var B, R, S = {}, I = Object.keys(M);
1733
- for (R = 0; R < I.length; R++) B = I[R], N.indexOf(B) >= 0 || (S[B] = M[B]);
1734
- return S;
1735
- }(h, n);
1736
- return (0, o.cloneElement)(w, a(a({}, T), {}, { className: (v ? v + " " : "") + "react-resizable", children: [].concat(w.props.children, k.map(function(M) {
1737
- var N, B = (N = b.handleRefs[M]) != null ? N : b.handleRefs[M] = r.createRef();
1738
- return r.createElement(i.DraggableCore, c({}, C, { nodeRef: B, key: "resizableHandle-" + M, onStop: b.resizeHandler("onResizeStop", M), onStart: b.resizeHandler("onResizeStart", M), onDrag: b.resizeHandler("onResize", M) }), b.renderResizeHandle(M, B));
1739
- })) }));
1740
- }, y;
1741
- }(r.Component);
1742
- return uo.default = d, d.propTypes = t.resizableProps, d.defaultProps = { axis: "both", handleSize: [20, 20], lockAspectRatio: !1, minConstraints: [20, 20], maxConstraints: [1 / 0, 1 / 0], resizeHandles: ["se"], transformScale: 1 }, uo;
1743
- }
1744
- var Ba, La, fo = {};
1745
- function gu() {
1746
- if (Ba) return fo;
1747
- Ba = 1, fo.__esModule = !0, fo.default = void 0;
1748
- var r = function(p, g) {
1749
- if (p && p.__esModule) return p;
1750
- if (p === null || typeof p != "object" && typeof p != "function") return { default: p };
1751
- var y = c(g);
1752
- if (y && y.has(p)) return y.get(p);
1753
- var x = {}, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
1754
- for (var h in p) if (h !== "default" && Object.prototype.hasOwnProperty.call(p, h)) {
1755
- var w = b ? Object.getOwnPropertyDescriptor(p, h) : null;
1756
- w && (w.get || w.set) ? Object.defineProperty(x, h, w) : x[h] = p[h];
1757
- }
1758
- return x.default = p, y && y.set(p, x), x;
1759
- }(le), i = l(mn()), o = l(qi()), t = Gi(), n = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
1760
- function l(p) {
1761
- return p && p.__esModule ? p : { default: p };
1762
- }
1763
- function c(p) {
1764
- if (typeof WeakMap != "function") return null;
1765
- var g = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap();
1766
- return (c = function(x) {
1767
- return x ? y : g;
1768
- })(p);
1769
- }
1770
- function m() {
1771
- return m = Object.assign ? Object.assign.bind() : function(p) {
1772
- for (var g = 1; g < arguments.length; g++) {
1773
- var y = arguments[g];
1774
- for (var x in y) Object.prototype.hasOwnProperty.call(y, x) && (p[x] = y[x]);
1775
- }
1776
- return p;
1777
- }, m.apply(this, arguments);
1778
- }
1779
- function a(p, g) {
1780
- var y = Object.keys(p);
1781
- if (Object.getOwnPropertySymbols) {
1782
- var x = Object.getOwnPropertySymbols(p);
1783
- g && (x = x.filter(function(b) {
1784
- return Object.getOwnPropertyDescriptor(p, b).enumerable;
1785
- })), y.push.apply(y, x);
1786
- }
1787
- return y;
1788
- }
1789
- function s(p) {
1790
- for (var g = 1; g < arguments.length; g++) {
1791
- var y = arguments[g] != null ? arguments[g] : {};
1792
- g % 2 ? a(Object(y), !0).forEach(function(x) {
1793
- u(p, x, y[x]);
1794
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(p, Object.getOwnPropertyDescriptors(y)) : a(Object(y)).forEach(function(x) {
1795
- Object.defineProperty(p, x, Object.getOwnPropertyDescriptor(y, x));
1796
- });
1797
- }
1798
- return p;
1799
- }
1800
- function u(p, g, y) {
1801
- return (g = function(x) {
1802
- var b = function(h, w) {
1803
- if (typeof h != "object" || h === null) return h;
1804
- var v = h[Symbol.toPrimitive];
1805
- if (v !== void 0) {
1806
- var C = v.call(h, w);
1807
- if (typeof C != "object") return C;
1808
- throw new TypeError("@@toPrimitive must return a primitive value.");
1809
- }
1810
- return (w === "string" ? String : Number)(h);
1811
- }(x, "string");
1812
- return typeof b == "symbol" ? b : String(b);
1813
- }(g)) in p ? Object.defineProperty(p, g, { value: y, enumerable: !0, configurable: !0, writable: !0 }) : p[g] = y, p;
1814
- }
1815
- function d(p, g) {
1816
- return d = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(y, x) {
1817
- return y.__proto__ = x, y;
1818
- }, d(p, g);
1819
- }
1820
- var f = function(p) {
1821
- var g, y;
1822
- function x() {
1823
- for (var b, h = arguments.length, w = new Array(h), v = 0; v < h; v++) w[v] = arguments[v];
1824
- return (b = p.call.apply(p, [this].concat(w)) || this).state = { width: b.props.width, height: b.props.height, propsWidth: b.props.width, propsHeight: b.props.height }, b.onResize = function(C, k) {
1825
- var T = k.size;
1826
- b.props.onResize ? (C.persist == null || C.persist(), b.setState(T, function() {
1827
- return b.props.onResize && b.props.onResize(C, k);
1828
- })) : b.setState(T);
1829
- }, b;
1830
- }
1831
- return y = p, (g = x).prototype = Object.create(y.prototype), g.prototype.constructor = g, d(g, y), x.getDerivedStateFromProps = function(b, h) {
1832
- return h.propsWidth !== b.width || h.propsHeight !== b.height ? { width: b.width, height: b.height, propsWidth: b.width, propsHeight: b.height } : null;
1833
- }, x.prototype.render = function() {
1834
- var b = this.props, h = b.handle, w = b.handleSize;
1835
- b.onResize;
1836
- var v = b.onResizeStart, C = b.onResizeStop, k = b.draggableOpts, T = b.minConstraints, M = b.maxConstraints, N = b.lockAspectRatio, B = b.axis;
1837
- b.width, b.height;
1838
- var R = b.resizeHandles, S = b.style, I = b.transformScale, L = function(O, $) {
1839
- if (O == null) return {};
1840
- var D, E, Y = {}, Z = Object.keys(O);
1841
- for (E = 0; E < Z.length; E++) D = Z[E], $.indexOf(D) >= 0 || (Y[D] = O[D]);
1842
- return Y;
1843
- }(b, n);
1844
- return r.createElement(o.default, { axis: B, draggableOpts: k, handle: h, handleSize: w, height: this.state.height, lockAspectRatio: N, maxConstraints: M, minConstraints: T, onResizeStart: v, onResize: this.onResize, onResizeStop: C, resizeHandles: R, transformScale: I, width: this.state.width }, r.createElement("div", m({}, L, { style: s(s({}, S), {}, { width: this.state.width + "px", height: this.state.height + "px" }) })));
1845
- }, x;
1846
- }(r.Component);
1847
- return fo.default = f, f.propTypes = s(s({}, t.resizableProps), {}, { children: i.default.element }), fo;
1848
- }
1849
- var hu = (La || (La = 1, $o.exports = function() {
1850
- throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
1851
- }, $o.exports.Resizable = qi().default, $o.exports.ResizableBox = gu().default), $o.exports);
1852
- function Pn(r, i) {
1853
- if (typeof r == "function") return r(i);
1854
- r && (r.current = i);
1855
- }
1856
- var Fo = parseInt(bs.split(".")[0], 10) >= 19 ? function(r) {
1857
- return (i) => {
1858
- const o = [];
1859
- for (const t of r) {
1860
- const n = Pn(t, i), l = typeof n == "function";
1861
- o.push(l ? n : () => Pn(t, null));
1862
- }
1863
- return () => {
1864
- for (const t of o) t();
1865
- };
1866
- };
1867
- } : function(r) {
1868
- return (i) => {
1869
- for (const o of r) Pn(o, i);
1870
- };
1871
- };
1872
- const Xi = K(J((r, i) => {
1873
- const { disabled: o, names: t, workbook: n, restoreFocus: l, readonly: c = !1, disabled: m = !1, commandPopupButtonProps: a, sx: s, notifier: u, ...d } = r, [f, p] = U(null), [g, y] = U(() => n.getSelectedRanges().getCoords()), [x, b] = U(!1), { reference: h } = oo({ parentFloat: a?.parentFloat }), [w, v] = U(() => c || !n.getProtection().isStructureAllowed()), C = () => f?.text ?? "", [k, T] = U(C), M = ee(() => {
1874
- if (h?.closeAll(), !k) {
1875
- const q = C();
1876
- return T(C()), q;
1877
- }
1878
- if (C() === k) return k;
1879
- const _ = k.trim().toLowerCase();
1880
- if (_ === "r" || _ === "c") return k;
1881
- try {
1882
- const q = n.getRanges(k);
1883
- if (q) return q.toString();
1884
- } catch {
1885
- }
1886
- const ne = t.getByName(k);
1887
- if (ne && ne.getRanges()) return k;
1888
- let ae = null;
1889
- try {
1890
- const q = n.getRanges(k), W = q.getCoords().map((Q) => ({ $colEnd: !0, $rowEnd: !0, $colStart: !0, $rowStart: !0, ...Q }));
1891
- ae = n.getRanges(W);
1892
- } catch {
1893
- }
1894
- if (!ae) {
1895
- const q = n.getSelectedRanges().getCoords().map((W) => ({ $colEnd: !0, $rowEnd: !0, $colStart: !0, $rowStart: !0, ...W }));
1896
- ae = n.getRanges(q);
1897
- }
1898
- try {
1899
- let q = t.getByName(k);
1900
- w || q || (q = t.addReference(k, ae)), q && p({ text: q.getName() });
1901
- } catch (q) {
1902
- T(C()), u.showMessage?.(q.message, { type: wt.Error });
1903
- }
1904
- return null;
1905
- }, [k, t, h, w]), N = ee(() => {
1906
- if (n.isClosed()) return;
1907
- const _ = [];
1908
- for (let q = 0; q < g.length; q++) {
1909
- const W = g[q];
1910
- _.push({ $colEnd: !0, $rowEnd: !0, $colStart: !0, $rowStart: !0, ...W });
1911
- }
1912
- let ne = null;
1913
- try {
1914
- ne = t.lookupByRanges(_);
1915
- } catch {
1916
- }
1917
- let ae = null;
1918
- ae = ne?.length > 0 ? ne[0].getName() : n.getSelectedSheet().getSelectedRange().toString(), p({ text: ae });
1919
- }, [n, g]), [B, R] = U(() => t?.getItems() ?? null);
1920
- _e(t, { onCollectionChange(_) {
1921
- R(t.getItems()), N();
1922
- }, onClose(_) {
1923
- R([]);
1924
- } }), me(() => {
1925
- T(C());
1926
- }, [f, g]);
1927
- const [S, I] = U(n?.getSelectedSheet());
1928
- _e(n, { onProtectionChange: (_) => {
1929
- v(c || !_.getProtection().isStructureAllowed());
1930
- }, onSheetsChange: (_) => {
1931
- I(_?.getSelectedSheet());
1932
- }, onViewChange(_) {
1933
- I(_?.getSelectedSheet());
1934
- } });
1935
- const [L, O] = U(null), $ = ee(Ze.debounce(N, L ? 320 : 0), []);
1936
- _e(S.getSelection(), { onChange: () => {
1937
- y((_) => {
1938
- const ne = n.getSelectedRanges().getCoords();
1939
- return gs.isEqualRangesArrays(ne, _) ? _ : ne;
1940
- });
1941
- }, onAdjustingChange: (_) => {
1942
- O(_.getAdjusting());
1943
- } }), me(() => {
1944
- if (L) {
1945
- const _ = n.getSelectedRange(), ne = _.getRowCount(), ae = _.getColumnCount();
1946
- let q = `${ne}R x ${ae}C`;
1947
- if (q.length > 17 && (q = `${ne}x${ae}`), ne > 1 || ae > 1) return void p({ text: q, fontStyle: "italic", justifyContent: "center" });
1948
- }
1949
- p({ text: n.getSelectedSheet().getSelectedRange().toString() }), $();
1950
- }, [g, n, L]);
1951
- const D = we(null), E = G((_) => {
1952
- const { onMouseDown: ne, onMouseUp: ae, ...q } = _;
1953
- return e(dt, { ...q, sx: { ...q?.sx, display: "flex", flex: "1 1 100%" }, disableRipple: !0, children: e(ir, { inputMode: "text", inputProps: { tabIndex: 0, name: "input-named-range", maxLength: 255, className: "input", autoFocus: !1, spellCheck: !1, autoComplete: "off", ref: D }, sx: { "&::before": { borderBottom: "1px solid transparent" }, "&:hover:not(.Mui-disabled):not(.Mui-focused):not(.Mui-error):before": { borderBottom: (W) => `1px solid ${W.palette.text.icon ?? W.palette.action.active}` }, "&:hover:not(.Mui-disabled):not(.Mui-error):before": { borderBottom: (W) => `1px solid ${W.palette.primary.main}` }, "::after": { borderBottom: (W) => `1px solid ${W.palette.primary.main}` }, paddingTop: "0px", paddingBottom: "0px", fontSize: 11 * Bt.getDeviceScale(), fontStyle: f?.fontStyle, paddingLeft: (W) => W.spacing(0.75), paddingRight: (W) => W.spacing(0.75), boxShadow: "none", flex: "1", color: (W) => W.palette.text.secondary, input: { padding: "0", textAlign: "left", "&:hover:not(.Mui-disabled):not(.Mui-error)": { color: (W) => W.palette.text.primary }, "&:focus:not(.Mui-disabled):not(.Mui-error)": { color: (W) => W.palette.text.primary } } }, value: k, onFocus: (W) => {
1954
- W.target?.select();
1955
- }, onKeyDown: (W) => {
1956
- if (W.which === be.Enter || W.which === be.Tab) {
1957
- let Q = k;
1958
- C() !== k && (W.stopPropagation(), W.preventDefault(), Q = M()), Q ? Y(Q) : l?.();
1959
- } else if (W.which === be.Escape) C() !== k ? (T(C()), setTimeout(() => {
1960
- W.target?.select();
1961
- }, 0), W.stopPropagation(), W.preventDefault()) : l?.();
1962
- else if (W.which === be.Space) return void W.stopPropagation();
1963
- }, onBlur: () => {
1964
- T(C());
1965
- }, onChange: (W) => {
1966
- T(W.target.value);
1967
- } }) });
1968
- }, [k, f]), Y = ee(async (_) => {
1969
- try {
1970
- h?.closeAll();
1971
- const ne = t.lookupByRanges(_)?.[0];
1972
- ne && await ne?.select(), await n.getRanges(_)?.select();
1973
- } catch (ne) {
1974
- u.showMessage?.(ne.message, { type: wt.Error });
1975
- }
1976
- }, [t, u, n]), Z = G((_) => {
1977
- setTimeout(() => {
1978
- b(!0);
1979
- }, 0);
1980
- const ne = { variant: ie.Menuitem, parentFloat: _.floatReference, commandHook: { ...a?.commandHook, beforeExecute: (Fe, Be) => (h?.closeAll(), a?.commandHook?.beforeExecute?.(Fe, Be)) }, scope: a?.scope, commands: a?.commands };
1981
- let ae = t.getItems({ scope: n?.getSelectedSheet().getName() });
1982
- ae = ae.sort((Fe, Be) => Fe.getType() === Be.getType() ? Fe.getName().localeCompare(Be.getName()) : Fe.getType() === "range" ? -1 : 1);
1983
- const q = w ? null : ["editNamedReference", "deleteNamedReference"], W = w ? null : ["editTable", null, "convertTableToRange", "deleteTable"], Q = [], ue = ae.length;
1984
- for (let Fe = 0; Fe < ue; Fe++) {
1985
- const Be = ae[Fe], Ye = Be.getRanges();
1986
- if (!Ye || Be.isHidden()) continue;
1987
- const ve = Be.getType();
1988
- ve !== ae[Fe - 1]?.getType() && (Fe > 0 && Q.push(e(re, { orientation: "horizontal" }, `type-divider-${Q.length}`)), Q.push(e(to, { variant: "subtitle2", sx: { paddingLeft: "16px" }, children: Be.getType() === "reference" ? "Ranges" : "Tables" }, `type-header-${Q.length}`))), ve === "reference" ? Q.push(Pe(ct, { ...ne, key: "named-" + Q.length, popupCommandKeys: q, popupScope: "namedItem", scope: "namedItem", commandState: Be, commands: a?.commands, label: Be.getName(), quickCommand: "selectNamed", disabled: !Be.getRanges() || m, icon: (je) => {
1989
- switch (je.key()) {
1990
- case "editNamedReference":
1991
- return P(e(Gc, {}));
1992
- case "deleteNamedReference":
1993
- return P(e(Uc, {}));
1994
- default:
1995
- return P(e(_c, {}));
1996
- }
1997
- } })) : ve === "table" && Q.push(Pe(ct, { ...ne, key: "namedItem-" + Q.length, popupCommandKeys: W, popupScope: "namedItem", scope: "namedItem", commands: a?.commands, commandState: Be, label: Be.getName(), quickCommand: "selectNamed", disabled: !Ye || m, icon: (je) => (je.key(), P(e(an, {}))) }));
1998
- }
1999
- const Le = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, ...d, children: [w ? null : e(F, { ...ne, scope: "namedItem", command: a?.commands.getCommand("addNamedReference"), icon: P(e(qc, {})) }), Q && Q.length > 0 ? z(se, { children: [w ? null : e(re, { orientation: "horizontal" }), e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: Q })] }) : null] });
2000
- return Se({ ..._, children: Le });
2001
- }, [n, B, t, f, w]), X = zt(i, () => ({ focus(_) {
2002
- D.current?.focus(_);
2003
- } }), []);
2004
- return e(A, { className: "outer", sx: { minWidth: 120, flex: "1 1 100%", display: "flex", alignItems: "center", justifyContent: "start", ...s }, ref: Fo([X, i]), ...d, children: e(vt, { className: "outer-button", sx: { display: "flex", flex: "1 1 100%", "& .tooltip-wrapper": { display: "flex", flex: "1 1 100%", width: "100%", height: "27px" }, ...s }, buttonProps: { sx: { backgroundColor: (_) => _.palette.background.paper, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` } }, tabIndex: -1, outlined: { color: (_) => o ? _.palette.action.disabled : he(_.palette.divider, 0.2) }, parentFloat: h, createPopupPanel: Z, onPopupOpen: () => b(!0), onPopupClose: () => b(!1), createTooltip: ({ children: _ }, ne) => e(rt, { title: ne || x ? "" : "Name Box", disabled: ne, leaveDelay: 0, sx: { opacity: ne || x ? 0 : 1 }, children: _ }), createQuickButton: E }) });
2005
- }));
2006
- Xi.displayName = "NamedCollectionEditor";
2007
- const fu = (r, i) => e(Xi, { ref: i, ...r }), Ki = K(J((r, i) => {
2008
- const { sx: o, workbook: t, sheetElement: n, gridStyle: l, showNamedCollectionEditor: c = !0, NamedCollectionEditorProps: m, renderNamedCollectionEditor: a = fu, disabled: s, commands: u, ...d } = r, [f, p] = U(t?.getSelectedSheet());
2009
- _e(t, { onSheetsChange: (W) => {
2010
- p(W?.getSelectedSheet());
2011
- }, onViewChange(W) {
2012
- p(W?.getSelectedSheet());
2013
- } });
2014
- const [g, y] = U(f.getSelection().getCoords().cell), x = f.getRange(g).getCell(), b = s || !x.isEditAllowed(), h = we(null), w = j(() => ({ fontSize: 11 }), []);
2015
- _e(f.getSelection(), { onChange: () => {
2016
- y(f.getSelection().getCoords().cell);
2017
- } }), _e(f, { onProtectionChange() {
2018
- y(f.getSelection().getCoords().cell);
2019
- } });
2020
- const v = h.current?.getLineHeight() ?? 20, [C, k] = U(v), [T, M] = U(5), [N, B] = U(1), R = ee((W, { size: Q }) => {
2021
- W.preventDefault(), W.stopPropagation();
2022
- const ue = Math.floor(Q.height / v);
2023
- k(ue * v + 1), ue > 1 && M(ue);
2024
- }, [v]), S = ee((W, { size: Q }) => {
2025
- const ue = Math.floor(Q.height / v);
2026
- B(ue);
2027
- }, [v]), I = un(), L = I.getMode();
2028
- let O = null;
2029
- L?.key === "edit" && (O = L.args?.stateAndCoords);
2030
- const $ = j(() => {
2031
- let W = O?.editState;
2032
- return W || (W = ip(() => f.getRange(g).getCell())), e(A, { sx: { display: "flex", flex: "1 1 100%", flexDirection: "row", gap: 4 }, children: e(lp, { ref: h, activeCoords: g, sheet: f, onFocus: () => {
2033
- n?.startEdit({ autoFocus: !1, editMode: !0, cell: g });
2034
- }, defaultTextStyle: w, useRichStyling: !1, disabled: b, onChangeEdit: (Q) => {
2035
- if (Q.dirty !== void 0) {
2036
- const ue = { sheet: f, coords: g, editState: Q };
2037
- I.setMode((Le) => ({ ...Le, args: { ...Le?.args, stateAndCoords: ue } }));
2038
- }
2039
- }, editState: W, commands: u, onCancelEdit: () => {
2040
- n?.cancelEdit(), n?.focus();
2041
- }, onSubmitEdit: () => {
2042
- n?.submitEdit(), n?.focus();
2043
- }, linesVisible: N }) });
2044
- }, [f, O, g, N, n]), D = we(null), E = j(() => c ? a({ names: t.getNames(), workbook: t, ...m }, D) : null, [a, m, c, f, t, b]), Y = j(() => z(Po, { elevation: 0, sx: { display: "flex", alignItems: "center", userSelect: "none", flexGrow: 0, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})`, border: (W) => `solid ${b ? W.palette.action.disabled : he(W.palette.divider, 0.2)} 1px` }, children: [e(bt, { sx: { padding: "0px", margin: "0px 0px", border: "none !important", "&.Mui-focusVisible": { border: "none" }, "&:hover:not([disabled])": { border: "none" } }, dense: !0, outlined: !1, color: "warning", "aria-label": "cancel-formula-edit", icon: P(e(Xc, {})), tooltipProps: { label: "Cancel", simple: !0 }, disabled: b || O === null, onMouseDown: (W) => {
2045
- W.button === 0 && W.preventDefault();
2046
- }, onClick: () => {
2047
- n.cancelEdit();
2048
- } }), e(bt, { sx: { padding: "0px", margin: "0px 0px", border: "none !important", "&.Mui-focusVisible": { border: "none" }, "&:hover:not([disabled])": { border: "none" } }, dense: !0, outlined: !1, color: "primary", "aria-label": "commit-formula-edit", icon: P(e(Kc, {})), tooltipProps: { label: "Enter", simple: !0 }, disabled: b || O === null, onMouseDown: (W) => {
2049
- W.button === 0 && W.preventDefault();
2050
- }, onClick: () => {
2051
- n.submitEdit();
2052
- } }), e(bt, { sx: { padding: "0px", margin: "0px 0px", border: "none !important", "&.Mui-focusVisible": { border: "none" }, "&:hover:not([disabled])": { border: "none" } }, dense: !0, outlined: !1, disabled: !0, "aria-label": "commit-formula-function", icon: P(e(Yc, { sx: { transform: "scale(0.85)" } })), tooltipProps: { label: "Insert Function", simple: !0 }, onMouseDown: (W) => {
2053
- W.button === 0 && W.preventDefault();
2054
- } })] }), [b, O]), Z = at(), [X, _] = U(!1), ne = j(() => z(A, { sx: { display: "flex", flexDirection: "row", flex: "1 1 100%", gap: (W) => W.spacing(0.5), alignItems: "start" }, children: [Y, z(Po, { elevation: 0, sx: { display: "flex", flexDirection: "row", flex: "1 1 100%", position: "relative", fontFamily: (W) => W.typography.fontFamily, fontSize: 11 * Bt.getDeviceScale(), "& .editor-placement": { top: "2px !important" }, boxShadow: "none", borderRadius: (W) => `${W.shape.borderRadius}px`, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})`, border: (W) => `solid ${b ? W.palette.action.disabled : he(W.palette.divider, 0.2)} 1px`, "& textarea": { color: (W) => b ? `${W.palette.text.disabled} !important` : W.palette.text.primary }, "& .react-resizable-handle": { width: "100%", height: "8px", backgroundColor: "transparent", boxSizing: "content-box", zIndex: 1e3 }, "& .react-resizable-handle-s": { position: "absolute", bottom: "-10px", cursor: "s-resize" } }, onFocus: () => _(!0), onBlur: () => _(!1), onMouseDown: (W) => {
2055
- W.target?.classList.contains("react-resizable-handle") && W.preventDefault();
2056
- }, children: [e(A, { className: "formula-editor", sx: { display: "flex", flexDirection: "row", flex: "1 1 100%", position: "relative", alignSelf: "baseline", paddingLeft: (W) => W.spacing(1), paddingRight: (W) => W.spacing(1) }, children: e(hu.ResizableBox, { height: C, draggableOpts: { grid: [v, v] }, minConstraints: [v, v], maxConstraints: [15 * v, 15 * v], onResize: S, onResizeStop: R, resizeHandles: ["s"], axis: "y", style: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, children: $ }) }), e(bt, { sx: { padding: "0px", margin: "0px 0px", border: "none !important", "&.Mui-focusVisible": { border: "none" }, "&:hover:not([disabled])": { border: "none" } }, dense: !0, outlined: !1, "aria-label": "toggle-expand-formula-edit", icon: P(e(N > 1 ? Yd : Ci, {})), tooltipProps: { label: (N > 1 ? "Collapse" : "Expand") + " Formula Bar", simple: !0 }, onMouseDown: (W) => {
2057
- W.button === 0 && W.preventDefault();
2058
- }, onClick: () => {
2059
- const W = N > 1 ? 1 : T;
2060
- k(W * v + 1), B(W);
2061
- } }), e(A, { sx: { position: "absolute", width: "100%", height: "2px", bottom: "0", willChange: "opacity", transition: "opacity 60ms ease-in", opacity: X ? 1 : 0, borderBottomWidth: "2px", borderBottomStyle: "solid", borderBottomColor: (W) => W.palette.primary.main, borderRadius: (W) => `${W.shape.borderRadius}px` } })] })] }), [Y, $, X, N, v]), ae = j(() => E || ne ? !E && ne ? ne : E && !ne ? E : e(se, { children: e(qn, { fixedPane: "before", minBefore: "165px", minAfter: "200px", paneBeforeProps: { style: { alignItems: "flex-start" } }, paneAfterProps: { style: { overflow: "visible" } }, resizerProps: { style: { backgroundImage: `url("data:image/svg+xml,%3Csvg width='6' height='13' viewBox='0 0 6 13' version='1.1' fill='${Z.palette.text.icon ?? Z.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='m 4.5961932,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.88365,0 -1.60005,-0.71626 -1.60005,-1.59991 0,-0.88365 0.7164,-1.6000508 1.60005,-1.6000508 0.88364,0 1.59991,0.7164008 1.59991,1.6000508 m 0,-4.881294 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 -0.88365,0 -1.60005,-0.7164 -1.60005,-1.60004 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-4.881226 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 -0.88365,0 -1.60005,-0.7164 -1.60005,-1.60005 0,-0.88365 0.7164,-1.59991 1.60005,-1.59991 0.88364,0 1.59991,0.71626 1.59991,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center 6.5px", minWidth: "18px" } }, elementBefore: E, elementAfter: ne }) }) : null, [E, ne]), q = zt(i, () => ({ isFormulaBarElement: () => !0, getNamedCollectionEditorElement: () => D.current }), []);
2062
- return e(A, { sx: { display: "flex", flexDirection: "row", gap: (W) => W.spacing(0.5), ...o }, ref: q, ...d, children: ae });
2063
- }));
2064
- Ki.displayName = "FormulaBar";
2065
- const Yi = K(J((r, i) => {
2066
- const { filter: o, commands: t, disabled: n, sx: l, floatReference: c, ...m } = r, a = j(() => ({}), []), s = j(() => ({ commandHook: { beforeExecute: (f, p) => c.closeAll(), onExecute() {
2067
- }, onError() {
2068
- console.log("onError");
2069
- } }, disabled: n, parentFloat: c }), [n, c]), u = j(() => ({ ...a, ...s, variant: ie.Menuitem }), [a, s]), d = z(se, { children: [e(F, { ...u, command: t.getCommand("sortAscending"), icon: P(e(Vn, {})) }), e(F, { ...u, command: t.getCommand("sortDescending"), icon: P(e(hi, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...u, command: t.getCommand("autoFilterClear"), icon: P(e(pr, {})) }), []] });
2070
- return e(A, { ref: i, sx: { paddingTop: "4px", paddingBottom: "4px", display: "flex", flexDirection: "column", ...l }, ...m, children: d });
2071
- }));
2072
- Yi.displayName = "FilterColumnMenu";
2073
- const bu = K(J((r, i) => {
2074
- const { children: o, className: t, disabled: n, style: l, filter: c, ...m } = r, a = zt(i, () => ({ isFilters: () => !0 }), []);
2075
- return e("div", { ref: a, className: Ae("filters", t), style: { position: "relative", display: "flex", flexDirection: "column", alignItems: "center", gap: "8px", ...l }, ...m, children: z("div", { style: { flex: "1 1 100%", display: "flex", minHeight: "100px", minWidth: "220px", alignItems: "center", border: "grey solid 1px", padding: "4px 4px", overflow: "hidden", flexDirection: "column", justifyContent: "space-evenly", marginTop: "4px", marginBottom: "4px", marginLeft: "16px", marginRight: "16px" }, children: [e("div", { children: c.getName() }), e("div", { children: "Filter Widget" })] }) });
2076
- }));
2077
- bu.displayName = "Filters";
2078
- const Zi = K(J((r, i) => {
2079
- const { children: o, sheet: t, style: n, className: l, value: c, index: m, editing: a, editable: s, disabled: u, selectedIndex: d, dragging: f, borderColor: p, borderWidth: g, activeColor: y, background: x = "white", tabRadius: b = 4, gridTheme: h, ...w } = r, [v, C] = U(() => !!t && t.getProtection().isLocked()), [k, T] = U(() => t ? t.getTabColor() : null);
2080
- _e(t, { onProtectionChange: () => {
2081
- C(t.getProtection().isLocked());
2082
- }, onTabColorChange: () => {
2083
- T(t.getTabColor());
2084
- }, onStyleChange: () => {
2085
- T(t.getTabColor());
2086
- } });
2087
- const M = at(), N = d === m;
2088
- let B = null, R = null;
2089
- if (k || f) {
2090
- let L = x;
2091
- k ? (R = k.toBlackOrWhite().toCSS(), L = k?.toCSS()) : N || (L = M.palette.background.paper), B = e(A, { sx: { position: "absolute", boxSizing: "border-box", top: "3px", left: "4px", right: "4.5px", bottom: "1.5px", opacity: N ? "50%" : "100%", borderRadius: "4px", border: (O) => N ? `${x} solid 1px` : `${O.palette.divider} solid 1px`, background: N && k ? `linear-gradient(0deg, ${L} 0%, transparent)` : L } });
2092
- }
2093
- let S = null;
2094
- typeof p == "string" ? S = p : p?.toCSS && (S = p.toCSS());
2095
- const I = N ? e(A, { sx: { width: "100%", borderRadius: "4px", minWidth: "4px", height: "2px", backgroundColor: (L) => L.palette.primary.main } }) : null;
2096
- return e(Ei, { theme: N ? h ?? M : M, children: e(A, { ref: i, className: Ae(l), sx: { ...n, display: "flex", flexDirection: "column", minHeight: "0px", fontWeight: N ? "700" : "400", fontSize: "0.85rem", letterSpacing: "0", lineHeight: "1", textTransform: "none", minWidth: "unset", cursor: f ? "grabbing" : void 0 }, ...w, children: e(tp, { style: { flex: "1 1 100%", display: "flex", flexDirection: "row" }, radius: b, strokeColor: N ? S : "transparent", children: e(nn, { sx: { textTransform: "none", borderRadius: "0px", minHeight: "0px", paddingLeft: "11px", paddingRight: "12px", paddingTop: "3px", flex: "1 1 100%", paddingBottom: "3px", fontWeight: N ? "700" : "400", fontSize: "0.85rem", letterSpacing: "0", transition: "none", cursor: f ? "grabbing" : void 0, color: N ? "primary" : R || "text.secondary", backgroundColor: N ? x : "transparent", "&:hover:not([disabled])": { backgroundColor: N ? x : "transparent" }, "& input": { color: (L) => `${L.palette.text.primary}`, textAlign: "center", fontWeight: "500" }, marginTop: "0px", minWidth: "unset" }, disabled: u, disableRipple: a, component: "div", children: z(se, { children: [B, z(A, { sx: { zIndex: "1", display: "flex", flexDirection: "row", alignItems: "center" }, children: [z(A, { sx: { display: "flex", flexDirection: "column", alignItems: "center", rowGap: "1px", lineHeight: "1", marginTop: N ? void 0 : "1px" }, children: [o, I] }), v ? e(dn, { sx: { scale: "0.80", marginLeft: "2px", width: "22px", height: "22px" }, color: "secondary" }) : e(A, { sx: { minHeight: "22px" } })] })] }) }, c + ":" + m) }) }) });
2097
- }));
2098
- Zi.displayName = "SheetTab";
2099
- const Ji = K(J((r, i) => {
2100
- const { workbook: o, index: t, commands: n, scope: l = "sheet", disabled: c, floatReference: m, sx: a, className: s, tabStripRef: u, ...d } = r, [f, p] = U(o?.getProtection());
2101
- _e(o, { onProtectionChange: (h) => {
2102
- p(h?.getProtection());
2103
- } });
2104
- const g = j(() => ({}), []), y = j(() => ({ commandHook: { beforeExecute: (h, w) => m.closeAll(), onExecute() {
2105
- }, onError() {
2106
- console.log("onError");
2107
- } }, scope: l, commandState: t, disabled: c || t === void 0, parentFloat: m }), [c, m]), x = j(() => ({ ...g, ...y }), [g, y]), b = z(se, { children: [e(F, { command: n.getCommand("addSheet"), commandState: t, ...x, variant: ie.Menuitem }), e(F, { command: n.getCommand("deleteSheet"), ...x, variant: ie.Menuitem }), z(pt, { onMouseDown: (h) => {
2108
- h.button === 0 && h.preventDefault();
2109
- }, onMouseUp: () => {
2110
- Promise.resolve(m.closeAll()).then(() => {
2111
- u?.startEdit(t);
2112
- });
2113
- }, disabled: c || !f.isStructureAllowed(), parentFloat: m, children: ["Rename", l !== "sheet" ? " Sheet" : ""] }), e(F, { command: n.getCommand("duplicateSheet"), ...x, variant: ie.Menuitem }), e(F, { command: n?.getCommand("protectionSheetToggle"), ...x, variant: ie.Menuitem, icon: e(dn, {}) }), e(Mo, { variant: ie.Menuitem, command: n.getCommand("formatSheetTabColor"), icon: e(cr, {}), panelProps: { disableAlpha: !0, autoColorLabel: "No Tab Color", autoColorPosition: Eo.End }, parentFloat: m }), e(re, { orientation: "horizontal" }), e(F, { command: n.getCommand("hideSheet"), ...x, variant: ie.Menuitem, icon: P(e(wi, {})) })] });
2114
- return e(A, { ref: i, className: Ae("menu", s), sx: { ...a }, ...d, children: b });
2115
- }));
2116
- Ji.displayName = "SheetTabMenu";
2117
- const Qi = K(J((r, i) => {
2118
- const { workbook: o, gridStyle: t, floatReference: n, closeFloatAll: l, className: c, ...m } = r, [a, s] = U(o?.getSheets().getItems()), [u, d] = U(o?.getProtection());
2119
- _e(o, { onSheetsChange: (p) => {
2120
- s(p.getSheets().getItems());
2121
- }, onProtectionChange: (p) => {
2122
- d(p?.getProtection());
2123
- } });
2124
- const f = j(() => {
2125
- const p = [], g = o.getSheets().getItems({ visibility: Rt.Visibility.Hidden }), y = o.getSelectedSheet();
2126
- for (let x = 0; x < g.length; x++) {
2127
- const b = g[x], h = b.getVisibility();
2128
- if (h === Rt.Visibility.VeryHidden) continue;
2129
- const w = y === b, v = b.getProtection().isLocked(), C = b.getTabColor(), k = t?.body.fill ?? "transparent";
2130
- let T = null, M = null, N = k;
2131
- C && (N = C.toCSS(), w || (M = C.toBlackOrWhite().toCSS()), T = e(A, { sx: { position: "absolute", display: "flex", flexDirection: "column", top: "4px", left: "40px", right: "8px", bottom: "4px", background: w ? N : "transparent", borderRadius: "4px", border: `solid 1px ${t.header.edgeStrokeFill}` }, children: e(A, { sx: { flex: "1 1 100%", boxSizing: "content-box", opacity: w || h === Rt.Visibility.Hidden ? "50%" : "100%", border: (R) => w ? `${k} solid 1.5px` : `${R.palette.divider} solid 1px`, background: w && C ? `linear-gradient(0deg, ${N} 0%, ${k})` : N, borderRadius: "4px" } }) }));
2132
- let B = null;
2133
- v && (B = e(dn, { color: "secondary" })), h !== Rt.Visibility.Visible && (B = P(e(wi, { style: { opacity: u.isStructureAllowed() ? 1 : 0.7 }, color: "secondary" }))), B && (B = e(A, { sx: { display: "flex", flex: "1 1 100%", alignItems: "center", ml: "16px", "& *": { lineHeight: "1em", fontSize: "1.3em" } }, children: B })), p.push(e(pt, { disabled: !u.isStructureAllowed() && h === Rt.Visibility.Hidden, sx: { color: (R) => {
2134
- let S = w ? R.palette.primary.main : R.palette.text.secondary;
2135
- return M && (S = M), h === Rt.Visibility.Hidden && (S = Qe(S, R.palette.action.disabledOpacity)), S;
2136
- }, borderLeft: (R) => `${w ? R.palette.primary.main : "transparent"} solid 2px`, paddingLeft: "4px", fontWeight: w ? "700" : "400", "&:hover": { fontWeight: "700" } }, icon: w ? e(sn, {}) : void 0, onMouseDown: (R) => R.preventDefault(), onMouseUp: () => {
2137
- Promise.resolve(n.closeAll()).then(() => {
2138
- try {
2139
- b.select();
2140
- } catch (R) {
2141
- console.error(R);
2142
- }
2143
- });
2144
- }, children: z(se, { children: [T, z(A, { sx: { paddingRight: "0px", paddingLeft: "4px", display: "flex", flexDirection: "row", flex: "1 1 100%", overflow: "hidden", alignItems: "center", zIndex: 2 }, children: [z(A, { className: "sheet-name", sx: { display: "flex", flexDirection: "column", paddingLeft: "8px", paddingRight: "8px", alignItems: "center" }, children: [b.getName(), e(A, { sx: { height: "0px", opacity: "0", fontWeight: "700" }, children: b.getName() })] }), B] })] }) }, "" + x));
2145
- }
2146
- return p;
2147
- }, [o, u, a, n, t]);
2148
- return e(A, { ref: i, className: Ae("menu", c), ...m, children: f });
2149
- }));
2150
- Qi.displayName = "SheetsAllMenu";
2151
- let qo = !1, el = !1, Pt = null;
2152
- const Ha = async (r) => {
2153
- const i = await vo.getDetails();
2154
- if (el || i.isEval()) {
2155
- try {
2156
- const o = top ?? window;
2157
- o.SheetXL || (o.SheetXL = Object.freeze({ getSelectedWorkbook: () => Pt?.getWorkbook(), getSelectedSheet: () => Pt?.getWorkbook().getSelectedSheet(), getSelectedRange: () => Pt?.getWorkbook().getSelectedRange(), getRange: (t) => Pt?.getWorkbook().getRange(t), getSelectedWorkbookElement: () => Pt, getLicenseManager: () => vo, moreExamples: () => {
2158
- console.table({ "SheetXL.getRange('Sheet1!e5:f6').setValues([[110, 220], [210, 220]])": { Summary: "Set an array of values." }, "SheetXL.getRange('a1:e5').setValue(100)": { Summary: "Set a single repeating value to a range." }, "SheetXL.getRange('Sheet1!e5:f6').getValues()": { Summary: "Get the values as a 2d array (see forEach)." }, "SheetXL.getSelectedRange().setValue(new Date())": { Summary: "Set current date/time using Javascript Date." }, "SheetXL.getSelectedRange().setValue('10/23/95')": { Summary: "Set current date/time using string." }, "SheetXL.getSelectedSheet().getUsedRange().getValues()": { Summary: "Get all of the values in a sheet." }, "SheetXL.getSelectedRange().updateStyle({ fill: 'accent4' })": { Summary: "Set fill to theme color 4." }, "SheetXL.getRange('E:L').updateStyle({ fill: 'accent1 lumMod 90 lumOff 40' })": { Summary: "Set some columns to a modified theme color." }, "SheetXL.getRange('e5:f10').updateStyle({ style: { border: 'double blue' }})": { Summary: "Set border." }, "SheetXL.getCell().getStyle().fill.toCSS()": { Summary: "Get the fill style as css for the selected cell." }, "SheetXL.getRange('a1:a3').autoFill('a1:a7')": { Summary: "Autofill down." }, "SheetXL.getRange('e7:i9').merge({ orientation: 'rows' })": { Summary: "Merge cells horizontally." }, "SheetXL.getSelectedRange().sort({ ascending: false, hasHeader: false })": { Summary: "Sort selected cells ascending with a header." }, "SheetXL.getSelectedRange().clear('all')": { Summary: "Clear the current range a different way." }, "SheetXL.getSelectedSheet().getTables().add('b2:e9')": { Summary: "Create a 4x8 table at b2 for current sheet." }, "SheetXL.getRange('a1:c3').copyFrom('e1:g3')": { Summary: "Copy cells." }, "SheetXL.getRange('c:t').getColumnHeaders().setSize(30)": { Summary: "Set the size of columns to 30 pixels." }, "SheetXL.getRange('2:3').delete()": { Summary: "Remove rows 2 and 3 and shift up." }, "SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg')": { Summary: "Add an image." }, "SheetXL.getSelectedSheet().getMovables().addImage('https://www.sheetxl.com/logo-text.svg', { bounds: { height: 100 } })": { Summary: "Add an image of height 100." }, "SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue(1.50).updateStyle({ numberFormat: '0%' }).autoFit(); }, 'Enter 150%')": { Summary: "Set value to 100 and numberformat to 0% as a single." }, "SheetXL.getSelectedRange().doBatch(() => { SheetXL.getSelectedRange().setValue('Remind Me Later').updateStyle({ namedStyle: 'Note'}).autoFit(); }, 'Set Reminder')": { Summary: "Set a value and style to Note style and autofit text." }, "SheetXL.getSelectedWorkbook().getNames().addReference('Small_Range', 'A2:E5');": { Summary: "Add a named range." }, "SheetXL.getSelectedWorkbook().getRange('a1:e5').addListener((e) => { console.log('got an update for:', e.getSource().toString()) })": { Summary: "Listen for updates at a range." } });
2159
- } }));
2160
- } catch (o) {
2161
- o instanceof DOMException || console.error(o), qo = !0;
2162
- }
2163
- if (Pt !== r && (Pt = r, !qo)) try {
2164
- qo = !0, (top ?? window).SheetXL && (await vo._validate(!0), vo.wasPrinted() && (() => {
2165
- Jt.consoleWithNoSource(`%cTip: You can access the API directly in the console.
2166
- Try
2167
- %c>%c SheetXL.getRange('b2:c3').setValues([[42, 'Hello Word'], [new Date(), true]]) %c
2168
- >%c SheetXL.moreExamples()`, "color:#ffa726;", "font-family:monospace;color:#1976d2;font-size:12px;", "font-family:monospace;", "font-family:monospace;color:#1976d2;font-size:12px;", "font-family:monospace;"), qo = !0;
2169
- const o = document.getElementById("openEditorLink");
2170
- o && o.addEventListener("click", (t) => {
2171
- t.preventDefault(), console.log("openScriptEditor called from console");
2172
- });
2173
- })());
2174
- } catch (o) {
2175
- o instanceof DOMException || console.error(o);
2176
- }
2177
- }
2178
- }, jm = (r) => {
2179
- el = r;
2180
- };
2181
- var xu = function() {
2182
- }, tl = typeof window < "u", yu = tl ? St : me, za = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
2183
- const Io = tl && window.ResizeObserver !== void 0 ? function() {
2184
- var r = U(null), i = r[0], o = r[1], t = U(za), n = t[0], l = t[1], c = j(function() {
2185
- return new window.ResizeObserver(function(m) {
2186
- if (m[0]) {
2187
- var a = m[0].contentRect, s = a.x, u = a.y, d = a.width, f = a.height, p = a.top, g = a.left, y = a.bottom, x = a.right;
2188
- l({ x: s, y: u, width: d, height: f, top: p, left: g, bottom: y, right: x });
2189
- }
2190
- });
2191
- }, []);
2192
- return yu(function() {
2193
- if (i) return c.observe(i), function() {
2194
- c.disconnect();
2195
- };
2196
- }, [i]), [o, n];
2197
- } : function() {
2198
- return [xu, za];
2199
- };
2200
- function Kn() {
2201
- return Kn = Object.assign ? Object.assign.bind() : function(r) {
2202
- for (var i = 1; i < arguments.length; i++) {
2203
- var o = arguments[i];
2204
- for (var t in o) ({}).hasOwnProperty.call(o, t) && (r[t] = o[t]);
2205
- }
2206
- return r;
2207
- }, Kn.apply(null, arguments);
2208
- }
2209
- function ol(r, i) {
2210
- if (r == null) return {};
2211
- var o = {};
2212
- for (var t in r) if ({}.hasOwnProperty.call(r, t)) {
2213
- if (i.indexOf(t) !== -1) continue;
2214
- o[t] = r[t];
2215
- }
2216
- return o;
2217
- }
2218
- function Yn(r, i) {
2219
- return Yn = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, t) {
2220
- return o.__proto__ = t, o;
2221
- }, Yn(r, i);
2222
- }
2223
- function nl(r, i) {
2224
- r.prototype = Object.create(i.prototype), r.prototype.constructor = r, Yn(r, i);
2225
- }
2226
- function Wa(r, i) {
2227
- return r.replace(new RegExp("(^|\\s)" + i + "(?:\\s|$)", "g"), "$1").replace(/\s+/g, " ").replace(/^\s*|\s*$/g, "");
2228
- }
2229
- const ja = !1, rl = le.createContext(null);
2230
- var al = function(r) {
2231
- return r.scrollTop;
2232
- }, ko = "unmounted", Mt = "exited", It = "entering", qt = "entered", Zn = "exiting", ht = function(r) {
2233
- function i(t, n) {
2234
- var l;
2235
- l = r.call(this, t, n) || this;
2236
- var c, m = n && !n.isMounting ? t.enter : t.appear;
2237
- return l.appearStatus = null, t.in ? m ? (c = Mt, l.appearStatus = It) : c = qt : c = t.unmountOnExit || t.mountOnEnter ? ko : Mt, l.state = { status: c }, l.nextCallback = null, l;
2238
- }
2239
- nl(i, r), i.getDerivedStateFromProps = function(t, n) {
2240
- return t.in && n.status === ko ? { status: Mt } : null;
2241
- };
2242
- var o = i.prototype;
2243
- return o.componentDidMount = function() {
2244
- this.updateStatus(!0, this.appearStatus);
2245
- }, o.componentDidUpdate = function(t) {
2246
- var n = null;
2247
- if (t !== this.props) {
2248
- var l = this.state.status;
2249
- this.props.in ? l !== It && l !== qt && (n = It) : l !== It && l !== qt || (n = Zn);
2250
- }
2251
- this.updateStatus(!1, n);
2252
- }, o.componentWillUnmount = function() {
2253
- this.cancelNextCallback();
2254
- }, o.getTimeouts = function() {
2255
- var t, n, l, c = this.props.timeout;
2256
- return t = n = l = c, c != null && typeof c != "number" && (t = c.exit, n = c.enter, l = c.appear !== void 0 ? c.appear : n), { exit: t, enter: n, appear: l };
2257
- }, o.updateStatus = function(t, n) {
2258
- if (t === void 0 && (t = !1), n !== null) if (this.cancelNextCallback(), n === It) {
2259
- if (this.props.unmountOnExit || this.props.mountOnEnter) {
2260
- var l = this.props.nodeRef ? this.props.nodeRef.current : Kt.findDOMNode(this);
2261
- l && al(l);
2262
- }
2263
- this.performEnter(t);
2264
- } else this.performExit();
2265
- else this.props.unmountOnExit && this.state.status === Mt && this.setState({ status: ko });
2266
- }, o.performEnter = function(t) {
2267
- var n = this, l = this.props.enter, c = this.context ? this.context.isMounting : t, m = this.props.nodeRef ? [c] : [Kt.findDOMNode(this), c], a = m[0], s = m[1], u = this.getTimeouts(), d = c ? u.appear : u.enter;
2268
- !t && !l || ja ? this.safeSetState({ status: qt }, function() {
2269
- n.props.onEntered(a);
2270
- }) : (this.props.onEnter(a, s), this.safeSetState({ status: It }, function() {
2271
- n.props.onEntering(a, s), n.onTransitionEnd(d, function() {
2272
- n.safeSetState({ status: qt }, function() {
2273
- n.props.onEntered(a, s);
2274
- });
2275
- });
2276
- }));
2277
- }, o.performExit = function() {
2278
- var t = this, n = this.props.exit, l = this.getTimeouts(), c = this.props.nodeRef ? void 0 : Kt.findDOMNode(this);
2279
- n && !ja ? (this.props.onExit(c), this.safeSetState({ status: Zn }, function() {
2280
- t.props.onExiting(c), t.onTransitionEnd(l.exit, function() {
2281
- t.safeSetState({ status: Mt }, function() {
2282
- t.props.onExited(c);
2283
- });
2284
- });
2285
- })) : this.safeSetState({ status: Mt }, function() {
2286
- t.props.onExited(c);
2287
- });
2288
- }, o.cancelNextCallback = function() {
2289
- this.nextCallback !== null && (this.nextCallback.cancel(), this.nextCallback = null);
2290
- }, o.safeSetState = function(t, n) {
2291
- n = this.setNextCallback(n), this.setState(t, n);
2292
- }, o.setNextCallback = function(t) {
2293
- var n = this, l = !0;
2294
- return this.nextCallback = function(c) {
2295
- l && (l = !1, n.nextCallback = null, t(c));
2296
- }, this.nextCallback.cancel = function() {
2297
- l = !1;
2298
- }, this.nextCallback;
2299
- }, o.onTransitionEnd = function(t, n) {
2300
- this.setNextCallback(n);
2301
- var l = this.props.nodeRef ? this.props.nodeRef.current : Kt.findDOMNode(this), c = t == null && !this.props.addEndListener;
2302
- if (l && !c) {
2303
- if (this.props.addEndListener) {
2304
- var m = this.props.nodeRef ? [this.nextCallback] : [l, this.nextCallback], a = m[0], s = m[1];
2305
- this.props.addEndListener(a, s);
2306
- }
2307
- t != null && setTimeout(this.nextCallback, t);
2308
- } else setTimeout(this.nextCallback, 0);
2309
- }, o.render = function() {
2310
- var t = this.state.status;
2311
- if (t === ko) return null;
2312
- var n = this.props, l = n.children;
2313
- n.in, n.mountOnEnter, n.unmountOnExit, n.appear, n.enter, n.exit, n.timeout, n.addEndListener, n.onEnter, n.onEntering, n.onEntered, n.onExit, n.onExiting, n.onExited, n.nodeRef;
2314
- var c = ol(n, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
2315
- return le.createElement(rl.Provider, { value: null }, typeof l == "function" ? l(t, c) : le.cloneElement(le.Children.only(l), c));
2316
- }, i;
2317
- }(le.Component);
2318
- function $t() {
2319
- }
2320
- ht.contextType = rl, ht.propTypes = {}, ht.defaultProps = { in: !1, mountOnEnter: !1, unmountOnExit: !1, appear: !1, enter: !0, exit: !0, onEnter: $t, onEntering: $t, onEntered: $t, onExit: $t, onExiting: $t, onExited: $t }, ht.UNMOUNTED = ko, ht.EXITED = Mt, ht.ENTERING = It, ht.ENTERED = qt, ht.EXITING = Zn;
2321
- var Rn = function(r, i) {
2322
- return r && i && i.split(" ").forEach(function(o) {
2323
- return n = o, void ((t = r).classList ? t.classList.remove(n) : typeof t.className == "string" ? t.className = Wa(t.className, n) : t.setAttribute("class", Wa(t.className && t.className.baseVal || "", n)));
2324
- var t, n;
2325
- });
2326
- }, Jn = function(r) {
2327
- function i() {
2328
- for (var t, n = arguments.length, l = new Array(n), c = 0; c < n; c++) l[c] = arguments[c];
2329
- return (t = r.call.apply(r, [this].concat(l)) || this).appliedClasses = { appear: {}, enter: {}, exit: {} }, t.onEnter = function(m, a) {
2330
- var s = t.resolveArguments(m, a), u = s[0], d = s[1];
2331
- t.removeClasses(u, "exit"), t.addClass(u, d ? "appear" : "enter", "base"), t.props.onEnter && t.props.onEnter(m, a);
2332
- }, t.onEntering = function(m, a) {
2333
- var s = t.resolveArguments(m, a), u = s[0], d = s[1] ? "appear" : "enter";
2334
- t.addClass(u, d, "active"), t.props.onEntering && t.props.onEntering(m, a);
2335
- }, t.onEntered = function(m, a) {
2336
- var s = t.resolveArguments(m, a), u = s[0], d = s[1] ? "appear" : "enter";
2337
- t.removeClasses(u, d), t.addClass(u, d, "done"), t.props.onEntered && t.props.onEntered(m, a);
2338
- }, t.onExit = function(m) {
2339
- var a = t.resolveArguments(m)[0];
2340
- t.removeClasses(a, "appear"), t.removeClasses(a, "enter"), t.addClass(a, "exit", "base"), t.props.onExit && t.props.onExit(m);
2341
- }, t.onExiting = function(m) {
2342
- var a = t.resolveArguments(m)[0];
2343
- t.addClass(a, "exit", "active"), t.props.onExiting && t.props.onExiting(m);
2344
- }, t.onExited = function(m) {
2345
- var a = t.resolveArguments(m)[0];
2346
- t.removeClasses(a, "exit"), t.addClass(a, "exit", "done"), t.props.onExited && t.props.onExited(m);
2347
- }, t.resolveArguments = function(m, a) {
2348
- return t.props.nodeRef ? [t.props.nodeRef.current, m] : [m, a];
2349
- }, t.getClassNames = function(m) {
2350
- var a = t.props.classNames, s = typeof a == "string", u = s ? (s && a ? a + "-" : "") + m : a[m];
2351
- return { baseClassName: u, activeClassName: s ? u + "-active" : a[m + "Active"], doneClassName: s ? u + "-done" : a[m + "Done"] };
2352
- }, t;
2353
- }
2354
- nl(i, r);
2355
- var o = i.prototype;
2356
- return o.addClass = function(t, n, l) {
2357
- var c = this.getClassNames(n)[l + "ClassName"], m = this.getClassNames("enter").doneClassName;
2358
- n === "appear" && l === "done" && m && (c += " " + m), l === "active" && t && al(t), c && (this.appliedClasses[n][l] = c, function(a, s) {
2359
- a && s && s.split(" ").forEach(function(u) {
2360
- return f = u, void ((d = a).classList ? d.classList.add(f) : function(p, g) {
2361
- return p.classList ? !!g && p.classList.contains(g) : (" " + (p.className.baseVal || p.className) + " ").indexOf(" " + g + " ") !== -1;
2362
- }(d, f) || (typeof d.className == "string" ? d.className = d.className + " " + f : d.setAttribute("class", (d.className && d.className.baseVal || "") + " " + f)));
2363
- var d, f;
2364
- });
2365
- }(t, c));
2366
- }, o.removeClasses = function(t, n) {
2367
- var l = this.appliedClasses[n], c = l.base, m = l.active, a = l.done;
2368
- this.appliedClasses[n] = {}, c && Rn(t, c), m && Rn(t, m), a && Rn(t, a);
2369
- }, o.render = function() {
2370
- var t = this.props;
2371
- t.classNames;
2372
- var n = ol(t, ["classNames"]);
2373
- return le.createElement(ht, Kn({}, n, { onEnter: this.onEnter, onEntered: this.onEntered, onEntering: this.onEntering, onExit: this.onExit, onExiting: this.onExiting, onExited: this.onExited }));
2374
- }, i;
2375
- }(le.Component);
2376
- Jn.defaultProps = { classNames: "" }, Jn.propTypes = {};
2377
- const Mn = 0.12, Va = (r, i) => {
2378
- const o = {}, t = (a) => {
2379
- const s = a.palette?.background.default ?? "rgba(255,255,255,1)";
2380
- return { text: { fontFamily: a.typography?.fontFamily ?? "Calibri", fontSize: a.typography?.fontSize ?? 8.25, fontWeight: a.typography?.fontWeightRegular ?? "400", fill: a.palette.mode === "dark" ? a.palette?.text?.secondary : a.palette?.text?.primary }, fill: s, strokeFill: it(s, Mn, a.palette?.mode), darkMode: a.palette.mode === "dark" };
2381
- }, n = t(i);
2382
- o.body = t(r), o.header = { ...o.body, strokeFill: it(o.body.fill, Mn, r.palette?.mode), fill: i && r.palette.mode === "dark" && i.palette.mode !== r.palette.mode ? o.body.fill : it(o.body.fill, 0.055, r.palette?.mode), edgeStrokeFill: r.palette.mode === "dark" ? o.body.strokeFill : it(o.body.fill, 0.328, r.palette?.mode) }, o.headerHover = (a) => ({ ...o.header, strokeFill: it(a?.fill ?? o.body.fill, 0.22, r.palette?.mode), fill: it(a?.fill ?? o.header.fill, 0.065, r.palette?.mode), text: { ...a?.text, fontWeight: r.typography?.fontWeightBold } });
2383
- const l = it(r.palette.mode !== "dark" ? r.palette.primary.light : r.palette.primary.main, 0.055, r.palette?.mode);
2384
- o.headerSelect = { ...o.header, strokeFill: r.palette.primary.main, fill: Qe(l, 0.2), text: { ...o.header.text, fill: r.palette.primary.main }, dividerStrokeFill: Qe(l, 0.7) }, o.headerSelectAll = { ...o.headerSelect, fill: Qe(l, 0.9), text: { ...o.headerSelect.text, fill: r.palette.primary.contrastText }, edgeStrokeFill: o.headerSelect.strokeFill }, o.buttonSurface = { ...n, strokeFill: it(n.fill, Mn, i.palette?.mode), fill: i && i.palette.mode === "dark" && i.palette.mode !== r.palette.mode ? n.fill : it(n.fill, 0.055, i.palette?.mode), edgeStrokeFill: i.palette.mode === "dark" ? n.strokeFill : it(n.fill, 0.328, i.palette?.mode) }, o.headerSelection = { fill: r.palette?.primary?.main ? Qe(r.palette?.primary?.main, 0.1) : void 0, strokeFill: r.palette?.primary?.main }, o.headerSelectionInactive = { ...o.headerSelection, fill: r.palette?.divider ? Qe(r.palette?.divider, 0.05) : void 0, strokeFill: "transparent" };
2385
- const c = i ?? r, m = c.palette.mode === "dark";
2386
- return o.selection = { fill: c.palette?.primary?.main ? Qe(c.palette?.primary?.main, 0.1) : void 0, strokeFill: c.palette?.primary?.main }, o.selectionInactive = { ...o.selection, fill: c.palette?.divider ? Qe(c.palette?.divider, 0.05) : void 0, strokeFill: "transparent" }, o.selectionRemove = { ...o.selection, fill: Qe(c.palette.warning.light, 0.05), strokeFill: c.palette.warning.dark }, i && (o.body = t(i)), o.colorShadow = Qe(c.palette.action.active, 0.5), o.colorGrey = c.palette.action.active, o.filterDarkInvert = m ? "hue-rotate(180deg) invert(1) brightness(95%)" : "none", o;
2387
- }, No = K(J((r, i) => {
2388
- const { children: o, sx: t, parentFloat: n, ...l } = r, c = zt(i, () => ({}), []), [m, a] = Io(), s = we(null), u = we(null), [d, f] = le.useReducer((C) => C + 1, 0), [p, g] = U(null), [y, x] = U(null), [b, h] = U(null), { reference: w } = oo({ parentFloat: n, label: "overflow" });
2389
- St(() => {
2390
- u.current = { refs: [] };
2391
- const C = [], k = le.Children.toArray(o);
2392
- let T = 0;
2393
- k.forEach((M, N) => {
2394
- C.push(e(A, { sx: { display: "flex" }, ref: (B) => {
2395
- T++, T === k.length && f();
2396
- const R = { current: null };
2397
- R.current = B, u.current.refs[N] = R;
2398
- }, children: M }, N));
2399
- }), g(C);
2400
- }, [o, a]), St(() => {
2401
- if (!p) return;
2402
- const C = u.current.refs;
2403
- if (!c.current || !C || C.length === 0) return x(null), void h(null);
2404
- const k = c.current?.getBoundingClientRect(), T = [], M = [];
2405
- let N = 0, B = !1;
2406
- for (let S = 0; !B && S < C.length; S++) {
2407
- const I = C[S];
2408
- if (!I) continue;
2409
- if (!I.current) {
2410
- B = !0;
2411
- continue;
2412
- }
2413
- const L = I.current.getBoundingClientRect();
2414
- N += L?.width, N > k.width && (B = !0);
2415
- }
2416
- if (!B) return x(null), void h([]);
2417
- const R = s.current?.getBoundingClientRect();
2418
- N = 0;
2419
- for (let S = 0; S < C.length; S++) {
2420
- const I = C[S];
2421
- let L = !1;
2422
- if (I.current) {
2423
- const O = I.current.getBoundingClientRect();
2424
- N += O?.width, N < k.width - R.width && (L = !0);
2425
- }
2426
- L ? T.push(p[S]) : M.push(p[S]);
2427
- }
2428
- x(T.length > 0 ? T : null), h(M.length > 0 ? M : null);
2429
- }, [o, p, a, w, d]);
2430
- const v = ee((C) => {
2431
- const k = [];
2432
- for (let M = 0; M < b.length; M++) {
2433
- let N = le.Children.toArray(b[M]);
2434
- const B = N[0];
2435
- N = le.Children.toArray(B.props.children?.props.children ?? B.props.children);
2436
- const R = N[0], S = { ...R.props };
2437
- S.parentFloat && (S.parentFloat = C.floatReference);
2438
- const I = le.cloneElement(R, S);
2439
- k.push(I);
2440
- }
2441
- const T = e(A, { className: "overflow-palette-popup-panel", sx: { display: "flex", flexDirection: "row", flexWrap: "wrap", rowGap: (M) => M.spacing(0.25), paddingTop: (M) => M.spacing(0.5), paddingBottom: (M) => M.spacing(0.5), paddingLeft: (M) => M.spacing(1), paddingRight: (M) => M.spacing(1), overflow: "hidden" }, children: k });
2442
- return Se({ ...C, children: T });
2443
- }, [b]);
2444
- return z(A, { className: "overflow-palette", sx: { display: "flex", flexDirection: "row", flex: "1 1 100%", width: "100%", maxWidth: "100%", ...t }, ref: Fo([c, m, i]), ...l, children: [e(A, { sx: { flexDirection: "row", display: "flex", maxWidth: "100%", flex: "1 1 100%" }, children: y ?? p }), e(A, { sx: { display: b !== null && b.length === 0 ? "none" : "flex", flex: "1 1 0" }, children: e(vt, { createPopupPanel: v, ref: s, parentFloat: w, createTooltip: ({ children: C }, k) => e(rt, { label: "More", description: "More toolbar options…", disabled: k, children: C }), icon: e(Zc, { children: e(Zd, {}) }) }) })] });
2445
- })), il = "https://unpkg.com/@sheetxl/scripting-templates/dist", wu = (r) => {
2446
- if (r.metadata?.name) return r.metadata.name;
2447
- let i = (r.path.split("/").pop() || "").replace(/\.[^/.]+$/, "");
2448
- return r.metadata?.icon === "formula" ? i.toUpperCase() : (i = i.replace(/([a-z])([A-Z])/g, "$1 $2"), i.replace(/[-_]/g, " ").trim().split(/\s+/).map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "));
2449
- }, ll = async (r) => {
2450
- const i = Yt.relativePath(r, "./manifest.json"), o = await fetch(i);
2451
- if (!o.ok) throw new Xn(`Failed to retrieve directory at '${r}': ${o.statusText}`);
2452
- const t = await o.text();
2453
- if (t.trim().toLowerCase().startsWith("<!doctype html") || t.trim().toLowerCase().startsWith("<html")) throw new Xn(`Failed to retrieve directory at '${r}'`);
2454
- let n;
2455
- try {
2456
- n = JSON.parse(t);
2457
- } catch (c) {
2458
- throw new Error(`Failed to parse directory: ${c.message}. Ensure the file is valid JSON.`);
2459
- }
2460
- const l = n.map(async (c) => {
2461
- try {
2462
- const m = Yt.relativePath(r, c.path), a = await fetch(m);
2463
- if (!a.ok) throw new Error(`Failed to fetch file at '${c.path}': ${a.statusText}`);
2464
- const s = await a.text();
2465
- let u = c.metadata;
2466
- return u?.title || (u = { title: wu(c), ...u }), { path: c.path, content: s, metadata: u };
2467
- } catch (m) {
2468
- console.error(m.message);
2469
- }
2470
- return null;
2471
- });
2472
- return (await Promise.all(l)).filter((c) => c !== null);
2473
- }, In = { fontSize: "0.8rem", marginRight: "4px" }, Su = K((r) => {
2474
- const { disabled: i, snippet: o, description: t, handleInsert: n, sx: l, ...c } = r;
2475
- let m;
2476
- return m = o.metadata?.icon === "formula" ? e(Si, { sx: In }) : o.metadata?.icon === "macro" ? e(ur, { sx: In }) : e(ki, { sx: In }), e(pt, { sx: { maxWidth: "460px", display: "flex", "*": { lineHeight: "1.2" }, ...l }, disabled: i, icon: m, onMouseDown: (a) => {
2477
- a.button === 0 && a.preventDefault();
2478
- }, onMouseUp: (a) => {
2479
- a.button === 0 && n(o);
2480
- }, onKeyDown: (a) => {
2481
- a.keyCode !== be.Enter && a.keyCode !== be.Space || n(o);
2482
- }, ...c, children: z(A, { sx: { display: "flex", flex: "1 1 100%", flexDirection: "column", overflow: "hidden" }, children: [e(Oe, { component: "div", children: o.metadata?.title ?? o.path }), e(Oe, { variant: "caption", component: "div", sx: { color: (a) => Qe(a.palette.text.secondary ?? a.palette.text.primary, 0.6), overflow: "hidden", textOverflow: "ellipsis" }, children: o.metadata?.summary })] }) });
2483
- }), vu = K(J((r, i) => {
2484
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, scriptPath: c = il, ...m } = r, [a, s] = U([]), [u, d] = U(!0), f = He(o, ["executeSelectedScript"]), p = f[0]?.context?.();
2485
- me(() => {
2486
- (async () => {
2487
- try {
2488
- const y = await ll(c);
2489
- s(y);
2490
- } catch {
2491
- } finally {
2492
- d(!1);
2493
- }
2494
- })();
2495
- }, [c]);
2496
- const g = G((y, x) => {
2497
- if (u) return e("div", { children: "Loading..." });
2498
- const b = { variant: ie.Menuitem, commandHook: t, scope: "scripts", disabled: l }, h = (C) => {
2499
- p.getEditor()?.insertSnippet(C.content), y.closeFloat();
2500
- }, w = [];
2501
- for (let C = 0; C < a.length; C++) {
2502
- const k = a[C];
2503
- k && w.push(e(Su, { handleInsert: h, snippet: k }, k.path));
2504
- }
2505
- const v = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, children: [w.length > 0 ? z(se, { children: [e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: w }), e(re, { orientation: "horizontal" })] }) : null, Pe(F, { ...b, key: "help", command: o.getCommand("help"), icon: P(e(yi, {})) })] });
2506
- return Se({ ...y, children: v });
2507
- }, [l, t, n, u, p]);
2508
- return e(Re, { ref: i, commands: o, disabled: l, commandHook: t, scope: n, label: "Insert Script", tooltip: "Inserts a script from a set of templates.", createPopupPanel: g, icon: P(e(Jc, {})), ...m });
2509
- })), sl = K(J((r, i) => {
2510
- const { commands: o, parentFloat: t, commandButtonProps: n, ...l } = r, c = ee((m) => {
2511
- const { commandButtonProps: a, commandPopupProps: s } = m;
2512
- return e(se, { children: z("div", { style: { display: "flex", flex: "1 1 100%" }, children: [e("div", { children: e(No, { parentFloat: t, style: {}, children: e(F, { ...a, command: o.getCommand("saveScripts"), icon: P(e(Qc, {})) }) }) }), e("div", { style: { flex: "1 1 100%" } }), e("div", { children: e(No, { parentFloat: t, style: {}, children: e(vu, { ...a, commands: o }) }) })] }) });
2513
- }, [o]);
2514
- return e(cn, { ref: i, commands: o, parentFloat: t, commandButtonProps: n, createToolbarPalette: c, ...l });
2515
- }));
2516
- sl.displayName = "ScriptEditorToolbar";
2517
- const Nn = { fontSize: "1rem" }, cl = K(J((r, i) => {
2518
- const { scriptPath: o = il, onScriptSelect: t, sx: n = pn.EmptyCssProperties, className: l, buttonMinWidth: c = 210, buttonMinHeight: m = 80, gap: a = 12, ...s } = r, [u, d] = U([]), [f, p] = U(!0), [g, y] = U(null);
2519
- if (me(() => {
2520
- (async () => {
2521
- const h = [{ path: null, metadata: { title: "Blank Template...", summary: "Start with an empty script." }, content: "" }];
2522
- try {
2523
- p(!0), y(null);
2524
- const w = await ll(o);
2525
- for (let v = 0; v < w.length; v++) {
2526
- const C = w[v];
2527
- C && h.push(C);
2528
- }
2529
- } catch (w) {
2530
- y(w instanceof Error ? w.message : "Failed to load scripts"), w instanceof Xn || console.error("Error loading scripts:", w);
2531
- } finally {
2532
- d(h), p(!1);
2533
- }
2534
- })();
2535
- }, [o]), f) return e(A, { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", className: Ae(l, "script-select"), sx: { background: (h) => h.palette.background.paper, zIndex: 1e3, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})`, ...n }, ...s, children: e(ks, {}) });
2536
- let x = null;
2537
- g && (x = z(A, { display: "flex", justifyContent: "center", alignItems: "center", className: Ae(l, "script-select", "error-results"), sx: { background: (h) => h.palette.error.light, flex: "0", zIndex: 1e3, flexDirection: "column", padding: (h) => h.spacing(1), border: (h) => `1px solid ${h.palette.error.main}`, borderBottomLeftRadius: 1, borderBottomRightRadius: 1, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` }, ...s, children: [e(Oe, { color: "error", variant: "h6", component: "div", gutterBottom: !0, children: "Error loading Templates" }), e(Oe, { color: "error", component: "div", children: g })] }));
2538
- const b = (h) => {
2539
- const w = h.metadata?.icon;
2540
- return w === "macro" ? e(ur, { sx: Nn }) : w === "formula" ? e(Si, { sx: Nn }) : w === "autostart" ? e(ki, { sx: Nn }) : null;
2541
- };
2542
- return z(A, { ref: i, className: Ae(l, "script-select"), sx: { background: (h) => h.palette.background.paper, zIndex: 1e3, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})`, ...n }, ...s, children: [z(A, { p: 3, className: "script-select-content", sx: { overflow: "auto", flex: "1 1 auto" }, children: [e(Oe, { variant: "h6", gutterBottom: !0, children: "Script Template" }), e(Oe, { variant: "body2", component: "div", color: "text.secondary", gutterBottom: !0, children: "Choose from a template to provide a starting point to automate tasks or create user defined functions." }), e(Oe, { variant: "body2", component: "div", color: "text.secondary", gutterBottom: !0, children: "Templates provide a foundation to customize and meet your specific needs." }), e(A, { sx: { display: "grid", gridTemplateColumns: `repeat(auto-fill, minmax(${c}px, 1fr))`, gap: `${a}px`, padding: 2, paddingLeft: "0px", paddingRight: "0px" }, children: u.map((h, w) => z(nn, { variant: "outlined", sx: { minWidth: c, minHeight: m, display: "flex", flexDirection: "column", justifyContent: "flex-start", alignItems: "flex-start", textAlign: "left", padding: 2, textTransform: "none", overflow: "hidden", ...w === 0 && { borderStyle: "dashed", marginBottom: "8px" }, ...w === 1 && { gridColumn: "1" } }, onClick: () => t?.(h), children: [z(A, { sx: { display: "flex", flexDirection: "row", justifyContent: "space-between", alignItems: "center", width: "100%", marginBottom: 0.5 }, children: [e(Oe, { variant: "subtitle2", component: "div", children: h.metadata?.title || h.path.split("/").pop()?.replace(/\.\w+$/, "") || "Untitled" }), b(h)] }), h.metadata?.summary && e(Oe, { variant: "body2", component: "div", color: "text.secondary", sx: { overflow: "hidden", display: "flex", flexDirection: "column", textOverflow: "ellipsis", alignItems: "flex-start" }, children: h.metadata.summary })] }, `${h.path}-${w}`)) })] }), x] });
2543
- }));
2544
- cl.displayName = "TemplateSelectPanel";
2545
- const dl = K(J((r, i) => {
2546
- const { className: o, sx: t, editorProps: n, commands: l, readOnly: c = !1, onClose: m, autoFocusSel: a, autoFocus: s = !0, scripts: u, ...d } = r, f = at(), [p, g] = U(!1), y = we(!1), [x, b] = U({ message: "Loading", cursor: "", dirty: !1 }), [h, w] = U(null);
2547
- me(() => {
2548
- let E = !1;
2549
- return w(null), async function() {
2550
- if (u && (await u.start(), !E)) {
2551
- const Y = u.getModules().getItems()[0]?.getSource();
2552
- w({ source: Y || null });
2553
- }
2554
- }(), () => {
2555
- E = !0;
2556
- };
2557
- }, [u]);
2558
- const v = G((E) => {
2559
- b((Y) => ({ ...Y, ...E }));
2560
- }, []), C = we(null), k = we(null), [T, M] = U(null), N = we(null), B = ee((E) => {
2561
- if (T) return T.focus(E), !0;
2562
- if (a) {
2563
- const Y = k.current?.querySelectorAll?.(a);
2564
- if (Y && Y.length > 0) return Y[0]?.focus?.(E), !0;
2565
- }
2566
- return k.current?.focus?.(E), !1;
2567
- }, [T, a, s]), R = j(() => e(Lt, { transitionDelay: "160ms", style: { position: "absolute", width: "100%", height: "100%" }, transparentBackground: !1 }), []), S = j(() => e(Po, { elevation: 1, tabIndex: 0, sx: { display: "flex", alignItems: "center", userSelect: "none", flexGrow: 1, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})`, marginLeft: (E) => E.spacing(0.5), marginRight: (E) => E.spacing(0.5), marginTop: (E) => E.spacing(1), marginBottom: (E) => E.spacing(1) }, children: e(sl, { commands: l }) }), [f, l]), I = j(() => e(A, { className: Ae("script-status-panel", "status-panel"), sx: { display: "flex", alignItems: "stretch", flexDirection: "row", flex: "0", paddingLeft: "12px", paddingRight: "12px", gap: "8px", paddingTop: "1px", minHeight: "calc(1em + 8px)", margin: 0, borderTop: `solid 1px ${f.palette.divider}` }, children: z("div", { style: { flex: "1 1 100%", display: "flex", alignItems: "center", flexDirection: "row", justifyContent: "center" }, children: [e(Oe, { component: "div", sx: { userSelect: "none", whiteSpace: "pre", overflow: "hidden", textOverflow: "ellipsis", flex: "1 1 100%", color: (E) => E.palette.text.secondary }, variant: "caption", children: x.message }), e(Oe, { component: "div", sx: { userSelect: "none", whiteSpace: "pre", overflow: "hidden", textOverflow: "ellipsis", flex: "none", color: (E) => E.palette.text.secondary }, variant: "caption", children: x.dirty ? "Unsaved" : "" }), e(Oe, { component: "div", sx: { userSelect: "none", whiteSpace: "pre", overflow: "hidden", textOverflow: "ellipsis", flex: "none", marginLeft: "8px", minWidth: "90px", display: "flex", justifyContent: "end", color: (E) => E.palette.text.secondary }, variant: "caption", children: x.cursor })] }) }), [x]), L = j(() => z(A, { className: Ae("script-editor-content"), sx: { display: "flex", flex: "1 1 100%", width: "100%", flexDirection: "column", boxSizing: "border-box" }, children: [S, e(A, { sx: { display: "flex", flex: "1 1 100%", width: "100%", flexDirection: "row", position: "relative", boxSizing: "border-box" }, children: e(sp, { ref: k, loadingPanel: R, readOnly: c, onClose: m, autoFocus: s, commands: l, onStatusChange: v, darkMode: f.palette.mode === "dark", ...n }) }), I] }), [f, l, S, I, p, R, c, n, s, a, m, v]), O = j(() => e(Ts, { className: Ae({ "Mui-selected": y.current }), sx: { display: "flex", color: (E) => E.palette.text.secondary, boxSizing: "border-box", padding: "0 0", transitionProperty: "opacity", transitionDuration: (E) => `${E.transitions.duration.shortest}ms`, opacity: 0.7, "&.Mui-selected": { opacity: 1, transitionDuration: (E) => E.transitions.duration.shortest / 2 + "ms" }, backgroundColor: (E) => he(E.palette.action.hover, 0.03), borderBottom: (E) => `solid ${he(E.palette.divider, 0.2)} 1px` }, onPointerDown: (E) => {
2568
- E.isDefaultPrevented() || (E.preventDefault(), B());
2569
- }, children: z(A, { sx: { display: "flex", flex: "1 1 10%", flexDirection: "row", alignItems: "center", marginTop: (E) => E.spacing(0.25), marginBottom: (E) => E.spacing(0.25), marginLeft: (E) => E.spacing(1), marginRight: (E) => E.spacing(1) }, children: [e(A, { sx: { flex: "1 1 100%", paddingLeft: (E) => E.spacing(1) }, children: "Script (Typescript)" }), e(rt, { label: "Close", children: e(dt, { "aria-label": "close", sx: { color: (E) => E.palette.text.icon ?? E.palette.action.active }, touchRippleRef: C, onPointerDown: (E) => {
2570
- C.current?.start(E, { center: !1 }), E.stopPropagation(), E.preventDefault();
2571
- }, onPointerUp: () => {
2572
- k.current?.close();
2573
- }, children: e(Ti, {}) }) })] }) }), [f, p]), $ = j(() => {
2574
- let E;
2575
- return h === null ? null : (h.source === null && (E = e(cl, { sx: { display: "flex", flex: "1 1 100%", flexDirection: "column", overflow: "hidden", position: "absolute", boxSizing: "border-box", width: "100%", height: "100%" }, onScriptSelect: (Y) => {
2576
- k.current?.getEditor().insertSnippet(Y.content), w({ source: Y.content ?? "" });
2577
- } })), z(A, { tabIndex: 0, className: Ae("script-workspace", o), sx: { display: "flex", flex: "1 1 100%", flexDirection: "column", overflow: "hidden", alignItems: "stretch", userSelect: "none", flexGrow: 0, outline: "none", backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` }, onPointerDown: (Y) => {
2578
- Y.isDefaultPrevented() || k.current?.focus();
2579
- }, children: [O, z(A, { sx: { flex: "1 1 100%", position: "relative", display: "flex" }, children: [L, E] })] }));
2580
- }, [S, L, o, h]), D = zt(i, () => ({ isScriptWorkspaceElement: () => !0, focus: (E) => {
2581
- B(E);
2582
- } }), []);
2583
- return e(A, { sx: { display: "flex", flexDirection: "row", flex: "1 1 100%", position: "relative", ...t }, ref: D, ...d, onFocus: (E) => {
2584
- g(!0), y.current = !0, D.current?.contains(E.target) && E.target !== D.current && M(E.target), E.relatedTarget && !N.current && (N.current = E.relatedTarget), d?.onFocus?.(E);
2585
- }, onBlur: (E) => {
2586
- D?.current?.contains(E.relatedTarget) || D?.current === E.relatedTarget || (N.current = null, y.current = !1, g(!1)), d?.onBlur?.(E);
2587
- }, children: $ });
2588
- }));
2589
- dl.displayName = "ScriptWorkspace";
2590
- const pl = K(J((r, i) => {
2591
- const { commands: o, commandHook: t, scope: n, disabled: l = !1, ...c } = r, m = He(o, ["executeScript"])[0].context();
2592
- He(o, ["showScriptEditor"]);
2593
- const a = G((s, u) => {
2594
- const d = { variant: ie.Menuitem, commandHook: t, scope: "scripts", disabled: l, shortcut: null }, f = m?.getScripts(), p = f?.searchFunction({ type: "macro" }), g = [];
2595
- if (p) for (let x = 0; x < p.length; x++) {
2596
- const b = p[x];
2597
- g.push(e(F, { ...d, command: u.getCommand("executeScript"), commandState: { declaration: b }, tooltipProps: { description: `Execute ${b.getName() ?? "script"}` }, icon: P(e(ur, {})), label: b.getName() ?? `Script '${b.getName()}'` }, `script-${b.getName()}-${x}`));
2598
- }
2599
- const y = z(A, { sx: { display: "flex", flexDirection: "column", flex: "1 1 100%", overflow: "hidden" }, children: [g.length > 0 ? z(se, { children: [e(A, { sx: { overflow: "auto", flex: "1 1 100%" }, children: g }), e(re, { orientation: "horizontal" })] }) : null, Pe(F, { ...d, key: "show-editor", command: u.getCommand("showScriptEditor"), icon: P(e(ed, {})) })] });
2600
- return Se({ ...s, children: y });
2601
- }, [l, m, t, n]);
2602
- return e(Re, { ref: i, commands: o, commandHook: t, createPopupPanel: a, selected: o.getCommand("showScriptEditor").state(), label: "Macros", tooltip: "Run or manage macros.", quickCommand: "showScriptEditor", icon: P(e(td, {})), ...c });
2603
- })), ul = K(J((r, i) => {
2604
- const { commands: o, parentFloat: t, commandButtonProps: n, ...l } = r, c = He(o, ["executeScript", "showScriptEditor"]), m = c[0]?.context?.(), a = G((s) => {
2605
- const { commandButtonProps: u, commandPopupProps: d } = s, f = e(Mo, { ...d, command: o.getCommand("formatFontColor"), icon: e(od, {}), isSplit: !0, panelProps: { disableAlpha: !0 } }), p = e(Mo, { ...d, command: o.getCommand("formatFillColor"), icon: e(nd, {}), isSplit: !0, panelProps: { disableAlpha: !0, autoColorLabel: "No Fill", autoColorPosition: Eo.End } }), g = o.getCommand("undo") ? e(se, { children: e(Fi, { ...d, quickCommand: "undo" }) }) : null, y = o.getCommand("find") ? e(se, { children: e(Ap, { ...d }) }) : null;
2606
- let x = null;
2607
- const b = m?.getScripts();
2608
- if (c[1]?.state?.() || b) {
2609
- let h = c[1]?.state?.();
2610
- const w = b?.searchFunction({ type: "macro" });
2611
- for (let v = 0; w && !h && v < w?.length; v++) h = !0;
2612
- h && (x = z(se, { children: [e(re, {}), e(pl, { ...d })] }));
2613
- }
2614
- return z(No, { parentFloat: t, children: [g, null, g ? e(re, {}) : null, e(Ai, { ...d, command: o.getCommand("paste") }), e(F, { ...u, command: o.getCommand("formatPainterToggle"), icon: P(e(rd, {})) }), e(br, { ...u, command: o.getCommand("copy") }), e(re, {}), e(Wp, { ...d, command: o.getCommand("formatFontFamily") }), e(Bp, { ...d, command: o.getCommand("formatFontSize") }), e(F, { ...u, command: o.getCommand("formatBoldToggle"), icon: e(ad, {}) }), e(F, { ...u, command: o.getCommand("formatItalicToggle"), icon: e(id, {}) }), e(Vp, { ...d }), e(jp, { ...d }), f, e(re, {}), p, e(Np, { ...d }), e(Fp, { ...d }), e(re, {}), e(xp, { ...d }), e(yp, { ...d }), e(wp, { ...d }), e(Sp, { ...d }), e(re, {}), e(Lp, { ...d }), e(Gp, { command: o.getCommand("formatCellStyle"), ...d }), e(Zp, { command: o.getCommand("formatTableStyle"), ...d }), e(re, {}), e(Mi, { ...d }), e(Ii, { ...d }), e(re, {}), e(Hp, { ...d }), null, e(Ri, { ...d }), e(Ni, { ...d }), y, x] });
2615
- }, [o, c]);
2616
- return e(cn, { ref: i, commands: o, parentFloat: t, commandButtonProps: n, createToolbarPalette: a, ...l });
2617
- }));
2618
- ul.displayName = "HomeToolbar";
2619
- const ml = K(J((r, i) => {
2620
- const { commands: o, parentFloat: t, commandButtonProps: n, ...l } = r, c = ee((m) => {
2621
- const { commandButtonProps: a, commandPopupProps: s } = m;
2622
- return z(No, { parentFloat: t, children: [null, e(F, { ...a, command: o.getCommand("updateHyperlink"), icon: P(e(_n, {})) }), e(F, { ...a, command: o.getCommand("updateComments"), icon: P(e(Un, {})) }), e(Hi, { ...s }), e(F, { ...a, command: o.getCommand("insertTable"), icon: P(e(an, {})) })] });
2623
- }, [o]);
2624
- return e(cn, { ref: i, commands: o, parentFloat: t, commandButtonProps: n, createToolbarPalette: c, ...l });
2625
- }));
2626
- ml.displayName = "InsertToolbar";
2627
- const gl = K(J((r, i) => {
2628
- const { commands: o, parentFloat: t, commandButtonProps: n, ...l } = r, c = ee((m) => {
2629
- const { commandButtonProps: a, commandPopupProps: s } = m;
2630
- return z(No, { parentFloat: t, children: [e(Op, { ...s }), e(F, { ...a, command: o.getCommand("protectionSheetToggle"), icon: e(dn, { color: "secondary" }) }), e(re, {}), e(zp, { ...s }), e($p, { ...s }), e(re, {}), e(F, { ...a, command: o.getCommand("sheetViewToggleFormulaView"), scope: "view", icon: e(eo, { command: o.getCommand("sheetViewToggleFormulaView"), scope: "view" }) }), e(F, { ...a, command: o.getCommand("sheetViewToggleShowZeros"), scope: "view", icon: e(eo, { command: o.getCommand("sheetViewToggleShowZeros"), scope: "view" }) }), e(re, {}), e(_p, { ...s }), e(tu, { command: o.getCommand("selectTheme"), ...s }), e(re, {}), e(pl, { ...s, scope: "view" }), e(re, {}), e(F, { ...a, command: o.getCommand("fullScreenToggle"), scope: "view", icon: () => P(o.getCommand("fullScreenToggle").state() ? e(ld, {}) : e(sd, {})) })] });
2631
- }, [o]);
2632
- return e(cn, { ref: i, commands: o, parentFloat: t, commandButtonProps: n, createToolbarPalette: c, ...l });
2633
- }));
2634
- gl.displayName = "ViewToolbar";
2635
- const hl = (r) => e(fl, { ...r }), Cu = K((r) => {
2636
- const { sx: i, ...o } = r;
2637
- return z(A, { sx: { display: "flex", flexDirection: "column", position: "relative", "&:hover:not([disabled]) .indicator": { borderBottom: (t) => `${he(t.palette.primary.main, 0.35)} solid 2px` } }, children: [e(Ps, { disableRipple: !0, onMouseDown: (t) => {
2638
- t.button === 0 && t.preventDefault();
2639
- }, sx: { textTransform: "none", flex: "1 1 100%", fontWeight: (t) => t.typography.fontWeightRegular, padding: "2px 6px", minHeight: "0px", minWidth: "0px", marginRight: (t) => t.spacing(0.5), "&.Mui-selected": {}, "&.Mui-focusVisible": {}, ...i }, ...o }), e(A, { className: "indicator", sx: { width: "90%", borderRadius: "4px", minWidth: "4px", position: "absolute", bottom: "0", alignSelf: "center", display: "flex" } })] });
2640
- }), ku = K((r) => {
2641
- const { toolbars: i, value: o, onToolbarChange: t, sx: n, ...l } = r, c = j(() => {
2642
- const m = [];
2643
- for (let a = 0; a < i.length; a++) m.push(e(Cu, { label: i[a].label }, i[a].label));
2644
- return m;
2645
- }, [i]);
2646
- return e(Ds, { value: o, onChange: (m, a) => {
2647
- t?.(a);
2648
- }, variant: "scrollable", scrollButtons: !1, sx: { paddingLeft: (m) => m.spacing(1.5), paddingRight: (m) => m.spacing(1.5), paddingTop: (m) => m.spacing(0), paddingBottom: (m) => m.spacing(0), minHeight: "26px", alignItems: "center", "& .MuiTabs-indicator": { display: "flex", justifyContent: "center", backgroundColor: "transparent" }, "& .MuiTabs-indicatorSpan": { width: "90%", borderRadius: "4px", minWidth: "4px", backgroundColor: (m) => m.palette.primary.main }, "& .MuiTab-root": { marginRight: "0px" }, ...n }, TabIndicatorProps: { children: e("span", { className: "MuiTabs-indicatorSpan" }) }, ...l, children: c });
2649
- }), Tu = K((r) => {
2650
- const { toolbars: i, value: o, onToolbarChange: t, selectProps: n, ...l } = r, c = G((a) => {
2651
- t?.(a.target.value);
2652
- }, [t]), m = j(() => {
2653
- const a = [];
2654
- for (let s = 0; s < i.length; s++) {
2655
- const u = i[s].label;
2656
- a.push(e(pi, { value: s, sx: { color: (d) => {
2657
- if (o === s) return d.palette.primary.main;
2658
- } }, children: u }, u));
2659
- }
2660
- return a;
2661
- }, [i, o]);
2662
- return e(lr, { sx: { minWidth: "125px", maxWidth: "125px", "& .MuiInputBase-root": { paddingLeft: "0px", paddingRight: "0px" }, "& .MuiSelect-select": { paddingTop: (a) => a.spacing(0.5), paddingBottom: (a) => a.spacing(0.5), paddingLeft: (a) => a.spacing(2), color: (a) => a.palette.primary.main }, "& .MuiSelect-icon": { fill: (a) => a.palette.text.icon ?? a.palette.action.active, "&:hover:not(.Mui-disabled)": { color: (a) => a.palette.text.icon ?? a.palette.action.active } }, ...n }, size: "small", children: e(Es, { value: o, onChange: c, variant: "outlined", sx: { backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` }, ...l, children: m }) });
2663
- }), fl = K(J((r, i) => {
2664
- const { commands: o, selectWrapper: t, selectProps: n = {}, renderCompact: l = !1, paletteWrapper: c, toolbarsProps: m, paletteProps: a = {}, workbook: s, sx: u, ...d } = r, f = j(() => {
2665
- const C = [], { ref: k, ...T } = m?.Home || {};
2666
- C.push({ label: "Home", component: e(ul, { commands: o, ...T }) });
2667
- const { ref: M, ...N } = m?.Insert || {};
2668
- C.push({ label: "Insert", component: e(ml, { commands: o, ...N }) });
2669
- const { ref: B, ...R } = m?.View || {};
2670
- return C.push({ label: "View", component: e(gl, { commands: o, ...R }) }), C;
2671
- }, [o, s]), p = j(() => {
2672
- const C = [];
2673
- for (let k = 0; k < f.length; k++) C.push(le.cloneElement(f[k].component, { ...f[k].component.props, key: f[k].key ?? f[k].label }));
2674
- return C;
2675
- }, [f]), [g, y] = U(0), x = (C) => {
2676
- y(C);
2677
- }, b = j(() => e(l ? Tu : ku, { toolbars: f, value: g, onToolbarChange: x, sx: n }), [f, g, n, l]), { sx: h, ...w } = a, v = e(Po, { elevation: 2, tabIndex: 0, sx: { display: "flex", alignItems: "center", userSelect: "none", flexGrow: 1, backgroundImage: `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})`, marginLeft: (C) => C.spacing(1), marginRight: (C) => C.spacing(1), marginTop: (C) => C.spacing(0.5), marginBottom: (C) => C.spacing(0.5), ...h }, ...w, children: p[g] });
2678
- return z(A, { ref: i, className: "toolbarWrappers", sx: { display: "flex", flexDirection: "column", paddingTop: (C) => C.spacing(0.5), "*": { userSelect: "none" }, ...u }, ...d, children: [t ? t(b) : b, c ? c(v) : v] });
2679
- }));
2680
- var $a, _a;
2681
- fl.displayName = "WorkbookToolbars", function() {
2682
- if (_a) return $a;
2683
- _a = 1;
2684
- var r = /^\s+|\s+$/g, i = /^[-+]0x[0-9a-f]+$/i, o = /^0b[01]+$/i, t = /^0o[0-7]+$/i, n = parseInt, l = typeof Co == "object" && Co && Co.Object === Object && Co, c = typeof self == "object" && self && self.Object === Object && self, m = l || c || Function("return this")(), a = Object.prototype.toString, s = Math.max, u = Math.min, d = function() {
2685
- return m.Date.now();
2686
- };
2687
- function f(g) {
2688
- var y = typeof g;
2689
- return !!g && (y == "object" || y == "function");
2690
- }
2691
- function p(g) {
2692
- if (typeof g == "number") return g;
2693
- if (function(b) {
2694
- return typeof b == "symbol" || /* @__PURE__ */ function(h) {
2695
- return !!h && typeof h == "object";
2696
- }(b) && a.call(b) == "[object Symbol]";
2697
- }(g)) return NaN;
2698
- if (f(g)) {
2699
- var y = typeof g.valueOf == "function" ? g.valueOf() : g;
2700
- g = f(y) ? y + "" : y;
2701
- }
2702
- if (typeof g != "string") return g === 0 ? g : +g;
2703
- g = g.replace(r, "");
2704
- var x = o.test(g);
2705
- return x || t.test(g) ? n(g.slice(2), x ? 2 : 8) : i.test(g) ? NaN : +g;
2706
- }
2707
- $a = function(g, y, x) {
2708
- var b, h, w, v, C, k, T = 0, M = !1, N = !1, B = !0;
2709
- if (typeof g != "function") throw new TypeError("Expected a function");
2710
- function R($) {
2711
- var D = b, E = h;
2712
- return b = h = void 0, T = $, v = g.apply(E, D);
2713
- }
2714
- function S($) {
2715
- var D = $ - k;
2716
- return k === void 0 || D >= y || D < 0 || N && $ - T >= w;
2717
- }
2718
- function I() {
2719
- var $ = d();
2720
- if (S($)) return L($);
2721
- C = setTimeout(I, function(D) {
2722
- var E = y - (D - k);
2723
- return N ? u(E, w - (D - T)) : E;
2724
- }($));
2725
- }
2726
- function L($) {
2727
- return C = void 0, B && b ? R($) : (b = h = void 0, v);
2728
- }
2729
- function O() {
2730
- var $ = d(), D = S($);
2731
- if (b = arguments, h = this, k = $, D) {
2732
- if (C === void 0) return function(E) {
2733
- return T = E, C = setTimeout(I, y), M ? R(E) : v;
2734
- }(k);
2735
- if (N) return C = setTimeout(I, y), R(k);
2736
- }
2737
- return C === void 0 && (C = setTimeout(I, y)), v;
2738
- }
2739
- return y = p(y) || 0, f(x) && (M = !!x.leading, w = (N = "maxWait" in x) ? s(p(x.maxWait) || 0, y) : w, B = "trailing" in x ? !!x.trailing : B), O.cancel = function() {
2740
- C !== void 0 && clearTimeout(C), T = 0, b = k = h = C = void 0;
2741
- }, O.flush = function() {
2742
- return C === void 0 ? v : L(d());
2743
- }, O;
2744
- };
2745
- }();
2746
- var Ua, Ga, qa = { exports: {} }, Fn = {};
2747
- Ga || (Ga = 1, qa.exports = function() {
2748
- if (Ua) return Fn;
2749
- Ua = 1;
2750
- var r = le, i = typeof Object.is == "function" ? Object.is : function(a, s) {
2751
- return a === s && (a !== 0 || 1 / a == 1 / s) || a != a && s != s;
2752
- }, o = r.useState, t = r.useEffect, n = r.useLayoutEffect, l = r.useDebugValue;
2753
- function c(a) {
2754
- var s = a.getSnapshot;
2755
- a = a.value;
2756
- try {
2757
- var u = s();
2758
- return !i(a, u);
2759
- } catch {
2760
- return !0;
2761
- }
2762
- }
2763
- var m = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? function(a, s) {
2764
- return s();
2765
- } : function(a, s) {
2766
- var u = s(), d = o({ inst: { value: u, getSnapshot: s } }), f = d[0].inst, p = d[1];
2767
- return n(function() {
2768
- f.value = u, f.getSnapshot = s, c(f) && p({ inst: f });
2769
- }, [a, u, s]), t(function() {
2770
- return c(f) && p({ inst: f }), a(function() {
2771
- c(f) && p({ inst: f });
2772
- });
2773
- }, [a]), l(u), u;
2774
- };
2775
- return Fn.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : m, Fn;
2776
- }()), qa.exports;
2777
- var Xa, Ka, bo = { exports: {} }, Xt = { exports: {} }, Eu = Xt.exports;
2778
- (function() {
2779
- if (Ka) return bo.exports;
2780
- Ka = 1;
2781
- for (var r = (Xa || (Xa = 1, function() {
2782
- var d, f, p, g, y, x;
2783
- typeof performance < "u" && performance !== null && performance.now ? Xt.exports = function() {
2784
- return performance.now();
2785
- } : typeof process < "u" && process !== null && process.hrtime ? (Xt.exports = function() {
2786
- return (d() - y) / 1e6;
2787
- }, f = process.hrtime, g = (d = function() {
2788
- var b;
2789
- return 1e9 * (b = f())[0] + b[1];
2790
- })(), x = 1e9 * process.uptime(), y = g - x) : Date.now ? (Xt.exports = function() {
2791
- return Date.now() - p;
2792
- }, p = Date.now()) : (Xt.exports = function() {
2793
- return (/* @__PURE__ */ new Date()).getTime() - p;
2794
- }, p = (/* @__PURE__ */ new Date()).getTime());
2795
- }.call(Eu)), Xt.exports), i = typeof window > "u" ? Co : window, o = ["moz", "webkit"], t = "AnimationFrame", n = i["request" + t], l = i["cancel" + t] || i["cancelRequest" + t], c = 0; !n && c < o.length; c++) n = i[o[c] + "Request" + t], l = i[o[c] + "Cancel" + t] || i[o[c] + "CancelRequest" + t];
2796
- if (!n || !l) {
2797
- var m = 0, a = 0, s = [], u = 1e3 / 60;
2798
- n = function(d) {
2799
- if (s.length === 0) {
2800
- var f = r(), p = Math.max(0, u - (f - m));
2801
- m = p + f, setTimeout(function() {
2802
- var g = s.slice(0);
2803
- s.length = 0;
2804
- for (var y = 0; y < g.length; y++) if (!g[y].cancelled) try {
2805
- g[y].callback(m);
2806
- } catch (x) {
2807
- setTimeout(function() {
2808
- throw x;
2809
- }, 0);
2810
- }
2811
- }, Math.round(p));
2812
- }
2813
- return s.push({ handle: ++a, callback: d, cancelled: !1 }), a;
2814
- }, l = function(d) {
2815
- for (var f = 0; f < s.length; f++) s[f].handle === d && (s[f].cancelled = !0);
2816
- };
2817
- }
2818
- bo.exports = function(d) {
2819
- return n.call(i, d);
2820
- }, bo.exports.cancel = function() {
2821
- l.apply(i, arguments);
2822
- }, bo.exports.polyfill = function(d) {
2823
- d || (d = i), d.requestAnimationFrame = n, d.cancelAnimationFrame = l;
2824
- }, bo.exports;
2825
- })();
2826
- var st = { DOM_UNAVAILABLE_ERROR: "DOM is unavailable server-side. Please use this method client-side only.", FULLSCREEN_UNSUPPORTED_ERROR: "Your browser does not support Fullscreen API.", getEventsNames() {
2827
- if (typeof document > "u") return null;
2828
- const r = document;
2829
- return "exitFullscreen" in r ? ["fullscreenchange", "fullscreenerror"] : "webkitExitFullscreen" in r || "webkitCancelFullScreen" in r ? ["webkitfullscreenchange", "webkitfullscreenerror"] : "mozCancelFullScreen" in r ? ["mozfullscreenchange", "mozfullscreenerror"] : "msExitFullscreen" in r ? ["MSFullscreenChange", "MSFullscreenError"] : null;
2830
- }, getEventName(r) {
2831
- const i = this.getEventsNames();
2832
- return i ? r === "change" ? i[0] : i[1] : null;
2833
- }, get fullscreenEnabled() {
2834
- if (typeof document > "u") return !1;
2835
- const r = document;
2836
- return r.fullscreenEnabled || r.webkitFullscreenEnabled || !!r.webkitCancelFullScreen || r.mozFullScreenEnabled || r.msFullscreenEnabled || !1;
2837
- }, get fullscreenElement() {
2838
- if (typeof document > "u") return null;
2839
- const r = document;
2840
- return r.fullscreenElement || r.webkitFullscreenElement || r.webkitCurrentFullScreenElement || r.mozFullScreenElement || r.msFullscreenElement || null;
2841
- }, requestFullscreen(r, i) {
2842
- if (typeof document > "u") throw new Error(this.DOM_UNAVAILABLE_ERROR);
2843
- const o = r ?? document.documentElement, t = o.requestFullscreen || o.webkitRequestFullscreen || o.webkitRequestFullScreen || o.mozRequestFullScreen || o.msRequestFullscreen;
2844
- if (!t) throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);
2845
- return t.call(o, i);
2846
- }, exitFullscreen() {
2847
- if (typeof document > "u") throw new Error(this.DOM_UNAVAILABLE_ERROR);
2848
- const r = document, i = r.exitFullscreen || r.webkitExitFullscreen || r.webkitCancelFullScreen || r.mozCancelFullScreen || r.msExitFullscreen;
2849
- if (!i) throw new Error(this.FULLSCREEN_UNSUPPORTED_ERROR);
2850
- return i.call(r);
2851
- }, on(r, i) {
2852
- const o = this.getEventName(r);
2853
- o && document.addEventListener(o, i);
2854
- }, off(r, i) {
2855
- const o = this.getEventName(r);
2856
- o && document.removeEventListener(o, i);
2857
- } };
2858
- const Du = (r) => {
2859
- const { workbook: i, workbookElement: o, notifier: t, target: n, commands: l, darkMode: c, onShowSidebar: m, onNewWorkbook: a = Pu } = r, [s, u] = U(i?.getSelectedSheet()), [d, f] = U(i?.getSheets().getItems()), p = ee(m, [m]), g = ee(a, [a]), y = j(() => [new Ge("workbookStatistics", n, { label: "Workbook Statistics", description: "Show the workbook statistics.", shortcut: { key: "G", modifiers: [ke.Ctrl, ke.Shift] } }), new Ge("showFormat", n, { label: "Show Format", description: "Open the format pane.", shortcut: { key: "F", modifiers: [ke.Ctrl, ke.Shift] } }), new ye("newCellStyle", n, { label: "New Cell Style…", scopedLabels: { cellStyle: "New Cell Style" }, description: "Create a new named style can can be quickly used later." }), new ye("deleteCellStyle", n, { label: "Delete Cell Style", scopedLabels: { cellStyle: "Delete" }, description: "Remove a named style that is no longer needed." }), new ye("modifyCellStyle", n, { label: "Modify Cell Style", scopedLabels: { cellStyle: "Modify" }, description: "Update a style with the currently style." }), new Ge("find", n, { label: "Find", description: "Open the Find window.", shortcut: [{ key: "F", modifiers: [ke.Ctrl] }, { key: "F5", modifiers: [ke.Shift] }] }), new Ge("findReplace", n, { label: "Find & Replace", description: "Open the Find & Replace window.", shortcut: [{ key: "H", modifiers: [ke.Ctrl] }, { key: "H", modifiers: [ke.Ctrl, ke.Alt] }] }), new Ge("goto", n, { label: "Go To", description: "Open the 'Go To' window.", shortcut: [{ key: "G", modifiers: [ke.Ctrl] }] }), new Ge("workbookViewToggleExpandFormulaBar", n, { label: "Toggle Expand Formula bar", description: "Expand or collapse the formula bar.", shortcut: { key: "U", modifiers: [ke.Ctrl, ke.Shift] } }), new Ge("workbookViewToggleShowFormulaBar", n, { label: "View Formula bar", scopedLabels: { view: "Formula Bar" }, description: "Show or hide the formula bar." }), new Ge("workbookViewToggleShowTabs", n, { label: "View Sheet Tabs", description: "Show or hide the sheet tabs.", scopedLabels: { view: "Sheet Tabs" } }), new Ge("workbookViewToggleShowStatusBar", n, { label: "View Status Bar", description: "Show or hide the status bar.", scopedLabels: { view: "Status Bar" } }), new Ge("workbookViewToggleShowHorizontalScrollBar", n, { label: "View Horizontal Scrollbar", description: "Show or hide the horizontal scrollbar.", scopedLabels: { view: "Horizontal Scrollbar" } }), new Ge("workbookViewToggleShowVerticalScrollBar", n, { label: "View Vertical Scrollbar", description: "Show or hide the vertical scrollbar.", scopedLabels: { view: "Vertical Scrollbar" } }), new ye("hideSheet", n, { label: "Hide Sheet", scopedLabels: { sheet: "Hide" }, description: "Hide the sheet from appearing in the tabs. This keeps the data but de-clutters the tabs." }), new ye("deleteSheet", n, { label: "Delete Sheet", scopedLabels: { sheet: "Delete" }, description: "Delete the sheet and all the data." }), new ye("addSheet", n, { label: "Insert Sheet", scopedLabels: { sheet: "Insert" }, description: "Insert sheet before the current sheet.", shortcut: [{ key: "F11", modifiers: [ke.Shift] }, { key: "F1", modifiers: [ke.Alt, ke.Shift] }] }), new ye("duplicateSheet", n, { label: "Duplicate Sheet", description: "Duplicate the current sheet.", scopedLabels: { sheet: "Duplicate" } }), new ye("nextSheet", n, { label: "Next Sheet", scopedLabels: { sheet: "Next" }, description: "Activate the next sheet.", shortcut: [{ key: "PageDown", modifiers: [ke.Ctrl] }] }), new ye("previousSheet", n, { label: "Previous Sheet", scopedLabels: { sheet: "Previous" }, description: "Activate the previous sheet.", shortcut: [{ key: "PageUp", modifiers: [ke.Ctrl] }] }), new ye("selectNextSheet", n, { label: "Select Next Sheet", scopedLabels: { sheet: "Select Next" }, description: "Select the next sheet.", shortcut: [{ key: "PageDown", modifiers: [ke.Ctrl, ke.Shift] }] }), new ye("selectPreviousSheet", n, { label: "Select Previous Sheet", scopedLabels: { sheet: "Select Previous" }, description: "Select the previous sheet.", shortcut: [{ key: "PageUp", modifiers: [ke.Ctrl, ke.Shift] }] }), new ye("selectTheme", n, { label: "Theme", description: "Select a theme that coveys a style suitable for your data." }), new ye("selectNamed", n, { label: (S) => S?.getName() ?? "Select Named Item", scopedLabels: { namedItem: (S) => S?.getName() ?? "Select" }, description: "Select the item." }), new ye("addNamedReference", n, { label: "Define Named Reference", scopedLabels: { namedItem: "Define Name…" }, description: "Add a new named reference. Names can be used as a substitute for cell references." }), new ye("editNamedReference", n, { label: "Edit Named Reference…", scopedLabels: { namedItem: "Edit…" }, description: "Add a new named reference. Names can be used as a substitute for cell references." }), new ye("deleteNamedReference", n, { label: "Delete Named Reference", scopedLabels: { namedItem: "Delete" }, description: "Remove the named reference." }), new Ge("activeNameBox", n, { label: "Activate Name Box", description: "Move the focus to the name box.", shortcut: { key: "F3", modifiers: [ke.Alt] } }), new Ge("createNamedReferenceFromSelection", n, { label: "Create from Selection", description: "Automatically generate names from the selected cells.", shortcut: { key: "F3", modifiers: [ke.Ctrl, ke.Shift] } }), new Ge("activeNameManager", n, { label: "Activate Name Manager", description: `Create, edit, delete, and find all the names used in the workbook.
2860
-
2861
- Names can be used as a substitute for cell references.`, shortcut: { key: "F3", modifiers: [ke.Ctrl] } }), new ye("fullScreenToggle", n, { label: "FullScreen", description: "Toggle showing the workbook using the full screen.", shortcut: { key: "F11" } }), new ye("showScriptEditor", n, { label: "Scripts", scopedLabels: { scripts: "Script Editor…" }, description: "Show the script editor.", shortcut: [{ key: "F11", modifiers: [ke.Alt] }] }, function(S = !0) {
2862
- p?.();
2863
- }), new ye("executeScript", n, { label: "Run Script", description: "Run the selected or last executed script.", shortcut: { key: "F8" } }), new ye("executeSelectedScript", n, { label: "Run Script", description: "Run the selected script.", shortcut: { key: "F8" } }), new ye("saveScripts", n, { label: "Save Script", description: "Save the current scripts." }), new ye("maximumWorkbookToggle", n, { label: "Maximize", description: "Toggle showing the workbook maximized.", shortcut: { key: "F10", modifiers: [ke.Ctrl] } }), new ye("spellCheck", n, { label: "Spell Check", description: "Check the workbook for spelling mistakes.", shortcut: { key: "F7" } }), new ye("calculateAll", n, { label: "Calculate Now", description: "Recalculate all formulas.", shortcut: { key: "F9" } }), new Ge("closeWorkbook", n, { label: "Close Workbook", description: "Close the workbook.", shortcut: { key: "W", modifiers: [ke.Ctrl] } }), new Ge("newWorkbook", n, { label: "New Workbook", description: "Create a new workbook in another tab." })], []), x = j(() => {
2864
- let S = null;
2865
- return S = l ? l.createChildGroup(n, "workbook", !1) : new mr(n, "workbook"), S.addCommands(y, !0), S;
2866
- }, [l, y]), b = un(), h = le.useRef(null), w = ee(() => {
2867
- let S, I = null;
2868
- const L = x.getCommand("executeScript");
2869
- if (L.update({ disabled: !1, context: { getScripts: () => i.getScripts() } }), !L) return;
2870
- const O = x.getCommand("executeSelectedScript");
2871
- if (!O) return;
2872
- const $ = { saveSource: async (D) => {
2873
- let E = null, Y = null;
2874
- const Z = i.getScripts();
2875
- try {
2876
- D && (Y = await t?.showBusy?.("Saving Scripts..."), E = await Z.createModule({ source: D })), Z.addModule("scripts", E, { replace: !0 }), Y?.();
2877
- } catch (X) {
2878
- Y?.(), console.warn("Unable to compile", X), t?.showError?.(X);
2879
- }
2880
- return E;
2881
- }, addContainerListener: (D) => (v.current = D, () => {
2882
- v.current = null;
2883
- }), setSelectedFunction: (D) => {
2884
- S = D ?? h.current ?? null, Promise.resolve(S).then((E) => {
2885
- O.update({ disabled: E === null });
2886
- });
2887
- }, quickInsertFunction: (D) => {
2888
- const E = `=${D.toUpperCase()}(`, Y = { text: E + ")", editMode: !0, initialSelection: { start: E.length, end: E.length + 0 } };
2889
- b.setMode((Z) => Z?.key === "edit" ? { ...Z, args: { ...Z.args } } : { key: "edit", args: { stateAndCoords: null, start: Y } });
2890
- }, getSelectedFunction: () => S, setEditor: (D) => {
2891
- I = D ?? null, x.getCommand("showScriptEditor")?.update({ state: D !== null });
2892
- }, getEditor: () => I, getRanges: (D) => {
2893
- try {
2894
- return i.getRanges(D);
2895
- } catch {
2896
- }
2897
- return null;
2898
- }, getScripts: () => i.getScripts(), isReadOnly: () => i.getProtection().isStructureAllowed() === !1 };
2899
- O.update({ context: $ });
2900
- }, [x, i, o, t]), v = le.useRef(null);
2901
- _e(i, { onBeforeSave: async () => {
2902
- await v.current?.onBeforeSave();
2903
- }, onProtectionChange: () => {
2904
- v.current?.onReadonlyChange();
2905
- }, onLoad: () => {
2906
- (async () => (await i.getCalculation().start(), i.getScripts().start(), v.current?.onScriptChange()))();
2907
- } }), _e(i, { onSheetsChange: (S) => {
2908
- f(S.getSheets().getItems());
2909
- }, onViewChange(S) {
2910
- u(S?.getSelectedSheet());
2911
- }, onProtectionChange: (S) => {
2912
- const I = { disabled: !S.getProtection().isStructureAllowed() };
2913
- x.getCommand("hideSheet").update(I), x.getCommand("deleteSheet").update(I), x.getCommand("addSheet").update(I), x.getCommand("duplicateSheet").update(I), x.getCommand("selectTheme").update(I), x.getCommand("addNamedReference").update(I), x.getCommand("editNamedReference").update(I), x.getCommand("deleteNamedReference").update(I);
2914
- }, onScriptsChange: (S) => {
2915
- w();
2916
- } });
2917
- const { isFullscreenAvailable: C, isFullscreenEnabled: k, toggleFullscreen: T } = function(S = {}) {
2918
- const { target: I, onChange: L, onError: O, requestFullScreenOptions: $ } = S, [D, E] = U(!1), [Y, Z] = U(null), [X, _] = U(!1), ne = G(() => st.requestFullscreen(I?.current || null, $), [I, $]), ae = G(() => st.exitFullscreen(), []), q = G(() => st.fullscreenElement ? ae() : ne(), [ne, ae]), W = G((ue) => {
2919
- const Le = st.fullscreenElement;
2920
- Z(Le), _(!!Le), L?.(ue);
2921
- }, [L]), Q = G((ue) => {
2922
- const Le = st.fullscreenElement;
2923
- Z(Le), _(!!Le), O?.(ue);
2924
- }, [O]);
2925
- return me(() => {
2926
- E(st.fullscreenEnabled);
2927
- }, []), me(() => (st.on("change", W), st.on("error", Q), () => {
2928
- st.off("change", W), st.off("error", Q);
2929
- }), [W, Q]), { isFullscreenAvailable: D, fullscreenElement: Y, isFullscreenEnabled: X, enableFullscreen: ne, disableFullscreen: ae, toggleFullscreen: q };
2930
- }({ target: { current: o ?? document.body } }), M = hr();
2931
- me(() => {
2932
- x.getCommand("selectTheme").update({ state: () => i.getTheme(), context: () => ({ theme: i.getTheme(), themes: M, darkMode: c }) });
2933
- }, [i?.getTheme(), c]);
2934
- const N = ee(async function(S, I) {
2935
- let L = null;
2936
- const O = i.getScripts();
2937
- if (S?.declaration || S?.functionName) {
2938
- const $ = S.declaration ? S.declaration.getName() : S.functionName;
2939
- O.searchFunction({ name: $ }).length > 0 && (L = $);
2940
- }
2941
- if (L) try {
2942
- await O.executeMacro(L), h.current = Promise.resolve({ source: null, name: L });
2943
- } catch ($) {
2944
- return void t?.showError?.($);
2945
- }
2946
- }, [i, t]);
2947
- me(() => {
2948
- x.getCommand("newCellStyle").updateCallback((S) => {
2949
- t?.showInputOptions?.({ initialValue: (() => {
2950
- let I = 0;
2951
- for (; ; ) {
2952
- I++;
2953
- const L = `Style ${I}`;
2954
- try {
2955
- return i.getStyles().validateStyleName(L, !0), L;
2956
- } catch {
2957
- }
2958
- }
2959
- })(), title: x.getCommand("newCellStyle")?.label("cellStyle"), description: "Enter a name for the new cell style.", inputLabel: "Style Name", inputProps: { style: { minWidth: "300px" } }, options: ["Ok", "Cancel"], defaultOption: "Ok", onValidateInputOption: async (I, L) => {
2960
- let O = null;
2961
- try {
2962
- i.getStyles().validateStyleName(I, !1);
2963
- } catch (E) {
2964
- O = E.message;
2965
- }
2966
- let $ = i.getStyles().getNamed(I), D = O;
2967
- return !D && $ && (D = `Update style '${$.getName()}'.`), { valid: O === null, message: D };
2968
- } }).then(({ input: I, option: L }) => {
2969
- const O = i.getSelectedSheet().getSelectedRange();
2970
- if (L !== "Ok") return;
2971
- const $ = i.getStyles().setNamed({ name: I, style: O.getCell().getStyle() });
2972
- O.updateStyle({ named: $.getName() });
2973
- });
2974
- }), x.getCommand("deleteCellStyle").updateCallback((S) => {
2975
- S.delete();
2976
- }), x.getCommand("modifyCellStyle").updateCallback(({ named: S }) => {
2977
- const I = i.getSelectedSheet().getSelectedRange();
2978
- i.getStyles().setNamed({ name: S.getName(), style: I.getCell().getStyle() });
2979
- }), x.getCommand("hideSheet").updateCallback((S) => {
2980
- i.getSheetAt(S).setVisibility(Rt.Visibility.Hidden);
2981
- }), x.getCommand("deleteSheet").updateCallback(async (S) => {
2982
- i.getSheetAt(S ?? i.getSelectedSheetIndex())?.delete();
2983
- }), x.getCommand("addSheet").updateCallback((S) => {
2984
- i.getSheets().add({ index: S, autoSelect: !0 });
2985
- }), x.getCommand("duplicateSheet").updateCallback(async (S) => {
2986
- (await i.getSheetAt(S ?? i.getSelectedSheetIndex())?.duplicate())?.select();
2987
- }), x.getCommand("nextSheet").updateCallback((S) => {
2988
- i.getNextSheet(S ?? i.getSelectedSheetIndex()).select();
2989
- }), x.getCommand("previousSheet").updateCallback((S) => {
2990
- i.getPreviousSheet(S ?? i.getSelectedSheetIndex()).select();
2991
- }), x.getCommand("selectNextSheet").updateCallback((S) => {
2992
- i.getNextSheet(S ?? i.getSelectedSheetIndex()).select();
2993
- }), x.getCommand("selectPreviousSheet").updateCallback((S) => {
2994
- i.getPreviousSheet(S ?? i.getSelectedSheetIndex()).select();
2995
- }), x.getCommand("selectTheme").updateCallback((S) => {
2996
- i.setTheme(S);
2997
- }), x.getCommand("calculateAll").updateCallback(() => {
2998
- i.getSelectedSheet().getEntireRange().calculate(!0);
2999
- }), x.getCommand("closeWorkbook").updateCallback(async () => {
3000
- await t?.showOptions({ title: "Confirm", description: "This will close the current workbook tab. Do you want to continue?", options: ["Close", "Cancel"], defaultOption: "Close" }) === "Close" && window.close();
3001
- }), x.getCommand("newWorkbook").updateCallback(() => {
3002
- g?.();
3003
- }), x.getCommand("executeScript").updateCallback(N), x.getCommand("executeSelectedScript").updateCallback(N);
3004
- }, [i, t]);
3005
- const B = ee(async (S) => {
3006
- let I = 0, L = null, O = "Find & Replace";
3007
- S?.replace && !S?.replaceOptions?.maxCount && (O = "Replace All");
3008
- const $ = await t?.showBusy?.(O);
3009
- try {
3010
- const D = S?.scope ?? "sheet";
3011
- let E = null;
3012
- const Y = i.getSelectedSheet(), Z = { from: Y.getSelectedCell(), ...S.findOptions };
3013
- if (E = D === "sheet" ? i.getSelectedSheet().find(S.findText, Z) : i.find(S.findText, Z), S.replace) {
3014
- const X = i.replace(E, S.replaceText, S.replaceOptions);
3015
- I = X.count, S.replaceOptions.maxCount && (L = X.last);
3016
- } else {
3017
- let X = E.next();
3018
- X.done || (I++, L = X.value);
3019
- }
3020
- L?.select({ autoFocus: !1 }), $?.(), !S.replaceOptions.maxCount && I > 1 && t?.showMessage?.(`We replaced ${I} cells.`);
3021
- } catch (D) {
3022
- $?.(), t?.showError?.(D);
3023
- }
3024
- return I;
3025
- }, [i, o]), R = ee((S) => {
3026
- const I = { value: S, context: { selection: () => {
3027
- const L = i.getSelectedRanges(), O = [];
3028
- for (let $ = 0; $ < L.getCount(); $++) {
3029
- const D = L.at($).getFixed(!0).getCoords();
3030
- O.push(D);
3031
- }
3032
- return i.getRanges(O);
3033
- }, getNames: () => i.getNames() }, onUpdate: async (L) => {
3034
- try {
3035
- await L.select();
3036
- } catch (O) {
3037
- t?.showMessage?.(O.message, { type: wt.Error });
3038
- }
3039
- } };
3040
- return t.showWindow?.("namedDetails", I);
3041
- }, [t, i, o]);
3042
- return me(() => {
3043
- const S = (I = !1) => {
3044
- const L = i.getSelectedCell(), O = { onFindOrReplace: B, onKeyDown: ($) => {
3045
- x.findCommandByEvent($) !== x.getCommand("find") && x.findCommandByEvent($) !== x.getCommand("findReplace") || $.preventDefault();
3046
- }, findOptions: {}, findText: L.toTextUnformatted(!0) };
3047
- O.replace = I, t.showWindow?.("find", O, { disableAutoDestroy: !0 });
3048
- };
3049
- x.getCommand("find")?.update({ disabled: !t?.showWindow }).updateCallback(() => {
3050
- S();
3051
- }), x.getCommand("findReplace")?.update({ disabled: !t?.showWindow }).updateCallback(() => {
3052
- S(!0);
3053
- }), x.getCommand("goto")?.update({ disabled: !t }).updateCallback(() => {
3054
- const I = { onInputOption: async (L) => {
3055
- try {
3056
- await i.getRanges(L).select();
3057
- } catch (O) {
3058
- t?.showMessage?.(O.message, { type: wt.Error });
3059
- }
3060
- }, onKeyDown: (L) => {
3061
- x.findCommandByEvent(L) === x.getCommand("goto") && L.preventDefault();
3062
- }, title: x.getCommand("goto")?.label(), inputLabel: "Location", options: ["Go To"] };
3063
- t?.showInputOptions?.(I);
3064
- }), x.getCommand("selectNamed")?.update({ disabled: !t }).updateCallback(async (I) => {
3065
- if (I) try {
3066
- await I.select();
3067
- } catch (L) {
3068
- t?.showError?.(L);
3069
- }
3070
- }), x.getCommand("addNamedReference")?.updateCallback(async function(I) {
3071
- R(null);
3072
- }), x.getCommand("editNamedReference")?.updateCallback(async function(I) {
3073
- R(I);
3074
- }), x.getCommand("deleteNamedReference")?.updateCallback(async function(I) {
3075
- I?.delete?.();
3076
- }), x.getCommand("activeNameBox")?.updateCallback(async function() {
3077
- o?.getFormulaBarElement()?.getNamedCollectionEditorElement()?.focus();
3078
- });
3079
- }, [o, i, t]), _e(i?.getView(), { onViewChange: (S) => {
3080
- x.getCommand("workbookViewToggleShowFormulaBar").update({ state: S.isShowFormulaBar() }).updateCallback(() => {
3081
- S.setShowFormulaBar(!S.isShowFormulaBar());
3082
- }), x.getCommand("workbookViewToggleShowTabs").update({ state: S.isShowTabs() }).updateCallback(() => {
3083
- S.setShowTabs(!S.isShowTabs());
3084
- }), x.getCommand("workbookViewToggleShowStatusBar").update({ state: S.isShowStatusBar() }).updateCallback(() => {
3085
- S.setShowStatusBar(!S.isShowStatusBar());
3086
- }), x.getCommand("workbookViewToggleShowHorizontalScrollBar").update({ state: S.isShowHorizontalScrollbar() }).updateCallback(() => {
3087
- S.setShowHorizontalScrollbar(!S.isShowHorizontalScrollbar());
3088
- }), x.getCommand("workbookViewToggleShowVerticalScrollBar").update({ state: S.isShowVerticalScrollbar() }).updateCallback(() => {
3089
- S.setShowVerticalScrollbar(!S.isShowVerticalScrollbar());
3090
- });
3091
- } }), me(() => {
3092
- x.getCommand("fullScreenToggle").update({ state: k, disabled: !C }).updateCallback(() => {
3093
- T();
3094
- });
3095
- }, [k, C]), me(() => {
3096
- const S = i.getProtection().isStructureAllowed();
3097
- x.getCommand("hideSheet").update({ disabled: d.length <= 1 || !S }), x.getCommand("deleteSheet").update({ disabled: d.length <= 1 || !S });
3098
- }, [d, s]), x;
3099
- }, Pu = () => {
3100
- window.open(window.origin.toString(), "sheetxl-" + Ze.uuidV4(), "popup=true");
3101
- }, Ru = "_sheetxl-theme_4opcr_2", Mu = "_sheetxl-workbook_1j3lu_5", Iu = (r) => e(Ji, { ...r }), Nu = (r) => e(Qi, { ...r }), Fu = (r) => e(Zi, { ...r }), bl = K(J((r, i) => {
3102
- const { workbook: o, commands: t, onBeforeUserChange: n, onUserChange: l, disabled: c = !1, readOnly: m = !1, contextMenuProps: a, renderContextMenu: s = Iu, sheetsAllProps: u, renderSheetsAll: d = Nu, sheetTabProps: f, renderSheetTab: p, background: g = "transparent", className: y, notifier: x, sx: b, borderWidth: h, borderColor: w, gridTheme: v, gridStyle: C, ...k } = r, [T, M] = U(o?.getSelectedSheetIndex()), [N, B] = U(o?.getSheets().getItems()), [R, S] = U(o?.getProtection());
3103
- _e(o, { onViewChange(H) {
3104
- M(H?.getSelectedSheetIndex());
3105
- }, onSheetsChange: (H) => {
3106
- B(H.getSheets().getItems());
3107
- }, onProtectionChange: (H) => {
3108
- S(H?.getProtection());
3109
- } });
3110
- const I = m || !R.isStructureAllowed(), L = j(() => {
3111
- const H = [];
3112
- for (let oe = 0; oe < N.length; oe++) H.push(N[oe].getName());
3113
- return H;
3114
- }, [N]), O = G((H) => {
3115
- n?.(H) !== !1 && (o.getSheetAt(H).select(), l?.(H));
3116
- }, [o, n, l]), $ = G((H, oe) => {
3117
- o.getSheetAt(H).setName(oe), l?.(H);
3118
- }, [o, l]), D = G((H, oe) => {
3119
- o.getSheetAt(H).setPosition(oe), l?.(oe);
3120
- }, [o, l]), E = ee(() => {
3121
- if (n?.(T) === !1) return;
3122
- const H = T + 1;
3123
- o.getSheets().add({ name: void 0, autoSelect: !0 }), l?.(H);
3124
- }, [o, n, l, T]), Y = j(() => ({ placement: "top-start" }), []), Z = we(null), [X, _] = U(!1), ne = G((H) => {
3125
- const { closeFloatAll: oe, floatReference: Te } = H;
3126
- return d({ workbook: o, gridStyle: C, floatReference: Te, closeFloatAll: oe, ...u });
3127
- }, [d, u, c, o, C]), { reference: ae, component: q } = oo({ label: "allSheet", popperProps: Y, anchor: Z.current, onOpen: () => _(!0), onClose: () => _(!1), createPopupPanel: ne }), W = we(null), [Q, ue] = U(null), Le = G((H) => {
3128
- const { floatReference: oe } = H;
3129
- return s?.({ workbook: o, index: Q?.index, tabStripRef: W.current, commands: t, disabled: c, floatReference: oe, ...a });
3130
- }, [s, a, c, o, t, Q]), { reference: Fe, component: Be } = oo({ label: "sheetTab", popperProps: Y, anchor: { getBoundingClientRect: () => new DOMRect(Q?.left || 0, Q?.top || 0, 0, 0) }, onClose: () => ue(null), createPopupPanel: Le });
3131
- me(() => {
3132
- Q ? Fe.open(0) : Fe.close(0);
3133
- }, [Q]);
3134
- const Ye = G((H, oe) => {
3135
- H.preventDefault(), ue({ left: H.clientX - 2, top: H.clientY - 4, index: oe });
3136
- }, []), ve = ee((H) => {
3137
- let oe;
3138
- try {
3139
- oe = o?.getSheetAt(H.index);
3140
- } catch {
3141
- }
3142
- return oe ? (p ?? Fu)({ sheet: oe, gridTheme: v, onContextMenu: (Te) => {
3143
- O(H.index), Ye(Te, H.index);
3144
- }, ...H, ...f }) : null;
3145
- }, [p, f, o, v]), je = j(() => I ? null : e(At, { disableInteractive: !0, title: "New sheet", children: e(dt, { disabled: c, component: "div", sx: { padding: "0", "&:hover:not([disabled])": { color: (H) => H.palette.primary.main }, color: (H) => H.palette.text.icon ?? H.palette.action.active, "& svg": { width: "18px", height: "18px" } }, "aria-label": "addTab", size: "small", onMouseDown: (H) => {
3146
- H.button === 0 && H.preventDefault();
3147
- }, onClick: () => E(), children: e(Jd, {}) }) }), [c, I, E]);
3148
- return z(A, { ref: i, className: Ae(y), sx: { position: "relative", display: "flex", alignItems: "stretch", flex: "1 1 100%", maxWidth: "100%", ...b }, ...k, children: [e(cp, { ref: W, selectedTabIndex: T, tabNames: L, onSelectedTabIndexChange: O, onTabNameChange: $, onTabMove: D, background: g, borderColor: w, borderWidth: h, activeColor: null, disabled: c, disableDrag: I, createScrollStartButton: pd, createScrollEndButton: dd, createScrollEdgeButton: cd, createTabButton: ve, createTabDivider: (H) => {
3149
- const { key: oe, ...Te } = H;
3150
- return e(re, { sx: { marginLeft: "-1px", marginRight: "0px", marginTop: "6px", marginBottom: "6px", background: (ge) => he(ge.palette.divider, 0.25) }, ...Te }, oe);
3151
- }, editLabelProps: { readOnly: I, maxLength: 31, styleHover: { fontWeight: "700" }, onKeyPress: (H) => {
3152
- o.isValidSheetNameCharacter(H.key) || H.preventDefault();
3153
- }, onCancel: () => {
3154
- l?.(T);
3155
- }, notifier: x }, children: e(At, { disableInteractive: !0, title: X ? "" : "List all sheets", children: e(bt, { sx: { padding: "0px", ml: 0.5, mr: 0, mt: 0, mb: 0, "& svg": { transform: "scale(0.8, 1)" }, color: (H) => H.palette.text.icon ?? H.palette.action.active }, ref: Z, dense: !0, outlined: !1, selected: X, color: "primary", "aria-label": "menu", onMouseDown: (H) => {
3156
- H.button === 0 && H.preventDefault();
3157
- }, onClick: () => {
3158
- X ? ae.close(0) : ae.open(0);
3159
- }, icon: e(Qd, {}) }) }) }), e("div", { style: { borderTop: `solid ${w} ${h}px`, minWidth: "4px" } }), e("div", { style: { borderTop: `solid ${w} ${h}px`, flex: "none", display: "flex", alignItems: "center" }, children: je }), e("div", { style: { borderTop: `solid ${w} ${h}px`, flex: 1, minWidth: "24px" } }), Be, q] });
3160
- }));
3161
- bl.displayName = "WorkbookStrip";
3162
- const xl = K(J((r, i) => {
3163
- const { workbook: o, commands: t, disabled: n, sx: l, floatReference: c, className: m, ...a } = r, [s, u] = rr((S) => S + 1, 0), [d, f] = U(o.getSelectedSheet()), [p, g] = U(d.getSelectedRanges()), [y, x] = U(d.getSelectedCell());
3164
- _e(o, { onSheetsChange() {
3165
- f(o.getSelectedSheet());
3166
- } }), _e(d.getSelection(), { onChange() {
3167
- g(d.getSelectedRanges()), x(d.getSelectedCell());
3168
- } }), He(t, [], { onChange: () => {
3169
- u();
3170
- } });
3171
- const b = j(() => ({}), []), h = j(() => ({ commandHook: { beforeExecute: (S, I) => c.closeAll(), onExecute() {
3172
- }, onError() {
3173
- console.log("onError");
3174
- } }, disabled: n, scope: "contextMenu", parentFloat: c }), [n, c]), w = j(() => ({ ...b, ...h, variant: ie.Menuitem }), [b, h]), v = j(() => ({ commands: t, variant: ie.Menuitem, parentFloat: c, ...h }), [t, h, c]), C = [];
3175
- let k = p.isEntireRows(), T = p.isEntireColumns();
3176
- p && (k && (C.push(e(re, { orientation: "horizontal" }, "context:" + C.length)), C.push(Pe(F, { command: t.getCommand("hideColumns"), ...w, icon: P(e(ud, {})), key: "context:" + C.length })), C.push(Pe(F, { command: t.getCommand("unhideColumns"), ...w, icon: P(e(md, {})), key: "context:" + C.length }))), T && (C.push(e(re, { orientation: "horizontal" }, "context:" + C.length)), C.push(Pe(F, { command: t.getCommand("hideRows"), ...w, icon: P(e(gd, {})), key: "context:" + C.length })), C.push(Pe(F, { command: t.getCommand("unhideRows"), ...w, icon: P(e(hd, {})), key: "context:" + C.length }))), (k || T) && C.push(e(re, { orientation: "horizontal" }, "context:" + C.length)), k && C.push(Pe(F, { command: t.getCommand("autoFitColumns"), ...w, icon: P(e(fd, {})), key: "context:" + C.length })), T && C.push(Pe(F, { command: t.getCommand("autoFitRows"), ...w, icon: P(e(bd, {})), key: "context:" + C.length })));
3177
- const M = [], N = t.getCommand("formatTableStyle"), B = N?.context()?.table();
3178
- if (Ht(N), !k && !T) {
3179
- if (M.push(e(re, { orientation: "horizontal" }, "contextBefore:" + M.length)), y?.getHyperlink()) M.push(Pe(ct, { ...v, popupCommandKeys: ["updateHyperlink", "deleteHyperlink"], popupScope: "hyperlink", key: "contextBefore:action" + M.length, quickCommand: "openHyperlink", icon: (S) => S.key() === "openHyperlink" ? P(e(_n, {})) : null }));
3180
- else {
3181
- const S = t.getCommand("updateHyperlink");
3182
- M.push(Pe(F, { command: S, ...w, icon: P(e(_n, {})), key: "contextBefore:" + M.length }));
3183
- }
3184
- if (y?.getComments()) M.push(Pe(ct, { ...v, popupCommandKeys: ["deleteComments"], key: "contextBefore:action" + M.length, quickCommand: "updateComments", icon: (S) => S.key() === "updateComments" ? P(e(Un, {})) : null }));
3185
- else {
3186
- const S = t.getCommand("updateComments");
3187
- M.push(Pe(F, { command: S, ...w, icon: P(e(Un, {})), key: "contextBefore:" + M.length }));
3188
- }
3189
- B ? M.push(Pe(ct, { ...v, variant: ie.Menuitem, key: "contextBefore:" + M.length, popupCommandKeys: ["convertTableToRange", "deleteTable"], popupScope: "table", scope: "context", commandState: B, quickCommand: "editTable", icon: (S) => (S.key(), P(e(an, {}))) })) : M.push(Pe(F, { command: t.getCommand("insertTable"), ...w, icon: P(e(an, {})), key: "context:" + C.length })), M.push(Pe(Hi, { ...v, key: "contextBefore:" + M.length }));
3190
- }
3191
- const R = z(se, { children: [e(F, { command: t.getCommand("cut"), ...w, icon: e(xd, {}) }), e(br, { command: t.getCommand("copy"), ...w }), e(Ai, { command: t.getCommand("paste"), ...v, includePasteAllInPopup: !1 }), e(re, { orientation: "horizontal" }), e(Ni, { ...v }), e(re, { orientation: "horizontal" }), e(Mi, { commands: t, ...v, disableSheet: !0 }), e(Ii, { commands: t, ...v, disableSheet: !0 }), e(Ri, { ...v }), M, C] });
3192
- return e(A, { ref: i, className: Ae("menu", m), sx: { ...l }, ...a, children: R });
3193
- }));
3194
- xl.displayName = "WorkbookContextMenu";
3195
- const yl = K(J((r, i) => {
3196
- const { movable: o, commands: t, disabled: n, sx: l, floatReference: c, ...m } = r;
3197
- _e(o, { onAnyChange(g) {
3198
- } });
3199
- const a = j(() => ({}), []), s = j(() => ({ commandHook: { beforeExecute: (g, y) => c.closeAll(), onExecute() {
3200
- }, onError() {
3201
- console.log("onError");
3202
- } }, disabled: n, parentFloat: c }), [n, c]), u = j(() => ({ variant: ie.Menuitem, ...a, ...s }), [a, s]), d = j(() => ({ commands: t, variant: ie.Menuitem, parentFloat: c, ...s }), [t, s, c]), f = (g) => {
3203
- switch (g?.key()) {
3204
- case "moveToFront":
3205
- return P(e(Rd, {}));
3206
- case "moveForward":
3207
- return P(e(Pd, {}));
3208
- case "moveToBack":
3209
- return P(e(Dd, {}));
3210
- case "moveBackward":
3211
- return P(e(Ed, {}));
3212
- case "toggleLockAspectRatio":
3213
- return P(e(aa, {}));
3214
- case "formatDrawAlignLeft":
3215
- return P(e(ia, {}));
3216
- case "formatDrawAlignCenter":
3217
- return P(e(Td, {}));
3218
- case "formatDrawAlignRight":
3219
- return P(e(kd, {}));
3220
- case "formatDrawAlignTop":
3221
- return P(e(Cd, {}));
3222
- case "formatDrawAlignMiddle":
3223
- return P(e(vd, {}));
3224
- case "formatDrawAlignBottom":
3225
- return P(e(Sd, {}));
3226
- case "formatDrawDistributeHorz":
3227
- return P(e(wd, {}));
3228
- case "formatDrawDistributeVert":
3229
- return P(e(yd, {}));
3230
- case "formatAnchorTypeTwoCell":
3231
- case "formatAnchorTypeOneCell":
3232
- case "formatAnchorTypeAbsolute":
3233
- return P(e(la, {}));
3234
- default:
3235
- return null;
3236
- }
3237
- }, p = z(se, { children: [e(br, { command: t.getCommand("copy"), ...u, variant: ie.Menuitem }), [], e(re, { orientation: "horizontal" }), e(ct, { ...d, popupCommandKeys: ["moveToFront", "moveForward"], quickCommand: "moveToFront", icon: f }), e(ct, { ...d, popupCommandKeys: ["moveToBack", "moveBackward"], quickCommand: "moveToBack", icon: f }), e(re, { orientation: "horizontal" }), e(F, { ...u, command: t.getCommand("toggleLockAspectRatio"), icon: P(e(aa, {})) }), e(re, { orientation: "horizontal" }), e(ct, { ...d, popupCommandKeys: ["formatDrawAlignLeft", "formatDrawAlignCenter", "formatDrawAlignRight", null, "formatDrawAlignTop", "formatDrawAlignMiddle", "formatDrawAlignBottom", null, "formatDrawDistributeHorz", "formatDrawDistributeVert"], label: "Align", icon: (g) => f(g) || P(e(ia, {})), tooltip: "Quickly change the placement of your drawings." }), e(re, { orientation: "horizontal" }), e(ct, { ...d, popupCommandKeys: ["formatAnchorTypeTwoCell", "formatAnchorTypeOneCell", "formatAnchorTypeAbsolute"], label: "Sizing", icon: (g) => f(g) || P(e(la, {})), tooltip: "Determine how the drawing size will adjust as the cell sizes adjust." }), []] });
3238
- return e(A, { ref: i, sx: { paddingTop: "4px", paddingBottom: "4px", ...l }, ...m, children: p });
3239
- }));
3240
- yl.displayName = "MovableContextMenu";
3241
- const Ou = (r) => e(yl, { ...r }), Au = (r) => e(xl, { ...r }), Bu = (r) => e(Yi, { ...r }), Lu = (r, i) => e(Ki, { ref: i, ...r }), Hu = (r) => e(Lt, { ...r }), zu = (r, i) => e(dp, { ref: i, ...r }), Wu = (r) => e(Vi, { ...r }), ju = (r) => e(bl, { ...r }), Vu = { fireOnModelChange: !1 }, On = { flex: "1 1 100%", display: "flex" }, wl = K(J((r, i) => {
3242
- const { workbook: o, createWorkbookOptions: t, onNewWorkbook: n, onElementLoad: l, notifier: c, autoFocus: m = !1, sx: a, style: s, className: u, onFocus: d, onBlur: f, onKeyDown: p, onRepeatCommandChange: g, commands: y, showFormulaBar: x, formulaBarProps: b, renderFormulaBar: h = Lu, showTabs: w, tabsProps: v, renderTabs: C = ju, showStatusBar: k, statusBarProps: T, renderStatusBar: M = Wu, toolbarProps: N, renderToolbar: B = hl, contextMenuSx: R, renderContextMenu: S = Au, renderFilterMenu: I = Bu, renderMovableMenu: L = Ou, renderLoadingPanel: O = Hu, loadingPanelProps: $, sheetProps: D, renderSheet: E = zu, showHorizontalScrollbar: Y, showVerticalScrollbar: Z, gridTheme: X, headersTheme: _, enableDarkImages: ne, ...ae } = r, q = at(), W = hr(), Q = j(() => {
3243
- const V = { theme: W.getDefaultTheme(), ...t };
3244
- return o ?? new jn(V);
3245
- }, [o]), ue = we(null), [Le, Fe] = U(!1), Be = we(null), Ye = j(() => e(A, { className: "sheetxl-viewport", sx: { width: "100%", height: "100%", boxSizing: "border-box", position: "absolute", pointerEvents: "none !important", "& > :first-of-type": { position: "relative" } }, ref: Be }), []), [ve, je] = U(!1), [H, oe] = U(!1), Te = G(() => {
3246
- je(!0);
3247
- }, []), ge = we(null), fe = zt(i, () => ({ isWorkbookElement: () => !0, getWorkbook: () => Q, getSheetElement: () => ue.current, getViewportElement: () => Be.current, getFormulaBarElement: () => ge.current, focus() {
3248
- ue && ue.current && ue.current.focus();
3249
- } }), [Q]), te = we(null);
3250
- St(() => {
3251
- ve && fe.current && (oe(!0), te.current !== l && (l?.({ source: fe.current }), te.current = l));
3252
- }, [ve, fe.current]), Ha(fe.current);
3253
- const ce = G((V) => (ue.current?.submitEdit(), !0), []), Me = G(() => {
3254
- requestAnimationFrame(() => {
3255
- ue?.current?.focus();
3256
- });
3257
- }, []), [xe, qe] = U(Q?.getSelectedSheet()), [et, no] = U(Q?.getProtection());
3258
- _e(Q, { onSheetsChange: (V) => {
3259
- qe(V?.getSelectedSheet());
3260
- }, onViewChange(V) {
3261
- qe(V?.getSelectedSheet());
3262
- }, onProtectionChange: (V) => {
3263
- no(V?.getProtection());
3264
- } }), _e(Q, { onRequestSelect: async (V, de) => new Promise((Ee) => {
3265
- ue.current.getSheet() !== de ? ue.current.getGridElement()?.onViewChangeOnce(() => {
3266
- ue.current.getSheet() !== de && Ee(!1), Ee(!0);
3267
- }) : Ee(!0);
3268
- }) }, Vu);
3269
- const [fn, vr] = rr((V) => V + 1, 0), jt = Q?.getView();
3270
- _e(jt, { onViewChange: (V) => {
3271
- vr();
3272
- } });
3273
- const ro = X ?? q, Ke = j(() => Va(q, ro), [q, ro]), Cr = _ ?? q, zl = j(() => Va(q, Cr), [q, Cr]), [kr, Wl] = U(null);
3274
- G(() => {
3275
- ue.current.focus();
3276
- }, []);
3277
- const [bn, Tr] = U(!1), Er = we(null), Ie = Du({ workbook: Q, workbookElement: fe.current, target: () => ue.current, notifier: c, commands: y, darkMode: Ke.body.darkMode, onNewWorkbook: n, onShowSidebar: () => {
3278
- bn ? Er.current?.focus() : Tr(!0);
3279
- } }), xn = we(null), [Dr, Pr] = U(!1), [jl, Rr] = U(null), [Vl, $l] = U(co.Top), [Bo, _l] = U(hs.EmptyBounds), yn = () => {
3280
- Pr(!1), Rr(null);
3281
- }, ao = (V, de, Ee = co.Top) => {
3282
- _l(V), $l(Ee), Rr(de), xn.current !== null && xn.current.update(), Pr(!0);
3283
- }, [km, Mr] = U("sheet"), Ct = w ?? jt?.isShowTabs(), kt = Y ?? jt?.isShowHorizontalScrollbar(), Ul = x ?? jt?.isShowFormulaBar(), Lo = k ?? jt?.isShowStatusBar(), Ir = Z ?? jt?.isShowVerticalScrollbar(), Vt = Ke?.header?.edgeStrokeFill || "rgb(171,171,171)", Gl = j(() => Lo ? M({ sheet: xe, gridStyle: Ke, ...T }) : null, [M, T, Lo, Ke, xe]), ql = j(() => B({ commands: Ie, workbook: fe.current, ...N }), [Ie, B, N, q]), [Xl, { width: Nr }] = Io(), Xe = Nr === 0 || Nr > 560, wn = j(() => {
3284
- if (!Ct) return null;
3285
- let V = C({ background: Ke.body.fill, borderWidth: 1, borderColor: Vt, gridTheme: ro, gridStyle: Ke, onBeforeUserChange: ce, onUserChange: Me, workbook: Q, commands: Ie, sheetTabProps: {}, notifier: c, ...v });
3286
- return Xe || (V = e("div", { style: { flex: "none", display: "flex" }, children: V })), V;
3287
- }, [C, v, c, q, Q, ro, Xe, Ie, Ct]), Fr = G((V) => {
3288
- const de = Ze.getOS() === Ze.OSType.Firefox;
3289
- let Ee = null, Ue = null, Ve = null;
3290
- if (kt && (Ue = e("div", { style: { display: "flex", flex: "1 1 100%", borderTop: `solid ${Vt} 1px`, maxWidth: "100%" }, children: e(ga, { style: { alignItems: "center", borderTop: (de ? 6 : 3) + "px solid transparent", borderBottom: (Xe ? 6 : 3) + "px solid transparent", borderLeft: (de ? 3 : 0) + "px solid transparent", borderRight: (de ? 3 : 0) + "px solid transparent" }, ...V, endGap: 700, sheet: xe, showCustomScrollButtons: !de, onShowTooltip: ($e) => {
3291
- ao({ x: $e.anchor.x, y: $e.anchor.y, width: 0, height: 0 }, $e.display, $e.placement);
3292
- }, onCloseTooltip: () => yn() }) })), Ct && Xe && (Ve = wn), Ct && Xe && !kt && (Ve = z(A, { sx: { display: "flex", flex: "1", position: "relative", alignContent: "center" }, children: [Ve, e(A, { sx: { borderTop: `solid ${Vt} 1px`, flex: "1" } })] })), Ve && kt) Ee = e(qn, { position: Q.getView().getTabRatio() / 10 + "%", onPositionChange: ({ percent: $e }) => {
3293
- Q.getView().setTabRatio(Math.round(10 * $e));
3294
- }, minBefore: "200px", minAfter: "180px", resizerProps: { style: { minWidth: "11px", backgroundImage: `url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${q.palette.text.icon ?? q.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center", borderTop: `solid ${Vt} 1px`, borderBottom: "solid 3px transparent" } }, elementBefore: Ve, elementAfter: Ue });
3295
- else if (kt) Ee = Ue;
3296
- else {
3297
- if (!Ve) return e(A, { sx: { display: "flex", flex: "1", position: "relative", alignContent: "center", height: "1px", borderTop: Lo ? null : `solid ${Vt} 1px` } });
3298
- Ee = Ve;
3299
- }
3300
- return e(A, { sx: { display: "flex", flex: "1", position: "relative", alignContent: "center" }, children: Ee });
3301
- }, [xe, ce, Q, Ke, ro, Ie, Ct, kt, Lo, Xe]), [tt, io] = le.useState(null), Kl = j(() => ({ placement: "right-start", ...tt?.popperProps }), [tt?.popperProps]), { reference: Or, component: Yl } = oo({ label: "contextMenu", popperProps: Kl, anchor: tt?.anchor ?? { getBoundingClientRect: () => new DOMRect(tt?.clientX || 0, tt?.clientY || 0) }, onClose: () => io(null), createPopupPanel: tt?.createPopupPanel });
3302
- me(() => {
3303
- tt ? Or.open(0) : Or.close(0);
3304
- }, [tt]);
3305
- const Zl = ee((V, de) => {
3306
- if (V?.isDefaultPrevented()) return !0;
3307
- V.preventDefault(), tt && tt.anchor === V.currentTarget ? io(null) : io({ anchor: V.currentTarget, popperProps: { offsets: [-4, 2] }, createPopupPanel: (Ee) => {
3308
- const { floatReference: Ue } = Ee;
3309
- return I({ filter: de, commands: Ie, floatReference: Ue, sx: { ...R } });
3310
- } });
3311
- }, [I, R, Ie, Q, tt]), Ar = ee((V) => {
3312
- if (V.originalEvent?.isDefaultPrevented()) return !0;
3313
- V.originalEvent?.preventDefault(), io({ clientX: V.clientX, clientY: V.clientY, createPopupPanel: (de) => {
3314
- const { floatReference: Ee } = de;
3315
- return S({ commands: Ie, workbook: Q, floatReference: Ee, sx: { ...R } });
3316
- } });
3317
- }, [S, R, Ie, Q]), Jl = ee((V, de) => {
3318
- if (V?.isDefaultPrevented()) return !0;
3319
- V.preventDefault(), io({ clientX: V.clientX, clientY: V.clientY, createPopupPanel: (Ee) => {
3320
- const { floatReference: Ue } = Ee;
3321
- return L({ movable: de, commands: Ie, floatReference: Ue, sx: { ...R } });
3322
- } });
3323
- }, [L, R, Ie]);
3324
- j(() => {
3325
- const V = [new Ge("openContextMenu", () => ue.current, { label: "Context Menu", description: "Open the context menu.", shortcut: [{ key: "F10", modifiers: [ke.Shift] }, { key: "ContextMenu" }] })];
3326
- Ie.addCommands(V, !0);
3327
- }, [Ie]), me(() => {
3328
- Ie.getCommand("openContextMenu").updateCallback(() => {
3329
- const V = xe.getSelection().getCoords().cell;
3330
- ue.current?.getGridElement()?.scrollCellCoordsIntoView(V).then((de) => {
3331
- requestAnimationFrame(() => {
3332
- const Ee = xe.getView().getZoomScale() / 100, Ue = xe.getColumnHeaders().findOffset(V.colIndex + 1) * Ee, Ve = xe.getRowHeaders().findOffset(V.rowIndex + 1) * Ee, $e = ue.current?.getGridElement()?.getRelativePointFromClient(0, 0) || { x: 0, y: 0 };
3333
- Ar({ clientX: Ue - $e.x - de.left + 6, clientY: Ve - $e.y - de.top + 6 });
3334
- });
3335
- });
3336
- });
3337
- }, [xe]);
3338
- const Ql = ee((V) => {
3339
- Ie?.dispatchToFocusedCommand(V);
3340
- }, [Ie]), es = ee(() => {
3341
- Ha(fe.current);
3342
- }, [Q, fe.current]), ts = G(() => {
3343
- Mr("sheet");
3344
- }, []), os = G(() => {
3345
- Mr("formulaBar");
3346
- }, []), ns = ee((V) => {
3347
- const de = Ze.getOS() === Ze.OSType.Firefox;
3348
- return e(ga, { style: { borderLeft: "3px solid transparent", borderRight: "0px solid transparent", borderTop: (de ? 3 : 0) + "px solid transparent", borderBottom: (de ? 3 : 0) + "px solid transparent", width: de ? "13px" : void 0 }, ...V, sheet: xe, endGap: 700, showCustomScrollButtons: !de, onShowTooltip: (Ee) => {
3349
- ao(Ee.anchor, Ee.display, co.Left);
3350
- }, onCloseTooltip: () => yn() });
3351
- }, [xe]);
3352
- me(() => {
3353
- m && ue && ue.current && ue.current.focus();
3354
- }, []);
3355
- const [Ho, Sn] = le.useState(null), vn = G((V) => {
3356
- Ie?.getCommand("openWorkbook") && (V.type === "dragenter" || V.type === "dragover" ? V.dataTransfer?.types.includes("Files") ? V.dataTransfer.files[0]?.type?.startsWith("image/") || V.dataTransfer.items[0]?.type?.startsWith("image/") || V.dataTransfer.types.length === 1 && Sn("Drop to open") : (V.dataTransfer?.types.includes("text/html") || V.dataTransfer?.types.includes("text/plain"), V.dataTransfer.effectAllowed = "none", V.dataTransfer.dropEffect = "none") : V.type === "dragleave" && Sn(null), V.preventDefault());
3357
- }, [Ie]), rs = ee((V) => {
3358
- if (Ie?.getCommand("openWorkbook") && (V.preventDefault(), V.stopPropagation(), Sn(null), V.dataTransfer.files && V.dataTransfer.files.length > 0)) {
3359
- const de = V.dataTransfer.files[0];
3360
- if (!de) return;
3361
- if (de?.type?.startsWith("image/")) {
3362
- const Ee = ue.current?.getGridElement().getViewFromClient(V.clientX, V.clientY);
3363
- if (!Ee) return;
3364
- const Ue = Ee.getRelativePointFromClient(V.clientX, V.clientY), Ve = Ee.toAbsoluteBounds({ ...Ue, width: 0, height: 0 }), $e = Ee.getCellCoordsFromClient(V.clientX, V.clientY);
3365
- if (!$e) return;
3366
- Ie?.getCommand("insertImageFromFile")?.execute({ file: de, options: { bounds: { x: Ve.x, y: Ve.y } }, goto: { range: { ...$e } } });
3367
- } else Ie?.getCommand("openWorkbook")?.execute(de);
3368
- }
3369
- }, [Ie, Ho]), as = j(() => Ho ? e(A, { sx: { position: "absolute", width: "100%", height: "100%", boxSizing: "border-box", pointerEvents: "none", display: "flex", justifyContent: "center", alignItems: "center", background: (V) => V.palette.divider, color: (V) => V.palette.primary.dark }, children: e(Oe, { variant: "h4", children: Ho }) }) : null, [Ho]), Br = we(null), is = j(() => e(Jn, { in: !H, nodeRef: Br, timeout: 500, classNames: "animating", unmountOnExit: !0, children: e(A, { style: { display: "flex", alignItems: "center", justifyContent: "center", left: "0px", top: "0px", width: "100%", height: "100%", pointerEvents: H ? "none" : a?.pointerEvents, position: "absolute", boxSizing: "border-box" }, children: O({ ref: Br, transitionDelay: "0", transparentBackground: !1, sx: { opacity: H ? 0 : a?.opacity, pointerEvents: H ? "none" : a?.pointerEvents, position: "absolute", left: "0px", top: "0px", width: "100%", height: "100%", ...$ } }) }) }), [H, O, $]), ls = j(() => h({ sx: { marginTop: (V) => V.spacing(0.25), marginLeft: (V) => V.spacing(1), marginRight: (V) => V.spacing(1) }, workbook: Q, sheetElement: ue.current, gridStyle: Ke, onFocus: os, ...b, NamedCollectionEditorProps: { restoreFocus: (V) => ue.current.focus(V), notifier: c, ...b?.NamedCollectionEditorProps, commandPopupButtonProps: { commands: Ie, ...b?.NamedCollectionEditorProps?.commandPopupButtonProps } } }, ge), [h, b, Q, Ke, Ie, H]), ss = G((V) => {
3370
- const { movable: de, ...Ee } = V, Ue = { movable: de, onContextMenuCapture: (Tt) => {
3371
- Jl(Tt, de);
3372
- }, ...Ee }, Ve = de.getContent().getType();
3373
- let $e = null;
3374
- if (Ve === "picture") return e(pp, { loadingPanel: e(Lt, { transitionDelay: "100", style: { position: "absolute" }, sx: { border: (Tt) => `solid 1px ${Tt.palette.action.active}` } }), picture: de.getContent(), description: de.getDescription() ?? de?.getName(), ...Ue });
3375
- if (Ve === "chart") {
3376
- const Tt = { ...Ue, chart: de.getContent() };
3377
- return e(up, { ...Tt });
3378
- }
3379
- if ($e = `Float of type '${Ve}'.`, typeof $e == "string") {
3380
- const Tt = { ...Ue, description: $e };
3381
- $e = e(mp, { ...Tt });
3382
- }
3383
- return e("div", { style: { position: "absolute", clipPath: "inset(0px)", display: "flex", alignItems: "stretch", justifyContent: "stretch", pointerEvents: "all" }, children: $e }, de.getUUID());
3384
- }, []), Lr = j(() => E({ style: On, onFocus: ts, notifier: c, gridStyle: Ke, headersStyle: zl, sheet: xe, commands: Ie, onSheetContextMenu: Ar, onViewportChange: (V) => {
3385
- Wl(V);
3386
- }, showScrollbars: !1, viewportComponent: Ye, onRepeatCommandChange: g, onElementLoad: Te, onShowColumnTooltip: (V) => {
3387
- ao(V.anchor, V.display, co.Top);
3388
- }, onShowRowTooltip: (V) => {
3389
- ao(V.anchor, V.display, co.Right);
3390
- }, onShowTooltip: (V) => {
3391
- ao({ x: V.anchor.x, y: V.anchor.y, width: 0, height: 0 }, V.display, V.placement);
3392
- }, onCloseTooltip: () => yn(), renderMovable: ss, ...D, cellRenderProps: { onFilterButtonMouseDown: (V, de) => {
3393
- D?.cellRenderProps?.onFilterButtonMouseDown(V, de), Zl(V, de);
3394
- }, ...D?.cellRenderProps } }, ue), [E, Ie, D, xe, Ke, c, g]), Cn = j(() => {
3395
- if (!bn) return null;
3396
- const V = !et.isStructureAllowed();
3397
- return e(dl, { sx: { marginBottom: (de) => de.spacing(0.5), border: (de) => `solid ${V ? de.palette.action.disabled : he(de.palette.divider, 0.2)} 1px`, borderRadius: (de) => `${de.shape.borderRadius}px`, overflow: "hidden" }, onClose: () => {
3398
- Tr(!1), requestAnimationFrame(() => {
3399
- ue.current.focus();
3400
- });
3401
- }, readOnly: V, commands: Ie, ref: Er, scripts: Q.getScripts() });
3402
- }, [bn, Ie, Q, c, et]), cs = j(() => {
3403
- const V = e(op, { style: { ...On, marginRight: Cn && Xe ? "0px" : "6px" }, viewport: kr, touchElement: ue.current?.getGridElement()?.stage, onScrollViewport: ($e) => {
3404
- ue.current?.getGridElement()?.scrollTo($e);
3405
- }, showHorizontalScrollbar: kt || Ct, showVerticalScrollbar: Ir, createHorizontalScrollbar: Fr, createVerticalScrollbar: ns, children: Lr });
3406
- let de = V;
3407
- Xe || (de = z(se, { children: [V, wn] }));
3408
- let Ee = null, Ue = 4, Ve = 13;
3409
- return Xe ? Ee = "m 3.6261898,11.36243 c 0,0.88365 -0.71627,1.59991 -1.59991,1.59991 -0.8836498,0 -1.60004965,-0.71626 -1.60004965,-1.59991 0,-0.88365 0.71639985,-1.6000508 1.60004965,-1.6000508 0.88364,0 1.59991,0.7164008 1.59991,1.6000508 m 0,-4.881294 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 -0.8836498,0 -1.60004965,-0.7164 -1.60004965,-1.60004 0,-0.88365 0.71639985,-1.60005 1.60004965,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-4.881226 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 1.14263,3.19996 0.42623015,2.48356 0.42623015,1.59991 0.42623015,0.71626 1.14263,0 2.0262798,0 c 0.88364,0 1.59991,0.71626 1.59991,1.59991" : (Ee = "M 1.59991,3.62619 C 0.71626,3.62619 0,2.90992 0,2.02628 0,1.1426301 0.71626,0.42623015 1.59991,0.42623015 c 0.88365,0 1.6000508,0.71639995 1.6000508,1.60004985 0,0.88364 -0.7164008,1.59991 -1.6000508,1.59991 m 4.881294,0 c -0.88364,0 -1.60004,-0.71627 -1.60004,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60004,-1.60004985 0.88365,0 1.60005,0.71639995 1.60005,1.60004985 0,0.88364 -0.7164,1.59991 -1.60005,1.59991 m 4.881226,0 c -0.88365,0 -1.60005,-0.71627 -1.60005,-1.59991 0,-0.8836499 0.7164,-1.60004985 1.60005,-1.60004985 0.88365,0 1.59991,0.71639995 1.59991,1.60004985 0,0.88364 -0.71626,1.59991 -1.59991,1.59991", Ue = 13, Ve = 4), e(qn, { fixedPane: "after", position: "40%", minAfter: Xe ? "280px" : "120px", splitDirection: Xe ? "row" : "column", style: On, ref: Xl, resizerProps: { className: "styled-resizer", style: { minWidth: Xe ? "6px" : void 0, minHeight: Xe ? void 0 : "6px", maskImage: `url("data:image/svg+xml,%3Csvg width='${Ue}' height='${Ve}' viewBox='0 0 ${Ue} ${Ve}' version='1.1' fill='${q.palette.text.icon ?? q.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${Ee}' /%3E%3C/svg%3E%0A")`, maskRepeat: "no-repeat", maskPosition: Xe ? "left center" : "top center" } }, elementBefore: de, paneBeforeProps: { style: { flexDirection: "column" } }, elementAfter: Cn, paneAfterProps: { style: { marginLeft: Xe ? "0px" : "4px", marginRight: Xe ? "8px" : "4px" } } });
3410
- }, [kt, Ct, Fr, Ir, kr, Cn, Lr, wn, q, Xe]), ds = j(() => ({ boxSizing: "border-box", background: (V) => V.palette.mode !== "dark" ? Ke.header.fill : V.palette.background.paper, "& *": { ...Md(q), fontWeight: 400 }, "&.Mui-focusVisible": {}, "& .viewport-overlay": { borderRight: `solid ${Vt} 1px` }, ...a }), [a, Ke]);
3411
- return z(Po, { className: Ae("sheetxl-workbook", Mu, { "Mui-focusVisible": Le }, Ru, u), sx: ds, style: s, square: !1, ...ae, ref: fe, onFocus: (V) => {
3412
- Fe(!0), es(), d?.(V);
3413
- }, onBlur: (V) => {
3414
- Fe(!1), f?.(V);
3415
- }, onKeyDown: (V) => {
3416
- Ql(V), p?.(V);
3417
- }, onDragStart: (V) => {
3418
- if (V.target.src) {
3419
- const de = new Image();
3420
- de.src = V.target.src, V.dataTransfer.setDragImage(de, 1, 1);
3421
- }
3422
- }, onDragEnter: vn, onDragLeave: vn, onDragOver: vn, onDrop: rs, children: [z("div", { className: Ae(Li), style: { flex: "1 1 100%", width: "100%", display: "flex", flexDirection: "column", opacity: H ? void 0 : 0, "--sxl-app-color-high-contrast": q.palette.primary.main, "--sxl-app-color-primary": q.palette.primary.main, "--sxl-app-color-primary-dark": q.palette.primary.dark, "--sxl-app-color-primary-light": q.palette.primary.light, "--sxl-app-color-info": q.palette.info.main, "--sxl-app-color-info-dark": q.palette.info.dark, "--sxl-app-color-info-light": q.palette.info.light, "--sxl-app-color-secondary": q.palette.secondary.main, "--sxl-app-color-secondary-dark": q.palette.secondary.dark, "--sxl-app-color-secondary-light": q.palette.secondary.light, "--sxl-app-color-success": q.palette.success.main, "--sxl-app-color-success-dark": q.palette.success.dark, "--sxl-app-color-success-light": q.palette.success.light, "--sxl-app-color-warning": q.palette.warning.main, "--sxl-app-color-warning-dark": q.palette.warning.dark, "--sxl-app-color-warning-light": q.palette.warning.light, "--sxl-app-color-error": q.palette.error.main, "--sxl-app-color-error-dark": q.palette.error.dark, "--sxl-app-color-error-light": q.palette.error.light, "--sxl-app-color-text": q.palette.text.primary, "--sxl-app-color-text-secondary": q.palette.text.secondary, "--sxl-app-color-text-disabled": q.palette.text.disabled, "--sxl-app-color-background": q.palette.background.paper, "--sxl-app-color-button-surface": q.palette.grey[600], "--sxl-app-color-shadow": q.palette.action.focus, "--sxl-app-color-grey": q.palette.grey[500], "--sxl-app-filter-dark-invert": Ke.body.darkMode && ne ? "hue-rotate(180deg) invert(1) brightness(95%)" : "none", "--sxl-app-image-background": Ke.body.darkMode ? `linear-gradient(${he("#fff", De(5))}, ${he("#fff", De(5))})` : void 0 }, children: [ql, Ul ? ls : null, e(A, { sx: { marginBottom: (V) => V.spacing(0.75) } }), cs, Gl, e(At, { arrow: !0, disableInteractive: !0, open: Dr, title: e(Oe, { variant: "subtitle2", component: "div", children: jl }), placement: Vl, TransitionProps: { timeout: { exit: 0 } }, PopperProps: { popperRef: xn, sx: { "& .MuiTooltip-tooltip": { padding: "2px 6px", "& .MuiTooltip-arrow": { display: Dr ? "visible" : "none" } } }, anchorEl: { getBoundingClientRect: () => new DOMRect(Bo.x, Bo.y, Bo.width, Bo.height) }, modifiers: [{ name: "offset", options: { offset: [0, 0] } }] }, children: e(A, {}) }), Yl, as] }), is] });
3423
- }));
3424
- wl.displayName = "WorkbookElement";
3425
- const $u = (r = !1, i = !1) => i ? null : { "& input:not(:focus):not(:hover)": { color: (o) => o.palette.text.secondary }, backgroundColor: (o) => he(o.palette.background.paper, 0.6), borderRadius: (o) => `${o.shape.borderRadius}px`, border: (o) => `solid ${r ? o.palette.divider : "transparent"} 1px`, "&.Mui-disabled": { border: (o) => `solid ${r ? o.palette.divider : "transparent"} 1px` }, "&:focus-within:not([disabled])": { backgroundColor: (o) => o.palette.background.paper }, "&:hover:not([disabled])": { border: (o) => `solid ${r ? o.palette.text?.primary : o.palette.divider} 1px`, backgroundColor: null }, "&.Mui-focusVisible": { outline: (o) => `solid ${o.palette.primary.main} 1px !important`, border: (o) => `1px solid ${o.palette?.primary?.main} !important` } }, Sl = K(J((r, i) => {
3426
- const { sx: o, workbook: t, title: n = "", placeHolder: l = "Untitled", onTitleChange: c, readOnly: m = !1, hidden: a, ...s } = r, [u, d] = U(!1), [f, p] = U(!1), [g, y] = U(n ?? ""), [x, b] = U(""), [h, { width: w }] = Io(), [v, { width: C }] = Io(), [k, T] = U(!1), M = we(null), N = we(null), B = zt(i, () => ({ requestWorkbookTitle: (R = null, S) => {
3427
- N.current = { onAccept: R, requestReason: S?.requestReason }, S?.selectAll && M.current?.select(), M.current?.focus(S);
3428
- }, focus: (R) => {
3429
- M.current?.focus(R);
3430
- } }), []);
3431
- return St(() => {
3432
- T(n !== g), b(n), y(n);
3433
- }, [n]), me(() => {
3434
- k && w !== 0 && Jt.debounce(() => {
3435
- T(!1);
3436
- }, 300)();
3437
- }, [k, w]), me(() => {
3438
- p(g && !Yt.isValidWindowsFilename(g));
3439
- }, [g]), a ? null : e(A, { sx: { display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", opacity: k ? "0" : "1", transition: k ? void 0 : "opacity .25s ease-in", "& .tooltip-wrapper": { maxWidth: "100%" } }, ref: Fo([B, v, i]), ...s, children: e(rt, { label: N.current?.requestReason ?? "Workbook Name", children: z(A, { className: Ae({ "Mui-focusVisible": u }), sx: { visibility: w === 0 ? "hidden" : "visible", display: "block", maxWidth: "100%", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", paddingLeft: "12px", paddingRight: "12px", marginLeft: "2px", marginRight: "2px", paddingTop: "2px", paddingBottom: "1px", ...$u(!0, m), ...o }, children: [m ? e(Oe, { variant: "subtitle1", component: "div", sx: { whiteSpace: "nowrap", fontStyle: g !== x ? "italic" : void 0, userSelect: "none", textOverflow: "ellipsis", lineHeight: "1.4375em", border: "transparent 1px solid", color: (R) => f ? R.palette.error.dark : void 0 }, children: n ?? l }) : e(ir, { sx: { width: `${Math.min(w + 3, Math.max(C, B.current?.getBoundingClientRect()?.width))}px`, overflow: "hidden", whiteSpace: "nowrap", fontWeight: "600", maxWidth: "100%", border: "none", padding: "0px", margin: "0px", color: (R) => f ? R.palette.error.dark : void 0, fontStyle: g !== x ? "italic" : void 0, "& input": { paddingTop: "0px", paddingBottom: "0px", textOverflow: "ellipsis" } }, disableUnderline: !0, fullWidth: !1, multiline: !1, readOnly: m, spellCheck: !1, placeholder: l, onFocus: (R) => {
3440
- d(!0), R.target?.select();
3441
- }, inputProps: { name: "input-workbook-title", autoComplete: "off", ref: M }, onBlur: () => {
3442
- d(!1), f ? y(x) : (g !== x && (c?.(g), g && N.current?.onAccept?.(g, "blur")), N.current = null);
3443
- }, onChange: (R) => {
3444
- if (R.target.value.length > Yt.MAX_WORKBOOK_NAME_SIZE) return R.stopPropagation(), void R.preventDefault();
3445
- y(R.target.value);
3446
- }, onKeyDown: (R) => {
3447
- (Yt.WINDOW_FILENAME_CHAR_RESERVED_REGEX.test(R.key) || R.target?.value.length > Yt.MAX_WORKBOOK_NAME_SIZE) && R.preventDefault(), R.which === be.Enter || R.which === be.Tab ? (f ? y(x) : (c?.(g), g && (N.current?.onAccept?.(g, "keydown"), N.current = null)), R.stopPropagation(), R.preventDefault(), t?.focus()) : R.which === be.Escape && (g === x ? t?.focus() : (y(x), setTimeout(() => {
3448
- R.target?.select();
3449
- }, 0)), N.current = null, R.stopPropagation(), R.preventDefault());
3450
- }, value: g }), e(A, { ref: h, sx: { position: "absolute", visibility: "hidden", top: "-9999px", fontWeight: "600 !important", whiteSpace: "pre", fontStyle: g !== x ? "italic" : void 0, fontFamily: (R) => R.typography.fontFamily, letterSpacing: "0.00938em" }, children: g || l })] }) }) });
3451
- }));
3452
- Sl.displayName = "WorkbookTitle";
3453
- const _u = K(J((r, i) => {
3454
- const { sx: o, style: t, className: n, licenseKey: l, renderLoadingPanel: c, ...m } = r;
3455
- l && vo.setLicenseKey(l);
3456
- const a = j(() => {
3457
- const u = { transitionDelay: "160ms", transparentBackground: !0 };
3458
- return e(A, { sx: o, style: { width: "100%", height: "100%", position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", ...t }, children: c?.(u) ?? e(Lt, { ...u }) });
3459
- }, [o, t, c]), s = j(() => le.lazy(async () => await Promise.resolve().then(() => Cm)), []);
3460
- return e(se, { children: e(ci, { fallback: a, children: e(s, { ...m, className: n, renderLoadingPanel: c, sx: o, style: t, ref: i }) }) });
3461
- }));
3462
- _u.displayName = "Studio";
3463
- const Uu = xs(null), An = { didCatch: !1, error: null };
3464
- class Gu extends di {
3465
- constructor(i) {
3466
- super(i), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = An;
3467
- }
3468
- static getDerivedStateFromError(i) {
3469
- return { didCatch: !0, error: i };
3470
- }
3471
- resetErrorBoundary() {
3472
- const { error: i } = this.state;
3473
- if (i !== null) {
3474
- for (var o, t, n = arguments.length, l = new Array(n), c = 0; c < n; c++) l[c] = arguments[c];
3475
- (o = (t = this.props).onReset) === null || o === void 0 || o.call(t, { args: l, reason: "imperative-api" }), this.setState(An);
3476
- }
3477
- }
3478
- componentDidCatch(i, o) {
3479
- var t, n;
3480
- (t = (n = this.props).onError) === null || t === void 0 || t.call(n, i, o);
3481
- }
3482
- componentDidUpdate(i, o) {
3483
- const { didCatch: t } = this.state, { resetKeys: n } = this.props;
3484
- var l, c;
3485
- t && o.error !== null && function() {
3486
- let m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
3487
- return m.length !== a.length || m.some((s, u) => !Object.is(s, a[u]));
3488
- }(i.resetKeys, n) && ((l = (c = this.props).onReset) === null || l === void 0 || l.call(c, { next: n, prev: i.resetKeys, reason: "keys" }), this.setState(An));
3489
- }
3490
- render() {
3491
- const { children: i, fallbackRender: o, FallbackComponent: t, fallback: n } = this.props, { didCatch: l, error: c } = this.state;
3492
- let m = i;
3493
- if (l) {
3494
- const a = { error: c, resetErrorBoundary: this.resetErrorBoundary };
3495
- if (typeof o == "function") m = o(a);
3496
- else if (t) m = Pe(t, a);
3497
- else {
3498
- if (n === void 0) throw c;
3499
- m = n;
3500
- }
3501
- }
3502
- return Pe(Uu.Provider, { value: { didCatch: l, error: c, resetErrorBoundary: this.resetErrorBoundary } }, m);
3503
- }
3504
- }
3505
- function vl(r) {
3506
- var i, o, t = "";
3507
- if (typeof r == "string" || typeof r == "number") t += r;
3508
- else if (typeof r == "object") if (Array.isArray(r)) for (i = 0; i < r.length; i++) r[i] && (o = vl(r[i])) && (t && (t += " "), t += o);
3509
- else for (i in r) r[i] && (t && (t += " "), t += i);
3510
- return t;
3511
- }
3512
- function Wt() {
3513
- for (var r, i, o = 0, t = ""; o < arguments.length; ) (r = arguments[o++]) && (i = vl(r)) && (t && (t += " "), t += i);
3514
- return t;
3515
- }
3516
- let qu = { data: "" }, Xu = (r) => typeof window == "object" ? ((r ? r.querySelector("#_goober") : window._goober) || Object.assign((r || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : r || qu, Ku = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Yu = /\/\*[^]*?\*\/| +/g, Ya = /\n+/g, Ft = (r, i) => {
3517
- let o = "", t = "", n = "";
3518
- for (let l in r) {
3519
- let c = r[l];
3520
- l[0] == "@" ? l[1] == "i" ? o = l + " " + c + ";" : t += l[1] == "f" ? Ft(c, l) : l + "{" + Ft(c, l[1] == "k" ? "" : i) + "}" : typeof c == "object" ? t += Ft(c, i ? i.replace(/([^,])+/g, (m) => l.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (a) => /&/.test(a) ? a.replace(/&/g, m) : m ? m + " " + a : a)) : l) : c != null && (l = /^--/.test(l) ? l : l.replace(/[A-Z]/g, "-$&").toLowerCase(), n += Ft.p ? Ft.p(l, c) : l + ":" + c + ";");
3521
- }
3522
- return o + (i && n ? i + "{" + n + "}" : n) + t;
3523
- }, ut = {}, Cl = (r) => {
3524
- if (typeof r == "object") {
3525
- let i = "";
3526
- for (let o in r) i += o + Cl(r[o]);
3527
- return i;
3528
- }
3529
- return r;
3530
- }, Zu = (r, i, o, t, n) => {
3531
- let l = Cl(r), c = ut[l] || (ut[l] = ((a) => {
3532
- let s = 0, u = 11;
3533
- for (; s < a.length; ) u = 101 * u + a.charCodeAt(s++) >>> 0;
3534
- return "go" + u;
3535
- })(l));
3536
- if (!ut[c]) {
3537
- let a = l !== r ? r : ((s) => {
3538
- let u, d, f = [{}];
3539
- for (; u = Ku.exec(s.replace(Yu, "")); ) u[4] ? f.shift() : u[3] ? (d = u[3].replace(Ya, " ").trim(), f.unshift(f[0][d] = f[0][d] || {})) : f[0][u[1]] = u[2].replace(Ya, " ").trim();
3540
- return f[0];
3541
- })(r);
3542
- ut[c] = Ft(n ? { ["@keyframes " + c]: a } : a, o ? "" : "." + c);
3543
- }
3544
- let m = o && ut.g ? ut.g : null;
3545
- return o && (ut.g = ut[c]), ((a, s, u, d) => {
3546
- d ? s.data = s.data.replace(d, a) : s.data.indexOf(a) === -1 && (s.data = u ? a + s.data : s.data + a);
3547
- })(ut[c], i, t, m), c;
3548
- };
3549
- function Qn(r) {
3550
- let i = this || {}, o = r.call ? r(i.p) : r;
3551
- return Zu(o.unshift ? o.raw ? ((t, n, l) => t.reduce((c, m, a) => {
3552
- let s = n[a];
3553
- if (s && s.call) {
3554
- let u = s(l), d = u && u.props && u.props.className || /^go/.test(u) && u;
3555
- s = d ? "." + d : u && typeof u == "object" ? u.props ? "" : Ft(u, "") : u === !1 ? "" : u;
3556
- }
3557
- return c + m + (s ?? "");
3558
- }, ""))(o, [].slice.call(arguments, 1), i.p) : o.reduce((t, n) => Object.assign(t, n && n.call ? n(i.p) : n), {}) : o, Xu(i.target), i.g, i.o, i.k);
3559
- }
3560
- function kl(r, i, o) {
3561
- return i && function(t, n) {
3562
- for (var l = 0; l < n.length; l++) {
3563
- var c = n[l];
3564
- c.enumerable = c.enumerable || !1, c.configurable = !0, "value" in c && (c.writable = !0), Object.defineProperty(t, c.key, c);
3565
- }
3566
- }(r.prototype, i), r;
3567
- }
3568
- function Ne() {
3569
- return Ne = Object.assign || function(r) {
3570
- for (var i = 1; i < arguments.length; i++) {
3571
- var o = arguments[i];
3572
- for (var t in o) Object.prototype.hasOwnProperty.call(o, t) && (r[t] = o[t]);
3573
- }
3574
- return r;
3575
- }, Ne.apply(this, arguments);
3576
- }
3577
- function Tl(r, i) {
3578
- r.prototype = Object.create(i.prototype), r.prototype.constructor = r, r.__proto__ = i;
3579
- }
3580
- function Oo(r, i) {
3581
- if (r == null) return {};
3582
- var o, t, n = {}, l = Object.keys(r);
3583
- for (t = 0; t < l.length; t++) o = l[t], i.indexOf(o) >= 0 || (n[o] = r[o]);
3584
- return n;
3585
- }
3586
- function Za(r) {
3587
- if (r === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3588
- return r;
3589
- }
3590
- Qn.bind({ g: 1 }), Qn.bind({ k: 1 });
3591
- var Ja = function() {
3592
- return "";
3593
- }, El = le.createContext({ enqueueSnackbar: Ja, closeSnackbar: Ja }), Bn = "@media (max-width:599.95px)", on = "@media (min-width:600px)", Qa = function(r) {
3594
- return r.charAt(0).toUpperCase() + r.slice(1);
3595
- }, yr = function(r) {
3596
- return "" + Qa(r.vertical) + Qa(r.horizontal);
3597
- }, Xo = function(r) {
3598
- return !!r || r === 0;
3599
- }, Ko = "unmounted", _t = "exited", Ut = "entering", xo = "entered", ei = "exiting", wr = function(r) {
3600
- function i(t) {
3601
- var n;
3602
- n = r.call(this, t) || this;
3603
- var l, c = t.appear;
3604
- return n.appearStatus = null, t.in ? c ? (l = _t, n.appearStatus = Ut) : l = xo : l = t.unmountOnExit || t.mountOnEnter ? Ko : _t, n.state = { status: l }, n.nextCallback = null, n;
3605
- }
3606
- Tl(i, r), i.getDerivedStateFromProps = function(t, n) {
3607
- return t.in && n.status === Ko ? { status: _t } : null;
3608
- };
3609
- var o = i.prototype;
3610
- return o.componentDidMount = function() {
3611
- this.updateStatus(!0, this.appearStatus);
3612
- }, o.componentDidUpdate = function(t) {
3613
- var n = null;
3614
- if (t !== this.props) {
3615
- var l = this.state.status;
3616
- this.props.in ? l !== Ut && l !== xo && (n = Ut) : l !== Ut && l !== xo || (n = ei);
3617
- }
3618
- this.updateStatus(!1, n);
3619
- }, o.componentWillUnmount = function() {
3620
- this.cancelNextCallback();
3621
- }, o.getTimeouts = function() {
3622
- var t = this.props.timeout, n = t, l = t;
3623
- return t != null && typeof t != "number" && typeof t != "string" && (l = t.exit, n = t.enter), { exit: l, enter: n };
3624
- }, o.updateStatus = function(t, n) {
3625
- t === void 0 && (t = !1), n !== null ? (this.cancelNextCallback(), n === Ut ? this.performEnter(t) : this.performExit()) : this.props.unmountOnExit && this.state.status === _t && this.setState({ status: Ko });
3626
- }, o.performEnter = function(t) {
3627
- var n = this, l = this.props.enter, c = t, m = this.getTimeouts();
3628
- t || l ? (this.props.onEnter && this.props.onEnter(this.node, c), this.safeSetState({ status: Ut }, function() {
3629
- n.props.onEntering && n.props.onEntering(n.node, c), n.onTransitionEnd(m.enter, function() {
3630
- n.safeSetState({ status: xo }, function() {
3631
- n.props.onEntered && n.props.onEntered(n.node, c);
3632
- });
3633
- });
3634
- })) : this.safeSetState({ status: xo }, function() {
3635
- n.props.onEntered && n.props.onEntered(n.node, c);
3636
- });
3637
- }, o.performExit = function() {
3638
- var t = this, n = this.props.exit, l = this.getTimeouts();
3639
- n ? (this.props.onExit && this.props.onExit(this.node), this.safeSetState({ status: ei }, function() {
3640
- t.props.onExiting && t.props.onExiting(t.node), t.onTransitionEnd(l.exit, function() {
3641
- t.safeSetState({ status: _t }, function() {
3642
- t.props.onExited && t.props.onExited(t.node);
3643
- });
3644
- });
3645
- })) : this.safeSetState({ status: _t }, function() {
3646
- t.props.onExited && t.props.onExited(t.node);
3647
- });
3648
- }, o.cancelNextCallback = function() {
3649
- this.nextCallback !== null && this.nextCallback.cancel && (this.nextCallback.cancel(), this.nextCallback = null);
3650
- }, o.safeSetState = function(t, n) {
3651
- n = this.setNextCallback(n), this.setState(t, n);
3652
- }, o.setNextCallback = function(t) {
3653
- var n = this, l = !0;
3654
- return this.nextCallback = function() {
3655
- l && (l = !1, n.nextCallback = null, t());
3656
- }, this.nextCallback.cancel = function() {
3657
- l = !1;
3658
- }, this.nextCallback;
3659
- }, o.onTransitionEnd = function(t, n) {
3660
- this.setNextCallback(n);
3661
- var l = t == null && !this.props.addEndListener;
3662
- this.node && !l ? (this.props.addEndListener && this.props.addEndListener(this.node, this.nextCallback), t != null && setTimeout(this.nextCallback, t)) : setTimeout(this.nextCallback, 0);
3663
- }, o.render = function() {
3664
- var t = this.state.status;
3665
- if (t === Ko) return null;
3666
- var n = this.props;
3667
- return (0, n.children)(t, Oo(n, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]));
3668
- }, kl(i, [{ key: "node", get: function() {
3669
- var t, n = (t = this.props.nodeRef) === null || t === void 0 ? void 0 : t.current;
3670
- if (!n) throw new Error("notistack - Custom snackbar is not refForwarding");
3671
- return n;
3672
- } }]), i;
3673
- }(le.Component);
3674
- function Gt() {
3675
- }
3676
- function ti(r, i) {
3677
- typeof r == "function" ? r(i) : r && (r.current = i);
3678
- }
3679
- function er(r, i) {
3680
- return j(function() {
3681
- return r == null && i == null ? null : function(o) {
3682
- ti(r, o), ti(i, o);
3683
- };
3684
- }, [r, i]);
3685
- }
3686
- function ln(r) {
3687
- var i = r.timeout, o = r.style, t = o === void 0 ? {} : o, n = r.mode;
3688
- return { duration: typeof i == "object" ? i[n] || 0 : i, easing: t.transitionTimingFunction, delay: t.transitionDelay };
3689
- }
3690
- wr.defaultProps = { in: !1, mountOnEnter: !1, unmountOnExit: !1, appear: !1, enter: !0, exit: !0, onEnter: Gt, onEntering: Gt, onEntered: Gt, onExit: Gt, onExiting: Gt, onExited: Gt };
3691
- var Ju = "cubic-bezier(0.4, 0, 0.2, 1)", Qu = "cubic-bezier(0.0, 0, 0.2, 1)", em = "cubic-bezier(0.4, 0, 0.6, 1)", Dl = function(r) {
3692
- r.scrollTop = r.scrollTop;
3693
- }, oi = function(r) {
3694
- return Math.round(r) + "ms";
3695
- };
3696
- function Zt(r, i) {
3697
- r === void 0 && (r = ["all"]);
3698
- var o = i || {}, t = o.duration, n = t === void 0 ? 300 : t, l = o.easing, c = l === void 0 ? Ju : l, m = o.delay, a = m === void 0 ? 0 : m;
3699
- return (Array.isArray(r) ? r : [r]).map(function(s) {
3700
- var u = typeof n == "string" ? n : oi(n), d = typeof a == "string" ? a : oi(a);
3701
- return s + " " + u + " " + c + " " + d;
3702
- }).join(",");
3703
- }
3704
- function Pl(r) {
3705
- var i = function(o) {
3706
- return o && o.ownerDocument || document;
3707
- }(r);
3708
- return i.defaultView || window;
3709
- }
3710
- function Yo(r, i) {
3711
- if (i) {
3712
- var o = function(t, n) {
3713
- var l, c = n.getBoundingClientRect(), m = Pl(n);
3714
- if (n.fakeTransform) l = n.fakeTransform;
3715
- else {
3716
- var a = m.getComputedStyle(n);
3717
- l = a.getPropertyValue("-webkit-transform") || a.getPropertyValue("transform");
3718
- }
3719
- var s = 0, u = 0;
3720
- if (l && l !== "none" && typeof l == "string") {
3721
- var d = l.split("(")[1].split(")")[0].split(",");
3722
- s = parseInt(d[4], 10), u = parseInt(d[5], 10);
3723
- }
3724
- switch (t) {
3725
- case "left":
3726
- return "translateX(" + (m.innerWidth + s - c.left) + "px)";
3727
- case "right":
3728
- return "translateX(-" + (c.left + c.width - s) + "px)";
3729
- case "up":
3730
- return "translateY(" + (m.innerHeight + u - c.top) + "px)";
3731
- default:
3732
- return "translateY(-" + (c.top + c.height - u) + "px)";
3733
- }
3734
- }(r, i);
3735
- o && (i.style.webkitTransform = o, i.style.transform = o);
3736
- }
3737
- }
3738
- var Rl = J(function(r, i) {
3739
- var o = r.children, t = r.direction, n = t === void 0 ? "down" : t, l = r.in, c = r.style, m = r.timeout, a = m === void 0 ? 0 : m, s = r.onEnter, u = r.onEntered, d = r.onExit, f = r.onExited, p = Oo(r, ["children", "direction", "in", "style", "timeout", "onEnter", "onEntered", "onExit", "onExited"]), g = we(null), y = er(o.ref, g), x = er(y, i), b = G(function() {
3740
- g.current && Yo(n, g.current);
3741
- }, [n]);
3742
- return me(function() {
3743
- if (!l && n !== "down" && n !== "right") {
3744
- var h = function(v, C) {
3745
- var k;
3746
- function T() {
3747
- for (var M = this, N = arguments.length, B = new Array(N), R = 0; R < N; R++) B[R] = arguments[R];
3748
- clearTimeout(k), k = setTimeout(function() {
3749
- v.apply(M, B);
3750
- }, C);
3751
- }
3752
- return C === void 0 && (C = 166), T.clear = function() {
3753
- clearTimeout(k);
3754
- }, T;
3755
- }(function() {
3756
- g.current && Yo(n, g.current);
3757
- }), w = Pl(g.current);
3758
- return w.addEventListener("resize", h), function() {
3759
- h.clear(), w.removeEventListener("resize", h);
3760
- };
3761
- }
3762
- }, [n, l]), me(function() {
3763
- l || b();
3764
- }, [l, b]), Pe(wr, Object.assign({ appear: !0, nodeRef: g, onEnter: function(h, w) {
3765
- Yo(n, h), Dl(h), s && s(h, w);
3766
- }, onEntered: u, onEntering: function(h) {
3767
- var w = c?.transitionTimingFunction || Qu, v = ln({ timeout: a, mode: "enter", style: Ne({}, c, { transitionTimingFunction: w }) });
3768
- h.style.webkitTransition = Zt("-webkit-transform", v), h.style.transition = Zt("transform", v), h.style.webkitTransform = "none", h.style.transform = "none";
3769
- }, onExit: function(h) {
3770
- var w = c?.transitionTimingFunction || em, v = ln({ timeout: a, mode: "exit", style: Ne({}, c, { transitionTimingFunction: w }) });
3771
- h.style.webkitTransition = Zt("-webkit-transform", v), h.style.transition = Zt("transform", v), Yo(n, h), d && d(h);
3772
- }, onExited: function(h) {
3773
- h.style.webkitTransition = "", h.style.transition = "", f && f(h);
3774
- }, in: l, timeout: a }, p), function(h, w) {
3775
- return ws(o, Ne({ ref: x, style: Ne({ visibility: h !== "exited" || l ? void 0 : "hidden" }, c, {}, o.props.style) }, w));
3776
- });
3777
- });
3778
- Rl.displayName = "Slide";
3779
- var hn = function(r) {
3780
- return le.createElement("svg", Object.assign({ viewBox: "0 0 24 24", focusable: "false", style: { fontSize: 20, marginInlineEnd: 8, userSelect: "none", width: "1em", height: "1em", display: "inline-block", fill: "currentColor", flexShrink: 0 } }, r));
3781
- }, tm = function() {
3782
- return le.createElement(hn, null, le.createElement("path", { d: `M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41
3783
- 10.59L10 14.17L17.59 6.58L19 8L10 17Z` }));
3784
- }, om = function() {
3785
- return le.createElement(hn, null, le.createElement("path", { d: "M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z" }));
3786
- }, nm = function() {
3787
- return le.createElement(hn, null, le.createElement("path", { d: `M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,
3788
- 6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,
3789
- 13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z` }));
3790
- }, rm = function() {
3791
- return le.createElement(hn, null, le.createElement("path", { d: `M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,
3792
- 0 22,12A10,10 0 0,0 12,2Z` }));
3793
- }, Nt = { maxSnack: 3, persist: !1, hideIconVariant: !1, disableWindowBlurListener: !1, variant: "default", autoHideDuration: 5e3, iconVariant: { default: void 0, success: le.createElement(tm, null), warning: le.createElement(om, null), error: le.createElement(nm, null), info: le.createElement(rm, null) }, anchorOrigin: { vertical: "bottom", horizontal: "left" }, TransitionComponent: Rl, transitionDuration: { enter: 225, exit: 195 } }, am = function(r, i) {
3794
- return function(o, t) {
3795
- return t === void 0 && (t = !1), t ? Ne({}, Nt[o], {}, i[o], {}, r[o]) : o === "autoHideDuration" ? (n = r.autoHideDuration, l = i.autoHideDuration, (c = function(m) {
3796
- return typeof m == "number" || m === null;
3797
- })(n) ? n : c(l) ? l : Nt.autoHideDuration) : o === "transitionDuration" ? function(m, a) {
3798
- var s = function(u, d) {
3799
- return d.some(function(f) {
3800
- return typeof u === f;
3801
- });
3802
- };
3803
- return s(m, ["string", "number"]) ? m : s(m, ["object"]) ? Ne({}, Nt.transitionDuration, {}, s(a, ["object"]) && a, {}, m) : s(a, ["string", "number"]) ? a : s(a, ["object"]) ? Ne({}, Nt.transitionDuration, {}, a) : Nt.transitionDuration;
3804
- }(r.transitionDuration, i.transitionDuration) : r[o] || i[o] || Nt[o];
3805
- var n, l, c;
3806
- };
3807
- };
3808
- function Ao(r) {
3809
- return Object.entries(r).reduce(function(i, o) {
3810
- var t, n = o[0], l = o[1];
3811
- return Ne({}, i, ((t = {})[n] = Qn(l), t));
3812
- }, {});
3813
- }
3814
- var im = "notistack-SnackbarContainer", lm = "notistack-Snackbar", Ml = "notistack-CollapseWrapper", sm = "notistack-MuiContent", cm = function(r) {
3815
- return "notistack-MuiContent-" + r;
3816
- }, ni = Ao({ root: { height: 0 }, entered: { height: "auto" } }), Ln = "0px", Il = J(function(r, i) {
3817
- var o = r.children, t = r.in, n = r.onExited, l = we(null), c = we(null), m = er(i, c), a = function() {
3818
- return l.current ? l.current.clientHeight : 0;
3819
- };
3820
- return Pe(wr, { in: t, unmountOnExit: !0, onEnter: function(s) {
3821
- s.style.height = Ln;
3822
- }, onEntered: function(s) {
3823
- s.style.height = "auto";
3824
- }, onEntering: function(s) {
3825
- var u = a(), d = ln({ timeout: 175, mode: "enter" }), f = d.duration, p = d.easing;
3826
- s.style.transitionDuration = typeof f == "string" ? f : f + "ms", s.style.height = u + "px", s.style.transitionTimingFunction = p || "";
3827
- }, onExit: function(s) {
3828
- s.style.height = a() + "px";
3829
- }, onExited: n, onExiting: function(s) {
3830
- Dl(s);
3831
- var u = ln({ timeout: 175, mode: "exit" }), d = u.duration, f = u.easing;
3832
- s.style.transitionDuration = typeof d == "string" ? d : d + "ms", s.style.height = Ln, s.style.transitionTimingFunction = f || "";
3833
- }, nodeRef: c, timeout: 175 }, function(s, u) {
3834
- return Pe("div", Object.assign({ ref: m, className: Wt(ni.root, s === "entered" && ni.entered), style: Ne({ pointerEvents: "all", overflow: "hidden", minHeight: Ln, transition: Zt("height") }, s === "entered" && { overflow: "visible" }, {}, s === "exited" && !t && { visibility: "hidden" }) }, u), Pe("div", { ref: l, className: Ml, style: { display: "flex", width: "100%" } }, o));
3835
- });
3836
- });
3837
- Il.displayName = "Collapse";
3838
- var ri = { right: "left", left: "right", bottom: "up", top: "down" }, dm = function(r) {
3839
- return "anchorOrigin" + yr(r);
3840
- }, pm = function() {
3841
- };
3842
- function Do(r, i) {
3843
- return r.reduce(function(o, t) {
3844
- return t == null ? o : function() {
3845
- for (var n = arguments.length, l = new Array(n), c = 0; c < n; c++) l[c] = arguments[c];
3846
- var m = [].concat(l);
3847
- i && m.indexOf(i) === -1 && m.push(i), o.apply(this, m), t.apply(this, m);
3848
- };
3849
- }, pm);
3850
- }
3851
- var um = typeof window < "u" ? St : me;
3852
- function ai(r) {
3853
- var i = we(r);
3854
- return um(function() {
3855
- i.current = r;
3856
- }), G(function() {
3857
- return i.current.apply(void 0, arguments);
3858
- }, []);
3859
- }
3860
- var Hn, Nl = J(function(r, i) {
3861
- var o = r.children, t = r.className, n = r.autoHideDuration, l = r.disableWindowBlurListener, c = l !== void 0 && l, m = r.onClose, a = r.id, s = r.open, u = r.SnackbarProps, d = u === void 0 ? {} : u, f = we(), p = ai(function() {
3862
- m && m.apply(void 0, arguments);
3863
- }), g = ai(function(b) {
3864
- m && b != null && (f.current && clearTimeout(f.current), f.current = setTimeout(function() {
3865
- p(null, "timeout", a);
3866
- }, b));
3867
- });
3868
- me(function() {
3869
- return s && g(n), function() {
3870
- f.current && clearTimeout(f.current);
3871
- };
3872
- }, [s, n, g]);
3873
- var y = function() {
3874
- f.current && clearTimeout(f.current);
3875
- }, x = G(function() {
3876
- n != null && g(0.5 * n);
3877
- }, [n, g]);
3878
- return me(function() {
3879
- if (!c && s) return window.addEventListener("focus", x), window.addEventListener("blur", y), function() {
3880
- window.removeEventListener("focus", x), window.removeEventListener("blur", y);
3881
- };
3882
- }, [c, x, s]), Pe("div", Object.assign({ ref: i }, d, { className: Wt(lm, t), onMouseEnter: function(b) {
3883
- d.onMouseEnter && d.onMouseEnter(b), y();
3884
- }, onMouseLeave: function(b) {
3885
- d.onMouseLeave && d.onMouseLeave(b), x();
3886
- } }), o);
3887
- });
3888
- Nl.displayName = "Snackbar";
3889
- var mm = Ao({ root: (Hn = { display: "flex", flexWrap: "wrap", flexGrow: 1 }, Hn[on] = { flexGrow: "initial", minWidth: "288px" }, Hn) }), Sr = J(function(r, i) {
3890
- var o = r.className, t = Oo(r, ["className"]);
3891
- return le.createElement("div", Object.assign({ ref: i, className: Wt(mm.root, o) }, t));
3892
- });
3893
- Sr.displayName = "SnackbarContent";
3894
- var yo = Ao({ root: { backgroundColor: "#313131", fontSize: "0.875rem", lineHeight: 1.43, letterSpacing: "0.01071em", color: "#fff", alignItems: "center", padding: "6px 16px", borderRadius: "4px", boxShadow: "0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)" }, lessPadding: { paddingLeft: "20px" }, default: { backgroundColor: "#313131" }, success: { backgroundColor: "#43a047" }, error: { backgroundColor: "#d32f2f" }, warning: { backgroundColor: "#ff9800" }, info: { backgroundColor: "#2196f3" }, message: { display: "flex", alignItems: "center", padding: "8px 0" }, action: { display: "flex", alignItems: "center", marginLeft: "auto", paddingLeft: "16px", marginRight: "-8px" } }), ii = "notistack-snackbar", Fl = J(function(r, i) {
3895
- var o = r.id, t = r.message, n = r.action, l = r.iconVariant, c = r.variant, m = r.hideIconVariant, a = r.style, s = r.className, u = l[c], d = n;
3896
- return typeof d == "function" && (d = d(o)), le.createElement(Sr, { ref: i, role: "alert", "aria-describedby": ii, style: a, className: Wt(sm, cm(c), yo.root, yo[c], s, !m && u && yo.lessPadding) }, le.createElement("div", { id: ii, className: yo.message }, m ? null : u, t), d && le.createElement("div", { className: yo.action }, d));
3897
- });
3898
- Fl.displayName = "MaterialDesignContent";
3899
- var wo, zn, Zo, Jo, Wn, gm = K(Fl), hm = Ao({ wrappedRoot: { width: "100%", position: "relative", transform: "translateX(0)", top: 0, right: 0, bottom: 0, left: 0, minWidth: "288px" } }), fm = function(r) {
3900
- var i = we(), o = U(!0), t = o[0], n = o[1], l = Do([r.snack.onClose, r.onClose]), c = G(function() {
3901
- i.current = setTimeout(function() {
3902
- n(function(M) {
3903
- return !M;
3904
- });
3905
- }, 125);
3906
- }, []);
3907
- me(function() {
3908
- return function() {
3909
- i.current && clearTimeout(i.current);
3910
- };
3911
- }, []);
3912
- var m, a = r.snack, s = r.classes, u = r.Component, d = u === void 0 ? gm : u, f = j(function() {
3913
- return function(M) {
3914
- M === void 0 && (M = {});
3915
- var N = { containerRoot: !0, containerAnchorOriginTopCenter: !0, containerAnchorOriginBottomCenter: !0, containerAnchorOriginTopRight: !0, containerAnchorOriginBottomRight: !0, containerAnchorOriginTopLeft: !0, containerAnchorOriginBottomLeft: !0 };
3916
- return Object.keys(M).filter(function(B) {
3917
- return !N[B];
3918
- }).reduce(function(B, R) {
3919
- var S;
3920
- return Ne({}, B, ((S = {})[R] = M[R], S));
3921
- }, {});
3922
- }(s);
3923
- }, [s]), p = a.open, g = a.SnackbarProps, y = a.TransitionComponent, x = a.TransitionProps, b = a.transitionDuration, h = a.disableWindowBlurListener, w = a.content, v = Oo(a, ["open", "SnackbarProps", "TransitionComponent", "TransitionProps", "transitionDuration", "disableWindowBlurListener", "content", "entered", "requestClose", "onEnter", "onEntered", "onExit", "onExited"]), C = Ne({ direction: (m = v.anchorOrigin, m.horizontal !== "center" ? ri[m.horizontal] : ri[m.vertical]), timeout: b }, x), k = w;
3924
- typeof k == "function" && (k = k(v.id, v.message));
3925
- var T = ["onEnter", "onEntered", "onExit", "onExited"].reduce(function(M, N) {
3926
- var B;
3927
- return Ne({}, M, ((B = {})[N] = Do([r.snack[N], r[N]], v.id), B));
3928
- }, {});
3929
- return le.createElement(Il, { in: t, onExited: T.onExited }, le.createElement(Nl, { open: p, id: v.id, disableWindowBlurListener: h, autoHideDuration: v.autoHideDuration, className: Wt(hm.wrappedRoot, f.root, f[dm(v.anchorOrigin)]), SnackbarProps: g, onClose: l }, le.createElement(y, Object.assign({}, C, { appear: !0, in: p, onExit: T.onExit, onExited: c, onEnter: T.onEnter, onEntered: Do([T.onEntered, function() {
3930
- r.snack.requestClose && l(null, "instructed", r.snack.id);
3931
- }], v.id) }), k || le.createElement(d, Object.assign({}, v)))));
3932
- }, So = { default: 20 }, Qo = { default: 6, dense: 2 }, li = "." + Ml, en = Ao({ root: (wo = { boxSizing: "border-box", display: "flex", maxHeight: "100%", position: "fixed", zIndex: 1400, height: "auto", width: "auto", transition: Zt(["top", "right", "bottom", "left", "max-width"], { duration: 300, easing: "ease" }), pointerEvents: "none" }, wo[li] = { padding: Qo.default + "px 0px", transition: "padding 300ms ease 0ms" }, wo.maxWidth = "calc(100% - " + 2 * So.default + "px)", wo[Bn] = { width: "100%", maxWidth: "calc(100% - 32px)" }, wo), rootDense: (zn = {}, zn[li] = { padding: Qo.dense + "px 0px" }, zn), top: { top: So.default - Qo.default + "px", flexDirection: "column" }, bottom: { bottom: So.default - Qo.default + "px", flexDirection: "column-reverse" }, left: (Zo = { left: So.default + "px" }, Zo[on] = { alignItems: "flex-start" }, Zo[Bn] = { left: "16px" }, Zo), right: (Jo = { right: So.default + "px" }, Jo[on] = { alignItems: "flex-end" }, Jo[Bn] = { right: "16px" }, Jo), center: (Wn = { left: "50%", transform: "translateX(-50%)" }, Wn[on] = { alignItems: "center" }, Wn) }), bm = K(function(r) {
3933
- var i = r.classes, o = i === void 0 ? {} : i, t = r.anchorOrigin, n = r.dense, l = r.children, c = Wt(im, en[t.vertical], en[t.horizontal], en.root, o.containerRoot, o["containerAnchorOrigin" + yr(t)], n && en.rootDense);
3934
- return le.createElement("div", { className: c }, l);
3935
- }), si = function(r) {
3936
- return !(typeof r == "string" || nr(r));
3937
- }, xm = function(r) {
3938
- function i(o) {
3939
- var t;
3940
- return (t = r.call(this, o) || this).enqueueSnackbar = function(n, l) {
3941
- if (l === void 0 && (l = {}), n == null) throw new Error("enqueueSnackbar called with invalid argument");
3942
- var c = si(n) ? n : l, m = si(n) ? n.message : n, a = c.key, s = c.preventDuplicate, u = Oo(c, ["key", "preventDuplicate"]), d = Xo(a), f = d ? a : (/* @__PURE__ */ new Date()).getTime() + Math.random(), p = am(u, t.props), g = Ne({ id: f }, u, { message: m, open: !0, entered: !1, requestClose: !1, persist: p("persist"), action: p("action"), content: p("content"), variant: p("variant"), anchorOrigin: p("anchorOrigin"), disableWindowBlurListener: p("disableWindowBlurListener"), autoHideDuration: p("autoHideDuration"), hideIconVariant: p("hideIconVariant"), TransitionComponent: p("TransitionComponent"), transitionDuration: p("transitionDuration"), TransitionProps: p("TransitionProps", !0), iconVariant: p("iconVariant", !0), style: p("style", !0), SnackbarProps: p("SnackbarProps", !0), className: Wt(t.props.className, u.className) });
3943
- return g.persist && (g.autoHideDuration = void 0), t.setState(function(y) {
3944
- if (s === void 0 && t.props.preventDuplicate || s) {
3945
- var x = function(w) {
3946
- return d ? w.id === f : w.message === m;
3947
- }, b = y.queue.findIndex(x) > -1, h = y.snacks.findIndex(x) > -1;
3948
- if (b || h) return y;
3949
- }
3950
- return t.handleDisplaySnack(Ne({}, y, { queue: [].concat(y.queue, [g]) }));
3951
- }), f;
3952
- }, t.handleDisplaySnack = function(n) {
3953
- return n.snacks.length >= t.maxSnack ? t.handleDismissOldest(n) : t.processQueue(n);
3954
- }, t.processQueue = function(n) {
3955
- var l = n.queue, c = n.snacks;
3956
- return l.length > 0 ? Ne({}, n, { snacks: [].concat(c, [l[0]]), queue: l.slice(1, l.length) }) : n;
3957
- }, t.handleDismissOldest = function(n) {
3958
- if (n.snacks.some(function(a) {
3959
- return !a.open || a.requestClose;
3960
- })) return n;
3961
- var l = !1, c = !1;
3962
- n.snacks.reduce(function(a, s) {
3963
- return a + (s.open && s.persist ? 1 : 0);
3964
- }, 0) === t.maxSnack && (c = !0);
3965
- var m = n.snacks.map(function(a) {
3966
- return l || a.persist && !c ? Ne({}, a) : (l = !0, a.entered ? (a.onClose && a.onClose(null, "maxsnack", a.id), t.props.onClose && t.props.onClose(null, "maxsnack", a.id), Ne({}, a, { open: !1 })) : Ne({}, a, { requestClose: !0 }));
3967
- });
3968
- return Ne({}, n, { snacks: m });
3969
- }, t.handleEnteredSnack = function(n, l, c) {
3970
- if (!Xo(c)) throw new Error("handleEnteredSnack Cannot be called with undefined key");
3971
- t.setState(function(m) {
3972
- return { snacks: m.snacks.map(function(a) {
3973
- return a.id === c ? Ne({}, a, { entered: !0 }) : Ne({}, a);
3974
- }) };
3975
- });
3976
- }, t.handleCloseSnack = function(n, l, c) {
3977
- t.props.onClose && t.props.onClose(n, l, c);
3978
- var m = c === void 0;
3979
- t.setState(function(a) {
3980
- var s = a.snacks, u = a.queue;
3981
- return { snacks: s.map(function(d) {
3982
- return m || d.id === c ? d.entered ? Ne({}, d, { open: !1 }) : Ne({}, d, { requestClose: !0 }) : Ne({}, d);
3983
- }), queue: u.filter(function(d) {
3984
- return d.id !== c;
3985
- }) };
3986
- });
3987
- }, t.closeSnackbar = function(n) {
3988
- var l = t.state.snacks.find(function(c) {
3989
- return c.id === n;
3990
- });
3991
- Xo(n) && l && l.onClose && l.onClose(null, "instructed", n), t.handleCloseSnack(null, "instructed", n);
3992
- }, t.handleExitedSnack = function(n, l) {
3993
- if (!Xo(l)) throw new Error("handleExitedSnack Cannot be called with undefined key");
3994
- t.setState(function(c) {
3995
- var m = t.processQueue(Ne({}, c, { snacks: c.snacks.filter(function(a) {
3996
- return a.id !== l;
3997
- }) }));
3998
- return m.queue.length === 0 ? m : t.handleDismissOldest(m);
3999
- });
4000
- }, t.enqueueSnackbar, t.closeSnackbar, t.state = { snacks: [], queue: [], contextValue: { enqueueSnackbar: t.enqueueSnackbar.bind(Za(t)), closeSnackbar: t.closeSnackbar.bind(Za(t)) } }, t;
4001
- }
4002
- return Tl(i, r), i.prototype.render = function() {
4003
- var o = this, t = this.state.contextValue, n = this.props, l = n.domRoot, c = n.children, m = n.dense, a = m !== void 0 && m, s = n.Components, u = s === void 0 ? {} : s, d = n.classes, f = this.state.snacks.reduce(function(g, y) {
4004
- var x, b = yr(y.anchorOrigin), h = g[b] || [];
4005
- return Ne({}, g, ((x = {})[b] = [].concat(h, [y]), x));
4006
- }, {}), p = Object.keys(f).map(function(g) {
4007
- var y = f[g], x = y[0];
4008
- return le.createElement(bm, { key: g, dense: a, anchorOrigin: x.anchorOrigin, classes: d }, y.map(function(b) {
4009
- return le.createElement(fm, { key: b.id, snack: b, classes: d, Component: u[b.variant], onClose: o.handleCloseSnack, onEnter: o.props.onEnter, onExit: o.props.onExit, onExited: Do([o.handleExitedSnack, o.props.onExited], b.id), onEntered: Do([o.handleEnteredSnack, o.props.onEntered], b.id) });
4010
- }));
4011
- });
4012
- return le.createElement(El.Provider, { value: t }, c, l ? hp(p, l) : p);
4013
- }, kl(i, [{ key: "maxSnack", get: function() {
4014
- return this.props.maxSnack || Nt.maxSnack;
4015
- } }]), i;
4016
- }(di), Ol = function() {
4017
- return ys(El);
4018
- };
4019
- const ym = [{ key: "SheetXL", description: "SheetXL", mimeType: ".sxl", exts: ["sxl"], handler: null, isDefault: !0 }, { key: "CSV", description: "Comma Delimited", mimeType: "text/csv", exts: ["csv"], handler: null }, { key: "Excel", description: "Excel Workbook", mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", exts: ["xlsx", "xls", "xlsm"], handler: null }], wm = [{ key: "SheetXL", mimeType: "application/vnd.sheetxl.sheet", description: "SheetXL", ext: "sxl", handler: null, isDefault: !0 }, { key: "CSV", mimeType: "text/csv", description: "Comma Delimited", ext: "csv", handler: null }, { key: "Excel", mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", description: "Excel Workbook", ext: "xlsx", tags: ["SheetJS Pro"], handler: null }];
4020
- class Sm {
4021
- constructor(i = ym, o = wm) {
4022
- this._readFormatType = [], this._writeFormatType = [], this._readFormatType = Object.freeze([...i]), this._writeFormatType = Object.freeze([...o]);
4023
- }
4024
- getReadFormats() {
4025
- return this._readFormatType;
4026
- }
4027
- getWriteFormats() {
4028
- return this._writeFormatType;
4029
- }
4030
- getAllReadFormatTypeAsString() {
4031
- const i = [], o = this._readFormatType;
4032
- for (let t = 0; t < o.length; t++) for (let n = 0; n < o[t].exts.length; n++) i.push("." + o[t].exts[n]);
4033
- return i;
4034
- }
4035
- async writeFile(i, o, t) {
4036
- if (!o || !i) throw new Error("Workbook model or file name must be provided.");
4037
- try {
4038
- return (await import("@sheetxl/io")).WorkbookIO.writeFile(i, o, t);
4039
- } catch (n) {
4040
- throw new Error("Unable to load io library", { cause: n });
4041
- }
4042
- }
4043
- async read(i, o) {
4044
- let t, n;
4045
- const l = await o?.showBusy?.(`Opening${i.name ? ` ${i.name}` : ""}...`);
4046
- try {
4047
- n = await import("@sheetxl/io");
4048
- } catch (c) {
4049
- throw c;
4050
- }
4051
- try {
4052
- return await n.WorkbookIO.read({ ...i, async onStart(c) {
4053
- await i?.onStart?.(c), t = await o?.showBusy?.(`Opening '${c}'...`);
4054
- } });
4055
- } catch (c) {
4056
- throw l?.(), t?.(), c;
4057
- } finally {
4058
- l?.(), t?.();
4059
- }
4060
- }
4061
- }
4062
- const Ot = new Sm(), mt = { card: "_card_1a398_7", actionRoot: "_actionRoot_1a398_11", icons: "_icons_1a398_16", expand: "_expand_1a398_22", expandOpen: "_expandOpen_1a398_29", stackTraceContainer: "_stackTraceContainer_1a398_33" }, Al = J((r, i) => {
4063
- const { id: o, message: t, iconVariant: n, error: l, hideIconVariant: c, ...m } = r, { closeSnackbar: a } = Ol(), s = at(), [u, d] = U(!1), f = G(() => {
4064
- d((y) => !y);
4065
- }, []), p = G(() => {
4066
- a(o);
4067
- }, [o, a]);
4068
- let g = l?.message;
4069
- return !g && nr(t) && (g = t), g || typeof t != "string" || (g = t), g || (g = `Unknown Error: ${t}`), e(Sr, { ref: i, className: Ae(mt.root, "error-snackbar"), children: z(Rs, { className: mt.card, style: { backgroundColor: s.palette.error.dark, border: `1px solid ${s.palette.error.dark}` }, children: [z(Ms, { className: mt.actionRoot, children: [c ? null : n?.error, e(Oe, { variant: "body2", component: "div", className: mt.typography, style: { color: s.palette.text.primary }, children: g }), e("div", { style: { flex: "1 1 auto" } }), z("div", { className: mt.icons, children: [l ? e(dt, { "aria-label": "Show more", size: "small", className: Ae(mt.expand, { [mt.expandOpen]: u }), style: { color: s.palette.action.active }, onClick: f, children: e(Ci, {}) }) : null, e(dt, { size: "small", className: mt.expand, style: { color: s.palette.action.active }, onClick: p, children: e(Ti, { fontSize: "small" }) })] })] }), l ? e(Is, { in: u, timeout: "auto", unmountOnExit: !0, children: e("div", { className: mt.stackTraceContainer, style: { backgroundColor: s.palette.error.light, borderTop: `1px solid ${s.palette.error.main}` }, children: e(Id, { error: l, hideLineNumbers: !0 }) }) }) : null] }) });
4070
- });
4071
- Al.displayName = "ToastError";
4072
- const Bl = K(J((r, i) => {
4073
- const { commands: o, commandHook: t, scope: n = "workbook", disabled: l = !1, ...c } = r, m = ee((s) => {
4074
- const u = { variant: ie.Menuitem, parentFloat: s.floatReference, commandHook: t, scope: n, disabled: l }, d = z(se, { children: [e(F, { ...u, command: o.getCommand("newWorkbook"), icon: P(e(Nd, {})) }), e(re, { orientation: "horizontal" }), e(F, { ...u, command: o.getCommand("openWorkbook"), icon: P(e(Fd, {})) }), e(Re, { ...u, commands: o, quickCommand: "saveWorkbook", icon: P(e(Bd, {})), createPopupPanel: (f) => {
4075
- const p = { ...u, parentFloat: f.floatReference, scope: "saveWorkbook" }, g = [];
4076
- return Ot.getWriteFormats().forEach((y) => {
4077
- if (y.isDefault) return;
4078
- let x = null;
4079
- y.key === "CSV" ? x = P(e(Od, {})) : y.key === "Excel" && (x = P(e(Ad, {})));
4080
- const b = o.getCommand(`saveWorkbookAs${y.key}`);
4081
- b ? g.push(Pe(F, { ...p, key: y.key, command: b, icon: x })) : console.warn(`Unable to resolve command: 'saveWorkbookAs${y.key}'`);
4082
- }), Se({ ...f, children: g, onClick: () => {
4083
- f.closeFloatAll();
4084
- } });
4085
- } })] });
4086
- return Se({ ...s, children: d, onClick: (f) => {
4087
- f.isDefaultPrevented || s.closeFloatAll();
4088
- } });
4089
- }, [l, o, t, n]), a = "File";
4090
- return e(Re, { commands: o, disabled: l, commandHook: t, scope: n, label: a, tooltip: "Options for saving and loading the workbook.", sx: { paddingBottom: "0px", "& button": { paddingTop: "0px", paddingBottom: "0px", height: (s) => `calc(1.25rem + ${s.spacing(2)}px)` } }, ...c, createPopupPanel: m, icon: e(eo, { className: "label", icon: null, label: a }) });
4091
- }));
4092
- Bl.displayName = "StandaloneFileCommandButton";
4093
- const vm = e(rt, { label: "SheetXL", description: "Visit me at sheetxl.com.", children: e(A, { sx: { width: "24px", height: "24px", marginBottom: "4px", marginLeft: "6px" }, children: e(gp, { onClick: () => {
4094
- window?.open("https://www.sheetxl.com", "_blank");
4095
- }, style: { width: "24px", height: "24px", cursor: "pointer" } }) }) }), Ll = K(J((r, i) => {
4096
- const { commands: o, workbook: t, logo: n = vm, mainElement: l, showFileMenu: c = !0, showAppearanceMenu: m = !0, ...a } = r, { reference: s } = oo(), [u, { width: d }] = Io(), f = d < 530, p = c ? e(Bl, { commands: o, commandHook: { beforeExecute() {
4097
- s?.closeAll();
4098
- }, onError(b, h, w) {
4099
- } } }) : null, g = m ? e(ou, { commands: o, commandHook: { beforeExecute() {
4100
- s?.closeAll();
4101
- }, onError(b, h, w) {
4102
- } } }) : null, y = j(() => ({ paddingLeft: (b) => b.spacing(1), paddingRight: (b) => b.spacing(1) }), []), x = we(null);
4103
- return e(A, { ref: Fo([x, u, i]), ...a, children: hl({ commands: o, renderCompact: f, workbook: t, selectWrapper: (b) => z(A, { sx: { display: "flex", flex: "1", flexDirection: "row", alignItems: "stretch", gap: (h) => h.spacing(1), paddingLeft: (h) => h.spacing(1), paddingRight: (h) => h.spacing(1) }, children: [z(A, { sx: { display: "flex", flexDirection: "row", alignItems: "center", flex: "1 1 100%", gap: (h) => h.spacing(0.5) }, children: [n, z(A, { sx: { display: "flex", flexDirection: "row", alignItems: "center", gap: (h) => h.spacing(0.25) }, children: [p, b] })] }), e(A, { sx: { display: "flex", flexDirection: "row", flex: "1 1 300%", overflow: "hidden", alignItems: "center", justifyContent: "center" }, children: l }), e(A, { sx: { display: "flex", alignItems: "center", justifyContent: "end", flex: f && !g ? "0 0 auto" : "1 1 100%" }, children: g })] }), selectProps: y, toolbarsProps: { Home: { sx: {} } } }) });
4104
- }));
4105
- Ll.displayName = "StudioToolbar";
4106
- const Hl = K(J((r, i) => {
4107
- const { workbook: o, setWorkbook: t, refWorkbookTitle: n, titleWorkbook: l, setWorkbookTitle: c, titlePlaceHolder: m, children: a, undoManager: s, commands: u, importExportDisabled: d, themeOptions: f } = r, p = Ol(), g = p ? p.enqueueSnackbar : () => {
4108
- }, y = p ? p.closeSnackbar : () => {
4109
- }, [x, b] = U({ isMounted: !1, label: null, starting: /* @__PURE__ */ new Map(), running: /* @__PURE__ */ new Map() }), h = G(() => {
4110
- b(($) => ({ ...$, isMounted: !0 }));
4111
- }, []), w = G(() => {
4112
- b(($) => ({ ...$, isMounted: !1 }));
4113
- }, []), v = {}, C = Hd(v), k = zd(v), T = Wd(v), M = we(/* @__PURE__ */ new Set()), N = j(() => {
4114
- const $ = (D, E) => {
4115
- if (E?.onceKey) {
4116
- if (M.current.has(E.onceKey)) return;
4117
- const Z = new Set(M.current);
4118
- Z.add(E.onceKey), M.current = Z;
4119
- }
4120
- const Y = { variant: E?.type ?? wt.Info, anchorOrigin: { vertical: "top", horizontal: "center" }, preventDuplicate: E?.preventDuplicate, persist: E?.persist ?? E?.type === wt.Error, action: (Z) => e(dt, { onClick: () => y(Z), children: e(ep, {}) }) };
4121
- E?.enqueueProps && Object.assign(Y, E.enqueueProps), D || console.log("message is 'null'", E), g(D ?? "Alert", Y);
4122
- };
4123
- return { showMessage: $, showBusy: (D, E) => {
4124
- let Y = null;
4125
- const Z = new Promise((X) => {
4126
- Y = X;
4127
- });
4128
- return b((X) => {
4129
- const _ = new Map(X.starting);
4130
- return _.set(Z, Y), { ...X, label: D, starting: _ };
4131
- }), Z;
4132
- }, showWindow: (D, E, Y) => {
4133
- const Z = { ...E, onKeyDown: (X) => {
4134
- u?.dispatchToFocusedCommand(X), X.isDefaultPrevented() || X.isPropagationStopped() || E?.onKeyDown?.(X);
4135
- } };
4136
- return C(D, { sort: () => import("./BWwRv_4Vs3pIJHK-.mjs"), numberFormat: () => import("./CTfL4NRMBZr5dUNM.mjs"), hyperlink: () => import("./Wo3zv3YCmz4f5NpR.mjs"), comments: () => import("./CGU0MsHi6xVOM3Wy.mjs"), find: () => import("./CyT1_wFdlQtHv48w.mjs"), tableDetails: () => import("./CrzQTch0GzxqX1Hh.mjs"), tableNew: () => import("./5Ukv5-SQmOLwdH1V.mjs"), namedDetails: () => import("./D1Jl9RDW29udjLaD.mjs") }[D], Z, Y);
4137
- }, showOptions: k, showInputOptions: T, showError: (D) => {
4138
- let E, Y = wt.Error, Z = "Unknown Error";
4139
- typeof D == "string" ? Z = D : D instanceof Error && (E = D, D.message && (Z = D.message)), D instanceof fp && (Y = wt.Info), $(Z, { type: Y, enqueueProps: { error: E } });
4140
- } };
4141
- }, []), B = G(() => {
4142
- }, []), R = (($) => {
4143
- const { workbook: D, setWorkbook: E, importExportDisabled: Y, workbookTitle: Z = "export", setWorkbookTitle: X, notifier: _, requestWorkbookTitle: ne, themeOptions: ae, undoManager: q, commands: W, onExecute: Q } = $, ue = ee(ae?.onModeChange, [ae?.onModeChange]), Le = ee(ae?.onEnabledDarkGridChange, [ae?.onEnabledDarkGridChange]), Fe = ee(ae?.onEnabledDarkImagesChange, [ae?.onEnabledDarkImagesChange]), Be = ee(async (ge = null, fe = null) => {
4144
- const te = [];
4145
- let ce, Me = null, xe = null;
4146
- if (typeof ge == "string" ? xe = ge : Me = ge, ce = Me ? ge : await Jt.openFileDialog(xe ?? Ot.getAllReadFormatTypeAsString().join(",")), !ce) return null;
4147
- const qe = { source: ce, createWorkbookOptions: fe, onWarning: (no) => {
4148
- te.push(no);
4149
- } }, et = await Ot.read(qe, _);
4150
- return te.length > 0 && (_?.showMessage?.("Some elements were not able to be imported. See console for details."), console.warn(`Import warnings:
4151
- ` + te.join(`
4152
- `))), et;
4153
- }, [Q, _, D]), Ye = ee(async (ge, fe, te) => {
4154
- if (!fe && ne) {
4155
- const ce = await ne("Enter Workbook name to " + (te.isDefault ? "Save." : `Export as ${te.description}.`));
4156
- return ce !== null && Ot.writeFile(ce, ge, { formatType: te.key });
4157
- }
4158
- return Ot.writeFile(fe, ge, { formatType: te.key });
4159
- }, [_, D, ne]), ve = G(() => ({ contains: (ge) => !0, focus() {
4160
- } }), []), je = j(() => {
4161
- const ge = [];
4162
- Y || (Ot.getWriteFormats().forEach((te) => {
4163
- const ce = te.isDefault, Me = { label: ce ? "Save Workbook" : `Save Workbook as ${te.description}`, scopedLabels: { workbook: "Save", saveWorkbook: `as ${te.description}` }, tags: te.tags, description: `Save the workbook to the desktop${ce ? "" : ` as ${te.description}`}.` };
4164
- ce && (Me.shortcut = { key: "S", modifiers: [ke.Ctrl] }, ge.push(new ye("saveWorkbookAs", ve, { label: "Save Workbook As…", scopedLabels: { workbook: "Save as…", saveWorkbook: "as…" }, shortcut: [{ key: "S", modifiers: [ke.Shift, ke.Ctrl] }, { key: "F12" }], description: "Save the workbook to the desktop with the provided name." }, () => {
4165
- Ye(D, null, te).catch((qe) => {
4166
- _?.showError?.(qe);
4167
- });
4168
- })));
4169
- const xe = ce ? "saveWorkbook" : `saveWorkbookAs${te.key}`;
4170
- ge.push(new ye(xe, ve, Me, (qe) => {
4171
- Ye(D, qe ?? Z, te).catch((et) => {
4172
- _?.showError?.(et);
4173
- });
4174
- }));
4175
- }), ge.push(new ye("openWorkbook", ve, { label: "Open Workbook…", scopedLabels: { workbook: "Open…" }, description: "Open a workbook from the desktop.", shortcut: { key: "O", modifiers: [ke.Ctrl] } }, async (te = null) => {
4176
- const ce = { date1904: D.isDate1904(), ...D.options };
4177
- try {
4178
- const Me = await Be(te, ce);
4179
- if (!Me) return;
4180
- const xe = Me.title, qe = Me.workbook, et = qe.getSelectedSheet();
4181
- if (Me.formatType.mimeType === "text/csv") {
4182
- const no = D.findValidSheetName(xe);
4183
- await D.doBatch(async () => {
4184
- const fn = et.getUsedRange();
4185
- if (!fn) return void _?.showMessage("The file appears to be blank.");
4186
- await D.getSheets().add({ name: no, autoSelect: !0 }).getRange({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }).copyFrom(fn);
4187
- }, `Import CSV '${xe}'`);
4188
- } else D?.close(), X?.(xe), E(qe);
4189
- } catch (Me) {
4190
- _?.showError?.(Me);
4191
- }
4192
- })), ge.push(new ye("openWorkbookFromUrl", ve, { label: "Open Workbook From Web", scopedLabels: { insert: "From Web", workbook: "From Web…" }, description: "Open a workbook from the web." }, async function(te) {
4193
- if (!te) {
4194
- const ce = await _?.showInputOptions?.({ title: "Open Workbook from the Web", description: "Enter the web address for the workbook to open.", inputLabel: "Address", initialValue: "https://www.sheetxl.com/examples/features-checklist.xlsx", inputProps: { style: { minWidth: "440px" } }, options: ["Open"] });
4195
- if (ce.option !== "Open") return;
4196
- te = ce.input;
4197
- }
4198
- te && console.log("openWorkbookFromUrl", te);
4199
- })));
4200
- let fe = [];
4201
- return ae && (fe = [new ye("themeMode", ve, { label: "Light/Dark Mode", scopedLabels: { appearance: "Light/Dark Mode" }, description: "Toggle the application styling between light and dark mode." }), new ye("defaultThemeMode", ve, { label: "Use System Light/Dark Mode", scopedLabels: { appearance: "Use System Default" }, description: "Use the system settings to determine styling for light and dark mode." }), new ye("enableDarkGrid", ve, { label: "Enable Dark Grid", description: "Allow the grid to render in dark mode if dark mode is being used. This is ensures that the grid will render the colors as specified in another tools (for example Excel)." }), new ye("enableDarkImages", ve, { label: "Enable Dark Images", description: "Allow the images to render in dark mode if dark mode is being used. This is ensures that the images will render the colors as specified in another tools (for example Excel). This only has any effect if the grid is in dark mode." })]), [...ge, ...fe, new Ge("help", ve, { label: "Show Help", description: "Provide Help.", shortcut: { key: "F1" } }, () => {
4202
- }), new Ge("showKeyboardShortcuts", ve, { label: "Keyboard Shortcuts", description: "Show keyboard shortcuts.", shortcut: { key: "/", modifiers: [ke.Ctrl] } }, () => {
4203
- }), new ye("gotoUrlGithub", ve, { label: "Github", description: "Download examples, explore source code, and leave a star." }, () => {
4204
- window?.open("https://github.com/sheetxl/sheetxl");
4205
- }), new ye("gotoUrlDiscord", ve, { label: "Discord", description: "Join our community on discord." }, () => {
4206
- window?.open("https://discord.gg/NTKdwUgK9p");
4207
- }), new ye("gotoUrlDocumentation", ve, { label: "Documentation", description: "Read the documentation." }, () => {
4208
- window?.open("https://www.sheetxl.com/docs");
4209
- }), new ye("gotoUrlIssue", ve, { label: "Create Issue", description: "Create an issue to identify a bug or a feature request." }, () => {
4210
- window?.open("https://github.com/sheetxl/sheetxl/issues");
4211
- })];
4212
- }, [D, Z, _, Y, ae, W, q]), H = j(() => {
4213
- let ge = null;
4214
- return ge = W ? W.createChildGroup(ve, "standaloneWorkbook", !1) : new mr(ve, "standaloneWorkbook"), ge.addCommands(je, !0), ge;
4215
- }, [W, je]);
4216
- np({ manager: q, commands: H, notifier: _ });
4217
- const { themeMode: oe } = vi();
4218
- me(() => {
4219
- if (!ae || !H) return;
4220
- const ge = ae.mode === "dark" || !ae.mode && oe === "dark";
4221
- H.getCommand("themeMode").update({ state: ae.mode ?? null, label: ge ? "Dark Mode" : "Light Mode", scopedLabels: { appearance: ge ? "Dark Mode" : "Light Mode" } }).updateCallback(() => {
4222
- ue(ge ? Gn.Light : Gn.Dark);
4223
- }), H.getCommand("defaultThemeMode").update({ state: !ae.mode }).updateCallback(() => {
4224
- ue(null);
4225
- }), H.getCommand("enableDarkGrid").update({ state: ae.enableDarkGrid }).updateCallback(() => {
4226
- Le(!ae.enableDarkGrid);
4227
- }), H.getCommand("enableDarkImages").update({ state: ae.enableDarkImages }).updateCallback(() => {
4228
- Fe(!ae.enableDarkImages);
4229
- });
4230
- }, [oe, ae, je]);
4231
- const { showModal: Te } = Ld();
4232
- return me(() => {
4233
- const ge = () => new Promise((fe, te) => {
4234
- const ce = le.lazy(() => import("./q95zwalhNRxfwm2I.mjs")), Me = Te(ce, { title: "Shortcut Keys Reference", commands: H, onDone: () => {
4235
- Me.hide();
4236
- }, TransitionProps: { onExited: () => {
4237
- fe(!0);
4238
- } } });
4239
- });
4240
- H.getCommand("showKeyboardShortcuts").updateCallback(() => ge()), H.getCommand("help").updateCallback(() => ge());
4241
- }, [je, H]), H;
4242
- })({ workbook: o, setWorkbook: t, importExportDisabled: d, workbookTitle: l, setWorkbookTitle: c, commands: u, requestWorkbookTitle: ($) => new Promise((D) => {
4243
- n.current ? n.current.requestWorkbookTitle((E, Y) => {
4244
- D(E);
4245
- }, { selectAll: !0, requestReason: $ }) : D(m);
4246
- }), themeOptions: f, undoManager: s, notifier: N, onExecute: B });
4247
- me(() => {
4248
- x.starting.size <= 0 || !x.isMounted || b(($) => {
4249
- const D = new Map($.running);
4250
- return $.starting.forEach((E, Y) => {
4251
- const Z = () => {
4252
- b((X) => {
4253
- const _ = new Map(X.running);
4254
- return _.delete(Y), { ...X, running: _ };
4255
- });
4256
- };
4257
- D.set(Y, Z), E(Z);
4258
- }), { ...$, starting: /* @__PURE__ */ new Map(), running: D };
4259
- });
4260
- }, [x]);
4261
- const [S, I] = U(null);
4262
- me(() => {
4263
- x.starting.size !== 0 || x.running.size !== 0 ? I(e(Lt, { icon: e(jd, { sx: { transform: "scale(0.7)", marginLeft: "-6px" } }), panel: !0, label: x.label, onMount: h, onUnmount: w, sx: { position: "absolute", left: "0", top: "0", width: "100%", height: "100%", zIndex: "9999" } })) : I(null);
4264
- }, [x.starting, x.running]);
4265
- const L = j(() => e(nu, { commands: R, disableHover: !0, sx: { padding: "0" }, buttonProps: { sx: { maxHeight: "22px" } } }), [R]), O = { notifier: N, commands: R };
4266
- return o && (O.statusBarProps = { childrenEnd: L }), z(se, { children: [S, a ? le.cloneElement(a, O) : null] });
4267
- }));
4268
- Hl.displayName = "SnackbarAndCommandsWrapper";
4269
- const tr = K(J((r, i) => {
4270
- const { className: o, sx: t, style: n, onElementLoad: l, onError: c, undoManager: m, errorPanel: a = Vd, onKeyDown: s, workbook: u, createWorkbookOptions: d, onWorkbookChange: f, logo: p, importExportDisabled: g = !1, themeOptions: y, autoFocus: x = !1, commands: b, title: h, onTitleChange: w, titleProps: v, renderLoadingPanel: C, ...k } = r, T = we(null), M = ee(f, [f]), N = ee(w ?? v?.onTitleChange, [w ?? v?.onTitleChange]), B = v?.placeHolder ?? "Untitled", R = y?.mode, { themeMode: S, source: I } = vi({ mode: R }), L = j(() => ({ ...y, light: sa(!1, Jt.deepMerge(y?.theme ?? {}, y?.light ?? {})), dark: sa(!0, Jt.deepMerge(y?.theme ?? {}, y?.dark ?? {})) }), [y]), O = S === Gn.Dark, [$, D] = U(null);
4271
- me(() => {
4272
- D(m ?? new bp());
4273
- }, [m]);
4274
- const [E, Y] = U(null), [Z, X] = U(null), _ = hr();
4275
- St(() => {
4276
- if (!u || Object.keys(u).length === 0 && !Jt.isPromiseLike(u)) {
4277
- const te = { theme: _.getDefaultTheme(), ...d };
4278
- X(new jn(te));
4279
- } else X(u);
4280
- }, [u]), St(() => {
4281
- if (Z) {
4282
- if (Z instanceof jn) return Y({ workbook: Z }), void (u !== Z && M?.(Z));
4283
- (async () => {
4284
- try {
4285
- let te, ce = await Promise.resolve(Z);
4286
- ce && ce.source && (ce = await Ot.read(ce)), ce.workbook ? (Q(ce.title), te = ce.workbook) : te = ce, M?.(te), Y({ workbook: te });
4287
- } catch (te) {
4288
- M?.(null), Y({ error: te });
4289
- }
4290
- })();
4291
- }
4292
- }, [Z]);
4293
- const [ne, ae] = U(null);
4294
- me(() => {
4295
- if (!$ || !E) return;
4296
- $.clear();
4297
- const te = E?.workbook?.getTransactions();
4298
- if (te)
4299
- return te.addListener({ onCommitEnd: (ce) => {
4300
- ce.getDescription() ? $.addUndoOperation({ description: ce.getDescription(), undo: () => (te.revert(ce.getId()), ne.source?.focus(), () => {
4301
- te.restore(ce.getId()), ne.source?.focus();
4302
- }) }) : console.warn("commit has no description", ce);
4303
- } });
4304
- }, [$, E, ne]);
4305
- const q = ee((te) => {
4306
- te ? $.setRepeatableOperation({ description: te.label(), repeat: async () => te.execute() }) : $.setRepeatableOperation(null);
4307
- }, [$]), [W, Q] = U(h ?? v?.title ?? "");
4308
- me(() => {
4309
- Q(h ?? v?.title ?? "");
4310
- }, [h ?? v?.title]), me(() => {
4311
- N?.(W);
4312
- }, [W]);
4313
- const [ue, Le] = U(null), Fe = j(() => {
4314
- const te = () => ({ contains: (ce) => !0, focus() {
4315
- } });
4316
- return b ? b.createChildGroup(te, "application", !1) : new mr(te, "application");
4317
- }, [b]), Be = ee((te) => {
4318
- Le(te.source.getViewportElement()), ae(te), Fe.activate("sheet"), l?.(te);
4319
- }, [Fe]);
4320
- me(() => {
4321
- ne && x && ne.source?.focus(typeof x == "object" ? x : void 0);
4322
- }, [ne]);
4323
- const Ye = we(null), ve = G((te) => {
4324
- let ce = null;
4325
- return v?.hidden || (ce = e(Sl, { ...v, style: { maxWidth: "100%", ...v?.style }, workbook: T.current, ref: Ye, title: W, placeHolder: B, onTitleChange: (Me) => {
4326
- Q(Me);
4327
- } })), e(Ll, { ...te, logo: p, mainElement: ce, showFileMenu: !g, showAppearanceMenu: !!(L?.onEnabledDarkGridChange || L?.onEnabledDarkImagesChange || L?.onModeChange) });
4328
- }, [p, W, v, L, g, Fe]);
4329
- me(() => {
4330
- const te = (ce) => ce.preventDefault();
4331
- return T.current?.addEventListener("wheel", te, { passive: !1 }), () => {
4332
- T.current?.removeEventListener("wheel", te);
4333
- };
4334
- }, []);
4335
- const je = j(() => {
4336
- const te = { transparentBackground: !0 };
4337
- return e(A, { sx: t, style: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, display: "flex", alignItems: "center", justifyContent: "center", ...n }, children: C?.(te) ?? e(Lt, { ...te }) });
4338
- }, [t, n, C]), H = G(({ error: te }) => (c?.(te), e(a, { sx: t, style: n, error: te ?? "Unable to display empty workbook." })), [t, n, c]), oe = j(() => ({ ...t, "& .SnackbarContainer-root": { position: "absolute !important" }, "& .notistack-Snackbar": { minWidth: "unset" }, "& .notistack-MuiContent *": { fontFamily: (te) => te.typography.fontFamily }, "& #notistack-snackbar": { maxWidth: "560px", whiteSpace: "pre-wrap" }, "*": { userSelect: "none" } }), [t]), Te = Fo([T, i]), ge = j(() => {
4339
- if (!E) return je;
4340
- if (E.error || !E.workbook) return H({ error: E.error });
4341
- let te = null, ce = null, Me = !1;
4342
- return L && (te = O ? L.dark : L.light, ce = O && L.enableDarkGrid ? L.dark : L.light, Me = L.enableDarkImages), e(wl, { sx: oe, style: n, tabIndex: 0, autoFocus: !0, workbook: E.workbook, ref: Te, renderToolbar: ve, onElementLoad: Be, onRepeatCommandChange: q, onKeyDown: (xe) => {
4343
- s?.(xe);
4344
- }, renderLoadingPanel: C, gridTheme: ce, headersTheme: te, enableDarkImages: Me, className: Ae(o, "sheetxl-workbook"), onContextMenu: (xe) => xe.preventDefault(), ...k }, "WorkbookElement");
4345
- }, [E, W, $, je, C, L, k, ve, oe]);
4346
- let fe = e(Gu, { fallbackRender: H, children: e(xm, { maxSnack: 3, domRoot: ue, anchorOrigin: { vertical: "bottom", horizontal: "right" }, autoHideDuration: 3500, onClose: (te, ce, Me) => {
4347
- T.current?.focus();
4348
- }, Components: { error: Al }, iconVariant: { success: e(ar, { style: { marginRight: "8px" }, children: e("path", { d: "M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z" }) }), error: e(_d, { style: { marginRight: "8px" } }) }, children: e($d, { children: e(Hl, { workbook: E?.workbook, setWorkbook: X, importExportDisabled: g, titlePlaceHolder: B, titleWorkbook: W, setWorkbookTitle: Q, refWorkbookTitle: Ye, commands: Fe, undoManager: $, themeOptions: L, children: ge }) }) }) });
4349
- return L && (fe = z(Ei, { theme: O ? L.dark : L.light, children: [L.cssBaseline ? e(Ns, {}) : null, fe] })), fe;
4350
- }));
4351
- tr.displayName = "EagerStudio";
4352
- const Cm = Object.freeze(Object.defineProperty({ __proto__: null, EagerStudio: tr, default: tr }, Symbol.toStringTag, { value: "Module" }));
4353
- export {
4354
- Eo as $,
4355
- tu as A,
4356
- Np as B,
4357
- Tp as C,
4358
- Ii as D,
4359
- ou as E,
4360
- Op as F,
4361
- nu as G,
4362
- xp as H,
4363
- Mi as I,
4364
- Hi as J,
4365
- br as K,
4366
- ru as L,
4367
- Fp as M,
4368
- lu as N,
4369
- iu as O,
4370
- Ai as P,
4371
- Ip as Q,
4372
- su as R,
4373
- _u as S,
4374
- zm as T,
4375
- Fi as U,
4376
- yp as V,
4377
- _p as W,
4378
- ha as X,
4379
- Mp as Y,
4380
- vp as Z,
4381
- Yn as _,
4382
- Xp as a,
4383
- Pp as a0,
4384
- fr as a1,
4385
- Pi as a2,
4386
- Jp as a3,
4387
- Qp as a4,
4388
- eu as a5,
4389
- Vi as a6,
4390
- ji as a7,
4391
- Ki as a8,
4392
- Xi as a9,
4393
- Yi as aa,
4394
- bu as ab,
4395
- Kp as ac,
4396
- Zi as ad,
4397
- Ji as ae,
4398
- Qi as af,
4399
- jm as ag,
4400
- wl as ah,
4401
- Sl as ai,
4402
- xl as aj,
4403
- bl as ak,
4404
- Du as al,
4405
- Pu as am,
4406
- Va as an,
4407
- tr as ao,
4408
- Sm as ap,
4409
- Ot as aq,
4410
- dl as ar,
4411
- pl as as,
4412
- vu as at,
4413
- sl as au,
4414
- Wt as b,
4415
- Co as c,
4416
- Kn as d,
4417
- ol as e,
4418
- Ae as f,
4419
- Wm as g,
4420
- wp as h,
4421
- Sp as i,
4422
- Ap as j,
4423
- Bp as k,
4424
- Lp as l,
4425
- Ri as m,
4426
- Hp as n,
4427
- zp as o,
4428
- Ni as p,
4429
- Hm as q,
4430
- mn as r,
4431
- Mo as s,
4432
- Wp as t,
4433
- Io as u,
4434
- jp as v,
4435
- Vp as w,
4436
- $p as x,
4437
- Gp as y,
4438
- Zp as z
4439
- };