@sheetxl/studio-mui 0.7.27 → 0.7.28-beta.1

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 (302) hide show
  1. package/README.md +2 -2
  2. package/browser/cjs/BQJKf40kttQWOzLw.cjs +20 -0
  3. package/browser/cjs/BTZ5uzK0wHzpiZGC.cjs +1 -0
  4. package/browser/cjs/B_D3JKseVvpRyX-E.cjs +1 -0
  5. package/browser/cjs/B_WyRpeiesnEiNP4.cjs +11 -0
  6. package/browser/cjs/BeKpqOx8It0RD0Rf.cjs +2 -0
  7. package/browser/cjs/Bj-EvSYeDfqmU0V6.cjs +2 -0
  8. package/browser/cjs/Bo9Kx3L_XQkGPBJ5.cjs +1 -0
  9. package/browser/cjs/ByIEqNsvj52sihT9.cjs +5 -0
  10. package/browser/cjs/C3moehR3VOd0LnmM.cjs +1 -0
  11. package/browser/cjs/C97KHSuikAbr1qVM.cjs +1 -0
  12. package/browser/cjs/CJLwX_A3y3TQUmzj.cjs +1 -0
  13. package/browser/cjs/CPSc2VSYZeZ1B9mi.cjs +1 -0
  14. package/browser/cjs/CPcBvw4ZPwHVTUZF.cjs +1 -0
  15. package/browser/cjs/CZm1jVZaHQ246prW.cjs +1 -0
  16. package/browser/cjs/CdDYyAfccXme8w6m.cjs +1 -0
  17. package/browser/cjs/DBJLJGiCGXesx5n6.cjs +1 -0
  18. package/browser/cjs/DLScL5AOXhHu9O9H.cjs +7 -0
  19. package/browser/cjs/Djsiad0Qha1Y-YaS.cjs +1 -0
  20. package/browser/cjs/IASAYG6qgv7lJY7y.cjs +1 -0
  21. package/browser/cjs/KZvriGbhEOVkQD0b.cjs +1 -0
  22. package/browser/cjs/UnMhi28mbvLiOXQe.cjs +1 -0
  23. package/browser/cjs/Vbigo0kFP3PFfmeA.cjs +1 -0
  24. package/browser/cjs/iMWEL01eC83oU-YY.cjs +1 -0
  25. package/browser/cjs/index.cjs +2 -7
  26. package/browser/cjs/w2GjebPlOFv3pCbm.cjs +1 -0
  27. package/browser/cjs/zQsyZpeXAvcVXJMs.cjs +1 -0
  28. package/browser/esm/0EONOhVZ7oT0C_G2.mjs +1150 -0
  29. package/browser/esm/5x7evORpymnb5SfW.mjs +129 -0
  30. package/browser/esm/BACBR1jjcpJbhOWA.mjs +191 -0
  31. package/browser/esm/BPZne8WpzrkWOH6L.mjs +47 -0
  32. package/browser/esm/BeKa8xVj69hAVKRN.mjs +155 -0
  33. package/browser/esm/BeQ9bqOvNNP-arFP.mjs +219 -0
  34. package/browser/esm/Bf3PIOM6U-NmWk2O.mjs +20 -0
  35. package/browser/esm/C4BPDYeqgN59wMGp.mjs +411 -0
  36. package/browser/esm/CGbn_xdhgTvk2mvb.mjs +612 -0
  37. package/browser/esm/CKADOp3hTx0MSNY7.mjs +52 -0
  38. package/browser/esm/CR2sUEZyRqVv2SNl.mjs +105 -0
  39. package/browser/esm/CTN8J8c1AneJu3Lu.mjs +2207 -0
  40. package/browser/esm/Cc5akPEmIwbgKIfc.mjs +516 -0
  41. package/browser/esm/CePKCTL6D05kDy2E.mjs +82 -0
  42. package/browser/esm/DBM1blcMTZMAM-eR.mjs +217 -0
  43. package/browser/esm/DPBnKqhSuJ414Pxx.mjs +99 -0
  44. package/browser/esm/F51tGfYHocox80zY.mjs +468 -0
  45. package/browser/esm/SDzKpaiuhQux7tAh.mjs +5391 -0
  46. package/browser/esm/TDH9XceS8cAkO5d3.mjs +508 -0
  47. package/browser/esm/XKVlG-x_9q5dbVIW.mjs +8878 -0
  48. package/browser/esm/fJiwyUQJ18X-cCQz.mjs +1376 -0
  49. package/browser/esm/fel6EbPAcZOsBmks.mjs +42 -0
  50. package/browser/esm/flvjZEXrSDrtDzLB.mjs +113 -0
  51. package/browser/esm/index.mjs +152 -91
  52. package/licenses/dependencies.txt +137 -627
  53. package/node/esm/B9-0usA1hSoD0Nk3.mjs +679 -0
  54. package/node/esm/BO1vNzjGWYdZdbq9.mjs +113 -0
  55. package/node/esm/BYigefA8bf9FOVib.mjs +47 -0
  56. package/node/esm/BdrLZp98HQaVMykZ.mjs +82 -0
  57. package/node/esm/BlubX7gm8wTUNiZ-.mjs +106 -0
  58. package/node/esm/C8a6QwMGW1tMiWA6.mjs +516 -0
  59. package/node/esm/CCCnorMn30oUDDIY.mjs +4536 -0
  60. package/node/esm/CKpik3HRSANKEy4G.mjs +99 -0
  61. package/node/esm/CTZcfST8pUcLMail.mjs +509 -0
  62. package/node/esm/D1K9Ji7iQwnOnd1-.mjs +190 -0
  63. package/node/esm/DuUiuB59bQRPQi-D.mjs +155 -0
  64. package/node/esm/eKP73GEWmonTXpfv.mjs +470 -0
  65. package/node/esm/g3y8kxL1Ln214UNr.mjs +129 -0
  66. package/node/esm/index.mjs +10603 -2832
  67. package/package.json +27 -27
  68. package/resources/contents.json +30 -0
  69. package/resources/locales/contents.json +44 -0
  70. package/resources/locales/de/groups.cmd.json +219 -0
  71. package/resources/locales/de/studio.cmd.json +159 -0
  72. package/resources/locales/de/ui.msg.json +507 -0
  73. package/resources/locales/en/groups.cmd.json +219 -0
  74. package/resources/locales/en/studio.cmd.json +159 -0
  75. package/resources/locales/en/ui.msg.json +508 -0
  76. package/types/index.d.ts +2 -1761
  77. package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +131 -0
  78. package/types/src/anchorItems/AnchorItemsPanel.d.ts +29 -0
  79. package/types/src/anchorItems/index.d.ts +3 -0
  80. package/types/src/border/BorderPopupButton.d.ts +30 -0
  81. package/types/src/border/BorderStylePopupButton.d.ts +40 -0
  82. package/types/src/border/index.d.ts +3 -0
  83. package/types/src/chart/command/InsertChartCommandButton.d.ts +10 -0
  84. package/types/src/chart/command/index.d.ts +2 -0
  85. package/types/src/color/Alpha.d.ts +36 -0
  86. package/types/src/color/Checkboard.d.ts +11 -0
  87. package/types/src/color/CheckboardUtils.d.ts +3 -0
  88. package/types/src/color/ColorButton.d.ts +21 -0
  89. package/types/src/color/ColorButtonList.d.ts +17 -0
  90. package/types/src/color/ColorPanel.d.ts +71 -0
  91. package/types/src/color/ColorPopupButton.d.ts +29 -0
  92. package/types/src/color/CustomColorPanel.d.ts +16 -0
  93. package/types/src/color/EditableInput.d.ts +22 -0
  94. package/types/src/color/Hue.d.ts +29 -0
  95. package/types/src/color/Saturation.d.ts +45 -0
  96. package/types/src/color/SketchFields.d.ts +9 -0
  97. package/types/src/color/Swatch.d.ts +16 -0
  98. package/types/src/color/Types.d.ts +11 -0
  99. package/types/src/color/_Utils.d.ts +4 -0
  100. package/types/src/color/index.d.ts +7 -0
  101. package/types/src/command/AccountingStyleCommandButton.d.ts +18 -0
  102. package/types/src/command/AppearanceCommandButton.d.ts +3 -0
  103. package/types/src/command/BorderCommandButton.d.ts +20 -0
  104. package/types/src/command/ColorCommandButton.d.ts +23 -0
  105. package/types/src/command/DocThemeCommandButton.d.ts +19 -0
  106. package/types/src/command/FileCommandButton.d.ts +8 -0
  107. package/types/src/command/FontFamilyCommandButton.d.ts +9 -0
  108. package/types/src/command/FontSizeCommandButton.d.ts +21 -0
  109. package/types/src/command/InsertFunctionCommandPopupButton.d.ts +9 -0
  110. package/types/src/command/InsertFunctionSumCommandPopupButton.d.ts +8 -0
  111. package/types/src/command/LanguageCommandButton.d.ts +19 -0
  112. package/types/src/command/LocaleCommandButton.d.ts +17 -0
  113. package/types/src/command/NumberFormatCommandButton.d.ts +6 -0
  114. package/types/src/command/PasteCommandButton.d.ts +14 -0
  115. package/types/src/command/PresetCellStylesCommandButton.d.ts +11 -0
  116. package/types/src/command/PresetTableStylesCommandButton.d.ts +12 -0
  117. package/types/src/command/RegisterCatalog.d.ts +3 -0
  118. package/types/src/command/SheetCommandGroups.d.ts +10 -0
  119. package/types/src/command/SheetZoomCommandButton.d.ts +9 -0
  120. package/types/src/command/StudioCommandGroups.d.ts +11 -0
  121. package/types/src/command/TextEffectsCommandButton.d.ts +6 -0
  122. package/types/src/command/TextRotateGroupButton.d.ts +14 -0
  123. package/types/src/command/UndoRedoCommandButton.d.ts +14 -0
  124. package/types/src/command/WalkingCopyCommandButton.d.ts +6 -0
  125. package/types/src/command/WorkbookCommandGroups.d.ts +11 -0
  126. package/types/src/command/index.d.ts +23 -0
  127. package/types/src/conditionalFormat/ColorScaleRulePanel.d.ts +18 -0
  128. package/types/src/conditionalFormat/ConditionalFormatDetailsPanel.d.ts +23 -0
  129. package/types/src/conditionalFormat/ConditionalFormatDetailsTaskPane.d.ts +4 -0
  130. package/types/src/conditionalFormat/ConditionalFormatEditorPanel.d.ts +20 -0
  131. package/types/src/conditionalFormat/ConditionalFormatPlugin.d.ts +2 -0
  132. package/types/src/conditionalFormat/ConditionalFormatRangeField.d.ts +32 -0
  133. package/types/src/conditionalFormat/ConditionalFormatStylePicker.d.ts +34 -0
  134. package/types/src/conditionalFormat/ConditionalFormatTitle.d.ts +10 -0
  135. package/types/src/conditionalFormat/DataBarRulePanel.d.ts +23 -0
  136. package/types/src/conditionalFormat/IconSetRulePanel.d.ts +23 -0
  137. package/types/src/conditionalFormat/PresetChip.d.ts +30 -0
  138. package/types/src/conditionalFormat/PresetScalesCommandButton.d.ts +20 -0
  139. package/types/src/conditionalFormat/RulePreview.d.ts +23 -0
  140. package/types/src/conditionalFormat/RuleSection.d.ts +20 -0
  141. package/types/src/conditionalFormat/ScaleMiniGrid.d.ts +59 -0
  142. package/types/src/conditionalFormat/ScaleStopRow.d.ts +34 -0
  143. package/types/src/conditionalFormat/index.d.ts +3 -0
  144. package/types/src/conditionalFormat/previewColor.d.ts +50 -0
  145. package/types/src/conditions/AverageOption.d.ts +25 -0
  146. package/types/src/conditions/BetweenOption.d.ts +25 -0
  147. package/types/src/conditions/BooleanOption.d.ts +24 -0
  148. package/types/src/conditions/CombinatorOption.d.ts +41 -0
  149. package/types/src/conditions/ConditionEditor.d.ts +57 -0
  150. package/types/src/conditions/ConditionUtils.d.ts +83 -0
  151. package/types/src/conditions/DateTimeOption.d.ts +43 -0
  152. package/types/src/conditions/ExpressionOption.d.ts +26 -0
  153. package/types/src/conditions/InSetOption.d.ts +37 -0
  154. package/types/src/conditions/NumberOption.d.ts +24 -0
  155. package/types/src/conditions/OperatorAndParamEditor.d.ts +55 -0
  156. package/types/src/conditions/OperatorSelect.d.ts +35 -0
  157. package/types/src/conditions/OperatorSelectPopupButton.d.ts +39 -0
  158. package/types/src/conditions/ScalarOption.d.ts +29 -0
  159. package/types/src/conditions/SelectorSelect.d.ts +43 -0
  160. package/types/src/conditions/StringOption.d.ts +24 -0
  161. package/types/src/conditions/TimePeriodOption.d.ts +25 -0
  162. package/types/src/conditions/TopNOption.d.ts +25 -0
  163. package/types/src/conditions/index.d.ts +13 -0
  164. package/types/src/dataValidation/DataValidationDetailsPanel.d.ts +16 -0
  165. package/types/src/dataValidation/DataValidationDetailsTaskPane.d.ts +3 -0
  166. package/types/src/dataValidation/DataValidationEditorPanel.d.ts +12 -0
  167. package/types/src/dataValidation/DataValidationPlugin.d.ts +2 -0
  168. package/types/src/dataValidation/index.d.ts +2 -0
  169. package/types/src/debug/DebugUtils.d.ts +4 -0
  170. package/types/src/debug/index.d.ts +2 -0
  171. package/types/src/dialog/CommentsDialog.d.ts +11 -0
  172. package/types/src/dialog/FindReplaceWindow.d.ts +13 -0
  173. package/types/src/dialog/HyperlinkDialog.d.ts +28 -0
  174. package/types/src/dialog/InsertFunctionDialog.d.ts +25 -0
  175. package/types/src/dialog/NamedReferenceDialog.d.ts +17 -0
  176. package/types/src/dialog/NumberFormatDialog.d.ts +12 -0
  177. package/types/src/dialog/ResizeHeaderDialog.d.ts +15 -0
  178. package/types/src/dialog/ShortcutKeysDialog.d.ts +9 -0
  179. package/types/src/dialog/ShortcutKeysPanel.d.ts +28 -0
  180. package/types/src/dialog/SortDialog.d.ts +9 -0
  181. package/types/src/dialog/TableNewDialog.d.ts +14 -0
  182. package/types/src/dialog/WorkbookStatisticsDialog.d.ts +13 -0
  183. package/types/src/dialog/index.d.ts +10 -0
  184. package/types/src/filter/ColumnMenu.d.ts +13 -0
  185. package/types/src/filter/FilterList.d.ts +28 -0
  186. package/types/src/filter/index.d.ts +3 -0
  187. package/types/src/form/FormulaField.d.ts +221 -0
  188. package/types/src/form/InputField.d.ts +89 -0
  189. package/types/src/form/index.d.ts +3 -0
  190. package/types/src/formulaBar/FormulaBar.d.ts +8 -0
  191. package/types/src/formulaBar/IFormulaBar.d.ts +51 -0
  192. package/types/src/formulaBar/index.d.ts +3 -0
  193. package/types/src/function/FunctionArgumentsPanel.d.ts +57 -0
  194. package/types/src/function/FunctionSearchPanel.d.ts +35 -0
  195. package/types/src/function/InsertFunctionWizard.d.ts +79 -0
  196. package/types/src/function/index.d.ts +4 -0
  197. package/types/src/function/paneMetrics.d.ts +33 -0
  198. package/types/src/index.d.ts +21 -0
  199. package/types/src/itemsPanel/EditorPanel.d.ts +21 -0
  200. package/types/src/itemsPanel/ItemCard.d.ts +57 -0
  201. package/types/src/itemsPanel/ItemsDescriptor.d.ts +215 -0
  202. package/types/src/itemsPanel/ItemsPanel.d.ts +45 -0
  203. package/types/src/itemsPanel/SortableCards.d.ts +67 -0
  204. package/types/src/itemsPanel/index.d.ts +6 -0
  205. package/types/src/movable/MovableContextMenu.d.ts +13 -0
  206. package/types/src/movable/index.d.ts +2 -0
  207. package/types/src/named/INamedCollectionEditor.d.ts +37 -0
  208. package/types/src/named/NamedCollectionEditor.d.ts +7 -0
  209. package/types/src/named/NamedDetailsPanel.d.ts +11 -0
  210. package/types/src/named/NamedDetailsTaskPane.d.ts +3 -0
  211. package/types/src/named/NamedDraft.d.ts +68 -0
  212. package/types/src/named/NamedEditorPanel.d.ts +19 -0
  213. package/types/src/named/NamedPlugin.d.ts +2 -0
  214. package/types/src/named/index.d.ts +8 -0
  215. package/types/src/numberFormat/NumberFormatPanel.d.ts +29 -0
  216. package/types/src/numberFormat/NumberFormatTaskPane.d.ts +12 -0
  217. package/types/src/numberFormat/index.d.ts +8 -0
  218. package/types/src/protectedRange/ProtectedRangeDetailsPanel.d.ts +20 -0
  219. package/types/src/protectedRange/ProtectedRangeDetailsTaskPane.d.ts +3 -0
  220. package/types/src/protectedRange/ProtectedRangeEditorPanel.d.ts +27 -0
  221. package/types/src/protectedRange/ProtectedRangePlugin.d.ts +2 -0
  222. package/types/src/protectedRange/index.d.ts +2 -0
  223. package/types/src/protection/WorkbookProtectionDialog.d.ts +23 -0
  224. package/types/src/protection/WorkbookProtectionPanel.d.ts +51 -0
  225. package/types/src/protection/index.d.ts +3 -0
  226. package/types/src/sheet/SheetTabMenu.d.ts +21 -0
  227. package/types/src/sheet/SheetsAllMenu.d.ts +16 -0
  228. package/types/src/sheet/index.d.ts +3 -0
  229. package/types/src/statusBar/NumberStats.d.ts +27 -0
  230. package/types/src/statusBar/SheetZoomScale.d.ts +11 -0
  231. package/types/src/statusBar/StatusBar.d.ts +35 -0
  232. package/types/src/statusBar/index.d.ts +4 -0
  233. package/types/src/studio/CommandsWrapper.d.ts +36 -0
  234. package/types/src/studio/DefaultLogo.d.ts +3 -0
  235. package/types/src/studio/EagerStudio.d.ts +5 -0
  236. package/types/src/studio/Studio.d.ts +26 -0
  237. package/types/src/studio/StudioCommandProvider.d.ts +26 -0
  238. package/types/src/studio/StudioCommands.d.ts +115 -0
  239. package/types/src/studio/StudioNotifierProvider.d.ts +10 -0
  240. package/types/src/studio/StudioProps.d.ts +372 -0
  241. package/types/src/studio/StudioSplitPane.d.ts +60 -0
  242. package/types/src/studio/StudioTaskPaneArea.d.ts +8 -0
  243. package/types/src/studio/StudioToolbar.d.ts +37 -0
  244. package/types/src/studio/index.d.ts +4 -0
  245. package/types/src/studio/useStudioApp.d.ts +51 -0
  246. package/types/src/table/TableDetailsPanel.d.ts +17 -0
  247. package/types/src/table/TableDetailsTaskPane.d.ts +3 -0
  248. package/types/src/table/TablePlugin.d.ts +2 -0
  249. package/types/src/table/TableStyleCanvasPreview.d.ts +21 -0
  250. package/types/src/table/TableStyleOptionsPanel.d.ts +38 -0
  251. package/types/src/table/TableStylePreview.d.ts +43 -0
  252. package/types/src/table/index.d.ts +7 -0
  253. package/types/src/theme/ThemeSelectButton.d.ts +23 -0
  254. package/types/src/theme/ThemeSelectPanel.d.ts +17 -0
  255. package/types/src/theme/ThemeSelectPopupButton.d.ts +24 -0
  256. package/types/src/theme/ThemeUtils.d.ts +57 -0
  257. package/types/src/theme/index.d.ts +5 -0
  258. package/types/src/toast/ToastError.d.ts +10 -0
  259. package/types/src/toast/index.d.ts +2 -0
  260. package/types/src/toolbar/WorkbookToolbars.d.ts +46 -0
  261. package/types/src/toolbar/index.d.ts +2 -0
  262. package/types/src/workbook/DefaultRenderers.d.ts +23 -0
  263. package/types/src/workbook/DocumentTitle.d.ts +69 -0
  264. package/types/src/workbook/WorkbookContextMenu.d.ts +13 -0
  265. package/types/src/workbook/WorkbookElement.d.ts +12 -0
  266. package/types/src/workbook/WorkbookStrip.d.ts +37 -0
  267. package/types/src/workbook/index.d.ts +7 -0
  268. package/browser/cjs/0DtrpXkQQehBmvSv.cjs +0 -6
  269. package/browser/cjs/6C3ia2nz4Zm-AdMZ.cjs +0 -7
  270. package/browser/cjs/BR_EGEaHisRrXAtK.cjs +0 -6
  271. package/browser/cjs/B_v_M4TiavtofChs.cjs +0 -42
  272. package/browser/cjs/C17p-h_nw582H7WD.cjs +0 -20
  273. package/browser/cjs/CInmVysdoHEvvW9h.cjs +0 -6
  274. package/browser/cjs/CMvQZPQsE7MuTMy_.cjs +0 -6
  275. package/browser/cjs/CkNt54AXVfJjIWja.cjs +0 -6
  276. package/browser/cjs/CtRvyhDzQxsk7dkI.cjs +0 -6
  277. package/browser/cjs/DN9cQ4_4ERQvzKn6.cjs +0 -6
  278. package/browser/cjs/DUTuBWUNF-w3Fxtb.cjs +0 -6
  279. package/browser/cjs/pTzEs1wlZj5Bb6xc.cjs +0 -18
  280. package/browser/esm/8ZnwcsRrGO3Nlw9Y.mjs +0 -54
  281. package/browser/esm/BFZ4oCbQukelEVLI.mjs +0 -53
  282. package/browser/esm/BP3nTf4-SLftsj61.mjs +0 -640
  283. package/browser/esm/BSMkBkXBQgZhX1xk.mjs +0 -2159
  284. package/browser/esm/CPLIJbynjEkwF2T0.mjs +0 -4533
  285. package/browser/esm/CuC13VFjBYFE7kub.mjs +0 -155
  286. package/browser/esm/Cw3i8T1tVnm8o6eB.mjs +0 -46
  287. package/browser/esm/D6E8W2KK4dGVRQO_.mjs +0 -25
  288. package/browser/esm/D8xc3AM9QHEqmpb9.mjs +0 -50
  289. package/browser/esm/DA_bEpA5kkn89fmW.mjs +0 -2411
  290. package/browser/esm/DVqOr-7nEXA7IjKJ.mjs +0 -26
  291. package/browser/esm/VAUOzclLs-dR9nt_.mjs +0 -50
  292. package/node/assets/style.css +0 -1
  293. package/node/esm/B9dvpdCD_p2q8aNP.mjs +0 -156
  294. package/node/esm/BBxZemzbmUkoOYdq.mjs +0 -46
  295. package/node/esm/BDdkV45Cf7BLs5jE.mjs +0 -25
  296. package/node/esm/BoX8OuVRgUNgw0Wb.mjs +0 -91
  297. package/node/esm/CPbwVoL6mq66TtTR.mjs +0 -53
  298. package/node/esm/DMd6h1vz-USluank.mjs +0 -88
  299. package/node/esm/DYgtaT_soTbSP8M9.mjs +0 -52
  300. package/node/esm/DxDGSRoOYlWydiwL.mjs +0 -57
  301. package/node/esm/OMgXBbHk-VRNKAop.mjs +0 -26
  302. package/node/esm/bGXLfLFngllNb8U1.mjs +0 -50
@@ -0,0 +1,4536 @@
1
+ /**
2
+ * @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.28-beta.1
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, ColorPopupButton as o, DocumentTitle as n, FormulaField as r, NamedPlugin as a, TablePlugin as l, WorkbookElement as i, b as s, c as d, createStudioThemeCSS as c, d as p, f as u, g as m, h as g, i as h, l as y, m as b, n as f, o as x, p as v, r as k, registerStudioCommandCatalogs as C, registerStudioCommandGroups as w, renderWorkbookToolbars as S, s as T, t as P, tokensToMuiOptions as F, u as D } from "./index.mjs";
8
+ import { Color as N, CommonUtils as O, Condition as I, FormulaError as M, ICondition as R, IConditionalFormat as A, IDataValidation as E, IFill as W, IFont as B, IStyle as L, ScalarType as z } from "@sheetxl/sdk";
9
+ import { COLOR_SCALE_PRESETS as j, CommandRootProvider as K, DATA_BAR_PRESETS as V, DefaultTaskPaneRegistry as $, ICON_SET_GROUPS as _, LogoNoPaddingIcon as U, STYLE_PRESETS as q, TaskPaneArea as H, TaskPaneProvider as G, ThemeStateKey as Q, WorkbookIO as Y, WorkbookProvider as X, buildOOXMLThemeCSS as J, createEditable as Z, createSystemColorVars as ee, defaultColorScale as te, defaultDataBar as oe, defaultIconSet as ne, defaultIconStops as re, getConditionalIconSet as ae, iconSetSize as le, useDocThemes as ie, useModelSync as se, useReferenceModeStore as de, useResolvedWorkbook as ce, useSheet as pe, useWorkbookEncrypted as ue, useWorkbookName as me, useWorkbookSaveState as ge } from "@sheetxl/react";
10
+ import { Command as he, DefaultIconService as ye, DefaultReactNotifier as be, DynamicIcon as fe, KeyCodes as xe, LanguageStateKey as ve, NotifierType as ke, ReactErrorBoundary as Ce, ReactNotifierProvider as we, SplitPane as Se, UncaughtErrorBoundary as Te, createBusyHandle as Pe, createThemeScopeClass as Fe, useCallbackRef as De, useFullscreen as Ne, useImperativeElement as Oe, useLanguage as Ie, useNotifier as Me, usePersistenceState as Re, useResolvedThemeMode as Ae, useTokenThemeContext as Ee, useTranslator as We } from "@sheetxl/utils-react";
11
+ import Be, { forwardRef as Le, isValidElement as ze, lazy as je, memo as Ke, useCallback as Ve, useEffect as $e, useId as _e, useMemo as Ue, useRef as qe, useState as He } from "react";
12
+ import { AnimatedLoadingPanel as Ge, AnimatedTraversingEllipsisIcon as Qe, CommandGroup as Ye, ExhibitFloatProvider as Xe, ExhibitIconButton as Je, ExhibitPopupIconButton as Ze, ExhibitTooltip as et, ModalProvider as tt, SimpleTooltip as ot, StackTrace as nt, createExhibitTheme as rt, useInputDialog as at, useLazyWindow as lt, useModal as it, useOptionsDialog as st } from "@sheetxl/utils-mui";
13
+ import { Fragment as dt, jsx as ct, jsxs as pt } from "react/jsx-runtime";
14
+ import { Accordion as ut, AccordionDetails as mt, AccordionSummary as gt, Box as ht, Button as yt, Card as bt, CardActions as ft, Checkbox as xt, Chip as vt, Collapse as kt, CssBaseline as Ct, DialogTitle as wt, Divider as St, FormControl as Tt, FormControlLabel as Pt, IconButton as Ft, InputAdornment as Dt, InputLabel as Nt, ListSubheader as Ot, MenuItem as It, MenuList as Mt, Paper as Rt, Select as At, Stack as Et, SvgIcon as Wt, Tab as Bt, Tabs as Lt, TextField as zt, ThemeProvider as jt, ToggleButton as Kt, ToggleButtonGroup as Vt, Typography as $t, alpha as _t, useMediaQuery as Ut, useTheme as qt } from "@mui/material";
15
+ import { CommonUtils as Ht, DOMUtils as Gt, DefaultLanguagePackService as Qt, ErrorUtils as Yt, ExpectedError as Xt, PartialError as Jt, formatMessage as Zt, messageKey as eo, t as to } from "@sheetxl/utils";
16
+ import oo from "clsx";
17
+ import { mergeRefs as no } from "react-merge-refs";
18
+ import { useMeasure as ro } from "react-use";
19
+ import { SnackbarContent as ao, SnackbarProvider as lo, useSnackbar as io } from "notistack";
20
+ var so = Ke(Le((e, t) => {
21
+ const { workbook: o, descriptor: n, args: r, dragReorder: a, ...l } = e;
22
+ return ct(m, {
23
+ ref: t,
24
+ workbook: o,
25
+ descriptor: Ue(() => ((e) => {
26
+ const t = (t) => e.getCollection(t.getSelectedSheet());
27
+ return {
28
+ key: e.key,
29
+ messageKeys: e.messageKeys,
30
+ getItems: (e) => t(e).getItems(),
31
+ subscribe: (t, o) => {
32
+ let n = null;
33
+ const r = () => {
34
+ n?.();
35
+ const r = {
36
+ onProtectionChange: () => o.onChange(),
37
+ onInvalidated: () => o.onInvalidated()
38
+ };
39
+ for (const t of e.changeEvents) r[t] = () => o.onChange();
40
+ n = t.getSelectedSheet().addListeners(r, { transactional: !1 });
41
+ };
42
+ r();
43
+ const a = t.addListeners({ onSelectedSheetChange: () => {
44
+ r(), o.onChange();
45
+ } }, { transactional: !1 });
46
+ return () => {
47
+ n?.(), a?.();
48
+ };
49
+ },
50
+ isReadOnly: (t) => {
51
+ const o = t.getSelectedSheet();
52
+ return e.isReadOnly?.(o) ?? !o.getProtection().isObjectsAllowed();
53
+ },
54
+ isItemReadOnly: (t, o) => {
55
+ const n = o.getSelectedSheet();
56
+ return (e.isReadOnly?.(n) ?? !n.getProtection().isObjectsAllowed()) || t.isProtected();
57
+ },
58
+ subscribeItem: (e, t) => e.addListeners({
59
+ onInvalidated: () => t(),
60
+ onProtectedChange: () => t()
61
+ }, { transactional: !1 }),
62
+ createDraft: (e, o) => t(e).createItem(o),
63
+ createSeededDraft: e.applySeed ? (o, n) => {
64
+ const r = t(o).createItem();
65
+ return e.applySeed(r, n), r;
66
+ } : void 0,
67
+ beforeSave: e.beforeSave,
68
+ save: (o, n, r) => {
69
+ null === r ? t(o).add(n) : e.applyUpdate(r, n);
70
+ },
71
+ delete: (e) => e.delete(),
72
+ duplicate: (e, o) => {
73
+ const n = t(o);
74
+ n.add(n.createItem(e));
75
+ },
76
+ moveBy: e.reorderable ?? 1 ? (e, t) => {
77
+ e.setIndex(e.getIndex() + t);
78
+ } : void 0,
79
+ getCardTitle: e.getCardTitle,
80
+ getCardSubtitle: (e) => e.getRanges().toString(),
81
+ CardSubtitle: e.CardSubtitle,
82
+ CardMedia: e.CardMedia,
83
+ CardBody: e.CardBody,
84
+ EditorBody: ({ draft: t }) => {
85
+ const o = e.EditorBody;
86
+ return ct(o, { item: t });
87
+ }
88
+ };
89
+ })(n), [n]),
90
+ args: r,
91
+ dragReorder: a,
92
+ ...l
93
+ });
94
+ }));
95
+ so.displayName = "AnchorItemsPanel";
96
+ var co = Ke((e) => {
97
+ const { option: t, onOptionChange: o, readOnly: n, ...r } = e;
98
+ return ct(zt, {
99
+ size: "small",
100
+ type: "text",
101
+ placeholder: We()("condition.enterText"),
102
+ value: t ?? "",
103
+ onChange: (e) => o(String(e.target.value)),
104
+ disabled: n,
105
+ ...r,
106
+ slotProps: { input: { sx: { backgroundColor: "background.paper" } } }
107
+ });
108
+ });
109
+ co.displayName = "StringOption";
110
+ var po = Ke((e) => {
111
+ const { option: t, onOptionChange: o, readOnly: n, ...r } = e;
112
+ return ct(zt, {
113
+ size: "small",
114
+ type: "number",
115
+ placeholder: We()("condition.enterNumber"),
116
+ value: "" + (t ?? ""),
117
+ onChange: (e) => o(Number(e.target.value)),
118
+ disabled: n,
119
+ ...r,
120
+ slotProps: { input: { sx: { backgroundColor: "background.paper" } } }
121
+ });
122
+ });
123
+ po.displayName = "NumberOption";
124
+ var uo = (e) => null == e ? "" : "boolean" == typeof e ? e ? "TRUE" : "FALSE" : M.isError(e) ? e.getLabel() : String(e), mo = Ke((e) => {
125
+ const { option: t, onOptionChange: o, readOnly: n, ...a } = e, l = We();
126
+ return ct(r, {
127
+ size: "small",
128
+ value: uo(t),
129
+ onChangeText: (e) => o(((e) => {
130
+ if (0 === e.length) return null;
131
+ if (!e.startsWith("=")) {
132
+ const t = e.trim();
133
+ if (t.length > 0) {
134
+ const e = Number(t);
135
+ if (Number.isFinite(e)) return e;
136
+ }
137
+ }
138
+ return e;
139
+ })(e)),
140
+ placeholder: l("condition.enterValueOrFormula"),
141
+ disabled: n,
142
+ fullWidth: !0,
143
+ equals: "literal",
144
+ pickAs: "absolute",
145
+ label: null,
146
+ showError: !1,
147
+ helperText: null,
148
+ ...a
149
+ });
150
+ });
151
+ mo.displayName = "ScalarOption";
152
+ var go = Ke((e) => {
153
+ const { option: t, onOptionChange: o, ...n } = e, r = We(), [a, l] = He(""), i = "string" == typeof t?.items, s = Ue(() => t?.items && Array.isArray(t.items) ? t.items : [], [t?.items]), d = () => {
154
+ if (!a.trim()) return;
155
+ let e = a;
156
+ const n = [...s, e];
157
+ o({
158
+ ...t,
159
+ items: n
160
+ }), l("");
161
+ };
162
+ return pt(ht, {
163
+ ...n,
164
+ style: {
165
+ display: "flex",
166
+ flex: "1 1 auto",
167
+ flexDirection: "column",
168
+ gap: "8px",
169
+ ...n?.style
170
+ },
171
+ children: [
172
+ pt(ht, {
173
+ sx: {
174
+ display: "flex",
175
+ alignItems: "center",
176
+ gap: 1
177
+ },
178
+ children: [ct($t, {
179
+ variant: "body2",
180
+ sx: { flexGrow: 1 },
181
+ children: r(i ? "condition.formulaMode" : "condition.listMode")
182
+ }), ct(yt, {
183
+ size: "small",
184
+ variant: "outlined",
185
+ onClick: () => {
186
+ o(i ? {
187
+ ...t,
188
+ items: []
189
+ } : {
190
+ ...t,
191
+ items: ""
192
+ });
193
+ },
194
+ children: r(i ? "condition.switchToList" : "condition.switchToFormula")
195
+ })]
196
+ }),
197
+ i && ct(zt, {
198
+ fullWidth: !0,
199
+ size: "small",
200
+ label: r("condition.formula"),
201
+ value: t.items || "",
202
+ onChange: (e) => {
203
+ n = e.target.value, o({
204
+ ...t,
205
+ items: n
206
+ });
207
+ return;
208
+ var n;
209
+ },
210
+ placeholder: "=A1:A10",
211
+ slotProps: { input: { sx: { backgroundColor: "background.paper" } } },
212
+ helperText: r("condition.formulaHelper")
213
+ }),
214
+ !i && pt(dt, { children: [
215
+ pt(ht, {
216
+ sx: {
217
+ display: "flex",
218
+ gap: 1
219
+ },
220
+ children: [ct(zt, {
221
+ fullWidth: !0,
222
+ size: "small",
223
+ label: r("condition.addValue"),
224
+ value: a,
225
+ onChange: (e) => l(e.target.value),
226
+ onKeyPress: (e) => {
227
+ "Enter" === e.key && d();
228
+ },
229
+ slotProps: { input: { sx: { backgroundColor: "background.paper" } } }
230
+ }), ct(Ft, {
231
+ color: "primary",
232
+ onClick: d,
233
+ disabled: !a.trim(),
234
+ sx: { backgroundColor: "background.paper" },
235
+ children: ct(fe, { iconKey: "Add" })
236
+ })]
237
+ }),
238
+ s.length > 0 && pt(ht, {
239
+ sx: {
240
+ p: 2,
241
+ backgroundColor: "background.paper",
242
+ border: 1,
243
+ borderColor: "divider",
244
+ borderRadius: 1
245
+ },
246
+ children: [ct($t, {
247
+ variant: "caption",
248
+ sx: {
249
+ mb: 1,
250
+ display: "block",
251
+ color: "text.secondary"
252
+ },
253
+ children: r("condition.valuesCount", { count: s.length })
254
+ }), ct(Et, {
255
+ direction: "row",
256
+ spacing: 1,
257
+ useFlexGap: !0,
258
+ sx: { flexWrap: "wrap" },
259
+ children: s.map((e, n) => ct(vt, {
260
+ label: String(e),
261
+ onDelete: () => ((e) => {
262
+ const n = s.filter((t, o) => o !== e);
263
+ o({
264
+ ...t,
265
+ items: n.length > 0 ? n : void 0
266
+ });
267
+ })(n),
268
+ size: "small",
269
+ sx: { mb: 1 }
270
+ }, n))
271
+ })]
272
+ }),
273
+ 0 === s.length && ct(ht, {
274
+ sx: {
275
+ p: 3,
276
+ textAlign: "center",
277
+ backgroundColor: "action.hover",
278
+ borderRadius: 1,
279
+ border: 1,
280
+ borderColor: "divider",
281
+ borderStyle: "dashed"
282
+ },
283
+ children: ct($t, {
284
+ variant: "body2",
285
+ sx: { color: "text.secondary" },
286
+ children: r("condition.noValues")
287
+ })
288
+ })
289
+ ] })
290
+ ]
291
+ });
292
+ });
293
+ go.displayName = "InSetOption";
294
+ var ho = {}, yo = Ke((e) => {
295
+ const { option: t, onOptionChange: o, className: n, readOnly: r, ...a } = e, l = We(), i = t?.type ?? R.AverageType.Above, s = t?.stdDevs ?? "";
296
+ let d = { backgroundColor: "background.paper" };
297
+ return r && (d = {
298
+ ...d,
299
+ "& .MuiSelect-icon": { display: "none" },
300
+ "& .MuiOutlinedInput-notchedOutline": { borderColor: "action.disabled" }
301
+ }), pt(ht, {
302
+ className: oo(n, ho.option),
303
+ ...a,
304
+ sx: {
305
+ display: "flex",
306
+ flexDirection: "row",
307
+ gap: .25,
308
+ ...a?.sx
309
+ },
310
+ children: [ct(Tt, {
311
+ sx: { flex: .5 },
312
+ size: "small",
313
+ children: pt(At, {
314
+ value: i,
315
+ sx: d,
316
+ IconComponent: (e) => ct(fe, {
317
+ iconKey: "ExpandMore",
318
+ ...e
319
+ }),
320
+ disabled: r,
321
+ onChange: (e) => o({
322
+ ...t,
323
+ type: e.target.value
324
+ }),
325
+ children: [ct(It, {
326
+ value: R.AverageType.Above,
327
+ children: l("condition.above")
328
+ }), ct(It, {
329
+ value: R.AverageType.Below,
330
+ children: l("condition.below")
331
+ })]
332
+ })
333
+ }), ct(zt, {
334
+ size: "small",
335
+ placeholder: l("condition.stdDevs"),
336
+ value: s,
337
+ onChange: (e) => {
338
+ const n = Number(e.target.value) || "", r = { ...t };
339
+ "number" == typeof n ? r.stdDevs = n : delete r.stdDevs, o(r);
340
+ },
341
+ sx: { flex: .5 },
342
+ disabled: r,
343
+ slotProps: { input: { sx: { backgroundColor: "background.paper" } } },
344
+ type: "number"
345
+ })]
346
+ });
347
+ });
348
+ yo.displayName = "AverageOption";
349
+ var bo = 0, fo = /* @__PURE__ */ new WeakMap(), xo = (e) => {
350
+ let t = fo.get(e);
351
+ return t || (t = "__ci_" + ++bo, fo.set(e, t)), t;
352
+ }, vo = Object.freeze([R.BuiltInOperatorNames.Icon, R.BuiltInOperatorNames.Color]), ko = (e, t, o, n = vo) => {
353
+ const r = t ?? Object.values(I.BuiltInOperators), a = e?.getSelectType() ?? null, l = e?.isList;
354
+ return r.filter((t) => {
355
+ if (n.includes(t.getName())) return !1;
356
+ const o = t.acceptsList?.();
357
+ if (!l && o) return !1;
358
+ if (l && !o) return !1;
359
+ if (!e) return !0;
360
+ const r = t.getAcceptsTypes?.();
361
+ return !r || r.includes(a);
362
+ }).sort((e, t) => (e.getTitle?.() ?? "").localeCompare(t.getTitle?.() ?? "", o));
363
+ }, Co = (e, t, o, n) => {
364
+ const r = (e, t) => (e.getTitle?.() ?? "").localeCompare(t.getTitle?.() ?? "", n), a = e.filter((e) => !e.isCombinator?.()).sort(r), l = e.filter((e) => e.isCombinator?.()).sort(r), i = [];
365
+ return a.length > 0 && (i.push(ct(Ot, {
366
+ disableSticky: !0,
367
+ sx: So,
368
+ children: o("condition.groupBasic")
369
+ }, "__header:leaf")), a.forEach((e) => i.push(t(e)))), a.length > 0 && l.length > 0 && i.push(ct(St, {}, "__divider")), l.length > 0 && (i.push(ct(Ot, {
370
+ disableSticky: !0,
371
+ sx: So,
372
+ children: o("condition.groupCombine")
373
+ }, "__header:combinator")), l.forEach((e) => i.push(t(e)))), i;
374
+ }, wo = (e, t, o = null) => {
375
+ if (!e.isCombinator?.()) return e.createDefaultParam?.(o ?? void 0) ?? null;
376
+ const n = t.find((e) => !e.isCombinator?.()) ?? null, r = n ? {
377
+ operator: n.getName(),
378
+ param: n.createDefaultParam?.(o ?? void 0) ?? null
379
+ } : null;
380
+ return "not" === e.getName() ? r : r ? [r] : [];
381
+ }, So = {
382
+ userSelect: "none",
383
+ lineHeight: "2",
384
+ fontSize: "0.75rem",
385
+ fontWeight: 600,
386
+ color: "text.secondary",
387
+ paddingLeft: 1,
388
+ paddingRight: 1
389
+ }, To = { pl: 2 };
390
+ var Po = Ke((e) => {
391
+ const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = function(e, t) {
392
+ const o = (e) => new Intl.DateTimeFormat(t, { month: "long" }).format(new Date(2e3, e, 1));
393
+ return [
394
+ {
395
+ header: e("condition.period.day"),
396
+ options: [
397
+ {
398
+ value: R.TimePeriodType.Today,
399
+ label: e("condition.period.today")
400
+ },
401
+ {
402
+ value: R.TimePeriodType.Yesterday,
403
+ label: e("condition.period.yesterday")
404
+ },
405
+ {
406
+ value: R.TimePeriodType.Tomorrow,
407
+ label: e("condition.period.tomorrow")
408
+ }
409
+ ]
410
+ },
411
+ {
412
+ header: e("condition.period.week"),
413
+ options: [
414
+ {
415
+ value: R.TimePeriodType.ThisWeek,
416
+ label: e("condition.period.thisWeek")
417
+ },
418
+ {
419
+ value: R.TimePeriodType.LastWeek,
420
+ label: e("condition.period.lastWeek")
421
+ },
422
+ {
423
+ value: R.TimePeriodType.NextWeek,
424
+ label: e("condition.period.nextWeek")
425
+ }
426
+ ]
427
+ },
428
+ {
429
+ header: e("condition.period.month"),
430
+ options: [
431
+ {
432
+ value: R.TimePeriodType.ThisMonth,
433
+ label: e("condition.period.thisMonth")
434
+ },
435
+ {
436
+ value: R.TimePeriodType.LastMonth,
437
+ label: e("condition.period.lastMonth")
438
+ },
439
+ {
440
+ value: R.TimePeriodType.NextMonth,
441
+ label: e("condition.period.nextMonth")
442
+ }
443
+ ]
444
+ },
445
+ {
446
+ header: e("condition.period.year"),
447
+ options: [{
448
+ value: R.TimePeriodType.YearToDate,
449
+ label: e("condition.period.yearToDate")
450
+ }, {
451
+ value: R.TimePeriodType.LastYear,
452
+ label: e("condition.period.lastYear")
453
+ }]
454
+ },
455
+ {
456
+ header: e("condition.period.byMonth"),
457
+ options: [
458
+ {
459
+ value: R.TimePeriodType.M1,
460
+ label: o(0)
461
+ },
462
+ {
463
+ value: R.TimePeriodType.M2,
464
+ label: o(1)
465
+ },
466
+ {
467
+ value: R.TimePeriodType.M3,
468
+ label: o(2)
469
+ },
470
+ {
471
+ value: R.TimePeriodType.M4,
472
+ label: o(3)
473
+ },
474
+ {
475
+ value: R.TimePeriodType.M5,
476
+ label: o(4)
477
+ },
478
+ {
479
+ value: R.TimePeriodType.M6,
480
+ label: o(5)
481
+ },
482
+ {
483
+ value: R.TimePeriodType.M7,
484
+ label: o(6)
485
+ },
486
+ {
487
+ value: R.TimePeriodType.M8,
488
+ label: o(7)
489
+ },
490
+ {
491
+ value: R.TimePeriodType.M9,
492
+ label: o(8)
493
+ },
494
+ {
495
+ value: R.TimePeriodType.M10,
496
+ label: o(9)
497
+ },
498
+ {
499
+ value: R.TimePeriodType.M11,
500
+ label: o(10)
501
+ },
502
+ {
503
+ value: R.TimePeriodType.M12,
504
+ label: o(11)
505
+ }
506
+ ]
507
+ },
508
+ {
509
+ header: e("condition.period.byQuarter"),
510
+ options: [
511
+ {
512
+ value: R.TimePeriodType.ThisQuarter,
513
+ label: e("condition.period.thisQuarter")
514
+ },
515
+ {
516
+ value: R.TimePeriodType.LastQuarter,
517
+ label: e("condition.period.lastQuarter")
518
+ },
519
+ {
520
+ value: R.TimePeriodType.NextQuarter,
521
+ label: e("condition.period.nextQuarter")
522
+ },
523
+ {
524
+ value: R.TimePeriodType.Q1,
525
+ label: e("condition.period.q1")
526
+ },
527
+ {
528
+ value: R.TimePeriodType.Q2,
529
+ label: e("condition.period.q2")
530
+ },
531
+ {
532
+ value: R.TimePeriodType.Q3,
533
+ label: e("condition.period.q3")
534
+ },
535
+ {
536
+ value: R.TimePeriodType.Q4,
537
+ label: e("condition.period.q4")
538
+ }
539
+ ]
540
+ }
541
+ ];
542
+ }(We(), Ie()), l = t?.type ?? R.TimePeriodType.Today;
543
+ return ct(ht, {
544
+ ...r,
545
+ sx: {
546
+ display: "flex",
547
+ flexDirection: "column",
548
+ gap: 2,
549
+ ...r?.sx
550
+ },
551
+ children: ct(Tt, {
552
+ size: "small",
553
+ children: ct(At, {
554
+ value: l,
555
+ sx: { backgroundColor: "background.paper" },
556
+ IconComponent: (e) => ct(fe, {
557
+ iconKey: "ExpandMore",
558
+ ...e
559
+ }),
560
+ onChange: (e) => o({
561
+ ...t,
562
+ type: e.target.value
563
+ }),
564
+ disabled: n,
565
+ children: a.map((e, t) => {
566
+ const o = [];
567
+ return t > 0 && o.push(ct(St, {}, `divider-${t}`)), o.push(ct(Ot, {
568
+ sx: So,
569
+ children: e.header
570
+ }, `header-${t}`)), e.options.map((e) => o.push(ct(It, {
571
+ sx: To,
572
+ value: e.value,
573
+ children: e.label
574
+ }, e.value))), o;
575
+ })
576
+ })
577
+ })
578
+ });
579
+ });
580
+ Po.displayName = "TimePeriodOption";
581
+ var Fo = Ke((e) => {
582
+ const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = We(), l = t?.top ?? !0, i = t?.limit ?? 10, s = t?.percent ?? !1;
583
+ return pt(ht, {
584
+ ...r,
585
+ sx: {
586
+ display: "flex",
587
+ flexDirection: "row",
588
+ gap: .25,
589
+ ...r?.sx
590
+ },
591
+ children: [
592
+ ct(Tt, {
593
+ size: "small",
594
+ sx: { flex: 1 },
595
+ children: pt(At, {
596
+ value: l ? "top" : "bottom",
597
+ sx: { backgroundColor: "background.paper" },
598
+ IconComponent: (e) => ct(fe, {
599
+ iconKey: "ExpandMore",
600
+ ...e
601
+ }),
602
+ onChange: (e) => o({
603
+ ...t,
604
+ top: "top" === e.target.value
605
+ }),
606
+ disabled: n,
607
+ children: [ct(It, {
608
+ value: "top",
609
+ children: a("condition.top")
610
+ }), ct(It, {
611
+ value: "bottom",
612
+ children: a("condition.bottom")
613
+ })]
614
+ })
615
+ }),
616
+ ct(zt, {
617
+ size: "small",
618
+ placeholder: "10",
619
+ value: i,
620
+ onChange: (e) => {
621
+ const n = parseFloat(e.target.value) || 10;
622
+ o({
623
+ ...t,
624
+ limit: n
625
+ });
626
+ },
627
+ disabled: n,
628
+ type: "number",
629
+ slotProps: { input: { sx: { backgroundColor: "background.paper" } } },
630
+ sx: { flex: .6 }
631
+ }),
632
+ ct(Tt, {
633
+ size: "small",
634
+ sx: { flex: 1 },
635
+ children: pt(At, {
636
+ value: s ? "percent" : "items",
637
+ sx: { backgroundColor: "background.paper" },
638
+ IconComponent: (e) => ct(fe, {
639
+ iconKey: "ExpandMore",
640
+ ...e
641
+ }),
642
+ onChange: (e) => o({
643
+ ...t,
644
+ percent: "percent" === e.target.value
645
+ }),
646
+ disabled: n,
647
+ children: [ct(It, {
648
+ value: "items",
649
+ children: a("condition.items")
650
+ }), ct(It, {
651
+ value: "percent",
652
+ children: a("condition.percent")
653
+ })]
654
+ })
655
+ })
656
+ ]
657
+ });
658
+ });
659
+ Fo.displayName = "TopNOption";
660
+ var Do = Ke((e) => {
661
+ const { option: t, onOptionChange: o, readOnly: n, ...r } = e, a = We();
662
+ return pt(ht, {
663
+ ...r,
664
+ sx: {
665
+ display: "flex",
666
+ flexDirection: "row",
667
+ gap: .25,
668
+ ...r?.sx
669
+ },
670
+ children: [ct(mo, {
671
+ option: t?.from ?? null,
672
+ placeholder: a("condition.from"),
673
+ onOptionChange: (e) => {
674
+ o({
675
+ ...t,
676
+ from: e
677
+ });
678
+ },
679
+ readOnly: n,
680
+ sx: {
681
+ flex: .6,
682
+ minWidth: 0
683
+ }
684
+ }), ct(mo, {
685
+ option: t?.to ?? null,
686
+ placeholder: a("condition.to"),
687
+ onOptionChange: (e) => {
688
+ o({
689
+ ...t,
690
+ to: e
691
+ });
692
+ },
693
+ readOnly: n,
694
+ sx: {
695
+ flex: .6,
696
+ minWidth: 0
697
+ }
698
+ })]
699
+ });
700
+ });
701
+ Do.displayName = "BetweenOption";
702
+ var No = Ke((e) => {
703
+ const { option: t, onOptionChange: o, readOnly: n, ...a } = e, l = We();
704
+ return ct(r, {
705
+ size: "small",
706
+ value: t ?? "",
707
+ onChangeText: (e) => o(e),
708
+ placeholder: l("condition.enterFormula"),
709
+ disabled: n,
710
+ fullWidth: !0,
711
+ equals: "bare",
712
+ label: null,
713
+ showError: !1,
714
+ helperText: null,
715
+ ...a
716
+ });
717
+ });
718
+ No.displayName = "ExpressionOption";
719
+ var Oo = Ke((e) => {
720
+ const { value: t = null, selectors: o, onChange: n, title: r, allowNull: a = !1, readOnly: l = !1, ...i } = e, s = We(), d = r ?? s("condition.selectorTitle"), c = o.map((e) => {
721
+ const t = e.getName();
722
+ return ct(It, {
723
+ value: t,
724
+ children: e.getTitle?.() ?? e.getName()
725
+ }, t);
726
+ });
727
+ let p = { backgroundColor: "background.paper" };
728
+ return l && (p = {
729
+ ...p,
730
+ "& .MuiSelect-icon": { display: "none" },
731
+ "& .MuiOutlinedInput-notchedOutline": { borderColor: "action.disabled" }
732
+ }), pt(Tt, {
733
+ size: "small",
734
+ ...i,
735
+ children: [ct(Nt, { children: d }), pt(At, {
736
+ value: t?.getName() ?? "null",
737
+ label: d,
738
+ readOnly: l,
739
+ IconComponent: (e) => ct(fe, {
740
+ iconKey: "ExpandMore",
741
+ ...e
742
+ }),
743
+ onChange: (e) => {
744
+ const t = e.target.value, r = "null" === t ? null : o.find((e) => e.getName() === t) ?? null;
745
+ n(r);
746
+ },
747
+ sx: p,
748
+ children: [a && ct(It, {
749
+ value: "null",
750
+ children: s("condition.anySelector")
751
+ }), c]
752
+ })]
753
+ });
754
+ });
755
+ Oo.displayName = "SelectorSelect";
756
+ var Io = Ke((e) => {
757
+ const { value: t, operators: o, onChange: n, title: r, readOnly: a = !1, ...l } = e, i = We(), s = Ie(), d = r ?? i("condition.operatorTitle"), c = /* @__PURE__ */ new Map();
758
+ o.forEach((e) => {
759
+ c.set(e.getName(), e);
760
+ });
761
+ const p = Co(o, (e) => ct(It, {
762
+ value: e.getName(),
763
+ sx: To,
764
+ children: e.getTitle?.()
765
+ }, e.getName()), i, s);
766
+ return pt(Tt, {
767
+ size: "small",
768
+ ...l,
769
+ children: [ct(Nt, { children: d }), ct(At, {
770
+ value: t?.getName() ?? "null",
771
+ label: d,
772
+ readOnly: a,
773
+ IconComponent: (e) => ct(fe, {
774
+ iconKey: "ExpandMore",
775
+ ...e
776
+ }),
777
+ onChange: (e) => {
778
+ const t = e.target.value, o = "null" === t ? null : c.get(t) ?? null;
779
+ n(o);
780
+ },
781
+ sx: a ? {
782
+ "& .MuiSelect-icon": { display: "none" },
783
+ "& .MuiOutlinedInput-notchedOutline": { borderColor: "action.disabled" }
784
+ } : void 0,
785
+ children: p
786
+ })]
787
+ });
788
+ });
789
+ Io.displayName = "OperatorSelect";
790
+ var Mo = Ke(Le((e, t) => {
791
+ const { icon: o, tooltip: n, label: r, darkMode: a, propsPanel: l, value: i, operators: s, onChange: d, title: c, readOnly: p = !1, ...u } = e, m = We(), g = Ie();
792
+ c ?? m("condition.operatorTitle");
793
+ const h = o || ct(fe, { iconKey: "Add" }), y = qe(d);
794
+ return y.current = d, ct(Ze, {
795
+ ref: t,
796
+ createPopupPanel: Ve((e) => {
797
+ const { closeFloatAll: t } = e, o = Co(s, (e) => ct(It, {
798
+ sx: To,
799
+ value: e.getName(),
800
+ onClick: () => {
801
+ t?.(), y.current(e);
802
+ },
803
+ children: e.getTitle?.()
804
+ }, e.getName()), m, g);
805
+ return ct("div", {
806
+ style: {
807
+ minWidth: 200,
808
+ paddingTop: "8px",
809
+ paddingBottom: "8px",
810
+ ...l?.style
811
+ },
812
+ ...l,
813
+ onKeyDown: (e) => {
814
+ e.which === xe.Enter && t?.();
815
+ },
816
+ children: ct(Mt, {
817
+ disablePadding: !0,
818
+ children: o
819
+ })
820
+ });
821
+ }, [
822
+ s,
823
+ m,
824
+ g
825
+ ]),
826
+ tooltip: n || r || "When",
827
+ label: r,
828
+ disabled: p,
829
+ icon: h,
830
+ ...u
831
+ });
832
+ })), Ro = Ke((e) => {
833
+ const { operator: t, inputs: o, onOptionChange: n, operators: r, selector: a, readOnly: l, ...i } = e, s = We(), d = "not" === t.getName(), c = d ? null : "and" === t.getName() ? s("condition.and") : s("condition.or"), p = (e, t) => {
834
+ const r = o.slice(), a = {
835
+ operator: t.operator,
836
+ param: t.param
837
+ };
838
+ ((e, t) => {
839
+ const o = fo.get(e);
840
+ o && fo.set(t, o);
841
+ })(o[e], a), r[e] = a, n(r);
842
+ }, u = d ? s("condition.not") : c;
843
+ return ct(ht, {
844
+ sx: {
845
+ display: "flex",
846
+ flexDirection: "column",
847
+ gap: .5,
848
+ pl: 1,
849
+ borderLeft: 2,
850
+ borderColor: "divider"
851
+ },
852
+ ...i,
853
+ children: o.map((e, t) => ct(Be.Fragment, { children: ct(jo, {
854
+ operatorTitle: t > 0 ? u ?? "" : "",
855
+ operatorParam: e,
856
+ onOperatorParamChange: (e) => p(t, e),
857
+ onRemove: () => ((e) => {
858
+ const t = o.filter((t, o) => o !== e);
859
+ n(t);
860
+ })(t),
861
+ operators: r,
862
+ selector: a,
863
+ readOnly: l,
864
+ required: d
865
+ }) }, xo(e)))
866
+ });
867
+ });
868
+ Ro.displayName = "CombinatorOption";
869
+ var Ao = Ke((e) => {
870
+ const { option: t, onOptionChange: o, readOnly: n } = e, r = We();
871
+ return pt(Vt, {
872
+ exclusive: !0,
873
+ size: "small",
874
+ value: t ?? !0,
875
+ onChange: (e, t) => {
876
+ null !== t && o(t);
877
+ },
878
+ sx: {
879
+ my: 0,
880
+ py: 0,
881
+ backgroundColor: "background.paper"
882
+ },
883
+ disabled: n,
884
+ children: [ct(Kt, {
885
+ value: !0,
886
+ children: r("condition.true")
887
+ }), ct(Kt, {
888
+ value: !1,
889
+ children: r("condition.false")
890
+ })]
891
+ });
892
+ });
893
+ function Eo(e, t) {
894
+ if (!e) return Wo(t);
895
+ const o = /* @__PURE__ */ new Date(`${e}T${t || "00:00"}`);
896
+ return isNaN(o.getTime()) ? null : o;
897
+ }
898
+ function Wo(e) {
899
+ return e ? Eo("1970-01-01", e) : null;
900
+ }
901
+ Ao.displayName = "BooleanOption";
902
+ var Bo = Ke((e) => {
903
+ const { option: t, onOptionChange: o, allowFormula: n, readOnly: r, type: a = "dateTime", ...l } = e, i = We(), s = "date" === a || "dateTime" === a, d = "time" === a || "dateTime" === a, c = pe(), p = Ve((e) => {
904
+ if (!c || null === e) return null;
905
+ const t = c.createCell({ value: e }), o = t.getValue();
906
+ return t.getType() !== z.Number ? null : o;
907
+ }, [c]), u = Ve((e) => c ? c.createCell({
908
+ value: e,
909
+ style: { numberFormat: "Short DateTime" }
910
+ }).getDate() : null, [c]);
911
+ if (n && "string" == typeof t) return ct(mo, {
912
+ option: t,
913
+ onOptionChange: (e) => o(e),
914
+ readOnly: r,
915
+ sx: l?.sx
916
+ });
917
+ const m = u(t ?? null), g = !(h = m) || isNaN(h.getTime()) ? "" : `${h.getFullYear()}-${String(h.getMonth() + 1).padStart(2, "0")}-${String(h.getDate()).padStart(2, "0")}`;
918
+ var h;
919
+ const y = function(e) {
920
+ return !e || isNaN(e.getTime()) ? "" : `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
921
+ }(m);
922
+ return pt(ht, {
923
+ ...l,
924
+ sx: {
925
+ display: "flex",
926
+ flexDirection: "row",
927
+ gap: .5,
928
+ ...l?.sx
929
+ },
930
+ children: [s && ct(co, {
931
+ option: g,
932
+ type: "date",
933
+ placeholder: i("condition.enterDate"),
934
+ onOptionChange: (e) => {
935
+ const t = p(Eo(e, y));
936
+ o(t);
937
+ },
938
+ sx: { flex: 1.5 },
939
+ readOnly: r
940
+ }), d && ct(co, {
941
+ option: y,
942
+ type: "time",
943
+ placeholder: i("condition.enterTime"),
944
+ onOptionChange: (e) => {
945
+ const t = p("time" === a ? Wo(e) : Eo(g, e));
946
+ o(t);
947
+ },
948
+ sx: { flex: 1 },
949
+ readOnly: r
950
+ })]
951
+ });
952
+ });
953
+ Bo.displayName = "DateTimeOption";
954
+ var Lo = R.BuiltInOperatorNames, zo = /* @__PURE__ */ new Set([
955
+ Lo.EqualTo,
956
+ Lo.GreaterThan,
957
+ Lo.GreaterThanEqualTo,
958
+ Lo.LessThan,
959
+ Lo.LessThanEqualTo,
960
+ Lo.After,
961
+ Lo.AfterEqualTo,
962
+ Lo.Before,
963
+ Lo.BeforeEqualTo
964
+ ]), jo = Ke((e) => {
965
+ const { operatorParam: t, onOperatorParamChange: o, onRemove: n, operators: r, selector: a, operatorTitle: l, readOnly: i, required: s, ...d } = e, c = We(), p = l ?? c("condition.when"), u = t?.operator ?? null, m = r.find((e) => e.getName() === u) ?? null, g = t?.param ?? null, h = !!m?.isCombinator?.(), [y, { width: b }] = ro(), f = Ue(() => !m || h ? null : m.getParamType?.(a ?? void 0) ?? null, [
966
+ m,
967
+ h,
968
+ a
969
+ ]), x = !h && "list" !== f && b > 360, v = De((e) => {
970
+ o({
971
+ operator: u,
972
+ param: e
973
+ });
974
+ }, [o, u]), k = Ue(() => {
975
+ if (!m || h || !f) return null;
976
+ const e = {
977
+ sx: {
978
+ flex: .6,
979
+ minWidth: 0
980
+ },
981
+ option: g,
982
+ onOptionChange: v
983
+ }, t = !!u && zo.has(u);
984
+ return f === R.BuiltInSelectorNames.Number || f === R.BuiltInSelectorNames.TextLength ? ct(t ? mo : po, { ...e }) : f === R.BuiltInSelectorNames.Whole ? t ? ct(mo, { ...e }) : ct(po, {
985
+ ...e,
986
+ placeholder: c("condition.enterWholeNumber"),
987
+ slotProps: { htmlInput: {
988
+ step: 1,
989
+ onKeyDown: (e) => {
990
+ [
991
+ ".",
992
+ ",",
993
+ "e",
994
+ "E"
995
+ ].includes(e.key) && e.preventDefault();
996
+ },
997
+ onPaste: (e) => {
998
+ /^-?\d+$/.test(e.clipboardData.getData("text")) || e.preventDefault();
999
+ }
1000
+ } }
1001
+ }) : f === R.BuiltInSelectorNames.Text ? ct(t ? mo : co, { ...e }) : f === R.BuiltInSelectorNames.DateTime ? ct(Bo, {
1002
+ ...e,
1003
+ allowFormula: t
1004
+ }) : f === R.BuiltInSelectorNames.Date ? ct(Bo, {
1005
+ ...e,
1006
+ type: "date",
1007
+ allowFormula: t
1008
+ }) : f === R.BuiltInSelectorNames.Time ? ct(Bo, {
1009
+ ...e,
1010
+ type: "time",
1011
+ allowFormula: t
1012
+ }) : f === R.BuiltInSelectorNames.List ? ct(go, { ...e }) : f === R.BuiltInSelectorNames.Logical ? ct(Ao, { ...e }) : f === R.BuiltInOperatorNames.Average ? ct(yo, { ...e }) : f === R.BuiltInOperatorNames.TimePeriod ? ct(Po, { ...e }) : f === R.BuiltInOperatorNames.TopN ? ct(Fo, { ...e }) : f === R.BuiltInOperatorNames.Between ? ct(Do, { ...e }) : f === R.BuiltInOperatorNames.Expression ? ct(No, { ...e }) : null;
1013
+ }, [
1014
+ m,
1015
+ h,
1016
+ f,
1017
+ g,
1018
+ c
1019
+ ]), C = Ue(() => h && g ? Array.isArray(g) ? g : [g] : [], [h, g]), w = h && "not" === m?.getName(), S = (e) => {
1020
+ if (!e || e === m) return;
1021
+ const t = !!e.isCombinator?.();
1022
+ let n;
1023
+ if (t && h) n = "not" === e.getName() ? C[0] ?? wo(e, r, a) : C.length > 0 ? C : wo(e, r, a);
1024
+ else {
1025
+ const o = m?.getParamType?.(a ?? void 0) ?? null, l = e.getParamType?.(a ?? void 0) ?? null;
1026
+ n = !t && l && l === o ? g : wo(e, r, a);
1027
+ }
1028
+ o({
1029
+ operator: e?.getName() ?? null,
1030
+ param: n
1031
+ });
1032
+ };
1033
+ return ct(ht, {
1034
+ ref: y,
1035
+ sx: {
1036
+ display: "flex",
1037
+ flexDirection: "column",
1038
+ gap: .5,
1039
+ backgroundColor: "background.paper",
1040
+ border: 1,
1041
+ borderColor: "divider",
1042
+ borderRadius: 1,
1043
+ p: 1
1044
+ },
1045
+ ...d,
1046
+ children: x ? pt(ht, {
1047
+ sx: {
1048
+ display: "flex",
1049
+ flexDirection: "row",
1050
+ alignItems: "center",
1051
+ gap: .5
1052
+ },
1053
+ children: [
1054
+ ct(Io, {
1055
+ title: p,
1056
+ sx: { flex: .4 },
1057
+ value: m,
1058
+ operators: r,
1059
+ onChange: S,
1060
+ readOnly: i
1061
+ }),
1062
+ k,
1063
+ !i && !s && ct(Je, {
1064
+ icon: ct(fe, { iconKey: "Close" }),
1065
+ onClick: n
1066
+ })
1067
+ ]
1068
+ }) : pt(dt, { children: [pt(ht, {
1069
+ sx: {
1070
+ display: "flex",
1071
+ flexDirection: "row",
1072
+ alignItems: "center",
1073
+ gap: .5
1074
+ },
1075
+ children: [
1076
+ ct(Io, {
1077
+ title: p,
1078
+ sx: { flex: 1 },
1079
+ value: m,
1080
+ operators: r,
1081
+ onChange: S,
1082
+ readOnly: i
1083
+ }),
1084
+ h && !w && !i && ct(Mo, {
1085
+ label: m?.getTitle?.(),
1086
+ icon: ct(fe, { iconKey: "Add" }),
1087
+ operators: r,
1088
+ value: null,
1089
+ onChange: (e) => {
1090
+ if (!e) return;
1091
+ const t = wo(e, r, a), n = [...C, {
1092
+ operator: e?.getName() ?? null,
1093
+ param: t
1094
+ }];
1095
+ o({
1096
+ operator: u,
1097
+ param: n
1098
+ });
1099
+ }
1100
+ }),
1101
+ !i && !s && ct(Je, {
1102
+ icon: ct(fe, { iconKey: "Close" }),
1103
+ disabled: i,
1104
+ onClick: n
1105
+ })
1106
+ ]
1107
+ }), h ? ct(Ro, {
1108
+ operator: m,
1109
+ inputs: C,
1110
+ onOptionChange: (e) => {
1111
+ o({
1112
+ operator: u,
1113
+ param: w ? e[0] ?? null : e
1114
+ });
1115
+ },
1116
+ operators: r,
1117
+ selector: a,
1118
+ readOnly: i
1119
+ }) : k] })
1120
+ });
1121
+ });
1122
+ jo.displayName = "OperatorAndParamEditor";
1123
+ var Ko = Ke((e) => {
1124
+ const { condition: t, onConditionChange: o, showIncludeBlanks: n = !1, selectorTitle: r, readOnly: a, operators: l, selectors: i, ...s } = e, d = We(), c = Ie(), [p, u] = He(() => t?.getSelector() ?? null), [m, g] = He(() => t?.getOperator() ? {
1125
+ operator: t.getOperator().getName(),
1126
+ param: t.getParam()
1127
+ } : null), [h, y] = He(() => t?.isIncludeBlanks() ?? !1);
1128
+ $e(() => {
1129
+ if (!t) return u(null), void g(null);
1130
+ const e = t.getOperator(), o = t.getSelector() ?? null;
1131
+ u(o), g(e ? {
1132
+ operator: e.getName(),
1133
+ param: t.getParam()
1134
+ } : null), y(t.isIncludeBlanks());
1135
+ }, [t]);
1136
+ const b = Ue(() => (i ?? Object.values(I.BuiltInSelectors)).slice().sort((e, t) => (e.getTitle?.() ?? "").localeCompare(t.getTitle?.() ?? "", c)), [i, c]), f = Ue(() => l ?? Object.values(I.BuiltInOperators), [l]), x = Ue(() => ko(p, f, c), [
1137
+ p,
1138
+ f,
1139
+ c
1140
+ ]), v = (e) => {
1141
+ g(e), o?.({
1142
+ selector: p,
1143
+ ...e
1144
+ });
1145
+ }, k = n;
1146
+ return pt(ht, {
1147
+ sx: {
1148
+ display: "flex",
1149
+ flexDirection: "column",
1150
+ p: 2,
1151
+ pb: k ? 0 : 1,
1152
+ gap: 1,
1153
+ backgroundColor: "action.hover",
1154
+ border: 1,
1155
+ borderColor: "divider",
1156
+ borderRadius: 1
1157
+ },
1158
+ ...s,
1159
+ children: [
1160
+ ct(Oo, {
1161
+ title: r,
1162
+ selectors: b,
1163
+ value: p,
1164
+ onChange: (e) => {
1165
+ if (u(e), m) {
1166
+ const { operator: t } = m, n = f.find((e) => e.getName() === t) ?? null, r = ko(e, f);
1167
+ if (!n || !r.includes(n)) return g(null), void o?.({
1168
+ selector: e,
1169
+ operator: null,
1170
+ param: null
1171
+ });
1172
+ const a = !!n.isCombinator?.(), l = n.getParamType?.(p ?? void 0) ?? null, i = n.getParamType?.(e ?? void 0) ?? null;
1173
+ if (a || l !== i) {
1174
+ const t = wo(n, r, e), a = {
1175
+ operator: n.getName(),
1176
+ param: t
1177
+ };
1178
+ g(a), o?.({
1179
+ selector: e,
1180
+ ...a
1181
+ });
1182
+ return;
1183
+ }
1184
+ }
1185
+ o?.({
1186
+ selector: e,
1187
+ ...m
1188
+ });
1189
+ },
1190
+ allowNull: !0,
1191
+ readOnly: a
1192
+ }),
1193
+ m ? ct(jo, {
1194
+ operatorParam: m,
1195
+ onOperatorParamChange: v,
1196
+ onRemove: () => {
1197
+ g(null), o?.({
1198
+ selector: p,
1199
+ operator: null,
1200
+ param: null
1201
+ });
1202
+ },
1203
+ operators: x,
1204
+ selector: p,
1205
+ readOnly: a
1206
+ }) : !a && ct(ht, {
1207
+ sx: { display: "flex" },
1208
+ children: ct(Mo, {
1209
+ label: d("condition.when"),
1210
+ operators: x,
1211
+ value: null,
1212
+ onChange: (e) => {
1213
+ e && v({
1214
+ operator: e?.getName() ?? null,
1215
+ param: wo(e, x, p)
1216
+ });
1217
+ },
1218
+ readOnly: a
1219
+ })
1220
+ }),
1221
+ k && ct(Pt, {
1222
+ control: ct(xt, {
1223
+ checked: !h,
1224
+ onChange: (e) => {
1225
+ t = !e.target.checked, y(t), o?.({
1226
+ selector: p,
1227
+ ...m,
1228
+ includeBlanks: t
1229
+ });
1230
+ return;
1231
+ var t;
1232
+ }
1233
+ }),
1234
+ disabled: a,
1235
+ label: d("condition.ignoreBlanks")
1236
+ })
1237
+ ]
1238
+ });
1239
+ });
1240
+ Ko.displayName = "ConditionEditor";
1241
+ var Vo = Ke((e) => {
1242
+ const { variant: t = "format", children: o, sx: n, ...r } = e;
1243
+ return ct(ht, {
1244
+ className: `sxl-cf-rule-section sxl-cf-rule-section-${t}`,
1245
+ sx: {
1246
+ display: "flex",
1247
+ flexDirection: "column",
1248
+ gap: 1,
1249
+ p: 2,
1250
+ border: 1,
1251
+ borderColor: "divider",
1252
+ borderRadius: 1,
1253
+ ..."config" === t ? { backgroundColor: "action.hover" } : null,
1254
+ ...n
1255
+ },
1256
+ ...r,
1257
+ children: o
1258
+ });
1259
+ });
1260
+ Vo.displayName = "RuleSection";
1261
+ var $o = new N("transparent"), _o = {
1262
+ lightRedFillDarkRedText: eo("conditionalFormat.preset.lightRedFillDarkRedText"),
1263
+ yellowFillDarkYellowText: eo("conditionalFormat.preset.yellowFillDarkYellowText"),
1264
+ greenFillDarkGreenText: eo("conditionalFormat.preset.greenFillDarkGreenText"),
1265
+ lightRedFill: eo("conditionalFormat.preset.lightRedFill"),
1266
+ redText: eo("conditionalFormat.preset.redText"),
1267
+ redBorder: eo("conditionalFormat.preset.redBorder")
1268
+ }, Uo = (e) => e ? "string" == typeof e ? e : e.type === W.Type.None ? null : e.color ?? e.foreground ?? null : null, qo = (e, t) => "auto" === e ? null : b(e, t), Ho = Ke((n) => {
1269
+ const { format: r, onFormatChange: a, readOnly: l, ...i } = n, s = We(), { workbook: d, schemeLookup: c, themeKey: p, darkMode: u, propsColorPanel: m } = g(), h = r?.font ?? null, y = (h?.weight ?? 400) >= 600, b = h?.style === B.Style.Italic, f = !!h?.underline && h.underline !== B.UnderlineStyle.None, v = !!h?.strike, k = (e) => {
1270
+ const t = { ...h };
1271
+ for (const [o, n] of Object.entries(e)) void 0 === n ? delete t[o] : t[o] = n;
1272
+ const o = { ...r };
1273
+ 0 === Object.keys(t).length ? delete o.font : o.font = t, a(0 === Object.keys(o).length ? null : o);
1274
+ }, C = Ue(() => d?.getStyles().getNormal().getFont().getColor(), [d, p]), w = Ue(() => qo(h?.color, d), [
1275
+ h?.color,
1276
+ d,
1277
+ p
1278
+ ]), S = Ue(() => qo(Uo(r?.fill), d), [
1279
+ r?.fill,
1280
+ d,
1281
+ p
1282
+ ]), T = {
1283
+ padding: "4px",
1284
+ border: "none",
1285
+ borderRadius: 1
1286
+ };
1287
+ return pt(Vo, {
1288
+ ...i,
1289
+ children: [pt(ht, {
1290
+ sx: {
1291
+ display: "flex",
1292
+ alignItems: "flex-start",
1293
+ gap: 1
1294
+ },
1295
+ children: [ct(ht, {
1296
+ sx: {
1297
+ flex: "1 1 auto",
1298
+ minWidth: 0,
1299
+ display: "flex",
1300
+ gap: .5,
1301
+ flexWrap: "wrap"
1302
+ },
1303
+ children: q.map((e, t) => {
1304
+ const o = qo(Uo(e.style.fill), d), n = qo(e.style.font?.color, d), r = e.style.border ? qo(Object.values(e.style.border)[0]?.color, d) : null;
1305
+ return ct(x, {
1306
+ sheet: !0,
1307
+ title: s(_o[e.key] ?? e.key),
1308
+ disabled: l,
1309
+ onClick: () => a(structuredClone(e.style)),
1310
+ sx: {
1311
+ backgroundColor: o?.toCSS("adaptive") ?? void 0,
1312
+ color: n?.toCSS("adaptive") ?? void 0,
1313
+ outline: r ? `1px solid ${r.toCSS("adaptive")}` : void 0,
1314
+ outlineOffset: "-3px"
1315
+ },
1316
+ children: "Aa"
1317
+ }, t);
1318
+ })
1319
+ }), ct(x, {
1320
+ title: s("conditionalFormat.clearStyle"),
1321
+ disabled: l || !r,
1322
+ onClick: () => a(null),
1323
+ sx: {
1324
+ color: "text.secondary",
1325
+ "&:disabled": { opacity: .4 }
1326
+ },
1327
+ children: ct(fe, {
1328
+ iconKey: "ClearFormats",
1329
+ size: 16
1330
+ })
1331
+ })]
1332
+ }), pt(ht, {
1333
+ sx: {
1334
+ display: "flex",
1335
+ alignItems: "center",
1336
+ gap: .25
1337
+ },
1338
+ children: [
1339
+ ct(Kt, {
1340
+ value: "bold",
1341
+ size: "small",
1342
+ sx: T,
1343
+ selected: y,
1344
+ disabled: l,
1345
+ onChange: () => k({ weight: y ? void 0 : 700 }),
1346
+ children: ct(fe, { iconKey: "TextBold" })
1347
+ }),
1348
+ ct(Kt, {
1349
+ value: "italic",
1350
+ size: "small",
1351
+ sx: T,
1352
+ selected: b,
1353
+ disabled: l,
1354
+ onChange: () => k({ style: b ? void 0 : B.Style.Italic }),
1355
+ children: ct(fe, { iconKey: "TextItalic" })
1356
+ }),
1357
+ ct(Kt, {
1358
+ value: "underline",
1359
+ size: "small",
1360
+ sx: T,
1361
+ selected: f,
1362
+ disabled: l,
1363
+ onChange: () => k({ underline: f ? void 0 : B.UnderlineStyle.Single }),
1364
+ children: ct(fe, { iconKey: "TextUnderline" })
1365
+ }),
1366
+ ct(Kt, {
1367
+ value: "strike",
1368
+ size: "small",
1369
+ sx: T,
1370
+ selected: v,
1371
+ disabled: l,
1372
+ onChange: () => k({ strike: !v || void 0 }),
1373
+ children: ct(fe, { iconKey: "TextStrike" })
1374
+ }),
1375
+ d && ct(t, {
1376
+ tooltip: s("conditionalFormat.border"),
1377
+ selectedBorder: r?.border,
1378
+ createBorder: (e) => d.getStyles().getNormal().createStyle({ border: e }).getBorder(),
1379
+ schemeLookup: c,
1380
+ autoColor: C,
1381
+ darkMode: u,
1382
+ disabled: l,
1383
+ onSelectBorder: (e) => ((e) => {
1384
+ const t = { ...r };
1385
+ e && 0 !== Object.keys(e).length ? t.border = e : delete t.border, a(0 === Object.keys(t).length ? null : t);
1386
+ })(e)
1387
+ }),
1388
+ ct(o, {
1389
+ icon: "fill.colored",
1390
+ tooltip: s("conditionalFormat.fillColor"),
1391
+ selectedColor: S,
1392
+ disabled: l,
1393
+ onSelectColor: (e) => ((e) => {
1394
+ const t = { ...r };
1395
+ e ? t.fill = {
1396
+ type: W.Type.Solid,
1397
+ color: e.toString()
1398
+ } : delete t.fill, a(0 === Object.keys(t).length ? null : t);
1399
+ })(e),
1400
+ darkMode: u,
1401
+ propsPanel: {
1402
+ disableAlpha: !0,
1403
+ autoColor: $o,
1404
+ autoColorLabelKey: eo("color.noFill"),
1405
+ autoColorPosition: e.End,
1406
+ ...m
1407
+ }
1408
+ }),
1409
+ ct(o, {
1410
+ icon: "text.colored",
1411
+ tooltip: s("conditionalFormat.fontColor"),
1412
+ selectedColor: w,
1413
+ disabled: l,
1414
+ onSelectColor: (e) => k({ color: e ? e.toString() : void 0 }),
1415
+ darkMode: u,
1416
+ propsPanel: {
1417
+ disableAlpha: !0,
1418
+ autoColor: C,
1419
+ ...m
1420
+ }
1421
+ })
1422
+ ]
1423
+ })]
1424
+ });
1425
+ });
1426
+ Ho.displayName = "ConditionalFormatStylePicker";
1427
+ var Go = {
1428
+ [A.ColorStopType.AutoMin]: eo("conditionalFormat.stopType.autoMin"),
1429
+ [A.ColorStopType.AutoMax]: eo("conditionalFormat.stopType.autoMax"),
1430
+ [A.ColorStopType.Min]: eo("conditionalFormat.stopType.min"),
1431
+ [A.ColorStopType.Max]: eo("conditionalFormat.stopType.max"),
1432
+ [A.ColorStopType.Num]: eo("conditionalFormat.stopType.num"),
1433
+ [A.ColorStopType.Percent]: eo("conditionalFormat.stopType.percent"),
1434
+ [A.ColorStopType.Percentile]: eo("conditionalFormat.stopType.percentile"),
1435
+ [A.ColorStopType.Formula]: eo("conditionalFormat.stopType.formula")
1436
+ }, Qo = /* @__PURE__ */ new Set([
1437
+ A.ColorStopType.AutoMin,
1438
+ A.ColorStopType.AutoMax,
1439
+ A.ColorStopType.Min,
1440
+ A.ColorStopType.Max
1441
+ ]), Yo = Ke((e) => {
1442
+ const { label: t, stop: n, onStopChange: a, allowedTypes: l, showColor: i = !1, showExclusive: s = !1, readOnly: d, ...c } = e, p = We(), { darkMode: u, toColor: m, propsColorPanel: h } = g(), y = n.type ?? A.ColorStopType.Num, b = !Qo.has(y), f = d || !b, x = y === A.ColorStopType.Formula, v = n.color, k = i ? m(v) : null;
1443
+ return pt(ht, {
1444
+ sx: {
1445
+ display: "flex",
1446
+ alignItems: "center",
1447
+ gap: .5
1448
+ },
1449
+ ...c,
1450
+ children: [
1451
+ ct($t, {
1452
+ variant: "caption",
1453
+ sx: {
1454
+ color: "text.secondary",
1455
+ flex: "0 0 62px",
1456
+ minWidth: 0,
1457
+ overflow: "hidden",
1458
+ textOverflow: "ellipsis"
1459
+ },
1460
+ children: t
1461
+ }),
1462
+ i && ct(o, {
1463
+ tooltip: p("conditionalFormat.stopColor"),
1464
+ selectedColor: k,
1465
+ disabled: d,
1466
+ onSelectColor: (e) => {
1467
+ e && a({
1468
+ ...n,
1469
+ color: e.toString()
1470
+ });
1471
+ },
1472
+ darkMode: u,
1473
+ propsPanel: {
1474
+ disableAlpha: !0,
1475
+ ...h
1476
+ }
1477
+ }),
1478
+ s && pt(At, {
1479
+ size: "small",
1480
+ value: n.exclusive ? "gt" : "gte",
1481
+ disabled: d,
1482
+ onChange: (e) => {
1483
+ const t = { ...n };
1484
+ "gt" === e.target.value ? t.exclusive = !0 : delete t.exclusive, a(t);
1485
+ },
1486
+ sx: {
1487
+ flex: "0 0 auto",
1488
+ backgroundColor: "background.paper"
1489
+ },
1490
+ children: [ct(It, {
1491
+ value: "gte",
1492
+ children: ">="
1493
+ }), ct(It, {
1494
+ value: "gt",
1495
+ children: ">"
1496
+ })]
1497
+ }),
1498
+ ct(At, {
1499
+ size: "small",
1500
+ value: y,
1501
+ disabled: d,
1502
+ onChange: (e) => ((e) => {
1503
+ const t = {
1504
+ ...n,
1505
+ type: e
1506
+ };
1507
+ if (Qo.has(e)) delete t.value;
1508
+ else if (void 0 === t.value) t.value = e === A.ColorStopType.Formula ? "" : 0;
1509
+ else if (e !== A.ColorStopType.Formula && "string" == typeof t.value) {
1510
+ const e = Number(t.value);
1511
+ t.value = Number.isFinite(e) ? e : 0;
1512
+ }
1513
+ a(t);
1514
+ })(e.target.value),
1515
+ sx: {
1516
+ flex: "1 1 40%",
1517
+ minWidth: 0,
1518
+ backgroundColor: "background.paper"
1519
+ },
1520
+ children: l.map((e) => ct(It, {
1521
+ value: e,
1522
+ children: p(Go[e])
1523
+ }, e))
1524
+ }),
1525
+ x ? ct(r, {
1526
+ size: "small",
1527
+ value: `${n.value ?? ""}`,
1528
+ onChangeText: (e) => {
1529
+ a({
1530
+ ...n,
1531
+ value: e
1532
+ });
1533
+ },
1534
+ placeholder: p("conditionalFormat.enterFormula"),
1535
+ disabled: f,
1536
+ equals: "bare",
1537
+ pickAs: "absolute",
1538
+ label: null,
1539
+ showError: !1,
1540
+ helperText: null,
1541
+ sx: {
1542
+ flex: "1 1 30%",
1543
+ minWidth: 0,
1544
+ "& .MuiInputBase-root": { backgroundColor: f ? "action.disabledBackground" : "background.paper" }
1545
+ }
1546
+ }) : ct(zt, {
1547
+ size: "small",
1548
+ type: "number",
1549
+ placeholder: b ? void 0 : p("conditionalFormat.stopFromData"),
1550
+ value: b ? `${n.value ?? ""}` : "",
1551
+ disabled: f,
1552
+ onChange: (e) => {
1553
+ const t = e.target.value;
1554
+ a({
1555
+ ...n,
1556
+ value: "" === t ? 0 : Number(t)
1557
+ });
1558
+ },
1559
+ sx: {
1560
+ flex: "1 1 30%",
1561
+ minWidth: 0,
1562
+ cursor: f ? "not-allowed" : void 0
1563
+ },
1564
+ slotProps: { input: { sx: {
1565
+ backgroundColor: f ? "action.disabledBackground" : "background.paper",
1566
+ cursor: f ? "not-allowed" : void 0
1567
+ } } }
1568
+ })
1569
+ ]
1570
+ });
1571
+ });
1572
+ Yo.displayName = "ScaleStopRow";
1573
+ var Xo = [
1574
+ A.ColorStopType.Min,
1575
+ A.ColorStopType.Max,
1576
+ A.ColorStopType.Num,
1577
+ A.ColorStopType.Percent,
1578
+ A.ColorStopType.Percentile,
1579
+ A.ColorStopType.Formula
1580
+ ], Jo = Ke((e) => {
1581
+ const { scale: t, onScaleChange: o, readOnly: n, ...r } = e, a = We(), { workbook: l, toColor: i } = g(), s = t.stops ?? [], c = 2 === s.length ? [eo("conditionalFormat.stop.minimum"), eo("conditionalFormat.stop.maximum")] : [
1582
+ eo("conditionalFormat.stop.minimum"),
1583
+ eo("conditionalFormat.stop.midpoint"),
1584
+ eo("conditionalFormat.stop.maximum")
1585
+ ];
1586
+ return pt(ht, {
1587
+ sx: {
1588
+ display: "flex",
1589
+ flexDirection: "column",
1590
+ gap: 1
1591
+ },
1592
+ ...r,
1593
+ children: [ct(Vo, { children: pt(ht, {
1594
+ sx: {
1595
+ display: "flex",
1596
+ alignItems: "flex-start",
1597
+ gap: 1
1598
+ },
1599
+ children: [ct(ht, {
1600
+ sx: {
1601
+ flex: "1 1 auto",
1602
+ minWidth: 0,
1603
+ display: "flex",
1604
+ gap: .5,
1605
+ flexWrap: "wrap"
1606
+ },
1607
+ children: j.filter((e) => e.stops.length === (2 === s.length ? 2 : 3)).map((e, t) => ct(x, {
1608
+ sheet: !0,
1609
+ disabled: n,
1610
+ onClick: () => o(structuredClone(e)),
1611
+ children: ct(p, { rows: u(e.stops ?? [], d, l) })
1612
+ }, t))
1613
+ }), pt(Vt, {
1614
+ exclusive: !0,
1615
+ size: "small",
1616
+ value: 2 === s.length ? 2 : 3,
1617
+ disabled: n,
1618
+ onChange: (e, n) => {
1619
+ n && ((e) => {
1620
+ if (e === s.length || 2 !== e && 3 !== e) return;
1621
+ const n = s.slice();
1622
+ if (3 === e) {
1623
+ let e = "#FFEB84";
1624
+ const t = i(s[0]?.color ?? e)?.toRGBA(), o = i(s[s.length - 1]?.color ?? e)?.toRGBA();
1625
+ if (t && o) {
1626
+ const n = (e) => Math.round(e).toString(16).padStart(2, "0").toUpperCase();
1627
+ e = `#${n((t.red + o.red) / 2)}${n((t.green + o.green) / 2)}${n((t.blue + o.blue) / 2)}`;
1628
+ }
1629
+ n.splice(1, 0, {
1630
+ type: A.ColorStopType.Percentile,
1631
+ value: 50,
1632
+ color: e
1633
+ });
1634
+ } else n.splice(1, n.length - 2);
1635
+ o({
1636
+ ...t,
1637
+ stops: n
1638
+ });
1639
+ })(n);
1640
+ },
1641
+ sx: { flex: "0 0 auto" },
1642
+ children: [ct(Kt, {
1643
+ value: 2,
1644
+ sx: {
1645
+ textTransform: "none",
1646
+ pt: .25,
1647
+ pb: .25
1648
+ },
1649
+ children: a("conditionalFormat.twoColor")
1650
+ }), ct(Kt, {
1651
+ value: 3,
1652
+ sx: {
1653
+ textTransform: "none",
1654
+ pt: .25,
1655
+ pb: .25
1656
+ },
1657
+ children: a("conditionalFormat.threeColor")
1658
+ })]
1659
+ })]
1660
+ }) }), ct(Vo, {
1661
+ variant: "config",
1662
+ children: s.map((e, r) => ct(Yo, {
1663
+ label: a(c[Math.min(r, c.length - 1)]),
1664
+ stop: e,
1665
+ allowedTypes: Xo,
1666
+ showColor: !0,
1667
+ readOnly: n,
1668
+ onStopChange: (e) => {
1669
+ const n = s.slice();
1670
+ n[r] = e, o({
1671
+ ...t,
1672
+ stops: n
1673
+ });
1674
+ }
1675
+ }, r))
1676
+ })]
1677
+ });
1678
+ });
1679
+ Jo.displayName = "ColorScaleRulePanel";
1680
+ var Zo = [
1681
+ A.ColorStopType.AutoMin,
1682
+ A.ColorStopType.Min,
1683
+ A.ColorStopType.Num,
1684
+ A.ColorStopType.Percent,
1685
+ A.ColorStopType.Percentile,
1686
+ A.ColorStopType.Formula
1687
+ ], en = [
1688
+ A.ColorStopType.AutoMax,
1689
+ A.ColorStopType.Max,
1690
+ A.ColorStopType.Num,
1691
+ A.ColorStopType.Percent,
1692
+ A.ColorStopType.Percentile,
1693
+ A.ColorStopType.Formula
1694
+ ], tn = "__auto__", on = Ke((e) => {
1695
+ const { scale: t, onScaleChange: n, readOnly: r, ...a } = e, l = We(), { darkMode: i, toColor: s, propsColorPanel: d } = g(), c = t.stops ?? [], u = s(t.color), m = s(t.negativeFillColor), h = s(t.borderColor), y = s(t.negativeBorderColor), b = t.gradient ?? !1, f = (e) => {
1696
+ const o = { ...t };
1697
+ for (const [t, n] of Object.entries(e)) void 0 === n ? delete o[t] : o[t] = n;
1698
+ n(o);
1699
+ }, k = { backgroundColor: "background.paper" };
1700
+ return pt(ht, {
1701
+ sx: {
1702
+ display: "flex",
1703
+ flexDirection: "column",
1704
+ gap: 1
1705
+ },
1706
+ ...a,
1707
+ children: [pt(Vo, { children: [
1708
+ pt(ht, {
1709
+ sx: {
1710
+ display: "flex",
1711
+ alignItems: "flex-start",
1712
+ gap: 1
1713
+ },
1714
+ children: [ct(ht, {
1715
+ sx: {
1716
+ flex: "1 1 auto",
1717
+ minWidth: 0,
1718
+ display: "flex",
1719
+ gap: .5,
1720
+ flexWrap: "wrap"
1721
+ },
1722
+ children: V.filter((e) => (e.gradient ?? !1) === b).map((e, t) => ct(x, {
1723
+ sheet: !0,
1724
+ disabled: r,
1725
+ onClick: () => f({
1726
+ color: e.color,
1727
+ gradient: e.gradient,
1728
+ borderColor: e.borderColor
1729
+ }),
1730
+ children: ct(p, { rows: v(e, s(e.color)?.toCSS("adaptive") ?? "var(--sxl-color-primary, rgb(33, 115, 70))") })
1731
+ }, t))
1732
+ }), pt(Vt, {
1733
+ exclusive: !0,
1734
+ size: "small",
1735
+ value: b,
1736
+ disabled: r,
1737
+ onChange: (e, t) => {
1738
+ null !== t && f({ gradient: !!t || void 0 });
1739
+ },
1740
+ sx: { flex: "0 0 auto" },
1741
+ children: [ct(Kt, {
1742
+ value: !1,
1743
+ sx: {
1744
+ textTransform: "none",
1745
+ pt: .25,
1746
+ pb: .25
1747
+ },
1748
+ children: l("conditionalFormat.solidFill")
1749
+ }), ct(Kt, {
1750
+ value: !0,
1751
+ sx: {
1752
+ textTransform: "none",
1753
+ pt: .25,
1754
+ pb: .25
1755
+ },
1756
+ children: l("conditionalFormat.gradientFill")
1757
+ })]
1758
+ })]
1759
+ }),
1760
+ ct(Pt, {
1761
+ control: ct(xt, {
1762
+ size: "small",
1763
+ checked: !1 === t.showValue,
1764
+ disabled: r,
1765
+ onChange: (e) => f({ showValue: !e.target.checked && void 0 })
1766
+ }),
1767
+ label: ct($t, {
1768
+ variant: "body2",
1769
+ children: l("conditionalFormat.showBarsOnly")
1770
+ })
1771
+ }),
1772
+ pt(ht, {
1773
+ sx: {
1774
+ display: "flex",
1775
+ alignItems: "center",
1776
+ gap: .5
1777
+ },
1778
+ children: [
1779
+ ct($t, {
1780
+ variant: "caption",
1781
+ sx: {
1782
+ color: "text.secondary",
1783
+ flex: "0 0 62px"
1784
+ },
1785
+ children: l("conditionalFormat.bar")
1786
+ }),
1787
+ ct(o, {
1788
+ icon: "fill.colored",
1789
+ tooltip: l("conditionalFormat.barColor"),
1790
+ selectedColor: u,
1791
+ disabled: r,
1792
+ onSelectColor: (e) => f({ color: e ? e.toString() : void 0 }),
1793
+ darkMode: i,
1794
+ propsPanel: {
1795
+ disableAlpha: !0,
1796
+ ...d
1797
+ }
1798
+ }),
1799
+ ct(o, {
1800
+ icon: "stroke.colored",
1801
+ tooltip: l("conditionalFormat.barBorderColor"),
1802
+ selectedColor: h,
1803
+ disabled: r,
1804
+ onSelectColor: (e) => f({ borderColor: e ? e.toString() : void 0 }),
1805
+ darkMode: i,
1806
+ propsPanel: {
1807
+ disableAlpha: !0,
1808
+ ...d
1809
+ }
1810
+ })
1811
+ ]
1812
+ }),
1813
+ pt(ht, {
1814
+ sx: {
1815
+ display: "flex",
1816
+ alignItems: "center",
1817
+ gap: .5
1818
+ },
1819
+ children: [
1820
+ ct($t, {
1821
+ variant: "caption",
1822
+ sx: {
1823
+ color: "text.secondary",
1824
+ flex: "0 0 62px"
1825
+ },
1826
+ children: l("conditionalFormat.negative")
1827
+ }),
1828
+ ct(o, {
1829
+ icon: "fill.colored",
1830
+ tooltip: l("conditionalFormat.negativeColor"),
1831
+ selectedColor: m ?? u,
1832
+ disabled: r,
1833
+ onSelectColor: (e) => f({ negativeFillColor: e ? e.toString() : void 0 }),
1834
+ darkMode: i,
1835
+ propsPanel: {
1836
+ disableAlpha: !0,
1837
+ ...d
1838
+ }
1839
+ }),
1840
+ ct(o, {
1841
+ icon: "stroke.colored",
1842
+ tooltip: l("conditionalFormat.negativeBorderColor"),
1843
+ selectedColor: y ?? h,
1844
+ disabled: r,
1845
+ onSelectColor: (e) => f({ negativeBorderColor: e ? e.toString() : void 0 }),
1846
+ darkMode: i,
1847
+ propsPanel: {
1848
+ disableAlpha: !0,
1849
+ ...d
1850
+ }
1851
+ }),
1852
+ ct(x, {
1853
+ title: l("conditionalFormat.sameAsPositive"),
1854
+ disabled: r || !t.negativeFillColor && !t.negativeBorderColor,
1855
+ onClick: () => f({
1856
+ negativeFillColor: void 0,
1857
+ negativeBorderColor: void 0
1858
+ }),
1859
+ sx: {
1860
+ color: "text.secondary",
1861
+ "&:disabled": { opacity: .4 }
1862
+ },
1863
+ children: ct(fe, {
1864
+ iconKey: "ClearFormats",
1865
+ size: 16
1866
+ })
1867
+ })
1868
+ ]
1869
+ }),
1870
+ pt(ht, {
1871
+ sx: {
1872
+ display: "flex",
1873
+ gap: 1,
1874
+ mt: .5
1875
+ },
1876
+ children: [pt(Tt, {
1877
+ size: "small",
1878
+ sx: {
1879
+ flex: 1,
1880
+ minWidth: 0
1881
+ },
1882
+ children: [ct(Nt, { children: l("conditionalFormat.axis") }), pt(At, {
1883
+ label: l("conditionalFormat.axis"),
1884
+ value: t.axisPosition ?? tn,
1885
+ disabled: r,
1886
+ sx: k,
1887
+ onChange: (e) => {
1888
+ const t = e.target.value;
1889
+ f({ axisPosition: t === tn ? void 0 : t });
1890
+ },
1891
+ children: [
1892
+ ct(It, {
1893
+ value: tn,
1894
+ children: l("conditionalFormat.automatic")
1895
+ }),
1896
+ ct(It, {
1897
+ value: "middle",
1898
+ children: l("conditionalFormat.axisMiddle")
1899
+ }),
1900
+ ct(It, {
1901
+ value: "none",
1902
+ children: l("conditionalFormat.axisNone")
1903
+ })
1904
+ ]
1905
+ })]
1906
+ }), pt(Tt, {
1907
+ size: "small",
1908
+ sx: {
1909
+ flex: 1,
1910
+ minWidth: 0
1911
+ },
1912
+ children: [ct(Nt, { children: l("conditionalFormat.direction") }), pt(At, {
1913
+ label: l("conditionalFormat.direction"),
1914
+ value: t.direction ?? tn,
1915
+ disabled: r,
1916
+ sx: k,
1917
+ onChange: (e) => {
1918
+ const t = e.target.value;
1919
+ f({ direction: t === tn ? void 0 : t });
1920
+ },
1921
+ children: [
1922
+ ct(It, {
1923
+ value: tn,
1924
+ children: l("conditionalFormat.automatic")
1925
+ }),
1926
+ ct(It, {
1927
+ value: "leftToRight",
1928
+ children: l("conditionalFormat.leftToRight")
1929
+ }),
1930
+ ct(It, {
1931
+ value: "rightToLeft",
1932
+ children: l("conditionalFormat.rightToLeft")
1933
+ })
1934
+ ]
1935
+ })]
1936
+ })]
1937
+ })
1938
+ ] }), pt(Vo, {
1939
+ variant: "config",
1940
+ children: [ct(Yo, {
1941
+ label: l("conditionalFormat.stop.minimum"),
1942
+ stop: c[0] ?? { type: A.ColorStopType.AutoMin },
1943
+ allowedTypes: Zo,
1944
+ readOnly: r,
1945
+ onStopChange: (e) => {
1946
+ const t = c.slice();
1947
+ t[0] = e, f({ stops: t });
1948
+ }
1949
+ }), ct(Yo, {
1950
+ label: l("conditionalFormat.stop.maximum"),
1951
+ stop: c[1] ?? { type: A.ColorStopType.AutoMax },
1952
+ allowedTypes: en,
1953
+ readOnly: r,
1954
+ onStopChange: (e) => {
1955
+ const t = c.slice();
1956
+ for (; t.length < 2;) t.push({ type: A.ColorStopType.AutoMax });
1957
+ t[1] = e, f({ stops: t });
1958
+ }
1959
+ })]
1960
+ })]
1961
+ });
1962
+ });
1963
+ on.displayName = "DataBarRulePanel";
1964
+ var nn = {
1965
+ directional: eo("conditionalFormat.iconGroup.directional"),
1966
+ shapes: eo("conditionalFormat.iconGroup.shapes"),
1967
+ indicators: eo("conditionalFormat.iconGroup.indicators"),
1968
+ ratings: eo("conditionalFormat.iconGroup.ratings")
1969
+ }, rn = [
1970
+ A.ColorStopType.Percent,
1971
+ A.ColorStopType.Num,
1972
+ A.ColorStopType.Percentile,
1973
+ A.ColorStopType.Formula
1974
+ ], an = new Set(Object.values(L.IconSet)), ln = Ke(({ set: e }) => {
1975
+ const t = ae(e);
1976
+ return 0 === t.length ? null : ct(ht, {
1977
+ sx: {
1978
+ display: "flex",
1979
+ alignItems: "center",
1980
+ gap: .75,
1981
+ lineHeight: 1
1982
+ },
1983
+ children: t.map((e, t) => ct(fe, {
1984
+ iconKey: e.iconKey,
1985
+ size: 16,
1986
+ style: {
1987
+ color: e.color,
1988
+ flex: "0 0 auto"
1989
+ }
1990
+ }, t))
1991
+ });
1992
+ });
1993
+ ln.displayName = "IconSetGlyphs";
1994
+ var sn = Ke((e) => {
1995
+ const { scale: t, onScaleChange: o, readOnly: n, ...r } = e, a = We(), l = t.iconSet ?? L.IconSet.TrafficLights3, i = !an.has(l), s = t.stops ?? [], d = (e) => {
1996
+ const n = { ...t };
1997
+ for (const [t, o] of Object.entries(e)) void 0 === o ? delete n[t] : n[t] = o;
1998
+ o(n);
1999
+ }, c = Ue(() => {
2000
+ const e = [];
2001
+ i && e.push(ct(It, {
2002
+ value: l,
2003
+ disabled: !0,
2004
+ children: O.camelToPrettyCase(l)
2005
+ }, l));
2006
+ for (const t of _) {
2007
+ e.push(ct(Ot, {
2008
+ disableSticky: !0,
2009
+ sx: So,
2010
+ children: a(nn[t.key])
2011
+ }, `__header:${t.key}`));
2012
+ for (const o of t.sets) {
2013
+ const t = O.camelToPrettyCase(o);
2014
+ e.push(ct(It, {
2015
+ value: o,
2016
+ "aria-label": t,
2017
+ sx: {
2018
+ pl: 2,
2019
+ py: .75
2020
+ },
2021
+ children: ct(ot, {
2022
+ disableInteractive: !0,
2023
+ placement: "right",
2024
+ title: t,
2025
+ children: ct(ht, {
2026
+ sx: {
2027
+ display: "flex",
2028
+ alignItems: "center",
2029
+ width: "100%"
2030
+ },
2031
+ children: ct(ln, { set: o })
2032
+ })
2033
+ })
2034
+ }, o));
2035
+ }
2036
+ }
2037
+ return e;
2038
+ }, [
2039
+ a,
2040
+ i,
2041
+ l
2042
+ ]);
2043
+ return pt(ht, {
2044
+ sx: {
2045
+ display: "flex",
2046
+ flexDirection: "column",
2047
+ gap: 1
2048
+ },
2049
+ ...r,
2050
+ children: [pt(Vo, { children: [
2051
+ pt(Tt, {
2052
+ size: "small",
2053
+ fullWidth: !0,
2054
+ children: [ct(Nt, { children: a("conditionalFormat.iconSet") }), ct(At, {
2055
+ label: a("conditionalFormat.iconSet"),
2056
+ value: l,
2057
+ renderValue: (e) => ct(ht, {
2058
+ sx: {
2059
+ display: "flex",
2060
+ alignItems: "center",
2061
+ minHeight: "1.4375em"
2062
+ },
2063
+ children: 0 === ae(e).length ? O.camelToPrettyCase(e) : ct(ln, { set: e })
2064
+ }),
2065
+ disabled: n || i,
2066
+ sx: { backgroundColor: "background.paper" },
2067
+ onChange: (e) => ((e) => {
2068
+ const t = le(e);
2069
+ let o = s;
2070
+ t !== s.length && (o = re(t)), d({
2071
+ iconSet: e,
2072
+ stops: o
2073
+ });
2074
+ })(e.target.value),
2075
+ children: c
2076
+ })]
2077
+ }),
2078
+ i && ct($t, {
2079
+ variant: "caption",
2080
+ sx: { color: "text.secondary" },
2081
+ children: a("conditionalFormat.adoptedIconSet")
2082
+ }),
2083
+ pt(ht, {
2084
+ sx: {
2085
+ display: "flex",
2086
+ gap: 1
2087
+ },
2088
+ children: [ct(Pt, {
2089
+ control: ct(xt, {
2090
+ size: "small",
2091
+ checked: !1 === t.showValue,
2092
+ disabled: n,
2093
+ onChange: (e) => d({ showValue: !e.target.checked && void 0 })
2094
+ }),
2095
+ label: ct($t, {
2096
+ variant: "body2",
2097
+ children: a("conditionalFormat.showIconsOnly")
2098
+ })
2099
+ }), ct(Pt, {
2100
+ control: ct(xt, {
2101
+ size: "small",
2102
+ checked: t.reverse ?? !1,
2103
+ disabled: n,
2104
+ onChange: (e) => d({ reverse: !!e.target.checked || void 0 })
2105
+ }),
2106
+ label: ct($t, {
2107
+ variant: "body2",
2108
+ children: a("conditionalFormat.reverseIcons")
2109
+ })
2110
+ })]
2111
+ })
2112
+ ] }), ct(Vo, {
2113
+ variant: "config",
2114
+ children: s.map((e, t) => ct(Yo, {
2115
+ label: a("conditionalFormat.iconN", { n: t + 1 }),
2116
+ stop: e,
2117
+ allowedTypes: rn,
2118
+ showExclusive: !0,
2119
+ readOnly: n || 0 === t,
2120
+ onStopChange: (e) => {
2121
+ const o = s.slice();
2122
+ o[t] = e, d({ stops: o });
2123
+ }
2124
+ }, t))
2125
+ })]
2126
+ });
2127
+ });
2128
+ sn.displayName = "IconSetRulePanel";
2129
+ var dn = (e, t, o) => b(e, t)?.toCSS("adaptive") ?? o, cn = (e, t, o) => {
2130
+ if (!e) return o;
2131
+ if ("string" == typeof e) return dn(e, t, o);
2132
+ if (e.type === W.Type.None) return o;
2133
+ const n = e, r = e;
2134
+ return dn(r.foreground ?? n.color ?? r.background, t, o);
2135
+ }, pn = Ke((e) => {
2136
+ const { conditionalFormat: t, size: o = 28, ...n } = e, { workbook: r, themeKey: a } = g();
2137
+ se(t, "onAnyChange");
2138
+ const l = t.getScale(), i = t.getStyle(), s = Ue(() => {
2139
+ try {
2140
+ return r?.getStyles().getNormal().getFont().toCSS("adaptive") ?? {};
2141
+ } catch {
2142
+ return {};
2143
+ }
2144
+ }, [r, a]), c = Ue(() => {
2145
+ if (l?.type === A.ScaleType.ColorScale) return ct(p, { rows: u(l.stops ?? [], d, r) });
2146
+ if (l?.type === A.ScaleType.DataBar) return ct(p, { rows: v(l, dn(l.color, r, T), l.borderColor ? dn(l.borderColor, r, T) : void 0) });
2147
+ if (l?.type === A.ScaleType.IconSet) {
2148
+ const e = l.stops?.length ?? 3, t = [
2149
+ "#D6604D",
2150
+ "#F5A623",
2151
+ "#57A45B",
2152
+ "#4472C4",
2153
+ "#7F7F7F"
2154
+ ], o = [];
2155
+ for (let n = 0; n < e; n++) o.push(ct(ht, { sx: {
2156
+ width: "12px",
2157
+ height: "12px",
2158
+ borderRadius: "50%",
2159
+ backgroundColor: t[n % t.length]
2160
+ } }, n));
2161
+ return l.reverse && o.reverse(), ct(ht, {
2162
+ sx: {
2163
+ display: "flex",
2164
+ alignItems: "center",
2165
+ justifyContent: "center",
2166
+ gap: "3px",
2167
+ width: "100%",
2168
+ height: "100%"
2169
+ },
2170
+ children: o
2171
+ });
2172
+ }
2173
+ const e = i?.font, t = e?.underline && e.underline !== B.UnderlineStyle.None;
2174
+ return ct(ht, {
2175
+ sx: {
2176
+ width: "100%",
2177
+ height: "100%",
2178
+ display: "flex",
2179
+ alignItems: "center",
2180
+ justifyContent: "center",
2181
+ ...s,
2182
+ backgroundColor: cn(i?.fill, r, "transparent"),
2183
+ ...e?.color && "auto" !== e.color ? { color: dn(e.color, r, D) } : null,
2184
+ ...e?.weight ? { fontWeight: e.weight } : null,
2185
+ ...e?.style ? { fontStyle: e.style } : null,
2186
+ textDecoration: [t ? "underline" : "", e?.strike ? "line-through" : ""].join(" ").trim() || "none",
2187
+ fontSize: `${Math.round(.5 * o)}px`,
2188
+ lineHeight: 1,
2189
+ outline: i?.border ? `1px solid ${dn(Object.values(i.border)[0]?.color, r, y)}` : void 0,
2190
+ outlineOffset: "-3px"
2191
+ },
2192
+ children: "Aa"
2193
+ });
2194
+ }, [
2195
+ l,
2196
+ i,
2197
+ o,
2198
+ s,
2199
+ r,
2200
+ a
2201
+ ]);
2202
+ return ct(x, {
2203
+ sheet: !0,
2204
+ className: "sxl-cf-rule-preview",
2205
+ sx: {
2206
+ width: "auto",
2207
+ minWidth: 1.7 * o + "px",
2208
+ height: `${o}px`
2209
+ },
2210
+ ...n,
2211
+ children: c
2212
+ });
2213
+ });
2214
+ pn.displayName = "RulePreview";
2215
+ var un = Ke((e) => {
2216
+ const { conditionalFormat: t, label: o, helperText: n } = e, a = We(), l = Me();
2217
+ se(t, ["onAnchorCoordsChange", "onAnyChange"]);
2218
+ const i = t.getRanges();
2219
+ return ct(r, {
2220
+ grammar: "reference",
2221
+ value: i,
2222
+ allowMulti: !0,
2223
+ allowCrossSheet: !1,
2224
+ home: Ue(() => {
2225
+ if (i.isInvalid()) return;
2226
+ const e = i.at(0).getCoords();
2227
+ return {
2228
+ rowIndex: e.rowStart,
2229
+ colIndex: e.colStart,
2230
+ scope: i.at(0).getSheet().getName()
2231
+ };
2232
+ }, [i]),
2233
+ pickAs: "absolute",
2234
+ changeOn: "done",
2235
+ onDone: Ve((e) => {
2236
+ const o = e?.getReferences();
2237
+ if (o && !o.isInvalid()) try {
2238
+ t.setRanges(o);
2239
+ } catch (e) {
2240
+ l.showMessage?.(e.message, { type: ke.Error });
2241
+ }
2242
+ }, [t, l]),
2243
+ label: void 0 === o ? a("conditionalFormat.applyTo") : o,
2244
+ helperText: n,
2245
+ disabled: t.isProtected()
2246
+ });
2247
+ });
2248
+ un.displayName = "ConditionalFormatRangeField";
2249
+ var mn = (e, t) => {
2250
+ const o = e.getCondition()?.toString();
2251
+ if (o) return o;
2252
+ const n = e.getScale();
2253
+ return n ? O.camelToPrettyCase(n.type) : t("conditionalFormat.noCondition");
2254
+ }, gn = {
2255
+ classic: eo("conditionalFormat.tab.classic"),
2256
+ [A.ScaleType.ColorScale]: eo("conditionalFormat.tab.colorScale"),
2257
+ [A.ScaleType.DataBar]: eo("conditionalFormat.tab.dataBars"),
2258
+ [A.ScaleType.IconSet]: eo("conditionalFormat.tab.iconSets")
2259
+ }, hn = Ke((e) => {
2260
+ const { conditionalFormat: t } = e, o = We();
2261
+ se(t, "onAnyChange");
2262
+ const n = t.getScale(), r = t.getCondition(), a = t.getStyle(), l = t.isProtected(), i = n?.type ?? "classic", d = qe({ scales: {} }), c = (e) => {
2263
+ t.update({ scale: e });
2264
+ };
2265
+ return pt(Rt, {
2266
+ tabIndex: 0,
2267
+ className: s["editor-panel"],
2268
+ sx: {
2269
+ gap: (e) => e.spacing(1),
2270
+ paddingTop: (e) => e.spacing(1.25),
2271
+ paddingBottom: (e) => e.spacing(2),
2272
+ paddingLeft: (e) => e.spacing(1.5),
2273
+ paddingRight: (e) => e.spacing(1.5),
2274
+ border: (e) => `1px solid ${e.palette.divider}`,
2275
+ borderRadius: (e) => e.spacing(1.25),
2276
+ overflow: "auto"
2277
+ },
2278
+ children: [
2279
+ pt(ht, {
2280
+ sx: {
2281
+ display: "flex",
2282
+ flexDirection: "column",
2283
+ gap: (e) => e.spacing(1.75),
2284
+ margin: (e) => e.spacing(1.25),
2285
+ marginBottom: 0
2286
+ },
2287
+ children: [pt(ht, {
2288
+ sx: {
2289
+ display: "flex",
2290
+ alignItems: "center",
2291
+ gap: (e) => e.spacing(1.5)
2292
+ },
2293
+ children: [ct(pn, {
2294
+ conditionalFormat: t,
2295
+ size: 48
2296
+ }), ct($t, {
2297
+ variant: "body2",
2298
+ sx: {
2299
+ minWidth: 0,
2300
+ wordBreak: "break-word"
2301
+ },
2302
+ children: mn(t, o)
2303
+ })]
2304
+ }), ct(un, { conditionalFormat: t })]
2305
+ }),
2306
+ ct(Lt, {
2307
+ value: i,
2308
+ onChange: (e, o) => {
2309
+ l || ((e) => {
2310
+ if (e !== i) if ("classic" === i ? (d.current.condition = r?.toJSON() ?? null, d.current.style = a) : n && (d.current.scales[n.type] = n), "classic" === e) t.update({
2311
+ condition: d.current.condition ?? {
2312
+ operator: R.BuiltInOperatorNames.Between,
2313
+ param: null
2314
+ },
2315
+ style: d.current.style ?? null,
2316
+ scale: null
2317
+ });
2318
+ else {
2319
+ const o = d.current.scales[e] ?? (e === A.ScaleType.ColorScale ? te() : e === A.ScaleType.DataBar ? oe() : ne());
2320
+ t.update({
2321
+ scale: o,
2322
+ condition: null,
2323
+ style: null
2324
+ });
2325
+ }
2326
+ })(o);
2327
+ },
2328
+ variant: "fullWidth",
2329
+ sx: {
2330
+ minHeight: "36px",
2331
+ borderBottom: 1,
2332
+ borderColor: "divider",
2333
+ "& .MuiTab-root": {
2334
+ minHeight: "36px",
2335
+ textTransform: "none",
2336
+ pt: .5,
2337
+ pb: .5,
2338
+ px: .5,
2339
+ minWidth: 0
2340
+ }
2341
+ },
2342
+ children: Object.keys(gn).map((e) => ct(Bt, {
2343
+ value: e,
2344
+ label: o(gn[e])
2345
+ }, e))
2346
+ }),
2347
+ "classic" === i && pt(dt, { children: [ct(Ho, {
2348
+ format: a,
2349
+ readOnly: l,
2350
+ onFormatChange: (e) => t.update({ style: e })
2351
+ }), ct(Ko, {
2352
+ selectorTitle: o("conditionalFormat.highlight"),
2353
+ condition: r,
2354
+ readOnly: l,
2355
+ onConditionChange: (e) => t.setCondition(e)
2356
+ })] }),
2357
+ n?.type === A.ScaleType.ColorScale && ct(Jo, {
2358
+ scale: n,
2359
+ onScaleChange: c,
2360
+ readOnly: l
2361
+ }),
2362
+ n?.type === A.ScaleType.DataBar && ct(on, {
2363
+ scale: n,
2364
+ onScaleChange: c,
2365
+ readOnly: l
2366
+ }),
2367
+ n?.type === A.ScaleType.IconSet && ct(sn, {
2368
+ scale: n,
2369
+ onScaleChange: c,
2370
+ readOnly: l
2371
+ }),
2372
+ "classic" === i && ct(ht, {
2373
+ sx: {
2374
+ pl: 2,
2375
+ pr: 2,
2376
+ border: 1,
2377
+ borderColor: "divider",
2378
+ borderRadius: 1
2379
+ },
2380
+ children: ct(Pt, {
2381
+ control: ct(xt, {
2382
+ checked: t.isStopIfTrue(),
2383
+ disabled: l,
2384
+ onChange: (e) => t.setStopIfTrue(e.target.checked)
2385
+ }),
2386
+ label: o("conditionalFormat.stopIfTrue")
2387
+ })
2388
+ })
2389
+ ]
2390
+ });
2391
+ });
2392
+ hn.displayName = "ConditionalFormatEditorPanel";
2393
+ var yn = Ke(({ item: e }) => {
2394
+ const t = We();
2395
+ return se(e, "onAnyChange"), !e.isStopIfTrue() || e.getScale() ? null : ct(ht, {
2396
+ sx: {
2397
+ display: "inline-flex",
2398
+ alignItems: "center",
2399
+ alignSelf: "flex-start",
2400
+ px: .75,
2401
+ py: .25,
2402
+ border: 1,
2403
+ borderColor: "divider",
2404
+ borderRadius: 1,
2405
+ color: "text.secondary"
2406
+ },
2407
+ children: ct($t, {
2408
+ variant: "caption",
2409
+ children: t("conditionalFormat.stopIfTrue")
2410
+ })
2411
+ });
2412
+ });
2413
+ yn.displayName = "StopIfTrueBadge";
2414
+ var bn = {
2415
+ key: "conditional-format",
2416
+ messageKeys: {
2417
+ none: eo("conditionalFormat.none"),
2418
+ addPrompt: eo("conditionalFormat.addPrompt"),
2419
+ heading: eo("conditionalFormat.heading"),
2420
+ insert: eo("conditionalFormat.insert"),
2421
+ new: eo("conditionalFormat.new"),
2422
+ moveUp: eo("conditionalFormat.moveUp"),
2423
+ moveDown: eo("conditionalFormat.moveDown"),
2424
+ edit: eo("conditionalFormat.edit"),
2425
+ duplicate: eo("conditionalFormat.duplicate"),
2426
+ delete: eo("conditionalFormat.delete"),
2427
+ cancel: eo("conditionalFormat.cancel"),
2428
+ save: eo("conditionalFormat.save")
2429
+ },
2430
+ getCollection: (e) => e.getConditionalFormats(),
2431
+ changeEvents: ["onConditionalFormatsChange"],
2432
+ applyUpdate: (e, t) => {
2433
+ const o = t.toJSON() ?? {};
2434
+ e.update({
2435
+ condition: o.condition ?? null,
2436
+ style: o.style ?? null,
2437
+ scale: o.scale ?? null,
2438
+ stopIfTrue: o.stopIfTrue ?? !1
2439
+ });
2440
+ const n = t.getRanges();
2441
+ n.isInvalid() || n.toString() === e.getRanges().toString() || e.setRanges(n);
2442
+ },
2443
+ applySeed: (e, t) => {
2444
+ e.update({
2445
+ condition: t.condition ?? null,
2446
+ style: t.style ?? null,
2447
+ scale: t.scale ?? null,
2448
+ stopIfTrue: t.stopIfTrue ?? !1
2449
+ });
2450
+ },
2451
+ getCardTitle: mn,
2452
+ CardMedia: ({ item: e }) => ct(pn, {
2453
+ conditionalFormat: e,
2454
+ size: 32
2455
+ }),
2456
+ CardSubtitle: ({ item: e }) => ct(un, {
2457
+ conditionalFormat: e,
2458
+ helperText: null
2459
+ }),
2460
+ CardBody: yn,
2461
+ EditorBody: ({ item: e }) => ct(hn, { conditionalFormat: e })
2462
+ }, fn = Ke(Le((e, t) => {
2463
+ const { workbook: o, args: n, ...r } = e;
2464
+ return ct(so, {
2465
+ ref: t,
2466
+ workbook: o,
2467
+ descriptor: bn,
2468
+ args: n,
2469
+ dragReorder: !0,
2470
+ ...r
2471
+ });
2472
+ }));
2473
+ fn.displayName = "ConditionalFormatDetailsPanel";
2474
+ var xn = (e) => {
2475
+ const { model: t, entryKey: o, frame: n, args: r, ref: a, ...l } = e;
2476
+ return ct(fn, {
2477
+ ref: a,
2478
+ workbook: t,
2479
+ args: r,
2480
+ ...l
2481
+ });
2482
+ }, vn = {
2483
+ card: "_card_h0jnt_7",
2484
+ actionRoot: "_actionRoot_h0jnt_11",
2485
+ icons: "_icons_h0jnt_16",
2486
+ expand: "_expand_h0jnt_22",
2487
+ expandOpen: "_expandOpen_h0jnt_29",
2488
+ stackTraceContainer: "_stackTraceContainer_h0jnt_33",
2489
+ paper: "_paper_h0jnt_37",
2490
+ checkIcon: "_checkIcon_h0jnt_42",
2491
+ button: "_button_h0jnt_47"
2492
+ }, kn = Ke(Le((e, t) => {
2493
+ const { id: o, message: n, iconVariant: r, error: a, hideIconVariant: l, ...i } = e, s = We(), { closeSnackbar: d } = io(), [c, p] = He(!1), u = a ? Yt.collectErrorChain(a, !0)?.[0]?.error : void 0, m = u && !(u instanceof Xt), g = Ve(() => {
2494
+ p((e) => !e);
2495
+ }, []), h = Ve(() => {
2496
+ d(o);
2497
+ }, [o, d]);
2498
+ let y = u?.message;
2499
+ return !y && ze(n) && (y = n), y || "string" != typeof n || (y = n), y || (y = `Unknown Error: ${n}`), ct(ao, {
2500
+ ref: t,
2501
+ className: oo(vn.root, "error-snackbar"),
2502
+ children: pt(bt, {
2503
+ className: vn.card,
2504
+ style: {
2505
+ backgroundColor: "var(--sxl-color-error)",
2506
+ color: "var(--sxl-color-error-content)",
2507
+ border: "1px solid var(--sxl-color-error)"
2508
+ },
2509
+ children: [pt(ft, {
2510
+ className: vn.actionRoot,
2511
+ children: [
2512
+ l ? null : r?.error,
2513
+ ct($t, {
2514
+ variant: "body2",
2515
+ component: "div",
2516
+ className: vn.typography,
2517
+ children: y
2518
+ }),
2519
+ ct("div", { style: { flex: "1 1 auto" } }),
2520
+ pt("div", {
2521
+ className: vn.icons,
2522
+ children: [m ? ct(Ft, {
2523
+ "aria-label": s("toast.showMore"),
2524
+ size: "small",
2525
+ className: oo(vn.expand, { [vn.expandOpen]: c }),
2526
+ onClick: g,
2527
+ children: ct(fe, { iconKey: "ExpandMore" })
2528
+ }) : null, ct(Ft, {
2529
+ size: "small",
2530
+ className: vn.expand,
2531
+ onClick: h,
2532
+ children: ct(fe, {
2533
+ iconKey: "Close",
2534
+ style: { transform: "scale(0.8)" }
2535
+ })
2536
+ })]
2537
+ })
2538
+ ]
2539
+ }), m ? ct(kt, {
2540
+ in: c,
2541
+ timeout: "auto",
2542
+ children: ct("div", {
2543
+ className: vn.stackTraceContainer,
2544
+ style: {
2545
+ backgroundColor: "color-mix(in srgb, var(--sxl-color-error) 90%, var(--sxl-color-base-100))",
2546
+ borderTop: "1px solid var(--sxl-color-error)"
2547
+ },
2548
+ children: ct(nt, {
2549
+ error: a,
2550
+ hideLineNumbers: !0
2551
+ })
2552
+ })
2553
+ }) : null]
2554
+ })
2555
+ });
2556
+ }));
2557
+ kn.displayName = "ToastError";
2558
+ var Cn = ct(() => ct(et, {
2559
+ label: "SheetXL",
2560
+ description: We()("logo.description"),
2561
+ children: ct(ht, {
2562
+ component: "a",
2563
+ href: "https://www.sheetxl.com",
2564
+ target: "_blank",
2565
+ rel: "noopener noreferrer",
2566
+ sx: {
2567
+ display: "inline-flex",
2568
+ width: "24px",
2569
+ height: "24px",
2570
+ marginBottom: "4px",
2571
+ marginLeft: "6px",
2572
+ cursor: "pointer"
2573
+ },
2574
+ children: ct(U, { style: {
2575
+ width: "24px",
2576
+ height: "24px"
2577
+ } })
2578
+ })
2579
+ }), {}), wn = Ke(Le((e, t) => {
2580
+ const { workbook: o, className: n, logo: r = Cn, mainElement: a, startElement: l, endElement: i, ...s } = e, [d, { width: c }] = ro(), p = c < 530, u = qe(null);
2581
+ return ct(ht, {
2582
+ ...s,
2583
+ ref: no([
2584
+ u,
2585
+ d,
2586
+ t
2587
+ ]),
2588
+ className: n,
2589
+ children: S({
2590
+ isCompact: p,
2591
+ wrapperSelect: (e) => pt(ht, {
2592
+ sx: {
2593
+ display: "grid",
2594
+ gridTemplateColumns: "1fr auto 1fr",
2595
+ flex: "1",
2596
+ alignItems: "stretch",
2597
+ gap: (e) => e.spacing(1),
2598
+ paddingLeft: (e) => e.spacing(1),
2599
+ paddingRight: (e) => e.spacing(1)
2600
+ },
2601
+ children: [
2602
+ pt(ht, {
2603
+ sx: {
2604
+ display: "flex",
2605
+ flexDirection: "row",
2606
+ alignItems: "center",
2607
+ justifyContent: "start",
2608
+ gap: (e) => e.spacing(.5)
2609
+ },
2610
+ children: [r, pt(ht, {
2611
+ sx: {
2612
+ display: "flex",
2613
+ flexDirection: "row",
2614
+ alignItems: "center",
2615
+ gap: (e) => e.spacing(.25)
2616
+ },
2617
+ children: [l, e]
2618
+ })]
2619
+ }),
2620
+ ct(ht, {
2621
+ sx: {
2622
+ display: "flex",
2623
+ flexDirection: "row",
2624
+ minWidth: 0,
2625
+ overflow: "hidden",
2626
+ alignItems: "center",
2627
+ justifyContent: "center"
2628
+ },
2629
+ children: a
2630
+ }),
2631
+ ct(ht, {
2632
+ sx: {
2633
+ display: "flex",
2634
+ alignItems: "center",
2635
+ justifyContent: "end"
2636
+ },
2637
+ children: i
2638
+ })
2639
+ ]
2640
+ })
2641
+ })
2642
+ });
2643
+ }));
2644
+ wn.displayName = "StudioToolbar";
2645
+ function Sn(e, t) {
2646
+ const { workbook: o, setWorkbook: n, workbookTitle: r = "export", isDirty: a, notifier: l } = t;
2647
+ let i = !1;
2648
+ const s = async (e = null, t = null, o = null) => {
2649
+ const n = [], r = {
2650
+ source: e && "string" != typeof e ? e : null,
2651
+ typedCreateWorkbookOptions: t ?? void 0,
2652
+ onPassword: async ({ origin: e, validate: t }) => {
2653
+ const o = await l.showInput({
2654
+ title: to("dialog.password.title"),
2655
+ description: to("dialog.password.open.description", { name: e.getName() ?? "" }),
2656
+ inputType: "password",
2657
+ options: [{
2658
+ id: "Open",
2659
+ label: () => to("dialog.open")
2660
+ }, "Cancel"],
2661
+ defaultOption: "Open",
2662
+ onValidateInput: async (e, o) => void 0 === o ? { valid: !0 } : e ? await t(e) ? { valid: !0 } : {
2663
+ valid: !1,
2664
+ message: to("dialog.password.open.retry")
2665
+ } : {
2666
+ valid: !1,
2667
+ message: to("dialog.password.open.required")
2668
+ }
2669
+ });
2670
+ return "Open" === o?.option ? o.input ?? null : null;
2671
+ },
2672
+ progress: { onWarning: (e) => {
2673
+ n.push(e);
2674
+ } }
2675
+ };
2676
+ let a;
2677
+ o && (r.progress.onStart = o);
2678
+ let i = -5;
2679
+ return Y.read({
2680
+ ...r,
2681
+ progress: {
2682
+ async onStart(e, t) {
2683
+ await r?.progress?.onStart?.(e, t), a = await l?.showBusy?.(to("workbook.opening", { name: e?.getName() ?? "" })), t && a?.setProgress?.(0, t);
2684
+ },
2685
+ onProgress(e, t) {
2686
+ if (!t) return;
2687
+ const o = Math.min(100, Math.round(e / t * 100));
2688
+ if (o >= 100) {
2689
+ if (100 === i) return;
2690
+ i = 100, a?.setProgress?.(e, t);
2691
+ return;
2692
+ }
2693
+ o - i < 5 || (i = o, a?.setProgress?.(e, t));
2694
+ },
2695
+ onComplete() {
2696
+ a?.(), n.length > 0 && (l.showMessage(to("workbook.importWarnings")), console.warn("Import warnings:\n" + n.join("\n")));
2697
+ },
2698
+ onWarning(e) {
2699
+ l.showMessage(e, { type: ke.Info });
2700
+ }
2701
+ }
2702
+ });
2703
+ }, d = async (e, t, o = !1) => {
2704
+ let n;
2705
+ const a = {
2706
+ format: t?.key,
2707
+ progress: {
2708
+ async onStart(e) {
2709
+ n = await l?.showBusy?.(to("workbook.saving", { name: e?.getName() ?? "" }));
2710
+ },
2711
+ onComplete() {
2712
+ n?.();
2713
+ }
2714
+ }
2715
+ };
2716
+ let i;
2717
+ if (o) {
2718
+ const o = e.getOrigin(), n = t?.exts?.[0] ?? (o.getExtension() || "sxl"), l = `${r || o.getName() || to("workbook.defaultName")}.${n}`;
2719
+ i = await Y.writeAs(e, l, {
2720
+ ...a,
2721
+ prompt: !0
2722
+ });
2723
+ } else i = await Y.write(e, void 0, a);
2724
+ return !!i;
2725
+ };
2726
+ return e.updateCommand("newWorkbook", { callback: () => {
2727
+ window.open(window.origin.toString(), "sheetxl-" + Ht.uuidV4(), "popup=true");
2728
+ } }), e.updateCommand("closeWorkbook", { callback: async () => {
2729
+ a() && "Close" !== await l.showOptions({
2730
+ title: to("dialog.confirm.title"),
2731
+ description: to("dialog.unsavedChanges"),
2732
+ options: [{
2733
+ id: "Close",
2734
+ label: () => to("dialog.close")
2735
+ }, "Cancel"],
2736
+ defaultOption: "Cancel"
2737
+ }) || window.close();
2738
+ } }), (async () => {
2739
+ const t = await Y.getWriteFormats();
2740
+ if (i) return;
2741
+ const r = Y.canWrite(), c = Y.canRead();
2742
+ if (r) {
2743
+ const n = (e) => {
2744
+ const n = e ? t.find((t) => t.key === e) : void 0;
2745
+ d(o, n, !0).catch((e) => l.showError(e));
2746
+ };
2747
+ e.updateCommand("saveWorkbook", { callback: () => {
2748
+ d(o, void 0, !1).catch((e) => l.showError(e));
2749
+ } }), e.updateCommand("saveWorkbookAs", { callback: (e) => {
2750
+ n(e);
2751
+ } }), e.updateCommand("protectWorkbook", {
2752
+ tags: ["noTransaction", "noRepeat"],
2753
+ callback: async () => {
2754
+ const e = o.getOrigin(), t = o.getProtection(), n = t.hasPassword();
2755
+ await l.showWindow("protectWorkbook", {
2756
+ initialValue: {
2757
+ encrypt: e.isEncrypted(),
2758
+ encryptPassword: e.isEncrypted() ? null : "",
2759
+ structure: t.isLocked(),
2760
+ structurePassword: n ? null : "",
2761
+ lockStructure: !t.isStructureAllowed(),
2762
+ lockWindows: !t.isWindowsAllowed()
2763
+ },
2764
+ onApply: async (o) => {
2765
+ try {
2766
+ o.encrypt ? null !== o.encryptPassword && "" !== o.encryptPassword && e.setPassword(o.encryptPassword) : e.setPassword(null);
2767
+ const n = o.structure;
2768
+ !n && t.isLocked() ? await t.unlock(o.structurePassword ?? void 0) : n && !t.isLocked() && await t.lock({
2769
+ structure: o.lockStructure,
2770
+ windows: o.lockWindows
2771
+ }, o.structurePassword || void 0);
2772
+ } catch (e) {
2773
+ l.showError(e);
2774
+ }
2775
+ }
2776
+ });
2777
+ }
2778
+ });
2779
+ for (const o of t) {
2780
+ const t = o.key;
2781
+ e.updateCommand(`saveWorkbookAs${t}`, {
2782
+ label: () => to("command.saveAsFormat.label", { format: o.description }),
2783
+ groupLabels: {
2784
+ workbook: () => to("command.saveAsFormat.workbook", { format: o.description }),
2785
+ saveWorkbookOptions: () => to("command.saveAsFormat.compact", { format: o.description })
2786
+ },
2787
+ tags: o.tags,
2788
+ description: () => to("command.saveAsFormat", { format: o.description }),
2789
+ icon: "CSV" === t ? "FileDownloadAsCSV" : "Excel" === t ? "FileDownloadAsExcel" : "FileDownloadAsSheet",
2790
+ callback: () => {
2791
+ n(t);
2792
+ }
2793
+ });
2794
+ }
2795
+ }
2796
+ const p = async (e = null) => {
2797
+ const t = { csv: {
2798
+ date1904: o.getRuntime().isDate1904(),
2799
+ ...o.options
2800
+ } };
2801
+ try {
2802
+ let n = "";
2803
+ const r = async (e) => {
2804
+ n = e?.getName() ?? "";
2805
+ }, a = await s(e, t, r);
2806
+ if (!a) return;
2807
+ const l = a.getSheets().getItems();
2808
+ await o.doBatch(async () => {
2809
+ for (let e = 0; e < l.length; e++) {
2810
+ const t = l[e], r = 1 === l.length ? n : t.getName(), a = o.findValidSheetName(r);
2811
+ await o.getSheets().add({
2812
+ name: a,
2813
+ autoSelect: e === l.length - 1
2814
+ }).getEntireRange().copyFrom(t.getEntireRange());
2815
+ }
2816
+ }, eo("op.importData")), a.close();
2817
+ } catch (e) {
2818
+ l.showError(e);
2819
+ }
2820
+ };
2821
+ if (e.updateCommand("insertDataFromFile", {
2822
+ tags: ["noTransaction", "noRepeat"],
2823
+ callback: async (e = null) => {
2824
+ let t = e;
2825
+ if (t || Y.canRead() || (t = await (async () => {
2826
+ const e = await Y.getReadFormats(), t = [...new Set(e.flatMap((e) => e.exts))].map((e) => `.${e}`);
2827
+ return Gt.openFileDialog(t.length ? t.join(",") : "*.*");
2828
+ })(), t)) return p(t);
2829
+ }
2830
+ }), e.updateCommand("insertDataFromURL", {
2831
+ tags: ["noTransaction", "noRepeat"],
2832
+ callback: async (e) => {
2833
+ if (!e) {
2834
+ const t = await l.showInput({
2835
+ title: to("dialog.importFromWeb.title"),
2836
+ description: to("dialog.importFromWeb.description"),
2837
+ inputLabel: to("dialog.webAddress.inputLabel"),
2838
+ initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
2839
+ propsInput: { style: { minWidth: "440px" } },
2840
+ options: [{
2841
+ id: "Import",
2842
+ label: () => to("dialog.import")
2843
+ }]
2844
+ });
2845
+ if ("Import" !== t.option) return;
2846
+ e = t.input;
2847
+ }
2848
+ if (e) try {
2849
+ const t = await fetch(e);
2850
+ if (!t.ok) throw new Error(`Could not fetch '${e}' (${t.status} ${t.statusText}).`);
2851
+ const o = await t.blob(), n = decodeURIComponent(e.split("/").pop()?.split("?")[0] || "") || "import.xlsx";
2852
+ await p(new File([o], n, { type: o.type }));
2853
+ } catch (e) {
2854
+ l.showError(e);
2855
+ }
2856
+ }
2857
+ }), c) {
2858
+ const t = async () => !a() || "Open" === await l.showOptions({
2859
+ title: to("dialog.confirm.title"),
2860
+ description: to("dialog.unsavedChanges"),
2861
+ options: [{
2862
+ id: "Open",
2863
+ label: () => to("dialog.open")
2864
+ }, "Cancel"],
2865
+ defaultOption: "Cancel"
2866
+ }), r = async (e = null) => {
2867
+ const t = { csv: {
2868
+ date1904: o.getRuntime().isDate1904(),
2869
+ ...o.options
2870
+ } };
2871
+ try {
2872
+ const o = await s(e, t);
2873
+ if (!o) return;
2874
+ n(o);
2875
+ } catch (e) {
2876
+ l.showError(e);
2877
+ }
2878
+ };
2879
+ e.updateCommand("openWorkbook", { callback: async (e = null) => {
2880
+ await t() && await r(e);
2881
+ } }), e.updateCommand("openWorkbookFromUrl", { callback: async (e) => {
2882
+ if (!e) {
2883
+ const t = await l.showInput({
2884
+ title: to("dialog.openFromWeb.title"),
2885
+ description: to("dialog.openFromWeb.description"),
2886
+ inputLabel: to("dialog.webAddress.inputLabel"),
2887
+ initialValue: "https://www.sheetxl.com/docs/examples/financial-calculators.xlsx",
2888
+ propsInput: { style: { minWidth: "440px" } },
2889
+ options: [{
2890
+ id: "Open",
2891
+ label: () => to("dialog.open")
2892
+ }]
2893
+ });
2894
+ if ("Open" !== t.option) return;
2895
+ e = t.input;
2896
+ }
2897
+ if (e && await t()) try {
2898
+ const t = await fetch(e);
2899
+ if (!t.ok) throw new Error(`Could not fetch '${e}' (${t.status} ${t.statusText}).`);
2900
+ const o = await t.blob(), n = decodeURIComponent(e.split("/").pop()?.split("?")[0] || "") || "workbook.xlsx";
2901
+ await r(new File([o], n, { type: o.type }));
2902
+ } catch (e) {
2903
+ l.showError(e);
2904
+ }
2905
+ } });
2906
+ }
2907
+ })(), () => {
2908
+ i = !0;
2909
+ };
2910
+ }
2911
+ var Tn = je(() => import("./eKP73GEWmonTXpfv.mjs"));
2912
+ C();
2913
+ var Pn = /* @__PURE__ */ new Set(["ui"]), Fn = (e) => {
2914
+ const t = (e) => {
2915
+ if ("function" != typeof e) return e;
2916
+ try {
2917
+ return e();
2918
+ } catch {
2919
+ return;
2920
+ }
2921
+ }, o = (e, o) => {
2922
+ const n = t(e);
2923
+ return "string" == typeof n ? Zt(n, o, Qt.getActive()) : void 0;
2924
+ }, n = [];
2925
+ for (const r of e.names()) if (!Pn.has(r)) for (const a of e.keys(r)) {
2926
+ const l = e.resolveDefinition(r, a);
2927
+ n.push({
2928
+ groupKey: r,
2929
+ command: {
2930
+ getLabel: () => o(l?.label, l?.params) ?? a,
2931
+ getIcon: () => t(l?.icon),
2932
+ getDescription: () => o(l?.description, l?.params) ?? "",
2933
+ getShortcut: () => t(l?.shortcut) ?? null,
2934
+ getScope: () => r,
2935
+ getScopeLabel: () => he.DefaultCommandCatalogService.getScopeLabel(r)
2936
+ }
2937
+ });
2938
+ }
2939
+ return { getAllCommands: () => n };
2940
+ }, Dn = (e) => {
2941
+ const { children: t, workbook: o, setWorkbook: n, workbookTitle: r, isDirty: a } = e, l = he.useCommandScope(), i = Me(), { showModal: s } = it(), d = We(), c = qe(a);
2942
+ c.current = a;
2943
+ const p = De(() => {
2944
+ const e = l?.getRoot().getRegistry();
2945
+ if (!e) return;
2946
+ const t = s(Tn, {
2947
+ title: d("dialog.shortcutKeys.title"),
2948
+ commands: Fn(e),
2949
+ onDone: () => t.hide()
2950
+ });
2951
+ }, [l, s]);
2952
+ $e(() => {
2953
+ if (!l) return;
2954
+ const e = l.getRoot().contribution();
2955
+ return function(e, t) {
2956
+ const o = () => t.showShortcuts();
2957
+ e.updateCommand("showKeyboardShortcuts", { callback: o }), e.updateCommand("help", { callback: o });
2958
+ for (const [t, o] of Object.entries({
2959
+ gotoUrlGithub: "https://github.com/sheetxl/sheetxl",
2960
+ gotoUrlDiscord: "https://discord.gg/NTKdwUgK9p",
2961
+ gotoUrlDocumentation: "https://www.sheetxl.com/docs",
2962
+ gotoUrlIssue: "https://github.com/sheetxl/sheetxl/issues"
2963
+ })) e.updateCommand(t, { callback: () => {
2964
+ window?.open(o);
2965
+ } });
2966
+ }(e, { showShortcuts: p }), () => e.remove();
2967
+ }, [l, p]);
2968
+ const u = Ut("(prefers-color-scheme: dark)"), { themeMode: m } = Ae(), [g, h] = Re(Q.Mode, null), [y, b] = Re(Q.DarkGrid, !1), [f, x] = Re(Q.DarkImages, !1);
2969
+ $e(() => {
2970
+ if (!l) return;
2971
+ const e = l.getRoot().contribution();
2972
+ return function(e, t) {
2973
+ e.updateCommand("themeMode", {
2974
+ state: t.mode ?? null,
2975
+ params: { dark: t.isDark },
2976
+ icon: t.isDark ? "DarkMode" : "LightMode",
2977
+ callback: () => t.setMode(t.isDark ? "light" : "dark")
2978
+ }), e.updateCommand("defaultThemeMode", {
2979
+ state: !t.mode,
2980
+ icon: t.systemDefaultDark ? "SystemDefaultDarkMode" : "SystemDefaultLightMode",
2981
+ callback: () => t.setMode(null)
2982
+ }), e.updateCommand("enableDarkGrid", {
2983
+ state: t.enableDarkGrid,
2984
+ callback: () => t.setEnableDarkGrid((e) => !e)
2985
+ }), e.updateCommand("enableDarkImages", {
2986
+ state: t.enableDarkImages,
2987
+ callback: () => t.setEnableDarkImages((e) => !e)
2988
+ });
2989
+ }(e, {
2990
+ mode: g,
2991
+ setMode: h,
2992
+ isDark: "dark" === g || !g && "dark" === m,
2993
+ systemDefaultDark: u,
2994
+ enableDarkGrid: y,
2995
+ setEnableDarkGrid: b,
2996
+ enableDarkImages: f,
2997
+ setEnableDarkImages: x
2998
+ }), () => e.remove();
2999
+ }, [
3000
+ l,
3001
+ g,
3002
+ m,
3003
+ u,
3004
+ y,
3005
+ f,
3006
+ h,
3007
+ b,
3008
+ x
3009
+ ]);
3010
+ const [v, k] = Re(ve.Active, null), [C, w] = He(() => Qt.getActive());
3011
+ $e(() => Qt.addChangeListener(w), []), $e(() => {
3012
+ v && v !== Qt.getActive() && Qt.setActive(v);
3013
+ }, [v]), $e(() => {
3014
+ if (!l) return;
3015
+ const e = l.getRoot().contribution();
3016
+ return function(e, t) {
3017
+ e.updateCommand("language", {
3018
+ state: t.active,
3019
+ callback: (e) => {
3020
+ e && t.setActive(e);
3021
+ }
3022
+ });
3023
+ }(e, {
3024
+ active: C,
3025
+ setActive: (e) => {
3026
+ k(e);
3027
+ }
3028
+ }), () => e.remove();
3029
+ }, [
3030
+ l,
3031
+ C,
3032
+ k
3033
+ ]);
3034
+ const { isFullscreenAvailable: S, isFullscreenEnabled: T, toggleFullscreen: P } = Ne();
3035
+ return $e(() => {
3036
+ if (!l) return;
3037
+ const e = l.getRoot().contribution();
3038
+ return function(e, t) {
3039
+ e.updateCommand("fullScreenToggle", {
3040
+ state: t.isFullscreenEnabled,
3041
+ disabledReasons: t.isFullscreenAvailable ? [] : [eo("reason.fullscreenUnavailable")],
3042
+ icon: t.isFullscreenEnabled ? "FullScreenOff" : "FullScreen",
3043
+ callback: () => {
3044
+ t.toggleFullscreen();
3045
+ }
3046
+ });
3047
+ }(e, {
3048
+ isFullscreenAvailable: S,
3049
+ isFullscreenEnabled: T,
3050
+ toggleFullscreen: P
3051
+ }), () => e.remove();
3052
+ }, [
3053
+ l,
3054
+ S,
3055
+ T,
3056
+ P
3057
+ ]), $e(() => {
3058
+ if (!l || !o) return;
3059
+ const e = l.getRoot().contribution(), t = Sn(e, {
3060
+ workbook: o,
3061
+ setWorkbook: n,
3062
+ workbookTitle: r ?? void 0,
3063
+ isDirty: () => c.current?.() ?? !1,
3064
+ notifier: i
3065
+ });
3066
+ return () => {
3067
+ t(), e.remove();
3068
+ };
3069
+ }, [
3070
+ l,
3071
+ o,
3072
+ n,
3073
+ r,
3074
+ i
3075
+ ]), t;
3076
+ };
3077
+ Dn.displayName = "StudioCommandProvider";
3078
+ var Nn = ({ renderWorkbook: e }) => {
3079
+ const t = he.useCommandResolver(), o = qe(null), [n, r] = He(null), a = Ve((e) => {
3080
+ const o = e.dataTransfer;
3081
+ if (t && o) {
3082
+ if ("dragenter" === e.type || "dragover" === e.type) {
3083
+ const e = (e) => {
3084
+ const t = o.items, n = t.length;
3085
+ for (let o = 0; o < n; o++) {
3086
+ const n = t[o];
3087
+ if (n.type.startsWith(e)) return n;
3088
+ }
3089
+ return null;
3090
+ };
3091
+ let t = null;
3092
+ t = e("image/");
3093
+ const n = o.types, a = o.items;
3094
+ t ? r({
3095
+ item: t,
3096
+ text: ""
3097
+ }) : n.includes("Files") && a.length > 0 ? r({
3098
+ item: a[0],
3099
+ text: "Drop to open"
3100
+ }) : n.includes("text/html") || n.includes("text/plain") ? (r({
3101
+ item: a[0],
3102
+ text: ""
3103
+ }), o.effectAllowed = "none", o.dropEffect = "none") : (o.effectAllowed = "none", o.dropEffect = "none");
3104
+ } else "dragleave" === e.type && r(null);
3105
+ e.preventDefault();
3106
+ }
3107
+ }, [t]), l = De((e) => {
3108
+ if (n && t && (e.preventDefault(), e.stopPropagation(), r(null), e.dataTransfer.files && e.dataTransfer.files.length > 0)) {
3109
+ const n = e.dataTransfer.files[0];
3110
+ if (!n) return;
3111
+ if (n?.type?.startsWith("image/")) {
3112
+ const r = o.current?.getSheetElement()?.getGridSurface().getPaneFromClient(e.clientX, e.clientY);
3113
+ if (!r) return;
3114
+ const a = r.getPanePointFromPointer(e.clientX, e.clientY);
3115
+ if (!a) return;
3116
+ const l = r.toAbsoluteBounds({
3117
+ x: a.x ?? 0,
3118
+ y: a.y ?? 0,
3119
+ width: 0,
3120
+ height: 0
3121
+ });
3122
+ t.execute("insertImageFromFile", {
3123
+ file: n,
3124
+ options: { bounds: {
3125
+ x: l.x,
3126
+ y: l.y
3127
+ } }
3128
+ });
3129
+ } else {
3130
+ if (!Y.canRead()) return;
3131
+ const o = (e.dataTransfer.items?.[0])?.getAsFileSystemHandle?.();
3132
+ o ? o.then((e) => t.execute("openWorkbook", "file" === e?.kind ? e : n)).catch(() => t.execute("openWorkbook", n)) : t.execute("openWorkbook", n);
3133
+ }
3134
+ }
3135
+ }, [t, n]), i = Ue(() => n && n.text ? ct(ht, {
3136
+ className: "drop-overlay",
3137
+ sx: {
3138
+ position: "absolute",
3139
+ width: "100%",
3140
+ height: "100%",
3141
+ boxSizing: "border-box",
3142
+ pointerEvents: "none",
3143
+ display: "flex",
3144
+ justifyContent: "center",
3145
+ alignItems: "center",
3146
+ background: (e) => e.palette.divider,
3147
+ color: (e) => e.palette.primary.dark
3148
+ },
3149
+ children: ct($t, {
3150
+ variant: "h4",
3151
+ children: n.text
3152
+ })
3153
+ }) : null, [n]);
3154
+ return pt(dt, { children: [e({
3155
+ ref: o,
3156
+ onDragStart: (e) => {
3157
+ if (e.target.src) {
3158
+ const t = new Image();
3159
+ t.src = e.target.src, e.dataTransfer.setDragImage(t, 1, 1);
3160
+ }
3161
+ },
3162
+ onDragEnter: a,
3163
+ onDragLeave: a,
3164
+ onDragOver: a,
3165
+ onDrop: l
3166
+ }), i] });
3167
+ }, On = Ke((e) => {
3168
+ const { workbook: t, setWorkbook: o, refDocumentTitle: n, titleWorkbook: r, setWorkbookTitle: a, isDirty: l, initialCommandAnchor: i, renderWorkbook: s } = e;
3169
+ return ct(K, {
3170
+ initialAnchor: i,
3171
+ children: ct(Dn, {
3172
+ workbook: t,
3173
+ setWorkbook: o,
3174
+ workbookTitle: r,
3175
+ isDirty: l,
3176
+ children: ct(Nn, { renderWorkbook: s })
3177
+ })
3178
+ });
3179
+ });
3180
+ On.displayName = "CommandsWrapper";
3181
+ var In = {
3182
+ sort: () => import("./C8a6QwMGW1tMiWA6.mjs"),
3183
+ numberFormat: () => import("./BYigefA8bf9FOVib.mjs"),
3184
+ hyperlink: () => import("./D1K9Ji7iQwnOnd1-.mjs"),
3185
+ comments: () => import("./BlubX7gm8wTUNiZ-.mjs"),
3186
+ find: () => import("./CTZcfST8pUcLMail.mjs"),
3187
+ tableNew: () => import("./BdrLZp98HQaVMykZ.mjs"),
3188
+ namedDetails: () => import("./BO1vNzjGWYdZdbq9.mjs"),
3189
+ insertFunction: () => import("./CKpik3HRSANKEy4G.mjs"),
3190
+ resizeHeader: () => import("./DuUiuB59bQRPQi-D.mjs"),
3191
+ workbookStatistics: () => import("./g3y8kxL1Ln214UNr.mjs"),
3192
+ protectWorkbook: () => import("./index.mjs").then((e) => e.a)
3193
+ }, Mn = ["find"], Rn = Ke((e) => {
3194
+ const { children: t } = e, o = io(), n = o ? o.enqueueSnackbar : () => {}, r = o ? o.closeSnackbar : () => {}, [a, l] = He({
3195
+ isMounted: !1,
3196
+ label: null,
3197
+ progress: null,
3198
+ starting: /* @__PURE__ */ new Map(),
3199
+ running: /* @__PURE__ */ new Map()
3200
+ }), i = Ve(() => {
3201
+ l((e) => ({
3202
+ ...e,
3203
+ isMounted: !0
3204
+ }));
3205
+ }, []), s = Ve(() => {
3206
+ l((e) => ({
3207
+ ...e,
3208
+ isMounted: !1
3209
+ }));
3210
+ }, []), d = We(), c = Ht.EmptyObject, p = lt(c), u = st(c), m = at(c), g = qe(!1);
3211
+ $e(() => {
3212
+ if (g.current) return;
3213
+ g.current = !0;
3214
+ const e = window, t = e.requestIdleCallback ?? ((e) => setTimeout(e, 500)), o = e.cancelIdleCallback ?? clearTimeout, n = t(() => {
3215
+ for (const e of Mn) p(e, In[e], { prewarm: !0 }).catch(() => {});
3216
+ });
3217
+ return () => o(n);
3218
+ }, []);
3219
+ const h = qe(/* @__PURE__ */ new Set()), y = Ue(() => {
3220
+ const e = (e, t) => {
3221
+ if (t?.onceKey) {
3222
+ if (h.current.has(t.onceKey)) return;
3223
+ const e = new Set(h.current);
3224
+ e.add(t.onceKey), h.current = e;
3225
+ }
3226
+ const o = {
3227
+ variant: t?.type ?? ke.Info,
3228
+ anchorOrigin: {
3229
+ vertical: "top",
3230
+ horizontal: "center"
3231
+ },
3232
+ preventDuplicate: t?.preventDuplicate,
3233
+ persist: t?.persist ?? t?.type === ke.Error,
3234
+ action: (e) => ct(Ft, {
3235
+ onClick: () => r(e),
3236
+ children: ct(fe, { iconKey: "Cancel" })
3237
+ })
3238
+ };
3239
+ t?.enqueueProps && Object.assign(o, t.enqueueProps), e || console.log("message is 'null'", t), n(e ?? "Alert", o);
3240
+ }, t = {
3241
+ showMessage: e,
3242
+ showBusy: (e, t) => {
3243
+ let o = null;
3244
+ const n = new Promise((e) => {
3245
+ o = e;
3246
+ });
3247
+ return l((t) => {
3248
+ const r = new Map(t.starting);
3249
+ return r.set(n, o), {
3250
+ ...t,
3251
+ label: e,
3252
+ starting: r
3253
+ };
3254
+ }), n;
3255
+ },
3256
+ showWindow: (e, t) => {
3257
+ const o = t;
3258
+ return t = {
3259
+ ...t,
3260
+ onKeyDown: (e) => {
3261
+ e.isDefaultPrevented() || e.isPropagationStopped() || o?.onKeyDown?.(e);
3262
+ }
3263
+ }, p(e, In[e], t);
3264
+ },
3265
+ showOptions: u,
3266
+ showInput: m,
3267
+ showError: (t) => {
3268
+ let o, n = ke.Error, r = d("error.unknown");
3269
+ "string" == typeof t ? r = t : t instanceof Error && (o = t, t.message && (r = d(t.message))), t instanceof Jt && (n = ke.Info), e(r, {
3270
+ type: n,
3271
+ enqueueProps: { error: o }
3272
+ });
3273
+ }
3274
+ }, o = new be();
3275
+ return o.setOverrides(t), o;
3276
+ }, [d]);
3277
+ $e(() => {
3278
+ a.starting.size <= 0 || !a.isMounted || l((e) => {
3279
+ const t = new Map(e.running);
3280
+ return e.starting.forEach((e, o) => {
3281
+ const n = Pe(() => {
3282
+ l((e) => {
3283
+ const t = new Map(e.running);
3284
+ return t.delete(o), {
3285
+ ...e,
3286
+ progress: 0 === t.size ? null : e.progress,
3287
+ running: t
3288
+ };
3289
+ });
3290
+ }, (e, t) => {
3291
+ const o = t && t > 0 && null != e ? Math.max(0, Math.min(1, e / t)) : null;
3292
+ l((e) => e.progress === o ? e : {
3293
+ ...e,
3294
+ progress: o
3295
+ });
3296
+ }, (e) => {
3297
+ l((t) => ({
3298
+ ...t,
3299
+ label: e
3300
+ }));
3301
+ });
3302
+ t.set(o, n), e(n);
3303
+ }), {
3304
+ ...e,
3305
+ starting: /* @__PURE__ */ new Map(),
3306
+ running: t
3307
+ };
3308
+ });
3309
+ }, [a]);
3310
+ const [b, f] = He(null);
3311
+ return $e(() => {
3312
+ 0 !== a.starting.size || 0 !== a.running.size ? f(ct(Ge, {
3313
+ icon: ct(Qe, { sx: {
3314
+ transform: "scale(0.7)",
3315
+ marginLeft: "-6px"
3316
+ } }),
3317
+ panel: !0,
3318
+ label: a.label,
3319
+ progress: a.progress,
3320
+ onMount: i,
3321
+ onUnmount: s,
3322
+ sx: {
3323
+ position: "absolute",
3324
+ left: "0",
3325
+ top: "0",
3326
+ width: "100%",
3327
+ height: "100%",
3328
+ zIndex: "9999"
3329
+ }
3330
+ })) : f(null);
3331
+ }, [
3332
+ a.starting,
3333
+ a.running,
3334
+ a.label,
3335
+ a.progress
3336
+ ]), pt(we, {
3337
+ notifier: y,
3338
+ children: [b, t]
3339
+ });
3340
+ });
3341
+ Rn.displayName = "StudioNotifierProvider";
3342
+ var An = "var(--sxl-color-input-border, light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.2)))", En = Ke(Le((e, t) => {
3343
+ const { children: o, title: n, taskPanes: r, onSelect: a, selected: l, registry: i = $, style: s, iconsOnly: d, side: c = "right", className: p, ...u } = e, m = "right" !== c, g = Ue(() => r.map((t) => {
3344
+ const o = i.getRegisteredTaskPane(t);
3345
+ if (!o) return null;
3346
+ let n = o.getIcon?.();
3347
+ "string" == typeof n && (n = ct(fe, { iconKey: n }));
3348
+ const r = t === l, a = n ? ct(ht, {
3349
+ sx: {
3350
+ display: "inline-block",
3351
+ transform: m ? "rotate(-90deg)" : "rotate(90deg)",
3352
+ transformOrigin: "center",
3353
+ color: (e) => e.palette.text.secondary
3354
+ },
3355
+ children: n
3356
+ }) : null, s = !n || !d && r, c = ct(ht, {
3357
+ sx: {
3358
+ display: "grid",
3359
+ gridTemplateColumns: s ? "1fr" : "0fr",
3360
+ opacity: s ? 1 : 0,
3361
+ transition: (e) => e.transitions.create(["grid-template-columns", "opacity"], { duration: e.transitions.duration.short })
3362
+ },
3363
+ children: ct(ht, {
3364
+ sx: {
3365
+ overflow: "hidden",
3366
+ minWidth: 0,
3367
+ minHeight: 0
3368
+ },
3369
+ children: ct($t, {
3370
+ component: "div",
3371
+ sx: {
3372
+ textTransform: "none",
3373
+ whiteSpace: "nowrap",
3374
+ transform: m ? "rotate(180deg)" : void 0,
3375
+ padding: "4px 0px",
3376
+ color: (e) => r ? e.palette.primary.main : e.palette.text.secondary
3377
+ },
3378
+ children: o.getTitle()
3379
+ })
3380
+ })
3381
+ });
3382
+ return ct(Bt, {
3383
+ value: t,
3384
+ label: ct(ot, {
3385
+ disableInteractive: !0,
3386
+ title: o.getTitle() ?? "",
3387
+ placement: "left-start",
3388
+ children: pt(ht, {
3389
+ sx: {
3390
+ padding: "0px 0px",
3391
+ writingMode: m ? "vertical-lr" : "vertical-rl",
3392
+ textOrientation: "mixed",
3393
+ display: "flex",
3394
+ alignItems: "center",
3395
+ justifyContent: "space-between",
3396
+ minWidth: "0px",
3397
+ color: (e) => e.palette.text.secondary
3398
+ },
3399
+ children: [m ? c : a, m ? a : c]
3400
+ })
3401
+ }),
3402
+ sx: {
3403
+ padding: "4px 4px",
3404
+ minWidth: "0px",
3405
+ minHeight: "0px",
3406
+ borderRadius: "4px"
3407
+ },
3408
+ className: oo("taskpane-strip-item", { "Mui-selected": r }),
3409
+ onClick: () => e.onSelect(t)
3410
+ }, t);
3411
+ }), [
3412
+ r,
3413
+ l,
3414
+ a,
3415
+ i,
3416
+ m,
3417
+ d,
3418
+ Ie()
3419
+ ]);
3420
+ return ct(ht, {
3421
+ ref: Oe(t, () => ({ isTaskPaneStrip: () => !0 }), []),
3422
+ className: Ue(() => oo("taskpane-strip", p), [p]),
3423
+ sx: {
3424
+ paddingLeft: m ? void 0 : "2px",
3425
+ paddingRight: m ? "2px" : void 0,
3426
+ paddingTop: "4px",
3427
+ ...s
3428
+ },
3429
+ ...u,
3430
+ children: ct(Lt, {
3431
+ orientation: "vertical",
3432
+ variant: "scrollable",
3433
+ value: l,
3434
+ onChange: (e, t) => {
3435
+ a(t);
3436
+ },
3437
+ slotProps: {
3438
+ list: { sx: { gap: "2px" } },
3439
+ indicator: { sx: {
3440
+ left: m ? void 0 : "0px",
3441
+ right: m ? void 0 : "unset",
3442
+ bottom: m ? "0px" : void 0
3443
+ } }
3444
+ },
3445
+ children: g
3446
+ })
3447
+ });
3448
+ })), Wn = (e) => {
3449
+ const { title: t, icon: o, onClose: n, readOnly: r, focused: a, ...l } = e, i = qe(null), s = We();
3450
+ return ct(wt, {
3451
+ className: oo({ "Mui-selected": a }),
3452
+ sx: {
3453
+ display: "flex",
3454
+ flex: "1 1 %0",
3455
+ color: (e) => e.palette.text.secondary,
3456
+ boxSizing: "border-box",
3457
+ padding: "0 0",
3458
+ transitionProperty: "opacity",
3459
+ transitionDuration: (e) => `${e.transitions.duration.shortest}ms`,
3460
+ opacity: .7,
3461
+ "&.Mui-selected": {
3462
+ opacity: 1,
3463
+ transitionDuration: (e) => e.transitions.duration.shortest / 2 + "ms"
3464
+ },
3465
+ backgroundColor: (e) => _t(e.palette.action.hover, .03),
3466
+ borderBottom: `solid ${An} 1px`
3467
+ },
3468
+ ...l,
3469
+ children: pt(ht, {
3470
+ sx: {
3471
+ display: "flex",
3472
+ flex: "1 1 10%",
3473
+ flexDirection: "row",
3474
+ alignItems: "center",
3475
+ marginTop: (e) => e.spacing(.25),
3476
+ marginBottom: (e) => e.spacing(.25),
3477
+ marginLeft: (e) => e.spacing(1),
3478
+ marginRight: (e) => e.spacing(1)
3479
+ },
3480
+ children: [ct(ht, {
3481
+ sx: {
3482
+ flex: "1 1 100%",
3483
+ paddingLeft: (e) => e.spacing(1)
3484
+ },
3485
+ children: t
3486
+ }), ct(et, {
3487
+ label: s("taskPane.close"),
3488
+ children: ct(Ft, {
3489
+ "aria-label": "close",
3490
+ sx: { color: (e) => e.palette.text.icon ?? e.palette.action.active },
3491
+ touchRippleRef: i,
3492
+ onPointerDown: (e) => {
3493
+ i.current?.start(e, { center: !1 }), e.stopPropagation(), e.preventDefault();
3494
+ },
3495
+ onPointerUp: () => {
3496
+ n();
3497
+ },
3498
+ children: ct(fe, { iconKey: "Close" })
3499
+ })
3500
+ })]
3501
+ })
3502
+ });
3503
+ }, Bn = Le((e, t) => {
3504
+ const { model: o, side: n, ...r } = e, a = qt();
3505
+ return ct(H, {
3506
+ model: o,
3507
+ ref: t,
3508
+ propsFrame: { style: {
3509
+ border: `solid ${An} 1px`,
3510
+ borderRadius: `${a.shape.borderRadius ?? 4}px`,
3511
+ marginBottom: `${a.spacing?.(.5) ?? 4}px`
3512
+ } },
3513
+ alwaysShowStrip: !0,
3514
+ componentTitle: Wn,
3515
+ componentStrip: En,
3516
+ side: n,
3517
+ ...e,
3518
+ onOpen: () => {
3519
+ e?.onOpen?.();
3520
+ },
3521
+ onClose: () => {
3522
+ e?.onClose?.();
3523
+ },
3524
+ ...r
3525
+ });
3526
+ }), Ln = "_styled-resizer_fdl5y_3", zn = {}, jn = {
3527
+ flex: "1 1 100%",
3528
+ display: "flex",
3529
+ boxSizing: "border-box"
3530
+ }, Kn = Ke(Le((e, t) => {
3531
+ const { mainElement: o, sidebarElement: n, position: r, persistKey: a, onPositionChange: l, className: i, style: s, taskSide: d = "right", ...c } = e, [p, u] = Re(a ?? null, zn), m = qt(), [g, { width: h }] = ro(), y = h > 530 || 0 === h, b = qe(null);
3532
+ let f, x, v = null, k = 4, C = 13;
3533
+ 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);
3534
+ let w, S = o, T = n;
3535
+ const P = "right" !== d, F = y ? "row" : "column", D = P && T ? "before" : "after", N = `${F}:${D}`, O = a ? p[N] : void 0, I = null != O ? `${O}%` : ((e, t) => {
3536
+ if (null == e) return "40%";
3537
+ if ("number" == typeof e || "string" == typeof e) return e;
3538
+ const o = e[t];
3539
+ return null != o ? `${o}%` : "40%";
3540
+ })(r, N), M = a || l ? (e) => {
3541
+ a && u((t) => ({
3542
+ ...t,
3543
+ [N]: e.percent
3544
+ })), l?.(e, {
3545
+ orientation: F,
3546
+ side: D,
3547
+ key: N
3548
+ });
3549
+ } : void 0;
3550
+ return P && T ? (S = n, T = o, x = { style: {
3551
+ flexDirection: "column",
3552
+ boxSizing: "border-box",
3553
+ paddingRight: "2px"
3554
+ } }, f = {}, w = {
3555
+ fixedPane: "before",
3556
+ position: I,
3557
+ minBefore: y ? "280px" : "120px",
3558
+ splitDirection: y ? "row" : "column"
3559
+ }) : (f = { style: {
3560
+ flexDirection: "column",
3561
+ marginRight: n ? void 0 : "6px"
3562
+ } }, x = { style: {
3563
+ marginLeft: y ? "0px" : "4px",
3564
+ marginRight: y ? "8px" : "4px"
3565
+ } }, w = {
3566
+ fixedPane: "after",
3567
+ position: I,
3568
+ minAfter: y ? "280px" : "120px",
3569
+ splitDirection: y ? "row" : "column"
3570
+ }), ct(Se, {
3571
+ ref: no([
3572
+ b,
3573
+ g,
3574
+ t
3575
+ ]),
3576
+ className: i,
3577
+ style: s ? {
3578
+ ...jn,
3579
+ ...s
3580
+ } : jn,
3581
+ ...c,
3582
+ ...w,
3583
+ onPositionChange: M,
3584
+ propsResizer: {
3585
+ className: oo("styled-resizer", Ln),
3586
+ style: {
3587
+ minWidth: y ? "7px" : void 0,
3588
+ minHeight: y ? void 0 : "6px",
3589
+ 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")`,
3590
+ maskRepeat: "no-repeat",
3591
+ maskPosition: P ? y ? "center center" : "bottom center" : y ? "left center" : "top center"
3592
+ }
3593
+ },
3594
+ elementBefore: S,
3595
+ propsPaneBefore: f,
3596
+ elementAfter: T,
3597
+ propsPaneAfter: x
3598
+ });
3599
+ }));
3600
+ Kn.displayName = "StudioSplitPane";
3601
+ var Vn = Ke((e) => {
3602
+ const { dataValidation: t } = e, o = We(), n = t.getRenderHints();
3603
+ return se(t, "onAnyChange"), pt(Rt, {
3604
+ tabIndex: 0,
3605
+ className: s["editor-panel"],
3606
+ sx: {
3607
+ gap: (e) => e.spacing(1),
3608
+ paddingTop: (e) => e.spacing(1.25),
3609
+ paddingBottom: (e) => e.spacing(2),
3610
+ paddingLeft: (e) => e.spacing(1.5),
3611
+ paddingRight: (e) => e.spacing(1.5),
3612
+ border: (e) => `1px solid ${e.palette.divider}`,
3613
+ borderRadius: (e) => e.spacing(1.25),
3614
+ overflow: "auto"
3615
+ },
3616
+ children: [
3617
+ ct(ht, {
3618
+ sx: { margin: (e) => e.spacing(1.25) },
3619
+ children: ct($t, {
3620
+ variant: "body2",
3621
+ sx: { color: "text.secondary" },
3622
+ children: o("dataValidation.range", { range: t.getRanges().toString() })
3623
+ })
3624
+ }),
3625
+ ct(Ko, {
3626
+ selectorTitle: o("dataValidation.allow"),
3627
+ showIncludeBlanks: !0,
3628
+ condition: t.getCondition(),
3629
+ readOnly: t.isProtected(),
3630
+ onConditionChange: (e) => t.setCondition(e)
3631
+ }),
3632
+ pt(ut, {
3633
+ expanded: t.isShowPromptMessage(),
3634
+ onChange: (e, o) => t.setShowPromptMessage(o),
3635
+ disableGutters: !0,
3636
+ elevation: 0,
3637
+ sx: {
3638
+ backgroundColor: "action.hover",
3639
+ border: 1,
3640
+ borderColor: "divider",
3641
+ borderRadius: 1,
3642
+ mb: 0,
3643
+ "&:before": { display: "none" },
3644
+ "&.Mui-expanded": {
3645
+ margin: 0,
3646
+ mb: 1
3647
+ }
3648
+ },
3649
+ children: [ct(gt, {
3650
+ expandIcon: ct(fe, { iconKey: "ExpandMore" }),
3651
+ sx: {
3652
+ px: 2,
3653
+ "& .MuiAccordionSummary-content": { my: 0 },
3654
+ "&.Mui-expanded .MuiAccordionSummary-content": { my: 0 }
3655
+ },
3656
+ children: ct(Pt, {
3657
+ control: ct(xt, {
3658
+ checked: t.isShowPromptMessage(),
3659
+ onChange: (e) => {
3660
+ e.stopPropagation();
3661
+ const o = e.target.checked;
3662
+ t.setShowPromptMessage(o);
3663
+ },
3664
+ onClick: (e) => e.stopPropagation()
3665
+ }),
3666
+ label: o("dataValidation.showPrompt"),
3667
+ onClick: (e) => e.stopPropagation()
3668
+ })
3669
+ }), pt(mt, {
3670
+ sx: {
3671
+ pl: 2,
3672
+ pr: 2,
3673
+ pt: 0,
3674
+ pb: 2,
3675
+ display: "flex",
3676
+ flexDirection: "column",
3677
+ gap: 2
3678
+ },
3679
+ children: [ct(zt, {
3680
+ size: "small",
3681
+ label: o("dataValidation.title"),
3682
+ value: t.getPromptTitle(),
3683
+ onChange: (e) => t.setPromptTitle(e.target.value),
3684
+ fullWidth: !0,
3685
+ sx: { backgroundColor: "background.paper" }
3686
+ }), ct(zt, {
3687
+ size: "small",
3688
+ label: o("dataValidation.message"),
3689
+ value: t.getPromptMessage(),
3690
+ onChange: (e) => t.setPromptMessage(e.target.value),
3691
+ multiline: !0,
3692
+ rows: 2,
3693
+ fullWidth: !0,
3694
+ sx: { backgroundColor: "background.paper" }
3695
+ })]
3696
+ })]
3697
+ }),
3698
+ pt(ut, {
3699
+ expanded: t.isShowAlertMessage(),
3700
+ onChange: (e, o) => t.setShowAlertMessage(o),
3701
+ disableGutters: !0,
3702
+ elevation: 0,
3703
+ sx: {
3704
+ backgroundColor: "action.hover",
3705
+ border: 1,
3706
+ borderColor: "divider",
3707
+ borderRadius: 1,
3708
+ mb: 0,
3709
+ "&:before": { display: "none" },
3710
+ "&.Mui-expanded": {
3711
+ margin: 0,
3712
+ mb: 1
3713
+ }
3714
+ },
3715
+ children: [ct(gt, {
3716
+ expandIcon: ct(fe, { iconKey: "ExpandMore" }),
3717
+ sx: {
3718
+ px: 2,
3719
+ "& .MuiAccordionSummary-content": { my: 0 },
3720
+ "&.Mui-expanded .MuiAccordionSummary-content": { my: 0 }
3721
+ },
3722
+ children: ct(Pt, {
3723
+ control: ct(xt, {
3724
+ checked: t.isShowAlertMessage(),
3725
+ onChange: (e) => {
3726
+ e.stopPropagation();
3727
+ const o = e.target.checked;
3728
+ t.setShowAlertMessage(o);
3729
+ },
3730
+ onClick: (e) => e.stopPropagation()
3731
+ }),
3732
+ label: o("dataValidation.showAlert"),
3733
+ onClick: (e) => e.stopPropagation()
3734
+ })
3735
+ }), pt(mt, {
3736
+ sx: {
3737
+ pl: 2,
3738
+ pr: 2,
3739
+ pt: 0,
3740
+ pb: 2,
3741
+ display: "flex",
3742
+ flexDirection: "column",
3743
+ gap: 2
3744
+ },
3745
+ children: [
3746
+ pt(Tt, {
3747
+ fullWidth: !0,
3748
+ size: "small",
3749
+ sx: { backgroundColor: "background.paper" },
3750
+ children: [ct(Nt, { children: o("dataValidation.alertStyle") }), pt(At, {
3751
+ value: t.getAlertStyle(),
3752
+ label: o("dataValidation.alertStyle"),
3753
+ onChange: (e) => t.setAlertStyle(e.target.value),
3754
+ children: [
3755
+ ct(It, {
3756
+ value: E.AlertStyle.Stop,
3757
+ children: o("dataValidation.alertStop")
3758
+ }),
3759
+ ct(It, {
3760
+ value: E.AlertStyle.Warning,
3761
+ children: o("dataValidation.alertWarning")
3762
+ }),
3763
+ ct(It, {
3764
+ value: E.AlertStyle.Information,
3765
+ children: o("dataValidation.alertInformation")
3766
+ })
3767
+ ]
3768
+ })]
3769
+ }),
3770
+ ct(zt, {
3771
+ size: "small",
3772
+ label: o("dataValidation.title"),
3773
+ value: t.getAlertTitle(),
3774
+ onChange: (e) => t.setAlertTitle(e.target.value),
3775
+ fullWidth: !0,
3776
+ sx: { backgroundColor: "background.paper" }
3777
+ }),
3778
+ ct(zt, {
3779
+ size: "small",
3780
+ label: o("dataValidation.message"),
3781
+ value: t.getAlertMessage(),
3782
+ onChange: (e) => t.setAlertMessage(e.target.value),
3783
+ multiline: !0,
3784
+ rows: 2,
3785
+ fullWidth: !0,
3786
+ sx: { backgroundColor: "background.paper" }
3787
+ })
3788
+ ]
3789
+ })]
3790
+ }),
3791
+ n.length > 0 && ct(ht, {
3792
+ sx: {
3793
+ pl: 2,
3794
+ pr: 2,
3795
+ backgroundColor: "action.hover",
3796
+ border: 1,
3797
+ borderColor: "divider",
3798
+ borderRadius: 1
3799
+ },
3800
+ children: ct(Pt, {
3801
+ control: ct(xt, {
3802
+ checked: !t.isHideDropdown(),
3803
+ onChange: (e) => t.setHideDropdown(!e.target.checked)
3804
+ }),
3805
+ label: o("dataValidation.useCustomInput", { type: O.camelToPrettyCase(n[0]) })
3806
+ })
3807
+ })
3808
+ ]
3809
+ });
3810
+ });
3811
+ Vn.displayName = "DataValidationEditorPanel";
3812
+ var $n = {
3813
+ key: "data-validation",
3814
+ messageKeys: {
3815
+ none: eo("dataValidation.none"),
3816
+ addPrompt: eo("dataValidation.addPrompt"),
3817
+ heading: eo("dataValidation.heading"),
3818
+ insert: eo("dataValidation.insert"),
3819
+ new: eo("dataValidation.new"),
3820
+ moveUp: eo("dataValidation.moveUp"),
3821
+ moveDown: eo("dataValidation.moveDown"),
3822
+ edit: eo("dataValidation.edit"),
3823
+ duplicate: eo("dataValidation.duplicate"),
3824
+ delete: eo("dataValidation.delete"),
3825
+ cancel: eo("dataValidation.cancel"),
3826
+ save: eo("dataValidation.save")
3827
+ },
3828
+ getCollection: (e) => e.getDataValidations(),
3829
+ changeEvents: ["onDataValidationsChange"],
3830
+ applyUpdate: (e, t) => {
3831
+ e.update(t);
3832
+ },
3833
+ getCardTitle: (e, t) => e.getCondition()?.toString() ?? t("dataValidation.noCondition"),
3834
+ CardBody: ({ item: e }) => {
3835
+ const t = We();
3836
+ return e.isShowPromptMessage() && e.getPromptTitle() ? ct($t, {
3837
+ variant: "caption",
3838
+ sx: {
3839
+ color: (e) => e.palette.text.secondary,
3840
+ fontStyle: "italic"
3841
+ },
3842
+ children: t("dataValidation.promptPrefix", { title: e.getPromptTitle() })
3843
+ }) : null;
3844
+ },
3845
+ EditorBody: ({ item: e }) => ct(Vn, { dataValidation: e })
3846
+ }, _n = Ke(Le((e, t) => {
3847
+ const { workbook: o, ...n } = e;
3848
+ return ct(so, {
3849
+ ref: t,
3850
+ workbook: o,
3851
+ descriptor: $n,
3852
+ dragReorder: !0,
3853
+ ...n
3854
+ });
3855
+ }));
3856
+ _n.displayName = "DataValidationDetailsPanel";
3857
+ var Un = (e) => {
3858
+ const { model: t, entryKey: o, frame: n, ref: r, ...a } = e;
3859
+ return ct(_n, {
3860
+ ref: r,
3861
+ workbook: t,
3862
+ ...a
3863
+ });
3864
+ }, qn = /* @__PURE__ */ new WeakMap(), Hn = Ke((e) => {
3865
+ const { protectedRange: t } = e, o = We();
3866
+ se(t, "onAnyChange");
3867
+ const n = t.isProtected(), [r, a] = He(() => t.getName()), [l] = He(() => t.getName()), [i, d] = He(null), [c, p] = He(""), [u, m] = He(!1), [g] = He(() => t.hasPassword()), h = (() => {
3868
+ try {
3869
+ const e = t.getRanges();
3870
+ return e.isInvalid() ? null : e.getSheet().getProtectedRanges();
3871
+ } catch {
3872
+ return null;
3873
+ }
3874
+ })(), y = () => {
3875
+ const e = r.trim();
3876
+ if (!e) return void d(o("protectedRange.nameRequired"));
3877
+ const n = h?.getItems({ name: e })[0];
3878
+ if (n && n.getName().toLocaleLowerCase() !== l.toLocaleLowerCase()) d(o("protectedRange.nameTaken", { name: e }));
3879
+ else if (e !== t.getName()) try {
3880
+ t.setName(e), d(null);
3881
+ } catch (e) {
3882
+ d(e?.message ?? o("protectedRange.nameRequired"));
3883
+ }
3884
+ else d(null);
3885
+ };
3886
+ return pt(Rt, {
3887
+ tabIndex: 0,
3888
+ className: s["editor-panel"],
3889
+ sx: {
3890
+ gap: (e) => e.spacing(1),
3891
+ paddingTop: (e) => e.spacing(1.25),
3892
+ paddingBottom: (e) => e.spacing(2),
3893
+ paddingLeft: (e) => e.spacing(1.5),
3894
+ paddingRight: (e) => e.spacing(1.5),
3895
+ border: (e) => `1px solid ${e.palette.divider}`,
3896
+ borderRadius: (e) => e.spacing(1.25),
3897
+ overflow: "auto"
3898
+ },
3899
+ children: [ct(ht, {
3900
+ sx: { margin: (e) => e.spacing(1.25) },
3901
+ children: ct($t, {
3902
+ variant: "body2",
3903
+ sx: { color: "text.secondary" },
3904
+ children: o("protectedRange.range", { range: t.getRanges().toString() })
3905
+ })
3906
+ }), pt(ht, {
3907
+ sx: {
3908
+ display: "flex",
3909
+ flexDirection: "column",
3910
+ gap: (e) => e.spacing(2),
3911
+ margin: (e) => e.spacing(1.25)
3912
+ },
3913
+ children: [
3914
+ ct(zt, {
3915
+ label: o("protectedRange.name"),
3916
+ size: "small",
3917
+ fullWidth: !0,
3918
+ disabled: n,
3919
+ value: r,
3920
+ error: null !== i,
3921
+ helperText: i ?? void 0,
3922
+ onChange: (e) => {
3923
+ a(e.target.value), d(null);
3924
+ },
3925
+ onBlur: y,
3926
+ onKeyDown: (e) => {
3927
+ "Enter" === e.key && y();
3928
+ }
3929
+ }),
3930
+ ct(zt, {
3931
+ label: o("protectedRange.password"),
3932
+ size: "small",
3933
+ fullWidth: !0,
3934
+ disabled: n,
3935
+ type: "password",
3936
+ value: c,
3937
+ placeholder: g && !u ? o("protectedRange.passwordUnchanged") : void 0,
3938
+ helperText: o(u ? "protectedRange.passwordCleared" : "protectedRange.passwordHelp"),
3939
+ autoComplete: "new-password",
3940
+ onChange: (e) => {
3941
+ const o = e.target.value;
3942
+ p(o), m(!1), o ? qn.set(t, o) : qn.delete(t);
3943
+ },
3944
+ slotProps: { input: { startAdornment: g && !u ? ct(Dt, {
3945
+ position: "start",
3946
+ children: ct(fe, { iconKey: "Lock" })
3947
+ }) : void 0 } }
3948
+ }),
3949
+ g && !c ? ct(yt, {
3950
+ size: "small",
3951
+ color: "inherit",
3952
+ disabled: n || u,
3953
+ sx: {
3954
+ alignSelf: "flex-start",
3955
+ textTransform: "none"
3956
+ },
3957
+ onClick: () => {
3958
+ m(!0), qn.set(t, null);
3959
+ },
3960
+ children: o("protectedRange.removePassword")
3961
+ }) : null,
3962
+ t.getSecurityDescriptor() ? ct($t, {
3963
+ variant: "caption",
3964
+ sx: {
3965
+ color: "text.secondary",
3966
+ fontStyle: "italic"
3967
+ },
3968
+ children: o("protectedRange.hasPermissions")
3969
+ }) : null
3970
+ ]
3971
+ })]
3972
+ });
3973
+ });
3974
+ Hn.displayName = "ProtectedRangeEditorPanel";
3975
+ var Gn = {
3976
+ key: "protected-range",
3977
+ messageKeys: {
3978
+ none: eo("protectedRange.none"),
3979
+ addPrompt: eo("protectedRange.addPrompt"),
3980
+ heading: eo("protectedRange.heading"),
3981
+ insert: eo("protectedRange.insert"),
3982
+ new: eo("protectedRange.new"),
3983
+ edit: eo("protectedRange.edit"),
3984
+ duplicate: eo("protectedRange.duplicate"),
3985
+ delete: eo("protectedRange.delete"),
3986
+ cancel: eo("protectedRange.cancel"),
3987
+ save: eo("protectedRange.save")
3988
+ },
3989
+ getCollection: (e) => e.getProtectedRanges(),
3990
+ changeEvents: ["onProtectedRangesChange"],
3991
+ reorderable: !1,
3992
+ beforeSave: (e) => (async (e) => {
3993
+ if (!qn.has(e)) return;
3994
+ const t = qn.get(e);
3995
+ qn.delete(e), await e.setPassword(t);
3996
+ })(e),
3997
+ applyUpdate: (e, t) => {
3998
+ e.update(t);
3999
+ },
4000
+ getCardTitle: (e, t) => e.getName() || t("protectedRange.unnamed"),
4001
+ CardBody: ({ item: e }) => {
4002
+ const t = We();
4003
+ return e.hasPassword() ? ct($t, {
4004
+ variant: "caption",
4005
+ sx: {
4006
+ color: (e) => e.palette.text.secondary,
4007
+ fontStyle: "italic"
4008
+ },
4009
+ children: t("protectedRange.passwordRequired")
4010
+ }) : null;
4011
+ },
4012
+ EditorBody: ({ item: e }) => ct(Hn, { protectedRange: e })
4013
+ }, Qn = Ke(Le((e, t) => {
4014
+ const { workbook: o, ...n } = e;
4015
+ return ct(so, {
4016
+ ref: t,
4017
+ workbook: o,
4018
+ descriptor: Gn,
4019
+ ...n
4020
+ });
4021
+ }));
4022
+ Qn.displayName = "ProtectedRangeDetailsPanel";
4023
+ var Yn = (e) => {
4024
+ const { model: t, entryKey: o, frame: n, ref: r, ...a } = e;
4025
+ return ct(Qn, {
4026
+ ref: r,
4027
+ workbook: t,
4028
+ ...a
4029
+ });
4030
+ };
4031
+ l(), ye.register("plugin-table", { icons: {} }), $.registerTaskPane({
4032
+ key: "dataValidationDetails",
4033
+ getTitle: () => "Data Validation",
4034
+ getIcon: () => "DataValidation",
4035
+ component: Un
4036
+ }, !0), $.registerTaskPane({
4037
+ key: "conditionalFormatDetails",
4038
+ getTitle: () => "Conditional Formatting",
4039
+ getIcon: () => "FormatPaint",
4040
+ component: xn
4041
+ }, !0), $.registerTaskPane({
4042
+ key: "protectedRangeDetails",
4043
+ getTitle: () => "Allow Edit Ranges",
4044
+ getIcon: () => "Lock",
4045
+ component: Yn
4046
+ }, !0), a(), w();
4047
+ var Xn = () => {
4048
+ let e, t;
4049
+ const o = new Promise((o, n) => {
4050
+ e = o, t = n;
4051
+ }), n = {
4052
+ promise: o,
4053
+ settled: !1,
4054
+ resolve: (t) => {
4055
+ n.settled = !0, e(t);
4056
+ },
4057
+ reject: (e) => {
4058
+ n.settled = !0, t(e);
4059
+ }
4060
+ };
4061
+ return o.catch(() => {}), n;
4062
+ }, Jn = (e, t) => {
4063
+ if (!e) return {};
4064
+ const { colorSchemes: o, ...n } = e, r = o?.[t ? "dark" : "light"];
4065
+ return r && "object" == typeof r ? Ht.deepMerge(n, r) : n;
4066
+ }, Zn = "taskPanePosition", er = Ke(Le((e, t) => {
4067
+ const { className: o, sx: r, square: a, elevation: l, variant: s, style: d, onWorkbookLoad: p, onDocumentError: u, renderDocumentError: m = P, propsDocumentError: g, propsTaskPaneArea: y, renderTaskPaneArea: b = tr, taskPaneSide: x = "right", onKeyDown: v, workbook: C, onWorkbookChange: w, logo: S, topLeft: T, topRight: D, muiTheme: N, tokens: O, cssBaseline: I, autoFocus: M = !1, title: R, onDirtyChange: A, propsDocumentTitle: E, renderDocumentLoading: W = k, propsDocumentLoading: B, propsWorkbook: L, showFormulaBar: z, propsFormulaBar: j, renderFormulaBar: K, editable: V, showStatusBar: $, propsStatusBar: _, renderStatusBar: U, propsToolbar: q, renderToolbar: H, ...te } = e, oe = qe(null), ne = qe(null), re = qe(null), ae = De(() => {
4068
+ re.current?.getNamedCollectionEditorElement?.()?.focus?.();
4069
+ }, []), le = De(u ?? (() => {}), [u]), pe = De(A ?? (() => {}), [A]), be = E?.placeHolder, [xe] = Re(Q.Mode, void 0), { themeMode: ke } = Ae({ mode: xe ?? void 0 }), [we] = Re(ve.Active, null), Se = qe(we);
4070
+ Se.current = we;
4071
+ const Pe = Ee(), Ne = Ue(() => ({
4072
+ light: rt(!1, Ht.deepMerge(Jn(N, !1), F(Pe?.light))),
4073
+ dark: rt(!0, Ht.deepMerge(Jn(N, !0), F(Pe?.dark)))
4074
+ }), [
4075
+ N,
4076
+ Pe?.light,
4077
+ Pe?.dark
4078
+ ]), Ie = "dark" === ke, Me = Fe("studio", _e()), We = Ue(() => c(Ne.light, Ne.dark, `.${Me}`, O), [
4079
+ Ne,
4080
+ Me,
4081
+ O
4082
+ ]), Be = Ue(() => J("sxl-defaults", `.${Me}`), [Me]), Le = ie(), [ze, je] = He(() => C ?? null);
4083
+ $e(() => {
4084
+ je(C ?? null);
4085
+ }, [C]);
4086
+ const [Ke, Ge] = He(0), Qe = qe(null);
4087
+ Qe.current || (Qe.current = Xn());
4088
+ const Je = ce(ze, {
4089
+ io: Y,
4090
+ defaultTheme: Le.getDefaultTheme(),
4091
+ reloadKey: Ke
4092
+ }), Ze = "loaded" === Je.status ? Je.workbook : null, et = Ue(() => "error" === Je.status ? {
4093
+ status: "error",
4094
+ error: Je.error
4095
+ } : "loaded" === Je.status ? {
4096
+ status: "loaded",
4097
+ workbook: Je.workbook
4098
+ } : { status: "loading" }, [Je]);
4099
+ $e(() => {
4100
+ Qe.current.settled && (Qe.current = Xn());
4101
+ }, [ze, Ke]), $e(() => {
4102
+ "loaded" === et.status ? Qe.current.resolve(et.workbook) : "error" === et.status && (le?.(et.error), Qe.current.reject(et.error));
4103
+ }, [et]);
4104
+ const [ot, nt] = He(null);
4105
+ Ze && !ot && nt(Ze);
4106
+ const at = Ze && ot && Ze !== ot ? Ze : null, lt = qe(at);
4107
+ lt.current = at;
4108
+ const it = qe(ot);
4109
+ it.current = ot;
4110
+ const st = qe([]), ut = Ve((e) => {
4111
+ const t = it.current;
4112
+ t && st.current.push(t), je(e);
4113
+ }, []);
4114
+ $e(() => {
4115
+ const e = st.current;
4116
+ if (0 !== e.length) {
4117
+ st.current = e.filter((e) => e === ot);
4118
+ for (let t = 0; t < e.length; t++) {
4119
+ const o = e[t];
4120
+ if (o !== ot) try {
4121
+ o.close();
4122
+ } catch (e) {
4123
+ console.warn("Unable to close the replaced workbook", e);
4124
+ }
4125
+ }
4126
+ }
4127
+ }, [ot]);
4128
+ const mt = V ? null : ot, gt = de(), yt = Ue(() => mt ? Z(mt.getSelectedSheet(), { referenceMode: gt }) : null, [mt, gt]), bt = V ?? yt, ft = qe(bt);
4129
+ ft.current = bt, $e(() => {
4130
+ if (!bt) return;
4131
+ let e = bt.getSession();
4132
+ return bt.subscribe(() => {
4133
+ const t = e;
4134
+ e = bt.getSession(), t && !e && "formula-bar" === t.getActiveEditorId() && re.current?.contains?.(document.activeElement) && oe.current?.focus();
4135
+ });
4136
+ }, [bt]);
4137
+ const xt = me(ot), { isDirty: vt, saveState: kt } = ge(ot, Y), wt = ue(ot), St = qe(kt);
4138
+ St.current = kt;
4139
+ const Tt = Ve(() => St.current?.isDirty() ?? !1, []), Pt = qe(et);
4140
+ Pt.current = et;
4141
+ const [Ft, Dt] = He(null), Nt = R ?? E?.title, [Ot, It] = He(null);
4142
+ $e(() => {
4143
+ It(null);
4144
+ }, [ot]);
4145
+ const Mt = Nt ?? Ot ?? xt ?? "";
4146
+ $e(() => {
4147
+ pe?.(vt);
4148
+ }, [vt]);
4149
+ const At = De(w ?? (() => {}), [w]);
4150
+ $e(() => {
4151
+ At?.(Ze);
4152
+ }, [Ze]);
4153
+ const Et = qe(Ze);
4154
+ Et.current = Ze, se(ot, "onViewChange");
4155
+ const Bt = Ue(() => ct(Ye, {
4156
+ groupKey: "helpOptions",
4157
+ disableHover: !0,
4158
+ sx: { padding: "0" },
4159
+ propsButton: { sx: { maxHeight: "22px" } }
4160
+ }), []), [Lt, zt] = He(null), Kt = Ve((e) => {
4161
+ zt(e);
4162
+ }, []);
4163
+ $e(() => {
4164
+ ye.prefetch();
4165
+ }, []);
4166
+ const Vt = qe(null);
4167
+ Vt.current || (Vt.current = Xn());
4168
+ const $t = qe(null), _t = Ve(() => $t.current?.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? Vt.current.promise, []), Ut = De(async (e) => {
4169
+ const t = Se.current;
4170
+ t && t !== Qt.getActive() && await Qt.setActive(t), await he.DefaultCommandCatalogService.prefetch(t ?? void 0), Dt(e), $t.current = e.source, Vt.current.settled || Vt.current.resolve(e.source.getSheetElement()?.getGridSurface()?.getPane()?.getElement() ?? null), p?.(e);
4171
+ }, []), qt = qe(null), Gt = Ve((e) => {
4172
+ let t = null, o = {
4173
+ readOnly: !0,
4174
+ ...E
4175
+ };
4176
+ return E?.hidden || (t = ct(n, {
4177
+ ...o,
4178
+ style: {
4179
+ maxWidth: "100%",
4180
+ ...E?.style
4181
+ },
4182
+ workbook: e.workbook ?? oe.current,
4183
+ ref: qt,
4184
+ title: Mt,
4185
+ modified: vt,
4186
+ encrypted: wt,
4187
+ placeHolder: be,
4188
+ onTitleChange: (e) => {
4189
+ It(e), E?.onTitleChange?.(e);
4190
+ }
4191
+ })), ct(wn, {
4192
+ ...e,
4193
+ logo: S,
4194
+ mainElement: t,
4195
+ startElement: T,
4196
+ endElement: D
4197
+ });
4198
+ }, [
4199
+ S,
4200
+ Mt,
4201
+ vt,
4202
+ wt,
4203
+ E,
4204
+ T,
4205
+ D
4206
+ ]);
4207
+ $e(() => {
4208
+ const e = oe.current;
4209
+ if (!e) return;
4210
+ const t = (e) => e.preventDefault();
4211
+ return e.addEventListener("wheel", t, { passive: !1 }), () => {
4212
+ e.removeEventListener("wheel", t);
4213
+ };
4214
+ }, [Ft]);
4215
+ const [Yt, Xt] = He(null);
4216
+ $e(() => {
4217
+ Xt(Ft?.source?.getCommandScope?.() ?? null);
4218
+ }, [Ft]);
4219
+ const Jt = Ue(() => ({
4220
+ "& .SnackbarContainer-root": { position: "absolute !important" },
4221
+ "& .notistack-SnackbarContainer > div": { maxWidth: "min(100%, 720px)" },
4222
+ "& .notistack-Snackbar": { minWidth: "unset" },
4223
+ "& .notistack-Snackbar > .error-snackbar .MuiTypography-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
4224
+ "& .notistack-Snackbar > .error-snackbar .MuiCardActions-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
4225
+ "& .notistack-Snackbar > .error-snackbar .MuiButtonBase-root": { color: (e) => e.palette.getContrastText(e.palette.error.main) },
4226
+ "& .notistack-MuiContent *": { fontFamily: (e) => e.typography.fontFamily },
4227
+ "& #notistack-snackbar": {
4228
+ maxWidth: "560px",
4229
+ whiteSpace: "pre-wrap"
4230
+ },
4231
+ "*": { userSelect: "none" },
4232
+ ...r
4233
+ }), [r]), [Zt, eo] = He(null), [, to] = Re(null, !1);
4234
+ $e(() => {
4235
+ to(null != Zt);
4236
+ }, [Zt, to]);
4237
+ const ro = Ve((e) => b({
4238
+ model: ot,
4239
+ side: x,
4240
+ ...e,
4241
+ ...y
4242
+ }), [
4243
+ ot,
4244
+ x,
4245
+ y
4246
+ ]), ao = Oe(t, () => ({
4247
+ isStudioElement: () => !0,
4248
+ getWorkbookElement: () => oe.current,
4249
+ getWorkbook: () => Et.current ?? null,
4250
+ isDirty: () => St.current?.isDirty() ?? !1,
4251
+ getEditable: () => ft.current,
4252
+ getFormulaBarElement: () => re.current ?? null,
4253
+ focus: () => oe.current?.focus(),
4254
+ whenReady: () => (Qe.current || (Qe.current = Xn()), Qe.current.promise),
4255
+ getWorkbookState: () => Pt.current,
4256
+ retry: () => Ge((e) => e + 1)
4257
+ }), []), io = qe(!1), so = De((e, t) => {
4258
+ t === lt.current && requestAnimationFrame(() => requestAnimationFrame(() => {
4259
+ t === lt.current && (io.current = ao.current?.contains(document.activeElement) ?? !0, nt(t), Ut(e));
4260
+ }));
4261
+ }, []);
4262
+ $e(() => {
4263
+ io.current && (io.current = !1, oe.current?.focus());
4264
+ }, [ot]);
4265
+ const co = Ve(() => ct(dt, {}), []), po = Ve((e) => {
4266
+ const { ref: t, ...o } = e, n = Ie ? Ne.dark : Ne.light, d = "error" === et.status ? m({
4267
+ ...g,
4268
+ style: {
4269
+ width: "100%",
4270
+ height: "100%",
4271
+ ...g?.style
4272
+ },
4273
+ error: et.error
4274
+ }) : null;
4275
+ if (d && !ot) return ct(Rt, {
4276
+ sx: r,
4277
+ style: {
4278
+ width: "100%",
4279
+ height: "100%",
4280
+ position: "absolute",
4281
+ display: "flex",
4282
+ alignItems: "stretch",
4283
+ justifyContent: "stretch"
4284
+ },
4285
+ children: d
4286
+ });
4287
+ let c = null;
4288
+ if (ot) {
4289
+ const e = ot, r = e.getView(), a = z ?? r?.isShowFormulaBar(), l = $ ?? r?.isShowStatusBar(), s = Ft?.source ?? oe.current, d = (H ?? Gt)({
4290
+ workbook: s,
4291
+ ...q
4292
+ }), p = a ? (K ?? f)({
4293
+ ref: re,
4294
+ style: {
4295
+ marginTop: n.spacing(.25),
4296
+ marginLeft: n.spacing(1),
4297
+ marginRight: n.spacing(1),
4298
+ marginBottom: n.spacing(.75)
4299
+ },
4300
+ workbook: e,
4301
+ editable: bt ?? void 0,
4302
+ ...j,
4303
+ propsNamedCollectionEditor: {
4304
+ restoreFocus: (e) => s?.focus(e),
4305
+ ...j?.propsNamedCollectionEditor
4306
+ }
4307
+ }) : null, u = l ? (U ?? h)({
4308
+ childrenEnd: Bt,
4309
+ ..._
4310
+ }) : null, m = (e, n) => ct(i, {
4311
+ ...L,
4312
+ tabIndex: 0,
4313
+ autoFocus: !n && M,
4314
+ workbook: e,
4315
+ editable: n ? void 0 : bt ?? void 0,
4316
+ focusNameBox: n ? void 0 : ae,
4317
+ ref: n ? ne : no([t, oe]),
4318
+ onWorkbookLoad: n ? (t) => so(t, e) : Ut,
4319
+ onKeyDown: (e) => {
4320
+ v?.(e);
4321
+ },
4322
+ propsWorkbookLoading: B,
4323
+ renderWorkbookLoading: co,
4324
+ style: n ? {
4325
+ ...L?.style,
4326
+ position: "absolute",
4327
+ inset: 0,
4328
+ visibility: "hidden"
4329
+ } : {
4330
+ flex: "1 1 100%",
4331
+ minHeight: 0,
4332
+ ...L?.style
4333
+ },
4334
+ onContextMenu: (e) => e.preventDefault(),
4335
+ ...n ? null : o
4336
+ }, e.getId());
4337
+ c = pt("div", {
4338
+ style: {
4339
+ display: "flex",
4340
+ flexDirection: "column",
4341
+ flex: "1 1 100%",
4342
+ minWidth: 0,
4343
+ minHeight: 0,
4344
+ ...ee({
4345
+ window: n.palette.background.default,
4346
+ windowText: n.palette.text.primary
4347
+ })
4348
+ },
4349
+ children: [
4350
+ d,
4351
+ p,
4352
+ ct(Kn, {
4353
+ taskSide: x,
4354
+ persistKey: Zn,
4355
+ sidebarElement: Zt ? ct(he.CommandScopeProvider, {
4356
+ scope: Yt,
4357
+ children: Zt
4358
+ }) : void 0,
4359
+ mainElement: pt("div", {
4360
+ style: {
4361
+ position: "relative",
4362
+ display: "flex",
4363
+ flexDirection: "column",
4364
+ flex: "1 1 100%",
4365
+ minWidth: 0,
4366
+ minHeight: 0
4367
+ },
4368
+ children: [[m(ot, !1), at ? m(at, !0) : null], ct(ht, {
4369
+ ref: Kt,
4370
+ sx: {
4371
+ position: "absolute",
4372
+ top: "10%",
4373
+ left: 0,
4374
+ right: 0,
4375
+ bottom: 0,
4376
+ pointerEvents: "none",
4377
+ "& > :first-of-type": { position: "relative" }
4378
+ }
4379
+ })]
4380
+ })
4381
+ }),
4382
+ u
4383
+ ]
4384
+ });
4385
+ }
4386
+ const p = Ft ? null : W({ ...B });
4387
+ return pt(Rt, {
4388
+ sx: Jt,
4389
+ style: {
4390
+ width: "100%",
4391
+ height: "100%",
4392
+ position: "absolute",
4393
+ display: "flex",
4394
+ alignItems: "stretch",
4395
+ justifyContent: "stretch",
4396
+ backgroundColor: "var(--sxl-color-base-200)"
4397
+ },
4398
+ className: "eager-studio",
4399
+ square: a,
4400
+ elevation: l,
4401
+ variant: s,
4402
+ children: [
4403
+ c,
4404
+ d ? ct(Rt, {
4405
+ style: {
4406
+ position: "absolute",
4407
+ inset: 0,
4408
+ display: "flex",
4409
+ alignItems: "stretch",
4410
+ justifyContent: "stretch"
4411
+ },
4412
+ children: d
4413
+ }) : null,
4414
+ p ? ct("div", {
4415
+ style: {
4416
+ position: "absolute",
4417
+ inset: 0,
4418
+ display: "flex",
4419
+ alignItems: "center",
4420
+ justifyContent: "center",
4421
+ background: `var(--sxl-color-base-100, ${Ie ? "#121212" : "#fff"})`
4422
+ },
4423
+ children: p
4424
+ }) : null
4425
+ ]
4426
+ });
4427
+ }, [
4428
+ et,
4429
+ ot,
4430
+ at,
4431
+ Ft,
4432
+ Mt,
4433
+ W,
4434
+ B,
4435
+ co,
4436
+ L,
4437
+ te,
4438
+ a,
4439
+ l,
4440
+ s,
4441
+ Bt,
4442
+ m,
4443
+ g,
4444
+ Gt,
4445
+ Jt,
4446
+ Zt,
4447
+ x,
4448
+ Yt,
4449
+ z,
4450
+ j,
4451
+ K,
4452
+ bt,
4453
+ $,
4454
+ _,
4455
+ U,
4456
+ q,
4457
+ H,
4458
+ Ne,
4459
+ Ie
4460
+ ]);
4461
+ let uo = ct(lo, {
4462
+ maxSnack: 3,
4463
+ domRoot: Lt ?? void 0,
4464
+ anchorOrigin: {
4465
+ vertical: "bottom",
4466
+ horizontal: "right"
4467
+ },
4468
+ autoHideDuration: 3500,
4469
+ onClose: (e, t, o) => {
4470
+ oe.current?.focus();
4471
+ },
4472
+ Components: { error: kn },
4473
+ iconVariant: {
4474
+ success: ct(Wt, {
4475
+ style: { marginRight: "8px" },
4476
+ children: ct("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" })
4477
+ }),
4478
+ error: ct(fe, {
4479
+ iconKey: "ErrorAlert",
4480
+ style: { marginRight: "8px" }
4481
+ })
4482
+ },
4483
+ children: ct(X, {
4484
+ workbook: ot,
4485
+ children: ct(G, {
4486
+ renderArea: ro,
4487
+ onUpdateArea: (e) => {
4488
+ eo(e);
4489
+ },
4490
+ children: ct(tt, { children: ct(Rn, { children: ct(Te, { children: ct(Ce, { children: ct(On, {
4491
+ workbook: ot,
4492
+ initialCommandAnchor: _t,
4493
+ renderWorkbook: po,
4494
+ setWorkbook: ut,
4495
+ titleWorkbook: Mt,
4496
+ setWorkbookTitle: It,
4497
+ refDocumentTitle: qt,
4498
+ isDirty: Tt
4499
+ }) }) }) }) })
4500
+ })
4501
+ })
4502
+ });
4503
+ return uo = pt(jt, {
4504
+ theme: Ie ? Ne.dark : Ne.light,
4505
+ children: [I ? ct(Ct, {}) : null, pt("div", {
4506
+ ref: ao,
4507
+ className: oo("sheetxl-studio", Me, o),
4508
+ "data-sxl-theme-mode": Ie ? "dark" : "light",
4509
+ style: {
4510
+ display: "flex",
4511
+ flexDirection: "column",
4512
+ flex: "1 1 100%",
4513
+ width: "100%",
4514
+ height: "100%",
4515
+ minWidth: 0,
4516
+ minHeight: 0,
4517
+ position: "relative",
4518
+ ...d
4519
+ },
4520
+ ...te,
4521
+ children: [
4522
+ ct("style", { children: We }),
4523
+ ct("style", { children: Be }),
4524
+ ct(Xe, {
4525
+ themeScopeClass: Me,
4526
+ themeSurface: "app",
4527
+ themeMode: ke,
4528
+ children: uo
4529
+ })
4530
+ ]
4531
+ })]
4532
+ }), uo;
4533
+ }));
4534
+ er.displayName = "EagerStudio";
4535
+ var tr = (e) => ct(Bn, { ...e });
4536
+ export { er as EagerStudio, er as default };