@nxgt/material 3.75.0 → 3.76.0

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 (239) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +37 -1
  3. package/dist/{alert-dialog-BfO_ri-N.js → alert-dialog-653apk3f.js} +8 -7
  4. package/dist/{async-slice-roMAJVzG.js → async-slice-CXLbQuOc.js} +1 -1
  5. package/dist/{bubble-input-B7BVd9fX.js → bubble-input-CQwVSoU3.js} +30 -29
  6. package/dist/{button-DgenqmpS.js → button-3op3rtZh.js} +5 -4
  7. package/dist/calculator-BaSMe0SK.js +1189 -0
  8. package/dist/calculator-announce-DRd2c6Dq.js +89 -0
  9. package/dist/calculator-context-BugcKuVG.js +10 -0
  10. package/dist/calculator-field.js +172 -0
  11. package/dist/calculator-panel-announce-AZSnZUSr.js +29 -0
  12. package/dist/calculator-segment-BlJE1LaS.js +22 -0
  13. package/dist/calculator.js +2 -0
  14. package/dist/charts.js +3 -3
  15. package/dist/{chip-CiDczNxO.js → chip-MuKDwtkG.js} +2 -2
  16. package/dist/{code-editor-CohlhFsA.js → code-editor-Bp2RrdNx.js} +13 -13
  17. package/dist/code-editor.js +37 -37
  18. package/dist/{code-language-items-Cs8GLYDp.js → code-language-items-B7WR5ua_.js} +19 -24
  19. package/dist/components/base-content.css +9 -4
  20. package/dist/components/ui/collections/server-table/server-table-phone-row.css +10 -3
  21. package/dist/{components-zJdfH4im.js → components-Ci3Zo8kC.js} +15837 -17245
  22. package/dist/components.js +37 -28
  23. package/dist/conversion-variant-BDFAxqe9.js +529 -0
  24. package/dist/copy-to-clipboard-Be5Ffvs_.js +7 -0
  25. package/dist/currency-B-r3ig11.js +16 -0
  26. package/dist/currency-field-BJ9rSrif.js +285 -0
  27. package/dist/{number.utils-BG_eEt5g.js → date.utils-DUvqcjan.js} +1 -7
  28. package/dist/dialog-Bm5LvVlB.js +166 -0
  29. package/dist/dist-BZe2evxL.js +139 -0
  30. package/dist/dist-CxhKjOYm.js +28 -0
  31. package/dist/dist-DHdUUM1w.js +241 -0
  32. package/dist/{dist-C4wtXCjf.js → dist-DOK3zo5C.js} +33 -32
  33. package/dist/dist-DWZXlCZR.js +182 -0
  34. package/dist/dist-DkQbkF9T.js +33 -0
  35. package/dist/dnd.js +1 -1
  36. package/dist/{dropdown-menu-CzR6JP31.js → dropdown-menu-xlZ6NYUA.js} +160 -159
  37. package/dist/editor.js +299 -298
  38. package/dist/{empty-state-DjHGMp5F.js → empty-state-C0kviQdW.js} +2 -2
  39. package/dist/{field-blur-CdASxjL7.js → field-blur-DkiZOVNV.js} +178 -180
  40. package/dist/{field-blur-context-kZ4SD7xu.js → field-blur-context-BLGgf_3z.js} +2 -2
  41. package/dist/financial-variant-BsZEa5sF.js +459 -0
  42. package/dist/{hooks-Dqq8O3Az.js → hooks-Dg94jPRq.js} +12 -12
  43. package/dist/hooks.js +2 -2
  44. package/dist/{hover-card-BPKqte4a.js → hover-card-B1g55Hi6.js} +44 -43
  45. package/dist/i18n.js +3 -3
  46. package/dist/icon-badge-BcW66bRk.js +17 -0
  47. package/dist/{icon-button-Cr-DyDGg.js → icon-button-Cogxy1cy.js} +5 -4
  48. package/dist/{in-dialog-Vwkyp-M5.js → in-dialog-D61Yeaol.js} +2 -1
  49. package/dist/input-CC2joTjB.js +56 -0
  50. package/dist/key-layout-cR79xfGE.js +38 -0
  51. package/dist/lib/calculator/index.d.ts +16 -0
  52. package/dist/lib/calculator-field/index.d.ts +12 -0
  53. package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +2 -2
  54. package/dist/lib/components/ui/feedback/moment/moment-body.d.ts +17 -2
  55. package/dist/lib/components/ui/feedback/moment/moment-passive.d.ts +13 -0
  56. package/dist/lib/components/ui/feedback/moment/moment.d.ts +16 -2
  57. package/dist/lib/components/ui/fields/calculator-field/apply-calculated.d.ts +17 -0
  58. package/dist/lib/components/ui/fields/calculator-field/calculator-field-content.d.ts +16 -0
  59. package/dist/lib/components/ui/fields/calculator-field/calculator-field-trigger.d.ts +4 -0
  60. package/dist/lib/components/ui/fields/calculator-field/calculator-field.d.ts +12 -0
  61. package/dist/lib/components/ui/fields/calculator-field/calculator-field.types.d.ts +31 -0
  62. package/dist/lib/components/ui/fields/calculator-field/calculator-form-field.d.ts +4 -0
  63. package/dist/lib/components/ui/fields/calculator-field/index.d.ts +3 -0
  64. package/dist/lib/components/ui/fields/calculator-field/use-calculator-field.d.ts +15 -0
  65. package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
  66. package/dist/lib/components/ui/fields/currency-field/currency-field.d.ts +7 -1
  67. package/dist/lib/components/ui/layout/app-shell/app-sidebar-context.d.ts +4 -0
  68. package/dist/lib/components/ui/widgets/calculator/calculator-announce.d.ts +27 -0
  69. package/dist/lib/components/ui/widgets/calculator/calculator-clipboard.d.ts +19 -0
  70. package/dist/lib/components/ui/widgets/calculator/calculator-context.d.ts +49 -0
  71. package/dist/lib/components/ui/widgets/calculator/calculator-feedback.d.ts +18 -0
  72. package/dist/lib/components/ui/widgets/calculator/calculator-keyboard.d.ts +30 -0
  73. package/dist/lib/components/ui/widgets/calculator/calculator-storage.d.ts +17 -0
  74. package/dist/lib/components/ui/widgets/calculator/calculator-variant-steps.d.ts +16 -0
  75. package/dist/lib/components/ui/widgets/calculator/calculator.d.ts +11 -0
  76. package/dist/lib/components/ui/widgets/calculator/calculator.selectors.d.ts +23 -0
  77. package/dist/lib/components/ui/widgets/calculator/calculator.slice.d.ts +1881 -0
  78. package/dist/lib/components/ui/widgets/calculator/currency.d.ts +9 -0
  79. package/dist/lib/components/ui/widgets/calculator/engine.d.ts +22 -0
  80. package/dist/lib/components/ui/widgets/calculator/index.d.ts +3 -0
  81. package/dist/lib/components/ui/widgets/calculator/partials/calculator-announcer.d.ts +2 -0
  82. package/dist/lib/components/ui/widgets/calculator/partials/calculator-display.d.ts +3 -0
  83. package/dist/lib/components/ui/widgets/calculator/partials/calculator-key.d.ts +17 -0
  84. package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +8 -0
  85. package/dist/lib/components/ui/widgets/calculator/partials/calculator-loading.d.ts +6 -0
  86. package/dist/lib/components/ui/widgets/calculator/partials/calculator-memory.d.ts +2 -0
  87. package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-announce.d.ts +10 -0
  88. package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-body.d.ts +9 -0
  89. package/dist/lib/components/ui/widgets/calculator/partials/calculator-screen.d.ts +4 -0
  90. package/dist/lib/components/ui/widgets/calculator/partials/calculator-segment.d.ts +21 -0
  91. package/dist/lib/components/ui/widgets/calculator/partials/calculator-shell.d.ts +9 -0
  92. package/dist/lib/components/ui/widgets/calculator/partials/calculator-switcher.d.ts +5 -0
  93. package/dist/lib/components/ui/widgets/calculator/partials/calculator-tape.d.ts +4 -0
  94. package/dist/lib/components/ui/widgets/calculator/partials/calculator-tools.d.ts +4 -0
  95. package/dist/lib/components/ui/widgets/calculator/partials/keypad-navigation.d.ts +24 -0
  96. package/dist/lib/components/ui/widgets/calculator/types.d.ts +102 -0
  97. package/dist/lib/components/ui/widgets/calculator/use-calculator-clipboard.d.ts +19 -0
  98. package/dist/lib/components/ui/widgets/calculator/use-calculator-conversion.d.ts +4 -0
  99. package/dist/lib/components/ui/widgets/calculator/use-calculator-feedback.d.ts +3 -0
  100. package/dist/lib/components/ui/widgets/calculator/use-calculator-keyboard.d.ts +22 -0
  101. package/dist/lib/components/ui/widgets/calculator/use-calculator-persistence.d.ts +14 -0
  102. package/dist/lib/components/ui/widgets/calculator/use-calculator-pos.d.ts +25 -0
  103. package/dist/lib/components/ui/widgets/calculator/use-calculator-press.d.ts +26 -0
  104. package/dist/lib/components/ui/widgets/calculator/use-calculator-tape.d.ts +29 -0
  105. package/dist/lib/components/ui/widgets/calculator/use-calculator-value.d.ts +9 -0
  106. package/dist/lib/components/ui/widgets/calculator/use-calculator-variant.d.ts +23 -0
  107. package/dist/lib/components/ui/widgets/calculator/use-calculator.d.ts +10 -0
  108. package/dist/lib/components/ui/widgets/calculator/use-engine-settings.d.ts +10 -0
  109. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-fields.d.ts +19 -0
  110. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-labels.d.ts +17 -0
  111. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-math.d.ts +31 -0
  112. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-names.d.ts +4 -0
  113. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-panel.d.ts +7 -0
  114. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-rates.d.ts +29 -0
  115. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-result.d.ts +15 -0
  116. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-state.d.ts +36 -0
  117. package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-variant.d.ts +3 -0
  118. package/dist/lib/components/ui/widgets/calculator/variants/conversion/use-conversion.d.ts +24 -0
  119. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-change.d.ts +4 -0
  120. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-figures.d.ts +43 -0
  121. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-format.d.ts +12 -0
  122. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan-math.d.ts +14 -0
  123. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan.d.ts +4 -0
  124. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-margin.d.ts +4 -0
  125. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-math.d.ts +10 -0
  126. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-panel.d.ts +7 -0
  127. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-parts.d.ts +35 -0
  128. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-table.d.ts +7 -0
  129. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-variant.d.ts +3 -0
  130. package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-vat.d.ts +4 -0
  131. package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +51 -0
  132. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-announce.d.ts +16 -0
  133. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-aside.d.ts +2 -0
  134. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-display.d.ts +2 -0
  135. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-fields.d.ts +2 -0
  136. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-layout.d.ts +9 -0
  137. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-line.d.ts +6 -0
  138. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-names.d.ts +2 -0
  139. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-state.d.ts +3 -0
  140. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-tender.d.ts +2 -0
  141. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket-data.d.ts +41 -0
  142. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket.d.ts +5 -0
  143. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-totals.d.ts +2 -0
  144. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-types.d.ts +76 -0
  145. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-variant.d.ts +3 -0
  146. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-vat.d.ts +2 -0
  147. package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-view.d.ts +28 -0
  148. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.d.ts +19 -0
  149. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-base.d.ts +11 -0
  150. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-bitpad.d.ts +14 -0
  151. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-display.d.ts +9 -0
  152. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-layout.d.ts +6 -0
  153. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-names.d.ts +2 -0
  154. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.d.ts +14 -0
  155. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-reduce.d.ts +29 -0
  156. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-state.d.ts +22 -0
  157. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-toolbar.d.ts +5 -0
  158. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-variant.d.ts +3 -0
  159. package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-word.d.ts +15 -0
  160. package/dist/lib/components/ui/widgets/calculator/variants/registry.d.ts +21 -0
  161. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-layout.d.ts +3 -0
  162. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-names.d.ts +2 -0
  163. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-toolbar.d.ts +2 -0
  164. package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-variant.d.ts +3 -0
  165. package/dist/lib/components/ui/widgets/calculator/variants/standard/standard-layout.d.ts +3 -0
  166. package/dist/lib/components/ui/widgets/calculator/variants/variant-loader.d.ts +34 -0
  167. package/dist/lib/components/ui/widgets/calculator/variants/variant-logic.d.ts +40 -0
  168. package/dist/lib/components/ui/widgets/calculator/variants/variant-types.d.ts +62 -0
  169. package/dist/lib/i18n/resources/en/en.d.ts +412 -0
  170. package/dist/lib/i18n/resources/en/material.json.d.ts +412 -0
  171. package/dist/lib/i18n/resources/fr/fr.d.ts +412 -0
  172. package/dist/lib/i18n/resources/fr/material.json.d.ts +412 -0
  173. package/dist/lib/i18n/resources/resources.d.ts +824 -0
  174. package/dist/lib/i18n/translator.d.ts +1 -1
  175. package/dist/lib.js +4 -3
  176. package/dist/main.js +50 -40
  177. package/dist/map.js +66 -65
  178. package/dist/material.css +1 -1
  179. package/dist/native-select-w_FlBLHV.js +40 -0
  180. package/dist/number.utils-CSueQZcv.js +7 -0
  181. package/dist/pdf-reader.js +1 -1
  182. package/dist/percent-field-lahyDJDG.js +14 -0
  183. package/dist/picker-surface-CV09H7Nb.js +1220 -0
  184. package/dist/popover-Cd7DkND4.js +233 -0
  185. package/dist/pos-types-DKCkOTYy.js +49 -0
  186. package/dist/pos-variant-GrUfbTTP.js +603 -0
  187. package/dist/print.js +1 -1
  188. package/dist/programmer-variant-eKJNKENL.js +501 -0
  189. package/dist/programmer-word-CNCF7DJF.js +15 -0
  190. package/dist/{public-DC9VQw4Z.js → public-y6g4ddxd.js} +895 -892
  191. package/dist/{rich-code-block-DBSL9zEN.js → rich-code-block-CRQ0iyLb.js} +5 -5
  192. package/dist/scientific-variant-2y3UxAAU.js +149 -0
  193. package/dist/{sortable-provider-C4tk5esY.js → sortable-provider-DdiI3Fwk.js} +2 -2
  194. package/dist/{spinner-B2MubVWb.js → spinner-C1QIewWv.js} +133 -159
  195. package/dist/standard-layout-BuSRr3TY.js +40 -0
  196. package/dist/tabs-DzEqMb1W.js +383 -0
  197. package/dist/{icon-badge-B9uvDoyY.js → text-field-BAdY-kpO.js} +20 -34
  198. package/dist/theme-picker.js +3 -3
  199. package/dist/{theme-toggle-BInlu21G.js → theme-toggle-C_VeiiCm.js} +2 -2
  200. package/dist/toggle-FeCCJqbg.js +40 -0
  201. package/dist/{toggle-group-DXXlqid2.js → toggle-group-CVMxEpWi.js} +1 -1
  202. package/dist/{toolbar-items-CRJSx1MU.js → toolbar-items-D310xDuM.js} +333 -554
  203. package/dist/{translate-material-pVlPJ1v4.js → translate-material-BypJJ1l5.js} +1 -1
  204. package/dist/{translator-BoYCward.js → translator-DJkf4J7t.js} +824 -0
  205. package/dist/{typography-B6YMbCge.js → typography-CYEquVeb.js} +1 -1
  206. package/dist/{use-chat-composer-BvWQogJe.js → use-chat-composer-DMXu9E1O.js} +4198 -4600
  207. package/dist/{use-heading-spy-B_Z4ArDh.js → use-heading-spy-DJR8YYm6.js} +19 -19
  208. package/dist/{use-material-translation-CIS2n3RB.js → use-material-translation-CD6QoVal.js} +1 -1
  209. package/dist/{use-return-focus-DNQtADAR.js → use-return-focus-Cevw_6yq.js} +106 -105
  210. package/dist/useLatest-C2PnQEeD.js +8 -0
  211. package/docs/README.md +1 -0
  212. package/docs/components/feedback-and-status.md +10 -1
  213. package/docs/components/form-fields.md +1 -0
  214. package/docs/components/rich-widgets.md +108 -0
  215. package/docs/getting-started.md +1 -0
  216. package/docs/guides/calculator.md +468 -0
  217. package/docs/guides/forms.md +4 -2
  218. package/docs/guides/i18n.md +5 -0
  219. package/docs/previews/rich-widgets-calculator-conversion.webp +0 -0
  220. package/docs/previews/rich-widgets-calculator-point-of-sale.webp +0 -0
  221. package/docs/previews/rich-widgets-calculator.webp +0 -0
  222. package/docs/roadmap.md +9 -3
  223. package/docs/troubleshooting.md +134 -0
  224. package/lib/components/base-content.css +9 -4
  225. package/lib/components/ui/collections/server-table/server-table-phone-row.css +10 -3
  226. package/lib/components/ui/widgets/calculator/calculator-bands.css +146 -0
  227. package/lib/components/ui/widgets/calculator/calculator-display.css +83 -0
  228. package/lib/components/ui/widgets/calculator/calculator-keys.css +118 -0
  229. package/lib/components/ui/widgets/calculator/calculator-pos-ticket.css +185 -0
  230. package/lib/components/ui/widgets/calculator/calculator-pos.css +38 -0
  231. package/lib/components/ui/widgets/calculator/calculator-tape.css +71 -0
  232. package/lib/components/ui/widgets/calculator/calculator.css +97 -0
  233. package/lib/components/ui/widgets/calculator/variants/conversion/conversion.css +98 -0
  234. package/lib/components/ui/widgets/calculator/variants/financial/financial.css +162 -0
  235. package/lib/components/ui/widgets/calculator/variants/programmer/programmer.css +162 -0
  236. package/package.json +17 -3
  237. package/dist/dialog-AGsB3bv4.js +0 -219
  238. package/dist/dist-B7RjY7SL.js +0 -158
  239. package/dist/dist-lmHmz_bu.js +0 -419
@@ -0,0 +1,1189 @@
1
+ import { t as e } from "./utils-BLfntITJ.js";
2
+ import { n as t, r as n, t as r, u as i } from "./tabs-DzEqMb1W.js";
3
+ import { t as a } from "./button-3op3rtZh.js";
4
+ import { t as o } from "./use-material-translation-CD6QoVal.js";
5
+ import { t as s } from "./icon-button-Cogxy1cy.js";
6
+ import { t as c } from "./copy-to-clipboard-Be5Ffvs_.js";
7
+ import { t as l } from "./useEvent-2fKq-6w8.js";
8
+ import { t as u } from "./useLatest-C2PnQEeD.js";
9
+ import { n as d } from "./use-slice-reducer-BGkeGtML.js";
10
+ import { t as f } from "./skeleton-DSdtr2qc.js";
11
+ import { t as p } from "./live-status-BGPaN8r8.js";
12
+ import { n as m, t as h } from "./calculator-context-BugcKuVG.js";
13
+ import { a as g, c as _, i as v, l as y, n as b, o as ee, r as te, s as ne } from "./calculator-announce-DRd2c6Dq.js";
14
+ import { i as re, t as ie } from "./pos-types-DKCkOTYy.js";
15
+ import { a as ae, r as oe } from "./key-layout-cR79xfGE.js";
16
+ import { n as x, r as se, t as ce } from "./programmer-word-CNCF7DJF.js";
17
+ import { t as le } from "./standard-layout-BuSRr3TY.js";
18
+ import { useCallback as S, useEffect as C, useId as w, useMemo as T, useRef as E, useState as ue, useSyncExternalStore as de } from "react";
19
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
20
+ import { ClipboardPaste as fe, Copy as pe, History as me, Trash2 as he } from "lucide-react";
21
+ import { createSlice as ge } from "@reduxjs/toolkit";
22
+ import { currencyFractionDigits as _e } from "@nxgt/material-core/currency-digits";
23
+ import { EMPTY_SESSION as A, calculate as ve, formatDecimal as j, formatExpression as M, historyEntry as N, keyFromEvent as P, localeSeparators as F, normaliseExpression as ye, parseDecimal as I, parseStoredHistory as be, press as L, pushHistory as xe, serializeHistory as Se, sessionOptions as Ce, toCanonical as R } from "@nxgt/material-core/calculator";
24
+ //#region lib/components/ui/widgets/calculator/partials/calculator-announcer.tsx
25
+ function we() {
26
+ let { t: e } = o(), { state: t } = m(), n = t.announcement;
27
+ return /* @__PURE__ */ O(p, {
28
+ slot: "calculator-status",
29
+ children: n ? e(n.key, n.fallback, n.values) : null
30
+ });
31
+ }
32
+ //#endregion
33
+ //#region lib/components/ui/widgets/calculator/partials/calculator-memory.tsx
34
+ function Te() {
35
+ let { t: e } = o(), { hasMemory: t, state: n, locale: r } = m();
36
+ if (!t) return null;
37
+ let i = v(n.session.memory, r);
38
+ return /* @__PURE__ */ k("span", {
39
+ "data-slot": "calculator-memory",
40
+ className: "nxgt-calc-memory bg-primary-container text-foreground",
41
+ children: [/* @__PURE__ */ O("span", {
42
+ "aria-hidden": "true",
43
+ children: "M"
44
+ }), /* @__PURE__ */ O("span", {
45
+ className: "sr-only",
46
+ children: e("material.calculator.display.memory", "Memory {value}", { value: i })
47
+ })]
48
+ });
49
+ }
50
+ //#endregion
51
+ //#region lib/components/ui/widgets/calculator/partials/calculator-tools.tsx
52
+ function Ee({ tapeId: e }) {
53
+ let { t } = o(), { display: n, copy: r, paste: i, toggleTape: a, state: c, toggleRef: l } = m();
54
+ return /* @__PURE__ */ k("div", {
55
+ className: "nxgt-calc-tools",
56
+ children: [
57
+ /* @__PURE__ */ O(Te, {}),
58
+ /* @__PURE__ */ O("span", { className: "nxgt-calc-grow" }),
59
+ /* @__PURE__ */ O(s, {
60
+ size: "sm",
61
+ variant: "ghost",
62
+ className: "nxgt-calc-tool",
63
+ "aria-label": t("material.calculator.copy", "Copy result"),
64
+ disabled: n.value === "",
65
+ onClick: r,
66
+ children: /* @__PURE__ */ O(pe, {})
67
+ }),
68
+ /* @__PURE__ */ O(s, {
69
+ size: "sm",
70
+ variant: "ghost",
71
+ className: "nxgt-calc-tool",
72
+ "aria-label": t("material.calculator.paste", "Paste an expression"),
73
+ onClick: i,
74
+ children: /* @__PURE__ */ O(fe, {})
75
+ }),
76
+ /* @__PURE__ */ O(s, {
77
+ ref: l,
78
+ size: "sm",
79
+ variant: "ghost",
80
+ className: "nxgt-calc-tool nxgt-calc-tape-toggle",
81
+ "aria-label": c.tapeOpen ? t("material.calculator.tape.hide", "Hide history") : t("material.calculator.tape.show", "Show history"),
82
+ "aria-expanded": c.tapeOpen,
83
+ "aria-controls": e,
84
+ onClick: a,
85
+ children: /* @__PURE__ */ O(me, {})
86
+ })
87
+ ]
88
+ });
89
+ }
90
+ //#endregion
91
+ //#region lib/components/ui/widgets/calculator/partials/calculator-display.tsx
92
+ function De({ tapeId: e }) {
93
+ return /* @__PURE__ */ k("div", {
94
+ "data-slot": "calculator-display",
95
+ className: "nxgt-calc-display bg-muted",
96
+ children: [/* @__PURE__ */ O(Ee, { tapeId: e }), /* @__PURE__ */ O(re, {})]
97
+ });
98
+ }
99
+ //#endregion
100
+ //#region lib/components/ui/widgets/calculator/partials/calculator-key.tsx
101
+ var Oe = {
102
+ digit: "bg-muted text-foreground",
103
+ operator: "bg-secondary-container text-foreground",
104
+ equals: "bg-primary text-primary-foreground",
105
+ utility: "bg-tertiary-container text-foreground",
106
+ function: "bg-muted text-foreground",
107
+ memory: "bg-muted text-foreground",
108
+ bracket: "bg-muted text-foreground"
109
+ };
110
+ function ke({ def: t, row: n, index: r, tabIndex: i, decimal: a, unavailable: s, onPress: c, onFocus: l, buttonRef: u }) {
111
+ let { t: d } = o();
112
+ return /* @__PURE__ */ O("button", {
113
+ ref: u,
114
+ type: "button",
115
+ "data-slot": "calculator-key",
116
+ "data-key": t.id,
117
+ "data-role": t.role,
118
+ "data-span": t.span,
119
+ "aria-disabled": s ? !0 : void 0,
120
+ tabIndex: i,
121
+ "aria-label": d(t.name.key, t.name.fallback),
122
+ className: e("nxgt-calc-key", Oe[t.role]),
123
+ onClick: () => !s && c(t),
124
+ onFocus: () => l(n, r),
125
+ children: /* @__PURE__ */ O("span", {
126
+ "aria-hidden": "true",
127
+ children: t.key === "." ? a : t.glyph
128
+ })
129
+ });
130
+ }
131
+ //#endregion
132
+ //#region lib/components/ui/widgets/calculator/partials/keypad-navigation.ts
133
+ function Ae(e) {
134
+ return e.rows.map((e) => {
135
+ let t = 0;
136
+ return e.map((e) => {
137
+ let n = t;
138
+ return t += e.span ?? 1, {
139
+ start: n,
140
+ end: t
141
+ };
142
+ });
143
+ });
144
+ }
145
+ var z = (e) => Math.max(e - 1, 0);
146
+ function je(e, t, n, r) {
147
+ let i = t.row < r, a = i ? 0 : r, o = i ? r - 1 : z(e.length), s = e[t.row] ?? [];
148
+ if (n === "ArrowUp" || n === "ArrowDown") {
149
+ let e = t.row + (n === "ArrowUp" ? -1 : 1);
150
+ return e < a || e > o ? void 0 : null;
151
+ }
152
+ if (!(i ? n === "ArrowRight" && t.index === z(s.length) : n === "ArrowLeft" && t.index === 0)) return null;
153
+ let c = t.row - a, l = i ? [r, z(e.length)] : [0, r - 1], u = Math.min(l[0] + c, l[1]);
154
+ return {
155
+ row: u,
156
+ index: i ? 0 : z((e[u] ?? []).length)
157
+ };
158
+ }
159
+ function Me(e, t, n, r = !1, i) {
160
+ let a = e[t.row] ?? [], o = a[t.index];
161
+ if (!o) return;
162
+ if (i && !(r && (n === "Home" || n === "End"))) {
163
+ let r = je(e, t, n, i);
164
+ if (r != null) return r;
165
+ if (r === void 0) return;
166
+ }
167
+ let s = z(e.length);
168
+ switch (n) {
169
+ case "ArrowLeft": return t.index > 0 ? {
170
+ row: t.row,
171
+ index: t.index - 1
172
+ } : void 0;
173
+ case "ArrowRight": return t.index < z(a.length) ? {
174
+ row: t.row,
175
+ index: t.index + 1
176
+ } : void 0;
177
+ case "ArrowUp":
178
+ case "ArrowDown": {
179
+ let r = t.row + (n === "ArrowUp" ? -1 : 1), i = e[r];
180
+ if (!i) return;
181
+ let a = i.findIndex((e) => e.start <= o.start && o.start < e.end);
182
+ return {
183
+ row: r,
184
+ index: Math.max(a, 0)
185
+ };
186
+ }
187
+ case "Home": return r ? {
188
+ row: 0,
189
+ index: 0
190
+ } : {
191
+ row: t.row,
192
+ index: 0
193
+ };
194
+ case "End": return r ? {
195
+ row: s,
196
+ index: z((e[s] ?? []).length)
197
+ } : {
198
+ row: t.row,
199
+ index: z(a.length)
200
+ };
201
+ default: return;
202
+ }
203
+ }
204
+ function Ne(e) {
205
+ let t = e.querySelectorAll("[data-pane]"), [n, r] = [t[0]?.firstElementChild, t[1]?.firstElementChild];
206
+ return !n || !r ? !1 : n.getBoundingClientRect().right <= r.getBoundingClientRect().left;
207
+ }
208
+ //#endregion
209
+ //#region lib/components/ui/widgets/calculator/partials/calculator-keypad.tsx
210
+ var Pe = {
211
+ columns: 12,
212
+ rows: []
213
+ };
214
+ function Fe(e, t, n) {
215
+ let r = e.map((e, t) => n(e, t));
216
+ return t ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("div", {
217
+ className: "nxgt-calc-pane",
218
+ "data-pane": "functions",
219
+ children: r.slice(0, t)
220
+ }), /* @__PURE__ */ O("div", {
221
+ className: "nxgt-calc-pane",
222
+ "data-pane": "main",
223
+ children: r.slice(t)
224
+ })] }) : r;
225
+ }
226
+ var Ie = /* @__PURE__ */ new Set([
227
+ "ArrowLeft",
228
+ "ArrowRight",
229
+ "ArrowUp",
230
+ "ArrowDown",
231
+ "Home",
232
+ "End"
233
+ ]);
234
+ function Le({ helpId: e }) {
235
+ let { t } = o(), { definition: n, press: r, locale: i, state: a } = m(), s = n.layout ?? Pe, c = T(() => Ae(s), [s]), [l, u] = ue({
236
+ row: 0,
237
+ index: 0
238
+ }), d = c[l.row]?.[l.index] ? l : {
239
+ row: 0,
240
+ index: 0
241
+ }, f = E(/* @__PURE__ */ new Map()), p = F(i).decimal, h = n.programmer ? a.programmer.base : void 0;
242
+ function g(e) {
243
+ if (!Ie.has(e.key) || e.altKey || e.metaKey) return;
244
+ let t = Me(c, d, e.key, e.ctrlKey, Ne(e.currentTarget) ? s.split : void 0);
245
+ e.preventDefault(), t && f.current.get(`${t.row}:${t.index}`)?.focus();
246
+ }
247
+ return /* @__PURE__ */ O("div", {
248
+ role: "group",
249
+ "aria-label": t("material.calculator.keypad", "Keypad"),
250
+ "aria-describedby": e,
251
+ dir: "ltr",
252
+ "data-slot": "calculator-keypad",
253
+ "data-columns": s.columns,
254
+ className: "nxgt-calc-keys",
255
+ onKeyDown: g,
256
+ children: Fe(s.rows, s.split, (e, t) => e.map((e, n) => {
257
+ let i = oe(e, a.second);
258
+ return /* @__PURE__ */ O(ke, {
259
+ def: i,
260
+ row: t,
261
+ index: n,
262
+ decimal: p,
263
+ unavailable: h !== void 0 && x(i.key, h),
264
+ tabIndex: d.row === t && d.index === n ? 0 : -1,
265
+ buttonRef: (e) => {
266
+ f.current.set(`${t}:${n}`, e);
267
+ },
268
+ onFocus: (e, t) => u({
269
+ row: e,
270
+ index: t
271
+ }),
272
+ onPress: (e) => {
273
+ for (let t of ae(e)) r(t);
274
+ }
275
+ }, i.id);
276
+ }))
277
+ });
278
+ }
279
+ //#endregion
280
+ //#region lib/components/ui/widgets/calculator/variants/variant-loader.ts
281
+ var Re = {
282
+ scientific: () => import("./scientific-variant-2y3UxAAU.js"),
283
+ pos: () => import("./pos-variant-GrUfbTTP.js"),
284
+ programmer: () => import("./programmer-variant-eKJNKENL.js"),
285
+ financial: () => import("./financial-variant-BsZEa5sF.js"),
286
+ conversion: () => import("./conversion-variant-BDFAxqe9.js")
287
+ }, B = "failed", V = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), W = () => {
288
+ for (let e of U) e();
289
+ };
290
+ function G(e) {
291
+ let t = Re[e];
292
+ if (!t || V.has(e) && V.get(e) !== B) return Promise.resolve();
293
+ let n = H.get(e);
294
+ if (n) return n;
295
+ V.get(e) === B && (V.delete(e), W());
296
+ let r = t().then(({ variant: t }) => {
297
+ t.logic && y(e, t.logic), V.set(e, t.part);
298
+ }).catch(() => {
299
+ V.set(e, B);
300
+ }).finally(() => {
301
+ H.delete(e), W();
302
+ });
303
+ return H.set(e, r), r;
304
+ }
305
+ var ze = (e) => (U.add(e), () => {
306
+ U.delete(e);
307
+ });
308
+ function Be(e) {
309
+ let t = de(ze, () => V.get(e), () => void 0);
310
+ return C(() => {
311
+ V.has(e) || G(e);
312
+ }, [e]), t;
313
+ }
314
+ //#endregion
315
+ //#region lib/components/ui/widgets/calculator/partials/calculator-loading.tsx
316
+ var Ve = 24;
317
+ function He() {
318
+ let { t: e } = o(), { variant: t, definition: n } = m(), r = n.pending === "failed", i = r ? e("material.calculator.load-failed", "This calculator could not be loaded.") : e("material.calculator.loading", "Loading the calculator");
319
+ return /* @__PURE__ */ O("div", {
320
+ className: "nxgt-calc-body nxgt-calc-loading",
321
+ "data-state": r ? "failed" : "loading",
322
+ role: "status",
323
+ children: /* @__PURE__ */ k("div", {
324
+ className: "nxgt-calc-main",
325
+ children: [r ? /* @__PURE__ */ k("div", {
326
+ className: "nxgt-calc-loading-message",
327
+ children: [/* @__PURE__ */ O("p", { children: i }), /* @__PURE__ */ O(a, {
328
+ type: "button",
329
+ variant: "outlined",
330
+ onClick: () => void G(t),
331
+ children: e("material.calculator.retry", "Try again")
332
+ })]
333
+ }) : /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("p", {
334
+ className: "sr-only",
335
+ children: i
336
+ }), /* @__PURE__ */ O(f, {
337
+ "aria-hidden": "true",
338
+ className: "nxgt-calc-loading-display"
339
+ })] }), /* @__PURE__ */ O("div", {
340
+ className: "nxgt-calc-loading-pad",
341
+ "aria-hidden": "true",
342
+ "aria-busy": !r || void 0,
343
+ children: Array.from({ length: Ve }, (e, t) => /* @__PURE__ */ O(f, {}, t))
344
+ })]
345
+ })
346
+ });
347
+ }
348
+ //#endregion
349
+ //#region lib/components/ui/widgets/calculator/partials/calculator-panel-body.tsx
350
+ function Ue({ panel: e }) {
351
+ return /* @__PURE__ */ O("div", {
352
+ className: "nxgt-calc-body",
353
+ onKeyDown: (e) => e.stopPropagation(),
354
+ onPaste: (e) => e.stopPropagation(),
355
+ children: /* @__PURE__ */ O("div", {
356
+ className: "nxgt-calc-main",
357
+ children: /* @__PURE__ */ O(e, {})
358
+ })
359
+ });
360
+ }
361
+ //#endregion
362
+ //#region lib/components/ui/widgets/calculator/types.ts
363
+ var K = [
364
+ "standard",
365
+ "scientific",
366
+ "pos",
367
+ "financial",
368
+ "conversion",
369
+ "programmer"
370
+ ], q = {
371
+ standard: {
372
+ key: "material.calculator.variants.standard",
373
+ fallback: "Standard"
374
+ },
375
+ scientific: {
376
+ key: "material.calculator.variants.scientific",
377
+ fallback: "Scientific"
378
+ },
379
+ pos: {
380
+ key: "material.calculator.variants.pos",
381
+ fallback: "Point of sale"
382
+ },
383
+ programmer: {
384
+ key: "material.calculator.variants.programmer",
385
+ fallback: "Programmer"
386
+ },
387
+ financial: {
388
+ key: "material.calculator.variants.financial",
389
+ fallback: "Financial"
390
+ },
391
+ conversion: {
392
+ key: "material.calculator.variants.conversion",
393
+ fallback: "Conversion"
394
+ }
395
+ }, We = {
396
+ id: "standard",
397
+ label: q.standard,
398
+ layout: le,
399
+ extraKeys: [
400
+ "(",
401
+ ")",
402
+ "CE",
403
+ "ans"
404
+ ]
405
+ };
406
+ function Ge() {
407
+ return K;
408
+ }
409
+ function Ke(e, t) {
410
+ if (e === "standard") return We;
411
+ let n = {
412
+ id: e,
413
+ label: q[e]
414
+ };
415
+ return t === void 0 ? {
416
+ ...n,
417
+ pending: "loading"
418
+ } : t === "failed" ? {
419
+ ...n,
420
+ pending: "failed"
421
+ } : {
422
+ ...n,
423
+ ...t
424
+ };
425
+ }
426
+ function qe(e) {
427
+ let t = new Set(e.extraKeys ?? []);
428
+ for (let n of e.layout?.rows ?? []) for (let e of n) t.add(e.key), e.alt && t.add(e.alt.key);
429
+ return t;
430
+ }
431
+ //#endregion
432
+ //#region lib/components/ui/widgets/calculator/partials/calculator-switcher.tsx
433
+ function Je({ children: e }) {
434
+ let { t: a } = o(), { variant: s, variants: c, setVariant: l } = m();
435
+ return /* @__PURE__ */ k(r, {
436
+ value: s,
437
+ variant: "segmented",
438
+ className: "nxgt-calc-tabs",
439
+ onValueChange: (e) => l(e),
440
+ children: [/* @__PURE__ */ O(n, {
441
+ "aria-label": a("material.calculator.variants.label", "Calculator type"),
442
+ className: "nxgt-calc-switcher",
443
+ children: c.map((e) => {
444
+ let n = q[e];
445
+ return /* @__PURE__ */ O(t, {
446
+ value: e,
447
+ onPointerEnter: () => void G(e),
448
+ onFocus: () => void G(e),
449
+ children: a(n.key, n.fallback)
450
+ }, e);
451
+ })
452
+ }), /* @__PURE__ */ O(i, {
453
+ value: s,
454
+ className: "nxgt-calc-panel",
455
+ children: e
456
+ })]
457
+ });
458
+ }
459
+ //#endregion
460
+ //#region lib/components/ui/widgets/calculator/partials/calculator-tape.tsx
461
+ var J = [
462
+ "bg-primary-container",
463
+ "bg-secondary-container",
464
+ "bg-tertiary-container"
465
+ ];
466
+ function Ye({ entry: e, colour: t }) {
467
+ let { t: n } = o(), { replay: r, reuse: i, locale: a } = m(), s = M(e.expression, { locale: a }), c = I(e.result), l = c ? j(c, { locale: a }) : e.result;
468
+ return /* @__PURE__ */ k("li", {
469
+ "data-slot": "calculator-tape-entry",
470
+ className: `nxgt-calc-entry ${t}`,
471
+ children: [/* @__PURE__ */ O("button", {
472
+ type: "button",
473
+ dir: "ltr",
474
+ className: "nxgt-calc-entry-expression",
475
+ "aria-label": n("material.calculator.tape.replay", "Replay {expression}", { expression: s }),
476
+ onClick: () => r(e),
477
+ children: s
478
+ }), /* @__PURE__ */ k("button", {
479
+ type: "button",
480
+ dir: "ltr",
481
+ className: "nxgt-calc-entry-result",
482
+ "aria-label": n("material.calculator.tape.reuse", "Use result {result}", { result: l }),
483
+ onClick: () => i(e),
484
+ children: [/* @__PURE__ */ O("span", {
485
+ "aria-hidden": "true",
486
+ children: "= "
487
+ }), l]
488
+ })]
489
+ });
490
+ }
491
+ function Y({ id: e }) {
492
+ let { t } = o(), { state: n, clearTape: r, tapeRef: i } = m(), { history: a } = n;
493
+ return /* @__PURE__ */ k("div", {
494
+ ref: i,
495
+ id: e,
496
+ role: "group",
497
+ tabIndex: -1,
498
+ "data-slot": "calculator-tape",
499
+ "aria-label": t("material.calculator.tape.label", "History"),
500
+ className: "nxgt-calc-tape",
501
+ children: [/* @__PURE__ */ k("header", {
502
+ className: "nxgt-calc-tape-head",
503
+ children: [
504
+ /* @__PURE__ */ O("p", {
505
+ className: "nxgt-calc-tape-title",
506
+ children: t("material.calculator.tape.label", "History")
507
+ }),
508
+ /* @__PURE__ */ O("span", { className: "nxgt-calc-grow" }),
509
+ /* @__PURE__ */ O(s, {
510
+ size: "sm",
511
+ variant: "ghost",
512
+ className: "nxgt-calc-tool",
513
+ "aria-label": t("material.calculator.tape.clear", "Clear history"),
514
+ disabled: a.length === 0,
515
+ onClick: r,
516
+ children: /* @__PURE__ */ O(he, {})
517
+ })
518
+ ]
519
+ }), a.length === 0 ? /* @__PURE__ */ O("p", {
520
+ className: "nxgt-calc-tape-empty text-muted-foreground",
521
+ children: t("material.calculator.tape.empty", "Your calculations appear here.")
522
+ }) : /* @__PURE__ */ O("ul", {
523
+ className: "nxgt-calc-entries",
524
+ children: a.map((e, t) => /* @__PURE__ */ O(Ye, {
525
+ entry: e,
526
+ colour: J[(a.length - 1 - t) % J.length] ?? ""
527
+ }, e.id))
528
+ })]
529
+ });
530
+ }
531
+ //#endregion
532
+ //#region lib/components/ui/widgets/calculator/partials/calculator-shell.tsx
533
+ function Xe({ className: t, "aria-label": n, onKeyDown: r, onPaste: i }) {
534
+ let { t: a } = o(), { variant: s, variants: c, state: l, definition: u } = m(), d = u.toolbar, f = u.panel, p = w(), h = w(), g = u.display, _ = u.aside, v = u.pending !== void 0, y = !!f || v, b = v ? /* @__PURE__ */ O(He, {}) : f ? /* @__PURE__ */ O(Ue, { panel: f }) : /* @__PURE__ */ k("div", {
535
+ className: "nxgt-calc-body",
536
+ children: [/* @__PURE__ */ k("div", {
537
+ className: "nxgt-calc-main",
538
+ children: [
539
+ g ? /* @__PURE__ */ O(g, {}) : /* @__PURE__ */ O(De, { tapeId: h }),
540
+ d ? /* @__PURE__ */ O(d, {}) : null,
541
+ /* @__PURE__ */ O(Le, { helpId: p })
542
+ ]
543
+ }), _ ? /* @__PURE__ */ O("div", {
544
+ "data-slot": "calculator-aside",
545
+ className: "nxgt-calc-aside",
546
+ children: /* @__PURE__ */ O(_, {})
547
+ }) : /* @__PURE__ */ O(Y, { id: h })]
548
+ });
549
+ return /* @__PURE__ */ k("div", {
550
+ role: "group",
551
+ "aria-label": n ?? a("material.calculator.label", "Calculator"),
552
+ "data-slot": "calculator",
553
+ "data-variant": s,
554
+ "data-tape-open": l.tapeOpen ? "" : void 0,
555
+ className: e("nxgt-calc", t),
556
+ onKeyDown: r,
557
+ onPaste: i,
558
+ children: [
559
+ c.length > 1 ? /* @__PURE__ */ O(Je, { children: b }) : b,
560
+ y ? null : /* @__PURE__ */ O("p", {
561
+ id: p,
562
+ className: "sr-only",
563
+ children: a("material.calculator.help", "Type digits and operators. Enter calculates, Escape clears, Backspace deletes.")
564
+ }),
565
+ y ? null : /* @__PURE__ */ O(we, {})
566
+ ]
567
+ });
568
+ }
569
+ //#endregion
570
+ //#region lib/components/ui/widgets/calculator/engine.ts
571
+ function X(e) {
572
+ let t = {};
573
+ e.precision !== void 0 && (t.precision = Math.min(Math.max(Math.trunc(e.precision), 1), 34)), e.rounding && (t.rounding = e.rounding);
574
+ let n = {
575
+ percent: e.percent,
576
+ ctx: t
577
+ };
578
+ return e.programmer ? _("programmer")?.options?.(n, e) ?? n : e.scientific ? _("scientific")?.options?.(n, e) ?? n : n;
579
+ }
580
+ var Ze = {
581
+ auto: "auto",
582
+ sci: "scientific",
583
+ eng: "engineering"
584
+ }, Qe = (e) => Ze[e ?? "auto"], $e = /(?:\s*(?:mod|[-+*/^])\s*)+$/, et = /\d*\.?\d+$|\d+\.$/, tt = (e) => e.replace($e, "").trim();
585
+ function nt(e, t) {
586
+ let n = t.programmer ? _("programmer")?.display?.(e, t) : void 0;
587
+ if (n) return n;
588
+ let { session: r } = e, { locale: i } = t, a = Qe(t.notation), o = M(r.expression, { locale: i });
589
+ if (r.error) return {
590
+ expression: o,
591
+ result: "",
592
+ kind: "error",
593
+ value: "",
594
+ error: r.error
595
+ };
596
+ let s = r.justEvaluated ? I(r.result) : void 0;
597
+ if (s) return {
598
+ expression: o,
599
+ result: j(s, {
600
+ locale: i,
601
+ notation: a
602
+ }),
603
+ kind: "result",
604
+ value: r.result,
605
+ error: ""
606
+ };
607
+ let c = tt(r.expression);
608
+ if (c === "") return {
609
+ expression: o,
610
+ result: "0",
611
+ kind: "empty",
612
+ value: "",
613
+ error: ""
614
+ };
615
+ let l = ve(c, Ce(r, X(t)));
616
+ if (l.ok) return {
617
+ expression: o,
618
+ result: j(l.value, {
619
+ locale: i,
620
+ notation: a
621
+ }),
622
+ kind: "preview",
623
+ value: R(l.value),
624
+ error: ""
625
+ };
626
+ let u = et.exec(c)?.[0], d = u ? I(u) : void 0;
627
+ return {
628
+ expression: o,
629
+ result: d ? j(d, { locale: i }) : "0",
630
+ kind: "preview",
631
+ value: "",
632
+ error: ""
633
+ };
634
+ }
635
+ var rt = (e) => {
636
+ let t = I(e.session.memory);
637
+ return t !== void 0 && t.c !== 0n;
638
+ };
639
+ //#endregion
640
+ //#region lib/components/ui/widgets/calculator/calculator-variant-steps.ts
641
+ function it(e, t) {
642
+ let { action: n, env: r, format: i } = t, a = _("pos");
643
+ if (!a?.reducePos || !a.announcePos) return;
644
+ let o = a.reducePos(e.pos, n, r);
645
+ e.announcement = a.announcePos(e.pos, o, n, r, i), e.pos = o;
646
+ }
647
+ function at(e, t) {
648
+ let n = _("programmer")?.reduce?.(e.session, e.programmer, t);
649
+ n && Object.assign(e, n);
650
+ }
651
+ //#endregion
652
+ //#region lib/components/ui/widgets/calculator/calculator.slice.ts
653
+ var ot = {
654
+ variant: "standard",
655
+ session: A,
656
+ history: [],
657
+ tapeOpen: !1,
658
+ angle: "deg",
659
+ notation: "auto",
660
+ second: !1,
661
+ pos: ie,
662
+ programmer: ce,
663
+ announcement: null,
664
+ restored: !1
665
+ }, st = 1e3, Z = ge({
666
+ name: "calculator",
667
+ initialState: ot,
668
+ reducers: {
669
+ press: (e, t) => {
670
+ let { key: n, settings: r, id: i } = t.payload, a = e.session, o = L(a, n, X(r));
671
+ e.session = o, e.announcement = te(n, a, o, r.locale, r.programmer);
672
+ let s = n === "=" && !a.justEvaluated ? N(o, e.variant, i) : void 0;
673
+ s && (e.history = xe(e.history, s));
674
+ },
675
+ setVariant: (e, t) => {
676
+ e.variant = t.payload;
677
+ },
678
+ replay: (e, t) => {
679
+ e.session = {
680
+ ...e.session,
681
+ expression: t.payload.expression,
682
+ result: "",
683
+ error: "",
684
+ justEvaluated: !1
685
+ }, e.announcement = null;
686
+ },
687
+ reuse: (e, t) => {
688
+ e.session = L({
689
+ ...e.session,
690
+ ans: t.payload.entry.result
691
+ }, "ans", X(t.payload.settings)), e.announcement = null;
692
+ },
693
+ paste: (e, t) => {
694
+ let n = ye(t.payload.text.slice(0, st), t.payload.locale).trim();
695
+ n !== "" && (e.session = {
696
+ ...e.session,
697
+ expression: n,
698
+ result: "",
699
+ error: "",
700
+ justEvaluated: !1
701
+ }, e.announcement = g("pasted"));
702
+ },
703
+ setAngle: (e, t) => {
704
+ e.angle = t.payload, e.announcement = b(t.payload);
705
+ },
706
+ setNotation: (e, t) => {
707
+ e.notation = t.payload, e.announcement = ee(t.payload);
708
+ },
709
+ toggleSecond: (e, t) => {
710
+ e.second = t.payload ?? !e.second, e.announcement = ne(e.second);
711
+ },
712
+ pos: (e, t) => {
713
+ it(e, t.payload);
714
+ },
715
+ programmer: (e, t) => {
716
+ at(e, t.payload);
717
+ },
718
+ announce: (e, t) => {
719
+ e.announcement = t.payload;
720
+ },
721
+ toggleTape: (e, t) => {
722
+ e.tapeOpen = t.payload ?? !e.tapeOpen;
723
+ },
724
+ clearTape: (e) => {
725
+ e.history = [];
726
+ },
727
+ restore: (e, t) => {
728
+ let n = new Set(e.history.map((e) => e.id)), r = t.payload.history.filter((e) => !n.has(e.id));
729
+ e.history = [...e.history, ...r].slice(0, 100), e.session.memory === "0" && (e.session = {
730
+ ...e.session,
731
+ memory: t.payload.memory
732
+ }), e.restored = !0;
733
+ },
734
+ markRestored: (e) => {
735
+ e.restored = !0;
736
+ }
737
+ }
738
+ });
739
+ Z.actions;
740
+ //#endregion
741
+ //#region lib/components/ui/widgets/calculator/calculator-clipboard.ts
742
+ async function ct(e, t, n, r) {
743
+ let i = I(e);
744
+ if (!i) return !1;
745
+ let a = r ? _("programmer")?.copy?.(e, r) : j(i, {
746
+ locale: t,
747
+ grouping: !1
748
+ });
749
+ if (a === void 0) return !1;
750
+ try {
751
+ await n.write(a);
752
+ } catch {
753
+ return !1;
754
+ }
755
+ return n.announce(g("copied")), !0;
756
+ }
757
+ async function lt(e) {
758
+ try {
759
+ return await e?.() ?? "";
760
+ } catch {
761
+ return "";
762
+ }
763
+ }
764
+ //#endregion
765
+ //#region lib/components/ui/widgets/calculator/use-calculator-clipboard.ts
766
+ function ut(e, t, n, r) {
767
+ let { announce: i, paste: a } = n;
768
+ return {
769
+ copy: S(() => ct(e, t, {
770
+ write: c,
771
+ announce: i
772
+ }, r), [
773
+ i,
774
+ t,
775
+ e,
776
+ r
777
+ ]),
778
+ paste: S(async () => {
779
+ let e = await lt(() => navigator.clipboard.readText());
780
+ e && a({
781
+ text: e,
782
+ locale: t
783
+ });
784
+ }, [t, a]),
785
+ pasteEvent: S((e) => {
786
+ e && a({
787
+ text: e,
788
+ locale: t
789
+ });
790
+ }, [t, a])
791
+ };
792
+ }
793
+ //#endregion
794
+ //#region lib/components/ui/widgets/calculator/use-calculator-conversion.ts
795
+ function dt(e) {
796
+ return T(() => ({
797
+ currencyRates: e.currencyRates,
798
+ precision: e.precision,
799
+ rounding: e.rounding
800
+ }), [
801
+ e.currencyRates,
802
+ e.precision,
803
+ e.rounding
804
+ ]);
805
+ }
806
+ function ft(e, t) {
807
+ if (e) try {
808
+ e.haptics && !t.reducedMotion() && t.vibrate?.(8), e.sound && t.audio?.()?.tick();
809
+ } catch {}
810
+ }
811
+ function pt() {
812
+ let e;
813
+ return () => {
814
+ let t = window.AudioContext ?? window.webkitAudioContext;
815
+ if (!t) return;
816
+ e ??= new t();
817
+ let n = e;
818
+ return { tick: () => {
819
+ n.state === "suspended" && n.resume();
820
+ let e = n.createOscillator(), t = n.createGain();
821
+ e.frequency.value = 880, t.gain.value = .04, e.connect(t).connect(n.destination), e.start(), e.stop(n.currentTime + .02);
822
+ } };
823
+ };
824
+ }
825
+ function mt(e) {
826
+ return {
827
+ vibrate: (e) => navigator.vibrate?.(e) ?? !1,
828
+ reducedMotion: () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1,
829
+ audio: e
830
+ };
831
+ }
832
+ //#endregion
833
+ //#region lib/components/ui/widgets/calculator/use-calculator-feedback.ts
834
+ function ht(e) {
835
+ let t = T(() => pt(), []), n = e?.haptics, r = e?.sound;
836
+ return S(() => {
837
+ !n && !r || ft({
838
+ haptics: n,
839
+ sound: r
840
+ }, mt(t));
841
+ }, [
842
+ n,
843
+ r,
844
+ t
845
+ ]);
846
+ }
847
+ //#endregion
848
+ //#region lib/components/ui/widgets/calculator/calculator-storage.ts
849
+ var gt = "nxgt-calculator:", Q = 1;
850
+ function $() {
851
+ try {
852
+ return typeof window > "u" ? void 0 : window.localStorage;
853
+ } catch {
854
+ return;
855
+ }
856
+ }
857
+ function _t(e) {
858
+ return e === !1 ? void 0 : `${gt}${typeof e == "object" ? e.key : "default"}`;
859
+ }
860
+ function vt(e) {
861
+ try {
862
+ let t = JSON.parse(e ?? ""), n = t.v === Q ? t.memory : void 0;
863
+ return typeof n == "string" && n.length <= 10100 && I(n) ? n : "0";
864
+ } catch {
865
+ return "0";
866
+ }
867
+ }
868
+ function yt(e, t) {
869
+ try {
870
+ return {
871
+ history: be(e?.getItem(`${t}:history`)),
872
+ memory: vt(e?.getItem(`${t}:memory`) ?? null)
873
+ };
874
+ } catch {
875
+ return {
876
+ history: [],
877
+ memory: "0"
878
+ };
879
+ }
880
+ }
881
+ function bt(e, t, n) {
882
+ try {
883
+ e?.setItem(`${t}:history`, Se(n.history)), e?.setItem(`${t}:memory`, JSON.stringify({
884
+ v: Q,
885
+ memory: n.memory
886
+ }));
887
+ } catch {}
888
+ }
889
+ //#endregion
890
+ //#region lib/components/ui/widgets/calculator/use-calculator-persistence.ts
891
+ var xt = 300;
892
+ function St(e, t, n) {
893
+ let r = _t(e), { restore: i, markRestored: a } = n;
894
+ C(() => {
895
+ if (!r) return a();
896
+ i(yt($(), r));
897
+ }, [r]);
898
+ let { history: o } = t, { memory: s } = t.session;
899
+ C(() => {
900
+ if (!r || !t.restored) return;
901
+ let e = setTimeout(() => bt($(), r, {
902
+ history: o,
903
+ memory: s
904
+ }), xt);
905
+ return () => clearTimeout(e);
906
+ }, [
907
+ r,
908
+ t.restored,
909
+ o,
910
+ s
911
+ ]);
912
+ }
913
+ //#endregion
914
+ //#region lib/components/ui/widgets/calculator/use-calculator-pos.ts
915
+ function Ct(e, t, n, r, i) {
916
+ let { vatRates: a, denominations: o, pricesIncludeVat: s, currency: c } = e, l = c ? _e(c) : 2, u = (a ?? []).join(" "), d = (o ?? []).join(" "), f = T(() => ({
917
+ currency: c,
918
+ digits: l,
919
+ rates: u === "" ? [] : u.split(" "),
920
+ inclusive: s !== !1
921
+ }), [
922
+ c,
923
+ l,
924
+ u,
925
+ s
926
+ ]), p = T(() => ({
927
+ locale: t,
928
+ denominations: d === "" ? [] : d.split(" ")
929
+ }), [t, d]);
930
+ return {
931
+ props: e,
932
+ env: f,
933
+ format: p,
934
+ view: T(() => r ? _("pos")?.selectPos?.(n, f, p.denominations, t) ?? null : null, [
935
+ r,
936
+ n,
937
+ f,
938
+ p,
939
+ t
940
+ ]),
941
+ dispatch: S((e) => i({
942
+ action: e,
943
+ env: f,
944
+ format: p
945
+ }), [
946
+ i,
947
+ f,
948
+ p
949
+ ])
950
+ };
951
+ }
952
+ //#endregion
953
+ //#region lib/components/ui/widgets/calculator/use-calculator-press.ts
954
+ var wt = 0, Tt = () => `${Date.now().toString(36)}-${(wt++).toString(36)}`;
955
+ function Et(e) {
956
+ let { actions: t, feel: n, settings: r, isPos: i, dispatchPos: a, t: o } = e;
957
+ return S((e) => {
958
+ if (r.programmer && x(e, r.programmer.base)) {
959
+ let e = _("programmer")?.refused?.(r.programmer.base, o);
960
+ e && t.announce(e);
961
+ return;
962
+ }
963
+ n(), i ? a({
964
+ type: "key",
965
+ key: e
966
+ }) : t.press({
967
+ key: e,
968
+ settings: r,
969
+ id: Tt()
970
+ });
971
+ }, [
972
+ t,
973
+ n,
974
+ r,
975
+ i,
976
+ a,
977
+ o
978
+ ]);
979
+ }
980
+ //#endregion
981
+ //#region lib/components/ui/widgets/calculator/use-calculator-tape.ts
982
+ function Dt(e, t, n) {
983
+ return !e || !t || t.getClientRects().length === 0 ? !1 : (n(), t.focus(), !0);
984
+ }
985
+ function Ot(e, t, n, r) {
986
+ t && n && e?.(n, r);
987
+ }
988
+ function kt(e, t) {
989
+ let n = E(null), r = E(null), i = E(!1);
990
+ return C(() => {
991
+ e && !i.current && r.current?.focus(), i.current = e;
992
+ }, [e]), {
993
+ toggleRef: n,
994
+ tapeRef: r,
995
+ closeTapeOverlay: S(() => Dt(e, n.current, t), [t, e])
996
+ };
997
+ }
998
+ function At(e, { justEvaluated: t, result: n, expression: r }) {
999
+ let i = E(e);
1000
+ i.current = e, C(() => {
1001
+ Ot(i.current, t, n, r);
1002
+ }, [
1003
+ t,
1004
+ n,
1005
+ r
1006
+ ]);
1007
+ }
1008
+ //#endregion
1009
+ //#region lib/components/ui/widgets/calculator/use-calculator-value.ts
1010
+ function jt(e) {
1011
+ let t = e === void 0 ? void 0 : I(e.trim());
1012
+ if (!t) return A;
1013
+ let n = R(t);
1014
+ return {
1015
+ ...A,
1016
+ expression: n,
1017
+ result: n,
1018
+ ans: n,
1019
+ justEvaluated: !0
1020
+ };
1021
+ }
1022
+ function Mt(e, t) {
1023
+ let n = E(e);
1024
+ n.current = e, C(() => {
1025
+ n.current?.(t);
1026
+ }, [t]);
1027
+ }
1028
+ //#endregion
1029
+ //#region lib/components/ui/widgets/calculator/use-calculator-variant.ts
1030
+ function Nt(e, t) {
1031
+ let n = Ge(), r = (e.variants ?? n).filter((e) => n.includes(e)), i = e.variant ?? t, a = r.includes(i) ? i : r[0] ?? "standard", o = Be(a), s = T(() => Ke(a, o), [a, o]), c = T(() => qe(s), [s]);
1032
+ return {
1033
+ variant: a,
1034
+ variants: r,
1035
+ definition: s,
1036
+ accepts: (e) => c.has(e)
1037
+ };
1038
+ }
1039
+ function Pt(e, t, n, r) {
1040
+ e !== t && (n(e), r?.(e));
1041
+ }
1042
+ function Ft(e, t, n) {
1043
+ return S((r) => Pt(r, e, t, n), [
1044
+ e,
1045
+ t,
1046
+ n
1047
+ ]);
1048
+ }
1049
+ //#endregion
1050
+ //#region lib/components/ui/widgets/calculator/use-engine-settings.ts
1051
+ function It(e, t, n, r) {
1052
+ let { percent: i, precision: a, rounding: o } = e, { angle: s, notation: c } = n, l = r.scientific === !0, u = r.programmer ? n.programmer : void 0;
1053
+ return T(() => ({
1054
+ locale: t,
1055
+ percent: i ?? (l ? "literal" : "contextual"),
1056
+ precision: a,
1057
+ rounding: o,
1058
+ scientific: l,
1059
+ angle: s,
1060
+ notation: l ? c : "auto",
1061
+ programmer: u
1062
+ }), [
1063
+ t,
1064
+ i,
1065
+ a,
1066
+ o,
1067
+ l,
1068
+ s,
1069
+ c,
1070
+ u
1071
+ ]);
1072
+ }
1073
+ //#endregion
1074
+ //#region lib/components/ui/widgets/calculator/use-calculator.ts
1075
+ function Lt(e) {
1076
+ let { language: t, t: n } = o(), r = e.locale ?? t, [i, a] = d(Z, {
1077
+ variant: e.defaultVariant ?? "standard",
1078
+ programmer: se(e),
1079
+ session: jt(e.defaultValue)
1080
+ }), s = Nt(e, i.variant), c = It(e, r, i, s.definition), l = ht(e.feedback);
1081
+ St(e.persist, i, a);
1082
+ let u = T(() => nt(i, c), [i, c]), f = ut(u.value, r, a, c.programmer), p = s.variant === "pos" && !s.definition.pending, m = Ct(e, r, i.pos, p, a.pos), h = dt(e), g = Et({
1083
+ actions: a,
1084
+ feel: l,
1085
+ settings: c,
1086
+ isPos: p,
1087
+ dispatchPos: m.dispatch,
1088
+ t: n
1089
+ }), _ = Ft(s.variant, a.setVariant, e.onVariantChange), { toggleRef: v, tapeRef: y, closeTapeOverlay: b } = kt(i.tapeOpen, () => a.toggleTape(!1));
1090
+ return At(e.onResult, i.session), Mt(e.onValueChange, u.value), {
1091
+ state: i,
1092
+ ...s,
1093
+ locale: r,
1094
+ conversion: h,
1095
+ currency: e.currency,
1096
+ display: u,
1097
+ hasMemory: rt(i),
1098
+ press: g,
1099
+ setVariant: _,
1100
+ setAngle: a.setAngle,
1101
+ setNotation: a.setNotation,
1102
+ toggleSecond: (e) => a.toggleSecond(e),
1103
+ setProgrammer: a.programmer,
1104
+ replay: a.replay,
1105
+ reuse: (e) => a.reuse({
1106
+ entry: e,
1107
+ settings: c
1108
+ }),
1109
+ clearTape: a.clearTape,
1110
+ toggleTape: () => a.toggleTape(void 0),
1111
+ copy: () => void f.copy(),
1112
+ paste: () => {
1113
+ s.definition.pending || f.paste();
1114
+ },
1115
+ pasteText: (e) => {
1116
+ s.definition.pending || f.pasteEvent(e);
1117
+ },
1118
+ pos: m,
1119
+ toggleRef: v,
1120
+ tapeRef: y,
1121
+ closeTapeOverlay: b
1122
+ };
1123
+ }
1124
+ //#endregion
1125
+ //#region lib/components/ui/widgets/calculator/calculator-keyboard.ts
1126
+ var Rt = /* @__PURE__ */ new Set([
1127
+ "INPUT",
1128
+ "TEXTAREA",
1129
+ "SELECT"
1130
+ ]);
1131
+ function zt(e) {
1132
+ return e ? Rt.has(e.tagName?.toUpperCase() ?? "") || e.isContentEditable === !0 : !1;
1133
+ }
1134
+ function Bt(e, t) {
1135
+ if (e.defaultPrevented) return null;
1136
+ let n = e.target;
1137
+ if (t.global && zt(n) || e.key === "Enter" && n?.closest?.("button")) return null;
1138
+ let r = P(e, {
1139
+ locale: t.locale,
1140
+ programmer: t.programmer
1141
+ });
1142
+ return r === null ? null : r === "copy" ? t.hasSelection?.() ? null : r : r === "paste" ? null : t.accepts(r) ? r : null;
1143
+ }
1144
+ //#endregion
1145
+ //#region lib/components/ui/widgets/calculator/use-calculator-keyboard.ts
1146
+ var Vt = () => (globalThis.getSelection?.()?.toString() ?? "") !== "";
1147
+ function Ht(e) {
1148
+ let t = u(e), n = S((e) => {
1149
+ let { locale: n, accepts: r, global: i, programmer: a, onKey: o, onCopy: s, beforeKey: c } = t.current;
1150
+ if (!e.defaultPrevented && c?.(e)) return e.preventDefault();
1151
+ let l = Bt(e, {
1152
+ locale: n,
1153
+ accepts: r,
1154
+ global: i,
1155
+ programmer: a,
1156
+ hasSelection: Vt
1157
+ });
1158
+ l !== null && (e.preventDefault(), l === "copy" ? s() : l !== "paste" && o(l));
1159
+ }, [t]);
1160
+ return l("keydown", S((e) => n(e), [n]), e.global && typeof window < "u" ? window : null), S((e) => n(e), [n]);
1161
+ }
1162
+ //#endregion
1163
+ //#region lib/components/ui/widgets/calculator/calculator.tsx
1164
+ function Ut({ className: e, "aria-label": t, ...n }) {
1165
+ let r = Lt(n);
1166
+ return /* @__PURE__ */ O(h, {
1167
+ value: r,
1168
+ children: /* @__PURE__ */ O(Xe, {
1169
+ className: e,
1170
+ "aria-label": t,
1171
+ onKeyDown: Ht({
1172
+ locale: r.locale,
1173
+ accepts: r.accepts,
1174
+ programmer: r.definition.programmer,
1175
+ global: n.globalKeyboard && !r.definition.panel,
1176
+ onKey: r.press,
1177
+ onCopy: r.copy,
1178
+ beforeKey: (e) => e.key === "Escape" && r.closeTapeOverlay()
1179
+ }),
1180
+ onPaste: (e) => {
1181
+ if (r.definition.pending) return;
1182
+ let t = e.clipboardData.getData("text/plain");
1183
+ t && (e.preventDefault(), r.pasteText(t));
1184
+ }
1185
+ })
1186
+ });
1187
+ }
1188
+ //#endregion
1189
+ export { K as n, Ut as t };