@sheetxl/studio-mui 0.7.28-beta.4 → 0.8.0-beta.10

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 (243) hide show
  1. package/browser/esm/{Drbpg4A9TaJUZd5A.mjs → 5cbK03T_Oh3tNdR7.mjs} +7 -5
  2. package/browser/esm/{GCJRjX28QYfxi-Lg.mjs → 9eKCkvqpMQwqcXiw.mjs} +1 -1
  3. package/browser/esm/B1Yp_uy1vFHcJB3U.mjs +13 -0
  4. package/browser/esm/Biy7bhzzzPb5sfRN.mjs +152 -0
  5. package/browser/esm/Blaj2R5hYxtLAW__.mjs +117 -0
  6. package/browser/esm/{CVxEcB8lAnOQ-oPh.mjs → ByeL_BZuJ2kl8gtf.mjs} +46 -47
  7. package/browser/esm/{BLjxQ1NUjmULb00s.mjs → C1Rp2hZrApo5MUc8.mjs} +2 -2
  8. package/browser/esm/{C7WFuxTBA8MWoOQj.mjs → CEvZe2cZK-voZTif.mjs} +5 -5
  9. package/browser/esm/{RbGJTMzxMTlkFlTq.mjs → CIu1bjPJe_x31Oww.mjs} +195 -174
  10. package/browser/esm/COv-m-c2byCgvU3M.mjs +14861 -0
  11. package/browser/esm/CjznclrKqJRi7u9O.mjs +77 -0
  12. package/browser/esm/{DoOWIBDSfgrvMmNO.mjs → CoSiOS-og0zFw4Ws.mjs} +587 -556
  13. package/browser/esm/{6GrWBX-cyxTRJerw.mjs → CtEFHbzYNvYjDYvi.mjs} +7 -7
  14. package/browser/esm/D6S8kVTzOjCn0-SK.mjs +627 -0
  15. package/browser/esm/{BVC0iuc28yuEcyua.mjs → D8al_cJ4U-NgzwoK.mjs} +1 -1
  16. package/browser/esm/DBtc4lku0uHVcqWn.mjs +71 -0
  17. package/browser/esm/{CDyYtk9WscSzj5I5.mjs → DHY19rkSiiRZxShC.mjs} +130 -103
  18. package/browser/esm/{DdbgnOWM0tle1jeT.mjs → DU3J8Gcf-WpBxNYg.mjs} +11 -10
  19. package/browser/esm/Die9NXVFveHvcCT-.mjs +4205 -0
  20. package/browser/esm/{CccE_2DTbTMNIfQM.mjs → DmCQbW4zwkT_Rq88.mjs} +1 -1
  21. package/browser/esm/IQLeaAbtGTipUsOD.mjs +516 -0
  22. package/browser/esm/{DhMl3LbgjdX8Nz7b.mjs → X1Db3b_7b_7OuCk6.mjs} +178 -129
  23. package/browser/esm/fb126BNj3F8URR19.mjs +225 -0
  24. package/browser/esm/index.mjs +418 -135
  25. package/browser/esm/sFOAxZpxXo-qvDSp.mjs +293 -0
  26. package/browser/esm/sam1KGQZ59B_fADz.mjs +1941 -0
  27. package/browser/esm/xKiLJKiLxto8SayF.mjs +256 -0
  28. package/browser/esm/yZxC4qUENOlMhVUH.mjs +68 -0
  29. package/licenses/dependencies.txt +58 -311
  30. package/node/esm/B8SQfjKjzYHLxzZR.mjs +632 -0
  31. package/node/esm/{CgA8rdWVZEpIUpsM.mjs → BYVLi0md4AYuDsB_.mjs} +1 -1
  32. package/node/esm/BYsG3KYVmxSe_CIQ.mjs +294 -0
  33. package/node/esm/BYwXhrEwkRAt9nJS.mjs +71 -0
  34. package/node/esm/B_jRGdwGFkudwmL-.mjs +68 -0
  35. package/node/esm/Bb1sLMqXWKjdve23.mjs +77 -0
  36. package/node/esm/{ELTc6e1FF88hBAev.mjs → BcwMb6CyVfvEwbHn.mjs} +69 -70
  37. package/node/esm/{DYlYrd0A73WoQQgM.mjs → CKu1AtRgyltyEdEN.mjs} +1 -1
  38. package/node/esm/Cmt8Wv806N7NmE4Y.mjs +3344 -0
  39. package/node/esm/{6PuhMTJrzLciGI0Z.mjs → D6oQL8knsPpgdXuk.mjs} +2 -2
  40. package/node/esm/{BxTFDoMd-nowfxfb.mjs → D9rzScOA9pEYFrtz.mjs} +1 -1
  41. package/node/esm/DNSjK5DAH3M14Qbc.mjs +521 -0
  42. package/node/esm/{C2HawKeialuFRR9r.mjs → DZzvTQxIKr9LbEsA.mjs} +1 -1
  43. package/node/esm/{uJOy7zjNtP0IqGoa.mjs → ETK6T6G0SIcFXDe5.mjs} +163 -135
  44. package/node/esm/ah3CUg4-VmNstGk_.mjs +256 -0
  45. package/node/esm/{DPhvWXmDun8bC0_v.mjs → ci8d-mF1H9wnYzix.mjs} +1 -1
  46. package/node/esm/cqzp431iNSLWictb.mjs +116 -0
  47. package/node/esm/index.mjs +14783 -6793
  48. package/package.json +15 -18
  49. package/resources/locales/de/groups.cmd.json +29 -16
  50. package/resources/locales/de/studio.cmd.json +18 -1
  51. package/resources/locales/de/ui.msg.json +350 -40
  52. package/resources/locales/en/groups.cmd.json +39 -17
  53. package/resources/locales/en/studio.cmd.json +18 -1
  54. package/resources/locales/en/ui.msg.json +306 -40
  55. package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +17 -1
  56. package/types/src/anchorItems/AnchorItemsPanel.d.ts +14 -0
  57. package/types/src/anchorItems/AnchoredRangeField.d.ts +40 -0
  58. package/types/src/anchorItems/index.d.ts +1 -0
  59. package/types/src/border/BorderPopupButton.d.ts +6 -6
  60. package/types/src/border/BorderStylePopupButton.d.ts +3 -3
  61. package/types/src/border/BorderTemplateIcon.d.ts +24 -0
  62. package/types/src/border/index.d.ts +1 -0
  63. package/types/src/color/ColorPanel.d.ts +8 -2
  64. package/types/src/color/ColorPopupButton.d.ts +2 -1
  65. package/types/src/command/NumberFormatQuickButtons.d.ts +32 -0
  66. package/types/src/command/PresetCellStylesCommandButton.d.ts +3 -3
  67. package/types/src/command/SheetZoomCommandButton.d.ts +4 -3
  68. package/types/src/comments/CommentCard.d.ts +41 -0
  69. package/types/src/comments/CommentsPlugin.d.ts +6 -0
  70. package/types/src/comments/CommentsTaskPane.d.ts +23 -0
  71. package/types/src/comments/index.d.ts +4 -0
  72. package/types/src/conditionalFormat/ConditionalFormatStylePicker.d.ts +4 -4
  73. package/types/src/conditionalFormat/IconPickerPopupButton.d.ts +2 -2
  74. package/types/src/conditionalFormat/IconSetRulePanel.d.ts +1 -1
  75. package/types/src/conditions/BetweenOption.d.ts +6 -1
  76. package/types/src/conditions/CombinatorOption.d.ts +7 -0
  77. package/types/src/conditions/ConditionEditor.d.ts +61 -4
  78. package/types/src/conditions/ConditionUtils.d.ts +65 -6
  79. package/types/src/conditions/ExpressionOption.d.ts +12 -6
  80. package/types/src/conditions/MembershipOption.d.ts +67 -0
  81. package/types/src/conditions/OperatorAndParamEditor.d.ts +36 -1
  82. package/types/src/conditions/ScalarOption.d.ts +25 -6
  83. package/types/src/conditions/SelectorSelect.d.ts +16 -7
  84. package/types/src/conditions/index.d.ts +1 -1
  85. package/types/src/conditions/useFormulaOption.d.ts +54 -0
  86. package/types/src/dataValidation/DataValidationDetailsPanel.d.ts +7 -1
  87. package/types/src/dataValidation/DataValidationDetailsTaskPane.d.ts +3 -2
  88. package/types/src/dataValidation/DataValidationEditorPanel.d.ts +13 -2
  89. package/types/src/dataValidation/DataValidationIcon.d.ts +22 -0
  90. package/types/src/dataValidation/DataValidationTitle.d.ts +13 -0
  91. package/types/src/dialog/FillSeriesDialog.d.ts +16 -0
  92. package/types/src/dialog/OutlineSettingsDialog.d.ts +12 -0
  93. package/types/src/dialog/TableNewDialog.d.ts +1 -4
  94. package/types/src/dialog/_ShortcutSearch.d.ts +26 -0
  95. package/types/src/dialog/index.d.ts +0 -2
  96. package/types/src/externalLink/ExternalLinkCardBody.d.ts +9 -0
  97. package/types/src/externalLink/ExternalLinkChip.d.ts +18 -0
  98. package/types/src/externalLink/ExternalLinkLocation.d.ts +18 -0
  99. package/types/src/externalLink/ExternalLinkSettingsTab.d.ts +18 -0
  100. package/types/src/externalLink/ExternalLinksPanel.d.ts +11 -0
  101. package/types/src/externalLink/ExternalLinksPlugin.d.ts +5 -0
  102. package/types/src/externalLink/ExternalLinksTaskPane.d.ts +19 -0
  103. package/types/src/externalLink/index.d.ts +8 -0
  104. package/types/src/fill/GradientEditor.d.ts +41 -0
  105. package/types/src/fill/GradientStopsBar.d.ts +43 -0
  106. package/types/src/fill/PatternPopupButton.d.ts +26 -0
  107. package/types/src/fill/PatternSwatch.d.ts +53 -0
  108. package/types/src/fill/index.d.ts +5 -0
  109. package/types/src/filter/ColumnMenu.d.ts +31 -1
  110. package/types/src/filter/index.d.ts +0 -1
  111. package/types/src/form/FormulaField.d.ts +35 -6
  112. package/types/src/form/InputField.d.ts +35 -5
  113. package/types/src/format/AlignmentPanel.d.ts +13 -0
  114. package/types/src/format/BorderPanel.d.ts +22 -0
  115. package/types/src/format/BorderPreview.d.ts +94 -0
  116. package/types/src/format/FillPanel.d.ts +65 -0
  117. package/types/src/format/FontPanel.d.ts +12 -0
  118. package/types/src/format/FormatCellPreview.d.ts +35 -0
  119. package/types/src/format/FormatPanelParts.d.ts +85 -0
  120. package/types/src/format/FormatPlugin.d.ts +11 -0
  121. package/types/src/format/FormatTaskPane.d.ts +39 -0
  122. package/types/src/format/LinePanel.d.ts +53 -0
  123. package/types/src/format/LinePreviews.d.ts +71 -0
  124. package/types/src/format/NumberFormatOption.d.ts +43 -0
  125. package/types/src/{numberFormat → format}/NumberFormatPanel.d.ts +20 -0
  126. package/types/src/format/index.d.ts +14 -0
  127. package/types/src/format/useFormatSelection.d.ts +93 -0
  128. package/types/src/formulaBar/IFormulaBar.d.ts +11 -0
  129. package/types/src/formulaBar/MobileFormulaBar.d.ts +21 -0
  130. package/types/src/formulaBar/MobileInputToolbar.d.ts +37 -0
  131. package/types/src/formulaBar/index.d.ts +3 -0
  132. package/types/src/formulaBar/useFormulaBarSession.d.ts +65 -0
  133. package/types/src/index.d.ts +7 -1
  134. package/types/src/itemsPanel/EditorCommit.d.ts +32 -0
  135. package/types/src/itemsPanel/EditorPanel.d.ts +4 -1
  136. package/types/src/itemsPanel/ItemCard.d.ts +60 -8
  137. package/types/src/itemsPanel/ItemsDescriptor.d.ts +68 -19
  138. package/types/src/itemsPanel/ItemsPanel.d.ts +9 -0
  139. package/types/src/itemsPanel/ItemsSearchField.d.ts +17 -0
  140. package/types/src/itemsPanel/index.d.ts +2 -0
  141. package/types/src/named/NamedDetailsPanel.d.ts +9 -2
  142. package/types/src/named/NamedDetailsTaskPane.d.ts +3 -2
  143. package/types/src/named/NamedEditorPanel.d.ts +1 -1
  144. package/types/src/named/NamedExpressionField.d.ts +32 -0
  145. package/types/src/named/NamedKindChip.d.ts +38 -0
  146. package/types/src/picture/PicturePlugin.d.ts +6 -0
  147. package/types/src/picture/index.d.ts +2 -0
  148. package/types/src/protectedRange/ProtectedRangeDetailsPanel.d.ts +6 -0
  149. package/types/src/protectedRange/ProtectedRangeDraft.d.ts +22 -0
  150. package/types/src/protectedRange/ProtectedRangeEditorPanel.d.ts +0 -14
  151. package/types/src/protectedRange/index.d.ts +2 -1
  152. package/types/src/protection/ManageProtectionTaskPane.d.ts +29 -0
  153. package/types/src/protection/PasswordDialog.d.ts +32 -0
  154. package/types/src/protection/PasswordField.d.ts +35 -0
  155. package/types/src/protection/ProtectedCellsPanel.d.ts +20 -0
  156. package/types/src/protection/ProtectionPlugin.d.ts +11 -0
  157. package/types/src/protection/SheetProtectionPanel.d.ts +35 -0
  158. package/types/src/protection/WorkbookProtectionPanel.d.ts +34 -15
  159. package/types/src/protection/WorkbookProtectionTab.d.ts +22 -0
  160. package/types/src/protection/index.d.ts +7 -1
  161. package/types/src/shape/InsertShapeCommandButton.d.ts +20 -0
  162. package/types/src/shape/ShapeFormatPanel.d.ts +11 -0
  163. package/types/src/shape/ShapePlugin.d.ts +6 -0
  164. package/types/src/shape/index.d.ts +3 -0
  165. package/types/src/slicer/PresetSlicerStylesCommandButton.d.ts +18 -0
  166. package/types/src/slicer/SlicerPlugin.d.ts +6 -0
  167. package/types/src/slicer/index.d.ts +3 -0
  168. package/types/src/statusBar/SheetZoomScale.d.ts +6 -0
  169. package/types/src/studio/CommandsWrapper.d.ts +5 -0
  170. package/types/src/studio/EagerStudio.d.ts +14 -1
  171. package/types/src/studio/StudioCommandProvider.d.ts +10 -0
  172. package/types/src/studio/StudioCommands.d.ts +40 -4
  173. package/types/src/studio/StudioProps.d.ts +64 -2
  174. package/types/src/studio/StudioSplitPane.d.ts +1 -1
  175. package/types/src/studio/formulaBarPlacement.d.ts +35 -0
  176. package/types/src/studio/splitStudioProps.d.ts +7 -0
  177. package/types/src/studio/useStudioApp.d.ts +31 -18
  178. package/types/src/template/TemplateCommands.d.ts +29 -0
  179. package/types/src/template/TemplateDialog.d.ts +19 -0
  180. package/types/src/template/TemplatePanel.d.ts +50 -0
  181. package/types/src/template/TemplateSearchField.d.ts +29 -0
  182. package/types/src/template/WelcomeDialog.d.ts +29 -0
  183. package/types/src/template/categoryColor.d.ts +8 -0
  184. package/types/src/template/index.d.ts +3 -0
  185. package/types/src/template/useTemplateCatalog.d.ts +71 -0
  186. package/types/src/toolbar/WorkbookToolbars.d.ts +1 -1
  187. package/types/src/workbook/DefaultRenderers.d.ts +15 -1
  188. package/types/src/workbook/FillMenu.d.ts +21 -0
  189. package/types/src/workbook/OutlineButtons.d.ts +11 -0
  190. package/types/src/workbook/WorkbookElement.d.ts +1 -1
  191. package/types/src/workbook/index.d.ts +1 -0
  192. package/browser/cjs/BQJKf40kttQWOzLw.cjs +0 -20
  193. package/browser/cjs/BTZ5uzK0wHzpiZGC.cjs +0 -1
  194. package/browser/cjs/B_D3JKseVvpRyX-E.cjs +0 -1
  195. package/browser/cjs/BeKpqOx8It0RD0Rf.cjs +0 -2
  196. package/browser/cjs/Bj-EvSYeDfqmU0V6.cjs +0 -2
  197. package/browser/cjs/Bo9Kx3L_XQkGPBJ5.cjs +0 -1
  198. package/browser/cjs/Bte6P3MhSjajJmmY.cjs +0 -7
  199. package/browser/cjs/C97KHSuikAbr1qVM.cjs +0 -1
  200. package/browser/cjs/CJLwX_A3y3TQUmzj.cjs +0 -1
  201. package/browser/cjs/CPSc2VSYZeZ1B9mi.cjs +0 -1
  202. package/browser/cjs/CPcBvw4ZPwHVTUZF.cjs +0 -1
  203. package/browser/cjs/CYxc8vnRi8dNpDPk.cjs +0 -1
  204. package/browser/cjs/CZm1jVZaHQ246prW.cjs +0 -1
  205. package/browser/cjs/CdDYyAfccXme8w6m.cjs +0 -1
  206. package/browser/cjs/Cm1APq2MraYNNhyI.cjs +0 -1
  207. package/browser/cjs/DO8V31Z1ewgMA1di.cjs +0 -5
  208. package/browser/cjs/Djsiad0Qha1Y-YaS.cjs +0 -1
  209. package/browser/cjs/IASAYG6qgv7lJY7y.cjs +0 -1
  210. package/browser/cjs/KZvriGbhEOVkQD0b.cjs +0 -1
  211. package/browser/cjs/UnMhi28mbvLiOXQe.cjs +0 -1
  212. package/browser/cjs/Vbigo0kFP3PFfmeA.cjs +0 -1
  213. package/browser/cjs/iMWEL01eC83oU-YY.cjs +0 -1
  214. package/browser/cjs/index.cjs +0 -2
  215. package/browser/cjs/w2GjebPlOFv3pCbm.cjs +0 -1
  216. package/browser/cjs/z0rB4fK6X1M6PpVD.cjs +0 -11
  217. package/browser/cjs/zQsyZpeXAvcVXJMs.cjs +0 -1
  218. package/browser/esm/6seXVm4fUaBp34tP.mjs +0 -217
  219. package/browser/esm/C1PiodbCgkhztxU5.mjs +0 -411
  220. package/browser/esm/C5XQW-A03GP8EZ3s.mjs +0 -52
  221. package/browser/esm/CZGRaL9mjYTo8fAd.mjs +0 -105
  222. package/browser/esm/DTWkitCkayiinpgU.mjs +0 -219
  223. package/browser/esm/DbHn3Fq4gYggsoXV.mjs +0 -5429
  224. package/browser/esm/DxBsD4nDbg_OWhYG.mjs +0 -47
  225. package/browser/esm/HZXAXZqrC43FBvGk.mjs +0 -82
  226. package/browser/esm/dgkVCh7lmm1Twqmo.mjs +0 -9257
  227. package/browser/esm/l5BsxVQszkPy_n34.mjs +0 -1150
  228. package/node/esm/-9Hcp_VKJtR9fWlC.mjs +0 -470
  229. package/node/esm/B-3Ypi8akR-GxIpw.mjs +0 -82
  230. package/node/esm/CbhFnQCOA5TjhFB1.mjs +0 -106
  231. package/node/esm/CxqL51jVpIL4ncWW.mjs +0 -47
  232. package/node/esm/D-x3LVzppkKf5be_.mjs +0 -4575
  233. package/types/src/conditionalFormat/ConditionalFormatRangeField.d.ts +0 -32
  234. package/types/src/conditions/DateTimeOption.d.ts +0 -43
  235. package/types/src/conditions/InSetOption.d.ts +0 -37
  236. package/types/src/dialog/CommentsDialog.d.ts +0 -11
  237. package/types/src/dialog/NumberFormatDialog.d.ts +0 -12
  238. package/types/src/filter/FilterList.d.ts +0 -28
  239. package/types/src/numberFormat/NumberFormatTaskPane.d.ts +0 -12
  240. package/types/src/numberFormat/index.d.ts +0 -8
  241. package/types/src/protectedRange/ProtectedRangeDetailsTaskPane.d.ts +0 -3
  242. package/types/src/protectedRange/ProtectedRangePlugin.d.ts +0 -2
  243. package/types/src/protection/WorkbookProtectionDialog.d.ts +0 -23
@@ -0,0 +1,3344 @@
1
+ /**
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.8.0-beta.10
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 { AutoColorPosition as e, BorderPopupButton as t, C as o, ColorPopupButton as r, CommentsPlugin as n, DocumentTitle as a, ExternalLinksPlugin as l, FormatPlugin as i, FormulaField as s, NamedPlugin as d, PresetChip as c, ProtectionPlugin as p, S as u, SlicerPlugin as m, T as g, TablePlugin as h, WorkbookElement as y, _ as f, a as b, b as x, c as v, createStudioThemeCSS as k, d as C, f as w, g as S, h as T, i as F, k as D, l as I, m as P, n as W, p as A, r as N, registerStudioCommandCatalogs as M, registerStudioCommandGroups as R, renderWorkbookToolbars as E, s as B, t as O, tokensToMuiOptions as V, u as j, v as $, w as L, x as z, y as K } from "./index.mjs";
8
+ import { Color as _, CommonUtils as H, ICellStyle as U, ICondition as G, IConditionalFormat as q, IDataValidation as Y, IFill as X, IFont as J } from "@sheetxl/sdk";
9
+ import { COLOR_SCALE_PRESETS as Z, CommandRootProvider as Q, DATA_BAR_PRESETS as ee, DefaultTaskPaneRegistry as te, ICON_CATALOG as oe, IconSetGlyphs as re, LogoNoPaddingIcon as ne, NO_CELL_ICON as ae, STYLE_PRESETS as le, TaskPaneArea as ie, TaskPaneProvider as se, ThemeStateDefaults as de, ThemeStateKey as ce, WorkbookIO as pe, WorkbookProvider as ue, buildOOXMLThemeCSS as me, createEditable as ge, createSystemColorVars as he, defaultColorScale as ye, defaultDataBar as fe, defaultIconSet as be, defaultIconStops as xe, getConditionalIconSet as ve, iconSetSize as ke, registerMovablePane as Ce, registerMovableToolbarEntry as we, resolveIconSetIcons as Se, useDocThemes as Te, useModelSync as Fe, useReferenceModeStore as De, useResolvedWorkbook as Ie, useTaskPaneArea as Pe, useWorkbookEncrypted as We, useWorkbookName as Ae, useWorkbookSaveState as Ne, withIconOverride as Me } from "@sheetxl/react";
10
+ import { Command as Re, DefaultIconService as Ee, DefaultReactNotifier as Be, DynamicIcon as Oe, LanguageStateKey as Ve, NotifierType as je, ReactErrorBoundary as $e, ReactNotifierProvider as Le, ReactUtils as ze, ScrollUtils as Ke, SplitPane as _e, UncaughtErrorBoundary as He, createBusyHandle as Ue, useCallbackRef as Ge, useFullscreen as qe, useImperativeElement as Ye, useLanguage as Xe, useMeasure as Je, useNotifier as Ze, usePersistentState as Qe, useResolvedThemeMode as et, useTokenThemeContext as tt, useTranslator as ot, useVisualViewportRect as rt } from "@sheetxl/utils-react";
11
+ import nt, { forwardRef as at, isValidElement as lt, memo as it, useCallback as st, useEffect as dt, useMemo as ct, useRef as pt, useState as ut } from "react";
12
+ import { AnimatedLoadingPanel as mt, AnimatedTraversingEllipsisIcon as gt, CommandGroup as ht, ExhibitFloatProvider as yt, ExhibitPopupIconButton as ft, ExhibitTooltip as bt, ModalProvider as xt, SimpleTooltip as vt, StackTrace as kt, createExhibitTheme as Ct, defaultCreatePopupPanel as wt, hideLoadingPanel as St, lazyModal as Tt, showLoadingPanel as Ft, useInputDialog as Dt, useLazyWindow as It, useModal as Pt, useOptionsDialog as Wt } from "@sheetxl/utils-mui";
13
+ import { Fragment as At, jsx as Nt, jsxs as Mt } from "react/jsx-runtime";
14
+ import { Box as Rt, Card as Et, CardActions as Bt, Checkbox as Ot, Collapse as Vt, CssBaseline as jt, DialogTitle as $t, FormControl as Lt, FormControlLabel as zt, IconButton as Kt, InputLabel as _t, MenuItem as Ht, Paper as Ut, Select as Gt, SvgIcon as qt, Tab as Yt, Tabs as Xt, TextField as Jt, ThemeProvider as Zt, ToggleButton as Qt, ToggleButtonGroup as eo, Typography as to, alpha as oo, useMediaQuery as ro, useTheme as no } from "@mui/material";
15
+ import { CommonUtils as ao, DOMUtils as lo, DefaultLanguagePackService as io, ErrorUtils as so, ExpectedError as co, PartialError as po, defineLazyModule as uo, formatMessage as mo, messageKey as go, t as ho } from "@sheetxl/utils";
16
+ import yo from "clsx";
17
+ import { mergeRefs as fo, useMergeRefs as bo } from "react-merge-refs";
18
+ import { SnackbarContent as xo, SnackbarProvider as vo, useSnackbar as ko } from "notistack";
19
+ var Co = it((e) => {
20
+ const { variant: t = "format", children: o, sx: r, ...n } = e;
21
+ return Nt(Rt, {
22
+ className: `sxl-cf-rule-section sxl-cf-rule-section-${t}`,
23
+ sx: {
24
+ display: "flex",
25
+ flexDirection: "column",
26
+ gap: 1,
27
+ p: 2,
28
+ border: 1,
29
+ borderColor: "divider",
30
+ borderRadius: 1,
31
+ ..."config" === t ? { backgroundColor: "action.hover" } : null,
32
+ ...r
33
+ },
34
+ ...n,
35
+ children: o
36
+ });
37
+ });
38
+ Co.displayName = "RuleSection";
39
+ var wo = new _("transparent"), So = {
40
+ lightRedFillDarkRedText: go("conditionalFormat.preset.lightRedFillDarkRedText"),
41
+ yellowFillDarkYellowText: go("conditionalFormat.preset.yellowFillDarkYellowText"),
42
+ greenFillDarkGreenText: go("conditionalFormat.preset.greenFillDarkGreenText"),
43
+ lightRedFill: go("conditionalFormat.preset.lightRedFill"),
44
+ redText: go("conditionalFormat.preset.redText"),
45
+ redBorder: go("conditionalFormat.preset.redBorder")
46
+ }, To = (e) => e ? "string" == typeof e ? e : e.type === X.Type.None ? null : e.color ?? e.foreground ?? null : null, Fo = (e, t) => "auto" === e ? null : $(e, t), Do = it((o) => {
47
+ const { format: n, onFormatChange: a, readOnly: l, ...i } = o, s = ot(), { workbook: d, schemeLookup: p, themeKey: u, darkMode: m, propsColorPanel: g } = K(), h = n?.font ?? null, y = (h?.weight ?? 400) >= 600, f = h?.style === J.Style.Italic, b = !!h?.underline && h.underline !== J.UnderlineStyle.None, x = !!h?.strike, v = (e) => {
48
+ const t = { ...h };
49
+ for (const [o, r] of Object.entries(e)) void 0 === r ? delete t[o] : t[o] = r;
50
+ const o = { ...n };
51
+ 0 === Object.keys(t).length ? delete o.font : o.font = t, a(0 === Object.keys(o).length ? null : o);
52
+ }, k = ct(() => d?.getStyles().getNormal().getFont().getColor(), [d, u]), C = ct(() => Fo(h?.color, d), [
53
+ h?.color,
54
+ d,
55
+ u
56
+ ]), w = ct(() => Fo(To(n?.fill), d), [
57
+ n?.fill,
58
+ d,
59
+ u
60
+ ]), S = {
61
+ padding: "4px",
62
+ border: "none",
63
+ borderRadius: 1
64
+ };
65
+ return Mt(Co, {
66
+ ...i,
67
+ children: [Mt(Rt, {
68
+ sx: {
69
+ display: "flex",
70
+ alignItems: "flex-start",
71
+ gap: 1
72
+ },
73
+ children: [Nt(Rt, {
74
+ sx: {
75
+ flex: "1 1 auto",
76
+ minWidth: 0,
77
+ display: "flex",
78
+ gap: .5,
79
+ flexWrap: "wrap"
80
+ },
81
+ children: le.map((e, t) => {
82
+ const o = Fo(To(e.style.fill), d), r = Fo(e.style.font?.color, d), n = e.style.borders ? Fo(Object.values(e.style.borders)[0]?.color, d) : null;
83
+ return Nt(c, {
84
+ sheet: !0,
85
+ title: s(So[e.key] ?? e.key),
86
+ disabled: l,
87
+ onClick: () => a(structuredClone(e.style)),
88
+ sx: {
89
+ backgroundColor: o?.toCSS("adaptive") ?? void 0,
90
+ color: r?.toCSS("adaptive") ?? void 0,
91
+ outline: n ? `1px solid ${n.toCSS("adaptive")}` : void 0,
92
+ outlineOffset: "-3px"
93
+ },
94
+ children: "Aa"
95
+ }, t);
96
+ })
97
+ }), Nt(c, {
98
+ title: s("conditionalFormat.clearStyle"),
99
+ disabled: l || !n,
100
+ onClick: () => a(null),
101
+ sx: {
102
+ color: "text.secondary",
103
+ "&:disabled": { opacity: .4 }
104
+ },
105
+ children: Nt(Oe, {
106
+ iconKey: "ClearFormats",
107
+ size: 16
108
+ })
109
+ })]
110
+ }), Mt(Rt, {
111
+ sx: {
112
+ display: "flex",
113
+ alignItems: "center",
114
+ gap: .25
115
+ },
116
+ children: [
117
+ Nt(Qt, {
118
+ value: "bold",
119
+ size: "small",
120
+ sx: S,
121
+ selected: y,
122
+ disabled: l,
123
+ onChange: () => v({ weight: y ? void 0 : 700 }),
124
+ children: Nt(Oe, { iconKey: "TextBold" })
125
+ }),
126
+ Nt(Qt, {
127
+ value: "italic",
128
+ size: "small",
129
+ sx: S,
130
+ selected: f,
131
+ disabled: l,
132
+ onChange: () => v({ style: f ? void 0 : J.Style.Italic }),
133
+ children: Nt(Oe, { iconKey: "TextItalic" })
134
+ }),
135
+ Nt(Qt, {
136
+ value: "underline",
137
+ size: "small",
138
+ sx: S,
139
+ selected: b,
140
+ disabled: l,
141
+ onChange: () => v({ underline: b ? void 0 : J.UnderlineStyle.Single }),
142
+ children: Nt(Oe, { iconKey: "TextUnderline" })
143
+ }),
144
+ Nt(Qt, {
145
+ value: "strike",
146
+ size: "small",
147
+ sx: S,
148
+ selected: x,
149
+ disabled: l,
150
+ onChange: () => v({ strike: !x || void 0 }),
151
+ children: Nt(Oe, { iconKey: "TextStrike" })
152
+ }),
153
+ d && Nt(t, {
154
+ tooltip: s("conditionalFormat.border"),
155
+ selectedBorder: n?.borders,
156
+ createBorder: (e) => d.getStyles().getNormal().createStyle({ borders: e }).getBorders(),
157
+ schemeLookup: p,
158
+ autoColor: k,
159
+ darkMode: m,
160
+ disabled: l,
161
+ onSelectBorder: (e) => ((e) => {
162
+ const t = { ...n };
163
+ e && 0 !== Object.keys(e).length ? t.borders = e : delete t.borders, a(0 === Object.keys(t).length ? null : t);
164
+ })(e)
165
+ }),
166
+ Nt(r, {
167
+ icon: "fill.colored",
168
+ tooltip: s("conditionalFormat.fillColor"),
169
+ selectedColor: w,
170
+ disabled: l,
171
+ onSelectColor: (e) => ((e) => {
172
+ const t = { ...n };
173
+ e ? t.fill = {
174
+ type: X.Type.Solid,
175
+ color: e.toString()
176
+ } : delete t.fill, a(0 === Object.keys(t).length ? null : t);
177
+ })(e),
178
+ darkMode: m,
179
+ propsPanel: {
180
+ disableAlpha: !0,
181
+ autoColor: wo,
182
+ autoColorLabelKey: go("color.noFill"),
183
+ autoColorPosition: e.End,
184
+ ...g
185
+ }
186
+ }),
187
+ Nt(r, {
188
+ icon: "text.colored",
189
+ tooltip: s("conditionalFormat.fontColor"),
190
+ selectedColor: C,
191
+ disabled: l,
192
+ onSelectColor: (e) => v({ color: e ? e.toString() : void 0 }),
193
+ darkMode: m,
194
+ propsPanel: {
195
+ disableAlpha: !0,
196
+ autoColor: k,
197
+ ...g
198
+ }
199
+ })
200
+ ]
201
+ })]
202
+ });
203
+ });
204
+ Do.displayName = "ConditionalFormatStylePicker";
205
+ var Io = {
206
+ [q.ColorStopType.AutoMin]: go("conditionalFormat.stopType.autoMin"),
207
+ [q.ColorStopType.AutoMax]: go("conditionalFormat.stopType.autoMax"),
208
+ [q.ColorStopType.Min]: go("conditionalFormat.stopType.min"),
209
+ [q.ColorStopType.Max]: go("conditionalFormat.stopType.max"),
210
+ [q.ColorStopType.Num]: go("conditionalFormat.stopType.num"),
211
+ [q.ColorStopType.Percent]: go("conditionalFormat.stopType.percent"),
212
+ [q.ColorStopType.Percentile]: go("conditionalFormat.stopType.percentile"),
213
+ [q.ColorStopType.Formula]: go("conditionalFormat.stopType.formula")
214
+ }, Po = /* @__PURE__ */ new Set([
215
+ q.ColorStopType.AutoMin,
216
+ q.ColorStopType.AutoMax,
217
+ q.ColorStopType.Min,
218
+ q.ColorStopType.Max
219
+ ]), Wo = it((e) => {
220
+ const { label: t, stop: n, onStopChange: a, allowedTypes: l, showColor: i = !1, leading: d, showExclusive: c = !1, readOnly: p, ...u } = e, m = ot(), { darkMode: g, toColor: h, propsColorPanel: y } = K(), f = o(), b = n.type ?? q.ColorStopType.Num, x = !Po.has(b), v = p || !x, k = b === q.ColorStopType.Formula, C = n.value?.isIFormula ? n.value : null, w = n.color, S = i ? h(w) : null;
221
+ return Mt(Rt, {
222
+ sx: {
223
+ display: "flex",
224
+ alignItems: "center",
225
+ gap: .5
226
+ },
227
+ ...u,
228
+ children: [
229
+ void 0 !== t && Nt(to, {
230
+ variant: "caption",
231
+ sx: {
232
+ color: "text.secondary",
233
+ flex: "0 0 62px",
234
+ minWidth: 0,
235
+ overflow: "hidden",
236
+ textOverflow: "ellipsis"
237
+ },
238
+ children: t
239
+ }),
240
+ d,
241
+ i && Nt(r, {
242
+ tooltip: m("conditionalFormat.stopColor"),
243
+ selectedColor: S,
244
+ disabled: p,
245
+ onSelectColor: (e) => {
246
+ e && a({
247
+ ...n,
248
+ color: e.toString()
249
+ });
250
+ },
251
+ darkMode: g,
252
+ propsPanel: {
253
+ disableAlpha: !0,
254
+ ...y
255
+ }
256
+ }),
257
+ c && Mt(Gt, {
258
+ size: "small",
259
+ value: n.exclusive ? "gt" : "gte",
260
+ disabled: p,
261
+ onChange: (e) => {
262
+ const t = { ...n };
263
+ "gt" === e.target.value ? t.exclusive = !0 : delete t.exclusive, a(t);
264
+ },
265
+ sx: {
266
+ flex: "0 0 auto",
267
+ backgroundColor: "background.paper"
268
+ },
269
+ children: [Nt(Ht, {
270
+ value: "gte",
271
+ children: ">="
272
+ }), Nt(Ht, {
273
+ value: "gt",
274
+ children: ">"
275
+ })]
276
+ }),
277
+ Nt(Gt, {
278
+ size: "small",
279
+ value: b,
280
+ disabled: p,
281
+ onChange: (e) => ((e) => {
282
+ const t = {
283
+ ...n,
284
+ type: e
285
+ };
286
+ if (Po.has(e)) delete t.value;
287
+ else if (void 0 === t.value) t.value = e === q.ColorStopType.Formula ? "" : 0;
288
+ else if (e !== q.ColorStopType.Formula && "number" != typeof t.value) {
289
+ const e = "string" == typeof t.value ? Number(t.value) : NaN;
290
+ t.value = Number.isFinite(e) ? e : 0;
291
+ }
292
+ a(t);
293
+ })(e.target.value),
294
+ sx: {
295
+ flex: "1 1 40%",
296
+ minWidth: 0,
297
+ backgroundColor: "background.paper"
298
+ },
299
+ children: l.map((e) => Nt(Ht, {
300
+ value: e,
301
+ children: m(Io[e])
302
+ }, e))
303
+ }),
304
+ k ? Nt(s, {
305
+ size: "small",
306
+ home: f.home,
307
+ value: C ? f.display(C) : `${n.value ?? ""}`,
308
+ onChangeText: (e) => {
309
+ a({
310
+ ...n,
311
+ value: e.trim().length > 0 ? f.compile(e) : e
312
+ });
313
+ },
314
+ placeholder: m("conditionalFormat.enterFormula"),
315
+ disabled: v,
316
+ equals: "bare",
317
+ pickAs: "absolute",
318
+ label: null,
319
+ showError: !1,
320
+ helperText: null,
321
+ sx: {
322
+ flex: "1 1 30%",
323
+ minWidth: 0,
324
+ "& .MuiInputBase-root": { backgroundColor: v ? "action.disabledBackground" : "background.paper" }
325
+ }
326
+ }) : Nt(Jt, {
327
+ size: "small",
328
+ type: "number",
329
+ placeholder: x ? void 0 : m("conditionalFormat.stopFromData"),
330
+ value: x ? `${n.value ?? ""}` : "",
331
+ disabled: v,
332
+ onChange: (e) => {
333
+ const t = e.target.value;
334
+ a({
335
+ ...n,
336
+ value: "" === t ? 0 : Number(t)
337
+ });
338
+ },
339
+ sx: {
340
+ flex: "1 1 30%",
341
+ minWidth: 0,
342
+ cursor: v ? "not-allowed" : void 0
343
+ },
344
+ slotProps: { input: { sx: {
345
+ backgroundColor: v ? "action.disabledBackground" : "background.paper",
346
+ cursor: v ? "not-allowed" : void 0
347
+ } } }
348
+ })
349
+ ]
350
+ });
351
+ });
352
+ Wo.displayName = "ScaleStopRow";
353
+ var Ao = [
354
+ q.ColorStopType.Min,
355
+ q.ColorStopType.Max,
356
+ q.ColorStopType.Num,
357
+ q.ColorStopType.Percent,
358
+ q.ColorStopType.Percentile,
359
+ q.ColorStopType.Formula
360
+ ], No = it((e) => {
361
+ const { scale: t, onScaleChange: o, readOnly: r, ...n } = e, a = ot(), { workbook: l, toColor: i } = K(), s = t.stops ?? [], d = 2 === s.length ? [go("conditionalFormat.stop.minimum"), go("conditionalFormat.stop.maximum")] : [
362
+ go("conditionalFormat.stop.minimum"),
363
+ go("conditionalFormat.stop.midpoint"),
364
+ go("conditionalFormat.stop.maximum")
365
+ ];
366
+ return Mt(Rt, {
367
+ sx: {
368
+ display: "flex",
369
+ flexDirection: "column",
370
+ gap: 1
371
+ },
372
+ ...n,
373
+ children: [Nt(Co, { children: Mt(Rt, {
374
+ sx: {
375
+ display: "flex",
376
+ alignItems: "flex-start",
377
+ gap: 1
378
+ },
379
+ children: [Nt(Rt, {
380
+ sx: {
381
+ flex: "1 1 auto",
382
+ minWidth: 0,
383
+ display: "flex",
384
+ gap: .5,
385
+ flexWrap: "wrap"
386
+ },
387
+ children: Z.filter((e) => e.stops.length === (2 === s.length ? 2 : 3)).map((e, t) => Nt(c, {
388
+ sheet: !0,
389
+ disabled: r,
390
+ onClick: () => o(structuredClone(e)),
391
+ children: Nt(T, { rows: S(e.stops ?? [], w, l) })
392
+ }, t))
393
+ }), Mt(eo, {
394
+ exclusive: !0,
395
+ size: "small",
396
+ value: 2 === s.length ? 2 : 3,
397
+ disabled: r,
398
+ onChange: (e, r) => {
399
+ r && ((e) => {
400
+ if (e === s.length || 2 !== e && 3 !== e) return;
401
+ const r = s.slice();
402
+ if (3 === e) {
403
+ let e = "#FFEB84";
404
+ const t = i(s[0]?.color ?? e)?.toRGBA(), o = i(s[s.length - 1]?.color ?? e)?.toRGBA();
405
+ if (t && o) {
406
+ const r = (e) => Math.round(e).toString(16).padStart(2, "0").toUpperCase();
407
+ e = `#${r((t.red + o.red) / 2)}${r((t.green + o.green) / 2)}${r((t.blue + o.blue) / 2)}`;
408
+ }
409
+ r.splice(1, 0, {
410
+ type: q.ColorStopType.Percentile,
411
+ value: 50,
412
+ color: e
413
+ });
414
+ } else r.splice(1, r.length - 2);
415
+ o({
416
+ ...t,
417
+ stops: r
418
+ });
419
+ })(r);
420
+ },
421
+ sx: { flex: "0 0 auto" },
422
+ children: [Nt(Qt, {
423
+ value: 2,
424
+ sx: {
425
+ textTransform: "none",
426
+ pt: .25,
427
+ pb: .25
428
+ },
429
+ children: a("conditionalFormat.twoColor")
430
+ }), Nt(Qt, {
431
+ value: 3,
432
+ sx: {
433
+ textTransform: "none",
434
+ pt: .25,
435
+ pb: .25
436
+ },
437
+ children: a("conditionalFormat.threeColor")
438
+ })]
439
+ })]
440
+ }) }), Nt(Co, {
441
+ variant: "config",
442
+ children: s.map((e, n) => Nt(Wo, {
443
+ label: a(d[Math.min(n, d.length - 1)]),
444
+ stop: e,
445
+ allowedTypes: Ao,
446
+ showColor: !0,
447
+ readOnly: r,
448
+ onStopChange: (e) => {
449
+ const r = s.slice();
450
+ r[n] = e, o({
451
+ ...t,
452
+ stops: r
453
+ });
454
+ }
455
+ }, n))
456
+ })]
457
+ });
458
+ });
459
+ No.displayName = "ColorScaleRulePanel";
460
+ var Mo = [
461
+ q.ColorStopType.AutoMin,
462
+ q.ColorStopType.Min,
463
+ q.ColorStopType.Num,
464
+ q.ColorStopType.Percent,
465
+ q.ColorStopType.Percentile,
466
+ q.ColorStopType.Formula
467
+ ], Ro = [
468
+ q.ColorStopType.AutoMax,
469
+ q.ColorStopType.Max,
470
+ q.ColorStopType.Num,
471
+ q.ColorStopType.Percent,
472
+ q.ColorStopType.Percentile,
473
+ q.ColorStopType.Formula
474
+ ], Eo = "__auto__", Bo = it((e) => {
475
+ const { scale: t, onScaleChange: o, readOnly: n, ...a } = e, l = ot(), { darkMode: i, toColor: s, propsColorPanel: d } = K(), p = t.stops ?? [], u = s(t.color), m = s(t.negativeFillColor), g = s(t.borderColor), h = s(t.negativeBorderColor), y = t.gradient ?? !1, b = (e) => {
476
+ const r = { ...t };
477
+ for (const [t, o] of Object.entries(e)) void 0 === o ? delete r[t] : r[t] = o;
478
+ o(r);
479
+ }, x = { backgroundColor: "background.paper" };
480
+ return Mt(Rt, {
481
+ sx: {
482
+ display: "flex",
483
+ flexDirection: "column",
484
+ gap: 1
485
+ },
486
+ ...a,
487
+ children: [Mt(Co, { children: [
488
+ Mt(Rt, {
489
+ sx: {
490
+ display: "flex",
491
+ alignItems: "flex-start",
492
+ gap: 1
493
+ },
494
+ children: [Nt(Rt, {
495
+ sx: {
496
+ flex: "1 1 auto",
497
+ minWidth: 0,
498
+ display: "flex",
499
+ gap: .5,
500
+ flexWrap: "wrap"
501
+ },
502
+ children: ee.filter((e) => (e.gradient ?? !1) === y).map((e, t) => Nt(c, {
503
+ sheet: !0,
504
+ disabled: n,
505
+ onClick: () => b({
506
+ color: e.color,
507
+ gradient: e.gradient,
508
+ borderColor: e.borderColor
509
+ }),
510
+ children: Nt(T, { rows: f(e, s(e.color)?.toCSS("adaptive") ?? "var(--sxl-color-primary, rgb(33, 115, 70))") })
511
+ }, t))
512
+ }), Mt(eo, {
513
+ exclusive: !0,
514
+ size: "small",
515
+ value: y,
516
+ disabled: n,
517
+ onChange: (e, t) => {
518
+ null !== t && b({ gradient: !!t || void 0 });
519
+ },
520
+ sx: { flex: "0 0 auto" },
521
+ children: [Nt(Qt, {
522
+ value: !1,
523
+ sx: {
524
+ textTransform: "none",
525
+ pt: .25,
526
+ pb: .25
527
+ },
528
+ children: l("conditionalFormat.solidFill")
529
+ }), Nt(Qt, {
530
+ value: !0,
531
+ sx: {
532
+ textTransform: "none",
533
+ pt: .25,
534
+ pb: .25
535
+ },
536
+ children: l("conditionalFormat.gradientFill")
537
+ })]
538
+ })]
539
+ }),
540
+ Nt(zt, {
541
+ control: Nt(Ot, {
542
+ size: "small",
543
+ checked: !1 === t.showValue,
544
+ disabled: n,
545
+ onChange: (e) => b({ showValue: !e.target.checked && void 0 })
546
+ }),
547
+ label: Nt(to, {
548
+ variant: "body2",
549
+ children: l("conditionalFormat.showBarsOnly")
550
+ })
551
+ }),
552
+ Mt(Rt, {
553
+ sx: {
554
+ display: "flex",
555
+ alignItems: "center",
556
+ gap: .5
557
+ },
558
+ children: [
559
+ Nt(to, {
560
+ variant: "caption",
561
+ sx: {
562
+ color: "text.secondary",
563
+ flex: "0 0 62px"
564
+ },
565
+ children: l("conditionalFormat.bar")
566
+ }),
567
+ Nt(r, {
568
+ icon: "fill.colored",
569
+ tooltip: l("conditionalFormat.barColor"),
570
+ selectedColor: u,
571
+ disabled: n,
572
+ onSelectColor: (e) => b({ color: e ? e.toString() : void 0 }),
573
+ darkMode: i,
574
+ propsPanel: {
575
+ disableAlpha: !0,
576
+ ...d
577
+ }
578
+ }),
579
+ Nt(r, {
580
+ icon: "stroke.colored",
581
+ tooltip: l("conditionalFormat.barBorderColor"),
582
+ selectedColor: g,
583
+ disabled: n,
584
+ onSelectColor: (e) => b({ borderColor: e ? e.toString() : void 0 }),
585
+ darkMode: i,
586
+ propsPanel: {
587
+ disableAlpha: !0,
588
+ ...d
589
+ }
590
+ })
591
+ ]
592
+ }),
593
+ Mt(Rt, {
594
+ sx: {
595
+ display: "flex",
596
+ alignItems: "center",
597
+ gap: .5
598
+ },
599
+ children: [
600
+ Nt(to, {
601
+ variant: "caption",
602
+ sx: {
603
+ color: "text.secondary",
604
+ flex: "0 0 62px"
605
+ },
606
+ children: l("conditionalFormat.negative")
607
+ }),
608
+ Nt(r, {
609
+ icon: "fill.colored",
610
+ tooltip: l("conditionalFormat.negativeColor"),
611
+ selectedColor: m ?? u,
612
+ disabled: n,
613
+ onSelectColor: (e) => b({ negativeFillColor: e ? e.toString() : void 0 }),
614
+ darkMode: i,
615
+ propsPanel: {
616
+ disableAlpha: !0,
617
+ ...d
618
+ }
619
+ }),
620
+ Nt(r, {
621
+ icon: "stroke.colored",
622
+ tooltip: l("conditionalFormat.negativeBorderColor"),
623
+ selectedColor: h ?? g,
624
+ disabled: n,
625
+ onSelectColor: (e) => b({ negativeBorderColor: e ? e.toString() : void 0 }),
626
+ darkMode: i,
627
+ propsPanel: {
628
+ disableAlpha: !0,
629
+ ...d
630
+ }
631
+ }),
632
+ Nt(c, {
633
+ title: l("conditionalFormat.sameAsPositive"),
634
+ disabled: n || !t.negativeFillColor && !t.negativeBorderColor,
635
+ onClick: () => b({
636
+ negativeFillColor: void 0,
637
+ negativeBorderColor: void 0
638
+ }),
639
+ sx: {
640
+ color: "text.secondary",
641
+ "&:disabled": { opacity: .4 }
642
+ },
643
+ children: Nt(Oe, {
644
+ iconKey: "ClearFormats",
645
+ size: 16
646
+ })
647
+ })
648
+ ]
649
+ }),
650
+ Mt(Rt, {
651
+ sx: {
652
+ display: "flex",
653
+ gap: 1,
654
+ mt: .5
655
+ },
656
+ children: [Mt(Lt, {
657
+ size: "small",
658
+ sx: {
659
+ flex: 1,
660
+ minWidth: 0
661
+ },
662
+ children: [Nt(_t, { children: l("conditionalFormat.axis") }), Mt(Gt, {
663
+ label: l("conditionalFormat.axis"),
664
+ value: t.axisPosition ?? Eo,
665
+ disabled: n,
666
+ sx: x,
667
+ onChange: (e) => {
668
+ const t = e.target.value;
669
+ b({ axisPosition: t === Eo ? void 0 : t });
670
+ },
671
+ children: [
672
+ Nt(Ht, {
673
+ value: Eo,
674
+ children: l("conditionalFormat.automatic")
675
+ }),
676
+ Nt(Ht, {
677
+ value: "middle",
678
+ children: l("conditionalFormat.axisMiddle")
679
+ }),
680
+ Nt(Ht, {
681
+ value: "none",
682
+ children: l("conditionalFormat.axisNone")
683
+ })
684
+ ]
685
+ })]
686
+ }), Mt(Lt, {
687
+ size: "small",
688
+ sx: {
689
+ flex: 1,
690
+ minWidth: 0
691
+ },
692
+ children: [Nt(_t, { children: l("conditionalFormat.direction") }), Mt(Gt, {
693
+ label: l("conditionalFormat.direction"),
694
+ value: t.direction ?? Eo,
695
+ disabled: n,
696
+ sx: x,
697
+ onChange: (e) => {
698
+ const t = e.target.value;
699
+ b({ direction: t === Eo ? void 0 : t });
700
+ },
701
+ children: [
702
+ Nt(Ht, {
703
+ value: Eo,
704
+ children: l("conditionalFormat.automatic")
705
+ }),
706
+ Nt(Ht, {
707
+ value: "leftToRight",
708
+ children: l("conditionalFormat.leftToRight")
709
+ }),
710
+ Nt(Ht, {
711
+ value: "rightToLeft",
712
+ children: l("conditionalFormat.rightToLeft")
713
+ })
714
+ ]
715
+ })]
716
+ })]
717
+ })
718
+ ] }), Mt(Co, {
719
+ variant: "config",
720
+ children: [Nt(Wo, {
721
+ label: l("conditionalFormat.stop.minimum"),
722
+ stop: p[0] ?? { type: q.ColorStopType.AutoMin },
723
+ allowedTypes: Mo,
724
+ readOnly: n,
725
+ onStopChange: (e) => {
726
+ const t = p.slice();
727
+ t[0] = e, b({ stops: t });
728
+ }
729
+ }), Nt(Wo, {
730
+ label: l("conditionalFormat.stop.maximum"),
731
+ stop: p[1] ?? { type: q.ColorStopType.AutoMax },
732
+ allowedTypes: Ro,
733
+ readOnly: n,
734
+ onStopChange: (e) => {
735
+ const t = p.slice();
736
+ for (; t.length < 2;) t.push({ type: q.ColorStopType.AutoMax });
737
+ t[1] = e, b({ stops: t });
738
+ }
739
+ })]
740
+ })]
741
+ });
742
+ });
743
+ Bo.displayName = "DataBarRulePanel";
744
+ var Oo = go("conditionalFormat.noCellIcon"), Vo = go("conditionalFormat.cellIcon"), jo = {
745
+ borderColor: "primary.main",
746
+ boxShadow: (e) => `inset 0 0 0 1px ${e.palette.primary.main}`
747
+ }, $o = {
748
+ width: "28px",
749
+ height: "26px"
750
+ }, Lo = it((e) => {
751
+ const { icon: t, onPick: o } = e, r = ot();
752
+ return Mt(Rt, {
753
+ sx: {
754
+ display: "flex",
755
+ flexDirection: "column",
756
+ gap: "4px",
757
+ padding: "6px 8px"
758
+ },
759
+ children: [Nt(c, {
760
+ sheet: !0,
761
+ title: r(Oo),
762
+ "aria-pressed": null === t,
763
+ sx: {
764
+ ...$o,
765
+ ...null === t ? jo : null
766
+ },
767
+ onClick: () => {
768
+ o({ ...ae });
769
+ },
770
+ children: Nt(re, {
771
+ icons: [null],
772
+ size: 16
773
+ })
774
+ }), Nt(Rt, {
775
+ sx: {
776
+ display: "grid",
777
+ gridTemplateColumns: "repeat(8, auto)",
778
+ justifyContent: "start",
779
+ gap: "3px"
780
+ },
781
+ children: oe.map((e) => {
782
+ const n = (a = t, l = e.spec, !!a && a.iconKey === l.iconKey && a.color === l.color);
783
+ var a, l;
784
+ return Nt(c, {
785
+ sheet: !0,
786
+ title: j(r, e.spec),
787
+ "aria-pressed": n,
788
+ sx: {
789
+ ...$o,
790
+ ...n ? jo : null
791
+ },
792
+ onClick: () => {
793
+ o({
794
+ set: e.set,
795
+ id: e.id
796
+ });
797
+ },
798
+ children: Nt(re, {
799
+ icons: [e.spec],
800
+ size: 16
801
+ })
802
+ }, `${e.set}:${e.id}`);
803
+ })
804
+ })]
805
+ });
806
+ });
807
+ Lo.displayName = "IconCatalogPanel";
808
+ var zo = it(at((e, t) => {
809
+ const { icon: o, onPick: r, tooltip: n, ...a } = e, l = ot(), i = st((e) => {
810
+ const { closeFloat: t } = e, n = Nt(Lo, {
811
+ icon: o,
812
+ onPick: (e) => {
813
+ t?.(), r(e);
814
+ }
815
+ });
816
+ return wt({
817
+ ...e,
818
+ children: n
819
+ });
820
+ }, [o, r]);
821
+ return Nt(ft, {
822
+ ref: t,
823
+ createPopupPanel: i,
824
+ tooltip: n ?? l(Vo),
825
+ icon: Nt(re, {
826
+ icons: [o],
827
+ size: 16
828
+ }),
829
+ outlined: !0,
830
+ ...a
831
+ });
832
+ }));
833
+ zo.displayName = "IconPickerPopupButton";
834
+ var Ko = [
835
+ q.ColorStopType.Percent,
836
+ q.ColorStopType.Num,
837
+ q.ColorStopType.Percentile,
838
+ q.ColorStopType.Formula
839
+ ], _o = it((e) => {
840
+ const { scale: t, onScaleChange: o, readOnly: r, ...n } = e, a = ot(), l = t.iconSet ?? U.IconSet.TrafficLights3, i = 0 === ve(l).length, s = t.stops ?? [], d = s.length, c = Se(t), p = (e) => {
841
+ const r = { ...t };
842
+ for (const [t, o] of Object.entries(e)) void 0 === o ? delete r[t] : r[t] = o;
843
+ o(r);
844
+ }, u = st((e) => {
845
+ const { closeFloat: t } = e, o = Nt(I, {
846
+ groups: v,
847
+ disabled: r,
848
+ onPick: (e) => {
849
+ t?.(), e.type === q.ScaleType.IconSet && e.iconSet && ((e) => {
850
+ if (e === l) return;
851
+ const t = ke(e);
852
+ let o = s;
853
+ t !== s.length && (o = xe(t)), p({
854
+ iconSet: e,
855
+ stops: o,
856
+ icon: void 0
857
+ });
858
+ })(e.iconSet);
859
+ }
860
+ });
861
+ return wt({
862
+ ...e,
863
+ children: o
864
+ });
865
+ }, [r, t]), m = H.camelToPrettyCase(l);
866
+ return Mt(Rt, {
867
+ sx: {
868
+ display: "flex",
869
+ flexDirection: "column",
870
+ gap: 1
871
+ },
872
+ ...n,
873
+ children: [Mt(Co, { children: [
874
+ Nt(Rt, {
875
+ sx: {
876
+ display: "flex",
877
+ alignItems: "center",
878
+ gap: 1
879
+ },
880
+ children: Nt(ft, {
881
+ outlined: !0,
882
+ disabled: r,
883
+ label: m,
884
+ tooltip: m,
885
+ icon: Nt(Rt, {
886
+ sx: {
887
+ width: "82px",
888
+ display: "flex",
889
+ justifyContent: "center"
890
+ },
891
+ children: i ? Nt(to, {
892
+ variant: "caption",
893
+ noWrap: !0,
894
+ children: m
895
+ }) : Nt(re, {
896
+ icons: ve(l),
897
+ order: "descending",
898
+ size: 14,
899
+ gap: 3
900
+ })
901
+ }),
902
+ createPopupPanel: u
903
+ })
904
+ }),
905
+ i && Nt(to, {
906
+ variant: "caption",
907
+ sx: { color: "text.secondary" },
908
+ children: a("conditionalFormat.adoptedIconSet")
909
+ }),
910
+ Mt(Rt, {
911
+ sx: {
912
+ display: "flex",
913
+ gap: 1
914
+ },
915
+ children: [Nt(zt, {
916
+ control: Nt(Ot, {
917
+ size: "small",
918
+ checked: !1 === t.showValue,
919
+ disabled: r,
920
+ onChange: (e) => p({ showValue: !e.target.checked && void 0 })
921
+ }),
922
+ label: Nt(to, {
923
+ variant: "body2",
924
+ children: a("conditionalFormat.showIconsOnly")
925
+ })
926
+ }), Nt(zt, {
927
+ control: Nt(Ot, {
928
+ size: "small",
929
+ checked: t.reverse ?? !1,
930
+ disabled: r,
931
+ onChange: (e) => p({ reverse: !!e.target.checked || void 0 })
932
+ }),
933
+ label: Nt(to, {
934
+ variant: "body2",
935
+ children: a("conditionalFormat.reverseIcons")
936
+ })
937
+ })]
938
+ })
939
+ ] }), Nt(Co, {
940
+ variant: "config",
941
+ children: s.map((e, n) => {
942
+ const a = t.reverse ? d - 1 - n : n;
943
+ return Nt(Wo, {
944
+ stop: e,
945
+ allowedTypes: Ko,
946
+ showExclusive: !0,
947
+ readOnly: r || 0 === n,
948
+ leading: Nt(zo, {
949
+ icon: c[n] ?? null,
950
+ disabled: r || i,
951
+ onPick: (e) => o(Me(t, a, e))
952
+ }),
953
+ onStopChange: (e) => {
954
+ const t = s.slice();
955
+ t[n] = e, p({ stops: t });
956
+ }
957
+ }, n);
958
+ })
959
+ })]
960
+ });
961
+ });
962
+ _o.displayName = "IconSetRulePanel";
963
+ var Ho = (e, t, o) => $(e, t)?.toCSS("adaptive") ?? o, Uo = (e, t, o) => {
964
+ if (!e) return o;
965
+ if ("string" == typeof e) return Ho(e, t, o);
966
+ if (e.type === X.Type.None) return o;
967
+ const r = e, n = e;
968
+ return Ho(n.foreground ?? r.color ?? n.background, t, o);
969
+ }, Go = it((e) => {
970
+ const { conditionalFormat: t, size: o = 28, ...r } = e, { workbook: n, themeKey: a } = K();
971
+ Fe(t, "onAnyChange");
972
+ const l = t.getScale(), i = t.getStyle(), s = ct(() => {
973
+ try {
974
+ return n?.getStyles().getNormal().getFont().toCSS("adaptive") ?? {};
975
+ } catch {
976
+ return {};
977
+ }
978
+ }, [n, a]), d = ct(() => {
979
+ if (l?.type === q.ScaleType.ColorScale) return Nt(T, { rows: S(l.stops ?? [], w, n) });
980
+ if (l?.type === q.ScaleType.DataBar) return Nt(T, { rows: f(l, Ho(l.color, n, C), l.borderColor ? Ho(l.borderColor, n, C) : void 0) });
981
+ if (l?.type === q.ScaleType.IconSet) return Nt(Rt, {
982
+ sx: {
983
+ display: "flex",
984
+ alignItems: "center",
985
+ justifyContent: "center",
986
+ width: "100%",
987
+ height: "100%",
988
+ px: .5
989
+ },
990
+ children: Nt(re, {
991
+ icons: Se(l),
992
+ order: "descending",
993
+ size: 14,
994
+ gap: 3
995
+ })
996
+ });
997
+ const e = i?.font, t = e?.underline && e.underline !== J.UnderlineStyle.None;
998
+ return Nt(Rt, {
999
+ sx: {
1000
+ width: "100%",
1001
+ height: "100%",
1002
+ display: "flex",
1003
+ alignItems: "center",
1004
+ justifyContent: "center",
1005
+ ...s,
1006
+ backgroundColor: Uo(i?.fill, n, "transparent"),
1007
+ ...e?.color && "auto" !== e.color ? { color: Ho(e.color, n, P) } : null,
1008
+ ...e?.weight ? { fontWeight: e.weight } : null,
1009
+ ...e?.style ? { fontStyle: e.style } : null,
1010
+ textDecoration: [t ? "underline" : "", e?.strike ? "line-through" : ""].join(" ").trim() || "none",
1011
+ fontSize: `${Math.round(.5 * o)}px`,
1012
+ lineHeight: 1,
1013
+ outline: i?.borders ? `1px solid ${Ho(Object.values(i.borders)[0]?.color, n, A)}` : void 0,
1014
+ outlineOffset: "-3px"
1015
+ },
1016
+ children: "Aa"
1017
+ });
1018
+ }, [
1019
+ l,
1020
+ i,
1021
+ o,
1022
+ s,
1023
+ n,
1024
+ a
1025
+ ]);
1026
+ return Nt(c, {
1027
+ sheet: !0,
1028
+ className: "sxl-cf-rule-preview",
1029
+ sx: {
1030
+ width: "auto",
1031
+ minWidth: 1.7 * o + "px",
1032
+ height: `${o}px`
1033
+ },
1034
+ ...r,
1035
+ children: d
1036
+ });
1037
+ });
1038
+ Go.displayName = "RulePreview";
1039
+ var qo = (e, t) => {
1040
+ const o = e.getCondition()?.toString();
1041
+ if (o) return o;
1042
+ const r = e.getScale();
1043
+ return r ? H.camelToPrettyCase(r.type) : t("conditionalFormat.noCondition");
1044
+ }, Yo = {
1045
+ classic: go("conditionalFormat.tab.classic"),
1046
+ [q.ScaleType.ColorScale]: go("conditionalFormat.tab.colorScale"),
1047
+ [q.ScaleType.DataBar]: go("conditionalFormat.tab.dataBars"),
1048
+ [q.ScaleType.IconSet]: go("conditionalFormat.tab.iconSets")
1049
+ }, Xo = it((e) => {
1050
+ const { conditionalFormat: t } = e, o = ot();
1051
+ Fe(t, "onAnyChange");
1052
+ const r = t.getScale(), n = t.getCondition(), a = t.getStyle(), l = t.isProtected(), i = r?.type ?? "classic", s = pt({ scales: {} }), d = (e) => {
1053
+ t.update({ scale: e });
1054
+ }, c = Mt(Ut, {
1055
+ tabIndex: 0,
1056
+ className: D["editor-panel"],
1057
+ sx: {
1058
+ gap: (e) => e.spacing(1),
1059
+ paddingTop: (e) => e.spacing(1.25),
1060
+ paddingBottom: (e) => e.spacing(2),
1061
+ paddingLeft: (e) => e.spacing(1.5),
1062
+ paddingRight: (e) => e.spacing(1.5),
1063
+ border: (e) => `1px solid ${e.palette.divider}`,
1064
+ borderRadius: (e) => e.spacing(1.25),
1065
+ overflow: "auto"
1066
+ },
1067
+ children: [
1068
+ Mt(Rt, {
1069
+ sx: {
1070
+ display: "flex",
1071
+ flexDirection: "column",
1072
+ gap: (e) => e.spacing(1.75),
1073
+ margin: (e) => e.spacing(1.25),
1074
+ marginBottom: 0
1075
+ },
1076
+ children: [Mt(Rt, {
1077
+ sx: {
1078
+ display: "flex",
1079
+ alignItems: "center",
1080
+ gap: (e) => e.spacing(1.5)
1081
+ },
1082
+ children: [Nt(Go, {
1083
+ conditionalFormat: t,
1084
+ size: 48
1085
+ }), Nt(to, {
1086
+ variant: "body2",
1087
+ sx: {
1088
+ minWidth: 0,
1089
+ wordBreak: "break-word"
1090
+ },
1091
+ children: qo(t, o)
1092
+ })]
1093
+ }), Nt(L, {
1094
+ item: t,
1095
+ label: o("conditionalFormat.applyTo")
1096
+ })]
1097
+ }),
1098
+ Nt(Xt, {
1099
+ value: i,
1100
+ onChange: (e, o) => {
1101
+ l || ((e) => {
1102
+ if (e !== i) if ("classic" === i ? (s.current.condition = n?.toJSON() ?? null, s.current.style = a) : r && (s.current.scales[r.type] = r), "classic" === e) t.update({
1103
+ condition: s.current.condition ?? {
1104
+ operator: G.BuiltInOperatorNames.Between,
1105
+ param: null
1106
+ },
1107
+ style: s.current.style ?? null,
1108
+ scale: null
1109
+ });
1110
+ else {
1111
+ const o = s.current.scales[e] ?? (e === q.ScaleType.ColorScale ? ye() : e === q.ScaleType.DataBar ? fe() : be());
1112
+ t.update({
1113
+ scale: o,
1114
+ condition: null,
1115
+ style: null
1116
+ });
1117
+ }
1118
+ })(o);
1119
+ },
1120
+ variant: "fullWidth",
1121
+ sx: {
1122
+ minHeight: "36px",
1123
+ borderBottom: 1,
1124
+ borderColor: "divider",
1125
+ "& .MuiTab-root": {
1126
+ minHeight: "36px",
1127
+ textTransform: "none",
1128
+ pt: .5,
1129
+ pb: .5,
1130
+ px: .5,
1131
+ minWidth: 0
1132
+ }
1133
+ },
1134
+ children: Object.keys(Yo).map((e) => Nt(Yt, {
1135
+ value: e,
1136
+ label: o(Yo[e])
1137
+ }, e))
1138
+ }),
1139
+ "classic" === i && Mt(At, { children: [Nt(Do, {
1140
+ format: a,
1141
+ readOnly: l,
1142
+ onFormatChange: (e) => t.update({ style: e })
1143
+ }), Nt(x, {
1144
+ sx: {
1145
+ ...z,
1146
+ p: 2,
1147
+ pb: 1
1148
+ },
1149
+ selectorTitle: o("conditionalFormat.highlight"),
1150
+ condition: n,
1151
+ ranges: t.getRanges(),
1152
+ readOnly: l,
1153
+ onConditionChange: (e) => t.setCondition(e)
1154
+ })] }),
1155
+ r?.type === q.ScaleType.ColorScale && Nt(No, {
1156
+ scale: r,
1157
+ onScaleChange: d,
1158
+ readOnly: l
1159
+ }),
1160
+ r?.type === q.ScaleType.DataBar && Nt(Bo, {
1161
+ scale: r,
1162
+ onScaleChange: d,
1163
+ readOnly: l
1164
+ }),
1165
+ r?.type === q.ScaleType.IconSet && Nt(_o, {
1166
+ scale: r,
1167
+ onScaleChange: d,
1168
+ readOnly: l
1169
+ }),
1170
+ "classic" === i && Nt(Rt, {
1171
+ sx: {
1172
+ pl: 2,
1173
+ pr: 2,
1174
+ border: 1,
1175
+ borderColor: "divider",
1176
+ borderRadius: 1
1177
+ },
1178
+ children: Nt(zt, {
1179
+ control: Nt(Ot, {
1180
+ checked: t.isStopIfTrue(),
1181
+ disabled: l,
1182
+ onChange: (e) => t.setStopIfTrue(e.target.checked)
1183
+ }),
1184
+ label: o("conditionalFormat.stopIfTrue")
1185
+ })
1186
+ })
1187
+ ]
1188
+ });
1189
+ return Nt(u.Provider, {
1190
+ value: t,
1191
+ children: c
1192
+ });
1193
+ });
1194
+ Xo.displayName = "ConditionalFormatEditorPanel";
1195
+ var Jo = it(({ item: e }) => {
1196
+ const t = ot();
1197
+ return Fe(e, "onAnyChange"), !e.isStopIfTrue() || e.getScale() ? null : Nt(Rt, {
1198
+ sx: {
1199
+ display: "inline-flex",
1200
+ alignItems: "center",
1201
+ alignSelf: "flex-start",
1202
+ px: .75,
1203
+ py: .25,
1204
+ border: 1,
1205
+ borderColor: "divider",
1206
+ borderRadius: 1,
1207
+ color: "text.secondary"
1208
+ },
1209
+ children: Nt(to, {
1210
+ variant: "caption",
1211
+ children: t("conditionalFormat.stopIfTrue")
1212
+ })
1213
+ });
1214
+ });
1215
+ Jo.displayName = "StopIfTrueBadge";
1216
+ var Zo = it(({ item: e }) => {
1217
+ const t = ot();
1218
+ return Nt(L, {
1219
+ item: e,
1220
+ label: t("conditionalFormat.applyTo"),
1221
+ helperText: null
1222
+ });
1223
+ });
1224
+ Zo.displayName = "ConditionalFormatCardRanges";
1225
+ var Qo = {
1226
+ key: "conditional-format",
1227
+ messageKeys: {
1228
+ none: go("conditionalFormat.none"),
1229
+ addPrompt: go("conditionalFormat.addPrompt"),
1230
+ heading: go("conditionalFormat.heading"),
1231
+ insert: go("conditionalFormat.insert"),
1232
+ new: go("conditionalFormat.new"),
1233
+ moveUp: go("conditionalFormat.moveUp"),
1234
+ moveDown: go("conditionalFormat.moveDown"),
1235
+ edit: go("conditionalFormat.edit"),
1236
+ duplicate: go("conditionalFormat.duplicate"),
1237
+ delete: go("conditionalFormat.delete"),
1238
+ cancel: go("conditionalFormat.cancel"),
1239
+ save: go("conditionalFormat.save")
1240
+ },
1241
+ getCollection: (e) => e.getConditionalFormats(),
1242
+ changeEvents: ["onConditionalFormatsChange"],
1243
+ isReadOnly: (e) => !e.getProtection().isFormatCellsAllowed(),
1244
+ applyUpdate: (e, t) => {
1245
+ e.update(t);
1246
+ },
1247
+ validate: (e) => e.getCondition()?.validate() ?? null,
1248
+ applySeed: (e, t) => {
1249
+ e.update({
1250
+ condition: t.condition ?? null,
1251
+ style: t.style ?? null,
1252
+ scale: t.scale ?? null,
1253
+ stopIfTrue: t.stopIfTrue ?? !1
1254
+ });
1255
+ },
1256
+ getCardTitle: qo,
1257
+ CardMedia: ({ item: e }) => Nt(Go, {
1258
+ conditionalFormat: e,
1259
+ size: 32
1260
+ }),
1261
+ CardSubtitle: Zo,
1262
+ CardBody: Jo,
1263
+ EditorBody: ({ item: e }) => Nt(Xo, { conditionalFormat: e })
1264
+ }, er = it(at((e, t) => {
1265
+ const { workbook: o, args: r, ...n } = e;
1266
+ return Nt(g, {
1267
+ ref: t,
1268
+ workbook: o,
1269
+ descriptor: Qo,
1270
+ args: r,
1271
+ dragReorder: !0,
1272
+ ...n
1273
+ });
1274
+ }));
1275
+ er.displayName = "ConditionalFormatDetailsPanel";
1276
+ var tr = (e) => {
1277
+ const { model: t, entryKey: o, frame: r, args: n, ref: a, ...l } = e;
1278
+ return Nt(er, {
1279
+ ref: a,
1280
+ workbook: t,
1281
+ args: n,
1282
+ ...l
1283
+ });
1284
+ }, or = ["lines"], rr = {
1285
+ card: "_card_h0jnt_7",
1286
+ actionRoot: "_actionRoot_h0jnt_11",
1287
+ icons: "_icons_h0jnt_16",
1288
+ expand: "_expand_h0jnt_22",
1289
+ expandOpen: "_expandOpen_h0jnt_29",
1290
+ stackTraceContainer: "_stackTraceContainer_h0jnt_33",
1291
+ paper: "_paper_h0jnt_37",
1292
+ checkIcon: "_checkIcon_h0jnt_42",
1293
+ button: "_button_h0jnt_47"
1294
+ }, nr = it(at((e, t) => {
1295
+ const { id: o, message: r, iconVariant: n, error: a, hideIconVariant: l, ...i } = e, s = ot(), { closeSnackbar: d } = ko(), [c, p] = ut(!1), u = a ? so.collectErrorChain(a, !0)?.[0]?.error : void 0, m = u && !(u instanceof co), g = st(() => {
1296
+ p((e) => !e);
1297
+ }, []), h = st(() => {
1298
+ d(o);
1299
+ }, [o, d]);
1300
+ let y = u?.message;
1301
+ return !y && lt(r) && (y = r), y || "string" != typeof r || (y = r), y || (y = `Unknown Error: ${r}`), Nt(xo, {
1302
+ ref: t,
1303
+ className: yo(rr.root, "error-snackbar"),
1304
+ children: Mt(Et, {
1305
+ className: rr.card,
1306
+ style: {
1307
+ backgroundColor: "var(--sxl-color-error)",
1308
+ color: "var(--sxl-color-error-content)",
1309
+ border: "1px solid var(--sxl-color-error)"
1310
+ },
1311
+ children: [Mt(Bt, {
1312
+ className: rr.actionRoot,
1313
+ children: [
1314
+ l ? null : n?.error,
1315
+ Nt(to, {
1316
+ variant: "body2",
1317
+ component: "div",
1318
+ className: rr.typography,
1319
+ children: y
1320
+ }),
1321
+ Nt("div", { style: { flex: "1 1 auto" } }),
1322
+ Mt("div", {
1323
+ className: rr.icons,
1324
+ children: [m ? Nt(Kt, {
1325
+ "aria-label": s("toast.showMore"),
1326
+ size: "small",
1327
+ className: yo(rr.expand, { [rr.expandOpen]: c }),
1328
+ onClick: g,
1329
+ children: Nt(Oe, { iconKey: "ExpandMore" })
1330
+ }) : null, Nt(Kt, {
1331
+ size: "small",
1332
+ className: rr.expand,
1333
+ onClick: h,
1334
+ children: Nt(Oe, {
1335
+ iconKey: "Close",
1336
+ style: { transform: "scale(0.8)" }
1337
+ })
1338
+ })]
1339
+ })
1340
+ ]
1341
+ }), m ? Nt(Vt, {
1342
+ in: c,
1343
+ timeout: "auto",
1344
+ children: Nt("div", {
1345
+ className: rr.stackTraceContainer,
1346
+ style: {
1347
+ backgroundColor: "color-mix(in srgb, var(--sxl-color-error) 90%, var(--sxl-color-base-100))",
1348
+ borderTop: "1px solid var(--sxl-color-error)"
1349
+ },
1350
+ children: Nt(kt, {
1351
+ error: a,
1352
+ hideLineNumbers: !0
1353
+ })
1354
+ })
1355
+ }) : null]
1356
+ })
1357
+ });
1358
+ }));
1359
+ nr.displayName = "ToastError";
1360
+ var ar = () => {
1361
+ const e = ot();
1362
+ return Nt(bt, {
1363
+ label: "SheetXL",
1364
+ description: e("logo.description"),
1365
+ children: Nt(Rt, {
1366
+ component: "a",
1367
+ href: "https://www.sheetxl.com",
1368
+ target: "_blank",
1369
+ rel: "noopener noreferrer",
1370
+ sx: {
1371
+ display: "inline-flex",
1372
+ width: "24px",
1373
+ height: "24px",
1374
+ marginBottom: "4px",
1375
+ marginLeft: "6px",
1376
+ cursor: "pointer"
1377
+ },
1378
+ children: Nt(ne, { style: {
1379
+ width: "24px",
1380
+ height: "24px"
1381
+ } })
1382
+ })
1383
+ });
1384
+ }, lr = Nt(ar, {}), ir = it(at((e, t) => {
1385
+ const { workbook: o, className: r, logo: n = lr, mainElement: a, startElement: l, endElement: i, ...s } = e, [d, { width: c }] = Je(), p = c < 530, u = pt(null), m = bo([
1386
+ u,
1387
+ d,
1388
+ t
1389
+ ]);
1390
+ return Nt(Rt, {
1391
+ ...s,
1392
+ ref: m,
1393
+ className: r,
1394
+ children: E({
1395
+ isCompact: p,
1396
+ wrapperSelect: (e) => Mt(Rt, {
1397
+ sx: {
1398
+ display: "grid",
1399
+ gridTemplateColumns: "1fr auto 1fr",
1400
+ flex: "1",
1401
+ alignItems: "stretch",
1402
+ gap: (e) => e.spacing(1),
1403
+ paddingLeft: (e) => e.spacing(1),
1404
+ paddingRight: (e) => e.spacing(1)
1405
+ },
1406
+ children: [
1407
+ Mt(Rt, {
1408
+ sx: {
1409
+ display: "flex",
1410
+ flexDirection: "row",
1411
+ alignItems: "center",
1412
+ justifyContent: "start",
1413
+ gap: (e) => e.spacing(.5)
1414
+ },
1415
+ children: [n, Mt(Rt, {
1416
+ sx: {
1417
+ display: "flex",
1418
+ flexDirection: "row",
1419
+ alignItems: "center",
1420
+ gap: (e) => e.spacing(.25)
1421
+ },
1422
+ children: [l, e]
1423
+ })]
1424
+ }),
1425
+ Nt(Rt, {
1426
+ sx: {
1427
+ display: "flex",
1428
+ flexDirection: "row",
1429
+ minWidth: 0,
1430
+ overflow: "hidden",
1431
+ alignItems: "center",
1432
+ justifyContent: "center"
1433
+ },
1434
+ children: a
1435
+ }),
1436
+ Nt(Rt, {
1437
+ sx: {
1438
+ display: "flex",
1439
+ alignItems: "center",
1440
+ justifyContent: "end"
1441
+ },
1442
+ children: i
1443
+ })
1444
+ ]
1445
+ })
1446
+ })
1447
+ });
1448
+ }));
1449
+ ir.displayName = "StudioToolbar";
1450
+ var sr = (e, t) => {
1451
+ const o = new URL(window.location.pathname, window.location.origin);
1452
+ e && o.searchParams.set("source", e), e && t && o.searchParams.set("title", t), window.open(o.toString(), "sheetxl-" + ao.uuidV4(), "popup=true");
1453
+ };
1454
+ function dr(e, t) {
1455
+ const { workbook: o, setWorkbook: r, workbookTitle: n = "export", isDirty: a, notifier: l, refSave: i } = t;
1456
+ let s = !1;
1457
+ const d = async (e = null, t = null, o = null) => {
1458
+ const r = [], n = {
1459
+ source: e && "string" != typeof e ? e : null,
1460
+ typedCreateWorkbookOptions: t ?? void 0,
1461
+ onPassword: async ({ origin: e, validate: t }) => {
1462
+ const o = await l.showInput({
1463
+ title: ho("dialog.password.title"),
1464
+ description: ho("dialog.password.open.description", { name: e.getName() ?? "" }),
1465
+ inputType: "password",
1466
+ options: [{
1467
+ id: "Open",
1468
+ label: () => ho("dialog.open")
1469
+ }, "Cancel"],
1470
+ defaultOption: "Open",
1471
+ onValidateInput: async (e, o) => void 0 === o ? { valid: !0 } : e ? await t(e) ? { valid: !0 } : {
1472
+ valid: !1,
1473
+ message: ho("dialog.password.open.retry")
1474
+ } : {
1475
+ valid: !1,
1476
+ message: ho("dialog.password.open.required")
1477
+ }
1478
+ });
1479
+ return "Open" === o?.option ? o.input ?? null : null;
1480
+ },
1481
+ progress: { onWarning: (e) => {
1482
+ r.push(e);
1483
+ } }
1484
+ };
1485
+ let a;
1486
+ o && (n.progress.onStart = o);
1487
+ let i = -5;
1488
+ return pe.read({
1489
+ ...n,
1490
+ progress: {
1491
+ async onStart(e, t) {
1492
+ await n?.progress?.onStart?.(e, t), a = await l?.showBusy?.(ho("workbook.opening", { name: e?.getName() ?? "" })), t && a?.setProgress?.(0, t);
1493
+ },
1494
+ onProgress(e, t) {
1495
+ if (!t) return;
1496
+ const o = Math.min(100, Math.round(e / t * 100));
1497
+ if (o >= 100) {
1498
+ if (100 === i) return;
1499
+ i = 100, a?.setProgress?.(e, t);
1500
+ return;
1501
+ }
1502
+ o - i < 5 || (i = o, a?.setProgress?.(e, t));
1503
+ },
1504
+ onComplete() {
1505
+ a?.(), r.length > 0 && (l.showMessage(ho("workbook.importWarnings")), console.warn("Import warnings:\n" + r.join("\n")));
1506
+ },
1507
+ onWarning(e, t) {
1508
+ n?.progress?.onWarning?.(e, t);
1509
+ }
1510
+ }
1511
+ });
1512
+ }, c = async (e, t, o = !1, r) => {
1513
+ let a;
1514
+ const i = {
1515
+ format: t?.key,
1516
+ progress: {
1517
+ async onStart(e) {
1518
+ a = await l?.showBusy?.(ho("workbook.saving", { name: e?.getName() ?? "" }));
1519
+ },
1520
+ onComplete() {
1521
+ a?.();
1522
+ }
1523
+ },
1524
+ onWarnings: r ?? (async ({ warnings: e, origin: t, canCancel: o }) => {
1525
+ a?.(), console.warn(`Not written to '${t.getName()}':\n${e.map((e) => ` ${e.message}`).join("\n")}`);
1526
+ const r = ho("dialog.writeWarnings.title"), n = t.getFormat(), i = (n ? (await pe.getWriteFormats({ search: n }))[0] : void 0)?.description ?? n ?? "", s = ho("dialog.writeWarnings.keep");
1527
+ return o ? "Save" === await l.showOptions({
1528
+ title: r,
1529
+ type: je.Warning,
1530
+ description: `${ho("dialog.writeWarnings.confirm", { format: i })}\n\n${s}`,
1531
+ options: [{
1532
+ id: "Save",
1533
+ label: () => ho("dialog.save")
1534
+ }, "Cancel"],
1535
+ defaultOption: "Cancel"
1536
+ }) && (a = await l?.showBusy?.(ho("workbook.saving", { name: t?.getName() ?? "" })), !0) : (l.showOptions({
1537
+ title: r,
1538
+ type: je.Warning,
1539
+ description: `${ho("dialog.writeWarnings.saved", { format: i })}\n\n${s}`,
1540
+ options: ["Ok"]
1541
+ }), !0);
1542
+ })
1543
+ };
1544
+ let s;
1545
+ if (o) {
1546
+ const o = e.getOrigin(), r = t?.exts?.[0] ?? (o.getExtension() || "sxl"), a = `${n || o.getName() || ho("workbook.defaultName")}.${r}`;
1547
+ s = await pe.writeAs(e, a, {
1548
+ ...i,
1549
+ prompt: !0
1550
+ });
1551
+ } else s = await pe.write(e, void 0, i);
1552
+ return s;
1553
+ };
1554
+ let p = null;
1555
+ return e.updateCommand("newWorkbook", { callback: async (e) => {
1556
+ const t = pe.canRead() && !a();
1557
+ e?.source ? t && p ? await p({
1558
+ url: e.source,
1559
+ title: e.title
1560
+ }) : sr(e.source, e.title) : t ? r({}) : sr();
1561
+ } }), e.updateCommand("closeWorkbook", { callback: async () => {
1562
+ a() && "Close" !== await l.showOptions({
1563
+ title: ho("dialog.confirm.title"),
1564
+ description: ho("dialog.unsavedChanges"),
1565
+ options: [{
1566
+ id: "Close",
1567
+ label: () => ho("dialog.close")
1568
+ }, "Cancel"],
1569
+ defaultOption: "Cancel"
1570
+ }) || window.close();
1571
+ } }), (async () => {
1572
+ const t = await pe.getWriteFormats();
1573
+ if (s) return;
1574
+ const n = pe.canWrite(), u = pe.canRead();
1575
+ if (n) {
1576
+ const r = (e) => {
1577
+ const r = e ? t.find((t) => t.key === e) : void 0;
1578
+ c(o, r, !0).catch((e) => l.showError(e));
1579
+ };
1580
+ e.updateCommand("saveWorkbook", { callback: () => {
1581
+ c(o, void 0, !1).catch((e) => l.showError(e));
1582
+ } }), i && (i.current = (e) => c(o, void 0, !1, e?.onWarnings)), e.updateCommand("saveWorkbookAs", { callback: (e) => {
1583
+ r(e);
1584
+ } });
1585
+ for (const o of t) {
1586
+ const t = o.key;
1587
+ e.updateCommand(`saveWorkbookAs${t}`, {
1588
+ label: () => ho("command.saveAsFormat.label", { format: o.description }),
1589
+ groupLabels: {
1590
+ workbook: () => ho("command.saveAsFormat.workbook", { format: o.description }),
1591
+ saveWorkbookOptions: () => ho("command.saveAsFormat.compact", { format: o.description })
1592
+ },
1593
+ tags: o.tags,
1594
+ description: () => ho("command.saveAsFormat", { format: o.description }),
1595
+ icon: "CSV" === t ? "FileDownloadAsCSV" : "Excel" === t ? "FileDownloadAsExcel" : "FileDownloadAsSheet",
1596
+ callback: () => {
1597
+ r(t);
1598
+ }
1599
+ });
1600
+ }
1601
+ }
1602
+ const m = async (e = null) => {
1603
+ const t = { csv: {
1604
+ date1904: o.getRuntime().isDate1904(),
1605
+ ...o.options
1606
+ } };
1607
+ try {
1608
+ let r = "";
1609
+ const n = async (e) => {
1610
+ r = e?.getName() ?? "";
1611
+ }, a = await d(e, t, n);
1612
+ if (!a) return;
1613
+ const l = a.getSheets().getItems();
1614
+ await o.doBatch(async () => {
1615
+ for (let e = 0; e < l.length; e++) {
1616
+ const t = l[e], n = 1 === l.length ? r : t.getName(), a = o.findValidSheetName(n);
1617
+ await o.getSheets().add({
1618
+ name: a,
1619
+ autoSelect: e === l.length - 1
1620
+ }).getEntireRange().copyFrom(t.getEntireRange());
1621
+ }
1622
+ }, go("op.importData")), a.close();
1623
+ } catch (e) {
1624
+ l.showError(e);
1625
+ }
1626
+ };
1627
+ if (e.updateCommand("insertDataFromFile", {
1628
+ tags: ["noTransaction", "noRepeat"],
1629
+ callback: async (e = null) => {
1630
+ let t = e;
1631
+ if (t || pe.canRead() || (t = await (async () => {
1632
+ const e = await pe.getReadFormats(), t = [...new Set(e.flatMap((e) => e.exts))].map((e) => `.${e}`);
1633
+ return lo.openFileDialog(t.length ? t.join(",") : "*.*");
1634
+ })(), t)) return m(t);
1635
+ }
1636
+ }), e.updateCommand("insertDataFromURL", {
1637
+ tags: ["noTransaction", "noRepeat"],
1638
+ callback: async (e) => {
1639
+ if (!e) {
1640
+ const t = await l.showInput({
1641
+ title: ho("dialog.importFromWeb.title"),
1642
+ description: ho("dialog.importFromWeb.description"),
1643
+ inputLabel: ho("dialog.webAddress.inputLabel"),
1644
+ initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
1645
+ propsInput: { style: { minWidth: "440px" } },
1646
+ options: [{
1647
+ id: "Import",
1648
+ label: () => ho("dialog.import")
1649
+ }]
1650
+ });
1651
+ if ("Import" !== t.option) return;
1652
+ e = t.input;
1653
+ }
1654
+ if (e) try {
1655
+ const t = await fetch(e);
1656
+ if (!t.ok) throw new Error(`Could not fetch '${e}' (${t.status} ${t.statusText}).`);
1657
+ const o = await t.blob(), r = decodeURIComponent(e.split("/").pop()?.split("?")[0] || "") || "import.xlsx";
1658
+ await m(new File([o], r, { type: o.type }));
1659
+ } catch (e) {
1660
+ l.showError(e);
1661
+ }
1662
+ }
1663
+ }), u) {
1664
+ const t = async () => !a() || "Open" === await l.showOptions({
1665
+ title: ho("dialog.confirm.title"),
1666
+ description: ho("dialog.unsavedChanges"),
1667
+ options: [{
1668
+ id: "Open",
1669
+ label: () => ho("dialog.open")
1670
+ }, "Cancel"],
1671
+ defaultOption: "Cancel"
1672
+ }), n = async (e = null) => {
1673
+ const t = { csv: {
1674
+ date1904: o.getRuntime().isDate1904(),
1675
+ ...o.options
1676
+ } };
1677
+ try {
1678
+ const o = await d(e, t);
1679
+ if (!o) return;
1680
+ r(o);
1681
+ } catch (e) {
1682
+ l.showError(e);
1683
+ }
1684
+ };
1685
+ e.updateCommand("openWorkbook", { callback: async (e = null) => {
1686
+ await t() && await n(e);
1687
+ } }), p = async (e) => {
1688
+ let o = "string" == typeof e ? e : e?.url;
1689
+ const r = "string" == typeof e ? void 0 : e?.title;
1690
+ if (!o) {
1691
+ const e = await l.showInput({
1692
+ title: ho("dialog.openFromWeb.title"),
1693
+ description: ho("dialog.openFromWeb.description"),
1694
+ inputLabel: ho("dialog.webAddress.inputLabel"),
1695
+ initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
1696
+ propsInput: { style: { minWidth: "440px" } },
1697
+ options: [{
1698
+ id: "Open",
1699
+ label: () => ho("dialog.open")
1700
+ }]
1701
+ });
1702
+ if ("Open" !== e.option) return;
1703
+ o = e.input;
1704
+ }
1705
+ if (o && await t()) try {
1706
+ const e = await fetch(o);
1707
+ if (!e.ok) throw new Error(`Could not fetch '${o}' (${e.status} ${e.statusText}).`);
1708
+ const t = await e.blob(), a = decodeURIComponent(o.split("/").pop()?.split("?")[0] || "") || "workbook.xlsx", l = a.match(/\.[^/.]+$/)?.[0] ?? "", i = r ? `${r}${l}` : a;
1709
+ await n(new File([t], i, { type: t.type }));
1710
+ } catch (e) {
1711
+ l.showError(e);
1712
+ }
1713
+ }, e.updateCommand("openWorkbookFromUrl", { callback: p });
1714
+ }
1715
+ })(), () => {
1716
+ s = !0, i && (i.current = null);
1717
+ };
1718
+ }
1719
+ var cr = Tt(uo("studio:shortcutKeysDialog", () => import("./DNSjK5DAH3M14Qbc.mjs")).load);
1720
+ M(), O();
1721
+ var pr = /* @__PURE__ */ new Set(["ui"]), ur = (e) => {
1722
+ const t = (e) => {
1723
+ if ("function" != typeof e) return e;
1724
+ try {
1725
+ return e();
1726
+ } catch {
1727
+ return;
1728
+ }
1729
+ }, o = (e, o) => {
1730
+ const r = t(e);
1731
+ return "string" == typeof r ? mo(r, o, io.getActive()) : void 0;
1732
+ }, r = [];
1733
+ for (const n of e.names()) if (!pr.has(n)) for (const a of e.keys(n)) {
1734
+ const l = e.resolveDefinition(n, a);
1735
+ r.push({
1736
+ groupKey: n,
1737
+ command: {
1738
+ getLabel: () => o(l?.label, l?.params) ?? a,
1739
+ getIcon: () => t(l?.icon),
1740
+ getDescription: () => o(l?.description, l?.params) ?? "",
1741
+ getShortcut: () => t(l?.shortcut) ?? null,
1742
+ getScope: () => n,
1743
+ getScopeLabel: () => Re.DefaultCommandCatalogService.getScopeLabel(n)
1744
+ }
1745
+ });
1746
+ }
1747
+ return { getAllCommands: () => r };
1748
+ }, mr = (e) => {
1749
+ const { children: t, workbook: o, setWorkbook: r, workbookTitle: n, isDirty: a, refSave: l, fullscreenTarget: i } = e, s = Re.useCommandScope(), d = Ze(), { showModal: c } = Pt(), p = ot(), u = pt(a);
1750
+ u.current = a;
1751
+ const m = Ge(() => {
1752
+ const e = s?.getRoot().getRegistry();
1753
+ if (!e) return;
1754
+ const t = c(cr, {
1755
+ title: p("dialog.shortcutKeys.title"),
1756
+ commands: ur(e),
1757
+ onDone: () => t.hide(),
1758
+ onLoadError: (e) => {
1759
+ t.destroy(), d.showError(e);
1760
+ }
1761
+ });
1762
+ }, [s, c]);
1763
+ dt(() => {
1764
+ if (!s) return;
1765
+ const e = s.getRoot().contribution();
1766
+ return function(e, t) {
1767
+ const o = () => t.showShortcuts();
1768
+ e.updateCommand("showKeyboardShortcuts", { callback: o }), e.updateCommand("help", { callback: o });
1769
+ for (const [t, o] of Object.entries({
1770
+ gotoUrlGithub: "https://github.com/sheetxl/sheetxl",
1771
+ gotoUrlDiscord: "https://discord.gg/NTKdwUgK9p",
1772
+ gotoUrlDocumentation: "https://www.sheetxl.com/docs",
1773
+ gotoUrlIssue: "https://github.com/sheetxl/sheetxl/issues"
1774
+ })) e.updateCommand(t, { callback: () => {
1775
+ window?.open(o);
1776
+ } });
1777
+ }(e, { showShortcuts: m }), () => e.remove();
1778
+ }, [s, m]);
1779
+ const g = ro("(prefers-color-scheme: dark)"), { themeMode: h } = et(), [y, f] = Qe(ce.Mode, de[ce.Mode]), [b, x] = Qe(ce.DarkGrid, de[ce.DarkGrid]), [v, k] = Qe(ce.DarkImages, de[ce.DarkImages]);
1780
+ dt(() => {
1781
+ if (!s) return;
1782
+ const e = s.getRoot().contribution();
1783
+ return function(e, t) {
1784
+ e.updateCommand("themeMode", {
1785
+ state: t.mode ?? null,
1786
+ params: { dark: t.isDark },
1787
+ icon: t.isDark ? "DarkMode" : "LightMode",
1788
+ callback: () => t.setMode(t.isDark ? "light" : "dark")
1789
+ }), e.updateCommand("defaultThemeMode", {
1790
+ state: !t.mode,
1791
+ icon: t.systemDefaultDark ? "SystemDefaultDarkMode" : "SystemDefaultLightMode",
1792
+ callback: () => t.setMode(null)
1793
+ }), e.updateCommand("enableDarkGrid", {
1794
+ state: t.enableDarkGrid,
1795
+ callback: () => t.setEnableDarkGrid((e) => !e)
1796
+ }), e.updateCommand("enableDarkImages", {
1797
+ state: t.enableDarkImages,
1798
+ callback: () => t.setEnableDarkImages((e) => !e)
1799
+ });
1800
+ }(e, {
1801
+ mode: y,
1802
+ setMode: f,
1803
+ isDark: "dark" === y || !y && "dark" === h,
1804
+ systemDefaultDark: g,
1805
+ enableDarkGrid: b,
1806
+ setEnableDarkGrid: x,
1807
+ enableDarkImages: v,
1808
+ setEnableDarkImages: k
1809
+ }), () => e.remove();
1810
+ }, [
1811
+ s,
1812
+ y,
1813
+ h,
1814
+ g,
1815
+ b,
1816
+ v,
1817
+ f,
1818
+ x,
1819
+ k
1820
+ ]);
1821
+ const [C, w] = Qe(Ve.Active, null), [S, T] = ut(() => io.getActive());
1822
+ dt(() => io.addChangeListener(T), []), dt(() => {
1823
+ C && C !== io.getActive() && io.setActive(C);
1824
+ }, [C]), dt(() => {
1825
+ if (!s) return;
1826
+ const e = s.getRoot().contribution();
1827
+ return function(e, t) {
1828
+ e.updateCommand("language", {
1829
+ state: t.active,
1830
+ callback: (e) => {
1831
+ e && t.setActive(e);
1832
+ }
1833
+ });
1834
+ }(e, {
1835
+ active: S,
1836
+ setActive: (e) => {
1837
+ w(e);
1838
+ }
1839
+ }), () => e.remove();
1840
+ }, [
1841
+ s,
1842
+ S,
1843
+ w
1844
+ ]);
1845
+ const F = ct(() => ({ current: i ?? null }), [i]), { isFullscreenAvailable: D, isFullscreenEnabled: I, toggleFullscreen: P } = qe({ target: F });
1846
+ dt(() => {
1847
+ if (!s) return;
1848
+ const e = s.getRoot().contribution();
1849
+ return function(e, t) {
1850
+ e.updateCommand("fullScreenToggle", {
1851
+ state: t.isFullscreenEnabled,
1852
+ disabledReasons: t.isFullscreenAvailable ? [] : [go("reason.fullscreenUnavailable")],
1853
+ icon: t.isFullscreenEnabled ? "FullScreenOff" : "FullScreen",
1854
+ callback: () => {
1855
+ t.toggleFullscreen();
1856
+ }
1857
+ });
1858
+ }(e, {
1859
+ isFullscreenAvailable: D,
1860
+ isFullscreenEnabled: I,
1861
+ toggleFullscreen: P
1862
+ }), () => e.remove();
1863
+ }, [
1864
+ s,
1865
+ D,
1866
+ I,
1867
+ P
1868
+ ]);
1869
+ const W = Pe(!0);
1870
+ return dt(() => {
1871
+ if (!s) return;
1872
+ const e = s.getRoot().contribution();
1873
+ return function(e, t) {
1874
+ e.updateCommand("protectWorkbook", {
1875
+ tags: ["noTransaction", "noRepeat"],
1876
+ callback: () => {
1877
+ t("manageProtection", { args: { tab: "workbook" } });
1878
+ }
1879
+ });
1880
+ }(e, (e, t) => W.activate(e, t)), () => e.remove();
1881
+ }, [s, W]), dt(() => {
1882
+ if (!s || !o) return;
1883
+ const e = s.getRoot().contribution(), t = dr(e, {
1884
+ workbook: o,
1885
+ setWorkbook: r,
1886
+ workbookTitle: n ?? void 0,
1887
+ isDirty: () => u.current?.() ?? !1,
1888
+ notifier: d,
1889
+ refSave: l
1890
+ });
1891
+ return () => {
1892
+ t(), e.remove();
1893
+ };
1894
+ }, [
1895
+ s,
1896
+ o,
1897
+ r,
1898
+ n,
1899
+ d,
1900
+ l
1901
+ ]), t;
1902
+ };
1903
+ mr.displayName = "StudioCommandProvider";
1904
+ var gr = ({ renderWorkbook: e }) => {
1905
+ const t = Re.useCommandResolver(), o = pt(null), r = ot(), [n, a] = ut(null), l = st((e) => {
1906
+ const o = e.dataTransfer;
1907
+ if (t && o) {
1908
+ if ("dragenter" === e.type || "dragover" === e.type) {
1909
+ const e = o.types, t = o.items;
1910
+ let r = !1;
1911
+ for (let e = 0; e < t.length; e++) if (t[e].type.startsWith("image/")) {
1912
+ r = !0;
1913
+ break;
1914
+ }
1915
+ r ? a("insertImage") : e.includes("Files") && t.length > 0 ? a("open") : (o.effectAllowed = "none", o.dropEffect = "none");
1916
+ } else if ("dragleave" === e.type) {
1917
+ const t = e.relatedTarget;
1918
+ t && e.currentTarget.contains(t) || a(null);
1919
+ }
1920
+ e.preventDefault();
1921
+ }
1922
+ }, [t]), i = Ge((e) => {
1923
+ e.preventDefault();
1924
+ const r = n;
1925
+ if (a(null), r && t && (e.stopPropagation(), e.dataTransfer.files && e.dataTransfer.files.length > 0)) {
1926
+ const r = e.dataTransfer.files[0];
1927
+ if (!r) return;
1928
+ if (r?.type?.startsWith("image/")) {
1929
+ const n = o.current?.getSheetElement()?.getGridSurface().getPaneFromClient(e.clientX, e.clientY);
1930
+ if (!n) return;
1931
+ const a = n.getPanePointFromPointer(e.clientX, e.clientY);
1932
+ if (!a) return;
1933
+ const l = n.toAbsoluteBounds({
1934
+ x: a.x ?? 0,
1935
+ y: a.y ?? 0,
1936
+ width: 0,
1937
+ height: 0
1938
+ });
1939
+ t.execute("insertImageFromFile", {
1940
+ file: r,
1941
+ options: { bounds: {
1942
+ x: l.x,
1943
+ y: l.y
1944
+ } }
1945
+ });
1946
+ } else {
1947
+ if (!pe.canRead()) return;
1948
+ const o = e.dataTransfer.items?.[0], n = "undefined" != typeof window && window.isSecureContext ? o?.getAsFileSystemHandle?.() : void 0;
1949
+ n ? n.then((e) => t.execute("openWorkbook", "file" === e?.kind ? e : r)).catch(() => t.execute("openWorkbook", r)) : t.execute("openWorkbook", r);
1950
+ }
1951
+ }
1952
+ }, [t, n]), s = ct(() => {
1953
+ if (!n) return null;
1954
+ const e = "insertImage" === n;
1955
+ return Nt(Rt, {
1956
+ className: "drop-overlay",
1957
+ sx: {
1958
+ position: "absolute",
1959
+ inset: 0,
1960
+ zIndex: 1,
1961
+ boxSizing: "border-box",
1962
+ pointerEvents: "none",
1963
+ display: "flex",
1964
+ justifyContent: "center",
1965
+ alignItems: "center",
1966
+ backgroundColor: (e) => oo(e.palette.primary.main, .46),
1967
+ outline: (e) => `2px dashed ${e.palette.primary.main}`,
1968
+ outlineOffset: "-6px",
1969
+ borderRadius: 2
1970
+ },
1971
+ children: Mt(Ut, {
1972
+ elevation: 6,
1973
+ sx: {
1974
+ display: "flex",
1975
+ alignItems: "center",
1976
+ gap: 1.5,
1977
+ px: 3,
1978
+ py: 2,
1979
+ borderRadius: 2,
1980
+ color: "text.primary",
1981
+ "& .drop-overlay-icon": { color: "primary.main" }
1982
+ },
1983
+ children: [Nt(Oe, {
1984
+ iconKey: e ? "InsertImage" : "FileOpen",
1985
+ className: "drop-overlay-icon",
1986
+ size: 32
1987
+ }), Nt(to, {
1988
+ variant: "h6",
1989
+ component: "span",
1990
+ children: r(e ? "drop.insertImage" : "drop.open")
1991
+ })]
1992
+ })
1993
+ });
1994
+ }, [n, r]);
1995
+ return Mt(At, { children: [e({
1996
+ ref: o,
1997
+ onDragStart: (e) => {
1998
+ if (e.target.src) {
1999
+ const t = new Image();
2000
+ t.src = e.target.src, e.dataTransfer.setDragImage(t, 1, 1);
2001
+ }
2002
+ },
2003
+ onDragEnter: l,
2004
+ onDragLeave: l,
2005
+ onDragOver: l,
2006
+ onDrop: i
2007
+ }), s] });
2008
+ }, hr = it((e) => {
2009
+ const { workbook: t, setWorkbook: o, refDocumentTitle: r, titleWorkbook: n, setWorkbookTitle: a, isDirty: l, initialCommandAnchor: i, renderWorkbook: s, refSave: d, host: c } = e;
2010
+ return Nt(Q, {
2011
+ initialAnchor: i,
2012
+ children: Nt(mr, {
2013
+ workbook: t,
2014
+ setWorkbook: o,
2015
+ workbookTitle: n,
2016
+ isDirty: l,
2017
+ refSave: d,
2018
+ fullscreenTarget: c,
2019
+ children: Nt(gr, { renderWorkbook: s })
2020
+ })
2021
+ });
2022
+ });
2023
+ hr.displayName = "CommandsWrapper";
2024
+ var yr = {
2025
+ sort: uo("studio:sortDialog", () => import("./ETK6T6G0SIcFXDe5.mjs")).load,
2026
+ hyperlink: uo("studio:hyperlinkDialog", () => import("./BYVLi0md4AYuDsB_.mjs")).load,
2027
+ find: uo("studio:findReplaceWindow", () => import("./BcwMb6CyVfvEwbHn.mjs")).load,
2028
+ tableNew: uo("studio:tableNewDialog", () => import("./cqzp431iNSLWictb.mjs")).load,
2029
+ namedDetails: uo("studio:namedReferenceDialog", () => import("./CKu1AtRgyltyEdEN.mjs")).load,
2030
+ insertFunction: uo("studio:insertFunctionDialog", () => import("./D9rzScOA9pEYFrtz.mjs")).load,
2031
+ resizeHeader: uo("studio:resizeHeaderDialog", () => import("./ci8d-mF1H9wnYzix.mjs")).load,
2032
+ outlineSettings: uo("studio:outlineSettingsDialog", () => import("./B_jRGdwGFkudwmL-.mjs")).load,
2033
+ fillSeries: uo("studio:fillSeriesDialog", () => import("./BYsG3KYVmxSe_CIQ.mjs")).load,
2034
+ workbookStatistics: uo("studio:workbookStatisticsDialog", () => import("./DZzvTQxIKr9LbEsA.mjs")).load,
2035
+ password: uo("studio:passwordDialog", () => import("./index.mjs").then((e) => e.o)).load
2036
+ }, fr = ["find"], br = it((e) => {
2037
+ const { children: t } = e, o = ko(), r = o ? o.enqueueSnackbar : () => {}, n = o ? o.closeSnackbar : () => {}, a = pt(/* @__PURE__ */ new Set()), l = pt(null), i = pt(null), [s, d] = ut({
2038
+ label: null,
2039
+ progress: null
2040
+ }), c = ot(), p = ao.EmptyObject, u = It(p), m = Wt(p), g = Dt(p), h = pt(!1);
2041
+ dt(() => {
2042
+ if (h.current) return;
2043
+ h.current = !0;
2044
+ const e = window, t = e.requestIdleCallback ?? ((e) => setTimeout(e, 500)), o = e.cancelIdleCallback ?? clearTimeout, r = t(() => {
2045
+ for (const e of fr) u(e, yr[e], { prewarm: !0 }).catch(() => {});
2046
+ });
2047
+ return () => o(r);
2048
+ }, []);
2049
+ const y = pt(/* @__PURE__ */ new Set()), f = ct(() => {
2050
+ const e = (e, t) => {
2051
+ if (t?.onceKey) {
2052
+ if (y.current.has(t.onceKey)) return;
2053
+ const e = new Set(y.current);
2054
+ e.add(t.onceKey), y.current = e;
2055
+ }
2056
+ const o = {
2057
+ variant: t?.type ?? je.Info,
2058
+ anchorOrigin: {
2059
+ vertical: "top",
2060
+ horizontal: "center"
2061
+ },
2062
+ preventDuplicate: t?.preventDuplicate,
2063
+ persist: t?.persist ?? t?.type === je.Error,
2064
+ action: (e) => Nt(Kt, {
2065
+ onClick: () => n(e),
2066
+ children: Nt(Oe, { iconKey: "Cancel" })
2067
+ })
2068
+ };
2069
+ t?.enqueueProps && Object.assign(o, t.enqueueProps), e || console.log("message is 'null'", t), r(e ?? "Alert", o);
2070
+ }, t = {
2071
+ showMessage: e,
2072
+ showBusy: (e, t) => {
2073
+ const o = Symbol("busy");
2074
+ a.current.add(o), i.current = e, null != e && "string" != typeof e && d((t) => t.label === e ? t : {
2075
+ ...t,
2076
+ label: e
2077
+ });
2078
+ const r = Ue(() => {
2079
+ a.current.delete(o) && (a.current.size > 0 || (St(l.current), i.current = null, d((e) => null === e.label && null === e.progress ? e : {
2080
+ label: null,
2081
+ progress: null
2082
+ })));
2083
+ }, (e, t) => {
2084
+ const o = t && t > 0 && null != e ? Math.max(0, Math.min(1, e / t)) : null;
2085
+ d((e) => e.progress === o ? e : {
2086
+ ...e,
2087
+ progress: o
2088
+ });
2089
+ }, (e) => {
2090
+ i.current = e, "string" == typeof e ? Ft(l.current, e) : d((t) => ({
2091
+ ...t,
2092
+ label: e
2093
+ }));
2094
+ }), n = Ft(l.current, "string" == typeof e ? e : void 0);
2095
+ return n ? n.then(() => r) : r;
2096
+ },
2097
+ showWindow: (e, t) => {
2098
+ const o = t;
2099
+ return t = {
2100
+ ...t,
2101
+ onKeyDown: (e) => {
2102
+ e.isDefaultPrevented() || e.isPropagationStopped() || o?.onKeyDown?.(e);
2103
+ }
2104
+ }, u(e, yr[e], t);
2105
+ },
2106
+ showOptions: m,
2107
+ showInput: g,
2108
+ showError: (t) => {
2109
+ let o, r = je.Error, n = c("error.unknown");
2110
+ "string" == typeof t ? n = t : t instanceof Error && (o = t, t.message && (n = c(t.message))), t instanceof po && (r = je.Info), e(n, {
2111
+ type: r,
2112
+ enqueueProps: { error: o }
2113
+ });
2114
+ }
2115
+ }, o = new Be();
2116
+ return o.setOverrides(t), o;
2117
+ }, [c]), b = ct(() => Nt(mt, {
2118
+ ref: l,
2119
+ autoStart: !1,
2120
+ icon: Nt(gt, { sx: {
2121
+ transform: "scale(0.7)",
2122
+ marginLeft: "-6px"
2123
+ } }),
2124
+ panel: !0,
2125
+ label: s.label ?? ("string" == typeof i.current ? i.current : void 0),
2126
+ progress: s.progress,
2127
+ sx: {
2128
+ position: "absolute",
2129
+ left: "0",
2130
+ top: "0",
2131
+ width: "100%",
2132
+ height: "100%",
2133
+ zIndex: "9999",
2134
+ pointerEvents: "none"
2135
+ }
2136
+ }), [s.label, s.progress]);
2137
+ return Mt(Le, {
2138
+ notifier: f,
2139
+ children: [b, t]
2140
+ });
2141
+ });
2142
+ br.displayName = "StudioNotifierProvider";
2143
+ var xr = "var(--sxl-color-input-border, light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2)))", vr = it(at((e, t) => {
2144
+ const { children: o, title: r, taskPanes: n, onSelect: a, selected: l, registry: i = te, style: s, iconsOnly: d, side: c = "right", className: p, ...u } = e, m = "right" !== c, g = Xe(), h = ct(() => n.map((t) => {
2145
+ const o = i.getRegisteredTaskPane(t);
2146
+ if (!o) return null;
2147
+ let r = o.getIcon?.();
2148
+ "string" == typeof r && (r = Nt(Oe, { iconKey: r }));
2149
+ const n = t === l, a = r ? Nt(Rt, {
2150
+ sx: {
2151
+ display: "inline-block",
2152
+ transform: m ? "rotate(-90deg)" : "rotate(90deg)",
2153
+ transformOrigin: "center",
2154
+ color: (e) => e.palette.text.secondary
2155
+ },
2156
+ children: r
2157
+ }) : null, s = !r || !d && n, c = Nt(Rt, {
2158
+ sx: {
2159
+ display: "grid",
2160
+ gridTemplateColumns: s ? "1fr" : "0fr",
2161
+ opacity: s ? 1 : 0,
2162
+ transition: (e) => e.transitions.create(["grid-template-columns", "opacity"], { duration: e.transitions.duration.short })
2163
+ },
2164
+ children: Nt(Rt, {
2165
+ sx: {
2166
+ overflow: "hidden",
2167
+ minWidth: 0,
2168
+ minHeight: 0
2169
+ },
2170
+ children: Nt(to, {
2171
+ component: "div",
2172
+ sx: {
2173
+ textTransform: "none",
2174
+ whiteSpace: "nowrap",
2175
+ transform: m ? "rotate(180deg)" : void 0,
2176
+ padding: "4px 0px",
2177
+ color: (e) => n ? e.palette.primary.main : e.palette.text.secondary
2178
+ },
2179
+ children: o.getTitle()
2180
+ })
2181
+ })
2182
+ });
2183
+ return Nt(Yt, {
2184
+ value: t,
2185
+ label: Nt(vt, {
2186
+ disableInteractive: !0,
2187
+ title: o.getTitle() ?? "",
2188
+ placement: "left-start",
2189
+ children: Mt(Rt, {
2190
+ sx: {
2191
+ padding: "0px 0px",
2192
+ writingMode: m ? "vertical-lr" : "vertical-rl",
2193
+ textOrientation: "mixed",
2194
+ display: "flex",
2195
+ alignItems: "center",
2196
+ justifyContent: "space-between",
2197
+ minWidth: "0px",
2198
+ color: (e) => e.palette.text.secondary
2199
+ },
2200
+ children: [m ? c : a, m ? a : c]
2201
+ })
2202
+ }),
2203
+ sx: {
2204
+ padding: "4px 4px",
2205
+ minWidth: "0px",
2206
+ minHeight: "0px",
2207
+ borderRadius: "4px"
2208
+ },
2209
+ className: yo("taskpane-strip-item", { "Mui-selected": n }),
2210
+ onClick: () => e.onSelect(t)
2211
+ }, t);
2212
+ }), [
2213
+ n,
2214
+ l,
2215
+ a,
2216
+ i,
2217
+ m,
2218
+ d,
2219
+ g
2220
+ ]), y = Ye(t, () => ({ isTaskPaneStrip: () => !0 }), []), f = ct(() => yo("taskpane-strip", p), [p]);
2221
+ return Nt(Rt, {
2222
+ ref: y,
2223
+ className: f,
2224
+ sx: {
2225
+ paddingLeft: m ? void 0 : "2px",
2226
+ paddingRight: m ? "2px" : void 0,
2227
+ paddingTop: "4px",
2228
+ ...s
2229
+ },
2230
+ ...u,
2231
+ children: Nt(Xt, {
2232
+ orientation: "vertical",
2233
+ variant: "scrollable",
2234
+ value: l,
2235
+ onChange: (e, t) => {
2236
+ a(t);
2237
+ },
2238
+ slotProps: {
2239
+ list: { sx: { gap: "2px" } },
2240
+ indicator: { sx: {
2241
+ left: m ? void 0 : "0px",
2242
+ right: m ? void 0 : "unset",
2243
+ bottom: m ? "0px" : void 0
2244
+ } }
2245
+ },
2246
+ children: h
2247
+ })
2248
+ });
2249
+ })), kr = (e) => {
2250
+ const { title: t, icon: o, onClose: r, readOnly: n, focused: a, ...l } = e, i = pt(null), s = ot();
2251
+ return Nt($t, {
2252
+ className: yo({ "Mui-selected": a }),
2253
+ sx: {
2254
+ display: "flex",
2255
+ flex: "1 1 %0",
2256
+ color: (e) => e.palette.text.secondary,
2257
+ boxSizing: "border-box",
2258
+ padding: "0 0",
2259
+ transitionProperty: "opacity",
2260
+ transitionDuration: (e) => `${e.transitions.duration.shortest}ms`,
2261
+ opacity: .7,
2262
+ "&.Mui-selected": {
2263
+ opacity: 1,
2264
+ transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
2265
+ },
2266
+ backgroundColor: (e) => oo(e.palette.action.hover, .03),
2267
+ borderBottom: `solid ${xr} 1px`
2268
+ },
2269
+ ...l,
2270
+ children: Mt(Rt, {
2271
+ sx: {
2272
+ display: "flex",
2273
+ flex: "1 1 10%",
2274
+ flexDirection: "row",
2275
+ alignItems: "center",
2276
+ marginTop: (e) => e.spacing(.25),
2277
+ marginBottom: (e) => e.spacing(.25),
2278
+ marginLeft: (e) => e.spacing(1),
2279
+ marginRight: (e) => e.spacing(1)
2280
+ },
2281
+ children: [Nt(Rt, {
2282
+ sx: {
2283
+ flex: "1 1 100%",
2284
+ paddingLeft: (e) => e.spacing(1)
2285
+ },
2286
+ children: t
2287
+ }), Nt(bt, {
2288
+ label: s("taskPane.close"),
2289
+ children: Nt(Kt, {
2290
+ "aria-label": "close",
2291
+ sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
2292
+ touchRippleRef: i,
2293
+ onPointerDown: (e) => {
2294
+ i.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
2295
+ },
2296
+ onPointerUp: () => {
2297
+ r();
2298
+ },
2299
+ children: Nt(Oe, { iconKey: "Close" })
2300
+ })
2301
+ })]
2302
+ })
2303
+ });
2304
+ }, Cr = at((e, t) => {
2305
+ const { model: o, side: r, ...n } = e, a = no(), l = `solid ${xr} 1px`, i = `${a.shape.borderRadius ?? 4}px`, s = `${a.spacing?.(.5) ?? 4}px`;
2306
+ return Nt(ie, {
2307
+ model: o,
2308
+ ref: t,
2309
+ propsFrame: { style: {
2310
+ border: l,
2311
+ borderRadius: i,
2312
+ marginBottom: s
2313
+ } },
2314
+ alwaysShowStrip: !0,
2315
+ componentTitle: kr,
2316
+ componentStrip: vr,
2317
+ side: r,
2318
+ ...e,
2319
+ onOpen: () => {
2320
+ e?.onOpen?.();
2321
+ },
2322
+ onClose: () => {
2323
+ e?.onClose?.();
2324
+ },
2325
+ ...n
2326
+ });
2327
+ }), wr = "_styled-resizer_fdl5y_3", Sr = {}, Tr = {
2328
+ flex: "1 1 100%",
2329
+ display: "flex",
2330
+ boxSizing: "border-box"
2331
+ }, Fr = it(at((e, t) => {
2332
+ const { mainElement: o, sidebarElement: r, position: n, persistKey: a, onPositionChange: l, className: i, style: s, taskSide: d = "right", ...c } = e, [p, u] = Qe(a ?? null, Sr), m = no(), [g, { width: h }] = Je(), y = h > 530 || 0 === h, f = pt(null);
2333
+ let b, x, v = null, k = 4, C = 13;
2334
+ y ? v = "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" : (v = "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", k = 13, C = 4);
2335
+ let w, S = o, T = r;
2336
+ const F = "right" !== d, D = y ? "row" : "column", I = F && T ? "before" : "after", P = `${D}:${I}`, W = a ? p[P] : void 0, A = null != W ? `${W}%` : ((e, t) => {
2337
+ if (null == e) return "40%";
2338
+ if ("number" == typeof e || "string" == typeof e) return e;
2339
+ const o = e[t];
2340
+ return null != o ? `${o}%` : "40%";
2341
+ })(n, P), N = a || l ? (e) => {
2342
+ a && u((t) => ({
2343
+ ...t,
2344
+ [P]: e.percent
2345
+ })), l?.(e, {
2346
+ orientation: D,
2347
+ side: I,
2348
+ key: P
2349
+ });
2350
+ } : void 0;
2351
+ F && T ? (S = r, T = o, x = { style: {
2352
+ flexDirection: "column",
2353
+ boxSizing: "border-box",
2354
+ paddingRight: "2px"
2355
+ } }, b = {}, w = {
2356
+ fixedPane: "before",
2357
+ position: A,
2358
+ minBefore: y ? "280px" : "120px",
2359
+ splitDirection: y ? "row" : "column"
2360
+ }) : (b = { style: {
2361
+ flexDirection: "column",
2362
+ marginRight: r ? void 0 : "6px"
2363
+ } }, x = { style: {
2364
+ marginLeft: y ? "0px" : "4px",
2365
+ marginRight: y ? "8px" : "4px"
2366
+ } }, w = {
2367
+ fixedPane: "after",
2368
+ position: A,
2369
+ minAfter: y ? "280px" : "120px",
2370
+ splitDirection: y ? "row" : "column"
2371
+ });
2372
+ const M = bo([
2373
+ f,
2374
+ g,
2375
+ t
2376
+ ]);
2377
+ return Nt(_e, {
2378
+ ref: M,
2379
+ className: i,
2380
+ style: s ? {
2381
+ ...Tr,
2382
+ ...s
2383
+ } : Tr,
2384
+ ...c,
2385
+ ...w,
2386
+ onPositionChange: N,
2387
+ propsResizer: {
2388
+ className: yo("styled-resizer", wr),
2389
+ style: {
2390
+ minWidth: y ? "7px" : void 0,
2391
+ minHeight: y ? void 0 : "6px",
2392
+ maskImage: `url("data:image/svg+xml,%3Csvg width='${k}' height='${C}' viewBox='0 0 ${k} ${C}' 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='${v}' /%3E%3C/svg%3E%0A")`,
2393
+ maskRepeat: "no-repeat",
2394
+ maskPosition: F ? y ? "center center" : "bottom center" : y ? "left center" : "top center"
2395
+ }
2396
+ },
2397
+ elementBefore: S,
2398
+ propsPaneBefore: b,
2399
+ elementAfter: T,
2400
+ propsPaneAfter: x
2401
+ });
2402
+ }));
2403
+ Fr.displayName = "StudioSplitPane";
2404
+ var Dr = () => Nt("div", { style: {
2405
+ flex: "none",
2406
+ height: 0,
2407
+ borderTop: "solid var(--sxl-color-base-border, light-dark(rgba(0, 0, 0, 0.26), rgba(255, 255, 255, 0.3))) 1px"
2408
+ } }), Ir = (e, t) => {
2409
+ const o = (e) => Nt(nt.Fragment, { children: t[e] }, e);
2410
+ if ("bottom" === e) {
2411
+ const e = t.statusBar && t.formulaBar ? Nt(Dr, {}, "divider") : null;
2412
+ return [
2413
+ o("toolbar"),
2414
+ o("main"),
2415
+ o("statusBar"),
2416
+ e,
2417
+ o("formulaBar")
2418
+ ];
2419
+ }
2420
+ return [
2421
+ o("toolbar"),
2422
+ o("formulaBar"),
2423
+ o("main"),
2424
+ o("statusBar")
2425
+ ];
2426
+ }, Pr = G.BuiltInSelectorNames, Wr = {
2427
+ [Pr.Whole]: "FormulaMathTrig",
2428
+ [Pr.Number]: "IncreaseDecimal",
2429
+ [Pr.Date]: "FormulaDateTime",
2430
+ [Pr.DateTime]: "FormulaDateTime",
2431
+ [Pr.Time]: "FormulaDateTime",
2432
+ [Pr.TextLength]: "FormulaText"
2433
+ }, Ar = (e) => {
2434
+ const t = e.getCondition();
2435
+ if (!t) return "DataValidation";
2436
+ const o = t.toJSON();
2437
+ return o.operator === G.BuiltInOperatorNames.Expression ? "FormulaCustom" : o.selector || o.operator !== G.BuiltInOperatorNames.InSet ? "string" == typeof o.selector && Wr[o.selector] || "DataValidation" : "Menu";
2438
+ }, Nr = it(({ dataValidation: e, size: t = 28 }) => (Fe(e, "onAnyChange"), Nt(c, {
2439
+ className: "sxl-dv-icon",
2440
+ sx: {
2441
+ width: "auto",
2442
+ minWidth: 1.7 * t + "px",
2443
+ height: `${t}px`
2444
+ },
2445
+ children: Nt(Oe, {
2446
+ iconKey: Ar(e),
2447
+ size: Math.round(.6 * t),
2448
+ ariaHidden: !0
2449
+ })
2450
+ })));
2451
+ Nr.displayName = "DataValidationIcon";
2452
+ var Mr = (e, t) => {
2453
+ const o = e.getCondition();
2454
+ if (!o) return t("dataValidation.anyValue");
2455
+ const r = o.toJSON();
2456
+ if (r.operator === G.BuiltInOperatorNames.Expression && "string" == typeof r.param) return t("dataValidation.titleCustom", { formula: r.param });
2457
+ if (!r.selector && r.operator === G.BuiltInOperatorNames.InSet) {
2458
+ const e = r.param, o = e?.source;
2459
+ if ("string" == typeof o && o.length > 0) return t("dataValidation.titleListFrom", { source: o });
2460
+ const n = (e?.items ?? []).map((e) => String(e ?? "")).concat((e?.additions ?? []).map((e) => e.trimStart()));
2461
+ return t("dataValidation.titleList", {
2462
+ items: n.slice(0, 3).join(", "),
2463
+ more: Math.max(0, n.length - 3)
2464
+ });
2465
+ }
2466
+ return o.toString();
2467
+ }, Rr = {
2468
+ [Y.AlertStyle.Stop]: "ValidationStop",
2469
+ [Y.AlertStyle.Warning]: "ValidationWarning",
2470
+ [Y.AlertStyle.Information]: "ValidationInformation"
2471
+ }, Er = "none", Br = {
2472
+ width: 18,
2473
+ height: 18,
2474
+ flex: "0 0 auto"
2475
+ }, Or = {
2476
+ [Y.AlertStyle.Stop]: go("dataValidation.alertStop"),
2477
+ [Y.AlertStyle.Warning]: go("dataValidation.alertWarning"),
2478
+ [Y.AlertStyle.Information]: go("dataValidation.alertInformation")
2479
+ }, Vr = it((e) => {
2480
+ const { dataValidation: t } = e, o = ot();
2481
+ Fe(t, "onAnyChange");
2482
+ const r = t.isProtected(), n = t.getRenderHints().includes("list"), [a, l] = ut("rule"), i = Mt(Ut, {
2483
+ tabIndex: 0,
2484
+ className: D["editor-panel"],
2485
+ sx: {
2486
+ gap: (e) => e.spacing(1),
2487
+ paddingTop: (e) => e.spacing(1.25),
2488
+ paddingBottom: (e) => e.spacing(2),
2489
+ paddingLeft: (e) => e.spacing(1.5),
2490
+ paddingRight: (e) => e.spacing(1.5),
2491
+ border: (e) => `1px solid ${e.palette.divider}`,
2492
+ borderRadius: (e) => e.spacing(1.25),
2493
+ overflow: "auto"
2494
+ },
2495
+ children: [
2496
+ Mt(Rt, {
2497
+ sx: {
2498
+ display: "flex",
2499
+ flexDirection: "column",
2500
+ gap: (e) => e.spacing(1.75),
2501
+ margin: (e) => e.spacing(1.25),
2502
+ marginBottom: 0
2503
+ },
2504
+ children: [Mt(Rt, {
2505
+ sx: {
2506
+ display: "flex",
2507
+ alignItems: "center",
2508
+ gap: (e) => e.spacing(1.5)
2509
+ },
2510
+ children: [Nt(Nr, {
2511
+ dataValidation: t,
2512
+ size: 48
2513
+ }), Nt(to, {
2514
+ variant: "body2",
2515
+ sx: {
2516
+ minWidth: 0,
2517
+ wordBreak: "break-word"
2518
+ },
2519
+ children: Mr(t, o)
2520
+ })]
2521
+ }), Nt(L, {
2522
+ item: t,
2523
+ label: o("dataValidation.applyTo")
2524
+ })]
2525
+ }),
2526
+ Mt(Xt, {
2527
+ value: a,
2528
+ onChange: (e, t) => l(t),
2529
+ sx: {
2530
+ minHeight: "36px",
2531
+ borderBottom: 1,
2532
+ borderColor: "divider",
2533
+ "& .MuiTab-root": {
2534
+ minHeight: "36px",
2535
+ textTransform: "none",
2536
+ pt: .5,
2537
+ pb: .5,
2538
+ px: 1.5,
2539
+ minWidth: 0
2540
+ }
2541
+ },
2542
+ children: [Nt(Yt, {
2543
+ value: "rule",
2544
+ label: o("dataValidation.tabRule")
2545
+ }), Nt(Yt, {
2546
+ value: "prompt",
2547
+ label: o("dataValidation.prompt")
2548
+ })]
2549
+ }),
2550
+ "prompt" === a ? Mt(Rt, {
2551
+ sx: {
2552
+ display: "flex",
2553
+ flexDirection: "column",
2554
+ gap: 2
2555
+ },
2556
+ children: [
2557
+ Nt(zt, {
2558
+ control: Nt(Ot, {
2559
+ checked: t.isShowPromptMessage(),
2560
+ disabled: r,
2561
+ onChange: (e) => t.setShowPromptMessage(e.target.checked)
2562
+ }),
2563
+ label: o("dataValidation.showPrompt"),
2564
+ sx: {
2565
+ ml: 0,
2566
+ pl: .5
2567
+ }
2568
+ }),
2569
+ Nt(Jt, {
2570
+ size: "small",
2571
+ label: o("dataValidation.title"),
2572
+ value: t.getPromptTitle(),
2573
+ onChange: (e) => t.setPromptTitle(e.target.value),
2574
+ disabled: r,
2575
+ fullWidth: !0,
2576
+ slotProps: { htmlInput: { maxLength: 32 } },
2577
+ sx: { backgroundColor: "background.paper" }
2578
+ }),
2579
+ Nt(Jt, {
2580
+ size: "small",
2581
+ label: o("dataValidation.message"),
2582
+ value: t.getPromptMessage(),
2583
+ onChange: (e) => t.setPromptMessage(e.target.value),
2584
+ disabled: r,
2585
+ multiline: !0,
2586
+ rows: 2,
2587
+ fullWidth: !0,
2588
+ slotProps: { htmlInput: { maxLength: 254 } },
2589
+ sx: { backgroundColor: "background.paper" }
2590
+ })
2591
+ ]
2592
+ }) : Mt(At, { children: [Nt(x, {
2593
+ sx: {
2594
+ ...z,
2595
+ p: 2,
2596
+ pb: 0
2597
+ },
2598
+ selectorTitle: o("dataValidation.allow"),
2599
+ condition: t.getCondition(),
2600
+ ranges: t.getRanges(),
2601
+ readOnly: r,
2602
+ onConditionChange: (e) => {
2603
+ const o = !t.getCondition() && e ? {
2604
+ ...e,
2605
+ includeBlanks: !0
2606
+ } : e;
2607
+ t.setCondition(o);
2608
+ },
2609
+ qualifiers: n ? Nt(zt, {
2610
+ control: Nt(Ot, {
2611
+ size: "small",
2612
+ checked: !t.isHideDropdown(),
2613
+ disabled: r,
2614
+ onChange: (e) => t.setHideDropdown(!e.target.checked)
2615
+ }),
2616
+ label: o("dataValidation.inCellDropdown")
2617
+ }) : null
2618
+ }), Mt(Rt, {
2619
+ sx: {
2620
+ display: "flex",
2621
+ flexDirection: "column",
2622
+ gap: 2,
2623
+ p: 2,
2624
+ border: 1,
2625
+ borderColor: "divider",
2626
+ borderRadius: 1
2627
+ },
2628
+ children: [Mt(Lt, {
2629
+ fullWidth: !0,
2630
+ size: "small",
2631
+ disabled: r,
2632
+ sx: { backgroundColor: "background.paper" },
2633
+ children: [Nt(_t, { children: o("dataValidation.onInvalid") }), Mt(Gt, {
2634
+ className: "on-invalid",
2635
+ value: t.isShowAlertMessage() ? t.getAlertStyle() : Er,
2636
+ label: o("dataValidation.onInvalid"),
2637
+ onChange: (e) => {
2638
+ const o = e.target.value;
2639
+ o !== Er ? (t.setAlertStyle(o), t.setShowAlertMessage(!0)) : t.setShowAlertMessage(!1);
2640
+ },
2641
+ renderValue: (e) => Mt(Rt, {
2642
+ sx: {
2643
+ display: "flex",
2644
+ alignItems: "center",
2645
+ gap: 1
2646
+ },
2647
+ children: [e === Er ? Nt(Rt, { sx: Br }) : Nt(Oe, {
2648
+ iconKey: Rr[e],
2649
+ size: 18,
2650
+ ariaHidden: !0
2651
+ }), o(e === Er ? "dataValidation.alertNone" : Or[e])]
2652
+ }),
2653
+ children: [Object.keys(Rr).map((e) => Mt(Ht, {
2654
+ value: e,
2655
+ sx: { gap: 1 },
2656
+ children: [Nt(Oe, {
2657
+ iconKey: Rr[e],
2658
+ size: 18,
2659
+ ariaHidden: !0
2660
+ }), o(Or[e])]
2661
+ }, e)), Mt(Ht, {
2662
+ value: Er,
2663
+ sx: { gap: 1 },
2664
+ children: [Nt(Rt, { sx: Br }), o("dataValidation.alertNone")]
2665
+ }, Er)]
2666
+ })]
2667
+ }), t.isShowAlertMessage() ? Mt(At, { children: [Nt(Jt, {
2668
+ size: "small",
2669
+ label: o("dataValidation.title"),
2670
+ value: t.getAlertTitle(),
2671
+ onChange: (e) => t.setAlertTitle(e.target.value),
2672
+ disabled: r,
2673
+ fullWidth: !0,
2674
+ slotProps: { htmlInput: { maxLength: 32 } },
2675
+ sx: { backgroundColor: "background.paper" }
2676
+ }), Nt(Jt, {
2677
+ size: "small",
2678
+ label: o("dataValidation.message"),
2679
+ value: t.getAlertMessage(),
2680
+ onChange: (e) => t.setAlertMessage(e.target.value),
2681
+ disabled: r,
2682
+ multiline: !0,
2683
+ rows: 2,
2684
+ fullWidth: !0,
2685
+ slotProps: { htmlInput: { maxLength: 225 } },
2686
+ sx: { backgroundColor: "background.paper" }
2687
+ })] }) : null]
2688
+ })] })
2689
+ ]
2690
+ });
2691
+ return Nt(u.Provider, {
2692
+ value: t,
2693
+ children: i
2694
+ });
2695
+ });
2696
+ Vr.displayName = "DataValidationEditorPanel";
2697
+ var jr = ({ icon: e, title: t, children: o }) => Mt(Rt, {
2698
+ className: "validation-badge",
2699
+ title: t,
2700
+ "aria-label": t,
2701
+ sx: {
2702
+ display: "inline-flex",
2703
+ alignItems: "center",
2704
+ gap: .5,
2705
+ px: .75,
2706
+ py: .25,
2707
+ border: 1,
2708
+ borderColor: "divider",
2709
+ borderRadius: 1,
2710
+ color: "text.secondary"
2711
+ },
2712
+ children: [Nt(Oe, {
2713
+ iconKey: e,
2714
+ size: 14,
2715
+ ariaHidden: !0
2716
+ }), o ? Nt(to, {
2717
+ variant: "caption",
2718
+ children: o
2719
+ }) : null]
2720
+ }), $r = {
2721
+ [Y.AlertStyle.Stop]: "dataValidation.alertStop",
2722
+ [Y.AlertStyle.Warning]: "dataValidation.alertWarning",
2723
+ [Y.AlertStyle.Information]: "dataValidation.alertInformation"
2724
+ }, Lr = it(({ item: e }) => {
2725
+ const t = ot();
2726
+ Fe(e, "onAnyChange");
2727
+ const o = [];
2728
+ if (e.isShowPromptMessage() && o.push(Nt(jr, {
2729
+ icon: "NoteInsert",
2730
+ title: t("dataValidation.prompt"),
2731
+ children: e.getPromptTitle() || null
2732
+ }, "prompt")), e.getCondition() && e.isShowAlertMessage()) {
2733
+ const r = e.getAlertStyle();
2734
+ o.push(Nt(jr, {
2735
+ icon: Rr[r],
2736
+ title: `${t("dataValidation.alert")}: ${t($r[r])}`
2737
+ }, "alert"));
2738
+ }
2739
+ return !e.isHideDropdown() && e.getRenderHints().includes("list") && o.push(Nt(jr, {
2740
+ icon: "ArrowDownOutline",
2741
+ title: t("dataValidation.inCellDropdown")
2742
+ }, "dropdown")), 0 === o.length ? null : Nt(Rt, {
2743
+ sx: {
2744
+ display: "flex",
2745
+ flexWrap: "wrap",
2746
+ gap: .5
2747
+ },
2748
+ children: o
2749
+ });
2750
+ });
2751
+ Lr.displayName = "DataValidationCardBody";
2752
+ var zr = it(({ item: e }) => {
2753
+ const t = ot();
2754
+ return Nt(L, {
2755
+ item: e,
2756
+ label: t("dataValidation.applyTo"),
2757
+ helperText: null
2758
+ });
2759
+ });
2760
+ zr.displayName = "DataValidationCardRanges";
2761
+ var Kr = {
2762
+ key: "data-validation",
2763
+ messageKeys: {
2764
+ none: go("dataValidation.none"),
2765
+ addPrompt: go("dataValidation.addPrompt"),
2766
+ heading: go("dataValidation.heading"),
2767
+ insert: go("dataValidation.insert"),
2768
+ new: go("dataValidation.new"),
2769
+ moveUp: go("dataValidation.moveUp"),
2770
+ moveDown: go("dataValidation.moveDown"),
2771
+ edit: go("dataValidation.edit"),
2772
+ duplicate: go("dataValidation.duplicate"),
2773
+ delete: go("dataValidation.delete"),
2774
+ cancel: go("dataValidation.cancel"),
2775
+ save: go("dataValidation.save")
2776
+ },
2777
+ getCollection: (e) => e.getDataValidations(),
2778
+ changeEvents: ["onDataValidationsChange"],
2779
+ isReadOnly: (e) => e.getProtection().isLocked() || e.getProtection().isReadOnly(),
2780
+ applyUpdate: (e, t) => {
2781
+ e.update(t);
2782
+ },
2783
+ validate: (e) => e.getCondition()?.validate() ?? null,
2784
+ applyNewDefaults: (e) => {
2785
+ e.update({
2786
+ alertStyle: Y.AlertStyle.Stop,
2787
+ showAlertMessage: !0
2788
+ });
2789
+ },
2790
+ applySeed: (e, t) => {
2791
+ e.update(t);
2792
+ },
2793
+ getCardTitle: Mr,
2794
+ CardMedia: ({ item: e }) => Nt(Nr, {
2795
+ dataValidation: e,
2796
+ size: 32
2797
+ }),
2798
+ CardSubtitle: zr,
2799
+ CardBody: Lr,
2800
+ EditorBody: ({ item: e }) => Nt(Vr, { dataValidation: e })
2801
+ }, _r = it(at((e, t) => {
2802
+ const { workbook: o, args: r, ...n } = e;
2803
+ return Nt(g, {
2804
+ ref: t,
2805
+ workbook: o,
2806
+ descriptor: Kr,
2807
+ args: r,
2808
+ dragReorder: !0,
2809
+ ...n
2810
+ });
2811
+ }));
2812
+ _r.displayName = "DataValidationDetailsPanel";
2813
+ var Hr = (e) => {
2814
+ const { model: t, entryKey: o, frame: r, args: n, ref: a, ...l } = e;
2815
+ return Nt(_r, {
2816
+ ref: a,
2817
+ workbook: t,
2818
+ args: n,
2819
+ ...l
2820
+ });
2821
+ };
2822
+ h(), we("shape", {
2823
+ key: "changeShapeGallery",
2824
+ render: (e) => Nt(B, {
2825
+ ...e,
2826
+ commandKey: "changeShape",
2827
+ excludeCategories: or
2828
+ })
2829
+ }, {
2830
+ order: -1,
2831
+ divider: "after"
2832
+ }), Ce("shape", () => import("./BYwXhrEwkRAt9nJS.mjs").then((e) => e.ShapeFormatPanel)), we("picture", {
2833
+ key: "changePictureOptions",
2834
+ defaultKey: "changePictureFromFile",
2835
+ members: ["changePictureFromFile", "changePictureFromURL"]
2836
+ }, {
2837
+ order: -1,
2838
+ divider: "after"
2839
+ }), m(), Ee.register("plugin-table", { icons: {} }), te.registerTaskPane({
2840
+ key: "dataValidationDetails",
2841
+ getTitle: () => "Data Validation",
2842
+ getIcon: () => "DataValidation",
2843
+ component: Hr
2844
+ }, !0), te.registerTaskPane({
2845
+ key: "conditionalFormatDetails",
2846
+ getTitle: () => "Conditional Formatting",
2847
+ getIcon: () => "FormatPaint",
2848
+ component: tr
2849
+ }, !0), p(), d(), l(), n(), i(), R();
2850
+ var Ur = () => {
2851
+ let e, t;
2852
+ const o = new Promise((o, r) => {
2853
+ e = o, t = r;
2854
+ }), r = {
2855
+ promise: o,
2856
+ settled: !1,
2857
+ resolve: (t) => {
2858
+ r.settled = !0, e(t);
2859
+ },
2860
+ reject: (e) => {
2861
+ r.settled = !0, t(e);
2862
+ }
2863
+ };
2864
+ return o.catch(() => {}), r;
2865
+ }, Gr = (e, t) => {
2866
+ if (!e) return {};
2867
+ const { colorSchemes: o, ...r } = e, n = o?.[t ? "dark" : "light"];
2868
+ return n && "object" == typeof n ? ao.deepMerge(r, n) : r;
2869
+ }, qr = "taskPanePosition", Yr = it(at((e, t) => {
2870
+ const { host: o, scopeClass: r, square: n, elevation: l, variant: i, onWorkbookLoad: s, prefetch: d, onDocumentError: c, renderDocumentError: p = W, propsDocumentError: u, propsTaskPaneArea: m, renderTaskPaneArea: g = Xr, taskPaneSide: h = "right", onKeyDown: f, workbook: x, onWorkbookChange: v, logo: C, topLeft: w, topRight: S, muiTheme: T, tokens: D, cssBaseline: I, autoFocus: P = !1, title: A, onDirtyChange: M, propsDocumentTitle: R, renderDocumentLoading: E = F, propsDocumentLoading: B, propsWorkbook: O, showFormulaBar: j, propsFormulaBar: $, renderFormulaBar: L, formulaBarPlacement: z, manageVisualViewport: K = !0, editable: _, showStatusBar: H, propsStatusBar: U, renderStatusBar: G, propsToolbar: q, renderToolbar: Y } = e, X = pt(null), J = pt(null), Z = pt(null), Q = Ge(() => {
2871
+ Z.current?.getNamedCollectionEditorElement?.()?.focus?.();
2872
+ }, []), ee = ((e, t = "undefined" == typeof window ? "mouse" : ze.detectIt().primaryInput) => "top" === e || "bottom" === e ? e : "touch" === t ? "bottom" : "top")(z), te = "bottom" === ee && K, oe = rt(te), re = oe ? Math.max(0, Math.round(window.innerHeight - oe.height)) : 0, ne = oe ? Math.round(oe.offsetTop) : 0, ae = oe?.height;
2873
+ dt(() => {
2874
+ te && void 0 !== ae && (0 === window.scrollX && 0 === window.scrollY || window.scrollTo(0, 0));
2875
+ }, [te, ae]);
2876
+ const le = Ge(c ?? (() => {}), [c]), ie = Ge(M ?? (() => {}), [M]), ye = R?.placeHolder, [fe] = Qe(ce.Mode, de[ce.Mode]), { themeMode: be } = et({ mode: fe ?? void 0 }), [xe] = Qe(Ve.Active, null), ve = pt(xe);
2877
+ ve.current = xe;
2878
+ const ke = tt(), Ce = ct(() => ({
2879
+ light: Ct(!1, ao.deepMerge(Gr(T, !1), V(ke?.light))),
2880
+ dark: Ct(!0, ao.deepMerge(Gr(T, !0), V(ke?.dark)))
2881
+ }), [
2882
+ T,
2883
+ ke?.light,
2884
+ ke?.dark
2885
+ ]), we = "dark" === be, Se = ct(() => k(Ce.light, Ce.dark, `.${r}`, D), [
2886
+ Ce,
2887
+ r,
2888
+ D
2889
+ ]), Pe = ct(() => me("sxl-defaults", `.${r}`), [r]), Me = Te(), [Be, je] = ut(() => x ?? null);
2890
+ dt(() => {
2891
+ je(x ?? null);
2892
+ }, [x]);
2893
+ const [Le, _e] = ut(0), Ue = pt(null);
2894
+ Ue.current || (Ue.current = Ur());
2895
+ const qe = Ie(Be, {
2896
+ io: pe,
2897
+ defaultTheme: Me.getDefaultTheme(),
2898
+ reloadKey: Le
2899
+ }), Xe = "loaded" === qe.status ? qe.workbook : null, Je = ct(() => "error" === qe.status ? {
2900
+ status: "error",
2901
+ error: qe.error
2902
+ } : "loaded" === qe.status ? {
2903
+ status: "loaded",
2904
+ workbook: qe.workbook
2905
+ } : { status: "loading" }, [qe]);
2906
+ dt(() => {
2907
+ Ue.current.settled && (Ue.current = Ur());
2908
+ }, [Be, Le]), dt(() => {
2909
+ "loaded" === Je.status ? Ue.current.resolve(Je.workbook) : "error" === Je.status && (le?.(Je.error), Ue.current.reject(Je.error));
2910
+ }, [Je]);
2911
+ const [Ze, ot] = ut(null);
2912
+ Xe && !Ze && ot(Xe);
2913
+ const nt = Xe && Ze && Xe !== Ze ? Xe : null, at = pt(nt);
2914
+ at.current = nt;
2915
+ const lt = pt(Ze);
2916
+ lt.current = Ze;
2917
+ const it = pt([]), mt = st((e) => {
2918
+ const t = lt.current;
2919
+ t && it.current.push(t), je(e);
2920
+ }, []);
2921
+ dt(() => {
2922
+ const e = it.current;
2923
+ if (0 !== e.length) {
2924
+ it.current = e.filter((e) => e === Ze);
2925
+ for (let t = 0; t < e.length; t++) {
2926
+ const o = e[t];
2927
+ if (o !== Ze) try {
2928
+ o.close();
2929
+ } catch (e) {
2930
+ console.warn("Unable to close the replaced workbook", e);
2931
+ }
2932
+ }
2933
+ }
2934
+ }, [Ze]);
2935
+ const gt = _ ? null : Ze, ft = De(), bt = ct(() => gt ? ge(gt.getSelectedSheet(), { referenceMode: ft }) : null, [gt, ft]), vt = _ ?? bt, kt = pt(vt);
2936
+ kt.current = vt, dt(() => {
2937
+ if (!vt) return;
2938
+ let e = vt.getSession();
2939
+ return vt.subscribe(() => {
2940
+ const t = e;
2941
+ e = vt.getSession(), t && !e && "formula-bar" === t.getActiveEditorId() && Z.current?.contains?.(document.activeElement) && X.current?.focus();
2942
+ });
2943
+ }, [vt]);
2944
+ const wt = Ae(Ze), { isDirty: St, saveState: Tt } = Ne(Ze, pe), Ft = We(Ze), Dt = pt(Tt), It = pt(null);
2945
+ Dt.current = Tt;
2946
+ const Pt = st(() => Dt.current?.isDirty() ?? !1, []), Wt = pt(Je);
2947
+ Wt.current = Je;
2948
+ const [Et, Bt] = ut(null), Ot = A ?? R?.title, [Vt, $t] = ut(null);
2949
+ dt(() => {
2950
+ $t(null);
2951
+ }, [Ze]);
2952
+ const Lt = Ot ?? Vt ?? wt ?? "";
2953
+ dt(() => {
2954
+ ie?.(St);
2955
+ }, [St]);
2956
+ const zt = Ge(v ?? (() => {}), [v]);
2957
+ dt(() => {
2958
+ zt?.(Xe);
2959
+ }, [Xe]);
2960
+ const Kt = pt(Xe);
2961
+ Kt.current = Xe, Fe(Ze, "onViewChange");
2962
+ const _t = ct(() => Nt(ht, {
2963
+ groupKey: "helpOptions",
2964
+ disableHover: !0,
2965
+ sx: { padding: "0" },
2966
+ propsButton: { sx: { maxHeight: "22px" } }
2967
+ }), []), [Ht, Gt] = ut(null), Yt = st((e) => {
2968
+ Gt(e);
2969
+ }, []);
2970
+ dt(() => {
2971
+ Ee.prefetch().catch((e) => {
2972
+ console.warn("Icons could not be loaded:", e);
2973
+ });
2974
+ }, []);
2975
+ const Xt = pt(null);
2976
+ Xt.current || (Xt.current = Ur());
2977
+ const Jt = pt(null), Qt = st(() => Jt.current?.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? Xt.current.promise, []), eo = Ge(async (e) => {
2978
+ const t = ve.current;
2979
+ t && t !== io.getActive() && await io.setActive(t), await Re.DefaultCommandCatalogService.prefetch(t ?? void 0), Bt(e), Jt.current = e.source, Xt.current.settled || Xt.current.resolve(e.source.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? null), s?.(e);
2980
+ }, []), to = pt(null), oo = st((e) => {
2981
+ let t = null, o = {
2982
+ readOnly: !0,
2983
+ ...R
2984
+ };
2985
+ return R?.hidden || (t = Nt(a, {
2986
+ ...o,
2987
+ style: {
2988
+ maxWidth: "100%",
2989
+ ...R?.style
2990
+ },
2991
+ workbook: e.workbook ?? X.current,
2992
+ ref: to,
2993
+ title: Lt,
2994
+ modified: St,
2995
+ encrypted: Ft,
2996
+ placeHolder: ye,
2997
+ onTitleChange: (e) => {
2998
+ $t(e), R?.onTitleChange?.(e);
2999
+ }
3000
+ })), Nt(ir, {
3001
+ ...e,
3002
+ logo: C,
3003
+ mainElement: t,
3004
+ startElement: w,
3005
+ endElement: S
3006
+ });
3007
+ }, [
3008
+ C,
3009
+ Lt,
3010
+ St,
3011
+ Ft,
3012
+ R,
3013
+ w,
3014
+ S
3015
+ ]);
3016
+ dt(() => {
3017
+ const e = X.current;
3018
+ if (!e) return;
3019
+ const t = (t) => {
3020
+ (t.ctrlKey || t.metaKey || "native" !== Ke.getWheelOwner(t, e)) && t.preventDefault();
3021
+ };
3022
+ return e.addEventListener("wheel", t, { passive: !1 }), () => {
3023
+ e.removeEventListener("wheel", t);
3024
+ };
3025
+ }, [Et]);
3026
+ const [ro, no] = ut(null);
3027
+ dt(() => {
3028
+ no(Et?.source?.getCommandScope?.() ?? null);
3029
+ }, [Et]);
3030
+ const lo = ct(() => ({
3031
+ "& .SnackbarContainer-root": { position: "absolute !important" },
3032
+ "& .notistack-SnackbarContainer > div": { maxWidth: "min(100%, 720px)" },
3033
+ "& .notistack-Snackbar": { minWidth: "unset" },
3034
+ "& .notistack-Snackbar > .error-snackbar .MuiTypography-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
3035
+ "& .notistack-Snackbar > .error-snackbar .MuiCardActions-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
3036
+ "& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
3037
+ "& .notistack-MuiContent *": { fontFamily: (e) => e.typography.fontFamily },
3038
+ "& #notistack-snackbar": {
3039
+ maxWidth: "560px",
3040
+ whiteSpace: "pre-wrap"
3041
+ },
3042
+ "*": { userSelect: "none" }
3043
+ }), []), [so, co] = ut(null), [, po] = Qe(null, !1);
3044
+ dt(() => {
3045
+ po(null != so);
3046
+ }, [so, po]);
3047
+ const uo = st((e) => g({
3048
+ model: Ze,
3049
+ side: h,
3050
+ ...e,
3051
+ ...m
3052
+ }), [
3053
+ Ze,
3054
+ h,
3055
+ m
3056
+ ]), mo = pt(o);
3057
+ mo.current = o, Ye(t, () => ({
3058
+ isStudioElement: () => !0,
3059
+ save: (e) => {
3060
+ const t = It.current;
3061
+ return t ? t(e) : Promise.reject(/* @__PURE__ */ new Error("The studio cannot save: no workbook, or the backing store cannot write."));
3062
+ },
3063
+ getWorkbookElement: () => X.current,
3064
+ getWorkbook: () => Kt.current ?? null,
3065
+ isDirty: () => Dt.current?.isDirty() ?? !1,
3066
+ getEditable: () => kt.current,
3067
+ getFormulaBarElement: () => Z.current ?? null,
3068
+ focus: () => X.current?.focus(),
3069
+ whenReady: () => (Ue.current || (Ue.current = Ur()), Ue.current.promise),
3070
+ getWorkbookState: () => Wt.current,
3071
+ retry: () => _e((e) => e + 1)
3072
+ }), [], o);
3073
+ const go = pt(!1), ho = Ge((e, t) => {
3074
+ t === at.current && requestAnimationFrame(() => requestAnimationFrame(() => {
3075
+ t === at.current && (go.current = mo.current?.contains(document.activeElement) ?? !0, ot(t), eo(e));
3076
+ }));
3077
+ }, []);
3078
+ dt(() => {
3079
+ go.current && (go.current = !1, X.current?.focus());
3080
+ }, [Ze]);
3081
+ const yo = st(() => Nt(At, {}), []), bo = st((e) => {
3082
+ const { ref: t, ...o } = e, r = we ? Ce.dark : Ce.light, a = "error" === Je.status ? p({
3083
+ ...u,
3084
+ style: {
3085
+ width: "100%",
3086
+ height: "100%",
3087
+ ...u?.style
3088
+ },
3089
+ error: Je.error
3090
+ }) : null;
3091
+ if (a && !Ze) return Nt(Ut, {
3092
+ style: {
3093
+ width: "100%",
3094
+ height: "100%",
3095
+ position: "absolute",
3096
+ display: "flex",
3097
+ alignItems: "stretch",
3098
+ justifyContent: "stretch"
3099
+ },
3100
+ children: a
3101
+ });
3102
+ let s = null;
3103
+ if (Ze) {
3104
+ const e = Ze, n = e.getView(), a = j ?? n?.isShowFormulaBar(), l = H ?? n?.isShowStatusBar(), i = Et?.source ?? X.current, c = (Y ?? oo)({
3105
+ workbook: i,
3106
+ ...q
3107
+ }), p = "bottom" === ee, u = a ? (L ?? N)({
3108
+ ref: Z,
3109
+ style: {
3110
+ marginTop: r.spacing(p ? .5 : .25),
3111
+ marginLeft: r.spacing(1),
3112
+ marginRight: r.spacing(1),
3113
+ marginBottom: r.spacing(p ? .5 : .75)
3114
+ },
3115
+ workbook: e,
3116
+ editable: vt ?? void 0,
3117
+ placement: ee,
3118
+ ...$,
3119
+ propsNamedCollectionEditor: {
3120
+ restoreFocus: (e) => i?.focus(e),
3121
+ ...$?.propsNamedCollectionEditor
3122
+ }
3123
+ }) : null, m = l ? (G ?? b)({
3124
+ childrenEnd: _t,
3125
+ ...U
3126
+ }) : null, g = (e, r) => Nt(y, {
3127
+ ...O,
3128
+ tabIndex: 0,
3129
+ autoFocus: !r && P,
3130
+ workbook: e,
3131
+ editable: r ? void 0 : vt ?? void 0,
3132
+ focusNameBox: r ? void 0 : Q,
3133
+ prefetch: !r && d,
3134
+ ref: r ? J : fo([t, X]),
3135
+ onWorkbookLoad: r ? (t) => ho(t, e) : eo,
3136
+ onKeyDown: (e) => {
3137
+ f?.(e);
3138
+ },
3139
+ propsWorkbookLoading: B,
3140
+ renderWorkbookLoading: yo,
3141
+ style: r ? {
3142
+ ...O?.style,
3143
+ position: "absolute",
3144
+ inset: 0,
3145
+ visibility: "hidden"
3146
+ } : {
3147
+ flex: "1 1 100%",
3148
+ minHeight: 0,
3149
+ ...O?.style
3150
+ },
3151
+ onContextMenu: (e) => e.preventDefault(),
3152
+ ...r ? null : o
3153
+ }, e.getId());
3154
+ s = Nt("div", {
3155
+ style: {
3156
+ display: "flex",
3157
+ flexDirection: "column",
3158
+ flex: "1 1 100%",
3159
+ minWidth: 0,
3160
+ minHeight: 0,
3161
+ ...he({
3162
+ window: r.palette.background.default,
3163
+ windowText: r.palette.text.primary
3164
+ })
3165
+ },
3166
+ children: Ir(ee, {
3167
+ toolbar: c,
3168
+ formulaBar: u,
3169
+ statusBar: m,
3170
+ main: Nt(Fr, {
3171
+ taskSide: h,
3172
+ persistKey: qr,
3173
+ sidebarElement: so ? Nt(Re.CommandScopeProvider, {
3174
+ scope: ro,
3175
+ children: so
3176
+ }) : void 0,
3177
+ mainElement: Mt("div", {
3178
+ style: {
3179
+ position: "relative",
3180
+ display: "flex",
3181
+ flexDirection: "column",
3182
+ flex: "1 1 100%",
3183
+ minWidth: 0,
3184
+ minHeight: 0
3185
+ },
3186
+ children: [[g(Ze, !1), nt ? g(nt, !0) : null], Nt(Rt, {
3187
+ ref: Yt,
3188
+ sx: {
3189
+ position: "absolute",
3190
+ top: "10%",
3191
+ left: 0,
3192
+ right: 0,
3193
+ bottom: 0,
3194
+ pointerEvents: "none",
3195
+ "& > :first-of-type": { position: "relative" }
3196
+ }
3197
+ })]
3198
+ })
3199
+ })
3200
+ })
3201
+ });
3202
+ }
3203
+ const c = Et ? null : E({ ...B });
3204
+ return Mt(Ut, {
3205
+ sx: lo,
3206
+ style: {
3207
+ width: "100%",
3208
+ height: re ? `calc(100% - ${re}px)` : "100%",
3209
+ transform: ne ? `translateY(${ne}px)` : void 0,
3210
+ overscrollBehavior: te ? "none" : void 0,
3211
+ position: "absolute",
3212
+ display: "flex",
3213
+ alignItems: "stretch",
3214
+ justifyContent: "stretch",
3215
+ backgroundColor: "var(--sxl-color-base-200)"
3216
+ },
3217
+ className: "eager-studio",
3218
+ square: n,
3219
+ elevation: l,
3220
+ variant: i,
3221
+ children: [
3222
+ s,
3223
+ a ? Nt(Ut, {
3224
+ style: {
3225
+ position: "absolute",
3226
+ inset: 0,
3227
+ display: "flex",
3228
+ alignItems: "stretch",
3229
+ justifyContent: "stretch"
3230
+ },
3231
+ children: a
3232
+ }) : null,
3233
+ c ? Nt("div", {
3234
+ style: {
3235
+ position: "absolute",
3236
+ inset: 0,
3237
+ display: "flex",
3238
+ alignItems: "center",
3239
+ justifyContent: "center",
3240
+ background: `var(--sxl-color-base-100, ${we ? "#121212" : "#fff"})`
3241
+ },
3242
+ children: c
3243
+ }) : null
3244
+ ]
3245
+ });
3246
+ }, [
3247
+ Je,
3248
+ Ze,
3249
+ nt,
3250
+ Et,
3251
+ Lt,
3252
+ E,
3253
+ B,
3254
+ yo,
3255
+ O,
3256
+ n,
3257
+ l,
3258
+ i,
3259
+ _t,
3260
+ p,
3261
+ u,
3262
+ oo,
3263
+ lo,
3264
+ so,
3265
+ h,
3266
+ ro,
3267
+ j,
3268
+ $,
3269
+ L,
3270
+ ee,
3271
+ vt,
3272
+ H,
3273
+ U,
3274
+ G,
3275
+ q,
3276
+ Y,
3277
+ te,
3278
+ re,
3279
+ ne,
3280
+ Ce,
3281
+ we
3282
+ ]);
3283
+ let xo = Nt(vo, {
3284
+ maxSnack: 3,
3285
+ domRoot: Ht ?? void 0,
3286
+ anchorOrigin: {
3287
+ vertical: "bottom",
3288
+ horizontal: "right"
3289
+ },
3290
+ autoHideDuration: 3500,
3291
+ onClose: (e, t, o) => {
3292
+ X.current?.focus();
3293
+ },
3294
+ Components: { error: nr },
3295
+ iconVariant: {
3296
+ success: Nt(qt, {
3297
+ style: { marginRight: "8px" },
3298
+ children: Nt("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" })
3299
+ }),
3300
+ error: Nt(Oe, {
3301
+ iconKey: "ErrorAlert",
3302
+ style: { marginRight: "8px" }
3303
+ })
3304
+ },
3305
+ children: Nt(ue, {
3306
+ workbook: Ze,
3307
+ children: Nt(se, {
3308
+ renderArea: uo,
3309
+ onUpdateArea: (e) => {
3310
+ co(e);
3311
+ },
3312
+ children: Nt(xt, { children: Nt(br, { children: Nt(He, { children: Nt($e, { children: Nt(hr, {
3313
+ workbook: Ze,
3314
+ initialCommandAnchor: Qt,
3315
+ renderWorkbook: bo,
3316
+ setWorkbook: mt,
3317
+ titleWorkbook: Lt,
3318
+ setWorkbookTitle: $t,
3319
+ refDocumentTitle: to,
3320
+ isDirty: Pt,
3321
+ refSave: It,
3322
+ host: o
3323
+ }) }) }) }) })
3324
+ })
3325
+ })
3326
+ });
3327
+ return xo = Mt(Zt, {
3328
+ theme: we ? Ce.dark : Ce.light,
3329
+ children: [
3330
+ I ? Nt(jt, {}) : null,
3331
+ Nt("style", { children: Se }),
3332
+ Nt("style", { children: Pe }),
3333
+ Nt(yt, {
3334
+ themeScopeClass: r,
3335
+ themeSurface: "app",
3336
+ themeMode: be,
3337
+ children: xo
3338
+ })
3339
+ ]
3340
+ }), xo;
3341
+ }));
3342
+ Yr.displayName = "EagerStudio";
3343
+ var Xr = (e) => Nt(Cr, { ...e });
3344
+ export { Yr as EagerStudio, Yr as default };