@sheetxl/studio-mui 0.8.0-beta.10 → 0.8.0-beta.11

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 (119) hide show
  1. package/browser/esm/0BWO0bLZ8Vm_dKd2.mjs +582 -0
  2. package/browser/esm/BAbq4-I5f5oUiNaF.mjs +141 -0
  3. package/browser/esm/BED6h6YAwCf1HEQJ.mjs +161 -0
  4. package/browser/esm/{CEvZe2cZK-voZTif.mjs → BXhNFzyEGokTF-BL.mjs} +5 -5
  5. package/browser/esm/BYE9gCDWKyx6mnVs.mjs +381 -0
  6. package/browser/esm/{DBtc4lku0uHVcqWn.mjs → BjvD_4t2KGsZP5V8.mjs} +3 -3
  7. package/browser/esm/{DU3J8Gcf-WpBxNYg.mjs → BknfGJouygmnpFIU.mjs} +4 -4
  8. package/browser/esm/{D8al_cJ4U-NgzwoK.mjs → BlE_8o8tO2AgAlaj.mjs} +19 -17
  9. package/browser/esm/BokqKEpU6TFgfRs6.mjs +252 -0
  10. package/browser/esm/{DHY19rkSiiRZxShC.mjs → Brsh5yscJ_4uKFXp.mjs} +3 -3
  11. package/browser/esm/Bujtz_Guj88d03vI.mjs +831 -0
  12. package/browser/esm/Buqcl7J75MJrhpVE.mjs +1379 -0
  13. package/browser/esm/BvhYPwX3GrRaO9CM.mjs +319 -0
  14. package/browser/esm/C0wlMAIn9iREPK6w.mjs +87 -0
  15. package/browser/esm/C8JU4KsMasmLvojI.mjs +103 -0
  16. package/browser/esm/{CjznclrKqJRi7u9O.mjs → C9pIZVACtl9unFOp.mjs} +2 -2
  17. package/browser/esm/CBD4RiRKbbZtSXV-.mjs +318 -0
  18. package/browser/esm/{Blaj2R5hYxtLAW__.mjs → CEtXsBzEjEKk9GOj.mjs} +6 -6
  19. package/browser/esm/{CIu1bjPJe_x31Oww.mjs → COlZu93LRwuBvjE-.mjs} +3 -3
  20. package/browser/esm/{CoSiOS-og0zFw4Ws.mjs → CTjqDD-swFMZzI-Y.mjs} +2 -2
  21. package/browser/esm/CWkOgdL7mOKiTR62.mjs +975 -0
  22. package/browser/esm/ChSVxkPTIjgcC8PL.mjs +412 -0
  23. package/browser/esm/{5cbK03T_Oh3tNdR7.mjs → ClBvNPeNCAhuVWrG.mjs} +1 -1
  24. package/browser/esm/CyLn6zOOp_biA3xU.mjs +335 -0
  25. package/browser/esm/CynTY0oNtyJnoaBq.mjs +14 -0
  26. package/browser/esm/{xKiLJKiLxto8SayF.mjs → D3rRUK4dIM5gUSmj.mjs} +2 -2
  27. package/browser/esm/D9ISy7VkaRRFJl46.mjs +515 -0
  28. package/browser/esm/{fb126BNj3F8URR19.mjs → DDc6rDuU9JAo1DH_.mjs} +3 -3
  29. package/browser/esm/DDczwkXhz_MHub4z.mjs +197 -0
  30. package/browser/esm/{X1Db3b_7b_7OuCk6.mjs → DEv4pIEgYr5C7etm.mjs} +1 -1
  31. package/browser/esm/DG21x7RKDpge6zAE.mjs +31 -0
  32. package/browser/esm/DJOOed_OtB-XT7f3.mjs +437 -0
  33. package/browser/esm/{9eKCkvqpMQwqcXiw.mjs → DKtJxrpN0axtuQ0l.mjs} +1 -1
  34. package/browser/esm/DRSCS6aLiYmPjUz1.mjs +1543 -0
  35. package/browser/esm/{ByeL_BZuJ2kl8gtf.mjs → DTpRkgsTm_zYnWfW.mjs} +1 -1
  36. package/browser/esm/DV6i9RQZfJiKtEaJ.mjs +2552 -0
  37. package/browser/esm/DdcZrjMLWVukWcU5.mjs +7473 -0
  38. package/browser/esm/Di3BUxA0SqFWWgeg.mjs +94 -0
  39. package/browser/esm/DnGaP5F7mLwCGUYG.mjs +408 -0
  40. package/browser/esm/DpD4fg2WcyiKX_2K.mjs +414 -0
  41. package/browser/esm/{C1Rp2hZrApo5MUc8.mjs → Ds3XRkne7HxcXD8J.mjs} +2 -2
  42. package/browser/esm/{sFOAxZpxXo-qvDSp.mjs → DsoNMWDwHZP8UXQd.mjs} +1 -1
  43. package/browser/esm/G0Inqm6Eqw47dMpa.mjs +212 -0
  44. package/browser/esm/{B1Yp_uy1vFHcJB3U.mjs → HViD4Wfoi0mmqk9w.mjs} +1 -1
  45. package/browser/esm/LZoYSQAYV2wksnDv.mjs +386 -0
  46. package/browser/esm/{CtEFHbzYNvYjDYvi.mjs → QgaAIDUMmBQBsXP9.mjs} +8 -8
  47. package/browser/esm/{D6S8kVTzOjCn0-SK.mjs → YThnrg3PadGs7B4j.mjs} +51 -51
  48. package/browser/esm/index.mjs +1028 -170
  49. package/browser/esm/ttjcNHcFn8O6hfnd.mjs +1288 -0
  50. package/browser/esm/{yZxC4qUENOlMhVUH.mjs → w_JrR69vEpvoyeMy.mjs} +1 -1
  51. package/browser/esm/{DmCQbW4zwkT_Rq88.mjs → xFqkfN8QMCxvsetB.mjs} +1 -1
  52. package/browser/esm/{IQLeaAbtGTipUsOD.mjs → zqilJefihVd7At2T.mjs} +22 -21
  53. package/licenses/dependencies.txt +94 -94
  54. package/node/esm/{BYsG3KYVmxSe_CIQ.mjs → 1bf4gn-2vld4BZ9u.mjs} +1 -1
  55. package/node/esm/{CKu1AtRgyltyEdEN.mjs → 3WghtBXAvCDwcVrq.mjs} +1 -1
  56. package/node/esm/{cqzp431iNSLWictb.mjs → 4HmLH0bPVJCZLgik.mjs} +22 -22
  57. package/node/esm/{BYVLi0md4AYuDsB_.mjs → B0bdb_6p7fQI_ivo.mjs} +28 -28
  58. package/node/esm/BIMkjQUwG4Ih-6Sh.mjs +142 -0
  59. package/node/esm/BNg4QQY0WAPLE0q7.mjs +141 -0
  60. package/node/esm/BPzcW4BejRqso338.mjs +72 -0
  61. package/node/esm/BR45ogAR-hY2bE60.mjs +318 -0
  62. package/node/esm/BlN7G0DVC24zauig.mjs +197 -0
  63. package/node/esm/{ah3CUg4-VmNstGk_.mjs → Bph-sR3l6AYWeuxK.mjs} +2 -2
  64. package/node/esm/CPq-MIdEnc-53JpF.mjs +319 -0
  65. package/node/esm/CSAnTp5rwId0DUb8.mjs +380 -0
  66. package/node/esm/CWcv7UVXF8IUB0PC.mjs +1379 -0
  67. package/node/esm/{D9rzScOA9pEYFrtz.mjs → CYIoK22I6Yvv12_x.mjs} +20 -20
  68. package/node/esm/CZyA9uD4SkTvqp_G.mjs +1283 -0
  69. package/node/esm/{ci8d-mF1H9wnYzix.mjs → CjC6s3RUJQNCF7mP.mjs} +1 -1
  70. package/node/esm/{D6oQL8knsPpgdXuk.mjs → CuMePia6i_8yfJ6S.mjs} +9 -9
  71. package/node/esm/CvRbu8JPxFarsSR-.mjs +412 -0
  72. package/node/esm/{DNSjK5DAH3M14Qbc.mjs → CyafafEgfmjLqE5O.mjs} +1 -1
  73. package/node/esm/D-xqQ5qOSd6WrzwJ.mjs +94 -0
  74. package/node/esm/DLqBHdFp6wvm6EGs.mjs +212 -0
  75. package/node/esm/{BcwMb6CyVfvEwbHn.mjs → DMXLxp3T0E0SRTQc.mjs} +1 -1
  76. package/node/esm/{DZzvTQxIKr9LbEsA.mjs → DWqvf4H5F2wMnZ0L.mjs} +32 -30
  77. package/node/esm/DatM6eEYPpAtIMy-.mjs +405 -0
  78. package/node/esm/Db3dbaYLKUO66T9s.mjs +1689 -0
  79. package/node/esm/{B_jRGdwGFkudwmL-.mjs → DdEzhVqYTrGODXrz.mjs} +1 -1
  80. package/node/esm/DeZJlLk8WJ3BLtLs.mjs +975 -0
  81. package/node/esm/DfCuL8AUxMFoEG2s.mjs +519 -0
  82. package/node/esm/{Bb1sLMqXWKjdve23.mjs → Do-zCKziWhoG5eAv.mjs} +2 -2
  83. package/node/esm/{B8SQfjKjzYHLxzZR.mjs → DpJ2gmZJioCyq8La.mjs} +67 -67
  84. package/node/esm/{ETK6T6G0SIcFXDe5.mjs → XEDcegsv5AGKBfu2.mjs} +40 -40
  85. package/node/esm/index.mjs +8941 -13558
  86. package/node/esm/yCUxQuqVuC4DHKPx.mjs +385 -0
  87. package/node/esm/zITjZ7R4raDqhP-n.mjs +515 -0
  88. package/package.json +9 -9
  89. package/resources/locales/de/ui.msg.json +97 -0
  90. package/resources/locales/en/ui.msg.json +97 -0
  91. package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +4 -4
  92. package/types/src/anomalies/AnomaliesPlugin.d.ts +5 -0
  93. package/types/src/anomalies/AnomaliesTaskPane.d.ts +17 -0
  94. package/types/src/anomalies/index.d.ts +3 -0
  95. package/types/src/border/BorderTemplateIcon.d.ts +6 -1
  96. package/types/src/chart/ChartFormatPanel.d.ts +20 -0
  97. package/types/src/chart/ChartPlugin.d.ts +6 -0
  98. package/types/src/chart/index.d.ts +3 -0
  99. package/types/src/comments/CommentCard.d.ts +2 -2
  100. package/types/src/conditions/useFormulaOption.d.ts +2 -2
  101. package/types/src/dialog/WorkbookStatisticsDialog.d.ts +1 -1
  102. package/types/src/format/BorderPreview.d.ts +11 -4
  103. package/types/src/format/useFormatSelection.d.ts +4 -4
  104. package/types/src/formulaBar/MobileFormulaBar.d.ts +18 -6
  105. package/types/src/formulaBar/MobileInputToolbar.d.ts +9 -3
  106. package/types/src/formulaBar/useFormulaBarSession.d.ts +6 -3
  107. package/types/src/index.d.ts +15 -6
  108. package/types/src/protection/ProtectedCellsPanel.d.ts +2 -2
  109. package/types/src/protection/{SheetProtectionPanel.d.ts → WorksheetProtectionPanel.d.ts} +6 -6
  110. package/types/src/protection/index.d.ts +1 -1
  111. package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +2 -2
  112. package/types/src/workbook/DefaultRenderers.d.ts +2 -2
  113. package/types/src/workbook/WorkbookContextMenu.d.ts +4 -0
  114. package/browser/esm/Biy7bhzzzPb5sfRN.mjs +0 -152
  115. package/browser/esm/COv-m-c2byCgvU3M.mjs +0 -14861
  116. package/browser/esm/Die9NXVFveHvcCT-.mjs +0 -4205
  117. package/browser/esm/sam1KGQZ59B_fADz.mjs +0 -1941
  118. package/node/esm/BYwXhrEwkRAt9nJS.mjs +0 -71
  119. package/node/esm/Cmt8Wv806N7NmE4Y.mjs +0 -3344
@@ -0,0 +1,1689 @@
1
+ /**
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.11
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { AnomaliesPlugin as e, CommentsPlugin as t, DocumentTitle as o, ExternalLinksPlugin as r, FormatPlugin as n, NamedPlugin as a, ProtectionPlugin as i, SlicerPlugin as s, TablePlugin as l, WorkbookElement as c, a as d, createStudioThemeCSS as p, i as u, n as m, p as g, r as h, registerStudioCommandCatalogs as f, registerStudioCommandGroups as k, renderWorkbookToolbars as b, t as y, tokensToMuiOptions as w } from "./index.mjs";
8
+ import { CommandRootProvider as x, DefaultTaskPaneRegistry as v, LogoNoPaddingIcon as C, SHAPE_ICON_PACK as D, TaskPaneArea as S, TaskPaneProvider as W, ThemeStateDefaults as E, ThemeStateKey as T, WorkbookIO as F, WorkbookProvider as I, buildOOXMLThemeCSS as P, createEditable as R, createSystemColorVars as A, registerMovablePane as j, registerMovableToolbarEntry as N, useDocThemes as M, useModelSync as L, useReferenceModeStore as O, useResolvedWorkbook as $, useTaskPaneArea as B, useWorkbookEncrypted as _, useWorkbookName as K, useWorkbookSaveState as V } from "@sheetxl/react";
9
+ import { Command as z, DefaultIconService as H, DynamicIcon as U, LanguageStateKey as G, NotifierType as q, ReactErrorBoundary as X, ReactNotifierProvider as Y, ReactUtils as Z, ScrollUtils as J, SplitPane as Q, UncaughtErrorBoundary as ee, createBusyHandle as te, useCallbackRef as oe, useFullscreen as re, useImperativeElement as ne, useLanguage as ae, useMeasure as ie, useNotifier as se, usePersistentState as le, useResolvedThemeMode as ce, useTokenThemeContext as de, useTranslator as pe, useVisualViewportRect as ue } from "@sheetxl/utils-react";
10
+ import me, { forwardRef as ge, isValidElement as he, memo as fe, useCallback as ke, useEffect as be, useMemo as ye, useRef as we, useState as xe } from "react";
11
+ import { AnimatedLoadingPanel as ve, AnimatedTraversingEllipsisIcon as Ce, CommandGroup as De, ExhibitFloatProvider as Se, ExhibitTooltip as We, ModalProvider as Ee, SimpleTooltip as Te, StackTrace as Fe, createExhibitTheme as Ie, hideLoadingPanel as Pe, lazyModal as Re, lazyPanel as Ae, showLoadingPanel as je, useInputDialog as Ne, useLazyWindow as Me, useModal as Le, useOptionsDialog as Oe } from "@sheetxl/utils-mui";
12
+ import { Fragment as $e, jsx as Be, jsxs as _e } from "react/jsx-runtime";
13
+ import { Box as Ke, Card as Ve, CardActions as ze, Collapse as He, CssBaseline as Ue, DialogTitle as Ge, IconButton as qe, Paper as Xe, SvgIcon as Ye, Tab as Ze, Tabs as Je, ThemeProvider as Qe, Typography as et, alpha as tt, useMediaQuery as ot, useTheme as rt } from "@mui/material";
14
+ import { CommonUtils as nt, DOMUtils as at, DefaultLanguagePackService as it, ErrorUtils as st, ExpectedError as lt, PartialError as ct, defineLazyModule as dt, formatMessage as pt, messageKey as ut, t as mt } from "@sheetxl/utils";
15
+ import gt from "clsx";
16
+ import { mergeRefs as ht, useMergeRefs as ft } from "react-merge-refs";
17
+ import { SnackbarContent as kt, SnackbarProvider as bt, useSnackbar as yt } from "notistack";
18
+ var wt = Ae(dt("studio:conditionalFormatDetailsTaskPane", () => import("./CZyA9uD4SkTvqp_G.mjs"), { select: (e) => ({ default: e.ConditionalFormatDetailsTaskPane }) }).load), xt = ["lines"], vt = {
19
+ card: "_card_h0jnt_7",
20
+ actionRoot: "_actionRoot_h0jnt_11",
21
+ icons: "_icons_h0jnt_16",
22
+ expand: "_expand_h0jnt_22",
23
+ expandOpen: "_expandOpen_h0jnt_29",
24
+ stackTraceContainer: "_stackTraceContainer_h0jnt_33",
25
+ paper: "_paper_h0jnt_37",
26
+ checkIcon: "_checkIcon_h0jnt_42",
27
+ button: "_button_h0jnt_47"
28
+ }, Ct = fe(ge((e, t) => {
29
+ const { id: o, message: r, iconVariant: n, error: a, hideIconVariant: i, ...s } = e, l = pe(), { closeSnackbar: c } = yt(), [d, p] = xe(!1), u = a ? st.collectErrorChain(a, !0)?.[0]?.error : void 0, m = u && !(u instanceof lt), g = ke(() => {
30
+ p((e) => !e);
31
+ }, []), h = ke(() => {
32
+ c(o);
33
+ }, [o, c]);
34
+ let f = u?.message;
35
+ return !f && he(r) && (f = r), f || "string" != typeof r || (f = r), f || (f = `Unknown Error: ${r}`), Be(kt, {
36
+ ref: t,
37
+ className: gt(vt.root, "error-snackbar"),
38
+ children: _e(Ve, {
39
+ className: vt.card,
40
+ style: {
41
+ backgroundColor: "var(--sxl-color-error)",
42
+ color: "var(--sxl-color-error-content)",
43
+ border: "1px solid var(--sxl-color-error)"
44
+ },
45
+ children: [_e(ze, {
46
+ className: vt.actionRoot,
47
+ children: [
48
+ i ? null : n?.error,
49
+ Be(et, {
50
+ variant: "body2",
51
+ component: "div",
52
+ className: vt.typography,
53
+ children: f
54
+ }),
55
+ Be("div", { style: { flex: "1 1 auto" } }),
56
+ _e("div", {
57
+ className: vt.icons,
58
+ children: [m ? Be(qe, {
59
+ "aria-label": l("toast.showMore"),
60
+ size: "small",
61
+ className: gt(vt.expand, { [vt.expandOpen]: d }),
62
+ onClick: g,
63
+ children: Be(U, { iconKey: "ExpandMore" })
64
+ }) : null, Be(qe, {
65
+ size: "small",
66
+ className: vt.expand,
67
+ onClick: h,
68
+ children: Be(U, {
69
+ iconKey: "Close",
70
+ style: { transform: "scale(0.8)" }
71
+ })
72
+ })]
73
+ })
74
+ ]
75
+ }), m ? Be(He, {
76
+ in: d,
77
+ timeout: "auto",
78
+ children: Be("div", {
79
+ className: vt.stackTraceContainer,
80
+ style: {
81
+ backgroundColor: "color-mix(in srgb, var(--sxl-color-error) 90%, var(--sxl-color-base-100))",
82
+ borderTop: "1px solid var(--sxl-color-error)"
83
+ },
84
+ children: Be(Fe, {
85
+ error: a,
86
+ hideLineNumbers: !0
87
+ })
88
+ })
89
+ }) : null]
90
+ })
91
+ });
92
+ }));
93
+ Ct.displayName = "ToastError";
94
+ var Dt = () => {
95
+ const e = pe();
96
+ return Be(We, {
97
+ label: "SheetXL",
98
+ description: e("logo.description"),
99
+ children: Be(Ke, {
100
+ component: "a",
101
+ href: "https://www.sheetxl.com",
102
+ target: "_blank",
103
+ rel: "noopener noreferrer",
104
+ sx: {
105
+ display: "inline-flex",
106
+ width: "24px",
107
+ height: "24px",
108
+ marginBottom: "4px",
109
+ marginLeft: "6px",
110
+ cursor: "pointer"
111
+ },
112
+ children: Be(C, { style: {
113
+ width: "24px",
114
+ height: "24px"
115
+ } })
116
+ })
117
+ });
118
+ }, St = Be(Dt, {}), Wt = fe(ge((e, t) => {
119
+ const { workbook: o, className: r, logo: n = St, mainElement: a, startElement: i, endElement: s, ...l } = e, [c, { width: d }] = ie(), p = d < 530, u = we(null), m = ft([
120
+ u,
121
+ c,
122
+ t
123
+ ]);
124
+ return Be(Ke, {
125
+ ...l,
126
+ ref: m,
127
+ className: r,
128
+ children: b({
129
+ isCompact: p,
130
+ wrapperSelect: (e) => _e(Ke, {
131
+ sx: {
132
+ display: "grid",
133
+ gridTemplateColumns: "1fr auto 1fr",
134
+ flex: "1",
135
+ alignItems: "stretch",
136
+ gap: (e) => e.spacing(1),
137
+ paddingLeft: (e) => e.spacing(1),
138
+ paddingRight: (e) => e.spacing(1)
139
+ },
140
+ children: [
141
+ _e(Ke, {
142
+ sx: {
143
+ display: "flex",
144
+ flexDirection: "row",
145
+ alignItems: "center",
146
+ justifyContent: "start",
147
+ gap: (e) => e.spacing(.5)
148
+ },
149
+ children: [n, _e(Ke, {
150
+ sx: {
151
+ display: "flex",
152
+ flexDirection: "row",
153
+ alignItems: "center",
154
+ gap: (e) => e.spacing(.25)
155
+ },
156
+ children: [i, e]
157
+ })]
158
+ }),
159
+ Be(Ke, {
160
+ sx: {
161
+ display: "flex",
162
+ flexDirection: "row",
163
+ minWidth: 0,
164
+ overflow: "hidden",
165
+ alignItems: "center",
166
+ justifyContent: "center"
167
+ },
168
+ children: a
169
+ }),
170
+ Be(Ke, {
171
+ sx: {
172
+ display: "flex",
173
+ alignItems: "center",
174
+ justifyContent: "end"
175
+ },
176
+ children: s
177
+ })
178
+ ]
179
+ })
180
+ })
181
+ });
182
+ }));
183
+ Wt.displayName = "StudioToolbar";
184
+ var Et = (e, t) => {
185
+ const o = new URL(window.location.pathname, window.location.origin);
186
+ e && o.searchParams.set("source", e), e && t && o.searchParams.set("title", t), window.open(o.toString(), "sheetxl-" + nt.uuidV4(), "popup=true");
187
+ };
188
+ function Tt(e, t) {
189
+ const { workbook: o, setWorkbook: r, workbookTitle: n = "export", isDirty: a, notifier: i, refSave: s } = t;
190
+ let l = !1;
191
+ const c = async (e = null, t = null, o = null) => {
192
+ const r = [], n = {
193
+ source: e && "string" != typeof e ? e : null,
194
+ typedCreateWorkbookOptions: t ?? void 0,
195
+ onPassword: async ({ origin: e, validate: t }) => {
196
+ const o = await i.showInput({
197
+ title: mt("dialog.password.title"),
198
+ description: mt("dialog.password.open.description", { name: e.getName() ?? "" }),
199
+ inputType: "password",
200
+ options: [{
201
+ id: "Open",
202
+ label: () => mt("dialog.open")
203
+ }, "Cancel"],
204
+ defaultOption: "Open",
205
+ onValidateInput: async (e, o) => void 0 === o ? { valid: !0 } : e ? await t(e) ? { valid: !0 } : {
206
+ valid: !1,
207
+ message: mt("dialog.password.open.retry")
208
+ } : {
209
+ valid: !1,
210
+ message: mt("dialog.password.open.required")
211
+ }
212
+ });
213
+ return "Open" === o?.option ? o.input ?? null : null;
214
+ },
215
+ progress: { onWarning: (e) => {
216
+ r.push(e);
217
+ } }
218
+ };
219
+ let a;
220
+ o && (n.progress.onStart = o);
221
+ let s = -5;
222
+ return F.read({
223
+ ...n,
224
+ progress: {
225
+ async onStart(e, t) {
226
+ await n?.progress?.onStart?.(e, t), a = await i?.showBusy?.(mt("workbook.opening", { name: e?.getName() ?? "" })), t && a?.setProgress?.(0, t);
227
+ },
228
+ onProgress(e, t) {
229
+ if (!t) return;
230
+ const o = Math.min(100, Math.round(e / t * 100));
231
+ if (o >= 100) {
232
+ if (100 === s) return;
233
+ s = 100, a?.setProgress?.(e, t);
234
+ return;
235
+ }
236
+ o - s < 5 || (s = o, a?.setProgress?.(e, t));
237
+ },
238
+ onComplete() {
239
+ a?.(), r.length > 0 && (i.showMessage(mt("workbook.importWarnings")), console.warn("Import warnings:\n" + r.join("\n")));
240
+ },
241
+ onWarning(e, t) {
242
+ n?.progress?.onWarning?.(e, t);
243
+ }
244
+ }
245
+ });
246
+ }, d = async (e, t, o = !1, r) => {
247
+ let a;
248
+ const s = {
249
+ format: t?.key,
250
+ progress: {
251
+ async onStart(e) {
252
+ a = await i?.showBusy?.(mt("workbook.saving", { name: e?.getName() ?? "" }));
253
+ },
254
+ onComplete() {
255
+ a?.();
256
+ }
257
+ },
258
+ onWarnings: r ?? (async ({ warnings: e, origin: t, canCancel: o }) => {
259
+ a?.(), console.warn(`Not written to '${t.getName()}':\n${e.map((e) => ` ${e.message}`).join("\n")}`);
260
+ const r = mt("dialog.writeWarnings.title"), n = t.getFormat(), s = (n ? (await F.getWriteFormats({ search: n }))[0] : void 0)?.description ?? n ?? "", l = mt("dialog.writeWarnings.keep");
261
+ return o ? "Save" === await i.showOptions({
262
+ title: r,
263
+ type: q.Warning,
264
+ description: `${mt("dialog.writeWarnings.confirm", { format: s })}\n\n${l}`,
265
+ options: [{
266
+ id: "Save",
267
+ label: () => mt("dialog.save")
268
+ }, "Cancel"],
269
+ defaultOption: "Cancel"
270
+ }) && (a = await i?.showBusy?.(mt("workbook.saving", { name: t?.getName() ?? "" })), !0) : (i.showOptions({
271
+ title: r,
272
+ type: q.Warning,
273
+ description: `${mt("dialog.writeWarnings.saved", { format: s })}\n\n${l}`,
274
+ options: ["Ok"]
275
+ }), !0);
276
+ })
277
+ };
278
+ let l;
279
+ if (o) {
280
+ const o = e.getOrigin(), r = t?.exts?.[0] ?? (o.getExtension() || "sxl"), a = `${n || o.getName() || mt("workbook.defaultName")}.${r}`;
281
+ l = await F.writeAs(e, a, {
282
+ ...s,
283
+ prompt: !0
284
+ });
285
+ } else l = await F.write(e, void 0, s);
286
+ return l;
287
+ };
288
+ let p = null;
289
+ return e.updateCommand("newWorkbook", { callback: async (e) => {
290
+ const t = F.canRead() && !a();
291
+ e?.source ? t && p ? await p({
292
+ url: e.source,
293
+ title: e.title
294
+ }) : Et(e.source, e.title) : t ? r({}) : Et();
295
+ } }), e.updateCommand("closeWorkbook", { callback: async () => {
296
+ a() && "Close" !== await i.showOptions({
297
+ title: mt("dialog.confirm.title"),
298
+ description: mt("dialog.unsavedChanges"),
299
+ options: [{
300
+ id: "Close",
301
+ label: () => mt("dialog.close")
302
+ }, "Cancel"],
303
+ defaultOption: "Cancel"
304
+ }) || window.close();
305
+ } }), (async () => {
306
+ const t = await F.getWriteFormats();
307
+ if (l) return;
308
+ const n = F.canWrite(), u = F.canRead();
309
+ if (n) {
310
+ const r = (e) => {
311
+ const r = e ? t.find((t) => t.key === e) : void 0;
312
+ d(o, r, !0).catch((e) => i.showError(e));
313
+ };
314
+ e.updateCommand("saveWorkbook", { callback: () => {
315
+ d(o, void 0, !1).catch((e) => i.showError(e));
316
+ } }), s && (s.current = (e) => d(o, void 0, !1, e?.onWarnings)), e.updateCommand("saveWorkbookAs", { callback: (e) => {
317
+ r(e);
318
+ } });
319
+ for (const o of t) {
320
+ const t = o.key;
321
+ e.updateCommand(`saveWorkbookAs${t}`, {
322
+ label: () => mt("command.saveAsFormat.label", { format: o.description }),
323
+ groupLabels: {
324
+ workbook: () => mt("command.saveAsFormat.workbook", { format: o.description }),
325
+ saveWorkbookOptions: () => mt("command.saveAsFormat.compact", { format: o.description })
326
+ },
327
+ tags: o.tags,
328
+ description: () => mt("command.saveAsFormat", { format: o.description }),
329
+ icon: "CSV" === t ? "FileDownloadAsCSV" : "Excel" === t ? "FileDownloadAsExcel" : "FileDownloadAsSheet",
330
+ callback: () => {
331
+ r(t);
332
+ }
333
+ });
334
+ }
335
+ }
336
+ const m = async (e = null) => {
337
+ const t = { csv: {
338
+ date1904: o.getRuntime().isDate1904(),
339
+ ...o.options
340
+ } };
341
+ try {
342
+ let r = "";
343
+ const n = async (e) => {
344
+ r = e?.getName() ?? "";
345
+ }, a = await c(e, t, n);
346
+ if (!a) return;
347
+ const i = a.getWorksheets().getItems();
348
+ await o.doBatch(async () => {
349
+ for (let e = 0; e < i.length; e++) {
350
+ const t = i[e], n = 1 === i.length ? r : t.getName(), a = o.findValidSheetName(n);
351
+ await o.getWorksheets().add({
352
+ name: a,
353
+ autoSelect: e === i.length - 1
354
+ }).getEntireRange().copyFrom(t.getEntireRange());
355
+ }
356
+ }, ut("op.importData")), a.close();
357
+ } catch (e) {
358
+ i.showError(e);
359
+ }
360
+ };
361
+ if (e.updateCommand("insertDataFromFile", {
362
+ tags: ["noTransaction", "noRepeat"],
363
+ callback: async (e = null) => {
364
+ let t = e;
365
+ if (t || F.canRead() || (t = await (async () => {
366
+ const e = await F.getReadFormats(), t = [...new Set(e.flatMap((e) => e.exts))].map((e) => `.${e}`);
367
+ return at.openFileDialog(t.length ? t.join(",") : "*.*");
368
+ })(), t)) return m(t);
369
+ }
370
+ }), e.updateCommand("insertDataFromURL", {
371
+ tags: ["noTransaction", "noRepeat"],
372
+ callback: async (e) => {
373
+ if (!e) {
374
+ const t = await i.showInput({
375
+ title: mt("dialog.importFromWeb.title"),
376
+ description: mt("dialog.importFromWeb.description"),
377
+ inputLabel: mt("dialog.webAddress.inputLabel"),
378
+ initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
379
+ propsInput: { style: { minWidth: "440px" } },
380
+ options: [{
381
+ id: "Import",
382
+ label: () => mt("dialog.import")
383
+ }]
384
+ });
385
+ if ("Import" !== t.option) return;
386
+ e = t.input;
387
+ }
388
+ if (e) try {
389
+ const t = await fetch(e);
390
+ if (!t.ok) throw new Error(`Could not fetch '${e}' (${t.status} ${t.statusText}).`);
391
+ const o = await t.blob(), r = decodeURIComponent(e.split("/").pop()?.split("?")[0] || "") || "import.xlsx";
392
+ await m(new File([o], r, { type: o.type }));
393
+ } catch (e) {
394
+ i.showError(e);
395
+ }
396
+ }
397
+ }), u) {
398
+ const t = async () => !a() || "Open" === await i.showOptions({
399
+ title: mt("dialog.confirm.title"),
400
+ description: mt("dialog.unsavedChanges"),
401
+ options: [{
402
+ id: "Open",
403
+ label: () => mt("dialog.open")
404
+ }, "Cancel"],
405
+ defaultOption: "Cancel"
406
+ }), n = async (e = null) => {
407
+ const t = { csv: {
408
+ date1904: o.getRuntime().isDate1904(),
409
+ ...o.options
410
+ } };
411
+ try {
412
+ const o = await c(e, t);
413
+ if (!o) return;
414
+ r(o);
415
+ } catch (e) {
416
+ i.showError(e);
417
+ }
418
+ };
419
+ e.updateCommand("openWorkbook", { callback: async (e = null) => {
420
+ await t() && await n(e);
421
+ } }), p = async (e) => {
422
+ let o = "string" == typeof e ? e : e?.url;
423
+ const r = "string" == typeof e ? void 0 : e?.title;
424
+ if (!o) {
425
+ const e = await i.showInput({
426
+ title: mt("dialog.openFromWeb.title"),
427
+ description: mt("dialog.openFromWeb.description"),
428
+ inputLabel: mt("dialog.webAddress.inputLabel"),
429
+ initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
430
+ propsInput: { style: { minWidth: "440px" } },
431
+ options: [{
432
+ id: "Open",
433
+ label: () => mt("dialog.open")
434
+ }]
435
+ });
436
+ if ("Open" !== e.option) return;
437
+ o = e.input;
438
+ }
439
+ if (o && await t()) try {
440
+ const e = await fetch(o);
441
+ if (!e.ok) throw new Error(`Could not fetch '${o}' (${e.status} ${e.statusText}).`);
442
+ const t = await e.blob(), a = decodeURIComponent(o.split("/").pop()?.split("?")[0] || "") || "workbook.xlsx", i = a.match(/\.[^/.]+$/)?.[0] ?? "", s = r ? `${r}${i}` : a;
443
+ await n(new File([t], s, { type: t.type }));
444
+ } catch (e) {
445
+ i.showError(e);
446
+ }
447
+ }, e.updateCommand("openWorkbookFromUrl", { callback: p });
448
+ }
449
+ })(), () => {
450
+ l = !0, s && (s.current = null);
451
+ };
452
+ }
453
+ var Ft = Re(dt("studio:shortcutKeysDialog", () => import("./CyafafEgfmjLqE5O.mjs")).load);
454
+ f(), y();
455
+ var It = /* @__PURE__ */ new Set(["ui"]), Pt = (e) => {
456
+ const t = (e) => {
457
+ if ("function" != typeof e) return e;
458
+ try {
459
+ return e();
460
+ } catch {
461
+ return;
462
+ }
463
+ }, o = (e, o) => {
464
+ const r = t(e);
465
+ return "string" == typeof r ? pt(r, o, it.getActive()) : void 0;
466
+ }, r = [];
467
+ for (const n of e.names()) if (!It.has(n)) for (const a of e.keys(n)) {
468
+ const i = e.resolveDefinition(n, a);
469
+ r.push({
470
+ groupKey: n,
471
+ command: {
472
+ getLabel: () => o(i?.label, i?.params) ?? a,
473
+ getIcon: () => t(i?.icon),
474
+ getDescription: () => o(i?.description, i?.params) ?? "",
475
+ getShortcut: () => t(i?.shortcut) ?? null,
476
+ getScope: () => n,
477
+ getScopeLabel: () => z.DefaultCommandCatalogService.getScopeLabel(n)
478
+ }
479
+ });
480
+ }
481
+ return { getAllCommands: () => r };
482
+ }, Rt = (e) => {
483
+ const { children: t, workbook: o, setWorkbook: r, workbookTitle: n, isDirty: a, refSave: i, fullscreenTarget: s } = e, l = z.useCommandScope(), c = se(), { showModal: d } = Le(), p = pe(), u = we(a);
484
+ u.current = a;
485
+ const m = oe(() => {
486
+ const e = l?.getRoot().getRegistry();
487
+ if (!e) return;
488
+ const t = d(Ft, {
489
+ title: p("dialog.shortcutKeys.title"),
490
+ commands: Pt(e),
491
+ onDone: () => t.hide(),
492
+ onLoadError: (e) => {
493
+ t.destroy(), c.showError(e);
494
+ }
495
+ });
496
+ }, [l, d]);
497
+ be(() => {
498
+ if (!l) return;
499
+ const e = l.getRoot().contribution();
500
+ return function(e, t) {
501
+ const o = () => t.showShortcuts();
502
+ e.updateCommand("showKeyboardShortcuts", { callback: o }), e.updateCommand("help", { callback: o });
503
+ for (const [t, o] of Object.entries({
504
+ gotoUrlGithub: "https://github.com/sheetxl/sheetxl",
505
+ gotoUrlDiscord: "https://discord.gg/NTKdwUgK9p",
506
+ gotoUrlDocumentation: "https://www.sheetxl.com/docs",
507
+ gotoUrlIssue: "https://github.com/sheetxl/sheetxl/issues"
508
+ })) e.updateCommand(t, { callback: () => {
509
+ window?.open(o);
510
+ } });
511
+ }(e, { showShortcuts: m }), () => e.remove();
512
+ }, [l, m]);
513
+ const g = ot("(prefers-color-scheme: dark)"), { themeMode: h } = ce(), [f, k] = le(T.Mode, E[T.Mode]), [b, y] = le(T.DarkGrid, E[T.DarkGrid]), [w, x] = le(T.DarkImages, E[T.DarkImages]);
514
+ be(() => {
515
+ if (!l) return;
516
+ const e = l.getRoot().contribution();
517
+ return function(e, t) {
518
+ e.updateCommand("themeMode", {
519
+ state: t.mode ?? null,
520
+ params: { dark: t.isDark },
521
+ icon: t.isDark ? "DarkMode" : "LightMode",
522
+ callback: () => t.setMode(t.isDark ? "light" : "dark")
523
+ }), e.updateCommand("defaultThemeMode", {
524
+ state: !t.mode,
525
+ icon: t.systemDefaultDark ? "SystemDefaultDarkMode" : "SystemDefaultLightMode",
526
+ callback: () => t.setMode(null)
527
+ }), e.updateCommand("enableDarkGrid", {
528
+ state: t.enableDarkGrid,
529
+ callback: () => t.setEnableDarkGrid((e) => !e)
530
+ }), e.updateCommand("enableDarkImages", {
531
+ state: t.enableDarkImages,
532
+ callback: () => t.setEnableDarkImages((e) => !e)
533
+ });
534
+ }(e, {
535
+ mode: f,
536
+ setMode: k,
537
+ isDark: "dark" === f || !f && "dark" === h,
538
+ systemDefaultDark: g,
539
+ enableDarkGrid: b,
540
+ setEnableDarkGrid: y,
541
+ enableDarkImages: w,
542
+ setEnableDarkImages: x
543
+ }), () => e.remove();
544
+ }, [
545
+ l,
546
+ f,
547
+ h,
548
+ g,
549
+ b,
550
+ w,
551
+ k,
552
+ y,
553
+ x
554
+ ]);
555
+ const [v, C] = le(G.Active, null), [D, S] = xe(() => it.getActive());
556
+ be(() => it.addChangeListener(S), []), be(() => {
557
+ v && v !== it.getActive() && it.setActive(v);
558
+ }, [v]), be(() => {
559
+ if (!l) return;
560
+ const e = l.getRoot().contribution();
561
+ return function(e, t) {
562
+ e.updateCommand("language", {
563
+ state: t.active,
564
+ callback: (e) => {
565
+ e && t.setActive(e);
566
+ }
567
+ });
568
+ }(e, {
569
+ active: D,
570
+ setActive: (e) => {
571
+ C(e);
572
+ }
573
+ }), () => e.remove();
574
+ }, [
575
+ l,
576
+ D,
577
+ C
578
+ ]);
579
+ const W = ye(() => ({ current: s ?? null }), [s]), { isFullscreenAvailable: F, isFullscreenEnabled: I, toggleFullscreen: P } = re({ target: W });
580
+ be(() => {
581
+ if (!l) return;
582
+ const e = l.getRoot().contribution();
583
+ return function(e, t) {
584
+ e.updateCommand("fullScreenToggle", {
585
+ state: t.isFullscreenEnabled,
586
+ disabledReasons: t.isFullscreenAvailable ? [] : [ut("reason.fullscreenUnavailable")],
587
+ icon: t.isFullscreenEnabled ? "FullScreenOff" : "FullScreen",
588
+ callback: () => {
589
+ t.toggleFullscreen();
590
+ }
591
+ });
592
+ }(e, {
593
+ isFullscreenAvailable: F,
594
+ isFullscreenEnabled: I,
595
+ toggleFullscreen: P
596
+ }), () => e.remove();
597
+ }, [
598
+ l,
599
+ F,
600
+ I,
601
+ P
602
+ ]);
603
+ const R = B(!0);
604
+ return be(() => {
605
+ if (!l) return;
606
+ const e = l.getRoot().contribution();
607
+ return function(e, t) {
608
+ e.updateCommand("protectWorkbook", {
609
+ tags: ["noTransaction", "noRepeat"],
610
+ callback: () => {
611
+ t("manageProtection", { args: { tab: "workbook" } });
612
+ }
613
+ });
614
+ }(e, (e, t) => R.activate(e, t)), () => e.remove();
615
+ }, [l, R]), be(() => {
616
+ if (!l || !o) return;
617
+ const e = l.getRoot().contribution(), t = Tt(e, {
618
+ workbook: o,
619
+ setWorkbook: r,
620
+ workbookTitle: n ?? void 0,
621
+ isDirty: () => u.current?.() ?? !1,
622
+ notifier: c,
623
+ refSave: i
624
+ });
625
+ return () => {
626
+ t(), e.remove();
627
+ };
628
+ }, [
629
+ l,
630
+ o,
631
+ r,
632
+ n,
633
+ c,
634
+ i
635
+ ]), t;
636
+ };
637
+ Rt.displayName = "StudioCommandProvider";
638
+ var At = ({ renderWorkbook: e }) => {
639
+ const t = z.useCommandResolver(), o = we(null), r = pe(), [n, a] = xe(null), i = ke((e) => {
640
+ const o = e.dataTransfer;
641
+ if (t && o) {
642
+ if ("dragenter" === e.type || "dragover" === e.type) {
643
+ const e = o.types, t = o.items;
644
+ let r = !1;
645
+ for (let e = 0; e < t.length; e++) if (t[e].type.startsWith("image/")) {
646
+ r = !0;
647
+ break;
648
+ }
649
+ r ? a("insertImage") : e.includes("Files") && t.length > 0 ? a("open") : (o.effectAllowed = "none", o.dropEffect = "none");
650
+ } else if ("dragleave" === e.type) {
651
+ const t = e.relatedTarget;
652
+ t && e.currentTarget.contains(t) || a(null);
653
+ }
654
+ e.preventDefault();
655
+ }
656
+ }, [t]), s = oe((e) => {
657
+ e.preventDefault();
658
+ const r = n;
659
+ if (a(null), r && t && (e.stopPropagation(), e.dataTransfer.files && e.dataTransfer.files.length > 0)) {
660
+ const r = e.dataTransfer.files[0];
661
+ if (!r) return;
662
+ if (r?.type?.startsWith("image/")) {
663
+ const n = o.current?.getSheetElement()?.getGridSurface().getPaneFromClient(e.clientX, e.clientY);
664
+ if (!n) return;
665
+ const a = n.getPanePointFromPointer(e.clientX, e.clientY);
666
+ if (!a) return;
667
+ const i = n.toAbsoluteBounds({
668
+ x: a.x ?? 0,
669
+ y: a.y ?? 0,
670
+ width: 0,
671
+ height: 0
672
+ });
673
+ t.execute("insertImageFromFile", {
674
+ file: r,
675
+ options: { bounds: {
676
+ x: i.x,
677
+ y: i.y
678
+ } }
679
+ });
680
+ } else {
681
+ if (!F.canRead()) return;
682
+ const o = e.dataTransfer.items?.[0], n = "undefined" != typeof window && window.isSecureContext ? o?.getAsFileSystemHandle?.() : void 0;
683
+ n ? n.then((e) => t.execute("openWorkbook", "file" === e?.kind ? e : r)).catch(() => t.execute("openWorkbook", r)) : t.execute("openWorkbook", r);
684
+ }
685
+ }
686
+ }, [t, n]), l = ye(() => {
687
+ if (!n) return null;
688
+ const e = "insertImage" === n;
689
+ return Be(Ke, {
690
+ className: "drop-overlay",
691
+ sx: {
692
+ position: "absolute",
693
+ inset: 0,
694
+ zIndex: 1,
695
+ boxSizing: "border-box",
696
+ pointerEvents: "none",
697
+ display: "flex",
698
+ justifyContent: "center",
699
+ alignItems: "center",
700
+ backgroundColor: (e) => tt(e.palette.primary.main, .46),
701
+ outline: (e) => `2px dashed ${e.palette.primary.main}`,
702
+ outlineOffset: "-6px",
703
+ borderRadius: 2
704
+ },
705
+ children: _e(Xe, {
706
+ elevation: 6,
707
+ sx: {
708
+ display: "flex",
709
+ alignItems: "center",
710
+ gap: 1.5,
711
+ px: 3,
712
+ py: 2,
713
+ borderRadius: 2,
714
+ color: "text.primary",
715
+ "& .drop-overlay-icon": { color: "primary.main" }
716
+ },
717
+ children: [Be(U, {
718
+ iconKey: e ? "InsertImage" : "FileOpen",
719
+ className: "drop-overlay-icon",
720
+ size: 32
721
+ }), Be(et, {
722
+ variant: "h6",
723
+ component: "span",
724
+ children: r(e ? "drop.insertImage" : "drop.open")
725
+ })]
726
+ })
727
+ });
728
+ }, [n, r]);
729
+ return _e($e, { children: [e({
730
+ ref: o,
731
+ onDragStart: (e) => {
732
+ if (e.target.src) {
733
+ const t = new Image();
734
+ t.src = e.target.src, e.dataTransfer.setDragImage(t, 1, 1);
735
+ }
736
+ },
737
+ onDragEnter: i,
738
+ onDragLeave: i,
739
+ onDragOver: i,
740
+ onDrop: s
741
+ }), l] });
742
+ }, jt = fe((e) => {
743
+ const { workbook: t, setWorkbook: o, refDocumentTitle: r, titleWorkbook: n, setWorkbookTitle: a, isDirty: i, initialCommandAnchor: s, renderWorkbook: l, refSave: c, host: d } = e;
744
+ return Be(x, {
745
+ initialAnchor: s,
746
+ children: Be(Rt, {
747
+ workbook: t,
748
+ setWorkbook: o,
749
+ workbookTitle: n,
750
+ isDirty: i,
751
+ refSave: c,
752
+ fullscreenTarget: d,
753
+ children: Be(At, { renderWorkbook: l })
754
+ })
755
+ });
756
+ });
757
+ jt.displayName = "CommandsWrapper";
758
+ var Nt = {
759
+ sort: dt("studio:sortDialog", () => import("./XEDcegsv5AGKBfu2.mjs")).load,
760
+ hyperlink: dt("studio:hyperlinkDialog", () => import("./B0bdb_6p7fQI_ivo.mjs")).load,
761
+ find: dt("studio:findReplaceWindow", () => import("./DMXLxp3T0E0SRTQc.mjs")).load,
762
+ tableNew: dt("studio:tableNewDialog", () => import("./4HmLH0bPVJCZLgik.mjs")).load,
763
+ namedDetails: dt("studio:namedReferenceDialog", () => import("./3WghtBXAvCDwcVrq.mjs")).load,
764
+ insertFunction: dt("studio:insertFunctionDialog", () => import("./CYIoK22I6Yvv12_x.mjs")).load,
765
+ resizeHeader: dt("studio:resizeHeaderDialog", () => import("./CjC6s3RUJQNCF7mP.mjs")).load,
766
+ outlineSettings: dt("studio:outlineSettingsDialog", () => import("./DdEzhVqYTrGODXrz.mjs")).load,
767
+ fillSeries: dt("studio:fillSeriesDialog", () => import("./1bf4gn-2vld4BZ9u.mjs")).load,
768
+ workbookStatistics: dt("studio:workbookStatisticsDialog", () => import("./DWqvf4H5F2wMnZ0L.mjs")).load,
769
+ password: dt("studio:passwordDialog", () => import("./D-xqQ5qOSd6WrzwJ.mjs")).load
770
+ }, Mt = ["find"], Lt = fe((e) => {
771
+ const { children: t } = e, o = yt(), r = o ? o.enqueueSnackbar : () => {}, n = o ? o.closeSnackbar : () => {}, a = we(/* @__PURE__ */ new Set()), i = we(null), s = we(null), [l, c] = xe({
772
+ label: null,
773
+ progress: null
774
+ }), d = pe(), p = nt.EmptyObject, u = Me(p), m = Oe(p), g = Ne(p), h = we(!1);
775
+ be(() => {
776
+ if (h.current) return;
777
+ h.current = !0;
778
+ const e = window, t = e.requestIdleCallback ?? ((e) => setTimeout(e, 500)), o = e.cancelIdleCallback ?? clearTimeout, r = t(() => {
779
+ for (const e of Mt) u(e, Nt[e], { prewarm: !0 }).catch(() => {});
780
+ });
781
+ return () => o(r);
782
+ }, []);
783
+ const f = we(/* @__PURE__ */ new Set()), k = ye(() => {
784
+ const e = (e, t) => {
785
+ if (t?.onceKey) {
786
+ if (f.current.has(t.onceKey)) return;
787
+ const e = new Set(f.current);
788
+ e.add(t.onceKey), f.current = e;
789
+ }
790
+ const o = {
791
+ variant: t?.type ?? q.Info,
792
+ anchorOrigin: {
793
+ vertical: "top",
794
+ horizontal: "center"
795
+ },
796
+ preventDuplicate: t?.preventDuplicate,
797
+ persist: t?.persist ?? t?.type === q.Error,
798
+ action: (e) => Be(qe, {
799
+ onClick: () => n(e),
800
+ children: Be(U, { iconKey: "Cancel" })
801
+ })
802
+ };
803
+ t?.enqueueProps && Object.assign(o, t.enqueueProps), e || console.log("message is 'null'", t), r(e ?? "Alert", o);
804
+ };
805
+ return {
806
+ showMessage: e,
807
+ showBusy: (e, t) => {
808
+ const o = Symbol("busy");
809
+ a.current.add(o), s.current = e, null != e && "string" != typeof e && c((t) => t.label === e ? t : {
810
+ ...t,
811
+ label: e
812
+ });
813
+ const r = te(() => {
814
+ a.current.delete(o) && (a.current.size > 0 || (Pe(i.current), s.current = null, c((e) => null === e.label && null === e.progress ? e : {
815
+ label: null,
816
+ progress: null
817
+ })));
818
+ }, (e, t) => {
819
+ const o = t && t > 0 && null != e ? Math.max(0, Math.min(1, e / t)) : null;
820
+ c((e) => e.progress === o ? e : {
821
+ ...e,
822
+ progress: o
823
+ });
824
+ }, (e) => {
825
+ s.current = e, "string" == typeof e ? je(i.current, e) : c((t) => ({
826
+ ...t,
827
+ label: e
828
+ }));
829
+ }), n = je(i.current, "string" == typeof e ? e : void 0);
830
+ return n ? n.then(() => r) : r;
831
+ },
832
+ showWindow: (e, t) => {
833
+ const o = t;
834
+ return t = {
835
+ ...t,
836
+ onKeyDown: (e) => {
837
+ e.isDefaultPrevented() || e.isPropagationStopped() || o?.onKeyDown?.(e);
838
+ }
839
+ }, u(e, Nt[e], t);
840
+ },
841
+ showOptions: m,
842
+ showInput: g,
843
+ showError: (t) => {
844
+ let o, r = q.Error, n = d("error.unknown");
845
+ "string" == typeof t ? n = t : t instanceof Error && (o = t, t.message && (n = d(t.message))), t instanceof ct && (r = q.Info), e(n, {
846
+ type: r,
847
+ enqueueProps: { error: o }
848
+ });
849
+ }
850
+ };
851
+ }, [d]), b = ye(() => Be(ve, {
852
+ ref: i,
853
+ autoStart: !1,
854
+ icon: Be(Ce, { sx: {
855
+ transform: "scale(0.7)",
856
+ marginLeft: "-6px"
857
+ } }),
858
+ panel: !0,
859
+ label: l.label ?? ("string" == typeof s.current ? s.current : void 0),
860
+ progress: l.progress,
861
+ sx: {
862
+ position: "absolute",
863
+ left: "0",
864
+ top: "0",
865
+ width: "100%",
866
+ height: "100%",
867
+ zIndex: "9999",
868
+ pointerEvents: "none"
869
+ }
870
+ }), [l.label, l.progress]);
871
+ return _e(Y, {
872
+ notifier: k,
873
+ children: [b, t]
874
+ });
875
+ });
876
+ Lt.displayName = "StudioNotifierProvider";
877
+ var Ot = "var(--sxl-color-input-border, light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2)))", $t = fe(ge((e, t) => {
878
+ const { children: o, title: r, taskPanes: n, onSelect: a, selected: i, registry: s = v, style: l, iconsOnly: c, side: d = "right", className: p, ...u } = e, m = "right" !== d, g = ae(), h = ye(() => n.map((t) => {
879
+ const o = s.getRegisteredTaskPane(t);
880
+ if (!o) return null;
881
+ let r = o.getIcon?.();
882
+ "string" == typeof r && (r = Be(U, { iconKey: r }));
883
+ const n = t === i, a = r ? Be(Ke, {
884
+ sx: {
885
+ display: "inline-block",
886
+ transform: m ? "rotate(-90deg)" : "rotate(90deg)",
887
+ transformOrigin: "center",
888
+ color: (e) => e.palette.text.secondary
889
+ },
890
+ children: r
891
+ }) : null, l = !r || !c && n, d = Be(Ke, {
892
+ sx: {
893
+ display: "grid",
894
+ gridTemplateColumns: l ? "1fr" : "0fr",
895
+ opacity: l ? 1 : 0,
896
+ transition: (e) => e.transitions.create(["grid-template-columns", "opacity"], { duration: e.transitions.duration.short })
897
+ },
898
+ children: Be(Ke, {
899
+ sx: {
900
+ overflow: "hidden",
901
+ minWidth: 0,
902
+ minHeight: 0
903
+ },
904
+ children: Be(et, {
905
+ component: "div",
906
+ sx: {
907
+ textTransform: "none",
908
+ whiteSpace: "nowrap",
909
+ transform: m ? "rotate(180deg)" : void 0,
910
+ padding: "4px 0px",
911
+ color: (e) => n ? e.palette.primary.main : e.palette.text.secondary
912
+ },
913
+ children: o.getTitle()
914
+ })
915
+ })
916
+ });
917
+ return Be(Ze, {
918
+ value: t,
919
+ label: Be(Te, {
920
+ disableInteractive: !0,
921
+ title: o.getTitle() ?? "",
922
+ placement: "left-start",
923
+ children: _e(Ke, {
924
+ sx: {
925
+ padding: "0px 0px",
926
+ writingMode: m ? "vertical-lr" : "vertical-rl",
927
+ textOrientation: "mixed",
928
+ display: "flex",
929
+ alignItems: "center",
930
+ justifyContent: "space-between",
931
+ minWidth: "0px",
932
+ color: (e) => e.palette.text.secondary
933
+ },
934
+ children: [m ? d : a, m ? a : d]
935
+ })
936
+ }),
937
+ sx: {
938
+ padding: "4px 4px",
939
+ minWidth: "0px",
940
+ minHeight: "0px",
941
+ borderRadius: "4px"
942
+ },
943
+ className: gt("taskpane-strip-item", { "Mui-selected": n }),
944
+ onClick: () => e.onSelect(t)
945
+ }, t);
946
+ }), [
947
+ n,
948
+ i,
949
+ a,
950
+ s,
951
+ m,
952
+ c,
953
+ g
954
+ ]), f = ne(t, () => ({ isTaskPaneStrip: () => !0 }), []), k = ye(() => gt("taskpane-strip", p), [p]);
955
+ return Be(Ke, {
956
+ ref: f,
957
+ className: k,
958
+ sx: {
959
+ paddingLeft: m ? void 0 : "2px",
960
+ paddingRight: m ? "2px" : void 0,
961
+ paddingTop: "4px",
962
+ ...l
963
+ },
964
+ ...u,
965
+ children: Be(Je, {
966
+ orientation: "vertical",
967
+ variant: "scrollable",
968
+ value: i,
969
+ onChange: (e, t) => {
970
+ a(t);
971
+ },
972
+ slotProps: {
973
+ list: { sx: { gap: "2px" } },
974
+ indicator: { sx: {
975
+ left: m ? void 0 : "0px",
976
+ right: m ? void 0 : "unset",
977
+ bottom: m ? "0px" : void 0
978
+ } }
979
+ },
980
+ children: h
981
+ })
982
+ });
983
+ })), Bt = (e) => {
984
+ const { title: t, icon: o, onClose: r, readOnly: n, focused: a, ...i } = e, s = we(null), l = pe();
985
+ return Be(Ge, {
986
+ className: gt({ "Mui-selected": a }),
987
+ sx: {
988
+ display: "flex",
989
+ flex: "1 1 %0",
990
+ color: (e) => e.palette.text.secondary,
991
+ boxSizing: "border-box",
992
+ padding: "0 0",
993
+ transitionProperty: "opacity",
994
+ transitionDuration: (e) => `${e.transitions.duration.shortest}ms`,
995
+ opacity: .7,
996
+ "&.Mui-selected": {
997
+ opacity: 1,
998
+ transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
999
+ },
1000
+ backgroundColor: (e) => tt(e.palette.action.hover, .03),
1001
+ borderBottom: `solid ${Ot} 1px`
1002
+ },
1003
+ ...i,
1004
+ children: _e(Ke, {
1005
+ sx: {
1006
+ display: "flex",
1007
+ flex: "1 1 10%",
1008
+ flexDirection: "row",
1009
+ alignItems: "center",
1010
+ marginTop: (e) => e.spacing(.25),
1011
+ marginBottom: (e) => e.spacing(.25),
1012
+ marginLeft: (e) => e.spacing(1),
1013
+ marginRight: (e) => e.spacing(1)
1014
+ },
1015
+ children: [Be(Ke, {
1016
+ sx: {
1017
+ flex: "1 1 100%",
1018
+ paddingLeft: (e) => e.spacing(1)
1019
+ },
1020
+ children: t
1021
+ }), Be(We, {
1022
+ label: l("taskPane.close"),
1023
+ children: Be(qe, {
1024
+ "aria-label": "close",
1025
+ sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
1026
+ touchRippleRef: s,
1027
+ onPointerDown: (e) => {
1028
+ s.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
1029
+ },
1030
+ onPointerUp: () => {
1031
+ r();
1032
+ },
1033
+ children: Be(U, { iconKey: "Close" })
1034
+ })
1035
+ })]
1036
+ })
1037
+ });
1038
+ }, _t = ge((e, t) => {
1039
+ const { model: o, side: r, ...n } = e, a = rt(), i = `solid ${Ot} 1px`, s = `${a.shape.borderRadius ?? 4}px`, l = `${a.spacing?.(.5) ?? 4}px`;
1040
+ return Be(S, {
1041
+ model: o,
1042
+ ref: t,
1043
+ propsFrame: { style: {
1044
+ border: i,
1045
+ borderRadius: s,
1046
+ marginBottom: l
1047
+ } },
1048
+ alwaysShowStrip: !0,
1049
+ componentTitle: Bt,
1050
+ componentStrip: $t,
1051
+ side: r,
1052
+ ...e,
1053
+ onOpen: () => {
1054
+ e?.onOpen?.();
1055
+ },
1056
+ onClose: () => {
1057
+ e?.onClose?.();
1058
+ },
1059
+ ...n
1060
+ });
1061
+ }), Kt = "_styled-resizer_fdl5y_3", Vt = {}, zt = {
1062
+ flex: "1 1 100%",
1063
+ display: "flex",
1064
+ boxSizing: "border-box"
1065
+ }, Ht = fe(ge((e, t) => {
1066
+ const { mainElement: o, sidebarElement: r, position: n, persistKey: a, onPositionChange: i, className: s, style: l, taskSide: c = "right", ...d } = e, [p, u] = le(a ?? null, Vt), m = rt(), [g, { width: h }] = ie(), f = h > 530 || 0 === h, k = we(null);
1067
+ let b, y, w = null, x = 4, v = 13;
1068
+ f ? w = "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" : (w = "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", x = 13, v = 4);
1069
+ let C, D = o, S = r;
1070
+ const W = "right" !== c, E = f ? "row" : "column", T = W && S ? "before" : "after", F = `${E}:${T}`, I = a ? p[F] : void 0, P = null != I ? `${I}%` : ((e, t) => {
1071
+ if (null == e) return "40%";
1072
+ if ("number" == typeof e || "string" == typeof e) return e;
1073
+ const o = e[t];
1074
+ return null != o ? `${o}%` : "40%";
1075
+ })(n, F), R = a || i ? (e) => {
1076
+ a && u((t) => ({
1077
+ ...t,
1078
+ [F]: e.percent
1079
+ })), i?.(e, {
1080
+ orientation: E,
1081
+ side: T,
1082
+ key: F
1083
+ });
1084
+ } : void 0;
1085
+ W && S ? (D = r, S = o, y = { style: {
1086
+ flexDirection: "column",
1087
+ boxSizing: "border-box",
1088
+ paddingRight: "2px"
1089
+ } }, b = {}, C = {
1090
+ fixedPane: "before",
1091
+ position: P,
1092
+ minBefore: f ? "280px" : "120px",
1093
+ splitDirection: f ? "row" : "column"
1094
+ }) : (b = { style: {
1095
+ flexDirection: "column",
1096
+ marginRight: r ? void 0 : "6px"
1097
+ } }, y = { style: {
1098
+ marginLeft: f ? "0px" : "4px",
1099
+ marginRight: f ? "8px" : "4px"
1100
+ } }, C = {
1101
+ fixedPane: "after",
1102
+ position: P,
1103
+ minAfter: f ? "280px" : "120px",
1104
+ splitDirection: f ? "row" : "column"
1105
+ });
1106
+ const A = ft([
1107
+ k,
1108
+ g,
1109
+ t
1110
+ ]);
1111
+ return Be(Q, {
1112
+ ref: A,
1113
+ className: s,
1114
+ style: l ? {
1115
+ ...zt,
1116
+ ...l
1117
+ } : zt,
1118
+ ...d,
1119
+ ...C,
1120
+ onPositionChange: R,
1121
+ propsResizer: {
1122
+ className: gt("styled-resizer", Kt),
1123
+ style: {
1124
+ minWidth: f ? "7px" : void 0,
1125
+ minHeight: f ? void 0 : "6px",
1126
+ maskImage: `url("data:image/svg+xml,%3Csvg width='${x}' height='${v}' viewBox='0 0 ${x} ${v}' version='1.1' fill='${m.palette.text.icon ?? m.palette.action.active}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='${w}' /%3E%3C/svg%3E%0A")`,
1127
+ maskRepeat: "no-repeat",
1128
+ maskPosition: W ? f ? "center center" : "bottom center" : f ? "left center" : "top center"
1129
+ }
1130
+ },
1131
+ elementBefore: D,
1132
+ propsPaneBefore: b,
1133
+ elementAfter: S,
1134
+ propsPaneAfter: y
1135
+ });
1136
+ }));
1137
+ Ht.displayName = "StudioSplitPane";
1138
+ var Ut = () => Be("div", { style: {
1139
+ flex: "none",
1140
+ height: 0,
1141
+ borderTop: "solid var(--sxl-color-base-border, light-dark(rgba(0, 0, 0, 0.26), rgba(255, 255, 255, 0.3))) 1px"
1142
+ } }), Gt = (e, t) => {
1143
+ const o = (e) => Be(me.Fragment, { children: t[e] }, e);
1144
+ if ("bottom" === e) {
1145
+ const e = t.statusBar && t.formulaBar ? Be(Ut, {}, "divider") : null;
1146
+ return [
1147
+ o("toolbar"),
1148
+ o("main"),
1149
+ o("statusBar"),
1150
+ e,
1151
+ o("formulaBar")
1152
+ ];
1153
+ }
1154
+ return [
1155
+ o("toolbar"),
1156
+ o("formulaBar"),
1157
+ o("main"),
1158
+ o("statusBar")
1159
+ ];
1160
+ }, qt = Ae(dt("studio:dataValidationDetailsTaskPane", () => import("./CvRbu8JPxFarsSR-.mjs"), { select: (e) => ({ default: e.DataValidationDetailsTaskPane }) }).load);
1161
+ l(), N("shape", {
1162
+ key: "changeShapeGallery",
1163
+ render: (e) => Be(g, {
1164
+ ...e,
1165
+ commandKey: "changeShape",
1166
+ excludeCategories: xt
1167
+ })
1168
+ }, {
1169
+ order: -1,
1170
+ divider: "after"
1171
+ }), j("shape", () => import("./BPzcW4BejRqso338.mjs").then((e) => e.ShapeFormatPanel)), j("chart", () => import("./zITjZ7R4raDqhP-n.mjs").then((e) => e.ChartFormatPanel)), N("picture", {
1172
+ key: "changePictureOptions",
1173
+ defaultKey: "changePictureFromFile",
1174
+ members: ["changePictureFromFile", "changePictureFromURL"]
1175
+ }, {
1176
+ order: -1,
1177
+ divider: "after"
1178
+ }), s(), H.register("plugin-table", { icons: {} }), v.registerTaskPane({
1179
+ key: "dataValidationDetails",
1180
+ getTitle: () => "Data Validation",
1181
+ getIcon: () => "DataValidation",
1182
+ component: qt
1183
+ }, !0), v.registerTaskPane({
1184
+ key: "conditionalFormatDetails",
1185
+ getTitle: () => "Conditional Formatting",
1186
+ getIcon: () => "FormatPaint",
1187
+ component: wt
1188
+ }, !0), i(), a(), r(), t(), e(), n(), k();
1189
+ var Xt = () => {
1190
+ let e, t;
1191
+ const o = new Promise((o, r) => {
1192
+ e = o, t = r;
1193
+ }), r = {
1194
+ promise: o,
1195
+ settled: !1,
1196
+ resolve: (t) => {
1197
+ r.settled = !0, e(t);
1198
+ },
1199
+ reject: (e) => {
1200
+ r.settled = !0, t(e);
1201
+ }
1202
+ };
1203
+ return o.catch(() => {}), r;
1204
+ }, Yt = (e, t) => {
1205
+ if (!e) return {};
1206
+ const { colorSchemes: o, ...r } = e, n = o?.[t ? "dark" : "light"];
1207
+ return n && "object" == typeof n ? nt.deepMerge(r, n) : r;
1208
+ }, Zt = "taskPanePosition", Jt = fe(ge((e, t) => {
1209
+ const { host: r, scopeClass: n, square: a, elevation: i, variant: s, onWorkbookLoad: l, prefetch: g, onDocumentError: f, renderDocumentError: k = m, propsDocumentError: b, propsTaskPaneArea: y, renderTaskPaneArea: x = Qt, taskPaneSide: v = "right", onKeyDown: C, workbook: S, onWorkbookChange: j, logo: N, topLeft: B, topRight: q, muiTheme: Y, tokens: Q, cssBaseline: te, autoFocus: re = !1, title: ae, onDirtyChange: ie, propsDocumentTitle: se, renderDocumentLoading: pe = u, propsDocumentLoading: me, propsWorkbook: ge, showFormulaBar: he, propsFormulaBar: fe, renderFormulaBar: ve, formulaBarPlacement: Ce, manageVisualViewport: We = !0, editable: Te, showStatusBar: Fe, propsStatusBar: Pe, renderStatusBar: Re, propsToolbar: Ae, renderToolbar: je } = e, Ne = we(null), Me = we(null), Le = we(null), Oe = oe(() => {
1210
+ Le.current?.getNamedCollectionEditorElement?.()?.focus?.();
1211
+ }, []), Ve = ((e, t = "undefined" == typeof window ? "mouse" : Z.detectIt().primaryInput) => "top" === e || "bottom" === e ? e : "touch" === t ? "bottom" : "top")(Ce), ze = "bottom" === Ve && We, He = ue(ze), Ge = He ? Math.max(0, Math.round(window.innerHeight - He.height)) : 0, qe = He ? Math.round(He.offsetTop) : 0, Ze = He?.height;
1212
+ be(() => {
1213
+ ze && void 0 !== Ze && (0 === window.scrollX && 0 === window.scrollY || window.scrollTo(0, 0));
1214
+ }, [ze, Ze]);
1215
+ const Je = oe(f ?? (() => {}), [f]), et = oe(ie ?? (() => {}), [ie]), tt = se?.placeHolder, [ot] = le(T.Mode, E[T.Mode]), { themeMode: rt } = ce({ mode: ot ?? void 0 }), [at] = le(G.Active, null), st = we(at);
1216
+ st.current = at;
1217
+ const lt = de(), ct = ye(() => ({
1218
+ light: Ie(!1, nt.deepMerge(Yt(Y, !1), w(lt?.light))),
1219
+ dark: Ie(!0, nt.deepMerge(Yt(Y, !0), w(lt?.dark)))
1220
+ }), [
1221
+ Y,
1222
+ lt?.light,
1223
+ lt?.dark
1224
+ ]), dt = "dark" === rt, pt = ye(() => p(ct.light, ct.dark, `.${n}`, Q), [
1225
+ ct,
1226
+ n,
1227
+ Q
1228
+ ]), ut = ye(() => P("sxl-defaults", `.${n}`), [n]), mt = M(), [gt, ft] = xe(() => S ?? null);
1229
+ be(() => {
1230
+ ft(S ?? null);
1231
+ }, [S]);
1232
+ const [kt, yt] = xe(0), wt = we(null);
1233
+ wt.current || (wt.current = Xt());
1234
+ const xt = $(gt, {
1235
+ io: F,
1236
+ defaultTheme: mt.getDefaultTheme(),
1237
+ reloadKey: kt
1238
+ }), vt = "loaded" === xt.status ? xt.workbook : null, Dt = ye(() => "error" === xt.status ? {
1239
+ status: "error",
1240
+ error: xt.error
1241
+ } : "loaded" === xt.status ? {
1242
+ status: "loaded",
1243
+ workbook: xt.workbook
1244
+ } : { status: "loading" }, [xt]);
1245
+ be(() => {
1246
+ wt.current.settled && (wt.current = Xt());
1247
+ }, [gt, kt]), be(() => {
1248
+ if ("loaded" === Dt.status) {
1249
+ const e = wt.current, t = Dt.workbook;
1250
+ t.whenFontsReady().then(() => e.resolve(t), () => e.resolve(t));
1251
+ } else "error" === Dt.status && (Je?.(Dt.error), wt.current.reject(Dt.error));
1252
+ }, [Dt]);
1253
+ const [St, Et] = xe(null);
1254
+ vt && !St && Et(vt);
1255
+ const Tt = vt && St && vt !== St ? vt : null, Ft = we(Tt);
1256
+ Ft.current = Tt;
1257
+ const It = we(St);
1258
+ It.current = St;
1259
+ const Pt = we([]), Rt = ke((e) => {
1260
+ const t = It.current;
1261
+ t && Pt.current.push(t), ft(e);
1262
+ }, []);
1263
+ be(() => {
1264
+ const e = Pt.current;
1265
+ if (0 !== e.length) {
1266
+ Pt.current = e.filter((e) => e === St);
1267
+ for (let t = 0; t < e.length; t++) {
1268
+ const o = e[t];
1269
+ if (o !== St) try {
1270
+ o.close();
1271
+ } catch (e) {
1272
+ console.warn("Unable to close the replaced workbook", e);
1273
+ }
1274
+ }
1275
+ }
1276
+ }, [St]);
1277
+ const At = Te ? null : St, Nt = O(), Mt = ye(() => {
1278
+ const e = At?.getSelectedWorksheet() ?? At?.getWorksheets().getItems({ visibility: "veryHidden" })[0];
1279
+ return e ? R(e, { referenceMode: Nt }) : null;
1280
+ }, [At, Nt]), Ot = Te ?? Mt, $t = we(Ot);
1281
+ $t.current = Ot, be(() => {
1282
+ if (!Ot) return;
1283
+ let e = Ot.getSession();
1284
+ return Ot.subscribe(() => {
1285
+ const t = e;
1286
+ e = Ot.getSession(), t && !e && "formula-bar" === t.getActiveEditorId() && Le.current?.contains?.(document.activeElement) && Ne.current?.focus();
1287
+ });
1288
+ }, [Ot]);
1289
+ const Bt = K(St), { isDirty: _t, saveState: Kt } = V(St, F), Vt = _(St), zt = we(Kt), Ut = we(null);
1290
+ zt.current = Kt;
1291
+ const qt = ke(() => zt.current?.isDirty() ?? !1, []), Jt = we(Dt);
1292
+ Jt.current = Dt;
1293
+ const [eo, to] = xe(null), oo = ae ?? se?.title, [ro, no] = xe(null);
1294
+ be(() => {
1295
+ no(null);
1296
+ }, [St]);
1297
+ const ao = oo ?? ro ?? Bt ?? "";
1298
+ be(() => {
1299
+ et?.(_t);
1300
+ }, [_t]);
1301
+ const io = oe(j ?? (() => {}), [j]);
1302
+ be(() => {
1303
+ io?.(vt);
1304
+ }, [vt]);
1305
+ const so = we(vt);
1306
+ so.current = vt, L(St, "onViewChange");
1307
+ const lo = ye(() => Be(De, {
1308
+ groupKey: "helpOptions",
1309
+ disableHover: !0,
1310
+ sx: { padding: "0" },
1311
+ propsButton: { sx: { maxHeight: "22px" } }
1312
+ }), []), [co, po] = xe(null), uo = ke((e) => {
1313
+ po(e);
1314
+ }, []);
1315
+ be(() => {
1316
+ H.prefetch([H.getActive(), D]).catch((e) => {
1317
+ console.warn("Icons could not be loaded:", e);
1318
+ });
1319
+ }, []);
1320
+ const mo = we(null);
1321
+ mo.current || (mo.current = Xt());
1322
+ const go = we(null), ho = ke(() => go.current?.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? mo.current.promise, []), fo = oe(async (e) => {
1323
+ const t = st.current;
1324
+ t && t !== it.getActive() && await it.setActive(t), await z.DefaultCommandCatalogService.prefetch(t ?? void 0), to(e), go.current = e.source, mo.current.settled || mo.current.resolve(e.source.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? null), l?.(e);
1325
+ }, []), ko = we(null), bo = ke((e) => {
1326
+ let t = null, r = {
1327
+ readOnly: !0,
1328
+ ...se
1329
+ };
1330
+ return se?.hidden || (t = Be(o, {
1331
+ ...r,
1332
+ style: {
1333
+ maxWidth: "100%",
1334
+ ...se?.style
1335
+ },
1336
+ workbook: e.workbook ?? Ne.current,
1337
+ ref: ko,
1338
+ title: ao,
1339
+ modified: _t,
1340
+ encrypted: Vt,
1341
+ placeHolder: tt,
1342
+ onTitleChange: (e) => {
1343
+ no(e), se?.onTitleChange?.(e);
1344
+ }
1345
+ })), Be(Wt, {
1346
+ ...e,
1347
+ logo: N,
1348
+ mainElement: t,
1349
+ startElement: B,
1350
+ endElement: q
1351
+ });
1352
+ }, [
1353
+ N,
1354
+ ao,
1355
+ _t,
1356
+ Vt,
1357
+ se,
1358
+ B,
1359
+ q
1360
+ ]);
1361
+ be(() => {
1362
+ const e = Ne.current;
1363
+ if (!e) return;
1364
+ const t = (t) => {
1365
+ (t.ctrlKey || t.metaKey || "native" !== J.getWheelOwner(t, e)) && t.preventDefault();
1366
+ };
1367
+ return e.addEventListener("wheel", t, { passive: !1 }), () => {
1368
+ e.removeEventListener("wheel", t);
1369
+ };
1370
+ }, [eo]);
1371
+ const [yo, wo] = xe(null);
1372
+ be(() => {
1373
+ wo(eo?.source?.getCommandScope?.() ?? null);
1374
+ }, [eo]);
1375
+ const xo = ye(() => ({
1376
+ "& .SnackbarContainer-root": { position: "absolute !important" },
1377
+ "& .notistack-SnackbarContainer > div": { maxWidth: "min(100%, 720px)" },
1378
+ "& .notistack-Snackbar": { minWidth: "unset" },
1379
+ "& .notistack-Snackbar > .error-snackbar .MuiTypography-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
1380
+ "& .notistack-Snackbar > .error-snackbar .MuiCardActions-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
1381
+ "& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
1382
+ "& .notistack-MuiContent *": { fontFamily: (e) => e.typography.fontFamily },
1383
+ "& #notistack-snackbar": {
1384
+ maxWidth: "560px",
1385
+ whiteSpace: "pre-wrap"
1386
+ },
1387
+ "*": { userSelect: "none" }
1388
+ }), []), [vo, Co] = xe(null), [, Do] = le(null, !1);
1389
+ be(() => {
1390
+ Do(null != vo);
1391
+ }, [vo, Do]);
1392
+ const So = ke((e) => x({
1393
+ model: St,
1394
+ side: v,
1395
+ ...e,
1396
+ ...y
1397
+ }), [
1398
+ St,
1399
+ v,
1400
+ y
1401
+ ]), Wo = we(r);
1402
+ Wo.current = r, ne(t, () => ({
1403
+ isStudioElement: () => !0,
1404
+ save: (e) => {
1405
+ const t = Ut.current;
1406
+ return t ? t(e) : Promise.reject(/* @__PURE__ */ new Error("The studio cannot save: no workbook, or the backing store cannot write."));
1407
+ },
1408
+ getWorkbookElement: () => Ne.current,
1409
+ getWorkbook: () => so.current ?? null,
1410
+ isDirty: () => zt.current?.isDirty() ?? !1,
1411
+ getEditable: () => $t.current,
1412
+ getFormulaBarElement: () => Le.current ?? null,
1413
+ focus: () => Ne.current?.focus(),
1414
+ whenReady: () => (wt.current || (wt.current = Xt()), wt.current.promise),
1415
+ getWorkbookState: () => Jt.current,
1416
+ retry: () => yt((e) => e + 1)
1417
+ }), [], r);
1418
+ const Eo = we(!1), To = oe((e, t) => {
1419
+ t === Ft.current && requestAnimationFrame(() => requestAnimationFrame(() => {
1420
+ t === Ft.current && (Eo.current = Wo.current?.contains(document.activeElement) ?? !0, Et(t), fo(e));
1421
+ }));
1422
+ }, []);
1423
+ be(() => {
1424
+ Eo.current && (Eo.current = !1, Ne.current?.focus());
1425
+ }, [St]);
1426
+ const Fo = ke(() => Be($e, {}), []), Io = ke((e) => {
1427
+ const { ref: t, ...o } = e, r = dt ? ct.dark : ct.light, n = "error" === Dt.status ? k({
1428
+ ...b,
1429
+ style: {
1430
+ width: "100%",
1431
+ height: "100%",
1432
+ ...b?.style
1433
+ },
1434
+ error: Dt.error
1435
+ }) : null;
1436
+ if (n && !St) return Be(Xe, {
1437
+ style: {
1438
+ width: "100%",
1439
+ height: "100%",
1440
+ position: "absolute",
1441
+ display: "flex",
1442
+ alignItems: "stretch",
1443
+ justifyContent: "stretch"
1444
+ },
1445
+ children: n
1446
+ });
1447
+ let l = null;
1448
+ if (St) {
1449
+ const e = St, n = e.getView(), a = he ?? n?.isShowFormulaBar(), i = Fe ?? n?.isShowStatusBar(), s = eo?.source ?? Ne.current, p = (je ?? bo)({
1450
+ workbook: s,
1451
+ ...Ae
1452
+ }), u = "bottom" === Ve, m = a ? (ve ?? h)({
1453
+ ref: Le,
1454
+ style: {
1455
+ marginTop: r.spacing(u ? .5 : .25),
1456
+ marginLeft: r.spacing(1),
1457
+ marginRight: r.spacing(1),
1458
+ marginBottom: r.spacing(u ? .5 : .75)
1459
+ },
1460
+ workbook: e,
1461
+ editable: Ot ?? void 0,
1462
+ placement: Ve,
1463
+ ...fe,
1464
+ propsNamedCollectionEditor: {
1465
+ restoreFocus: (e) => s?.focus(e),
1466
+ ...fe?.propsNamedCollectionEditor
1467
+ }
1468
+ }) : null, f = i ? (Re ?? d)({
1469
+ childrenEnd: lo,
1470
+ ...Pe
1471
+ }) : null, k = (e, r) => Be(c, {
1472
+ ...ge,
1473
+ tabIndex: 0,
1474
+ autoFocus: !r && re,
1475
+ workbook: e,
1476
+ editable: r ? void 0 : Ot ?? void 0,
1477
+ focusNameBox: r ? void 0 : Oe,
1478
+ prefetch: !r && g,
1479
+ ref: r ? Me : ht([t, Ne]),
1480
+ onWorkbookLoad: r ? (t) => To(t, e) : fo,
1481
+ onKeyDown: (e) => {
1482
+ C?.(e);
1483
+ },
1484
+ propsWorkbookLoading: me,
1485
+ renderWorkbookLoading: Fo,
1486
+ style: r ? {
1487
+ ...ge?.style,
1488
+ position: "absolute",
1489
+ inset: 0,
1490
+ visibility: "hidden"
1491
+ } : {
1492
+ flex: "1 1 100%",
1493
+ minHeight: 0,
1494
+ ...ge?.style
1495
+ },
1496
+ onContextMenu: (e) => e.preventDefault(),
1497
+ ...r ? null : o
1498
+ }, e.getId());
1499
+ l = Be("div", {
1500
+ style: {
1501
+ display: "flex",
1502
+ flexDirection: "column",
1503
+ flex: "1 1 100%",
1504
+ minWidth: 0,
1505
+ minHeight: 0,
1506
+ ...A({
1507
+ window: r.palette.background.default,
1508
+ windowText: r.palette.text.primary
1509
+ })
1510
+ },
1511
+ children: Gt(Ve, {
1512
+ toolbar: p,
1513
+ formulaBar: m,
1514
+ statusBar: f,
1515
+ main: Be(Ht, {
1516
+ taskSide: v,
1517
+ persistKey: Zt,
1518
+ sidebarElement: vo ? Be(z.CommandScopeProvider, {
1519
+ scope: yo,
1520
+ children: vo
1521
+ }) : void 0,
1522
+ mainElement: _e("div", {
1523
+ style: {
1524
+ position: "relative",
1525
+ display: "flex",
1526
+ flexDirection: "column",
1527
+ flex: "1 1 100%",
1528
+ minWidth: 0,
1529
+ minHeight: 0
1530
+ },
1531
+ children: [[k(St, !1), Tt ? k(Tt, !0) : null], Be(Ke, {
1532
+ ref: uo,
1533
+ sx: {
1534
+ position: "absolute",
1535
+ top: "10%",
1536
+ left: 0,
1537
+ right: 0,
1538
+ bottom: 0,
1539
+ pointerEvents: "none",
1540
+ "& > :first-of-type": { position: "relative" }
1541
+ }
1542
+ })]
1543
+ })
1544
+ })
1545
+ })
1546
+ });
1547
+ }
1548
+ const p = eo ? null : pe({ ...me });
1549
+ return _e(Xe, {
1550
+ sx: xo,
1551
+ style: {
1552
+ width: "100%",
1553
+ height: Ge ? `calc(100% - ${Ge}px)` : "100%",
1554
+ transform: qe ? `translateY(${qe}px)` : void 0,
1555
+ overscrollBehavior: ze ? "none" : void 0,
1556
+ position: "absolute",
1557
+ display: "flex",
1558
+ alignItems: "stretch",
1559
+ justifyContent: "stretch",
1560
+ backgroundColor: "var(--sxl-color-base-200)"
1561
+ },
1562
+ className: "eager-studio",
1563
+ square: a,
1564
+ elevation: i,
1565
+ variant: s,
1566
+ children: [
1567
+ l,
1568
+ n ? Be(Xe, {
1569
+ style: {
1570
+ position: "absolute",
1571
+ inset: 0,
1572
+ display: "flex",
1573
+ alignItems: "stretch",
1574
+ justifyContent: "stretch"
1575
+ },
1576
+ children: n
1577
+ }) : null,
1578
+ p ? Be("div", {
1579
+ style: {
1580
+ position: "absolute",
1581
+ inset: 0,
1582
+ display: "flex",
1583
+ alignItems: "center",
1584
+ justifyContent: "center",
1585
+ background: `var(--sxl-color-base-100, ${dt ? "#121212" : "#fff"})`
1586
+ },
1587
+ children: p
1588
+ }) : null
1589
+ ]
1590
+ });
1591
+ }, [
1592
+ Dt,
1593
+ St,
1594
+ Tt,
1595
+ eo,
1596
+ ao,
1597
+ pe,
1598
+ me,
1599
+ Fo,
1600
+ ge,
1601
+ a,
1602
+ i,
1603
+ s,
1604
+ lo,
1605
+ k,
1606
+ b,
1607
+ bo,
1608
+ xo,
1609
+ vo,
1610
+ v,
1611
+ yo,
1612
+ he,
1613
+ fe,
1614
+ ve,
1615
+ Ve,
1616
+ Ot,
1617
+ Fe,
1618
+ Pe,
1619
+ Re,
1620
+ Ae,
1621
+ je,
1622
+ ze,
1623
+ Ge,
1624
+ qe,
1625
+ ct,
1626
+ dt
1627
+ ]);
1628
+ let Po = Be(bt, {
1629
+ maxSnack: 3,
1630
+ domRoot: co ?? void 0,
1631
+ anchorOrigin: {
1632
+ vertical: "bottom",
1633
+ horizontal: "right"
1634
+ },
1635
+ autoHideDuration: 3500,
1636
+ onClose: (e, t, o) => {
1637
+ Ne.current?.focus();
1638
+ },
1639
+ Components: { error: Ct },
1640
+ iconVariant: {
1641
+ success: Be(Ye, {
1642
+ style: { marginRight: "8px" },
1643
+ children: Be("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" })
1644
+ }),
1645
+ error: Be(U, {
1646
+ iconKey: "ErrorAlert",
1647
+ style: { marginRight: "8px" }
1648
+ })
1649
+ },
1650
+ children: Be(I, {
1651
+ workbook: St,
1652
+ children: Be(W, {
1653
+ renderArea: So,
1654
+ onUpdateArea: (e) => {
1655
+ Co(e);
1656
+ },
1657
+ children: Be(Ee, { children: Be(Lt, { children: Be(ee, { children: Be(X, { children: Be(jt, {
1658
+ workbook: St,
1659
+ initialCommandAnchor: ho,
1660
+ renderWorkbook: Io,
1661
+ setWorkbook: Rt,
1662
+ titleWorkbook: ao,
1663
+ setWorkbookTitle: no,
1664
+ refDocumentTitle: ko,
1665
+ isDirty: qt,
1666
+ refSave: Ut,
1667
+ host: r
1668
+ }) }) }) }) })
1669
+ })
1670
+ })
1671
+ });
1672
+ return Po = _e(Qe, {
1673
+ theme: dt ? ct.dark : ct.light,
1674
+ children: [
1675
+ te ? Be(Ue, {}) : null,
1676
+ Be("style", { children: pt }),
1677
+ Be("style", { children: ut }),
1678
+ Be(Se, {
1679
+ themeScopeClass: n,
1680
+ themeSurface: "app",
1681
+ themeMode: rt,
1682
+ children: Po
1683
+ })
1684
+ ]
1685
+ }), Po;
1686
+ }));
1687
+ Jt.displayName = "EagerStudio";
1688
+ var Qt = (e) => Be(_t, { ...e });
1689
+ export { Jt as EagerStudio, Jt as default };