@mono-lit/helper 0.0.0-stage → 0.0.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 (538) hide show
  1. package/LICENSE.md +55 -0
  2. package/README.md +34 -2
  3. package/dist/breakpoints-CAbhDUht.js +84 -0
  4. package/dist/checkbox-Cqpie9Ap.js +4 -0
  5. package/dist/chip-DBUUa2eB.js +4 -0
  6. package/dist/chip-limits-BMoO31JM.js +213 -0
  7. package/dist/chip-strip-Cw3gyz0q.js +213 -0
  8. package/dist/color-DHYrfXsX.js +253 -0
  9. package/dist/css-class-BRKRzHx-.js +60 -0
  10. package/dist/css-size-DhHSVZJK.js +37 -0
  11. package/dist/data/theme/presets.json.d.ts +140 -0
  12. package/dist/data-search-Bwo5bg8K.js +573 -0
  13. package/dist/data-source-controller-C50Qyfzh.js +178 -0
  14. package/dist/data-source-options-BTpfrOZ_.js +535 -0
  15. package/dist/data-source-options-CQSTZHPE.js +537 -0
  16. package/dist/data-source-read-CUX-lgrQ.js +216 -0
  17. package/dist/data-source-read-DL88aH8t.js +217 -0
  18. package/dist/decorate-DEXtNagw.js +141 -0
  19. package/dist/element-props-CLB6yvbm.js +114 -0
  20. package/dist/esm-Ptok4SQZ.js +2026 -0
  21. package/dist/excel-CY6zGkcx.js +608 -0
  22. package/dist/excel-DopRbEMK.js +608 -0
  23. package/dist/export-BvlBx_GZ.js +2302 -0
  24. package/dist/export.d.ts +1 -0
  25. package/dist/export.js +2302 -0
  26. package/dist/field-icons-BoOG6KrL.js +51 -0
  27. package/dist/field-path-C92eGLg3.js +251 -0
  28. package/dist/filter-builder-Bke3qOgJ.js +205 -0
  29. package/dist/filter-builder-CE4zE0V5.js +205 -0
  30. package/dist/filter-eval-DIfU2EAn.js +173 -0
  31. package/dist/filter-odata-C1vSGZaY.js +591 -0
  32. package/dist/form-control-core-B8d7k6vk.js +223 -0
  33. package/dist/form-control-core-eeRr0zLU.js +223 -0
  34. package/dist/hydration-flush-RB5Tz5nl.js +1001 -0
  35. package/dist/icon-CJkTlmTb.js +55 -0
  36. package/dist/icon-dVhYJUIH.js +17 -0
  37. package/dist/import-BgJdkwBI.js +606 -0
  38. package/dist/import.d.ts +1 -0
  39. package/dist/import.js +606 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +16 -0
  42. package/dist/index.node-DjvYOL-J.js +395 -0
  43. package/dist/index.node.d.ts +1 -0
  44. package/dist/index.node.js +16 -0
  45. package/dist/input-zGOULADt.js +4 -0
  46. package/dist/layout-var-CZnzMC0s.js +73 -0
  47. package/dist/light-slots-BVJwyg_2.js +244 -0
  48. package/dist/light-slots-DW1WgfgT.js +254 -0
  49. package/dist/markdown-DfqrfOJN.js +20146 -0
  50. package/dist/mono-button-CoVnBLav.js +873 -0
  51. package/dist/mono-button.shadow-FfP_hMH4.js +784 -0
  52. package/dist/mono-data-chart-ChU4Ii3p.js +738 -0
  53. package/dist/mono-data-dropdown-BAUl58kW.js +357 -0
  54. package/dist/mono-data-grid-CLBK8clE.js +4140 -0
  55. package/dist/mono-data-grid-Db80FzdZ.js +4142 -0
  56. package/dist/mono-element-B0kP_96P.js +232 -0
  57. package/dist/mono-event-Bi1qP9uN.js +129 -0
  58. package/dist/mono-form-controller-5PfsU4qa.js +409 -0
  59. package/dist/mono-modal-controller-BMO3n3rP.js +223 -0
  60. package/dist/mono-ui-CPV7rrdo.js +358 -0
  61. package/dist/notifier-CE4yxMUQ.js +88 -0
  62. package/dist/nuxt.d.ts +1 -0
  63. package/dist/nuxt.js +130 -0
  64. package/dist/popup-portal-BziRX1yG.js +465 -0
  65. package/dist/popup-stack-CEEMib__.js +189 -0
  66. package/dist/rate-limit-BBa2PO79.js +521 -0
  67. package/dist/reactive-BHsqVjRh.js +789 -0
  68. package/dist/reactive-D3EERqgO.js +47 -0
  69. package/dist/search.d.ts +1 -0
  70. package/dist/search.js +97 -0
  71. package/dist/src/components/accordion/accordion-core.d.ts +62 -0
  72. package/dist/src/components/accordion/accordion-types.d.ts +62 -0
  73. package/dist/src/components/accordion/index.d.ts +3 -0
  74. package/dist/src/components/accordion/index.shadow.d.ts +5 -0
  75. package/dist/src/components/accordion/mono-accordion.d.ts +55 -0
  76. package/dist/src/components/accordion/mono-accordion.shadow.d.ts +56 -0
  77. package/dist/src/components/alert/alert-core.d.ts +46 -0
  78. package/dist/src/components/alert/alert-types.d.ts +44 -0
  79. package/dist/src/components/alert/index.d.ts +3 -0
  80. package/dist/src/components/alert/index.shadow.d.ts +5 -0
  81. package/dist/src/components/alert/mono-alert.d.ts +44 -0
  82. package/dist/src/components/alert/mono-alert.shadow.d.ts +34 -0
  83. package/dist/src/components/breadcrumb/breadcrumb-core.d.ts +61 -0
  84. package/dist/src/components/breadcrumb/breadcrumb-list-core.d.ts +49 -0
  85. package/dist/src/components/breadcrumb/breadcrumb-render.d.ts +31 -0
  86. package/dist/src/components/breadcrumb/breadcrumb-types.d.ts +117 -0
  87. package/dist/src/components/breadcrumb/breadcrumb-utils.d.ts +43 -0
  88. package/dist/src/components/breadcrumb/index.d.ts +6 -0
  89. package/dist/src/components/breadcrumb/index.shadow.d.ts +8 -0
  90. package/dist/src/components/breadcrumb/mono-breadcrumb-list.d.ts +29 -0
  91. package/dist/src/components/breadcrumb/mono-breadcrumb-list.shadow.d.ts +48 -0
  92. package/dist/src/components/breadcrumb/mono-breadcrumb.d.ts +38 -0
  93. package/dist/src/components/breadcrumb/mono-breadcrumb.shadow.d.ts +73 -0
  94. package/dist/src/components/button/button-core.d.ts +90 -0
  95. package/dist/src/components/button/button-dropdown-core.d.ts +57 -0
  96. package/dist/src/components/button/button-dropdown-types.d.ts +129 -0
  97. package/dist/src/components/button/button-types.d.ts +219 -0
  98. package/dist/src/components/button/button-utils.d.ts +18 -0
  99. package/dist/src/components/button/index.button-dropdown.d.ts +4 -0
  100. package/dist/src/components/button/index.button-dropdown.shadow.d.ts +4 -0
  101. package/dist/src/components/button/index.d.ts +8 -0
  102. package/dist/src/components/button/index.shadow.d.ts +5 -0
  103. package/dist/src/components/button/mono-button-dropdown.d.ts +35 -0
  104. package/dist/src/components/button/mono-button-dropdown.shadow.d.ts +45 -0
  105. package/dist/src/components/button/mono-button.d.ts +123 -0
  106. package/dist/src/components/button/mono-button.shadow.d.ts +56 -0
  107. package/dist/src/components/card/card-core.d.ts +74 -0
  108. package/dist/src/components/card/card-types.d.ts +137 -0
  109. package/dist/src/components/card/card-utils.d.ts +23 -0
  110. package/dist/src/components/card/index.d.ts +4 -0
  111. package/dist/src/components/card/index.shadow.d.ts +6 -0
  112. package/dist/src/components/card/mono-card.d.ts +56 -0
  113. package/dist/src/components/card/mono-card.shadow.d.ts +52 -0
  114. package/dist/src/components/chart/chart-core.d.ts +43 -0
  115. package/dist/src/components/chart/chart-odata.d.ts +52 -0
  116. package/dist/src/components/chart/chart-types.d.ts +337 -0
  117. package/dist/src/components/chart/index.d.ts +8 -0
  118. package/dist/src/components/chart/index.shadow.d.ts +7 -0
  119. package/dist/src/components/chart/mono-chart-presets.d.ts +43 -0
  120. package/dist/src/components/chart/mono-chart-presets.shadow.d.ts +43 -0
  121. package/dist/src/components/chart/mono-chart.d.ts +30 -0
  122. package/dist/src/components/chart/mono-chart.shadow.d.ts +22 -0
  123. package/dist/src/components/chart/mono-data-chart.d.ts +27 -0
  124. package/dist/src/components/checkbox/checkbox-core.d.ts +53 -0
  125. package/dist/src/components/checkbox/checkbox-types.d.ts +69 -0
  126. package/dist/src/components/checkbox/checkbox-utils.d.ts +35 -0
  127. package/dist/src/components/checkbox/index.d.ts +4 -0
  128. package/dist/src/components/checkbox/index.shadow.d.ts +5 -0
  129. package/dist/src/components/checkbox/mono-checkbox.d.ts +34 -0
  130. package/dist/src/components/checkbox/mono-checkbox.shadow.d.ts +45 -0
  131. package/dist/src/components/chip/chip-core.d.ts +58 -0
  132. package/dist/src/components/chip/chip-types.d.ts +142 -0
  133. package/dist/src/components/chip/chip-utils.d.ts +24 -0
  134. package/dist/src/components/chip/index.d.ts +8 -0
  135. package/dist/src/components/chip/index.shadow.d.ts +6 -0
  136. package/dist/src/components/chip/mono-chip.d.ts +48 -0
  137. package/dist/src/components/chip/mono-chip.shadow.d.ts +33 -0
  138. package/dist/src/components/chip/mono-status-dot.d.ts +34 -0
  139. package/dist/src/components/date/date-core.d.ts +80 -0
  140. package/dist/src/components/date/date-types.d.ts +163 -0
  141. package/dist/src/components/date/index.d.ts +3 -0
  142. package/dist/src/components/date/index.shadow.d.ts +4 -0
  143. package/dist/src/components/date/mono-date.d.ts +22 -0
  144. package/dist/src/components/date/mono-date.shadow.d.ts +31 -0
  145. package/dist/src/components/drawer/drawer-core.d.ts +99 -0
  146. package/dist/src/components/drawer/drawer-types.d.ts +153 -0
  147. package/dist/src/components/drawer/index.d.ts +3 -0
  148. package/dist/src/components/drawer/index.shadow.d.ts +4 -0
  149. package/dist/src/components/drawer/mono-drawer.d.ts +45 -0
  150. package/dist/src/components/drawer/mono-drawer.shadow.d.ts +46 -0
  151. package/dist/src/components/dropdown/dropdown-core.d.ts +33 -0
  152. package/dist/src/components/dropdown/dropdown-types.d.ts +88 -0
  153. package/dist/src/components/dropdown/index.d.ts +3 -0
  154. package/dist/src/components/dropdown/index.shadow.d.ts +4 -0
  155. package/dist/src/components/dropdown/mono-dropdown.d.ts +34 -0
  156. package/dist/src/components/dropdown/mono-dropdown.shadow.d.ts +28 -0
  157. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +65 -0
  158. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +278 -0
  159. package/dist/src/components/dropdown-table/index.d.ts +5 -0
  160. package/dist/src/components/dropdown-table/index.shadow.d.ts +6 -0
  161. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +152 -0
  162. package/dist/src/components/dropdown-table/mono-dropdown-table.d.ts +46 -0
  163. package/dist/src/components/dropdown-table/mono-dropdown-table.shadow.d.ts +22 -0
  164. package/dist/src/components/file-upload/file-upload-core.d.ts +60 -0
  165. package/dist/src/components/file-upload/file-upload-types.d.ts +145 -0
  166. package/dist/src/components/file-upload/file-upload-utils.d.ts +16 -0
  167. package/dist/src/components/file-upload/index.d.ts +4 -0
  168. package/dist/src/components/file-upload/index.shadow.d.ts +5 -0
  169. package/dist/src/components/file-upload/mono-file-upload.d.ts +33 -0
  170. package/dist/src/components/file-upload/mono-file-upload.shadow.d.ts +50 -0
  171. package/dist/src/components/filter/filter-builder-core.d.ts +36 -0
  172. package/dist/src/components/filter/filter-builder.d.ts +23 -0
  173. package/dist/src/components/filter/filter-odata.d.ts +27 -0
  174. package/dist/src/components/filter/filter-operators.d.ts +13 -0
  175. package/dist/src/components/filter/filter-types.d.ts +253 -0
  176. package/dist/src/components/filter/index.d.ts +6 -0
  177. package/dist/src/components/filter/index.shadow.d.ts +7 -0
  178. package/dist/src/components/filter/mono-filter-builder.d.ts +21 -0
  179. package/dist/src/components/filter/mono-filter-builder.shadow.d.ts +17 -0
  180. package/dist/src/components/form/form-control-core.d.ts +37 -0
  181. package/dist/src/components/form/form-rules.d.ts +25 -0
  182. package/dist/src/components/form/form-types.d.ts +307 -0
  183. package/dist/src/components/form/index.d.ts +6 -0
  184. package/dist/src/components/form/mono-form-controller.d.ts +16 -0
  185. package/dist/src/components/input/index.d.ts +6 -0
  186. package/dist/src/components/input/index.shadow.d.ts +8 -0
  187. package/dist/src/components/input/input-core.d.ts +91 -0
  188. package/dist/src/components/input/input-format.d.ts +118 -0
  189. package/dist/src/components/input/input-types.d.ts +179 -0
  190. package/dist/src/components/input/input-utils.d.ts +10 -0
  191. package/dist/src/components/input/mono-input.d.ts +46 -0
  192. package/dist/src/components/input/mono-input.shadow.d.ts +34 -0
  193. package/dist/src/components/menu/index.d.ts +6 -0
  194. package/dist/src/components/menu/index.shadow.d.ts +7 -0
  195. package/dist/src/components/menu/menu-core.d.ts +65 -0
  196. package/dist/src/components/menu/menu-render.d.ts +55 -0
  197. package/dist/src/components/menu/menu-types.d.ts +195 -0
  198. package/dist/src/components/menu/menu-utils.d.ts +53 -0
  199. package/dist/src/components/menu/mono-menu-list.d.ts +118 -0
  200. package/dist/src/components/menu/mono-menu.d.ts +39 -0
  201. package/dist/src/components/menu/mono-menu.shadow.d.ts +40 -0
  202. package/dist/src/components/modal/index.d.ts +4 -0
  203. package/dist/src/components/modal/index.shadow.d.ts +5 -0
  204. package/dist/src/components/modal/modal-core.d.ts +110 -0
  205. package/dist/src/components/modal/modal-types.d.ts +304 -0
  206. package/dist/src/components/modal/mono-modal-controller.d.ts +4 -0
  207. package/dist/src/components/modal/mono-modal.d.ts +45 -0
  208. package/dist/src/components/modal/mono-modal.shadow.d.ts +50 -0
  209. package/dist/src/components/nav/index.d.ts +4 -0
  210. package/dist/src/components/nav/index.shadow.d.ts +6 -0
  211. package/dist/src/components/nav/mono-nav.d.ts +41 -0
  212. package/dist/src/components/nav/mono-nav.shadow.d.ts +21 -0
  213. package/dist/src/components/nav/nav-core.d.ts +34 -0
  214. package/dist/src/components/nav/nav-types.d.ts +48 -0
  215. package/dist/src/components/nav/nav-utils.d.ts +12 -0
  216. package/dist/src/components/radio/index.d.ts +4 -0
  217. package/dist/src/components/radio/index.shadow.d.ts +5 -0
  218. package/dist/src/components/radio/mono-radio.d.ts +31 -0
  219. package/dist/src/components/radio/mono-radio.shadow.d.ts +35 -0
  220. package/dist/src/components/radio/radio-core.d.ts +45 -0
  221. package/dist/src/components/radio/radio-types.d.ts +58 -0
  222. package/dist/src/components/radio/radio-utils.d.ts +12 -0
  223. package/dist/src/components/rich-text-editor/index.d.ts +5 -0
  224. package/dist/src/components/rich-text-editor/index.shadow.d.ts +6 -0
  225. package/dist/src/components/rich-text-editor/mono-rich-text-editor.d.ts +31 -0
  226. package/dist/src/components/rich-text-editor/mono-rich-text-editor.shadow.d.ts +34 -0
  227. package/dist/src/components/rich-text-editor/rich-text-editor-core.d.ts +100 -0
  228. package/dist/src/components/rich-text-editor/rich-text-editor-loader.d.ts +17 -0
  229. package/dist/src/components/rich-text-editor/rich-text-editor-toolbar.d.ts +65 -0
  230. package/dist/src/components/rich-text-editor/rich-text-editor-types.d.ts +231 -0
  231. package/dist/src/components/select/index.d.ts +4 -0
  232. package/dist/src/components/select/index.shadow.d.ts +5 -0
  233. package/dist/src/components/select/mono-select.d.ts +69 -0
  234. package/dist/src/components/select/mono-select.shadow.d.ts +48 -0
  235. package/dist/src/components/select/select-core.d.ts +98 -0
  236. package/dist/src/components/select/select-types.d.ts +258 -0
  237. package/dist/src/components/select/select-utils.d.ts +7 -0
  238. package/dist/src/components/sidebar/index.d.ts +4 -0
  239. package/dist/src/components/sidebar/index.shadow.d.ts +6 -0
  240. package/dist/src/components/sidebar/mono-sidebar.d.ts +34 -0
  241. package/dist/src/components/sidebar/mono-sidebar.shadow.d.ts +27 -0
  242. package/dist/src/components/sidebar/sidebar-core.d.ts +51 -0
  243. package/dist/src/components/sidebar/sidebar-types.d.ts +119 -0
  244. package/dist/src/components/sidebar/sidebar-utils.d.ts +55 -0
  245. package/dist/src/components/switch/index.d.ts +4 -0
  246. package/dist/src/components/switch/index.shadow.d.ts +5 -0
  247. package/dist/src/components/switch/mono-switch.d.ts +31 -0
  248. package/dist/src/components/switch/mono-switch.shadow.d.ts +36 -0
  249. package/dist/src/components/switch/switch-core.d.ts +49 -0
  250. package/dist/src/components/switch/switch-types.d.ts +64 -0
  251. package/dist/src/components/switch/switch-utils.d.ts +12 -0
  252. package/dist/src/components/table/array-source.d.ts +44 -0
  253. package/dist/src/components/table/date-filter-tree.d.ts +93 -0
  254. package/dist/src/components/table/grouping.d.ts +55 -0
  255. package/dist/src/components/table/index.d.ts +33 -0
  256. package/dist/src/components/table/index.shadow.d.ts +47 -0
  257. package/dist/src/components/table/mono-data-grid.d.ts +1756 -0
  258. package/dist/src/components/table/mono-table-checkbox-core.d.ts +76 -0
  259. package/dist/src/components/table/mono-table-checkbox.d.ts +34 -0
  260. package/dist/src/components/table/mono-table-checkbox.shadow.d.ts +26 -0
  261. package/dist/src/components/table/mono-table-detail-core.d.ts +87 -0
  262. package/dist/src/components/table/mono-table-detail.d.ts +32 -0
  263. package/dist/src/components/table/mono-table-detail.shadow.d.ts +31 -0
  264. package/dist/src/components/table/mono-table-empty-core.d.ts +60 -0
  265. package/dist/src/components/table/mono-table-empty.d.ts +35 -0
  266. package/dist/src/components/table/mono-table-empty.shadow.d.ts +40 -0
  267. package/dist/src/components/table/mono-table-error-core.d.ts +84 -0
  268. package/dist/src/components/table/mono-table-error.d.ts +28 -0
  269. package/dist/src/components/table/mono-table-error.shadow.d.ts +21 -0
  270. package/dist/src/components/table/mono-table-info-core.d.ts +13 -0
  271. package/dist/src/components/table/mono-table-info.d.ts +19 -0
  272. package/dist/src/components/table/mono-table-info.shadow.d.ts +14 -0
  273. package/dist/src/components/table/mono-table-loading-core.d.ts +41 -0
  274. package/dist/src/components/table/mono-table-loading.d.ts +50 -0
  275. package/dist/src/components/table/mono-table-loading.shadow.d.ts +14 -0
  276. package/dist/src/components/table/mono-table-page-size-core.d.ts +14 -0
  277. package/dist/src/components/table/mono-table-page-size.d.ts +16 -0
  278. package/dist/src/components/table/mono-table-page-size.shadow.d.ts +11 -0
  279. package/dist/src/components/table/mono-table-paging-core.d.ts +22 -0
  280. package/dist/src/components/table/mono-table-paging-group-core.d.ts +18 -0
  281. package/dist/src/components/table/mono-table-paging-group.d.ts +20 -0
  282. package/dist/src/components/table/mono-table-paging-group.shadow.d.ts +13 -0
  283. package/dist/src/components/table/mono-table-paging.d.ts +16 -0
  284. package/dist/src/components/table/mono-table-paging.shadow.d.ts +11 -0
  285. package/dist/src/components/table/mono-table-search-core.d.ts +74 -0
  286. package/dist/src/components/table/mono-table-search.d.ts +34 -0
  287. package/dist/src/components/table/mono-table-search.shadow.d.ts +21 -0
  288. package/dist/src/components/table/mono-table-sort-core.d.ts +35 -0
  289. package/dist/src/components/table/mono-table-sort.d.ts +38 -0
  290. package/dist/src/components/table/mono-table-sort.shadow.d.ts +20 -0
  291. package/dist/src/components/table/mono-table-summary-core.d.ts +26 -0
  292. package/dist/src/components/table/mono-table-summary.d.ts +24 -0
  293. package/dist/src/components/table/mono-table-summary.shadow.d.ts +14 -0
  294. package/dist/src/components/table/mono-table-th-core.d.ts +56 -0
  295. package/dist/src/components/table/mono-table-th.d.ts +41 -0
  296. package/dist/src/components/table/mono-table-th.shadow.d.ts +19 -0
  297. package/dist/src/components/table/store-group-source.d.ts +24 -0
  298. package/dist/src/components/table/table-controller-core.d.ts +40 -0
  299. package/dist/src/components/table/table-filter-icons.d.ts +3 -0
  300. package/dist/src/components/table/table-menu-core.d.ts +65 -0
  301. package/dist/src/components/table/table-overlay.d.ts +165 -0
  302. package/dist/src/components/table/table-sort-icons.d.ts +4 -0
  303. package/dist/src/components/table/table-sort-utils.d.ts +20 -0
  304. package/dist/src/components/table/table-types.d.ts +475 -0
  305. package/dist/src/components/tabs/index.d.ts +3 -0
  306. package/dist/src/components/tabs/index.shadow.d.ts +4 -0
  307. package/dist/src/components/tabs/mono-tabs.d.ts +33 -0
  308. package/dist/src/components/tabs/mono-tabs.shadow.d.ts +37 -0
  309. package/dist/src/components/tabs/tabs-core.d.ts +57 -0
  310. package/dist/src/components/tabs/tabs-types.d.ts +65 -0
  311. package/dist/src/components/tag-input/index.d.ts +4 -0
  312. package/dist/src/components/tag-input/index.shadow.d.ts +5 -0
  313. package/dist/src/components/tag-input/mono-tag-input.d.ts +66 -0
  314. package/dist/src/components/tag-input/mono-tag-input.shadow.d.ts +40 -0
  315. package/dist/src/components/tag-input/tag-input-core.d.ts +108 -0
  316. package/dist/src/components/tag-input/tag-input-types.d.ts +394 -0
  317. package/dist/src/components/tag-input/tag-input-utils.d.ts +8 -0
  318. package/dist/src/components/textarea/index.d.ts +4 -0
  319. package/dist/src/components/textarea/index.shadow.d.ts +5 -0
  320. package/dist/src/components/textarea/mono-textarea.d.ts +29 -0
  321. package/dist/src/components/textarea/mono-textarea.shadow.d.ts +31 -0
  322. package/dist/src/components/textarea/textarea-core.d.ts +60 -0
  323. package/dist/src/components/textarea/textarea-types.d.ts +131 -0
  324. package/dist/src/components/textarea/textarea-utils.d.ts +7 -0
  325. package/dist/src/components/tooltip/control-tooltip.d.ts +36 -0
  326. package/dist/src/components/tooltip/index.d.ts +6 -0
  327. package/dist/src/components/tooltip/tooltip-config.d.ts +27 -0
  328. package/dist/src/components/tooltip/tooltip-declarative.d.ts +41 -0
  329. package/dist/src/components/tooltip/tooltip-loader.d.ts +1 -0
  330. package/dist/src/components/tooltip/tooltip-types.d.ts +110 -0
  331. package/dist/src/composables/breakpoints.d.ts +59 -0
  332. package/dist/src/composables/chip-limits.d.ts +48 -0
  333. package/dist/src/composables/chip-strip.d.ts +93 -0
  334. package/dist/src/composables/color.d.ts +103 -0
  335. package/dist/src/composables/css-class.d.ts +27 -0
  336. package/dist/src/composables/css-size.d.ts +40 -0
  337. package/dist/src/composables/data-source-controller.d.ts +84 -0
  338. package/dist/src/composables/element-props.d.ts +46 -0
  339. package/dist/src/composables/field-icons.d.ts +7 -0
  340. package/dist/src/composables/hybird-prop.d.ts +79 -0
  341. package/dist/src/composables/hydration-flush.d.ts +34 -0
  342. package/dist/src/composables/icon.d.ts +17 -0
  343. package/dist/src/composables/layout-var.d.ts +34 -0
  344. package/dist/src/composables/light-slots.d.ts +133 -0
  345. package/dist/src/composables/mdi-glyphs.d.ts +4 -0
  346. package/dist/src/composables/mono-element.d.ts +9 -0
  347. package/dist/src/composables/mono-event.d.ts +55 -0
  348. package/dist/src/composables/mono-pending.d.ts +8 -0
  349. package/dist/src/composables/mono-skeleton.d.ts +193 -0
  350. package/dist/src/composables/mono-ui.d.ts +58 -0
  351. package/dist/src/composables/notifier.d.ts +46 -0
  352. package/dist/src/composables/popup-portal.d.ts +226 -0
  353. package/dist/src/composables/popup-stack.d.ts +70 -0
  354. package/dist/src/composables/rate-limit.d.ts +108 -0
  355. package/dist/src/composables/reactive.d.ts +53 -0
  356. package/dist/src/composables/shadow-css.d.ts +42 -0
  357. package/dist/src/composables/visibility.d.ts +36 -0
  358. package/dist/src/data/theme/index.d.ts +30 -0
  359. package/dist/src/data/theme/presets.d.ts +94 -0
  360. package/dist/src/entries/index.d.ts +2 -0
  361. package/dist/src/entries/index.node.d.ts +42 -0
  362. package/dist/src/entries/search.d.ts +3 -0
  363. package/dist/src/export/detail.d.ts +29 -0
  364. package/dist/src/export/download.d.ts +9 -0
  365. package/dist/src/export/excel/index.d.ts +27 -0
  366. package/dist/src/export/excel/nodes.d.ts +123 -0
  367. package/dist/src/export/expression.d.ts +36 -0
  368. package/dist/src/export/helpers.d.ts +6 -0
  369. package/dist/src/export/index.d.ts +13 -0
  370. package/dist/src/export/markdown.d.ts +52 -0
  371. package/dist/src/export/resolve-data.d.ts +31 -0
  372. package/dist/src/export/sentinel.d.ts +97 -0
  373. package/dist/src/export/sheet-name.d.ts +45 -0
  374. package/dist/src/export/styles.d.ts +33 -0
  375. package/dist/src/export/template.d.ts +10 -0
  376. package/dist/src/export/types.d.ts +259 -0
  377. package/dist/src/import/coerce.d.ts +38 -0
  378. package/dist/src/import/index.d.ts +16 -0
  379. package/dist/src/import/match.d.ts +54 -0
  380. package/dist/src/import/parse.d.ts +15 -0
  381. package/dist/src/import/types.d.ts +153 -0
  382. package/dist/src/nuxt/index.d.ts +94 -0
  383. package/dist/src/search/data-search.d.ts +207 -0
  384. package/dist/src/search/field-path.d.ts +107 -0
  385. package/dist/src/search/filter-eval.d.ts +30 -0
  386. package/dist/src/search/index.d.ts +22 -0
  387. package/dist/src/search/odata-search.d.ts +18 -0
  388. package/dist/src/search/search-expr.d.ts +160 -0
  389. package/dist/src/utils/data-source-apply.d.ts +97 -0
  390. package/dist/src/utils/data-source-options.d.ts +116 -0
  391. package/dist/src/utils/data-source-read.d.ts +85 -0
  392. package/dist/src/utils/data-source-summary.d.ts +55 -0
  393. package/dist/src/utils/normalize-error.d.ts +60 -0
  394. package/dist/src/vite/index.d.ts +48 -0
  395. package/dist/src/vite/mono-client-only.d.ts +35 -0
  396. package/dist/src/vite/mono-ssr-stub.d.ts +20 -0
  397. package/dist/src/vite/shadow-manifest.d.ts +8 -0
  398. package/dist/styles-BIJ31TM4.js +20146 -0
  399. package/dist/tooltip-CysgRgBi.js +760 -0
  400. package/dist/tooltip.d.ts +1 -0
  401. package/dist/tooltip.js +2 -0
  402. package/dist/ui/accordion.d.ts +1 -0
  403. package/dist/ui/accordion.js +466 -0
  404. package/dist/ui/alert.d.ts +1 -0
  405. package/dist/ui/alert.js +221 -0
  406. package/dist/ui/breadcrumb.d.ts +1 -0
  407. package/dist/ui/breadcrumb.js +902 -0
  408. package/dist/ui/button-dropdown.d.ts +1 -0
  409. package/dist/ui/button-dropdown.js +679 -0
  410. package/dist/ui/button.d.ts +1 -0
  411. package/dist/ui/button.js +63 -0
  412. package/dist/ui/card.d.ts +1 -0
  413. package/dist/ui/card.js +511 -0
  414. package/dist/ui/chart.d.ts +1 -0
  415. package/dist/ui/chart.js +808 -0
  416. package/dist/ui/checkbox.d.ts +1 -0
  417. package/dist/ui/checkbox.js +413 -0
  418. package/dist/ui/chip.d.ts +1 -0
  419. package/dist/ui/chip.js +558 -0
  420. package/dist/ui/date.d.ts +1 -0
  421. package/dist/ui/date.js +686 -0
  422. package/dist/ui/drawer.d.ts +1 -0
  423. package/dist/ui/drawer.js +901 -0
  424. package/dist/ui/dropdown-table.d.ts +1 -0
  425. package/dist/ui/dropdown-table.js +1291 -0
  426. package/dist/ui/dropdown.d.ts +1 -0
  427. package/dist/ui/dropdown.js +586 -0
  428. package/dist/ui/file-upload.d.ts +1 -0
  429. package/dist/ui/file-upload.js +688 -0
  430. package/dist/ui/filter.d.ts +1 -0
  431. package/dist/ui/filter.js +400 -0
  432. package/dist/ui/font/files/geist-47c091c9.woff2 +0 -0
  433. package/dist/ui/font/files/geist-8dd77544.woff2 +0 -0
  434. package/dist/ui/font/files/geist-b9248b1e.woff2 +0 -0
  435. package/dist/ui/font/files/geist-d40d74b4.woff2 +0 -0
  436. package/dist/ui/font/files/geist-f493429a.woff2 +0 -0
  437. package/dist/ui/font/files/geistmono-03737868.woff2 +0 -0
  438. package/dist/ui/font/files/geistmono-421a7e38.woff2 +0 -0
  439. package/dist/ui/font/files/geistmono-48ef518d.woff2 +0 -0
  440. package/dist/ui/font/files/geistmono-5df35d39.woff2 +0 -0
  441. package/dist/ui/font/files/geistmono-7de289a4.woff2 +0 -0
  442. package/dist/ui/font/files/geistmono-e976128f.woff2 +0 -0
  443. package/dist/ui/font/files/inter-05cf802c.woff2 +0 -0
  444. package/dist/ui/font/files/inter-2b2f25a4.woff2 +0 -0
  445. package/dist/ui/font/files/inter-467acc7a.woff2 +0 -0
  446. package/dist/ui/font/files/inter-6e85163c.woff2 +0 -0
  447. package/dist/ui/font/files/inter-7048add3.woff2 +0 -0
  448. package/dist/ui/font/files/inter-9be0371e.woff2 +0 -0
  449. package/dist/ui/font/files/inter-a28b7e31.woff2 +0 -0
  450. package/dist/ui/font/files/poppins-054df55a.woff2 +0 -0
  451. package/dist/ui/font/files/poppins-0ee5dc9a.woff2 +0 -0
  452. package/dist/ui/font/files/poppins-0f44cb18.woff2 +0 -0
  453. package/dist/ui/font/files/poppins-0ff0d30c.woff2 +0 -0
  454. package/dist/ui/font/files/poppins-13045147.woff2 +0 -0
  455. package/dist/ui/font/files/poppins-1db57cd9.woff2 +0 -0
  456. package/dist/ui/font/files/poppins-2cf2a902.woff2 +0 -0
  457. package/dist/ui/font/files/poppins-39e7f079.woff2 +0 -0
  458. package/dist/ui/font/files/poppins-9607042d.woff2 +0 -0
  459. package/dist/ui/font/files/poppins-9a88fc1f.woff2 +0 -0
  460. package/dist/ui/font/files/poppins-b8f4f752.woff2 +0 -0
  461. package/dist/ui/font/files/poppins-f5e57db4.woff2 +0 -0
  462. package/dist/ui/font/geist-mono.css +104 -0
  463. package/dist/ui/font/geist.css +168 -0
  464. package/dist/ui/font/inter.css +232 -0
  465. package/dist/ui/font/poppins.css +104 -0
  466. package/dist/ui/form.d.ts +1 -0
  467. package/dist/ui/form.js +3 -0
  468. package/dist/ui/index.css +21826 -0
  469. package/dist/ui/input.d.ts +1 -0
  470. package/dist/ui/input.js +1176 -0
  471. package/dist/ui/menu.d.ts +1 -0
  472. package/dist/ui/menu.js +1289 -0
  473. package/dist/ui/modal.d.ts +1 -0
  474. package/dist/ui/modal.js +995 -0
  475. package/dist/ui/nav.d.ts +1 -0
  476. package/dist/ui/nav.js +295 -0
  477. package/dist/ui/radio.d.ts +1 -0
  478. package/dist/ui/radio.js +379 -0
  479. package/dist/ui/rich-text-editor.d.ts +1 -0
  480. package/dist/ui/rich-text-editor.js +1338 -0
  481. package/dist/ui/select.d.ts +1 -0
  482. package/dist/ui/select.js +2066 -0
  483. package/dist/ui/shadow/accordion.js +442 -0
  484. package/dist/ui/shadow/alert.js +218 -0
  485. package/dist/ui/shadow/breadcrumb.js +919 -0
  486. package/dist/ui/shadow/button-dropdown.js +696 -0
  487. package/dist/ui/shadow/button.js +63 -0
  488. package/dist/ui/shadow/card.js +524 -0
  489. package/dist/ui/shadow/chart.js +1569 -0
  490. package/dist/ui/shadow/checkbox.js +457 -0
  491. package/dist/ui/shadow/chip.js +559 -0
  492. package/dist/ui/shadow/date.js +712 -0
  493. package/dist/ui/shadow/drawer.js +869 -0
  494. package/dist/ui/shadow/dropdown-table.js +1620 -0
  495. package/dist/ui/shadow/dropdown.js +547 -0
  496. package/dist/ui/shadow/file-upload.js +731 -0
  497. package/dist/ui/shadow/filter.js +402 -0
  498. package/dist/ui/shadow/input.js +1150 -0
  499. package/dist/ui/shadow/menu.js +899 -0
  500. package/dist/ui/shadow/modal.js +1193 -0
  501. package/dist/ui/shadow/nav.js +240 -0
  502. package/dist/ui/shadow/radio.js +408 -0
  503. package/dist/ui/shadow/rich-text-editor.js +1344 -0
  504. package/dist/ui/shadow/select.js +2033 -0
  505. package/dist/ui/shadow/sidebar.js +606 -0
  506. package/dist/ui/shadow/switch.js +428 -0
  507. package/dist/ui/shadow/table.js +4755 -0
  508. package/dist/ui/shadow/tabs.js +372 -0
  509. package/dist/ui/shadow/tag-input.js +2846 -0
  510. package/dist/ui/shadow/textarea.js +816 -0
  511. package/dist/ui/sidebar.d.ts +1 -0
  512. package/dist/ui/sidebar.js +659 -0
  513. package/dist/ui/switch.d.ts +1 -0
  514. package/dist/ui/switch.js +398 -0
  515. package/dist/ui/table.d.ts +1 -0
  516. package/dist/ui/table.js +4654 -0
  517. package/dist/ui/tabs.d.ts +1 -0
  518. package/dist/ui/tabs.js +379 -0
  519. package/dist/ui/tag-input.d.ts +1 -0
  520. package/dist/ui/tag-input.js +2819 -0
  521. package/dist/ui/textarea.d.ts +1 -0
  522. package/dist/ui/textarea.js +819 -0
  523. package/dist/ui/theme/legacy.css +293 -0
  524. package/dist/ui/theme/luma.css +743 -0
  525. package/dist/ui/theme/lyra.css +754 -0
  526. package/dist/ui/theme/maia.css +673 -0
  527. package/dist/ui/theme/mira.css +802 -0
  528. package/dist/ui/theme/nova.css +662 -0
  529. package/dist/ui/theme/one.css +699 -0
  530. package/dist/ui/theme/rhea.css +742 -0
  531. package/dist/ui/theme/sera.css +845 -0
  532. package/dist/ui/theme/tokens.css +261 -0
  533. package/dist/ui/theme/vega.css +467 -0
  534. package/dist/vite-C5iUK7so.js +329 -0
  535. package/dist/vite.d.ts +1 -0
  536. package/dist/vite.js +2 -0
  537. package/dist/vue.d.ts +282 -0
  538. package/package.json +411 -3
@@ -0,0 +1,2302 @@
1
+ import { a as stripDirectives, d as __toESM, i as escapeCellText, n as parseMarkdown, r as encodeDirective, u as __commonJSMin } from "./markdown-DfqrfOJN.js";
2
+ import { n as unwrapReactive } from "./reactive-BHsqVjRh.js";
3
+ import { n as isReadableSource, r as readAllRows } from "./data-source-read-CUX-lgrQ.js";
4
+ //#region src/export/download.ts
5
+ /**
6
+ * Browser download helper. Kept separate (and DOM-guarded) so the report engine
7
+ * can still render on a server — where `download()` is simply a no-op warning
8
+ * rather than a crash.
9
+ */
10
+ /** MIME type per output format. */
11
+ var MIME = {
12
+ md: "text/markdown;charset=utf-8",
13
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
14
+ };
15
+ /** Save a Blob to disk via a transient `<a download>`. Browser only. */
16
+ function downloadBlob(blob, fileName) {
17
+ if (typeof document === "undefined" || typeof URL?.createObjectURL !== "function") {
18
+ console.warn("[mono-export] download() needs a browser environment — skipped.");
19
+ return;
20
+ }
21
+ const url = URL.createObjectURL(blob);
22
+ const anchor = document.createElement("a");
23
+ anchor.href = url;
24
+ anchor.download = fileName;
25
+ anchor.style.display = "none";
26
+ document.body.appendChild(anchor);
27
+ anchor.click();
28
+ document.body.removeChild(anchor);
29
+ setTimeout(() => URL.revokeObjectURL(url), 0);
30
+ }
31
+ //#endregion
32
+ //#region src/export/detail.ts
33
+ function readPath(row, path) {
34
+ if (path in row) return row[path];
35
+ return path.split(".").reduce((acc, part) => acc == null ? acc : acc[part], row);
36
+ }
37
+ /**
38
+ * Run `task` over `items` with at most `limit` in flight.
39
+ *
40
+ * Deliberately NOT `Promise.all` over the whole list. The implementation this
41
+ * replaces fires every batch at once and wraps the lot in a single `.catch`, so
42
+ * one flaky request loses a multi-minute export and discards the error with it.
43
+ * Here a rejection is captured per item, and the rest of the workbook is still
44
+ * produced.
45
+ *
46
+ * The items are CHUNKS of master rows, not single documents — see the note at
47
+ * the top of this file.
48
+ */
49
+ async function pool(items, limit, task) {
50
+ const out = new Array(items.length);
51
+ let cursor = 0;
52
+ const worker = async () => {
53
+ for (;;) {
54
+ const index = cursor;
55
+ cursor += 1;
56
+ if (index >= items.length) return;
57
+ try {
58
+ out[index] = {
59
+ status: "fulfilled",
60
+ value: await task(items[index])
61
+ };
62
+ } catch (error) {
63
+ out[index] = {
64
+ status: "rejected",
65
+ reason: error
66
+ };
67
+ }
68
+ }
69
+ };
70
+ const size = Math.max(1, Math.min(limit, items.length));
71
+ await Promise.all(Array.from({ length: size }, worker));
72
+ return out;
73
+ }
74
+ /**
75
+ * Turn master rows into per-document detail rows.
76
+ *
77
+ * A document with no rows is reported in `skipped` rather than given an empty
78
+ * sheet — an empty worksheet behind a link is worse than no link, and the
79
+ * caller gets told which documents those were instead of having to diff the
80
+ * tab list.
81
+ */
82
+ async function resolveDetails(masterRows, detail) {
83
+ const rows = masterRows.filter((row) => !!row && typeof row === "object");
84
+ const keyOf = (row) => String(readPath(row, detail.key) ?? "");
85
+ const details = [];
86
+ const skipped = [];
87
+ const collect = (row, value) => {
88
+ const key = keyOf(row);
89
+ const list = Array.isArray(value) ? value : [];
90
+ if (!key || !list.length) {
91
+ skipped.push({
92
+ key: key || "(no key)",
93
+ reason: "empty"
94
+ });
95
+ return;
96
+ }
97
+ details.push({
98
+ row,
99
+ key,
100
+ rows: list
101
+ });
102
+ };
103
+ if (typeof detail.load === "function") {
104
+ const size = Math.max(1, Math.floor(detail.loadChunk ?? 100));
105
+ const chunks = [];
106
+ for (let i = 0; i < rows.length; i += size) chunks.push(rows.slice(i, i + size));
107
+ const groupBy = detail.groupBy ?? detail.key;
108
+ const groupOf = typeof groupBy === "function" ? groupBy : (row) => readPath(row, groupBy);
109
+ (await pool(chunks, detail.concurrency ?? 4, (chunk) => Promise.resolve(detail.load({
110
+ data: chunk,
111
+ keys: [...new Set(chunk.map((row) => readPath(row, detail.key)))],
112
+ key: detail.key
113
+ })))).forEach((result, index) => {
114
+ const chunk = chunks[index];
115
+ if (result.status === "rejected") {
116
+ for (const row of chunk) skipped.push({
117
+ key: keyOf(row) || "(no key)",
118
+ reason: "failed",
119
+ error: result.reason
120
+ });
121
+ return;
122
+ }
123
+ const byKey = /* @__PURE__ */ new Map();
124
+ for (const row of Array.isArray(result.value) ? result.value : []) {
125
+ if (!row || typeof row !== "object") continue;
126
+ const key = String(groupOf(row) ?? "");
127
+ if (!key) continue;
128
+ const bucket = byKey.get(key);
129
+ if (bucket) bucket.push(row);
130
+ else byKey.set(key, [row]);
131
+ }
132
+ for (const row of chunk) collect(row, byKey.get(keyOf(row)) ?? []);
133
+ });
134
+ return {
135
+ details,
136
+ skipped
137
+ };
138
+ }
139
+ if (detail.field) {
140
+ for (const row of rows) collect(row, readPath(row, detail.field));
141
+ return {
142
+ details,
143
+ skipped
144
+ };
145
+ }
146
+ throw new Error("[mono-export] `detail` needs either `field` or `load`.");
147
+ }
148
+ //#endregion
149
+ //#region src/export/resolve-data.ts
150
+ /**
151
+ * Turning live data sources in `options.data` into plain arrays.
152
+ *
153
+ * A template can only loop over an array, but the thing a consumer *has* is
154
+ * usually a devextreme DataSource. Rather than making everyone drain it by hand
155
+ * before every export, any DataSource-shaped value in `data` is drained here
156
+ * first — in chunks, honouring whatever filter / search / sort the source
157
+ * already carries — so the template just sees rows:
158
+ *
159
+ * ```ts
160
+ * data: { program: dataSourceProgramTransfer.value }
161
+ * ```
162
+ * ```hbs
163
+ * {{#each program}}| {{NoDokumen}} | {{currency TotalBudget}} |
164
+ * {{/each}}
165
+ * ```
166
+ */
167
+ /**
168
+ * Replace every DataSource / store in `data`'s **top level** with its rows.
169
+ *
170
+ * Top-level only, deliberately: it's predictable, and a deep walk would mean
171
+ * inspecting every record of every array already in `data` — a real cost for a
172
+ * 10k-row export, to support a nesting nobody has asked for. A source nested
173
+ * deeper stays the caller's job (`await table.getData()` and pass the array).
174
+ *
175
+ * Sources are drained concurrently — several are independent queries, and a
176
+ * report with three of them shouldn't take three times as long.
177
+ */
178
+ async function resolveExportData(data, options = {}) {
179
+ if (!data) return {};
180
+ const entries = Object.entries(data);
181
+ const pending = [];
182
+ const out = {};
183
+ for (const [key, raw] of entries) {
184
+ const value = unwrapReactive(raw);
185
+ if (isReadableSource(value)) pending.push(readAllRows(value, { chunkSize: options.chunkSize }).then((rows) => {
186
+ out[key] = rows;
187
+ }));
188
+ else out[key] = value;
189
+ }
190
+ if (pending.length) await Promise.all(pending);
191
+ return out;
192
+ }
193
+ //#endregion
194
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/interopRequireDefault.js
195
+ var require_interopRequireDefault = /* @__PURE__ */ __commonJSMin(((exports, module) => {
196
+ function _interopRequireDefault(e) {
197
+ return e && e.__esModule ? e : { "default": e };
198
+ }
199
+ module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
200
+ }));
201
+ //#endregion
202
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/typeof.js
203
+ var require_typeof = /* @__PURE__ */ __commonJSMin(((exports, module) => {
204
+ function _typeof(o) {
205
+ "@babel/helpers - typeof";
206
+ return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
207
+ return typeof o;
208
+ } : function(o) {
209
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
210
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
211
+ }
212
+ module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
213
+ }));
214
+ //#endregion
215
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/toPrimitive.js
216
+ var require_toPrimitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
217
+ var _typeof = require_typeof()["default"];
218
+ function toPrimitive(t, r) {
219
+ if ("object" != _typeof(t) || !t) return t;
220
+ var e = t[Symbol.toPrimitive];
221
+ if (void 0 !== e) {
222
+ var i = e.call(t, r || "default");
223
+ if ("object" != _typeof(i)) return i;
224
+ throw new TypeError("@@toPrimitive must return a primitive value.");
225
+ }
226
+ return ("string" === r ? String : Number)(t);
227
+ }
228
+ module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
229
+ }));
230
+ //#endregion
231
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/toPropertyKey.js
232
+ var require_toPropertyKey = /* @__PURE__ */ __commonJSMin(((exports, module) => {
233
+ var _typeof = require_typeof()["default"];
234
+ var toPrimitive = require_toPrimitive();
235
+ function toPropertyKey(t) {
236
+ var i = toPrimitive(t, "string");
237
+ return "symbol" == _typeof(i) ? i : i + "";
238
+ }
239
+ module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
240
+ }));
241
+ //#endregion
242
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/defineProperty.js
243
+ var require_defineProperty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
244
+ var toPropertyKey = require_toPropertyKey();
245
+ function _defineProperty(e, r, t) {
246
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
247
+ value: t,
248
+ enumerable: !0,
249
+ configurable: !0,
250
+ writable: !0
251
+ }) : e[r] = t, e;
252
+ }
253
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
254
+ }));
255
+ //#endregion
256
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/classCallCheck.js
257
+ var require_classCallCheck = /* @__PURE__ */ __commonJSMin(((exports, module) => {
258
+ function _classCallCheck(a, n) {
259
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
260
+ }
261
+ module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
262
+ }));
263
+ //#endregion
264
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/createClass.js
265
+ var require_createClass = /* @__PURE__ */ __commonJSMin(((exports, module) => {
266
+ var toPropertyKey = require_toPropertyKey();
267
+ function _defineProperties(e, r) {
268
+ for (var t = 0; t < r.length; t++) {
269
+ var o = r[t];
270
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
271
+ }
272
+ }
273
+ function _createClass(e, r, t) {
274
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
275
+ }
276
+ module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
277
+ }));
278
+ //#endregion
279
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/arrayLikeToArray.js
280
+ var require_arrayLikeToArray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
281
+ function _arrayLikeToArray(r, a) {
282
+ (null == a || a > r.length) && (a = r.length);
283
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
284
+ return n;
285
+ }
286
+ module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
287
+ }));
288
+ //#endregion
289
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js
290
+ var require_arrayWithoutHoles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
291
+ var arrayLikeToArray = require_arrayLikeToArray();
292
+ function _arrayWithoutHoles(r) {
293
+ if (Array.isArray(r)) return arrayLikeToArray(r);
294
+ }
295
+ module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
296
+ }));
297
+ //#endregion
298
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/iterableToArray.js
299
+ var require_iterableToArray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
300
+ function _iterableToArray(r) {
301
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
302
+ }
303
+ module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
304
+ }));
305
+ //#endregion
306
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js
307
+ var require_unsupportedIterableToArray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
308
+ var arrayLikeToArray = require_arrayLikeToArray();
309
+ function _unsupportedIterableToArray(r, a) {
310
+ if (r) {
311
+ if ("string" == typeof r) return arrayLikeToArray(r, a);
312
+ var t = {}.toString.call(r).slice(8, -1);
313
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;
314
+ }
315
+ }
316
+ module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
317
+ }));
318
+ //#endregion
319
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/nonIterableSpread.js
320
+ var require_nonIterableSpread = /* @__PURE__ */ __commonJSMin(((exports, module) => {
321
+ function _nonIterableSpread() {
322
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
323
+ }
324
+ module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
325
+ }));
326
+ //#endregion
327
+ //#region ../../node_modules/.pnpm/@babel+runtime@7.26.10/node_modules/@babel/runtime/helpers/toConsumableArray.js
328
+ var require_toConsumableArray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
329
+ var arrayWithoutHoles = require_arrayWithoutHoles();
330
+ var iterableToArray = require_iterableToArray();
331
+ var unsupportedIterableToArray = require_unsupportedIterableToArray();
332
+ var nonIterableSpread = require_nonIterableSpread();
333
+ function _toConsumableArray(r) {
334
+ return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread();
335
+ }
336
+ module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
337
+ }));
338
+ //#endregion
339
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/evaluator/handlers.js
340
+ var require_handlers$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
341
+ var _toConsumableArray2 = require_interopRequireDefault()(require_toConsumableArray());
342
+ var poolNames = {
343
+ functions: "Jexl Function",
344
+ transforms: "Transform"
345
+ };
346
+ /**
347
+ * Evaluates an ArrayLiteral by returning its value, with each element
348
+ * independently run through the evaluator.
349
+ * @param {{type: 'ObjectLiteral', value: <{}>}} ast An expression tree with an
350
+ * ObjectLiteral as the top node
351
+ * @returns {Promise.<[]>} resolves to a map contained evaluated values.
352
+ * @private
353
+ */
354
+ exports.ArrayLiteral = function(ast) {
355
+ return this.evalArray(ast.value);
356
+ };
357
+ /**
358
+ * Evaluates a BinaryExpression node by running the Grammar's evaluator for
359
+ * the given operator. Note that binary expressions support two types of
360
+ * evaluators: `eval` is called with the left and right operands pre-evaluated.
361
+ * `evalOnDemand`, if it exists, will be called with the left and right operands
362
+ * each individually wrapped in an object with an "eval" function that returns
363
+ * a promise with the resulting value. This allows the binary expression to
364
+ * evaluate the operands conditionally.
365
+ * @param {{type: 'BinaryExpression', operator: <string>, left: {},
366
+ * right: {}}} ast An expression tree with a BinaryExpression as the top
367
+ * node
368
+ * @returns {Promise<*>} resolves with the value of the BinaryExpression.
369
+ * @private
370
+ */
371
+ exports.BinaryExpression = function(ast) {
372
+ var _this = this;
373
+ var grammarOp = this._grammar.elements[ast.operator];
374
+ if (grammarOp.evalOnDemand) {
375
+ var wrap = function wrap(subAst) {
376
+ return { eval: function _eval() {
377
+ return _this.eval(subAst);
378
+ } };
379
+ };
380
+ return grammarOp.evalOnDemand(wrap(ast.left), wrap(ast.right));
381
+ }
382
+ return this.Promise.all([this.eval(ast.left), this.eval(ast.right)]).then(function(arr) {
383
+ return grammarOp.eval(arr[0], arr[1]);
384
+ });
385
+ };
386
+ /**
387
+ * Evaluates a ConditionalExpression node by first evaluating its test branch,
388
+ * and resolving with the consequent branch if the test is truthy, or the
389
+ * alternate branch if it is not. If there is no consequent branch, the test
390
+ * result will be used instead.
391
+ * @param {{type: 'ConditionalExpression', test: {}, consequent: {},
392
+ * alternate: {}}} ast An expression tree with a ConditionalExpression as
393
+ * the top node
394
+ * @private
395
+ */
396
+ exports.ConditionalExpression = function(ast) {
397
+ var _this2 = this;
398
+ return this.eval(ast.test).then(function(res) {
399
+ if (res) {
400
+ if (ast.consequent) return _this2.eval(ast.consequent);
401
+ return res;
402
+ }
403
+ return _this2.eval(ast.alternate);
404
+ });
405
+ };
406
+ /**
407
+ * Evaluates a FilterExpression by applying it to the subject value.
408
+ * @param {{type: 'FilterExpression', relative: <boolean>, expr: {},
409
+ * subject: {}}} ast An expression tree with a FilterExpression as the top
410
+ * node
411
+ * @returns {Promise<*>} resolves with the value of the FilterExpression.
412
+ * @private
413
+ */
414
+ exports.FilterExpression = function(ast) {
415
+ var _this3 = this;
416
+ return this.eval(ast.subject).then(function(subject) {
417
+ if (ast.relative) return _this3._filterRelative(subject, ast.expr);
418
+ return _this3._filterStatic(subject, ast.expr);
419
+ });
420
+ };
421
+ /**
422
+ * Evaluates an Identifier by either stemming from the evaluated 'from'
423
+ * expression tree or accessing the context provided when this Evaluator was
424
+ * constructed.
425
+ * @param {{type: 'Identifier', value: <string>, [from]: {}}} ast An expression
426
+ * tree with an Identifier as the top node
427
+ * @returns {Promise<*>|*} either the identifier's value, or a Promise that
428
+ * will resolve with the identifier's value.
429
+ * @private
430
+ */
431
+ exports.Identifier = function(ast) {
432
+ if (!ast.from) return ast.relative ? this._relContext[ast.value] : this._context[ast.value];
433
+ return this.eval(ast.from).then(function(context) {
434
+ if (context === void 0 || context === null) return;
435
+ if (Array.isArray(context)) context = context[0];
436
+ return context[ast.value];
437
+ });
438
+ };
439
+ /**
440
+ * Evaluates a Literal by returning its value property.
441
+ * @param {{type: 'Literal', value: <string|number|boolean>}} ast An expression
442
+ * tree with a Literal as its only node
443
+ * @returns {string|number|boolean} The value of the Literal node
444
+ * @private
445
+ */
446
+ exports.Literal = function(ast) {
447
+ return ast.value;
448
+ };
449
+ /**
450
+ * Evaluates an ObjectLiteral by returning its value, with each key
451
+ * independently run through the evaluator.
452
+ * @param {{type: 'ObjectLiteral', value: <{}>}} ast An expression tree with an
453
+ * ObjectLiteral as the top node
454
+ * @returns {Promise<{}>} resolves to a map contained evaluated values.
455
+ * @private
456
+ */
457
+ exports.ObjectLiteral = function(ast) {
458
+ return this.evalMap(ast.value);
459
+ };
460
+ /**
461
+ * Evaluates a FunctionCall node by applying the supplied arguments to a
462
+ * function defined in one of the grammar's function pools.
463
+ * @param {{type: 'FunctionCall', name: <string>}} ast An
464
+ * expression tree with a FunctionCall as the top node
465
+ * @returns {Promise<*>|*} the value of the function call, or a Promise that
466
+ * will resolve with the resulting value.
467
+ * @private
468
+ */
469
+ exports.FunctionCall = function(ast) {
470
+ var poolName = poolNames[ast.pool];
471
+ if (!poolName) throw new Error("Corrupt AST: Pool '".concat(ast.pool, "' not found"));
472
+ var func = this._grammar[ast.pool][ast.name];
473
+ if (!func) throw new Error("".concat(poolName, " ").concat(ast.name, " is not defined."));
474
+ return this.evalArray(ast.args || []).then(function(args) {
475
+ return func.apply(void 0, (0, _toConsumableArray2.default)(args));
476
+ });
477
+ };
478
+ /**
479
+ * Evaluates a Unary expression by passing the right side through the
480
+ * operator's eval function.
481
+ * @param {{type: 'UnaryExpression', operator: <string>, right: {}}} ast An
482
+ * expression tree with a UnaryExpression as the top node
483
+ * @returns {Promise<*>} resolves with the value of the UnaryExpression.
484
+ * @constructor
485
+ */
486
+ exports.UnaryExpression = function(ast) {
487
+ var _this4 = this;
488
+ return this.eval(ast.right).then(function(right) {
489
+ return _this4._grammar.elements[ast.operator].eval(right);
490
+ });
491
+ };
492
+ }));
493
+ //#endregion
494
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/evaluator/Evaluator.js
495
+ var require_Evaluator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
496
+ var _interopRequireDefault = require_interopRequireDefault();
497
+ var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
498
+ var _createClass2 = _interopRequireDefault(require_createClass());
499
+ var handlers = require_handlers$1();
500
+ module.exports = /* @__PURE__ */ function() {
501
+ function Evaluator(grammar, context, relativeContext) {
502
+ var promise = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : Promise;
503
+ (0, _classCallCheck2.default)(this, Evaluator);
504
+ this._grammar = grammar;
505
+ this._context = context || {};
506
+ this._relContext = relativeContext || this._context;
507
+ this.Promise = promise;
508
+ }
509
+ /**
510
+ * Evaluates an expression tree within the configured context.
511
+ * @param {{}} ast An expression tree object
512
+ * @returns {Promise<*>} resolves with the resulting value of the expression.
513
+ */
514
+ (0, _createClass2.default)(Evaluator, [
515
+ {
516
+ key: "eval",
517
+ value: function _eval(ast) {
518
+ var _this = this;
519
+ return this.Promise.resolve().then(function() {
520
+ return handlers[ast.type].call(_this, ast);
521
+ });
522
+ }
523
+ },
524
+ {
525
+ key: "evalArray",
526
+ value: function evalArray(arr) {
527
+ var _this2 = this;
528
+ return this.Promise.all(arr.map(function(elem) {
529
+ return _this2.eval(elem);
530
+ }));
531
+ }
532
+ },
533
+ {
534
+ key: "evalMap",
535
+ value: function evalMap(map) {
536
+ var _this3 = this;
537
+ var keys = Object.keys(map);
538
+ var result = {};
539
+ var asts = keys.map(function(key) {
540
+ return _this3.eval(map[key]);
541
+ });
542
+ return this.Promise.all(asts).then(function(vals) {
543
+ vals.forEach(function(val, idx) {
544
+ result[keys[idx]] = val;
545
+ });
546
+ return result;
547
+ });
548
+ }
549
+ },
550
+ {
551
+ key: "_filterRelative",
552
+ value: function _filterRelative(subject, expr) {
553
+ var _this4 = this;
554
+ var promises = [];
555
+ if (!Array.isArray(subject)) subject = subject === void 0 ? [] : [subject];
556
+ subject.forEach(function(elem) {
557
+ var evalInst = new Evaluator(_this4._grammar, _this4._context, elem, _this4.Promise);
558
+ promises.push(evalInst.eval(expr));
559
+ });
560
+ return this.Promise.all(promises).then(function(values) {
561
+ var results = [];
562
+ values.forEach(function(value, idx) {
563
+ if (value) results.push(subject[idx]);
564
+ });
565
+ return results;
566
+ });
567
+ }
568
+ },
569
+ {
570
+ key: "_filterStatic",
571
+ value: function _filterStatic(subject, expr) {
572
+ return this.eval(expr).then(function(res) {
573
+ if (typeof res === "boolean") return res ? subject : void 0;
574
+ return subject[res];
575
+ });
576
+ }
577
+ }
578
+ ]);
579
+ return Evaluator;
580
+ }();
581
+ }));
582
+ //#endregion
583
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Lexer.js
584
+ var require_Lexer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
585
+ var _interopRequireDefault = require_interopRequireDefault();
586
+ var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
587
+ var _createClass2 = _interopRequireDefault(require_createClass());
588
+ var numericRegex = /^-?(?:(?:[0-9]*\.[0-9]+)|[0-9]+)$/;
589
+ var identRegex = /^[a-zA-Zа-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$][a-zA-Zа-яА-Я0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$]*$/;
590
+ var escEscRegex = /\\\\/;
591
+ var whitespaceRegex = /^\s*$/;
592
+ var preOpRegexElems = [
593
+ "'(?:(?:\\\\')|[^'])*'",
594
+ "\"(?:(?:\\\\\")|[^\"])*\"",
595
+ "\\s+",
596
+ "\\btrue\\b",
597
+ "\\bfalse\\b"
598
+ ];
599
+ var postOpRegexElems = ["[a-zA-Zа-яА-Я_À-ÖØ-öø-ÿ\\$][a-zA-Z0-9а-яА-Я_À-ÖØ-öø-ÿ\\$]*", "(?:(?:[0-9]*\\.[0-9]+)|[0-9]+)"];
600
+ var minusNegatesAfter = [
601
+ "binaryOp",
602
+ "unaryOp",
603
+ "openParen",
604
+ "openBracket",
605
+ "question",
606
+ "colon"
607
+ ];
608
+ module.exports = /* @__PURE__ */ function() {
609
+ function Lexer(grammar) {
610
+ (0, _classCallCheck2.default)(this, Lexer);
611
+ this._grammar = grammar;
612
+ }
613
+ /**
614
+ * Splits a Jexl expression string into an array of expression elements.
615
+ * @param {string} str A Jexl expression string
616
+ * @returns {Array<string>} An array of substrings defining the functional
617
+ * elements of the expression.
618
+ */
619
+ (0, _createClass2.default)(Lexer, [
620
+ {
621
+ key: "getElements",
622
+ value: function getElements(str) {
623
+ var regex = this._getSplitRegex();
624
+ return str.split(regex).filter(function(elem) {
625
+ return elem;
626
+ });
627
+ }
628
+ },
629
+ {
630
+ key: "getTokens",
631
+ value: function getTokens(elements) {
632
+ var tokens = [];
633
+ var negate = false;
634
+ for (var i = 0; i < elements.length; i++) if (this._isWhitespace(elements[i])) {
635
+ if (tokens.length) tokens[tokens.length - 1].raw += elements[i];
636
+ } else if (elements[i] === "-" && this._isNegative(tokens)) negate = true;
637
+ else {
638
+ if (negate) {
639
+ elements[i] = "-" + elements[i];
640
+ negate = false;
641
+ }
642
+ tokens.push(this._createToken(elements[i]));
643
+ }
644
+ if (negate) tokens.push(this._createToken("-"));
645
+ return tokens;
646
+ }
647
+ },
648
+ {
649
+ key: "tokenize",
650
+ value: function tokenize(str) {
651
+ var elements = this.getElements(str);
652
+ return this.getTokens(elements);
653
+ }
654
+ },
655
+ {
656
+ key: "_createToken",
657
+ value: function _createToken(element) {
658
+ var token = {
659
+ type: "literal",
660
+ value: element,
661
+ raw: element
662
+ };
663
+ if (element[0] === "\"" || element[0] === "'") token.value = this._unquote(element);
664
+ else if (element.match(numericRegex)) token.value = parseFloat(element);
665
+ else if (element === "true" || element === "false") token.value = element === "true";
666
+ else if (this._grammar.elements[element]) token.type = this._grammar.elements[element].type;
667
+ else if (element.match(identRegex)) token.type = "identifier";
668
+ else throw new Error("Invalid expression token: ".concat(element));
669
+ return token;
670
+ }
671
+ },
672
+ {
673
+ key: "_escapeRegExp",
674
+ value: function _escapeRegExp(str) {
675
+ str = str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
676
+ if (str.match(identRegex)) str = "\\b" + str + "\\b";
677
+ return str;
678
+ }
679
+ },
680
+ {
681
+ key: "_getSplitRegex",
682
+ value: function _getSplitRegex() {
683
+ var _this = this;
684
+ if (!this._splitRegex) {
685
+ var elemArray = Object.keys(this._grammar.elements).sort(function(a, b) {
686
+ return b.length - a.length;
687
+ }).map(function(elem) {
688
+ return _this._escapeRegExp(elem);
689
+ }, this);
690
+ this._splitRegex = new RegExp("(" + [
691
+ preOpRegexElems.join("|"),
692
+ elemArray.join("|"),
693
+ postOpRegexElems.join("|")
694
+ ].join("|") + ")");
695
+ }
696
+ return this._splitRegex;
697
+ }
698
+ },
699
+ {
700
+ key: "_isNegative",
701
+ value: function _isNegative(tokens) {
702
+ if (!tokens.length) return true;
703
+ return minusNegatesAfter.some(function(type) {
704
+ return type === tokens[tokens.length - 1].type;
705
+ });
706
+ }
707
+ },
708
+ {
709
+ key: "_isWhitespace",
710
+ value: function _isWhitespace(str) {
711
+ return !!str.match(whitespaceRegex);
712
+ }
713
+ },
714
+ {
715
+ key: "_unquote",
716
+ value: function _unquote(str) {
717
+ var quote = str[0];
718
+ var escQuoteRegex = new RegExp("\\\\" + quote, "g");
719
+ return str.substr(1, str.length - 2).replace(escQuoteRegex, quote).replace(escEscRegex, "\\");
720
+ }
721
+ }
722
+ ]);
723
+ return Lexer;
724
+ }();
725
+ }));
726
+ //#endregion
727
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/handlers.js
728
+ var require_handlers = /* @__PURE__ */ __commonJSMin(((exports) => {
729
+ /**
730
+ * Handles a subexpression that's used to define a transform argument's value.
731
+ * @param {{type: <string>}} ast The subexpression tree
732
+ */
733
+ exports.argVal = function(ast) {
734
+ if (ast) this._cursor.args.push(ast);
735
+ };
736
+ /**
737
+ * Handles new array literals by adding them as a new node in the AST,
738
+ * initialized with an empty array.
739
+ */
740
+ exports.arrayStart = function() {
741
+ this._placeAtCursor({
742
+ type: "ArrayLiteral",
743
+ value: []
744
+ });
745
+ };
746
+ /**
747
+ * Handles a subexpression representing an element of an array literal.
748
+ * @param {{type: <string>}} ast The subexpression tree
749
+ */
750
+ exports.arrayVal = function(ast) {
751
+ if (ast) this._cursor.value.push(ast);
752
+ };
753
+ /**
754
+ * Handles tokens of type 'binaryOp', indicating an operation that has two
755
+ * inputs: a left side and a right side.
756
+ * @param {{type: <string>}} token A token object
757
+ */
758
+ exports.binaryOp = function(token) {
759
+ var precedence = this._grammar.elements[token.value].precedence || 0;
760
+ var parent = this._cursor._parent;
761
+ while (parent && parent.operator && this._grammar.elements[parent.operator].precedence >= precedence) {
762
+ this._cursor = parent;
763
+ parent = parent._parent;
764
+ }
765
+ var node = {
766
+ type: "BinaryExpression",
767
+ operator: token.value,
768
+ left: this._cursor
769
+ };
770
+ this._setParent(this._cursor, node);
771
+ this._cursor = parent;
772
+ this._placeAtCursor(node);
773
+ };
774
+ /**
775
+ * Handles successive nodes in an identifier chain. More specifically, it
776
+ * sets values that determine how the following identifier gets placed in the
777
+ * AST.
778
+ */
779
+ exports.dot = function() {
780
+ this._nextIdentEncapsulate = this._cursor && this._cursor.type !== "UnaryExpression" && (this._cursor.type !== "BinaryExpression" || this._cursor.type === "BinaryExpression" && this._cursor.right);
781
+ this._nextIdentRelative = !this._cursor || this._cursor && !this._nextIdentEncapsulate;
782
+ if (this._nextIdentRelative) this._relative = true;
783
+ };
784
+ /**
785
+ * Handles a subexpression used for filtering an array returned by an
786
+ * identifier chain.
787
+ * @param {{type: <string>}} ast The subexpression tree
788
+ */
789
+ exports.filter = function(ast) {
790
+ this._placeBeforeCursor({
791
+ type: "FilterExpression",
792
+ expr: ast,
793
+ relative: this._subParser.isRelative(),
794
+ subject: this._cursor
795
+ });
796
+ };
797
+ /**
798
+ * Handles identifier tokens when used to indicate the name of a function to
799
+ * be called.
800
+ * @param {{type: <string>}} token A token object
801
+ */
802
+ exports.functionCall = function() {
803
+ this._placeBeforeCursor({
804
+ type: "FunctionCall",
805
+ name: this._cursor.value,
806
+ args: [],
807
+ pool: "functions"
808
+ });
809
+ };
810
+ /**
811
+ * Handles identifier tokens by adding them as a new node in the AST.
812
+ * @param {{type: <string>}} token A token object
813
+ */
814
+ exports.identifier = function(token) {
815
+ var node = {
816
+ type: "Identifier",
817
+ value: token.value
818
+ };
819
+ if (this._nextIdentEncapsulate) {
820
+ node.from = this._cursor;
821
+ this._placeBeforeCursor(node);
822
+ this._nextIdentEncapsulate = false;
823
+ } else {
824
+ if (this._nextIdentRelative) {
825
+ node.relative = true;
826
+ this._nextIdentRelative = false;
827
+ }
828
+ this._placeAtCursor(node);
829
+ }
830
+ };
831
+ /**
832
+ * Handles literal values, such as strings, booleans, and numerics, by adding
833
+ * them as a new node in the AST.
834
+ * @param {{type: <string>}} token A token object
835
+ */
836
+ exports.literal = function(token) {
837
+ this._placeAtCursor({
838
+ type: "Literal",
839
+ value: token.value
840
+ });
841
+ };
842
+ /**
843
+ * Queues a new object literal key to be written once a value is collected.
844
+ * @param {{type: <string>}} token A token object
845
+ */
846
+ exports.objKey = function(token) {
847
+ this._curObjKey = token.value;
848
+ };
849
+ /**
850
+ * Handles new object literals by adding them as a new node in the AST,
851
+ * initialized with an empty object.
852
+ */
853
+ exports.objStart = function() {
854
+ this._placeAtCursor({
855
+ type: "ObjectLiteral",
856
+ value: {}
857
+ });
858
+ };
859
+ /**
860
+ * Handles an object value by adding its AST to the queued key on the object
861
+ * literal node currently at the cursor.
862
+ * @param {{type: <string>}} ast The subexpression tree
863
+ */
864
+ exports.objVal = function(ast) {
865
+ this._cursor.value[this._curObjKey] = ast;
866
+ };
867
+ /**
868
+ * Handles traditional subexpressions, delineated with the groupStart and
869
+ * groupEnd elements.
870
+ * @param {{type: <string>}} ast The subexpression tree
871
+ */
872
+ exports.subExpression = function(ast) {
873
+ this._placeAtCursor(ast);
874
+ };
875
+ /**
876
+ * Handles a completed alternate subexpression of a ternary operator.
877
+ * @param {{type: <string>}} ast The subexpression tree
878
+ */
879
+ exports.ternaryEnd = function(ast) {
880
+ this._cursor.alternate = ast;
881
+ };
882
+ /**
883
+ * Handles a completed consequent subexpression of a ternary operator.
884
+ * @param {{type: <string>}} ast The subexpression tree
885
+ */
886
+ exports.ternaryMid = function(ast) {
887
+ this._cursor.consequent = ast;
888
+ };
889
+ /**
890
+ * Handles the start of a new ternary expression by encapsulating the entire
891
+ * AST in a ConditionalExpression node, and using the existing tree as the
892
+ * test element.
893
+ */
894
+ exports.ternaryStart = function() {
895
+ this._tree = {
896
+ type: "ConditionalExpression",
897
+ test: this._tree
898
+ };
899
+ this._cursor = this._tree;
900
+ };
901
+ /**
902
+ * Handles identifier tokens when used to indicate the name of a transform to
903
+ * be applied.
904
+ * @param {{type: <string>}} token A token object
905
+ */
906
+ exports.transform = function(token) {
907
+ this._placeBeforeCursor({
908
+ type: "FunctionCall",
909
+ name: token.value,
910
+ args: [this._cursor],
911
+ pool: "transforms"
912
+ });
913
+ };
914
+ /**
915
+ * Handles token of type 'unaryOp', indicating that the operation has only
916
+ * one input: a right side.
917
+ * @param {{type: <string>}} token A token object
918
+ */
919
+ exports.unaryOp = function(token) {
920
+ this._placeAtCursor({
921
+ type: "UnaryExpression",
922
+ operator: token.value
923
+ });
924
+ };
925
+ }));
926
+ //#endregion
927
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/states.js
928
+ var require_states = /* @__PURE__ */ __commonJSMin(((exports) => {
929
+ var h = require_handlers();
930
+ /**
931
+ * A mapping of all states in the finite state machine to a set of instructions
932
+ * for handling or transitioning into other states. Each state can be handled
933
+ * in one of two schemes: a tokenType map, or a subHandler.
934
+ *
935
+ * Standard expression elements are handled through the tokenType object. This
936
+ * is an object map of all legal token types to encounter in this state (and
937
+ * any unexpected token types will generate a thrown error) to an options
938
+ * object that defines how they're handled. The available options are:
939
+ *
940
+ * {string} toState: The name of the state to which to transition
941
+ * immediately after handling this token
942
+ * {string} handler: The handler function to call when this token type is
943
+ * encountered in this state. If omitted, the default handler
944
+ * matching the token's "type" property will be called. If the handler
945
+ * function does not exist, no call will be made and no error will be
946
+ * generated. This is useful for tokens whose sole purpose is to
947
+ * transition to other states.
948
+ *
949
+ * States that consume a subexpression should define a subHandler, the
950
+ * function to be called with an expression tree argument when the
951
+ * subexpression is complete. Completeness is determined through the
952
+ * endStates object, which maps tokens on which an expression should end to the
953
+ * state to which to transition once the subHandler function has been called.
954
+ *
955
+ * Additionally, any state in which it is legal to mark the AST as completed
956
+ * should have a 'completable' property set to boolean true. Attempting to
957
+ * call {@link Parser#complete} in any state without this property will result
958
+ * in a thrown Error.
959
+ *
960
+ * @type {{}}
961
+ */
962
+ exports.states = {
963
+ expectOperand: { tokenTypes: {
964
+ literal: { toState: "expectBinOp" },
965
+ identifier: { toState: "identifier" },
966
+ unaryOp: {},
967
+ openParen: { toState: "subExpression" },
968
+ openCurl: {
969
+ toState: "expectObjKey",
970
+ handler: h.objStart
971
+ },
972
+ dot: { toState: "traverse" },
973
+ openBracket: {
974
+ toState: "arrayVal",
975
+ handler: h.arrayStart
976
+ }
977
+ } },
978
+ expectBinOp: {
979
+ tokenTypes: {
980
+ binaryOp: { toState: "expectOperand" },
981
+ pipe: { toState: "expectTransform" },
982
+ dot: { toState: "traverse" },
983
+ question: {
984
+ toState: "ternaryMid",
985
+ handler: h.ternaryStart
986
+ }
987
+ },
988
+ completable: true
989
+ },
990
+ expectTransform: { tokenTypes: { identifier: {
991
+ toState: "postTransform",
992
+ handler: h.transform
993
+ } } },
994
+ expectObjKey: { tokenTypes: {
995
+ identifier: {
996
+ toState: "expectKeyValSep",
997
+ handler: h.objKey
998
+ },
999
+ closeCurl: { toState: "expectBinOp" }
1000
+ } },
1001
+ expectKeyValSep: { tokenTypes: { colon: { toState: "objVal" } } },
1002
+ postTransform: {
1003
+ tokenTypes: {
1004
+ openParen: { toState: "argVal" },
1005
+ binaryOp: { toState: "expectOperand" },
1006
+ dot: { toState: "traverse" },
1007
+ openBracket: { toState: "filter" },
1008
+ pipe: { toState: "expectTransform" }
1009
+ },
1010
+ completable: true
1011
+ },
1012
+ postArgs: {
1013
+ tokenTypes: {
1014
+ binaryOp: { toState: "expectOperand" },
1015
+ dot: { toState: "traverse" },
1016
+ openBracket: { toState: "filter" },
1017
+ pipe: { toState: "expectTransform" }
1018
+ },
1019
+ completable: true
1020
+ },
1021
+ identifier: {
1022
+ tokenTypes: {
1023
+ binaryOp: { toState: "expectOperand" },
1024
+ dot: { toState: "traverse" },
1025
+ openBracket: { toState: "filter" },
1026
+ openParen: {
1027
+ toState: "argVal",
1028
+ handler: h.functionCall
1029
+ },
1030
+ pipe: { toState: "expectTransform" },
1031
+ question: {
1032
+ toState: "ternaryMid",
1033
+ handler: h.ternaryStart
1034
+ }
1035
+ },
1036
+ completable: true
1037
+ },
1038
+ traverse: { tokenTypes: { identifier: { toState: "identifier" } } },
1039
+ filter: {
1040
+ subHandler: h.filter,
1041
+ endStates: { closeBracket: "identifier" }
1042
+ },
1043
+ subExpression: {
1044
+ subHandler: h.subExpression,
1045
+ endStates: { closeParen: "expectBinOp" }
1046
+ },
1047
+ argVal: {
1048
+ subHandler: h.argVal,
1049
+ endStates: {
1050
+ comma: "argVal",
1051
+ closeParen: "postArgs"
1052
+ }
1053
+ },
1054
+ objVal: {
1055
+ subHandler: h.objVal,
1056
+ endStates: {
1057
+ comma: "expectObjKey",
1058
+ closeCurl: "expectBinOp"
1059
+ }
1060
+ },
1061
+ arrayVal: {
1062
+ subHandler: h.arrayVal,
1063
+ endStates: {
1064
+ comma: "arrayVal",
1065
+ closeBracket: "expectBinOp"
1066
+ }
1067
+ },
1068
+ ternaryMid: {
1069
+ subHandler: h.ternaryMid,
1070
+ endStates: { colon: "ternaryEnd" }
1071
+ },
1072
+ ternaryEnd: {
1073
+ subHandler: h.ternaryEnd,
1074
+ completable: true
1075
+ }
1076
+ };
1077
+ }));
1078
+ //#endregion
1079
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/Parser.js
1080
+ var require_Parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1081
+ var _interopRequireDefault = require_interopRequireDefault();
1082
+ var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
1083
+ var _createClass2 = _interopRequireDefault(require_createClass());
1084
+ var handlers = require_handlers();
1085
+ var states = require_states().states;
1086
+ module.exports = /* @__PURE__ */ function() {
1087
+ function Parser(grammar, prefix, stopMap) {
1088
+ (0, _classCallCheck2.default)(this, Parser);
1089
+ this._grammar = grammar;
1090
+ this._state = "expectOperand";
1091
+ this._tree = null;
1092
+ this._exprStr = prefix || "";
1093
+ this._relative = false;
1094
+ this._stopMap = stopMap || {};
1095
+ }
1096
+ /**
1097
+ * Processes a new token into the AST and manages the transitions of the state
1098
+ * machine.
1099
+ * @param {{type: <string>}} token A token object, as provided by the
1100
+ * {@link Lexer#tokenize} function.
1101
+ * @throws {Error} if a token is added when the Parser has been marked as
1102
+ * complete by {@link #complete}, or if an unexpected token type is added.
1103
+ * @returns {boolean|*} the stopState value if this parser encountered a token
1104
+ * in the stopState mapb false if tokens can continue.
1105
+ */
1106
+ (0, _createClass2.default)(Parser, [
1107
+ {
1108
+ key: "addToken",
1109
+ value: function addToken(token) {
1110
+ if (this._state === "complete") throw new Error("Cannot add a new token to a completed Parser");
1111
+ var state = states[this._state];
1112
+ var startExpr = this._exprStr;
1113
+ this._exprStr += token.raw;
1114
+ if (state.subHandler) {
1115
+ if (!this._subParser) this._startSubExpression(startExpr);
1116
+ var stopState = this._subParser.addToken(token);
1117
+ if (stopState) {
1118
+ this._endSubExpression();
1119
+ if (this._parentStop) return stopState;
1120
+ this._state = stopState;
1121
+ }
1122
+ } else if (state.tokenTypes[token.type]) {
1123
+ var typeOpts = state.tokenTypes[token.type];
1124
+ var handleFunc = handlers[token.type];
1125
+ if (typeOpts.handler) handleFunc = typeOpts.handler;
1126
+ if (handleFunc) handleFunc.call(this, token);
1127
+ if (typeOpts.toState) this._state = typeOpts.toState;
1128
+ } else if (this._stopMap[token.type]) return this._stopMap[token.type];
1129
+ else throw new Error("Token ".concat(token.raw, " (").concat(token.type, ") unexpected in expression: ").concat(this._exprStr));
1130
+ return false;
1131
+ }
1132
+ },
1133
+ {
1134
+ key: "addTokens",
1135
+ value: function addTokens(tokens) {
1136
+ tokens.forEach(this.addToken, this);
1137
+ }
1138
+ },
1139
+ {
1140
+ key: "complete",
1141
+ value: function complete() {
1142
+ if (this._cursor && !states[this._state].completable) throw new Error("Unexpected end of expression: ".concat(this._exprStr));
1143
+ if (this._subParser) this._endSubExpression();
1144
+ this._state = "complete";
1145
+ return this._cursor ? this._tree : null;
1146
+ }
1147
+ },
1148
+ {
1149
+ key: "isRelative",
1150
+ value: function isRelative() {
1151
+ return this._relative;
1152
+ }
1153
+ },
1154
+ {
1155
+ key: "_endSubExpression",
1156
+ value: function _endSubExpression() {
1157
+ states[this._state].subHandler.call(this, this._subParser.complete());
1158
+ this._subParser = null;
1159
+ }
1160
+ },
1161
+ {
1162
+ key: "_placeAtCursor",
1163
+ value: function _placeAtCursor(node) {
1164
+ if (!this._cursor) this._tree = node;
1165
+ else {
1166
+ this._cursor.right = node;
1167
+ this._setParent(node, this._cursor);
1168
+ }
1169
+ this._cursor = node;
1170
+ }
1171
+ },
1172
+ {
1173
+ key: "_placeBeforeCursor",
1174
+ value: function _placeBeforeCursor(node) {
1175
+ this._cursor = this._cursor._parent;
1176
+ this._placeAtCursor(node);
1177
+ }
1178
+ },
1179
+ {
1180
+ key: "_setParent",
1181
+ value: function _setParent(node, parent) {
1182
+ Object.defineProperty(node, "_parent", {
1183
+ value: parent,
1184
+ writable: true
1185
+ });
1186
+ }
1187
+ },
1188
+ {
1189
+ key: "_startSubExpression",
1190
+ value: function _startSubExpression(exprStr) {
1191
+ var endStates = states[this._state].endStates;
1192
+ if (!endStates) {
1193
+ this._parentStop = true;
1194
+ endStates = this._stopMap;
1195
+ }
1196
+ this._subParser = new Parser(this._grammar, exprStr, endStates);
1197
+ }
1198
+ }
1199
+ ]);
1200
+ return Parser;
1201
+ }();
1202
+ }));
1203
+ //#endregion
1204
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/PromiseSync.js
1205
+ var require_PromiseSync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1206
+ var _interopRequireDefault = require_interopRequireDefault();
1207
+ var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
1208
+ var _createClass2 = _interopRequireDefault(require_createClass());
1209
+ var PromiseSync = /*#__PURE__*/ function() {
1210
+ function PromiseSync(fn) {
1211
+ (0, _classCallCheck2.default)(this, PromiseSync);
1212
+ fn(this._resolve.bind(this), this._reject.bind(this));
1213
+ }
1214
+ (0, _createClass2.default)(PromiseSync, [
1215
+ {
1216
+ key: "catch",
1217
+ value: function _catch(rejected) {
1218
+ if (this.error) try {
1219
+ this._resolve(rejected(this.error));
1220
+ } catch (e) {
1221
+ this._reject(e);
1222
+ }
1223
+ return this;
1224
+ }
1225
+ },
1226
+ {
1227
+ key: "then",
1228
+ value: function then(resolved, rejected) {
1229
+ if (!this.error) try {
1230
+ this._resolve(resolved(this.value));
1231
+ } catch (e) {
1232
+ this._reject(e);
1233
+ }
1234
+ if (rejected) this.catch(rejected);
1235
+ return this;
1236
+ }
1237
+ },
1238
+ {
1239
+ key: "_reject",
1240
+ value: function _reject(error) {
1241
+ this.value = void 0;
1242
+ this.error = error;
1243
+ }
1244
+ },
1245
+ {
1246
+ key: "_resolve",
1247
+ value: function _resolve(val) {
1248
+ if (val instanceof PromiseSync) if (val.error) this._reject(val.error);
1249
+ else this._resolve(val.value);
1250
+ else {
1251
+ this.value = val;
1252
+ this.error = void 0;
1253
+ }
1254
+ }
1255
+ }
1256
+ ]);
1257
+ return PromiseSync;
1258
+ }();
1259
+ PromiseSync.all = function(vals) {
1260
+ return new PromiseSync(function(resolve) {
1261
+ resolve(vals.map(function(val) {
1262
+ while (val instanceof PromiseSync) {
1263
+ if (val.error) throw Error(val.error);
1264
+ val = val.value;
1265
+ }
1266
+ return val;
1267
+ }));
1268
+ });
1269
+ };
1270
+ PromiseSync.resolve = function(val) {
1271
+ return new PromiseSync(function(resolve) {
1272
+ return resolve(val);
1273
+ });
1274
+ };
1275
+ PromiseSync.reject = function(error) {
1276
+ return new PromiseSync(function(resolve, reject) {
1277
+ return reject(error);
1278
+ });
1279
+ };
1280
+ module.exports = PromiseSync;
1281
+ }));
1282
+ //#endregion
1283
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Expression.js
1284
+ var require_Expression = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1285
+ var _interopRequireDefault = require_interopRequireDefault();
1286
+ var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
1287
+ var _createClass2 = _interopRequireDefault(require_createClass());
1288
+ var Evaluator = require_Evaluator();
1289
+ var Lexer = require_Lexer();
1290
+ var Parser = require_Parser();
1291
+ var PromiseSync = require_PromiseSync();
1292
+ module.exports = /* @__PURE__ */ function() {
1293
+ function Expression(grammar, exprStr) {
1294
+ (0, _classCallCheck2.default)(this, Expression);
1295
+ this._grammar = grammar;
1296
+ this._exprStr = exprStr;
1297
+ this._ast = null;
1298
+ }
1299
+ /**
1300
+ * Forces a compilation of the expression string that this Expression object
1301
+ * was constructed with. This function can be called multiple times; useful
1302
+ * if the language elements of the associated Jexl instance change.
1303
+ * @returns {Expression} this Expression instance, for convenience
1304
+ */
1305
+ (0, _createClass2.default)(Expression, [
1306
+ {
1307
+ key: "compile",
1308
+ value: function compile() {
1309
+ var lexer = new Lexer(this._grammar);
1310
+ var parser = new Parser(this._grammar);
1311
+ var tokens = lexer.tokenize(this._exprStr);
1312
+ parser.addTokens(tokens);
1313
+ this._ast = parser.complete();
1314
+ return this;
1315
+ }
1316
+ },
1317
+ {
1318
+ key: "eval",
1319
+ value: function _eval() {
1320
+ var context = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1321
+ return this._eval(context, Promise);
1322
+ }
1323
+ },
1324
+ {
1325
+ key: "evalSync",
1326
+ value: function evalSync() {
1327
+ var context = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1328
+ var res = this._eval(context, PromiseSync);
1329
+ if (res.error) throw res.error;
1330
+ return res.value;
1331
+ }
1332
+ },
1333
+ {
1334
+ key: "_eval",
1335
+ value: function _eval(context, promise) {
1336
+ var _this = this;
1337
+ return promise.resolve().then(function() {
1338
+ var ast = _this._getAst();
1339
+ return new Evaluator(_this._grammar, context, void 0, promise).eval(ast);
1340
+ });
1341
+ }
1342
+ },
1343
+ {
1344
+ key: "_getAst",
1345
+ value: function _getAst() {
1346
+ if (!this._ast) this.compile();
1347
+ return this._ast;
1348
+ }
1349
+ }
1350
+ ]);
1351
+ return Expression;
1352
+ }();
1353
+ }));
1354
+ //#endregion
1355
+ //#region ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/grammar.js
1356
+ var require_grammar = /* @__PURE__ */ __commonJSMin(((exports) => {
1357
+ exports.getGrammar = function() {
1358
+ return {
1359
+ /**
1360
+ * A map of all expression elements to their properties. Note that changes
1361
+ * here may require changes in the Lexer or Parser.
1362
+ * @type {{}}
1363
+ */
1364
+ elements: {
1365
+ ".": { type: "dot" },
1366
+ "[": { type: "openBracket" },
1367
+ "]": { type: "closeBracket" },
1368
+ "|": { type: "pipe" },
1369
+ "{": { type: "openCurl" },
1370
+ "}": { type: "closeCurl" },
1371
+ ":": { type: "colon" },
1372
+ ",": { type: "comma" },
1373
+ "(": { type: "openParen" },
1374
+ ")": { type: "closeParen" },
1375
+ "?": { type: "question" },
1376
+ "+": {
1377
+ type: "binaryOp",
1378
+ precedence: 30,
1379
+ eval: function _eval(left, right) {
1380
+ return left + right;
1381
+ }
1382
+ },
1383
+ "-": {
1384
+ type: "binaryOp",
1385
+ precedence: 30,
1386
+ eval: function _eval(left, right) {
1387
+ return left - right;
1388
+ }
1389
+ },
1390
+ "*": {
1391
+ type: "binaryOp",
1392
+ precedence: 40,
1393
+ eval: function _eval(left, right) {
1394
+ return left * right;
1395
+ }
1396
+ },
1397
+ "/": {
1398
+ type: "binaryOp",
1399
+ precedence: 40,
1400
+ eval: function _eval(left, right) {
1401
+ return left / right;
1402
+ }
1403
+ },
1404
+ "//": {
1405
+ type: "binaryOp",
1406
+ precedence: 40,
1407
+ eval: function _eval(left, right) {
1408
+ return Math.floor(left / right);
1409
+ }
1410
+ },
1411
+ "%": {
1412
+ type: "binaryOp",
1413
+ precedence: 50,
1414
+ eval: function _eval(left, right) {
1415
+ return left % right;
1416
+ }
1417
+ },
1418
+ "^": {
1419
+ type: "binaryOp",
1420
+ precedence: 50,
1421
+ eval: function _eval(left, right) {
1422
+ return Math.pow(left, right);
1423
+ }
1424
+ },
1425
+ "==": {
1426
+ type: "binaryOp",
1427
+ precedence: 20,
1428
+ eval: function _eval(left, right) {
1429
+ return left == right;
1430
+ }
1431
+ },
1432
+ "!=": {
1433
+ type: "binaryOp",
1434
+ precedence: 20,
1435
+ eval: function _eval(left, right) {
1436
+ return left != right;
1437
+ }
1438
+ },
1439
+ ">": {
1440
+ type: "binaryOp",
1441
+ precedence: 20,
1442
+ eval: function _eval(left, right) {
1443
+ return left > right;
1444
+ }
1445
+ },
1446
+ ">=": {
1447
+ type: "binaryOp",
1448
+ precedence: 20,
1449
+ eval: function _eval(left, right) {
1450
+ return left >= right;
1451
+ }
1452
+ },
1453
+ "<": {
1454
+ type: "binaryOp",
1455
+ precedence: 20,
1456
+ eval: function _eval(left, right) {
1457
+ return left < right;
1458
+ }
1459
+ },
1460
+ "<=": {
1461
+ type: "binaryOp",
1462
+ precedence: 20,
1463
+ eval: function _eval(left, right) {
1464
+ return left <= right;
1465
+ }
1466
+ },
1467
+ "&&": {
1468
+ type: "binaryOp",
1469
+ precedence: 10,
1470
+ evalOnDemand: function evalOnDemand(left, right) {
1471
+ return left.eval().then(function(leftVal) {
1472
+ if (!leftVal) return leftVal;
1473
+ return right.eval();
1474
+ });
1475
+ }
1476
+ },
1477
+ "||": {
1478
+ type: "binaryOp",
1479
+ precedence: 10,
1480
+ evalOnDemand: function evalOnDemand(left, right) {
1481
+ return left.eval().then(function(leftVal) {
1482
+ if (leftVal) return leftVal;
1483
+ return right.eval();
1484
+ });
1485
+ }
1486
+ },
1487
+ in: {
1488
+ type: "binaryOp",
1489
+ precedence: 20,
1490
+ eval: function _eval(left, right) {
1491
+ if (typeof right === "string") return right.indexOf(left) !== -1;
1492
+ if (Array.isArray(right)) return right.some(function(elem) {
1493
+ return elem === left;
1494
+ });
1495
+ return false;
1496
+ }
1497
+ },
1498
+ "!": {
1499
+ type: "unaryOp",
1500
+ precedence: Infinity,
1501
+ eval: function _eval(right) {
1502
+ return !right;
1503
+ }
1504
+ }
1505
+ },
1506
+ /**
1507
+ * A map of function names to javascript functions. A Jexl function
1508
+ * takes zero ore more arguemnts:
1509
+ *
1510
+ * - {*} ...args: A variable number of arguments passed to this function.
1511
+ * All of these are pre-evaluated to their actual values before calling
1512
+ * the function.
1513
+ *
1514
+ * The Jexl function should return either the transformed value, or
1515
+ * a Promises/A+ Promise object that resolves with the value and rejects
1516
+ * or throws only when an unrecoverable error occurs. Functions should
1517
+ * generally return undefined when they don't make sense to be used on the
1518
+ * given value type, rather than throw/reject. An error is only
1519
+ * appropriate when the function would normally return a value, but
1520
+ * cannot due to some other failure.
1521
+ */
1522
+ functions: {},
1523
+ /**
1524
+ * A map of transform names to transform functions. A transform function
1525
+ * takes one ore more arguemnts:
1526
+ *
1527
+ * - {*} val: A value to be transformed
1528
+ * - {*} ...args: A variable number of arguments passed to this transform.
1529
+ * All of these are pre-evaluated to their actual values before calling
1530
+ * the function.
1531
+ *
1532
+ * The transform function should return either the transformed value, or
1533
+ * a Promises/A+ Promise object that resolves with the value and rejects
1534
+ * or throws only when an unrecoverable error occurs. Transforms should
1535
+ * generally return undefined when they don't make sense to be used on the
1536
+ * given value type, rather than throw/reject. An error is only
1537
+ * appropriate when the transform would normally return a value, but
1538
+ * cannot due to some other failure.
1539
+ */
1540
+ transforms: {}
1541
+ };
1542
+ };
1543
+ }));
1544
+ //#endregion
1545
+ //#region src/export/expression.ts
1546
+ var import_Jexl = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
1547
+ var _interopRequireDefault = require_interopRequireDefault();
1548
+ var _defineProperty2 = _interopRequireDefault(require_defineProperty());
1549
+ var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
1550
+ var _createClass2 = _interopRequireDefault(require_createClass());
1551
+ var Expression = require_Expression();
1552
+ var getGrammar = require_grammar().getGrammar;
1553
+ /**
1554
+ * Jexl is the Javascript Expression Language, capable of parsing and
1555
+ * evaluating basic to complex expression strings, combined with advanced
1556
+ * xpath-like drilldown into native Javascript objects.
1557
+ * @constructor
1558
+ */
1559
+ var Jexl = /*#__PURE__*/ function() {
1560
+ function Jexl() {
1561
+ (0, _classCallCheck2.default)(this, Jexl);
1562
+ this.expr = this.expr.bind(this);
1563
+ this._grammar = getGrammar();
1564
+ }
1565
+ /**
1566
+ * Adds a binary operator to Jexl at the specified precedence. The higher the
1567
+ * precedence, the earlier the operator is applied in the order of operations.
1568
+ * For example, * has a higher precedence than +, because multiplication comes
1569
+ * before division.
1570
+ *
1571
+ * Please see grammar.js for a listing of all default operators and their
1572
+ * precedence values in order to choose the appropriate precedence for the
1573
+ * new operator.
1574
+ * @param {string} operator The operator string to be added
1575
+ * @param {number} precedence The operator's precedence
1576
+ * @param {function} fn A function to run to calculate the result. The function
1577
+ * will be called with two arguments: left and right, denoting the values
1578
+ * on either side of the operator. It should return either the resulting
1579
+ * value, or a Promise that resolves with the resulting value.
1580
+ * @param {boolean} [manualEval] If true, the `left` and `right` arguments
1581
+ * will be wrapped in objects with an `eval` function. Calling
1582
+ * left.eval() or right.eval() will return a promise that resolves to
1583
+ * that operand's actual value. This is useful to conditionally evaluate
1584
+ * operands.
1585
+ */
1586
+ (0, _createClass2.default)(Jexl, [
1587
+ {
1588
+ key: "addBinaryOp",
1589
+ value: function addBinaryOp(operator, precedence, fn, manualEval) {
1590
+ this._addGrammarElement(operator, (0, _defineProperty2.default)({
1591
+ type: "binaryOp",
1592
+ precedence
1593
+ }, manualEval ? "evalOnDemand" : "eval", fn));
1594
+ }
1595
+ },
1596
+ {
1597
+ key: "addFunction",
1598
+ value: function addFunction(name, fn) {
1599
+ this._grammar.functions[name] = fn;
1600
+ }
1601
+ },
1602
+ {
1603
+ key: "addFunctions",
1604
+ value: function addFunctions(map) {
1605
+ for (var key in map) this._grammar.functions[key] = map[key];
1606
+ }
1607
+ },
1608
+ {
1609
+ key: "addUnaryOp",
1610
+ value: function addUnaryOp(operator, fn) {
1611
+ this._addGrammarElement(operator, {
1612
+ type: "unaryOp",
1613
+ weight: Infinity,
1614
+ eval: fn
1615
+ });
1616
+ }
1617
+ },
1618
+ {
1619
+ key: "addTransform",
1620
+ value: function addTransform(name, fn) {
1621
+ this._grammar.transforms[name] = fn;
1622
+ }
1623
+ },
1624
+ {
1625
+ key: "addTransforms",
1626
+ value: function addTransforms(map) {
1627
+ for (var key in map) this._grammar.transforms[key] = map[key];
1628
+ }
1629
+ },
1630
+ {
1631
+ key: "compile",
1632
+ value: function compile(expression) {
1633
+ return this.createExpression(expression).compile();
1634
+ }
1635
+ },
1636
+ {
1637
+ key: "createExpression",
1638
+ value: function createExpression(expression) {
1639
+ return new Expression(this._grammar, expression);
1640
+ }
1641
+ },
1642
+ {
1643
+ key: "getFunction",
1644
+ value: function getFunction(name) {
1645
+ return this._grammar.functions[name];
1646
+ }
1647
+ },
1648
+ {
1649
+ key: "getTransform",
1650
+ value: function getTransform(name) {
1651
+ return this._grammar.transforms[name];
1652
+ }
1653
+ },
1654
+ {
1655
+ key: "eval",
1656
+ value: function _eval(expression) {
1657
+ var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1658
+ return this.createExpression(expression).eval(context);
1659
+ }
1660
+ },
1661
+ {
1662
+ key: "evalSync",
1663
+ value: function evalSync(expression) {
1664
+ var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1665
+ return this.createExpression(expression).evalSync(context);
1666
+ }
1667
+ },
1668
+ {
1669
+ key: "expr",
1670
+ value: function expr(strs) {
1671
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
1672
+ var exprStr = strs.reduce(function(acc, str, idx) {
1673
+ var arg = idx < args.length ? args[idx] : "";
1674
+ acc += str + arg;
1675
+ return acc;
1676
+ }, "");
1677
+ return this.createExpression(exprStr);
1678
+ }
1679
+ },
1680
+ {
1681
+ key: "removeOp",
1682
+ value: function removeOp(operator) {
1683
+ if (this._grammar.elements[operator] && (this._grammar.elements[operator].type === "binaryOp" || this._grammar.elements[operator].type === "unaryOp")) delete this._grammar.elements[operator];
1684
+ }
1685
+ },
1686
+ {
1687
+ key: "_addGrammarElement",
1688
+ value: function _addGrammarElement(str, obj) {
1689
+ this._grammar.elements[str] = obj;
1690
+ }
1691
+ }
1692
+ ]);
1693
+ return Jexl;
1694
+ }();
1695
+ module.exports = new Jexl();
1696
+ module.exports.Jexl = Jexl;
1697
+ })))(), 1);
1698
+ /** jexl ships a UMD bundle whose `module.exports` is the ready-made instance. */
1699
+ var jexl = import_Jexl.default?.default ?? import_Jexl.default;
1700
+ /** Handlebars sub-expressions/blocks — never wrap these in `{{esc}}`. */
1701
+ var NON_VALUE_MUSTACHE = /^[#/!>^&]|^\s*else\b/;
1702
+ /**
1703
+ * Evaluate one Jexl expression.
1704
+ *
1705
+ * Jexl is used instead of `eval()` so a template can never reach globals, the
1706
+ * DOM, or `fetch` — the worst a malicious template can do is compute a wrong
1707
+ * number.
1708
+ */
1709
+ function evaluateExpression(expression, context) {
1710
+ try {
1711
+ return jexl.evalSync(expression, context);
1712
+ } catch (err) {
1713
+ const reason = err instanceof Error ? err.message : String(err);
1714
+ throw new Error(`[mono-export] cannot evaluate {{= ${expression} }} — ${reason}`);
1715
+ }
1716
+ }
1717
+ /**
1718
+ * Normalise JS habits that Jexl's grammar doesn't share. Everyone types `===`;
1719
+ * Jexl only knows `==`, and would otherwise throw a bare "Token = unexpected".
1720
+ */
1721
+ function normalizeExpression(expression) {
1722
+ return expression.replace(/===/g, "==").replace(/!==/g, "!=");
1723
+ }
1724
+ /** Escape a string for embedding in a Handlebars double-quoted literal. */
1725
+ function toHandlebarsLiteral(value) {
1726
+ return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
1727
+ }
1728
+ /**
1729
+ * Find the `}}` that closes a mustache opened at `start`, ignoring any that
1730
+ * appear inside a quoted string (`{{= name == "a}}b" }}` is one expression).
1731
+ * Returns the index of the `}}`, or `-1` when unterminated.
1732
+ */
1733
+ function findMustacheEnd(src, start) {
1734
+ let quote = null;
1735
+ for (let i = start; i < src.length - 1; i += 1) {
1736
+ const ch = src[i];
1737
+ if (quote) {
1738
+ if (ch === "\\") i += 1;
1739
+ else if (ch === quote) quote = null;
1740
+ continue;
1741
+ }
1742
+ if (ch === "\"" || ch === "'") {
1743
+ quote = ch;
1744
+ continue;
1745
+ }
1746
+ if (ch === "}" && src[i + 1] === "}") return i;
1747
+ }
1748
+ return -1;
1749
+ }
1750
+ /** Whether `line` is a GFM table row (`| a | b |`), ignoring indentation. */
1751
+ function isTableRow(line) {
1752
+ return /^\s{0,3}\|/.test(line);
1753
+ }
1754
+ /**
1755
+ * Rewrite a template's mustaches. Single pass, line-aware (for table rows) and
1756
+ * code-aware (fenced blocks + inline spans are copied verbatim).
1757
+ */
1758
+ function preprocessTemplate(src, opts = {}) {
1759
+ const escapeCells = opts.escapeTableCells !== false;
1760
+ const lines = src.split("\n");
1761
+ const state = {
1762
+ fence: null,
1763
+ inCode: false
1764
+ };
1765
+ const out = [];
1766
+ for (const line of lines) {
1767
+ const fenceMatch = /^\s{0,3}(`{3,}|~{3,})/.exec(line);
1768
+ if (fenceMatch) {
1769
+ const marker = fenceMatch[1][0].repeat(3);
1770
+ if (state.fence === null) state.fence = marker;
1771
+ else if (state.fence === marker) state.fence = null;
1772
+ out.push(line);
1773
+ continue;
1774
+ }
1775
+ if (state.fence) {
1776
+ out.push(line);
1777
+ continue;
1778
+ }
1779
+ out.push(rewriteLine(line, escapeCells && isTableRow(line), state));
1780
+ }
1781
+ return out.join("\n");
1782
+ }
1783
+ /** Rewrite the mustaches on one non-fenced line. */
1784
+ function rewriteLine(line, wrapCells, state) {
1785
+ let out = "";
1786
+ let i = 0;
1787
+ while (i < line.length) {
1788
+ const ch = line[i];
1789
+ if (ch === "`") {
1790
+ state.inCode = !state.inCode;
1791
+ out += ch;
1792
+ i += 1;
1793
+ continue;
1794
+ }
1795
+ if (state.inCode || ch !== "{" || line[i + 1] !== "{") {
1796
+ out += ch;
1797
+ i += 1;
1798
+ continue;
1799
+ }
1800
+ const isTriple = line[i + 2] === "{";
1801
+ const open = isTriple ? i + 3 : i + 2;
1802
+ const end = findMustacheEnd(line, open);
1803
+ if (end === -1) {
1804
+ out += line.slice(i);
1805
+ break;
1806
+ }
1807
+ const closeLength = isTriple && line[end + 2] === "}" ? 3 : 2;
1808
+ const inner = line.slice(open, end);
1809
+ out += renderMustache(inner, {
1810
+ isTriple,
1811
+ wrapCells
1812
+ });
1813
+ i = end + closeLength;
1814
+ }
1815
+ return out;
1816
+ }
1817
+ /**
1818
+ * Split a mustache body into its Handlebars whitespace-control markers and the
1819
+ * expression between them, so `{{~ foo ~}}` keeps its `~`s after rewriting.
1820
+ */
1821
+ function splitWhitespaceControl(inner) {
1822
+ let body = inner;
1823
+ let open = "";
1824
+ let close = "";
1825
+ if (body.startsWith("~")) {
1826
+ open = "~";
1827
+ body = body.slice(1);
1828
+ }
1829
+ if (body.endsWith("~")) {
1830
+ close = "~";
1831
+ body = body.slice(0, -1);
1832
+ }
1833
+ return {
1834
+ open,
1835
+ body: body.trim(),
1836
+ close
1837
+ };
1838
+ }
1839
+ /**
1840
+ * Whether `body` is a bare path (`Name.Full`, `[my field]`, `@index`) rather
1841
+ * than a helper call (`currency salary`).
1842
+ *
1843
+ * This distinction decides how the value is handed to `esc`: a path is passed
1844
+ * as an **argument** (`{{esc Name.Full}}`), while a helper call must become a
1845
+ * **sub-expression** (`{{esc (currency salary)}}`). Getting it backwards breaks
1846
+ * at runtime — `(Name.Full)` compiles to a helper invocation, and Handlebars
1847
+ * then tries to *call* the string it resolved.
1848
+ */
1849
+ function isBarePath(body) {
1850
+ return (body.startsWith("[") ? body.slice(body.indexOf("]") + 1) : body.replace(/^\S+/, "")).trim() === "";
1851
+ }
1852
+ /** Turn one mustache body into its rewritten `{{…}}` form. */
1853
+ function renderMustache(inner, { isTriple, wrapCells }) {
1854
+ const { open, body, close } = splitWhitespaceControl(inner);
1855
+ const wrap = (expr) => `{{${open}${expr}${close}}}`;
1856
+ if (body.startsWith("=")) {
1857
+ const call = `__jexl ${toHandlebarsLiteral(normalizeExpression(body.slice(1).trim()))}`;
1858
+ return wrap(wrapCells ? `esc (${call})` : call);
1859
+ }
1860
+ if (isTriple) return `{{{${inner}}}}`;
1861
+ if (NON_VALUE_MUSTACHE.test(body)) return wrap(body);
1862
+ if (wrapCells) return wrap(isBarePath(body) ? `esc ${body}` : `esc (${body})`);
1863
+ return wrap(body);
1864
+ }
1865
+ /**
1866
+ * Escape an interpolated value for a GFM table cell. Registered as the `esc`
1867
+ * helper and applied automatically to table-row mustaches by
1868
+ * {@link preprocessTemplate}; also callable by hand.
1869
+ */
1870
+ function escapeForCell(value) {
1871
+ if (value == null) return "";
1872
+ return escapeCellText(String(value));
1873
+ }
1874
+ //#endregion
1875
+ //#region src/export/helpers.ts
1876
+ /**
1877
+ * Built-in Handlebars helpers for report templates.
1878
+ *
1879
+ * Three families:
1880
+ *
1881
+ * - **Formatting** (`currency`, `number`, `date`, `percent`) — emit pretty
1882
+ * display text *plus* a hidden {@link ValueDirective} carrying the raw value
1883
+ * and an Excel number format. That's what keeps `SUM()` working: Markdown
1884
+ * shows `Rp 1.000.000`, the spreadsheet stores `1000000`.
1885
+ * - **Aggregation / logic** (`sum`, `avg`, `count`, `eq`, `gt`, …) — plain
1886
+ * values, so they nest as sub-expressions: `{{currency (sum rows "Salary")}}`.
1887
+ * - **Excel-only** (`style`, `rowStyle`, `merge`, `formula`, `image`) — emit a
1888
+ * directive and no visible text, so they vanish from Markdown output.
1889
+ */
1890
+ /** Drop Handlebars' trailing options object, returning it alongside the args. */
1891
+ function splitArgs(args) {
1892
+ const last = args[args.length - 1];
1893
+ const isOptions = !!last && typeof last === "object" && "hash" in last;
1894
+ return {
1895
+ args: isOptions ? args.slice(0, -1) : args,
1896
+ hash: (isOptions ? last.hash : void 0) ?? {}
1897
+ };
1898
+ }
1899
+ /** Coerce to a finite number, or `null` when the value isn't numeric. */
1900
+ function toNumber(value) {
1901
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
1902
+ if (typeof value === "string" && value.trim() !== "") {
1903
+ const n = Number(value);
1904
+ return Number.isFinite(n) ? n : null;
1905
+ }
1906
+ return null;
1907
+ }
1908
+ /** Coerce to a Date, or `null`. Accepts a Date, an ISO string, or epoch ms. */
1909
+ function toDate(value) {
1910
+ if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value;
1911
+ if (typeof value === "number" || typeof value === "string") {
1912
+ const d = new Date(value);
1913
+ return Number.isNaN(d.getTime()) ? null : d;
1914
+ }
1915
+ return null;
1916
+ }
1917
+ /** Pull `field` off each item (or the item itself when no field is given). */
1918
+ function pluck(list, field) {
1919
+ if (!Array.isArray(list)) return [];
1920
+ if (typeof field !== "string" || !field) return list;
1921
+ return list.map((item) => item?.[field]);
1922
+ }
1923
+ /** The numeric values of `list[field]`, skipping anything non-numeric. */
1924
+ function numbersOf(list, field) {
1925
+ return pluck(list, field).map(toNumber).filter((n) => n !== null);
1926
+ }
1927
+ /**
1928
+ * Derive an Excel number format from a currency code by asking `Intl` where the
1929
+ * symbol goes and how many decimals it uses — so IDR renders `"Rp"#,##0` and
1930
+ * EUR-in-German renders `#,##0.00" €"` without a hard-coded lookup table.
1931
+ */
1932
+ function deriveCurrencyFormat(locale, currency) {
1933
+ try {
1934
+ const parts = new Intl.NumberFormat(locale, {
1935
+ style: "currency",
1936
+ currency
1937
+ }).formatToParts(1);
1938
+ const symbol = parts.find((p) => p.type === "currency")?.value ?? currency;
1939
+ const fraction = parts.find((p) => p.type === "fraction")?.value ?? "";
1940
+ const digits = fraction.length ? `.${"0".repeat(fraction.length)}` : "";
1941
+ const symbolFirst = parts.findIndex((p) => p.type === "currency") === 0;
1942
+ const quoted = `"${symbol}"`;
1943
+ return symbolFirst ? `${quoted}#,##0${digits}` : `#,##0${digits}${quoted}`;
1944
+ } catch {
1945
+ return "#,##0.00";
1946
+ }
1947
+ }
1948
+ /**
1949
+ * Display text + the raw value/format directive that Excel will pick up. The
1950
+ * display text is echoed back into the directive (`t`) so the renderer can tell
1951
+ * "this cell *is* the value" from "this value is mentioned mid-sentence".
1952
+ */
1953
+ function formatted(display, directive) {
1954
+ return display + encodeDirective({
1955
+ k: "val",
1956
+ ...directive,
1957
+ t: display
1958
+ });
1959
+ }
1960
+ /**
1961
+ * Build the built-in helper map for one render. Bound to `formatting` so
1962
+ * locale/currency choices apply consistently across every helper.
1963
+ */
1964
+ function createHelpers(formatting = {}) {
1965
+ const locale = formatting.locale;
1966
+ const currencyCode = formatting.currency ?? "USD";
1967
+ const currencyFormat = formatting.currencyFormat ?? deriveCurrencyFormat(locale, currencyCode);
1968
+ const numberFormat = formatting.numberFormat ?? "#,##0";
1969
+ const dateFormat = formatting.dateFormat ?? "yyyy-mm-dd";
1970
+ const percentFormat = formatting.percentFormat ?? "0.00%";
1971
+ return {
1972
+ /** `{{currency salary}}` → `$1,234.00` in Markdown, `1234` + format in Excel. */
1973
+ currency(...raw) {
1974
+ const { args, hash } = splitArgs(raw);
1975
+ const n = toNumber(args[0]);
1976
+ if (n === null) return "";
1977
+ const code = hash.code ?? currencyCode;
1978
+ return formatted(new Intl.NumberFormat(locale, {
1979
+ style: "currency",
1980
+ currency: code
1981
+ }).format(n), {
1982
+ n,
1983
+ f: hash.fmt ?? (code === currencyCode ? currencyFormat : deriveCurrencyFormat(locale, code))
1984
+ });
1985
+ },
1986
+ /** `{{number qty}}` / `{{number rate decimals=2}}`. */
1987
+ number(...raw) {
1988
+ const { args, hash } = splitArgs(raw);
1989
+ const n = toNumber(args[0]);
1990
+ if (n === null) return "";
1991
+ const decimals = toNumber(hash.decimals);
1992
+ return formatted(new Intl.NumberFormat(locale, {
1993
+ minimumFractionDigits: decimals ?? void 0,
1994
+ maximumFractionDigits: decimals ?? void 0
1995
+ }).format(n), {
1996
+ n,
1997
+ f: hash.fmt ?? (decimals ? `#,##0.${"0".repeat(decimals)}` : numberFormat)
1998
+ });
1999
+ },
2000
+ /** `{{date createdAt}}` — Markdown gets the locale date, Excel a real Date. */
2001
+ date(...raw) {
2002
+ const { args, hash } = splitArgs(raw);
2003
+ const d = toDate(args[0]);
2004
+ if (!d) return "";
2005
+ return formatted(new Intl.DateTimeFormat(locale, {
2006
+ year: "numeric",
2007
+ month: "2-digit",
2008
+ day: "2-digit"
2009
+ }).format(d), {
2010
+ d: d.toISOString(),
2011
+ f: hash.fmt ?? dateFormat
2012
+ });
2013
+ },
2014
+ /** `{{percent 0.155}}` → `15.50%`; Excel stores the fraction with a % format. */
2015
+ percent(...raw) {
2016
+ const { args, hash } = splitArgs(raw);
2017
+ const n = toNumber(args[0]);
2018
+ if (n === null) return "";
2019
+ return formatted(new Intl.NumberFormat(locale, {
2020
+ style: "percent",
2021
+ minimumFractionDigits: 2
2022
+ }).format(n), {
2023
+ n,
2024
+ f: hash.fmt ?? percentFormat
2025
+ });
2026
+ },
2027
+ /** `{{sum employees "salary"}}` — or `{{sum numbers}}` for a bare array. */
2028
+ sum: (...raw) => {
2029
+ const { args } = splitArgs(raw);
2030
+ return numbersOf(args[0], args[1]).reduce((total, n) => total + n, 0);
2031
+ },
2032
+ avg: (...raw) => {
2033
+ const { args } = splitArgs(raw);
2034
+ const values = numbersOf(args[0], args[1]);
2035
+ return values.length ? values.reduce((t, n) => t + n, 0) / values.length : 0;
2036
+ },
2037
+ /** `{{count employees}}` — length, or how many have a truthy `field`. */
2038
+ count: (...raw) => {
2039
+ const { args } = splitArgs(raw);
2040
+ const list = args[0];
2041
+ if (!Array.isArray(list)) return 0;
2042
+ return typeof args[1] === "string" ? pluck(list, args[1]).filter((v) => v != null && v !== "").length : list.length;
2043
+ },
2044
+ max: (...raw) => {
2045
+ const { args } = splitArgs(raw);
2046
+ const values = numbersOf(args[0], args[1]);
2047
+ return values.length ? Math.max(...values) : 0;
2048
+ },
2049
+ min: (...raw) => {
2050
+ const { args } = splitArgs(raw);
2051
+ const values = numbersOf(args[0], args[1]);
2052
+ return values.length ? Math.min(...values) : 0;
2053
+ },
2054
+ eq: (...raw) => {
2055
+ const { args } = splitArgs(raw);
2056
+ return args[0] === args[1];
2057
+ },
2058
+ ne: (...raw) => {
2059
+ const { args } = splitArgs(raw);
2060
+ return args[0] !== args[1];
2061
+ },
2062
+ gt: (...raw) => compare(raw, (a, b) => a > b),
2063
+ gte: (...raw) => compare(raw, (a, b) => a >= b),
2064
+ lt: (...raw) => compare(raw, (a, b) => a < b),
2065
+ lte: (...raw) => compare(raw, (a, b) => a <= b),
2066
+ and: (...raw) => splitArgs(raw).args.every(Boolean),
2067
+ or: (...raw) => splitArgs(raw).args.some(Boolean),
2068
+ not: (...raw) => !splitArgs(raw).args[0],
2069
+ /** `{{default value "-"}}` — fall back when null / undefined / empty. */
2070
+ default: (...raw) => {
2071
+ const { args } = splitArgs(raw);
2072
+ const value = args[0];
2073
+ return value == null || value === "" ? args[1] ?? "" : value;
2074
+ },
2075
+ /**
2076
+ * Escape a value for a GFM table cell. Applied automatically to mustaches on
2077
+ * table rows by the preprocessor; call it by hand elsewhere if needed.
2078
+ */
2079
+ esc: (...raw) => escapeForCell(splitArgs(raw).args[0]),
2080
+ /** `{{style "header"}}` — apply a named style to this cell. */
2081
+ style: (...raw) => {
2082
+ const { args } = splitArgs(raw);
2083
+ const name = args[0];
2084
+ return typeof name === "string" && name ? encodeDirective({
2085
+ k: "style",
2086
+ v: name
2087
+ }) : "";
2088
+ },
2089
+ /** `{{rowStyle "groupHeader"}}` — apply a named style to the whole row. */
2090
+ rowStyle: (...raw) => {
2091
+ const { args } = splitArgs(raw);
2092
+ const name = args[0];
2093
+ return typeof name === "string" && name ? encodeDirective({
2094
+ k: "rowStyle",
2095
+ v: name
2096
+ }) : "";
2097
+ },
2098
+ /** `{{merge cols=4}}` — merge this cell across columns and/or rows. */
2099
+ merge: (...raw) => {
2100
+ const { hash } = splitArgs(raw);
2101
+ const cols = toNumber(hash.cols);
2102
+ const rows = toNumber(hash.rows);
2103
+ if (!cols && !rows) return "";
2104
+ return encodeDirective({
2105
+ k: "merge",
2106
+ ...cols ? { cols: Math.max(1, Math.floor(cols)) } : {},
2107
+ ...rows ? { rows: Math.max(1, Math.floor(rows)) } : {}
2108
+ });
2109
+ },
2110
+ /**
2111
+ * `{{formula "SUM(C{row}:D{row})"}}` — an Excel formula for this cell.
2112
+ * `{row}`, `{firstRow}`, `{lastRow}` and `{col:Field}` are resolved when the
2113
+ * cell is written, since a template can't know its own row number.
2114
+ */
2115
+ formula: (...raw) => {
2116
+ const { args } = splitArgs(raw);
2117
+ const expr = args[0];
2118
+ return typeof expr === "string" && expr ? encodeDirective({
2119
+ k: "formula",
2120
+ v: expr
2121
+ }) : "";
2122
+ },
2123
+ /** `{{image logo width=120 height=40}}` — anchor an image at this cell. */
2124
+ image: (...raw) => {
2125
+ const { args, hash } = splitArgs(raw);
2126
+ const src = args[0];
2127
+ if (typeof src !== "string" || !src) return "";
2128
+ const width = toNumber(hash.width);
2129
+ const height = toNumber(hash.height);
2130
+ return encodeDirective({
2131
+ k: "image",
2132
+ v: src,
2133
+ ...width ? { width } : {},
2134
+ ...height ? { height } : {}
2135
+ });
2136
+ }
2137
+ };
2138
+ }
2139
+ /** Numeric-aware comparison shared by `gt` / `gte` / `lt` / `lte`. */
2140
+ function compare(raw, test) {
2141
+ const { args } = splitArgs(raw);
2142
+ const a = toNumber(args[0]);
2143
+ const b = toNumber(args[1]);
2144
+ if (a !== null && b !== null) return test(a, b);
2145
+ return test(args[0], args[1]);
2146
+ }
2147
+ //#endregion
2148
+ //#region src/export/template.ts
2149
+ /** Load the optional `handlebars` peer, with an actionable error when it's absent. */
2150
+ async function loadHandlebars() {
2151
+ try {
2152
+ const mod = await import("handlebars");
2153
+ return mod?.default ?? mod;
2154
+ } catch (err) {
2155
+ throw new Error("[mono-export] rendering a report needs the optional peer dependency \"handlebars\". Install it in your app: pnpm add handlebars" + (err instanceof Error ? `\n (resolution failed: ${err.message})` : ""));
2156
+ }
2157
+ }
2158
+ /**
2159
+ * Render a report template to Markdown (still carrying directive tokens).
2160
+ *
2161
+ * `noEscape` is deliberate: Handlebars' default escaping is *HTML* escaping,
2162
+ * which would turn `&` into `&amp;` and `"` into `&quot;` inside a spreadsheet
2163
+ * cell. Table cells are protected instead by the `esc` helper, which the
2164
+ * preprocessor injects only where it matters (see `expression.ts`).
2165
+ */
2166
+ async function renderTemplate(options) {
2167
+ const env = (await loadHandlebars()).create();
2168
+ env.registerHelper(createHelpers(options.formatting));
2169
+ /**
2170
+ * The bridge to Jexl. `this` is the current block context (inside `{{#each}}`
2171
+ * it's the item), `options.data.root` is the whole report context — merging
2172
+ * them lets an expression name a loop-local field *and* a top-level one.
2173
+ */
2174
+ env.registerHelper("__jexl", function(...args) {
2175
+ const helperOptions = args[args.length - 1];
2176
+ const expression = String(args[0] ?? "");
2177
+ const root = helperOptions?.data?.root ?? {};
2178
+ const local = typeof this === "object" && this !== null ? this : {};
2179
+ const value = evaluateExpression(expression, {
2180
+ ...root,
2181
+ ...local,
2182
+ this: local
2183
+ });
2184
+ return value == null ? "" : value;
2185
+ });
2186
+ if (options.helpers) env.registerHelper(options.helpers);
2187
+ if (options.partials) for (const [name, source] of Object.entries(options.partials)) env.registerPartial(name, preprocessTemplate(source));
2188
+ return env.compile(preprocessTemplate(options.md ?? ""), { noEscape: true })(options.data ?? {});
2189
+ }
2190
+ //#endregion
2191
+ //#region src/export/index.ts
2192
+ /**
2193
+ * `@mono-lit/helper/export` — render a Markdown template into a report.
2194
+ *
2195
+ * The pipeline: **Handlebars** fills the template from your data, **Jexl**
2196
+ * evaluates any `{{= … }}` expressions, **remark** parses the result into an
2197
+ * AST, and a renderer walks that AST. Markdown is the template language, so the
2198
+ * layout stays readable and diffable, and the data stays separate from the
2199
+ * presentation.
2200
+ *
2201
+ * @example
2202
+ * import { exportTable } from '@mono-lit/helper/export'
2203
+ * import md from './payroll.md?raw'
2204
+ *
2205
+ * const report = await exportTable({ md, data: { employees }, fileName: 'payroll.xlsx' })
2206
+ * report.markdown // the rendered markdown, for a preview pane
2207
+ *
2208
+ * Bound to a grid, `monoDataGrid(...).export({ md, … })` does the same thing
2209
+ * with the table's rows, groups and columns already in the context.
2210
+ */
2211
+ /** Pick the renderer from a file name's extension. */
2212
+ function formatFromFileName(fileName) {
2213
+ if (!fileName) return null;
2214
+ const ext = fileName.slice(fileName.lastIndexOf(".") + 1).toLowerCase();
2215
+ if (ext === "xlsx" || ext === "xls") return "xlsx";
2216
+ if (ext === "md" || ext === "markdown") return "md";
2217
+ return null;
2218
+ }
2219
+ /** Give a file name the extension its format implies. */
2220
+ function withExtension(fileName, format) {
2221
+ return formatFromFileName(fileName) === format ? fileName : `${fileName}.${format}`;
2222
+ }
2223
+ /**
2224
+ * Render a Markdown report template.
2225
+ *
2226
+ * When `fileName` is given its extension selects the renderer and the file
2227
+ * downloads automatically (pass `download: false` to suppress that). Without
2228
+ * one, nothing is written — you just get the result object.
2229
+ */
2230
+ async function exportTable(options) {
2231
+ const data = await resolveExportData(options.data, { chunkSize: options.chunkSize });
2232
+ const rendered = await renderTemplate({
2233
+ ...options,
2234
+ data
2235
+ });
2236
+ const markdown = stripDirectives(rendered);
2237
+ const resolvedFormat = options.format ?? formatFromFileName(options.fileName);
2238
+ const detailSheets = [];
2239
+ const skipped = [];
2240
+ if (options.detail) {
2241
+ const detail = options.detail;
2242
+ const masterRows = data[detail.from ?? "rows"];
2243
+ const { details, skipped: dropped } = await resolveDetails(Array.isArray(masterRows) ? masterRows : [], detail);
2244
+ skipped.push(...dropped);
2245
+ for (const item of details) detailSheets.push({
2246
+ key: item.key,
2247
+ name: detail.sheetName?.(item.row) ?? item.key,
2248
+ markdown: await renderTemplate({
2249
+ ...options,
2250
+ md: detail.md,
2251
+ data: {
2252
+ row: item.row,
2253
+ rows: item.rows
2254
+ }
2255
+ })
2256
+ });
2257
+ }
2258
+ let workbookPromise = null;
2259
+ const workbook = () => {
2260
+ workbookPromise ??= import("./excel-DopRbEMK.js").then(({ renderExcel }) => renderExcel(parseMarkdown(rendered), {
2261
+ ...options,
2262
+ back: options.detail?.back,
2263
+ sheets: detailSheets.map((s) => ({
2264
+ key: s.key,
2265
+ name: s.name,
2266
+ ast: parseMarkdown(s.markdown)
2267
+ }))
2268
+ })).then(async (book) => {
2269
+ await options.onWorkbook?.(book);
2270
+ return book;
2271
+ });
2272
+ return workbookPromise;
2273
+ };
2274
+ const toBuffer = async (format) => {
2275
+ if ((format ?? resolvedFormat ?? "md") === "md") return new TextEncoder().encode(markdown).buffer;
2276
+ return await (await workbook()).xlsx.writeBuffer();
2277
+ };
2278
+ const toBlob = async (format) => {
2279
+ const target = format ?? resolvedFormat ?? "md";
2280
+ return new Blob([await toBuffer(target)], { type: MIME[target] });
2281
+ };
2282
+ const download = async (fileName) => {
2283
+ const target = resolvedFormat ?? formatFromFileName(fileName) ?? "md";
2284
+ const name = withExtension(fileName ?? options.fileName ?? "export", target);
2285
+ downloadBlob(await toBlob(target), name);
2286
+ };
2287
+ const result = {
2288
+ markdown,
2289
+ format: resolvedFormat,
2290
+ fileName: options.fileName ?? null,
2291
+ sheets: [options.sheetName ?? "Sheet1", ...detailSheets.map((s) => s.name)],
2292
+ skipped,
2293
+ toBlob,
2294
+ toBuffer,
2295
+ workbook,
2296
+ download
2297
+ };
2298
+ if (options.fileName && options.download !== false) await download();
2299
+ return result;
2300
+ }
2301
+ //#endregion
2302
+ export { exportTable };