allyhub 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (632) hide show
  1. package/dist/audio-text.js +1 -1
  2. package/dist/commands/add.js +2 -2
  3. package/dist/commands/cloud-tools.js +5 -5
  4. package/dist/commands/dev.js +1 -1
  5. package/dist/commands/frames/piece.js +1 -1
  6. package/dist/commands/frames/sheet.js +1 -1
  7. package/dist/commands/frames.js +8 -8
  8. package/dist/commands/index.js +1 -1
  9. package/dist/commands/inspect/common.js +1 -1
  10. package/dist/commands/inspect/layout.js +1 -1
  11. package/dist/commands/render.js +1 -1
  12. package/dist/commands/sheet.js +7 -7
  13. package/dist/commands/site.js +3 -2
  14. package/dist/commands/skills.js +3 -3
  15. package/dist/commands/slides.js +2 -2
  16. package/dist/node_modules/@allyhub-next/audio/dist/node/index.js +1 -1
  17. package/dist/node_modules/@allyhub-next/audio/dist/node/master.js +1 -1
  18. package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
  19. package/dist/node_modules/@allyhub-next/browser/dist/html.js +1 -1
  20. package/dist/node_modules/@allyhub-next/browser/package.json +1 -1
  21. package/dist/node_modules/@allyhub-next/build/dist/content.d.ts +4 -0
  22. package/dist/node_modules/@allyhub-next/build/dist/content.js +1 -1
  23. package/dist/node_modules/@allyhub-next/build/dist/index.d.ts +2 -2
  24. package/dist/node_modules/@allyhub-next/build/dist/index.js +1 -1
  25. package/dist/node_modules/@allyhub-next/build/dist/meta-worker.d.ts +2 -2
  26. package/dist/node_modules/@allyhub-next/build/dist/meta-worker.js +3 -3
  27. package/dist/node_modules/@allyhub-next/build/dist/move-refs.d.ts +1 -1
  28. package/dist/node_modules/@allyhub-next/build/dist/move-refs.js +1 -1
  29. package/dist/node_modules/@allyhub-next/build/dist/plugin.d.ts +12 -3
  30. package/dist/node_modules/@allyhub-next/build/dist/plugin.js +7 -6
  31. package/dist/node_modules/@allyhub-next/build/dist/prepare.d.ts +9 -5
  32. package/dist/node_modules/@allyhub-next/build/dist/prepare.js +2 -2
  33. package/dist/node_modules/@allyhub-next/build/dist/vite.d.ts +10 -0
  34. package/dist/node_modules/@allyhub-next/build/dist/vite.js +2 -2
  35. package/dist/node_modules/@allyhub-next/build/package.json +1 -1
  36. package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +2 -2
  37. package/dist/node_modules/@allyhub-next/chart/dist/chart.d.ts +14 -5
  38. package/dist/node_modules/@allyhub-next/chart/dist/chart.js +1 -1
  39. package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
  40. package/dist/node_modules/@allyhub-next/check/dist/check.js +3 -3
  41. package/dist/node_modules/@allyhub-next/check/package.json +1 -1
  42. package/dist/node_modules/@allyhub-next/cloud/dist/blobs.js +2 -0
  43. package/dist/node_modules/@allyhub-next/cloud/dist/call.js +4 -2
  44. package/dist/node_modules/@allyhub-next/cloud/dist/client.js +1 -1
  45. package/dist/node_modules/@allyhub-next/cloud/dist/errors.js +1 -1
  46. package/dist/node_modules/@allyhub-next/cloud/dist/hashes.js +2 -0
  47. package/dist/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
  48. package/dist/node_modules/@allyhub-next/cloud/dist/sites.js +2 -0
  49. package/dist/node_modules/@allyhub-next/cloud/dist/voice.js +1 -1
  50. package/dist/node_modules/@allyhub-next/cloud/package.json +1 -1
  51. package/dist/node_modules/@allyhub-next/components/package.json +1 -1
  52. package/dist/node_modules/@allyhub-next/components/r/caption-subtitle.json +1 -1
  53. package/dist/node_modules/@allyhub-next/components/src/caption-subtitle.ts +54 -16
  54. package/dist/node_modules/@allyhub-next/dev-server/dist/background.js +1 -1
  55. package/dist/node_modules/@allyhub-next/dev-server/dist/exports.js +1 -1
  56. package/dist/node_modules/@allyhub-next/dev-server/dist/fonts.js +2 -0
  57. package/dist/node_modules/@allyhub-next/dev-server/dist/index.js +1 -1
  58. package/dist/node_modules/@allyhub-next/dev-server/dist/live.js +1 -1
  59. package/dist/node_modules/@allyhub-next/dev-server/dist/project.js +1 -1
  60. package/dist/node_modules/@allyhub-next/dev-server/dist/reach.js +2 -0
  61. package/dist/node_modules/@allyhub-next/dev-server/dist/record.js +2 -0
  62. package/dist/node_modules/@allyhub-next/dev-server/dist/server.js +2 -2
  63. package/dist/node_modules/@allyhub-next/dev-server/dist/tools.js +1 -1
  64. package/dist/node_modules/@allyhub-next/dev-server/dist/tree.js +2 -0
  65. package/dist/node_modules/@allyhub-next/dev-server/package.json +1 -1
  66. package/dist/node_modules/@allyhub-next/doc/package.json +1 -1
  67. package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.js +1 -1
  68. package/dist/node_modules/@allyhub-next/export/dist/export.js +5 -5
  69. package/dist/node_modules/@allyhub-next/export/dist/index.js +1 -1
  70. package/dist/node_modules/@allyhub-next/export/package.json +1 -1
  71. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.d.ts +205 -0
  72. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.js +2 -0
  73. package/dist/node_modules/@allyhub-next/formats/dist/data/script.d.ts +4 -1
  74. package/dist/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
  75. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +248 -18
  76. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +1 -1
  77. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +1114 -91
  78. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
  79. package/dist/node_modules/@allyhub-next/formats/dist/data/website.d.ts +20 -0
  80. package/dist/node_modules/@allyhub-next/formats/dist/data/website.js +2 -0
  81. package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +4 -0
  82. package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
  83. package/dist/node_modules/@allyhub-next/formats/dist/items.d.ts +1 -1
  84. package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
  85. package/dist/node_modules/@allyhub-next/formats/dist/media-type.d.ts +3 -0
  86. package/dist/node_modules/@allyhub-next/formats/dist/media-type.js +2 -0
  87. package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +625 -30
  88. package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
  89. package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +2 -0
  90. package/dist/node_modules/@allyhub-next/formats/dist/strict.js +1 -1
  91. package/dist/node_modules/@allyhub-next/formats/dist/zip.d.ts +17 -0
  92. package/dist/node_modules/@allyhub-next/formats/dist/zip.js +2 -0
  93. package/dist/node_modules/@allyhub-next/formats/package.json +2 -1
  94. package/dist/node_modules/@allyhub-next/measure/package.json +1 -1
  95. package/dist/node_modules/@allyhub-next/media/dist/index.d.ts +1 -1
  96. package/dist/node_modules/@allyhub-next/media/dist/index.js +1 -1
  97. package/dist/node_modules/@allyhub-next/media/dist/sheet.d.ts +2 -0
  98. package/dist/node_modules/@allyhub-next/media/dist/sheet.js +7 -7
  99. package/dist/node_modules/@allyhub-next/media/package.json +1 -1
  100. package/dist/node_modules/@allyhub-next/model/package.json +1 -1
  101. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.d.ts +31 -0
  102. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.js +2 -0
  103. package/dist/node_modules/@allyhub-next/ooxml/dist/color.d.ts +33 -0
  104. package/dist/node_modules/@allyhub-next/ooxml/dist/color.js +2 -0
  105. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.d.ts +13 -0
  106. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.js +2 -0
  107. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.d.ts +79 -0
  108. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.js +2 -0
  109. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.d.ts +132 -0
  110. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.js +2 -0
  111. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.d.ts +28 -0
  112. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.js +2 -0
  113. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.d.ts +4708 -0
  114. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.js +2 -0
  115. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.d.ts +57 -0
  116. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.js +2 -0
  117. package/dist/node_modules/@allyhub-next/ooxml/dist/index.d.ts +10 -0
  118. package/dist/node_modules/@allyhub-next/ooxml/dist/index.js +2 -0
  119. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.d.ts +12 -0
  120. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.js +2 -0
  121. package/dist/node_modules/@allyhub-next/ooxml/dist/node.d.ts +111 -0
  122. package/dist/node_modules/@allyhub-next/ooxml/dist/node.js +2 -0
  123. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.d.ts +45 -0
  124. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.js +2 -0
  125. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.d.ts +48 -0
  126. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.js +2 -0
  127. package/dist/node_modules/@allyhub-next/ooxml/dist/report.d.ts +45 -0
  128. package/dist/node_modules/@allyhub-next/ooxml/dist/report.js +2 -0
  129. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.d.ts +28 -0
  130. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.js +2 -0
  131. package/dist/node_modules/@allyhub-next/ooxml/package.json +26 -0
  132. package/dist/node_modules/@allyhub-next/project/dist/deck-keys.js +2 -0
  133. package/dist/node_modules/@allyhub-next/project/dist/deck-measure.js +2 -0
  134. package/dist/node_modules/@allyhub-next/project/dist/deck-pool.js +2 -0
  135. package/dist/node_modules/@allyhub-next/project/dist/index.js +1 -1
  136. package/dist/node_modules/@allyhub-next/project/dist/session.js +1 -1
  137. package/dist/node_modules/@allyhub-next/project/dist/stills.js +2 -0
  138. package/dist/node_modules/@allyhub-next/project/package.json +1 -1
  139. package/dist/node_modules/@allyhub-next/protocol/dist/account.d.ts +338 -0
  140. package/dist/node_modules/@allyhub-next/protocol/dist/account.js +2 -0
  141. package/dist/node_modules/@allyhub-next/protocol/dist/auth.d.ts +12 -13
  142. package/dist/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
  143. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.d.ts +35 -0
  144. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.js +2 -0
  145. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +101 -32
  146. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
  147. package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +89 -5
  148. package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
  149. package/dist/node_modules/@allyhub-next/protocol/dist/files.d.ts +2 -2
  150. package/dist/node_modules/@allyhub-next/protocol/dist/index.d.ts +6 -0
  151. package/dist/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
  152. package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +23 -0
  153. package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
  154. package/dist/node_modules/@allyhub-next/protocol/dist/open.d.ts +13 -0
  155. package/dist/node_modules/@allyhub-next/protocol/dist/open.js +2 -0
  156. package/dist/node_modules/@allyhub-next/protocol/dist/registry.d.ts +73 -59
  157. package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
  158. package/dist/node_modules/@allyhub-next/protocol/dist/routes.d.ts +1 -1
  159. package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
  160. package/dist/node_modules/@allyhub-next/protocol/dist/shares.d.ts +115 -0
  161. package/dist/node_modules/@allyhub-next/protocol/dist/shares.js +2 -0
  162. package/dist/node_modules/@allyhub-next/protocol/dist/sites.d.ts +293 -0
  163. package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +2 -0
  164. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +377 -0
  165. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +2 -0
  166. package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +27 -9
  167. package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
  168. package/dist/node_modules/@allyhub-next/protocol/dist/tools.d.ts +53 -14
  169. package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
  170. package/dist/node_modules/@allyhub-next/protocol/package.json +2 -1
  171. package/dist/node_modules/@allyhub-next/registry/package.json +1 -1
  172. package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.js +3 -2
  173. package/dist/node_modules/@allyhub-next/render/dist/doc/index.js +1 -1
  174. package/dist/node_modules/@allyhub-next/render/dist/doc/pdf.js +34 -0
  175. package/dist/node_modules/@allyhub-next/render/dist/doc/print.js +4 -4
  176. package/dist/node_modules/@allyhub-next/render/dist/exports.js +2 -2
  177. package/dist/node_modules/@allyhub-next/render/dist/pdf.js +2 -0
  178. package/dist/node_modules/@allyhub-next/render/package.json +1 -1
  179. package/dist/node_modules/@allyhub-next/runtime/dist/fonts.js +1 -1
  180. package/dist/node_modules/@allyhub-next/runtime/dist/music.js +1 -1
  181. package/dist/node_modules/@allyhub-next/runtime/package.json +1 -1
  182. package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
  183. package/dist/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +25 -5
  184. package/dist/node_modules/@allyhub-next/scaffold/dist/index.js +4 -4
  185. package/dist/node_modules/@allyhub-next/scaffold/package.json +1 -1
  186. package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
  187. package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.d.ts +10 -0
  188. package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.js +3 -3
  189. package/dist/node_modules/@allyhub-next/scenery-host/package.json +1 -1
  190. package/dist/node_modules/@allyhub-next/sheet/dist/api/capabilities.js +1 -1
  191. package/dist/node_modules/@allyhub-next/sheet/dist/api/index.d.ts +1 -0
  192. package/dist/node_modules/@allyhub-next/sheet/dist/api/index.js +1 -1
  193. package/dist/node_modules/@allyhub-next/sheet/dist/api/page.d.ts +83 -0
  194. package/dist/node_modules/@allyhub-next/sheet/dist/api/page.js +2 -0
  195. package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.d.ts +40 -1
  196. package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.js +1 -1
  197. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +9 -3
  198. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +1 -1
  199. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +5 -1
  200. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +1 -1
  201. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +60 -13
  202. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +1 -1
  203. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +1 -1
  204. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.d.ts +4 -0
  205. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.js +2 -0
  206. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +1 -1
  207. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +1 -1
  208. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +1 -1
  209. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +27 -1
  210. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +1 -1
  211. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.d.ts +16 -0
  212. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.js +2 -0
  213. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +18 -1
  214. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +1 -1
  215. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +1 -1
  216. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +2 -0
  217. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +1 -1
  218. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +1 -1
  219. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +1 -1
  220. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +1 -1
  221. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +1 -1
  222. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +1 -1
  223. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.d.ts +2 -0
  224. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.js +2 -0
  225. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +1 -1
  226. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.d.ts +38 -0
  227. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.js +2 -0
  228. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.d.ts +19 -0
  229. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.js +2 -0
  230. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.d.ts +49 -0
  231. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.js +2 -0
  232. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.d.ts +82 -0
  233. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.js +2 -0
  234. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +6 -1
  235. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +1 -1
  236. package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +1 -1
  237. package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
  238. package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +15 -0
  239. package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +1 -1
  240. package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +29 -8
  241. package/dist/node_modules/@allyhub-next/sheet/dist/export.js +3 -4
  242. package/dist/node_modules/@allyhub-next/sheet/dist/file.js +2 -2
  243. package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +8 -2
  244. package/dist/node_modules/@allyhub-next/sheet/dist/format.js +1 -1
  245. package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +52 -4
  246. package/dist/node_modules/@allyhub-next/sheet/dist/html.js +43 -11
  247. package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +7 -3
  248. package/dist/node_modules/@allyhub-next/sheet/dist/index.js +1 -1
  249. package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +1 -1
  250. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.d.ts +98 -0
  251. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.js +2 -0
  252. package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
  253. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.d.ts +32 -0
  254. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.js +2 -0
  255. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.d.ts +3 -0
  256. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.js +2 -0
  257. package/dist/node_modules/@allyhub-next/sheet/dist/values.js +1 -1
  258. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +10 -1
  259. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +1 -1
  260. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +12 -1
  261. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
  262. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +14 -4
  263. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +2 -2
  264. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +11 -1
  265. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +36 -16
  266. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +6 -1
  267. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +1 -1
  268. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +44 -2
  269. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -1
  270. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.d.ts +23 -0
  271. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.js +2 -0
  272. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +2 -0
  273. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +1 -1
  274. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +6 -0
  275. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
  276. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.d.ts +40 -0
  277. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +2 -0
  278. package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
  279. package/dist/node_modules/@allyhub-next/slides-core/dist/animation.js +1 -1
  280. package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +121 -44
  281. package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +2 -2
  282. package/dist/node_modules/@allyhub-next/slides-core/dist/capabilities.js +1 -1
  283. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +50 -13
  284. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
  285. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-file.js +1 -1
  286. package/dist/node_modules/@allyhub-next/slides-core/dist/check.js +1 -1
  287. package/dist/node_modules/@allyhub-next/slides-core/dist/code.d.ts +33 -0
  288. package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +2 -0
  289. package/dist/node_modules/@allyhub-next/slides-core/dist/components.d.ts +31 -0
  290. package/dist/node_modules/@allyhub-next/slides-core/dist/components.js +2 -0
  291. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +188 -5
  292. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
  293. package/dist/node_modules/@allyhub-next/slides-core/dist/file.d.ts +43 -21
  294. package/dist/node_modules/@allyhub-next/slides-core/dist/file.js +3 -3
  295. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.d.ts +17 -0
  296. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.js +2 -0
  297. package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +5 -0
  298. package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
  299. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.d.ts +6 -0
  300. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.js +2 -0
  301. package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +1 -1
  302. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.d.ts +58 -0
  303. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +2 -0
  304. package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +38 -4
  305. package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +27 -1
  306. package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
  307. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +26 -5
  308. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
  309. package/dist/node_modules/@allyhub-next/slides-core/dist/script.d.ts +18 -16
  310. package/dist/node_modules/@allyhub-next/slides-core/dist/script.js +2 -2
  311. package/dist/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +51 -53
  312. package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +1 -1
  313. package/dist/node_modules/@allyhub-next/slides-core/dist/units.d.ts +27 -0
  314. package/dist/node_modules/@allyhub-next/slides-core/dist/units.js +1 -1
  315. package/dist/node_modules/@allyhub-next/slides-core/dist/values.d.ts +7 -0
  316. package/dist/node_modules/@allyhub-next/slides-core/dist/values.js +2 -0
  317. package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
  318. package/dist/node_modules/@allyhub-next/slides-pptx/dist/charts.js +1 -1
  319. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/code.js +4 -0
  320. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/index.js +3 -0
  321. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/names.js +2 -0
  322. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/script.js +2 -0
  323. package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.js +1 -1
  324. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/chart.js +2 -0
  325. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/common.js +2 -0
  326. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/index.js +4 -0
  327. package/dist/{site.js → node_modules/@allyhub-next/slides-pptx/dist/read/model.js} +1 -1
  328. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/shapes.js +2 -0
  329. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/table.js +2 -0
  330. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/text.js +2 -0
  331. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/timing.js +2 -0
  332. package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.js +1 -1
  333. package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.js +1 -1
  334. package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.js +1 -1
  335. package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.js +1 -1
  336. package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.js +2 -2
  337. package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.js +2 -2
  338. package/dist/node_modules/@allyhub-next/slides-pptx/package.json +1 -1
  339. package/dist/node_modules/@allyhub-next/slides-runtime/dist/component.js +2 -0
  340. package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.js +2 -2
  341. package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.js +1 -1
  342. package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.js +5 -5
  343. package/dist/node_modules/@allyhub-next/slides-runtime/package.json +5 -1
  344. package/dist/node_modules/@allyhub-next/stage/dist/graphics.js +1 -1
  345. package/dist/node_modules/@allyhub-next/stage/dist/index.js +1 -1
  346. package/dist/node_modules/@allyhub-next/stage/dist/page.js +22 -12
  347. package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.js +5 -5
  348. package/dist/node_modules/@allyhub-next/stage/dist/server.js +1 -1
  349. package/dist/node_modules/@allyhub-next/stage/package.json +1 -1
  350. package/dist/node_modules/@allyhub-next/stage-page/dist/host.js +1 -20
  351. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/probe.html +8 -0
  352. package/dist/{astro.js → node_modules/@allyhub-next/stage-page/dist/runtime/probe.js} +1 -1
  353. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/runtime.js +79 -0
  354. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.html +21 -0
  355. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.js +3 -0
  356. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.html +9 -0
  357. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.js +3 -0
  358. package/dist/node_modules/@allyhub-next/stage-page/package.json +2 -3
  359. package/dist/node_modules/@allyhub-next/video-core/dist/captions.js +6 -6
  360. package/dist/node_modules/@allyhub-next/video-core/dist/fact.d.ts +47 -8
  361. package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
  362. package/dist/node_modules/@allyhub-next/video-core/dist/index.d.ts +1 -0
  363. package/dist/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
  364. package/dist/node_modules/@allyhub-next/video-core/dist/marks.d.ts +14 -0
  365. package/dist/node_modules/@allyhub-next/video-core/dist/marks.js +1 -1
  366. package/dist/node_modules/@allyhub-next/video-core/dist/music.d.ts +2 -1
  367. package/dist/node_modules/@allyhub-next/video-core/dist/piece.d.ts +11 -2
  368. package/dist/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
  369. package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
  370. package/dist/node_modules/@allyhub-next/video-core/dist/schema.d.ts +2 -2
  371. package/dist/node_modules/@allyhub-next/video-core/dist/schema.js +1 -1
  372. package/dist/node_modules/@allyhub-next/video-core/dist/script.d.ts +2 -1
  373. package/dist/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
  374. package/dist/node_modules/@allyhub-next/video-core/dist/source.d.ts +7 -0
  375. package/dist/node_modules/@allyhub-next/video-core/dist/source.js +2 -0
  376. package/dist/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +10 -33
  377. package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
  378. package/dist/node_modules/@allyhub-next/website/LICENSE +241 -0
  379. package/dist/node_modules/@allyhub-next/website/dist/index.js +2 -0
  380. package/dist/node_modules/@allyhub-next/website/dist/publish.js +3 -0
  381. package/dist/node_modules/@allyhub-next/website/dist/rules.js +2 -0
  382. package/dist/node_modules/@allyhub-next/website/dist/website.js +4 -0
  383. package/dist/node_modules/@allyhub-next/website/package.json +13 -0
  384. package/dist/text/facts-text.js +4 -4
  385. package/dist/works.js +1 -1
  386. package/editor-web/assets/calc-worker-Bz9r26p1.js +158 -0
  387. package/editor-web/assets/dist-0emakyZE.js +36 -0
  388. package/editor-web/assets/dist-B3UoDUa5.js +37 -0
  389. package/editor-web/assets/dist-B6KzR3pN.js +10 -0
  390. package/editor-web/assets/dist-Bc5iA5k1.js +1 -0
  391. package/editor-web/assets/dist-CTQIm8Im.js +10 -0
  392. package/editor-web/assets/dist-CiHNHwyq.js +2 -0
  393. package/editor-web/assets/dist-DNZ8PQ-E.js +224 -0
  394. package/editor-web/assets/index-CFt3ovRY.js +69 -0
  395. package/editor-web/assets/index-ujKjdu_s.css +2 -0
  396. package/editor-web/assets/minus-BhoPZC5P.js +1 -0
  397. package/editor-web/assets/react-C_-rEEBU.js +101 -0
  398. package/editor-web/assets/tabs-Den4gHrU.js +105 -0
  399. package/editor-web/assets/text-align-start-CsW4nqqL.js +1 -0
  400. package/editor-web/index.html +5 -5
  401. package/package.json +8 -14
  402. package/dist/astro.d.ts +0 -2
  403. package/dist/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +0 -52
  404. package/dist/node_modules/@allyhub-next/audio/dist/decode.d.ts +0 -33
  405. package/dist/node_modules/@allyhub-next/audio/dist/envelope.d.ts +0 -37
  406. package/dist/node_modules/@allyhub-next/audio/dist/index.d.ts +0 -17
  407. package/dist/node_modules/@allyhub-next/audio/dist/levels.d.ts +0 -97
  408. package/dist/node_modules/@allyhub-next/audio/dist/master.d.ts +0 -29
  409. package/dist/node_modules/@allyhub-next/audio/dist/music.d.ts +0 -11
  410. package/dist/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +0 -39
  411. package/dist/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +0 -25
  412. package/dist/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +0 -31
  413. package/dist/node_modules/@allyhub-next/audio/dist/node/index.d.ts +0 -8
  414. package/dist/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +0 -18
  415. package/dist/node_modules/@allyhub-next/audio/dist/node/master.d.ts +0 -42
  416. package/dist/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +0 -60
  417. package/dist/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +0 -31
  418. package/dist/node_modules/@allyhub-next/audio/dist/plan.d.ts +0 -143
  419. package/dist/node_modules/@allyhub-next/audio/dist/recorded.d.ts +0 -26
  420. package/dist/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +0 -47
  421. package/dist/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +0 -89
  422. package/dist/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +0 -64
  423. package/dist/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +0 -26
  424. package/dist/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +0 -42
  425. package/dist/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +0 -56
  426. package/dist/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +0 -10
  427. package/dist/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +0 -12
  428. package/dist/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +0 -67
  429. package/dist/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +0 -32
  430. package/dist/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +0 -27
  431. package/dist/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +0 -64
  432. package/dist/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +0 -78
  433. package/dist/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +0 -111
  434. package/dist/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +0 -3
  435. package/dist/node_modules/@allyhub-next/audio/dist/render.d.ts +0 -26
  436. package/dist/node_modules/@allyhub-next/audio/dist/sfx.d.ts +0 -10
  437. package/dist/node_modules/@allyhub-next/audio/dist/shape.d.ts +0 -118
  438. package/dist/node_modules/@allyhub-next/audio/dist/voice.d.ts +0 -45
  439. package/dist/node_modules/@allyhub-next/browser/dist/browser.d.ts +0 -24
  440. package/dist/node_modules/@allyhub-next/browser/dist/capture.d.ts +0 -61
  441. package/dist/node_modules/@allyhub-next/browser/dist/cdp.d.ts +0 -51
  442. package/dist/node_modules/@allyhub-next/browser/dist/flags.d.ts +0 -13
  443. package/dist/node_modules/@allyhub-next/browser/dist/frames.d.ts +0 -35
  444. package/dist/node_modules/@allyhub-next/browser/dist/html.d.ts +0 -19
  445. package/dist/node_modules/@allyhub-next/browser/dist/index.d.ts +0 -10
  446. package/dist/node_modules/@allyhub-next/browser/dist/launch.d.ts +0 -35
  447. package/dist/node_modules/@allyhub-next/browser/dist/page.d.ts +0 -67
  448. package/dist/node_modules/@allyhub-next/browser/dist/server.d.ts +0 -26
  449. package/dist/node_modules/@allyhub-next/check/dist/cache.d.ts +0 -46
  450. package/dist/node_modules/@allyhub-next/check/dist/check.d.ts +0 -142
  451. package/dist/node_modules/@allyhub-next/check/dist/generated.d.ts +0 -22
  452. package/dist/node_modules/@allyhub-next/check/dist/index.d.ts +0 -7
  453. package/dist/node_modules/@allyhub-next/check/dist/plans.d.ts +0 -111
  454. package/dist/node_modules/@allyhub-next/check/dist/result.d.ts +0 -12
  455. package/dist/node_modules/@allyhub-next/check/dist/scenery.d.ts +0 -23
  456. package/dist/node_modules/@allyhub-next/dev-server/dist/background.d.ts +0 -50
  457. package/dist/node_modules/@allyhub-next/dev-server/dist/card.d.ts +0 -17
  458. package/dist/node_modules/@allyhub-next/dev-server/dist/exports.d.ts +0 -18
  459. package/dist/node_modules/@allyhub-next/dev-server/dist/index.d.ts +0 -11
  460. package/dist/node_modules/@allyhub-next/dev-server/dist/live.d.ts +0 -77
  461. package/dist/node_modules/@allyhub-next/dev-server/dist/mime.d.ts +0 -2
  462. package/dist/node_modules/@allyhub-next/dev-server/dist/mime.js +0 -2
  463. package/dist/node_modules/@allyhub-next/dev-server/dist/paths.d.ts +0 -27
  464. package/dist/node_modules/@allyhub-next/dev-server/dist/project.d.ts +0 -153
  465. package/dist/node_modules/@allyhub-next/dev-server/dist/reveal.d.ts +0 -6
  466. package/dist/node_modules/@allyhub-next/dev-server/dist/server.d.ts +0 -47
  467. package/dist/node_modules/@allyhub-next/dev-server/dist/sound.d.ts +0 -21
  468. package/dist/node_modules/@allyhub-next/dev-server/dist/stage.d.ts +0 -82
  469. package/dist/node_modules/@allyhub-next/dev-server/dist/stage.js +0 -121
  470. package/dist/node_modules/@allyhub-next/dev-server/dist/tools.d.ts +0 -24
  471. package/dist/node_modules/@allyhub-next/dev-server/dist/validate.d.ts +0 -6
  472. package/dist/node_modules/@allyhub-next/dev-server/dist/watcher.d.ts +0 -47
  473. package/dist/node_modules/@allyhub-next/dev-server/dist/writer.d.ts +0 -51
  474. package/dist/node_modules/@allyhub-next/export/dist/batch.d.ts +0 -70
  475. package/dist/node_modules/@allyhub-next/export/dist/deck-fonts.d.ts +0 -24
  476. package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.d.ts +0 -12
  477. package/dist/node_modules/@allyhub-next/export/dist/export.d.ts +0 -123
  478. package/dist/node_modules/@allyhub-next/export/dist/index.d.ts +0 -5
  479. package/dist/node_modules/@allyhub-next/export/dist/names.d.ts +0 -36
  480. package/dist/node_modules/@allyhub-next/measure/dist/compare.d.ts +0 -195
  481. package/dist/node_modules/@allyhub-next/measure/dist/contrast.d.ts +0 -14
  482. package/dist/node_modules/@allyhub-next/measure/dist/cut-sheet.d.ts +0 -90
  483. package/dist/node_modules/@allyhub-next/measure/dist/cuts.d.ts +0 -108
  484. package/dist/node_modules/@allyhub-next/measure/dist/facts.d.ts +0 -60
  485. package/dist/node_modules/@allyhub-next/measure/dist/fidelity.d.ts +0 -40
  486. package/dist/node_modules/@allyhub-next/measure/dist/flat.d.ts +0 -42
  487. package/dist/node_modules/@allyhub-next/measure/dist/index.d.ts +0 -24
  488. package/dist/node_modules/@allyhub-next/measure/dist/loop.d.ts +0 -22
  489. package/dist/node_modules/@allyhub-next/measure/dist/overlay.d.ts +0 -57
  490. package/dist/node_modules/@allyhub-next/measure/dist/recording-report.d.ts +0 -66
  491. package/dist/node_modules/@allyhub-next/measure/dist/reference/compare.d.ts +0 -118
  492. package/dist/node_modules/@allyhub-next/measure/dist/reference/folder.d.ts +0 -75
  493. package/dist/node_modules/@allyhub-next/measure/dist/reference/interpret.d.ts +0 -39
  494. package/dist/node_modules/@allyhub-next/measure/dist/reference/piece.d.ts +0 -53
  495. package/dist/node_modules/@allyhub-next/measure/dist/reference/sections.d.ts +0 -53
  496. package/dist/node_modules/@allyhub-next/measure/dist/reference/sets.d.ts +0 -84
  497. package/dist/node_modules/@allyhub-next/measure/dist/reference/text.d.ts +0 -27
  498. package/dist/node_modules/@allyhub-next/measure/dist/reference/video.d.ts +0 -55
  499. package/dist/node_modules/@allyhub-next/measure/dist/seams.d.ts +0 -46
  500. package/dist/node_modules/@allyhub-next/measure/dist/sound-measures.d.ts +0 -74
  501. package/dist/node_modules/@allyhub-next/measure/dist/sound-report.d.ts +0 -156
  502. package/dist/node_modules/@allyhub-next/measure/dist/still.d.ts +0 -58
  503. package/dist/node_modules/@allyhub-next/measure/dist/version-voice.d.ts +0 -12
  504. package/dist/node_modules/@allyhub-next/project/dist/console.d.ts +0 -34
  505. package/dist/node_modules/@allyhub-next/project/dist/digest.d.ts +0 -9
  506. package/dist/node_modules/@allyhub-next/project/dist/index.d.ts +0 -11
  507. package/dist/node_modules/@allyhub-next/project/dist/ledger.d.ts +0 -17
  508. package/dist/node_modules/@allyhub-next/project/dist/media-index.d.ts +0 -27
  509. package/dist/node_modules/@allyhub-next/project/dist/page.d.ts +0 -119
  510. package/dist/node_modules/@allyhub-next/project/dist/says.d.ts +0 -15
  511. package/dist/node_modules/@allyhub-next/project/dist/scenery.d.ts +0 -35
  512. package/dist/node_modules/@allyhub-next/project/dist/session.d.ts +0 -37
  513. package/dist/node_modules/@allyhub-next/project/dist/stretch.d.ts +0 -38
  514. package/dist/node_modules/@allyhub-next/project/dist/version.d.ts +0 -114
  515. package/dist/node_modules/@allyhub-next/render/dist/cap.d.ts +0 -41
  516. package/dist/node_modules/@allyhub-next/render/dist/capture.d.ts +0 -78
  517. package/dist/node_modules/@allyhub-next/render/dist/clip.d.ts +0 -27
  518. package/dist/node_modules/@allyhub-next/render/dist/composite.d.ts +0 -106
  519. package/dist/node_modules/@allyhub-next/render/dist/delivery.d.ts +0 -18
  520. package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.d.ts +0 -3
  521. package/dist/node_modules/@allyhub-next/render/dist/doc/index.d.ts +0 -3
  522. package/dist/node_modules/@allyhub-next/render/dist/doc/print.d.ts +0 -51
  523. package/dist/node_modules/@allyhub-next/render/dist/encode.d.ts +0 -111
  524. package/dist/node_modules/@allyhub-next/render/dist/errors.d.ts +0 -15
  525. package/dist/node_modules/@allyhub-next/render/dist/exports.d.ts +0 -76
  526. package/dist/node_modules/@allyhub-next/render/dist/ffmpeg.d.ts +0 -75
  527. package/dist/node_modules/@allyhub-next/render/dist/footage.d.ts +0 -169
  528. package/dist/node_modules/@allyhub-next/render/dist/image.d.ts +0 -16
  529. package/dist/node_modules/@allyhub-next/render/dist/index.d.ts +0 -26
  530. package/dist/node_modules/@allyhub-next/render/dist/junction.d.ts +0 -70
  531. package/dist/node_modules/@allyhub-next/render/dist/look.d.ts +0 -21
  532. package/dist/node_modules/@allyhub-next/render/dist/page.d.ts +0 -186
  533. package/dist/node_modules/@allyhub-next/render/dist/parts.d.ts +0 -140
  534. package/dist/node_modules/@allyhub-next/render/dist/png.d.ts +0 -37
  535. package/dist/node_modules/@allyhub-next/render/dist/pool.d.ts +0 -54
  536. package/dist/node_modules/@allyhub-next/render/dist/post-probe.d.ts +0 -27
  537. package/dist/node_modules/@allyhub-next/render/dist/post.d.ts +0 -27
  538. package/dist/node_modules/@allyhub-next/render/dist/render.d.ts +0 -151
  539. package/dist/node_modules/@allyhub-next/render/dist/segments.d.ts +0 -40
  540. package/dist/node_modules/@allyhub-next/render/dist/sound.d.ts +0 -24
  541. package/dist/node_modules/@allyhub-next/render/dist/stills.d.ts +0 -41
  542. package/dist/node_modules/@allyhub-next/render/dist/tools.d.ts +0 -25
  543. package/dist/node_modules/@allyhub-next/render/dist/webp.d.ts +0 -17
  544. package/dist/node_modules/@allyhub-next/runtime/dist/bridge.d.ts +0 -211
  545. package/dist/node_modules/@allyhub-next/runtime/dist/captions.d.ts +0 -24
  546. package/dist/node_modules/@allyhub-next/runtime/dist/clock.d.ts +0 -32
  547. package/dist/node_modules/@allyhub-next/runtime/dist/compose.d.ts +0 -149
  548. package/dist/node_modules/@allyhub-next/runtime/dist/console.d.ts +0 -21
  549. package/dist/node_modules/@allyhub-next/runtime/dist/contrast.d.ts +0 -13
  550. package/dist/node_modules/@allyhub-next/runtime/dist/embed.d.ts +0 -50
  551. package/dist/node_modules/@allyhub-next/runtime/dist/env.d.ts +0 -101
  552. package/dist/node_modules/@allyhub-next/runtime/dist/errors.d.ts +0 -21
  553. package/dist/node_modules/@allyhub-next/runtime/dist/facade.d.ts +0 -42
  554. package/dist/node_modules/@allyhub-next/runtime/dist/fonts.d.ts +0 -110
  555. package/dist/node_modules/@allyhub-next/runtime/dist/footage.d.ts +0 -52
  556. package/dist/node_modules/@allyhub-next/runtime/dist/frame.d.ts +0 -61
  557. package/dist/node_modules/@allyhub-next/runtime/dist/guards.d.ts +0 -32
  558. package/dist/node_modules/@allyhub-next/runtime/dist/index.d.ts +0 -14
  559. package/dist/node_modules/@allyhub-next/runtime/dist/inspect.d.ts +0 -112
  560. package/dist/node_modules/@allyhub-next/runtime/dist/locate.d.ts +0 -11
  561. package/dist/node_modules/@allyhub-next/runtime/dist/measure.d.ts +0 -41
  562. package/dist/node_modules/@allyhub-next/runtime/dist/mix-plan.d.ts +0 -42
  563. package/dist/node_modules/@allyhub-next/runtime/dist/music.d.ts +0 -29
  564. package/dist/node_modules/@allyhub-next/runtime/dist/output.d.ts +0 -5
  565. package/dist/node_modules/@allyhub-next/runtime/dist/pictures.d.ts +0 -39
  566. package/dist/node_modules/@allyhub-next/runtime/dist/piece.d.ts +0 -34
  567. package/dist/node_modules/@allyhub-next/runtime/dist/player/clips.d.ts +0 -41
  568. package/dist/node_modules/@allyhub-next/runtime/dist/player/cutout.d.ts +0 -57
  569. package/dist/node_modules/@allyhub-next/runtime/dist/player/player.d.ts +0 -78
  570. package/dist/node_modules/@allyhub-next/runtime/dist/reads.d.ts +0 -132
  571. package/dist/node_modules/@allyhub-next/runtime/dist/sound.d.ts +0 -22
  572. package/dist/node_modules/@allyhub-next/runtime/dist/speech.d.ts +0 -107
  573. package/dist/node_modules/@allyhub-next/runtime/dist/stage-kit.d.ts +0 -12
  574. package/dist/node_modules/@allyhub-next/runtime/dist/stage.d.ts +0 -34
  575. package/dist/node_modules/@allyhub-next/runtime/dist/styles.d.ts +0 -35
  576. package/dist/node_modules/@allyhub-next/runtime/dist/takes.d.ts +0 -72
  577. package/dist/node_modules/@allyhub-next/runtime/dist/titles.d.ts +0 -10
  578. package/dist/node_modules/@allyhub-next/runtime/dist/transitions.d.ts +0 -26
  579. package/dist/node_modules/@allyhub-next/site/dist/assets.d.ts +0 -59
  580. package/dist/node_modules/@allyhub-next/site/dist/assets.js +0 -2
  581. package/dist/node_modules/@allyhub-next/site/dist/astro.d.ts +0 -22
  582. package/dist/node_modules/@allyhub-next/site/dist/astro.js +0 -3
  583. package/dist/node_modules/@allyhub-next/site/dist/lockfile.d.ts +0 -40
  584. package/dist/node_modules/@allyhub-next/site/dist/lockfile.js +0 -3
  585. package/dist/node_modules/@allyhub-next/site/dist/media.d.ts +0 -24
  586. package/dist/node_modules/@allyhub-next/site/dist/media.js +0 -4
  587. package/dist/node_modules/@allyhub-next/site/package.json +0 -25
  588. package/dist/node_modules/@allyhub-next/slides-pptx/dist/charts.d.ts +0 -6
  589. package/dist/node_modules/@allyhub-next/slides-pptx/dist/fonts.d.ts +0 -45
  590. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.d.ts +0 -18
  591. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.js +0 -3
  592. package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.d.ts +0 -5
  593. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.d.ts +0 -55
  594. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.js +0 -4
  595. package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.d.ts +0 -67
  596. package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.d.ts +0 -21
  597. package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.d.ts +0 -4
  598. package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.d.ts +0 -32
  599. package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.d.ts +0 -32
  600. package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.d.ts +0 -26
  601. package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.d.ts +0 -40
  602. package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.d.ts +0 -4
  603. package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.js +0 -2
  604. package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.d.ts +0 -4
  605. package/dist/node_modules/@allyhub-next/slides-runtime/dist/ink.d.ts +0 -10
  606. package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.d.ts +0 -6
  607. package/dist/node_modules/@allyhub-next/stage/dist/bakes.d.ts +0 -42
  608. package/dist/node_modules/@allyhub-next/stage/dist/graphics.d.ts +0 -7
  609. package/dist/node_modules/@allyhub-next/stage/dist/identity.d.ts +0 -2
  610. package/dist/node_modules/@allyhub-next/stage/dist/index.d.ts +0 -9
  611. package/dist/node_modules/@allyhub-next/stage/dist/page.d.ts +0 -87
  612. package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.d.ts +0 -69
  613. package/dist/node_modules/@allyhub-next/stage/dist/scenery-solve.d.ts +0 -49
  614. package/dist/node_modules/@allyhub-next/stage/dist/scenery.d.ts +0 -8
  615. package/dist/node_modules/@allyhub-next/stage/dist/server.d.ts +0 -21
  616. package/dist/node_modules/@allyhub-next/stage-page/dist/host.d.ts +0 -22
  617. package/dist/node_modules/@allyhub-next/stage-page/dist/page.js +0 -79
  618. package/dist/site.d.ts +0 -2
  619. package/editor-web/assets/dist-Cg2PdedY.js +0 -6
  620. package/editor-web/assets/dist-CuW84oPe.js +0 -233
  621. package/editor-web/assets/dist-CxAS_vp7.js +0 -2
  622. package/editor-web/assets/dist-DCVaj9i1.js +0 -4
  623. package/editor-web/assets/dist-DGVUuVPB.js +0 -33
  624. package/editor-web/assets/dist-Yi3sy7Ea.js +0 -1
  625. package/editor-web/assets/index-B7S9RZhL.css +0 -2
  626. package/editor-web/assets/index-pwRfZ2Jv.js +0 -69
  627. package/editor-web/assets/minus-BizJdinJ.js +0 -1
  628. package/editor-web/assets/react-D54s6gwK.js +0 -101
  629. package/editor-web/assets/textarea-CvxipnGW.js +0 -105
  630. package/editor-web/assets/trash-2-Bq1Dt8XG.js +0 -1
  631. package/editor-web/assets/undo-2-Djhvu4xt.js +0 -1
  632. /package/dist/node_modules/@allyhub-next/{site → ooxml}/LICENSE +0 -0
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{FUNCTIONS as g}from"./functions/index.js";export function analyse(o,f){const s={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},m=new Set,c=(e,t)=>{const n=e.toLowerCase();if(t.has(n))return!0;const a=o.name(n);if(a)return s.names.add(n),m.has(n)||(m.add(n),a.formula?.node&&r(a.formula.node,new Set)),!0;const u=o.table(n);return u?(s.reads.push({kind:"structured",table:u.name,sections:[],columns:[],thisRow:!1}),!0):!1},r=(e,t)=>{switch(e.kind){case"ref":case"structured":s.reads.push(e);return;case"name":c(e.name,t)||s.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":r(e.arg,t);return;case"binary":r(e.left,t),r(e.right,t);return;case"array":return;case"invoke":r(e.callee,t);for(const n of e.args)r(n,t);return;case"call":{const n=g.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const a=new Set(t),u=e.args[e.args.length-1];e.args.forEach((i,d)=>{if(i!==u){if(e.name==="LET"&&d%2===1){r(i,a);return}i.kind==="name"&&a.add(i.name.toLowerCase())}}),u&&r(u,a);return}n?(n.volatile===!0&&(s.volatile=!0),(e.args.length<n.min||e.args.length>n.max)&&s.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max})):c(e.written,t)||s.unknownFunctions.push(e.name);for(const a of e.args)r(a,t);return}default:return}};return f.node&&r(f.node,new Set),s}
2
+ import{FUNCTIONS as p}from"./functions/index.js";import{fillsGroup as w}from"./functions/define.js";export function analyse(i,c,l){const a={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},d=new Set,g=(e,t,n)=>{const r=e.toLowerCase();if(n===void 0&&t.has(r))return!0;const u=n===void 0?l:i.sheet(n),o=u?[i.name(r,u)]:i.definitions(r);if(o.some(m=>m!==void 0)){a.names.add(r);const m=`${n??""}!${r}`;if(!d.has(m)){d.add(m);for(const h of o)h?.formula?.node&&s(h.formula.node,new Set)}return!0}if(p.has(e.toUpperCase()))return!0;const f=i.table(r);return f?(a.reads.push({kind:"structured",table:f.name,sections:[],columns:[],thisRow:!1}),!0):!1},s=(e,t)=>{switch(e.kind){case"ref":case"structured":a.reads.push(e);return;case"name":g(e.name,t,e.sheet)||a.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":s(e.arg,t);return;case"binary":s(e.left,t),s(e.right,t);return;case"array":return;case"invoke":s(e.callee,t);for(const n of e.args)s(n,t);return;case"call":{const n=p.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const r=new Set(t),u=e.args[e.args.length-1];e.args.forEach((o,f)=>{if(o!==u){if(e.name==="LET"&&f%2===1){s(o,r);return}o.kind==="name"&&r.add(o.name.toLowerCase())}}),u&&s(u,r);return}if(!n)g(e.written,t)||a.unknownFunctions.push(e.name);else{n.volatile===!0&&(a.volatile=!0);const r=n.kind==="raw"&&!w(n.params,e.args.length);(e.args.length<n.min||e.args.length>n.max||r)&&a.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max,...r?{group:n.params.group.length}:{}})}for(const r of e.args)s(r,t);return}default:return}};return c.node&&s(c.node,new Set),a}
@@ -4,7 +4,11 @@ export declare function numberOfText(text: string): number | undefined;
4
4
  export declare function toNumber(v: Scalar | undefined): number | CellError;
5
5
  export declare function toText(v: Scalar | undefined): string | CellError;
6
6
  export declare function toBool(v: Scalar | undefined): boolean | CellError;
7
- /** Equal to 15 significant digits, as Excel compares numbers. */
7
+ /**
8
+ * Equal to 15 significant digits, as Excel compares numbers. Two numbers that
9
+ * round to the same 15 digits are within 1e-13 of each other relatively, so
10
+ * any further apart are told apart without rounding either.
11
+ */
8
12
  export declare const sameNumber: (a: number, b: number) => boolean;
9
13
  /** Excel's order of two values that are not errors: numbers, then text, then TRUE and FALSE. */
10
14
  export declare function compare(a: Scalar, b: Scalar): number;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as b}from"../values.js";export function numberOfText(e){const r=b(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r||Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
2
+ import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as M}from"../values.js";export function numberOfText(e){if(!/\d/u.test(e))return;const r=M(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r?!0:Math.abs(e-r)>1e-13*Math.max(Math.abs(e),Math.abs(r))?!1:Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
@@ -1,12 +1,27 @@
1
1
  import type { Node, RefNode, StructuredNode } from "../formula/ast.js";
2
2
  import { CellError, Matrix, type Scalar } from "../values.js";
3
3
  import { FormulaCell, SharedFormula, type Slot, type Workbook, type Worksheet } from "../workbook.js";
4
+ import { type Computed } from "./remote.js";
5
+ import { RangeCache, type Index } from "./indexes.js";
6
+ import { type FunctionDef } from "./functions/index.js";
4
7
  import { Lambda, Reference, Union, type Frame, type Value } from "./types.js";
5
8
  export interface CalcOptions {
6
9
  /** The moment NOW and TODAY read. Default: the clock. */
7
10
  now?: Date;
8
11
  /** What RAND reads, values from 0 up to 1. Default: Math.random. */
9
12
  random?: () => number;
13
+ /**
14
+ * Keeps what each pass settles for `takeComputed`: a calculation in a
15
+ * worker, which sends it to the model the page reads.
16
+ */
17
+ report?: boolean;
18
+ /**
19
+ * Computes nothing: a model the page reads while a calculation elsewhere
20
+ * works. What is typed shows at once; what formulas give arrives by
21
+ * `receive`, and a formula reads as it last did until then. A formula
22
+ * given to `evaluate` (a rule's, a validation's) is worked out over that.
23
+ */
24
+ replica?: boolean;
10
25
  }
11
26
  /**
12
27
  * Random numbers that are the same for the same seed, for a result that must
@@ -31,12 +46,15 @@ export declare class Calc {
31
46
  private readonly stack;
32
47
  private readonly inCycle;
33
48
  private readonly namesAt;
34
- private readonly dependents;
35
- private readonly watches;
36
- /** Watches by the column they are on, and those too wide to list by column. */
37
- private readonly watchesAt;
38
- private readonly wideWatches;
39
- private graph;
49
+ /** Who reads whom: made the first time something changes. */
50
+ private readonly graph;
51
+ private graphMade;
52
+ /** Keeps what each pass settles, for `takeComputed`. */
53
+ private readonly reports;
54
+ /** Computes nothing; results arrive by `receive`. */
55
+ readonly replica: boolean;
56
+ /** What passes settled since `takeComputed` was last asked. */
57
+ private readonly settled;
40
58
  /** What spills changed since it was last looked at. */
41
59
  private moved;
42
60
  /** Formula cells whose spill's size turned out to depend on itself. */
@@ -44,8 +62,10 @@ export declare class Calc {
44
62
  private readonly hiddenBy;
45
63
  /** What reads what no reference shows (OFFSET, INDIRECT) or changes by itself (NOW, RAND): computed with every change, as Excel's are. */
46
64
  private volatiles;
47
- /** Lookup indexes of ranges, while nothing has changed. */
48
- readonly indexes: Map<string, Map<string, number[]>>;
65
+ /** Lookup and criteria indexes of ranges, each kept until its range changes. */
66
+ readonly indexes: RangeCache<Index>;
67
+ /** Criteria functions' results over ranges, each kept until a range it read changes. */
68
+ readonly results: RangeCache<Scalar>;
49
69
  readonly wb: Workbook;
50
70
  constructor(wb: Workbook, o?: CalcOptions);
51
71
  private allCells;
@@ -65,6 +85,8 @@ export declare class Calc {
65
85
  /** What an empty place reads: nothing, or the value a formula spilled into it. */
66
86
  private ghost;
67
87
  private circular;
88
+ /** What was worked out over ranges that hold changed cells is worked out again. */
89
+ private forget;
68
90
  private run;
69
91
  /**
70
92
  * What reads a spill's cells computed again until nothing moves: who reads
@@ -79,6 +101,8 @@ export declare class Calc {
79
101
  private analysisOf;
80
102
  /** What a formula cell reads, by what evaluating its references gives. */
81
103
  private readsOf;
104
+ /** What a formula reads evaluated at a place, an entry a reference (each place of a union its own); undefined where one gives no place. */
105
+ private readsAt;
82
106
  /** What a formula that is in no cell reads: a chart's, a rule's, a check's. */
83
107
  readsOfFormula(shared: SharedFormula, sheet: Worksheet): Reference[];
84
108
  /** `seeds`, and what they read that is to be computed, each after what it reads. */
@@ -103,6 +127,7 @@ export declare class Calc {
103
127
  private bound;
104
128
  resolveRef(n: RefNode, f: Frame): Reference | Union | CellError;
105
129
  structured(n: StructuredNode, f: Frame): Reference | Union | CellError;
130
+ /** A name's value: a LET's or a LAMBDA's, else the sheet's own (`sheet` when it is written Sheet1!name), else the workbook's. */
106
131
  private nameValue;
107
132
  private intersect;
108
133
  private unary;
@@ -115,17 +140,31 @@ export declare class Calc {
115
140
  /** A LAMBDA given its arguments' values. */
116
141
  apply(l: Lambda, args: readonly Value[]): Value;
117
142
  private call;
118
- /** A function of single values given ranges or arrays: over each of their cells. */
119
- private lifted;
143
+ /**
144
+ * A function given its arguments' values: every function call goes through
145
+ * here, a function's own call of another (AGGREGATE's) too, so each is
146
+ * lifted over arrays as its parameters say.
147
+ */
148
+ applyFunction(def: FunctionDef, values: readonly Value[], f: Frame): Value;
149
+ /**
150
+ * A function over its arguments, as Excel lifts one: where a single value
151
+ * goes and an array or a range of several cells is given, the function is
152
+ * applied over each of its cells and the results are an array. Arrays of
153
+ * different sizes are stretched along a side of one, and give #N/A past the
154
+ * end of a shorter one. Every argument taken as a single value is given as
155
+ * one (a Scalar, or Missing when left empty).
156
+ */
157
+ private over;
158
+ /** One cell of a lifted function's array: what one call gave, as a single value. */
159
+ private element;
120
160
  /** One scalar from a value: a range in a place for one gives the cell in the formula's row or column. */
121
161
  scalar(v: Value, f: Frame): Scalar;
122
162
  /** Lets NOW, TODAY, RAND and whatever else is volatile change on the next pass. */
123
163
  recalculate(): this;
124
- private key;
125
- private addEdges;
126
- private removeEdges;
127
164
  /** The graph of who reads whom: made the first time something changes. */
128
165
  private build;
166
+ private addEdges;
167
+ private removeEdges;
129
168
  /** Who reads any place of an area. */
130
169
  private readersIn;
131
170
  /** Who reads a place. */
@@ -146,6 +185,14 @@ export declare class Calc {
146
185
  change(cells: readonly CellChange[]): void;
147
186
  /** Sets a defined name's constant (a scenario's) and computes what reads it. */
148
187
  setName(name: string, value: Scalar): void;
188
+ /** What passes settled since this was last asked, for the model the page reads (`receive`). */
189
+ takeComputed(): Computed;
190
+ /**
191
+ * What a calculation elsewhere computed, put in this model: each formula
192
+ * cell's value and spill. A cell no longer a formula, or another formula
193
+ * now, is left as it is: what was typed there since is newer.
194
+ */
195
+ receive(computed: Computed): void;
149
196
  /** Numbers of a value, for code outside a formula. */
150
197
  numberOf(v: Scalar): number | CellError;
151
198
  }
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{MAX_COLUMNS as A,MAX_ROWS as M,overlaps as L}from"../address.js";import{CellError as m,ERR as f,Matrix as d,serialOfDate as U}from"../values.js";import{filteredRows as N}from"../filter.js";import{FormulaCell as b,SharedFormula as F,placeKey as _}from"../workbook.js";import{analyse as V}from"./analyse.js";import{binary as k,mapBoth as I,toNumber as T}from"./coerce.js";import{FUNCTIONS as B}from"./functions/index.js";import{Lambda as S,MISSING as O,Missing as x,Reference as u,Union as g}from"./types.js";export function seededRandom(h){let t=2166136261;for(let e=0;e<h.length;e++)t=Math.imul(t^h.charCodeAt(e),16777619);return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const $=new Set,W=/\b(?:SUBTOTAL|AGGREGATE)\(/iu,D=2e3,z=32,R=12,G=(h,t)=>!h||!t?h===t:h.rows!==t.rows||h.cols!==t.cols?!1:h.data.every((e,s)=>e===t.data[s]),H=(h,t)=>h.row<t.row||h.row===t.row&&h.col<t.col;class P{cells=new Set;reference;constructor(t){this.reference=t}}export class Calc{cycles=[];computed=0;nowSerial;random;pass=0;stack=[];inCycle=new Set;namesAt=new Set;dependents=new Map;watches=new Map;watchesAt=new Map;wideWatches=[];graph=!1;moved=[];unsettled=new Set;hiddenBy=new Map;volatiles=new Set;indexes=new Map;wb;constructor(t,e={}){this.wb=t;const{now:s,random:n}=e;this.nowSerial=()=>U(s??new Date),this.random=n??Math.random;for(const o of t.sheets)o.expand()}allCells(){return this.wb.sheets.flatMap(t=>[...t.formulas])}filtered(t){return this.hiddenBy.get(t)??$}calculate(){this.hiddenBy.clear();for(const e of this.wb.sheets)e.clearSpills();this.moved=[],this.unsettled.clear();const t=this.allCells();for(const e of t)e.state=1;return this.cycles=[],this.inCycle.clear(),this.run(t),this.applyFilters(t),this}applyFilters(t){for(const e of this.wb.sheets){if(e.filters.every(n=>n.columns.size===0))continue;const s=N(e,this);s.size>0&&this.hiddenBy.set(e,s)}if(this.hiddenBy.size!==0&&t.some(e=>W.test(e.shared.text))){for(const e of t)e.state=1;this.cycles=[],this.inCycle.clear(),this.run([...t])}}value(t,e,s){return this.read(t,e,s)}read(t,e,s){const n=t.at(e,s);return n===void 0?this.ghost(t,e,s):typeof n!="object"||n instanceof m?n:(n.state===1?this.compute(n):n.state===2&&this.circular(n),n.value)}ghost(t,e,s){const n=t.spillAt(e,s);if(!n)return null;if(n.state===1)this.compute(n);else if(n.state===2)return this.circular(n),null;const{array:o}=n;return o&&t.spillAt(e,s)===n?o.at(e-n.row,s-n.col):null}circular(t){const e=this.stack.indexOf(t),s=e<0?[t]:this.stack.slice(e);s.some(n=>this.inCycle.has(n))||this.cycles.push(s);for(const n of s)this.inCycle.add(n)}run(t){this.indexes.clear(),this.computed=0;for(const e of this.order(t))e.state===1&&this.compute(e);this.spread()}spread(){for(let t=0;this.moved.length>0;t++){const e=this.moved;if(this.moved=[],t>=R*2)break;if(t>=R)for(const{sheet:o,area:r}of e)for(const i of o.spillsIn(r))this.unsettled.add(i);this.build();const s=new Set,n=[...this.unsettled];for(const{sheet:o,area:r}of e)n.push(...this.readersIn(o,r),...o.blockedBy(r));for(;;){const o=n.pop();if(!o)break;s.has(o)||(s.add(o),n.push(...this.readers(o.sheet,o.row,o.col)))}if(s.size!==0){for(const o of s)o.state=1,this.inCycle.delete(o);this.cycles=this.cycles.filter(o=>!o.some(r=>s.has(r))),this.indexes.clear();for(const o of this.order([...s]))o.state===1&&this.compute(o)}}for(const t of this.wb.sheets)t.tighten()}spillOut(t,e){const{sheet:s,row:n,col:o}=t,r={top:n,left:o,bottom:n+e.rows-1,right:o+e.cols-1},i=s.spillsIn(r).filter(c=>c!==t);if(r.bottom>=M||r.right>=A||s.holds(r,t)||s.tables.some(c=>L(c.area,r))||s.merges.some(c=>L(c,r))||i.some(c=>H(c,t)))return s.blockSpill(t,r),!1;for(const c of i)this.evict(c,r);return s.placeSpill(t,r),!0}evict(t,e){const{sheet:s,spill:n}=t;n&&(s.clearSpill(t),s.blockSpill(t,e),t.array=void 0,t.value=f.SPILL,this.moved.push({sheet:s,area:n}))}analysisOf(t){return t.analysis??=V(this.wb,t)}readsOf(t){const e=[],s=v(t);for(const n of this.analysisOf(t.shared).reads){const o=n.kind==="ref"?this.resolveRef(n,s):this.structured(n,s);o instanceof u?e.push(o):o instanceof g&&e.push(...o.parts)}return e}readsOfFormula(t,e){const s=[],n={sheet:e,row:t.row,col:t.col,dr:0,dc:0};for(const o of this.analysisOf(t).reads){const r=o.kind==="ref"?this.resolveRef(o,n):this.structured(o,n);r instanceof u?s.push(r):r instanceof g&&s.push(...r.parts)}return s}order(t){this.pass+=1;const{pass:e}=this,s=[],n=new Set,o=[],r=i=>{i.mark=e,o.push({cell:i,reads:this.pending(i,n),next:0})};for(const i of t)if(i.mark!==e)for(r(i);;){const a=o[o.length-1];if(!a)break;const c=a.reads[a.next];a.next+=1,c===void 0?(s.push(a.cell),o.pop()):c.mark!==e&&c.state===1&&r(c)}return s}pending(t,e){const s=[];for(const n of this.readsOf(t)){const{sheet:o}=n;if(n.single){const i=o.at(n.top,n.left);i instanceof b&&s.push(i);continue}if(e.has(n.key))continue;e.add(n.key);const r=Math.min(n.right,o.columnsUsed-1);for(let i=n.left;i<=r;i++){if(!o.hasFormulas(i))continue;const[a,c]=o.span(i,n.top,n.bottom);for(let l=a;l<=c;l++){const p=o.at(l,i);p instanceof b&&s.push(p)}}}return s}compute(t){if(this.stack.length>=D){t.value=f.CALC,t.state=0;return}t.state=2,this.stack.push(t),this.computed+=1;const{node:e}=t.shared,s=e?this.top(this.eval(e,v(t))):f.NAME;this.stack.pop(),this.unsettled.has(t)&&!this.inCycle.has(t)&&(this.inCycle.add(t),this.cycles.push([t])),this.settleResult(t,s),t.state=0}settleResult(t,e){const{sheet:s}=t,n=t.spill,o=t.array;if(s.clearSpill(t),t.array=void 0,e instanceof d){const i=j(e);i.rows*i.cols<=1||this.spillOut(t,i)?(t.array=i,t.value=i.at(0,0)??0):t.value=f.SPILL}else t.value=e;this.inCycle.has(t)&&(s.clearSpill(t),t.value=f.CYCLE,t.array=void 0);const r=t.spill;(!G(o,t.array)||!q(n,r))&&(n&&this.moved.push({sheet:s,area:n}),r&&this.moved.push({sheet:s,area:r}))}top(t){const e=this.flat(t);return e===null?0:e}flat(t){return t instanceof u?t.single?this.read(t.sheet,t.top,t.left):this.matrix(t):t instanceof g?f.VALUE:t instanceof S?f.CALC:t instanceof x?null:t}matrix(t){const e=t.bottom===M-1?Math.min(t.bottom,t.sheet.lastRow):t.bottom,s=t.right===A-1?Math.min(t.right,t.sheet.columnsUsed-1):t.right,n=Math.max(0,e-t.top+1),o=Math.max(0,s-t.left+1),r=new Array(n*o);for(let i=0;i<n;i++)for(let a=0;a<o;a++)r[i*o+a]=this.read(t.sheet,t.top+i,t.left+a);return new d(n,o,r)}each(t,e){const{sheet:s}=t,n=Math.min(t.right,s.columnsUsed-1);for(let o=t.left;o<=n;o++){const[r,i]=s.span(o,t.top,t.bottom);for(let a=r;a<=i;a++){const c=s.at(a,o);if(c===void 0){s.spillAt(a,o)&&e(this.read(s,a,o),a,o);continue}e(typeof c=="object"&&!(c instanceof m)?this.read(s,a,o):c,a,o)}}}evaluate(t,e){const{node:s}=t;return s?this.top(this.eval(s,{sheet:e,row:t.row,col:t.col,dr:0,dc:0})):f.NAME}evaluateAt(t,e,s,n){const{node:o}=t;return o?this.top(this.eval(o,{sheet:e,row:s,col:n,dr:s-t.row,dc:n-t.col})):f.NAME}bound(t,e,s){const n=t.abs?t.index:t.index+e;return n<0||n>=s?void 0:n}resolveRef(t,e){const s=t.sheet===void 0?e.sheet:this.wb.sheet(t.sheet);if(!s)return f.REF;let n=0,o=A-1,r=0,i=M-1;if(t.col){const a=this.bound(t.col,e.dc,A),c=this.bound(t.col2??t.col,e.dc,A);if(a===void 0||c===void 0)return f.REF;n=Math.min(a,c),o=Math.max(a,c)}if(t.row){const a=this.bound(t.row,e.dr,M),c=this.bound(t.row2??t.row,e.dr,M);if(a===void 0||c===void 0)return f.REF;r=Math.min(a,c),i=Math.max(a,c)}if(t.lastSheet!==void 0){const a=this.wb.sheet(t.lastSheet);if(!a)return f.REF;const[c,l]=[Math.min(s.index,a.index),Math.max(s.index,a.index)];return new g(this.wb.sheets.slice(c,l+1).map(p=>new u(p,r,n,i,o)))}return new u(s,r,n,i,o)}structured(t,e){const s=t.table===void 0?e.sheet.tableAt(e.row,e.col):this.wb.table(t.table);return s?X(s,t,e):t.table===void 0?f.REF:f.NAME}nameValue(t,e){const s=t.toLowerCase();for(let r=e.scope;r;r=r.parent){const i=r.names.get(s);if(i!==void 0)return i}const n=this.wb.name(t);if(n){if(!n.formula)return n.value??null;const{node:r}=n.formula;if(!r)return f.NAME;if(this.namesAt.has(s))return f.CYCLE;this.namesAt.add(s);try{return this.eval(r,{sheet:e.sheet,row:0,col:0,dr:0,dc:0})}finally{this.namesAt.delete(s)}}const o=this.wb.table(t);if(o){const{top:r,left:i,bottom:a,right:c}=o.data;return new u(o.sheet,r,i,a,c)}return f.NAME}intersect(t,e){return!(t instanceof u)||t.single?t:t.cols===1&&e.row>=t.top&&e.row<=t.bottom?new u(t.sheet,e.row,t.left,e.row,t.left):t.rows===1&&e.col>=t.left&&e.col<=t.right?new u(t.sheet,t.top,e.col,t.top,e.col):f.VALUE}unary(t,e){const s=this.flat(t);return s instanceof d?new d(s.rows,s.cols,s.data.map(e)):e(s)}operate(t,e,s){const n=this.flat(e),o=this.flat(s);if(n instanceof d||o instanceof d){const r=(i,a)=>k(t,i,a);return I(n instanceof d?n:new d(1,1,[n]),o instanceof d?o:new d(1,1,[o]),r)}return k(t,n,o)}rangeOf(t,e){return t instanceof m?t:e instanceof m?e:!(t instanceof u)||!(e instanceof u)||t.sheet!==e.sheet?f.REF:new u(t.sheet,Math.min(t.top,e.top),Math.min(t.left,e.left),Math.max(t.bottom,e.bottom),Math.max(t.right,e.right))}intersection(t,e){if(t instanceof m)return t;if(e instanceof m)return e;if(!(t instanceof u)||!(e instanceof u))return f.REF;const s=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.bottom,e.bottom),r=Math.min(t.right,e.right);return t.sheet!==e.sheet||s>o||n>r?f.NULL:new u(t.sheet,s,n,o,r)}union(t,e){if(t instanceof m)return t;if(e instanceof m)return e;const s=o=>o instanceof u?[o]:o instanceof g?o.parts:[],n=[...s(t),...s(e)];return n.length===0?f.VALUE:new g(n)}eval(t,e){switch(t.kind){case"number":case"string":case"boolean":return t.value;case"error":return m.of(t.code);case"missing":return O;case"ref":return this.resolveRef(t,e);case"structured":return this.structured(t,e);case"name":return this.nameValue(t.name,e);case"paren":return this.eval(t.arg,e);case"unary":{const s=this.eval(t.arg,e);return t.op==="@"?this.intersect(s,e):t.op==="+"?s:this.unary(s,n=>k("*",n,-1))}case"postfix":{const s=this.eval(t.arg,e);if(t.op==="%")return this.unary(s,n=>k("/",n,100));if(s instanceof u&&s.single){const n=s.sheet.at(s.top,s.left);if(n instanceof b){this.read(s.sheet,s.top,s.left);const{spill:o}=n;if(o)return new u(s.sheet,o.top,o.left,o.bottom,o.right);if(n.array)return s}}return f.REF}case"binary":{const s=this.eval(t.left,e),n=this.eval(t.right,e);return t.op===":"?this.rangeOf(s,n):t.op===" "?this.intersection(s,n):t.op===","?this.union(s,n):this.operate(t.op,s,n)}case"array":return new d(t.rows.length,t.rows[0]?.length??0,t.rows.flatMap(s=>s.map(n=>{const o=this.eval(n,e);return o instanceof d||o instanceof u||o instanceof g||o instanceof S||o instanceof x?f.VALUE:o})));case"invoke":{const s=this.eval(t.callee,e);return s instanceof S?this.invoke(s,t.args,e):s instanceof m?s:f.VALUE}case"call":return this.call(t.name,t.args,e)}}invoke(t,e,s){return this.apply(t,e.map(n=>this.eval(n,s)))}apply(t,e){if(e.length>t.params.length)return f.VALUE;const s=new Map;return t.params.forEach((n,o)=>{s.set(n,e[o]??O)}),this.eval(t.body,{...t.frame,scope:{names:s,...t.frame.scope?{parent:t.frame.scope}:{}}})}call(t,e,s){const n=B.get(t);if(!n){const i=this.nameValue(t,s);return i instanceof S?this.invoke(i,e,s):f.NAME}const o={calc:this,frame:s};if(e.length<n.min||e.length>n.max)return f.VALUE;if(n.kind==="lazy")return n.call(e,o);const r=e.map(i=>this.eval(i,s));return n.kind==="raw"?n.call(r,o):this.lifted(n.call,n.errors===!0,r)}lifted(t,e,s){const n=s.map(l=>l instanceof x?void 0:this.flat(l)),o=l=>{if(!e){for(const p of l)if(p instanceof m)return p}return t(...l)};if(!n.some(l=>l instanceof d))return o(n);const r=n.filter(l=>l instanceof d),i=Math.max(...r.map(l=>l.rows)),a=Math.max(...r.map(l=>l.cols)),c=new Array(i*a);for(let l=0;l<i;l++)for(let p=0;p<a;p++)c[l*a+p]=o(n.map(w=>{if(!(w instanceof d))return w;const E=w.rows===1?0:l,y=w.cols===1?0:p;return E<w.rows&&y<w.cols?w.at(E,y):f.NA}));return new d(i,a,c)}scalar(t,e){if(t instanceof x)return null;if(t instanceof u){const s=this.intersect(t,e);return s instanceof u?this.read(s.sheet,s.top,s.left):f.VALUE}return t instanceof d?t.at(0,0):t instanceof g||t instanceof S?f.VALUE:t}recalculate(){const t=this.allCells().filter(e=>this.analysisOf(e.shared).volatile);return this.mark(t),this}key(t,e,s){return`${String(t.index)}:${String(_(e,s))}`}addEdges(t){this.analysisOf(t.shared).volatile&&this.volatiles.add(t);for(const e of this.readsOf(t))if(e.single){const s=this.key(e.sheet,e.top,e.left);let n=this.dependents.get(s);n||(n=new Set,this.dependents.set(s,n)),n.add(t)}else{let s=this.watches.get(e.key);if(!s)if(s=new P(e),this.watches.set(e.key,s),e.cols>z)this.wideWatches.push(s);else for(let n=e.left;n<=e.right;n++){const o=`${String(e.sheet.index)}:${String(n)}`,r=this.watchesAt.get(o);r?r.push(s):this.watchesAt.set(o,[s])}s.cells.add(t)}}removeEdges(t){this.volatiles.delete(t);for(const e of this.readsOf(t))e.single?this.dependents.get(this.key(e.sheet,e.top,e.left))?.delete(t):this.watches.get(e.key)?.cells.delete(t)}build(){if(!this.graph){this.graph=!0;for(const t of this.allCells())this.addEdges(t)}}readersIn(t,e){const s=new Set,n=e.right;for(let i=e.top;i<=e.bottom;i++)for(let a=e.left;a<=n;a++)for(const c of this.dependents.get(this.key(t,i,a))??[])s.add(c);const o=new Set,r=i=>{if(o.has(i))return;o.add(i);const{reference:a,cells:c}=i;if(a.sheet===t&&L(a,e))for(const l of c)s.add(l)};this.wideWatches.forEach(r);for(let i=e.left;i<=n;i++)this.watchesAt.get(`${String(t.index)}:${String(i)}`)?.forEach(r);return[...s]}readers(t,e,s){this.build();const n=new Set(this.dependents.get(this.key(t,e,s))),o=`${String(t.index)}:${String(s)}`,r=this.watchesAt.get(o)??[];for(const i of[r,this.wideWatches])for(const{reference:a,cells:c}of i)if(a.sheet===t&&e>=a.top&&e<=a.bottom&&s>=a.left&&s<=a.right)for(const l of c)n.add(l);return[...n]}precedents(t){return this.readsOf(t)}mark(t){this.build();const e=new Set(t),s=[...t];for(;;){const n=s.pop();if(!n)break;for(const o of this.readers(n.sheet,n.row,n.col))e.has(o)||(e.add(o),s.push(o))}this.settle(e)}settle(t){for(const e of t)e.state=1,this.inCycle.delete(e);this.cycles=this.cycles.filter(e=>!e.some(s=>t.has(s))),this.run([...t])}set(t,e,s,n){const o=typeof n=="string"&&n.length>1&&n.startsWith("=")?new b(new F(n,e,s,{file:""}),t,e,s):void 0;this.change([{sheet:t,row:e,col:s,slot:o??n??void 0}])}prepare(){this.build()}change(t){this.build();const e=new Set,s=[...this.unsettled];this.unsettled.clear();for(const{sheet:n,row:o,col:r,slot:i}of t){const a=n.at(o,r);a instanceof b&&(this.removeEdges(a),e.delete(a),a.spill&&this.moved.push({sheet:n,area:a.spill}),n.clearSpill(a));const c=n.spillAt(o,r);c&&s.push(c),s.push(...n.blockedBy({top:o,left:r,bottom:o,right:r})),n.replace(o,r,i),i instanceof b&&(this.addEdges(i),e.add(i))}for(const{sheet:n,row:o,col:r}of t)s.push(...this.readers(n,o,r));for(s.push(...this.volatiles);;){const n=s.pop();if(!n)break;e.has(n)||(e.add(n),s.push(...this.readers(n.sheet,n.row,n.col)))}this.settle(e)}setName(t,e){const s=this.wb.name(t);if(!s)throw new Error(`There is no name ${t}.`);s.value=e,delete s.formula;const n=t.toLowerCase();this.mark(this.allCells().filter(o=>this.analysisOf(o.shared).names.has(n)))}numberOf(t){return T(t)}}const q=(h,t)=>h?.top===t?.top&&h?.left===t?.left&&h?.bottom===t?.bottom&&h?.right===t?.right;function j(h){return h.data.some(t=>t===null)?new d(h.rows,h.cols,h.data.map(t=>t??0)):h}function v(h){return{sheet:h.sheet,row:h.row,col:h.col,dr:h.row-h.shared.row,dc:h.col-h.shared.col}}function X(h,t,e){const{sheet:s}=h,n=h.area;let o=n.left,r=n.right;const[i,a]=t.columns;if(i!==void 0){const y=h.column(i),C=a===void 0?y:h.column(a);if(!y||!C)return f.REF;o=n.left+Math.min(y.index,C.index),r=n.left+Math.max(y.index,C.index)}if(t.thisRow)return e.sheet!==s||e.row<=n.top||e.row>n.bottom?f.VALUE:new u(s,e.row,o,e.row,r);const c=t.sections;if(c.includes("#Totals"))return f.REF;const l=c.includes("#All")||c.includes("#Headers"),p=c.length===0||c.includes("#All")||c.includes("#Data"),w=l?n.top:n.top+1,E=p?n.bottom:n.top;return new u(s,w,o,E,r)}
2
+ import{MAX_COLUMNS as E,MAX_ROWS as k,overlaps as O}from"../address.js";import{CellError as m,ERR as h,Matrix as p,serialOfDate as _}from"../values.js";import{filteredRows as B}from"../filter.js";import{FormulaCell as y,SharedFormula as I}from"../workbook.js";import{analyse as z}from"./analyse.js";import{Graph as T}from"./graph.js";import{fromWire as G,matrixFromWire as D,matrixToWire as W,toWire as P}from"./remote.js";import{RangeCache as U}from"./indexes.js";import{binary as S,mapBoth as H,toNumber as q}from"./coerce.js";import{FUNCTIONS as v}from"./functions/index.js";import{fillsGroup as j,paramAt as X}from"./functions/define.js";import{Lambda as M,MISSING as F,Missing as x,Reference as u,Union as b}from"./types.js";export function seededRandom(l){let t=2166136261;for(let e=0;e<l.length;e++)t=Math.imul(t^l.charCodeAt(e),16777619);return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const Y=new Set,Z=/\b(?:SUBTOTAL|AGGREGATE)\(/iu,$=2e3,N=12,J=(l,t)=>!l||!t?l===t:l.rows!==t.rows||l.cols!==t.cols?!1:l.data.every((e,s)=>e===t.data[s]),K=(l,t)=>l.row<t.row||l.row===t.row&&l.col<t.col;export class Calc{cycles=[];computed=0;nowSerial;random;pass=0;stack=[];inCycle=new Set;namesAt=new Set;graph=new T({readsOf:t=>this.readsOf(t),readsAt:(t,e,s,n)=>this.readsAt(t,e,s,n)});graphMade=!1;reports;replica;settled=new Set;moved=[];unsettled=new Set;hiddenBy=new Map;volatiles=new Set;indexes=new U;results=new U;wb;constructor(t,e={}){this.wb=t;const{now:s,random:n}=e;this.reports=e.report===!0,this.replica=e.replica===!0,this.nowSerial=()=>_(s??new Date),this.random=n??Math.random;for(const o of t.sheets)o.expand()}allCells(){return this.wb.sheets.flatMap(t=>[...t.formulas])}filtered(t){return this.hiddenBy.get(t)??Y}calculate(){if(this.replica){for(const e of this.wb.sheets)e.clearSpills();for(const e of this.allCells())e.state=0;return this}this.hiddenBy.clear(),this.indexes.clear(),this.results.clear();for(const e of this.wb.sheets)e.clearSpills();this.moved=[],this.unsettled.clear();const t=this.allCells();for(const e of t)e.state=1;return this.cycles=[],this.inCycle.clear(),this.run(t),this.applyFilters(t),this}applyFilters(t){for(const e of this.wb.sheets){if(e.filters.every(n=>n.columns.size===0))continue;const s=B(e,this);s.size>0&&this.hiddenBy.set(e,s)}if(this.hiddenBy.size!==0&&t.some(e=>Z.test(e.shared.text))){for(const e of t)e.state=1;this.cycles=[],this.inCycle.clear(),this.run([...t])}}value(t,e,s){return this.read(t,e,s)}read(t,e,s){const n=t.at(e,s);return n===void 0?this.ghost(t,e,s):typeof n!="object"||n instanceof m?n:(n.state===1?this.compute(n):n.state===2&&this.circular(n),n.value)}ghost(t,e,s){const n=t.spillAt(e,s);if(!n)return null;if(n.state===1)this.compute(n);else if(n.state===2)return this.circular(n),null;const{array:o}=n;return o&&t.spillAt(e,s)===n?o.at(e-n.row,s-n.col):null}circular(t){const e=this.stack.indexOf(t),s=e<0?[t]:this.stack.slice(e);s.some(n=>this.inCycle.has(n))||this.cycles.push(s);for(const n of s)this.inCycle.add(n)}forget(t,e){this.indexes.changed(t,e),this.results.changed(t,e)}run(t){for(const e of t){const{sheet:s,row:n,col:o}=e;this.forget(s,{top:n,left:o,bottom:n,right:o}),e.spill&&this.forget(s,e.spill)}this.computed=0;for(const e of this.order(t))e.state===1&&this.compute(e);this.spread()}spread(){for(let t=0;this.moved.length>0;t++){const e=this.moved;if(this.moved=[],t>=N*2)break;if(t>=N)for(const{sheet:o,area:r}of e)for(const i of o.spillsIn(r))this.unsettled.add(i);this.build();const s=new Set,n=[...this.unsettled];for(const{sheet:o,area:r}of e)n.push(...this.readersIn(o,r),...o.blockedBy(r));for(;;){const o=n.pop();if(!o)break;s.has(o)||(s.add(o),n.push(...this.readers(o.sheet,o.row,o.col)))}if(s.size!==0){for(const o of s)o.state=1,this.inCycle.delete(o);this.cycles=this.cycles.filter(o=>!o.some(r=>s.has(r))),this.indexes.clear(),this.results.clear();for(const o of this.order([...s]))o.state===1&&this.compute(o)}}for(const t of this.wb.sheets)t.tighten()}spillOut(t,e){const{sheet:s,row:n,col:o}=t,r={top:n,left:o,bottom:n+e.rows-1,right:o+e.cols-1},i=s.spillsIn(r).filter(c=>c!==t);if(r.bottom>=k||r.right>=E||s.holds(r,t)||s.tables.some(c=>O(c.area,r))||s.merges.some(c=>O(c,r))||i.some(c=>K(c,t)))return s.blockSpill(t,r),!1;for(const c of i)this.evict(c,r);return s.placeSpill(t,r),!0}evict(t,e){const{sheet:s,spill:n}=t;n&&(s.clearSpill(t),s.blockSpill(t,e),t.array=void 0,t.value=h.SPILL,this.moved.push({sheet:s,area:n}),this.reports&&this.settled.add(t))}analysisOf(t){return t.analysis??=z(this.wb,t)}readsOf(t){const e=[],s=V(t);for(const n of this.analysisOf(t.shared).reads){const o=n.kind==="ref"?this.resolveRef(n,s):this.structured(n,s);o instanceof u?e.push(o):o instanceof b&&e.push(...o.parts)}return e}readsAt(t,e,s,n){const o={sheet:e,row:s,col:n,dr:s-t.row,dc:n-t.col},r=[];for(const i of this.analysisOf(t).reads){const a=i.kind==="ref"?this.resolveRef(i,o):this.structured(i,o);a instanceof u?r.push(a):a instanceof b?r.push(...a.parts):r.push(void 0)}return r}readsOfFormula(t,e){const s=[],n={sheet:e,row:t.row,col:t.col,dr:0,dc:0};for(const o of this.analysisOf(t).reads){const r=o.kind==="ref"?this.resolveRef(o,n):this.structured(o,n);r instanceof u?s.push(r):r instanceof b&&s.push(...r.parts)}return s}order(t){this.pass+=1;const{pass:e}=this,s=[],n=new Set,o=[],r=i=>{i.mark=e,o.push({cell:i,reads:this.pending(i,n),next:0})};for(const i of t)if(i.mark!==e)for(r(i);;){const a=o[o.length-1];if(!a)break;const c=a.reads[a.next];a.next+=1,c===void 0?(s.push(a.cell),o.pop()):c.mark!==e&&c.state===1&&r(c)}return s}pending(t,e){const s=[];for(const n of this.readsOf(t)){const{sheet:o}=n;if(n.single){const i=o.at(n.top,n.left);i instanceof y&&s.push(i);continue}if(e.has(n.key))continue;e.add(n.key);const r=Math.min(n.right,o.columnsUsed-1);for(let i=n.left;i<=r;i++){if(!o.hasFormulas(i))continue;const[a,c]=o.span(i,n.top,n.bottom);for(let f=a;f<=c;f++){const d=o.at(f,i);d instanceof y&&s.push(d)}}}return s}compute(t){if(this.stack.length>=$){t.value=h.CALC,t.state=0;return}t.state=2,this.stack.push(t),this.computed+=1;const{node:e}=t.shared,s=e?this.top(this.eval(e,V(t))):h.NAME;this.stack.pop(),this.unsettled.has(t)&&!this.inCycle.has(t)&&(this.inCycle.add(t),this.cycles.push([t])),this.settleResult(t,s),t.state=0,this.reports&&this.settled.add(t)}settleResult(t,e){const{sheet:s}=t,n=t.spill,o=t.array;if(s.clearSpill(t),t.array=void 0,e instanceof p){const i=tt(e);i.rows*i.cols<=1||this.spillOut(t,i)?(t.array=i,t.value=i.at(0,0)??0):t.value=h.SPILL}else t.value=e;this.inCycle.has(t)&&(s.clearSpill(t),t.value=h.CYCLE,t.array=void 0);const r=t.spill;(!J(o,t.array)||!Q(n,r))&&(n&&this.moved.push({sheet:s,area:n}),r&&this.moved.push({sheet:s,area:r}))}top(t){const e=this.flat(t);return e===null?0:e}flat(t){return t instanceof u?t.single?this.read(t.sheet,t.top,t.left):this.matrix(t):t instanceof b?h.VALUE:t instanceof M?h.CALC:t instanceof x?null:t}matrix(t){const e=t.bottom===k-1?Math.min(t.bottom,t.sheet.lastRow):t.bottom,s=t.right===E-1?Math.min(t.right,t.sheet.columnsUsed-1):t.right,n=Math.max(0,e-t.top+1),o=Math.max(0,s-t.left+1),r=new Array(n*o);for(let i=0;i<n;i++)for(let a=0;a<o;a++)r[i*o+a]=this.read(t.sheet,t.top+i,t.left+a);return new p(n,o,r)}each(t,e){const{sheet:s}=t,n=Math.min(t.right,s.columnsUsed-1);for(let o=t.left;o<=n;o++){const[r,i]=s.span(o,t.top,t.bottom);for(let a=r;a<=i;a++){const c=s.at(a,o);if(c===void 0){s.spillAt(a,o)&&e(this.read(s,a,o),a,o);continue}e(typeof c=="object"&&!(c instanceof m)?this.read(s,a,o):c,a,o)}}}evaluate(t,e){const{node:s}=t;return s?this.top(this.eval(s,{sheet:e,row:t.row,col:t.col,dr:0,dc:0})):h.NAME}evaluateAt(t,e,s,n){const{node:o}=t;return o?this.top(this.eval(o,{sheet:e,row:s,col:n,dr:s-t.row,dc:n-t.col})):h.NAME}bound(t,e,s){const n=t.abs?t.index:t.index+e;return n<0||n>=s?void 0:n}resolveRef(t,e){const s=t.sheet===void 0?e.sheet:this.wb.sheet(t.sheet);if(!s)return h.REF;let n=0,o=E-1,r=0,i=k-1;if(t.col){const a=this.bound(t.col,e.dc,E),c=this.bound(t.col2??t.col,e.dc,E);if(a===void 0||c===void 0)return h.REF;n=Math.min(a,c),o=Math.max(a,c)}if(t.row){const a=this.bound(t.row,e.dr,k),c=this.bound(t.row2??t.row,e.dr,k);if(a===void 0||c===void 0)return h.REF;r=Math.min(a,c),i=Math.max(a,c)}if(t.lastSheet!==void 0){const a=this.wb.sheet(t.lastSheet);if(!a)return h.REF;const[c,f]=[Math.min(s.index,a.index),Math.max(s.index,a.index)];return new b(this.wb.sheets.slice(c,f+1).map(d=>new u(d,r,n,i,o)))}return new u(s,r,n,i,o)}structured(t,e){const s=t.table===void 0?e.sheet.tableAt(e.row,e.col):this.wb.table(t.table);return s?et(s,t,e):t.table===void 0?h.REF:h.NAME}nameValue(t,e,s){const n=t.toLowerCase();if(s===void 0)for(let c=e.scope;c;c=c.parent){const f=c.names.get(n);if(f!==void 0)return f}const o=s===void 0?e.sheet:this.wb.sheet(s);if(!o)return h.REF;const r=this.wb.name(t,o);if(r){if(!r.formula)return r.value??null;const{node:c}=r.formula;if(!c)return h.NAME;if(this.namesAt.has(n))return h.CYCLE;this.namesAt.add(n);try{return this.eval(c,{sheet:e.sheet,row:0,col:0,dr:0,dc:0})}finally{this.namesAt.delete(n)}}const i=this.wb.table(t);if(i){const{top:c,left:f,bottom:d,right:g}=i.data;return new u(i.sheet,c,f,d,g)}const a=v.get(t.toUpperCase());return a&&a.kind!=="lazy"?st(a,t,e):h.NAME}intersect(t,e){return!(t instanceof u)||t.single?t:t.cols===1&&e.row>=t.top&&e.row<=t.bottom?new u(t.sheet,e.row,t.left,e.row,t.left):t.rows===1&&e.col>=t.left&&e.col<=t.right?new u(t.sheet,t.top,e.col,t.top,e.col):h.VALUE}unary(t,e){const s=this.flat(t);return s instanceof p?new p(s.rows,s.cols,s.data.map(e)):e(s)}operate(t,e,s){const n=this.flat(e),o=this.flat(s);if(n instanceof p||o instanceof p){const r=(i,a)=>S(t,i,a);return H(n instanceof p?n:new p(1,1,[n]),o instanceof p?o:new p(1,1,[o]),r)}return S(t,n,o)}rangeOf(t,e){return t instanceof m?t:e instanceof m?e:!(t instanceof u)||!(e instanceof u)||t.sheet!==e.sheet?h.REF:new u(t.sheet,Math.min(t.top,e.top),Math.min(t.left,e.left),Math.max(t.bottom,e.bottom),Math.max(t.right,e.right))}intersection(t,e){if(t instanceof m)return t;if(e instanceof m)return e;if(!(t instanceof u)||!(e instanceof u))return h.REF;const s=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.bottom,e.bottom),r=Math.min(t.right,e.right);return t.sheet!==e.sheet||s>o||n>r?h.NULL:new u(t.sheet,s,n,o,r)}union(t,e){if(t instanceof m)return t;if(e instanceof m)return e;const s=o=>o instanceof u?[o]:o instanceof b?o.parts:[],n=[...s(t),...s(e)];return n.length===0?h.VALUE:new b(n)}eval(t,e){switch(t.kind){case"number":case"string":case"boolean":return t.value;case"error":return m.of(t.code);case"missing":return F;case"ref":return this.resolveRef(t,e);case"structured":return this.structured(t,e);case"name":return this.nameValue(t.name,e,t.sheet);case"paren":return this.eval(t.arg,e);case"unary":{const s=this.eval(t.arg,e);return t.op==="@"?this.intersect(s,e):t.op==="+"?s:this.unary(s,n=>S("*",n,-1))}case"postfix":{const s=this.eval(t.arg,e);if(t.op==="%")return this.unary(s,n=>S("/",n,100));if(s instanceof u&&s.single){const n=s.sheet.at(s.top,s.left);if(n instanceof y){this.read(s.sheet,s.top,s.left);const{spill:o}=n;if(o)return new u(s.sheet,o.top,o.left,o.bottom,o.right);if(n.array)return s}}return h.REF}case"binary":{const s=this.eval(t.left,e),n=this.eval(t.right,e);return t.op===":"?this.rangeOf(s,n):t.op===" "?this.intersection(s,n):t.op===","?this.union(s,n):this.operate(t.op,s,n)}case"array":return new p(t.rows.length,t.rows[0]?.length??0,t.rows.flatMap(s=>s.map(n=>{const o=this.eval(n,e);return o instanceof p||o instanceof u||o instanceof b||o instanceof M||o instanceof x?h.VALUE:o})));case"invoke":{const s=this.eval(t.callee,e);return s instanceof M?this.invoke(s,t.args,e):s instanceof m?s:h.VALUE}case"call":return this.call(t.name,t.args,e)}}invoke(t,e,s){return this.apply(t,e.map(n=>this.eval(n,s)))}apply(t,e){if(t.named!==void 0){const n=v.get(t.named);return!n||n.kind==="lazy"?h.NAME:e.length<n.min||e.length>n.max?h.VALUE:this.applyFunction(n,e,t.frame)}if(e.length>t.params.length)return h.VALUE;const s=new Map;return t.params.forEach((n,o)=>{s.set(n,e[o]??F)}),this.eval(t.body,{...t.frame,scope:{names:s,...t.frame.scope?{parent:t.frame.scope}:{}}})}call(t,e,s){const n=v.get(t);if(!n){const o=this.nameValue(t,s);return o instanceof M?this.invoke(o,e,s):h.NAME}return e.length<n.min||e.length>n.max?h.VALUE:n.kind==="lazy"?n.call(e,{calc:this,frame:s}):this.applyFunction(n,e.map(o=>this.eval(o,s)),s)}applyFunction(t,e,s){const n={calc:this,frame:s};if(t.kind==="lazy")return h.VALUE;if(t.kind==="raw")return j(t.params,e.length)?this.over(e,r=>X(t.params,r)==="value",r=>t.call(r,n)):h.VALUE;const o=t.errors===!0;return this.over(e,()=>!0,r=>{const i=r.map(a=>a instanceof x?void 0:a);if(!o){for(const a of i)if(a instanceof m)return a}return t.call(...i)})}over(t,e,s){const n=[],o=new Map;for(const[f,d]of t.entries()){if(!e(f)||d instanceof x){n.push(d);continue}const g=this.flat(d);g instanceof p&&o.set(f,g),n.push(g)}if(o.size===0)return s(n);const r=[...o.values()],i=Math.max(...r.map(f=>f.rows)),a=Math.max(...r.map(f=>f.cols));if(i===0||a===0)return h.CALC;const c=new Array(i*a);for(let f=0;f<i;f++)for(let d=0;d<a;d++){const g=n.map((C,A)=>{const w=o.get(A);if(!w)return C;const L=w.rows===1?0:f,R=w.cols===1?0:d;return L<w.rows&&R<w.cols?w.at(L,R):h.NA});c[f*a+d]=this.element(s(g))}return new p(i,a,c)}element(t){const e=this.flat(t);return e instanceof p?e.rows>0&&e.cols>0?e.at(0,0):h.CALC:e}scalar(t,e){if(t instanceof x)return null;if(t instanceof u){const s=this.intersect(t,e);return s instanceof u?this.read(s.sheet,s.top,s.left):h.VALUE}return t instanceof p?t.at(0,0):t instanceof b||t instanceof M?h.VALUE:t}recalculate(){if(this.replica)return this;const t=this.allCells().filter(e=>this.analysisOf(e.shared).volatile);return this.mark(t),this}build(){if(this.graphMade)return;this.graphMade=!0;const t=this.allCells();for(const e of t)this.analysisOf(e.shared).volatile&&this.volatiles.add(e);this.graph.build(t)}addEdges(t){this.analysisOf(t.shared).volatile&&this.volatiles.add(t),this.graph.add(t)}removeEdges(t){this.volatiles.delete(t),this.graph.remove(t)}readersIn(t,e){return this.graph.readersIn(t,e)}readers(t,e,s){return this.build(),this.graph.readers(t,e,s)}precedents(t){return this.readsOf(t)}mark(t){this.build();const e=new Set(t),s=[...t];for(;;){const n=s.pop();if(!n)break;for(const o of this.readers(n.sheet,n.row,n.col))e.has(o)||(e.add(o),s.push(o))}this.settle(e)}settle(t){for(const e of t)e.state=1,this.inCycle.delete(e);this.cycles=this.cycles.filter(e=>!e.some(s=>t.has(s))),this.run([...t])}set(t,e,s,n){const o=typeof n=="string"&&n.length>1&&n.startsWith("=")?new y(new I(n,e,s,{file:""}),t,e,s):void 0;this.change([{sheet:t,row:e,col:s,slot:o??n??void 0}])}prepare(){this.build()}change(t){if(this.replica){for(const{sheet:o,row:r,col:i,slot:a}of t){const c=o.at(r,i);c instanceof y&&o.clearSpill(c),o.replace(r,i,a),a instanceof y&&(a.state=0)}return}this.build();const e=new Set,s=[...this.unsettled];this.unsettled.clear();const n=new Set;for(const{sheet:o,row:r,col:i,slot:a}of t){const c=o.at(r,i);c instanceof y&&(n.add(c),this.inCycle.delete(c),this.removeEdges(c),e.delete(c),c.spill&&this.moved.push({sheet:o,area:c.spill}),o.clearSpill(c));const f=o.spillAt(r,i);f&&s.push(f),s.push(...o.blockedBy({top:r,left:i,bottom:r,right:i})),o.replace(r,i,a),this.forget(o,{top:r,left:i,bottom:r,right:i}),a instanceof y&&(this.addEdges(a),e.add(a))}n.size>0&&(this.cycles=this.cycles.filter(o=>!o.some(r=>n.has(r))));for(const{sheet:o,row:r,col:i}of t)s.push(...this.readers(o,r,i));for(s.push(...this.volatiles);;){const o=s.pop();if(!o)break;e.has(o)||(e.add(o),s.push(...this.readers(o.sheet,o.row,o.col)))}this.settle(e)}setName(t,e){const s=this.wb.name(t);if(!s)throw new Error(`There is no name ${t}.`);s.value=e,delete s.formula;const n=t.toLowerCase();this.mark(this.allCells().filter(o=>this.analysisOf(o.shared).names.has(n)))}takeComputed(){const t=[];for(const e of this.settled)t.push({sheet:e.sheet.index,row:e.row,col:e.col,value:P(e.value),...e.array?{array:W(e.array)}:{},...e.spill?{spill:e.spill}:{},...e.blocked?{blocked:e.blocked}:{}});return this.settled.clear(),{cells:t,cycles:this.cycles.map(e=>e.map(s=>({sheet:s.sheet.index,row:s.row,col:s.col}))),hidden:[...this.hiddenBy].map(([e,s])=>({sheet:e.index,rows:[...s]}))}}receive(t){for(const s of t.cells){const n=this.wb.sheets[s.sheet],o=n?.at(s.row,s.col);!n||!(o instanceof y)||(n.clearSpill(o),o.value=G(s.value),o.array=s.array?D(s.array):void 0,s.spill&&n.placeSpill(o,s.spill),s.blocked&&n.blockSpill(o,s.blocked),o.state=0)}this.cycles=t.cycles.flatMap(s=>{const n=s.flatMap(o=>{const r=this.wb.sheets[o.sheet]?.at(o.row,o.col);return r instanceof y?[r]:[]});return n.length>0?[n]:[]});const e=new Map(this.hiddenBy);this.hiddenBy.clear();for(const{sheet:s,rows:n}of t.hidden){const o=this.wb.sheets[s];if(!o)continue;const r=e.get(o),i=r?.size===n.length&&n.every(a=>r.has(a));this.hiddenBy.set(o,i?r:new Set(n))}for(const s of this.wb.sheets)s.tighten()}numberOf(t){return q(t)}}const Q=(l,t)=>l?.top===t?.top&&l?.left===t?.left&&l?.bottom===t?.bottom&&l?.right===t?.right;function tt(l){return l.data.some(t=>t===null)?new p(l.rows,l.cols,l.data.map(t=>t??0)):l}function V(l){return{sheet:l.sheet,row:l.row,col:l.col,dr:l.row-l.shared.row,dc:l.col-l.shared.col}}function et(l,t,e){const{sheet:s}=l,n=l.area;let o=n.left,r=n.right;const[i,a]=t.columns;if(i!==void 0){const A=l.column(i),w=a===void 0?A:l.column(a);if(!A||!w)return h.REF;o=n.left+Math.min(A.index,w.index),r=n.left+Math.max(A.index,w.index)}if(t.thisRow)return e.sheet!==s||e.row<=n.top||e.row>n.bottom?h.VALUE:new u(s,e.row,o,e.row,r);const c=t.sections;if(c.includes("#Totals"))return h.REF;const f=c.includes("#All")||c.includes("#Headers"),d=c.length===0||c.includes("#All")||c.includes("#Data"),g=f?n.top:n.top+1,C=d?n.bottom:n.top;return new u(s,g,o,C,r)}function st(l,t,e){return new M([],{kind:"call",name:l.name,written:t,args:[]},e,l.name)}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{MAX_ROWS as b}from"../../address.js";import{CellError as s,ERR as m,Matrix as g}from"../../values.js";import{FormulaCell as D}from"../../workbook.js";import{finite as E,snap as w}from"../coerce.js";import{Reference as R,Union as y}from"../types.js";import{FUNCTIONS as I,cellsOf as P,eachArg as O,many as c,numbersOf as h,numbersOfA as M,raw as i}from"./define.js";function V(n){let t=0;for(const e of n)t=w(t+e,t,e);return t}i("SUM",1,c,(n,t)=>{let e=0,o;return O(n,t,(f,l)=>{if(!o){if(typeof f=="number")e=w(e+f,e,f);else if(f instanceof s)o=f;else if(l){const a=h([f],t);a instanceof s?o=a:e+=a[0]??0}}}),o??E(e)}),i("AVERAGE",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?m.DIV0:V(e)/e.length}),i("AVERAGEA",1,c,(n,t)=>{const e=M(n,t);return e instanceof s?e:e.length===0?m.DIV0:V(e)/e.length}),i("COUNT",1,c,(n,t)=>{let e=0;return O(n,t,(o,f)=>{typeof o=="number"?e+=1:f&&!(o instanceof s)&&o!==null&&(h([o],t)instanceof s||(e+=1))}),e}),i("COUNTA",1,c,(n,t)=>{let e=0;return O(n,t,()=>{e+=1}),e}),i("COUNTBLANK",1,1,(n,t)=>{const e=n[0];if(e instanceof s)return e;if(e instanceof R){let f=0;return t.calc.each(e,l=>{l!==""&&(f+=1)}),e.rows*e.cols-f}const o=t.calc.flat(e);return o instanceof g?o.data.filter(f=>f===null||f==="").length:o===null||o===""?1:0});const C=n=>t=>{if(t instanceof s)return t;if(t.length===0)return 0;let e=t[0]??0;for(const o of t)e=n(e,o);return e},N=C((n,t)=>t<n?t:n),L=C((n,t)=>t>n?t:n);i("MIN",1,c,(n,t)=>N(h(n,t))),i("MAX",1,c,(n,t)=>L(h(n,t))),i("MINA",1,c,(n,t)=>N(M(n,t))),i("MAXA",1,c,(n,t)=>L(M(n,t))),i("PRODUCT",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?0:E(e.reduce((o,f)=>o*f,1))}),i("SUMSQ",1,c,(n,t)=>{const e=h(n,t);return e instanceof s?e:E(V(e.map(o=>o*o)))}),i("SUMPRODUCT",1,c,(n,t)=>{const e=n.map(r=>P(r,t)),o=e[0];if(o===void 0||o instanceof s)return o??m.VALUE;let{rows:f}=o;const{cols:l}=o,a=r=>r.reference&&r.reference.bottom<b-1?r.reference.rows:r.rows;for(const r of e){if(r instanceof s)return r;if(r.cols!==l||a(r)!==a(o))return m.VALUE;f=Math.min(f,r.rows)}let d=0;for(let r=0;r<f;r++)for(let U=0;U<l;U++){let T=1;for(const p of e){const A=p.at(r,U);if(A instanceof s)return A;T*=typeof A=="number"?A:0}d+=T}return E(d)});const k={1:"AVERAGE",2:"COUNT",3:"COUNTA",4:"MAX",5:"MIN",6:"PRODUCT",7:"STDEV.S",8:"STDEV.P",9:"SUM",10:"VAR.S",11:"VAR.P"};function B(n){if(!(n instanceof D))return!1;const{node:t}=n.shared;return t?.kind==="call"&&t.name==="SUBTOTAL"}i("SUBTOTAL",2,c,(n,t)=>{const e=t.calc.scalar(n[0],t.frame);if(e instanceof s)return e;if(typeof e!="number")return m.VALUE;const o=e<100,f=k[o?e:e-100],l=f===void 0?void 0:I.get(f);if(l?.kind!=="raw")return m.VALUE;const a=[],d=r=>{const U=u=>r.sheet.spec.rows?.[String(u+1)]?.hidden===!0,T=Math.min(r.bottom,r.sheet.lastRow),p=[],A=t.calc.filtered(r.sheet);for(let u=r.top;u<=T;u++)if(!A.has(u)&&!(!o&&U(u)))for(let S=r.left;S<=r.right;S++)p.push(B(r.sheet.at(u,S))?null:t.calc.read(r.sheet,u,S));a.push(new g(p.length,1,p))};for(const r of n.slice(1)){if(r instanceof s)return r;if(r instanceof R)d(r);else if(r instanceof y)r.parts.forEach(d);else return m.VALUE}return l.call(a,t)});
2
+ import{MAX_ROWS as L}from"../../address.js";import{CellError as s,ERR as u,Matrix as V}from"../../values.js";import{FormulaCell as b}from"../../workbook.js";import{finite as S,snap as g}from"../coerce.js";import{Reference as w,Union as D}from"../types.js";import{FUNCTIONS as I,cellsOf as y,eachArg as E,numbersOf as h,numbersOfA as O,raw as i}from"./define.js";function M(n){let t=0;for(const e of n)t=g(t+e,t,e);return t}i("SUM","(r)",(n,t)=>{let e=0,o;return E(n,t,(f,c)=>{if(!o){if(typeof f=="number")e=g(e+f,e,f);else if(f instanceof s)o=f;else if(c){const l=h([f],t);l instanceof s?o=l:e+=l[0]??0}}}),o??S(e)}),i("AVERAGE","(r)",(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?u.DIV0:M(e)/e.length}),i("AVERAGEA","(r)",(n,t)=>{const e=O(n,t);return e instanceof s?e:e.length===0?u.DIV0:M(e)/e.length}),i("COUNT","(r)",(n,t)=>{let e=0;return E(n,t,(o,f)=>{typeof o=="number"?e+=1:f&&!(o instanceof s)&&o!==null&&(h([o],t)instanceof s||(e+=1))}),e}),i("COUNTA","(r)",(n,t)=>{let e=0;return E(n,t,()=>{e+=1}),e}),i("COUNTBLANK","r",(n,t)=>{const e=n[0];if(e instanceof s)return e;if(e instanceof w){let f=0;return t.calc.each(e,c=>{c!==""&&(f+=1)}),e.rows*e.cols-f}const o=t.calc.flat(e);return o instanceof V?o.data.filter(f=>f===null||f==="").length:o===null||o===""?1:0});const R=n=>t=>{if(t instanceof s)return t;if(t.length===0)return 0;let e=t[0]??0;for(const o of t)e=n(e,o);return e},C=R((n,t)=>t<n?t:n),N=R((n,t)=>t>n?t:n);i("MIN","(r)",(n,t)=>C(h(n,t))),i("MAX","(r)",(n,t)=>N(h(n,t))),i("MINA","(r)",(n,t)=>C(O(n,t))),i("MAXA","(r)",(n,t)=>N(O(n,t))),i("PRODUCT","(r)",(n,t)=>{const e=h(n,t);return e instanceof s?e:e.length===0?0:S(e.reduce((o,f)=>o*f,1))}),i("SUMSQ","(r)",(n,t)=>{const e=h(n,t);return e instanceof s?e:S(M(e.map(o=>o*o)))}),i("SUMPRODUCT","(r)",(n,t)=>{const e=n.map(r=>y(r,t)),o=e[0];if(o===void 0||o instanceof s)return o??u.VALUE;let{rows:f}=o;const{cols:c}=o,l=r=>r.reference&&r.reference.bottom<L-1?r.reference.rows:r.rows;for(const r of e){if(r instanceof s)return r;if(r.cols!==c||l(r)!==l(o))return u.VALUE;f=Math.min(f,r.rows)}let A=0;for(let r=0;r<f;r++)for(let d=0;d<c;d++){let p=1;for(const U of e){const m=U.at(r,d);if(m instanceof s)return m;p*=typeof m=="number"?m:0}A+=p}return S(A)});const P={1:"AVERAGE",2:"COUNT",3:"COUNTA",4:"MAX",5:"MIN",6:"PRODUCT",7:"STDEV.S",8:"STDEV.P",9:"SUM",10:"VAR.S",11:"VAR.P"};function k(n){if(!(n instanceof b))return!1;const{node:t}=n.shared;return t?.kind==="call"&&t.name==="SUBTOTAL"}i("SUBTOTAL","v(r)",(n,t)=>{const e=t.calc.scalar(n[0],t.frame);if(e instanceof s)return e;if(typeof e!="number")return u.VALUE;const o=e<100,f=P[o?e:e-100],c=f===void 0?void 0:I.get(f);if(c?.kind!=="raw")return u.VALUE;const l=[],A=r=>{const d=a=>r.sheet.spec.rows?.[String(a+1)]?.hidden===!0,p=Math.min(r.bottom,r.sheet.lastRow),U=[],m=t.calc.filtered(r.sheet);for(let a=r.top;a<=p;a++)if(!m.has(a)&&!(!o&&d(a)))for(let T=r.left;T<=r.right;T++)U.push(k(r.sheet.at(a,T))?null:t.calc.read(r.sheet,a,T));l.push(new V(U.length,1,U))};for(const r of n.slice(1)){if(r instanceof s)return r;if(r instanceof w)A(r);else if(r instanceof D)r.parts.forEach(A);else return u.VALUE}return c.call(l,t)});
@@ -0,0 +1,4 @@
1
+ import { CellError } from "../../values.js";
2
+ /** A number from one unit to another; #N/A for an unknown unit or two of different quantities. */
3
+ export declare function convert(value: number, from: string, to: string): number | CellError;
4
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{CellError as b,ERR as l}from"../../values.js";import{toNumber as I,toText as v}from"../coerce.js";import{scalar as w}from"./define.js";const u=.0254,s=12*u,d=3*s,_=5280*s,g=1852,h=9460730472580800,k=u/72,f=453.59237,E=9.80665,P=f/1e3*E,K=s*P,q=231*u**3/128,R=.00454609,T=101325,O=550*K,N=new Map;function t(a,i){for(const o of a)N.set(o,i)}const e=(a,i)=>({quantity:a,factor:i,prefix:1});t(["g"],e("mass",1)),t(["sg"],{quantity:"mass",factor:P*1e3/s}),t(["lbm"],{quantity:"mass",factor:f}),t(["u"],e("mass",1660538782e-33)),t(["ozm"],{quantity:"mass",factor:f/16}),t(["grain"],{quantity:"mass",factor:f/7e3}),t(["cwt","shweight"],{quantity:"mass",factor:100*f}),t(["uk_cwt","lcwt","hweight"],{quantity:"mass",factor:112*f}),t(["stone"],{quantity:"mass",factor:14*f}),t(["ton"],{quantity:"mass",factor:2e3*f}),t(["uk_ton","LTON","brton"],{quantity:"mass",factor:2240*f}),t(["m"],e("distance",1)),t(["mi"],{quantity:"distance",factor:_}),t(["Nmi"],{quantity:"distance",factor:g}),t(["in"],{quantity:"distance",factor:u}),t(["ft"],{quantity:"distance",factor:s}),t(["yd"],{quantity:"distance",factor:d}),t(["ang"],e("distance",1e-10)),t(["ell"],{quantity:"distance",factor:45*u}),t(["ly"],e("distance",h)),t(["parsec","pc"],e("distance",648e3/Math.PI*149597870700)),t(["Picapt","Pica"],{quantity:"distance",factor:k}),t(["pica"],{quantity:"distance",factor:u/6}),t(["survey_mi"],{quantity:"distance",factor:6336e3/3937}),t(["yr"],{quantity:"time",factor:365.25*86400}),t(["day","d"],{quantity:"time",factor:86400}),t(["hr"],{quantity:"time",factor:3600}),t(["mn","min"],{quantity:"time",factor:60}),t(["sec","s"],e("time",1)),t(["Pa","p"],e("pressure",1)),t(["atm","at"],e("pressure",T)),t(["mmHg"],e("pressure",T/760)),t(["psi"],{quantity:"pressure",factor:P/u**2}),t(["Torr"],{quantity:"pressure",factor:T/760}),t(["N"],e("force",1)),t(["dyn","dy"],e("force",1e-5)),t(["lbf"],{quantity:"force",factor:P}),t(["pond"],e("force",E/1e3)),t(["J"],e("energy",1)),t(["e"],e("energy",1e-7)),t(["c"],e("energy",4.184)),t(["cal"],e("energy",4.1868)),t(["eV","ev"],e("energy",1602176487e-28)),t(["HPh","hh"],{quantity:"energy",factor:O*3600}),t(["Wh","wh"],e("energy",3600)),t(["flb"],{quantity:"energy",factor:K}),t(["BTU","btu"],{quantity:"energy",factor:1055.05585262}),t(["HP","h"],{quantity:"power",factor:O}),t(["PS"],{quantity:"power",factor:75*E}),t(["W","w"],e("power",1)),t(["T"],e("magnetism",1)),t(["ga"],e("magnetism",1e-4));const y=(a,i,o=!1)=>{t(a,{quantity:"volume",factor:i**3,...o?{prefix:3}:{}})};t(["tsp"],{quantity:"volume",factor:q/6}),t(["tspm"],{quantity:"volume",factor:5e-6}),t(["tbs"],{quantity:"volume",factor:q/2}),t(["oz"],{quantity:"volume",factor:q}),t(["cup"],{quantity:"volume",factor:8*q}),t(["pt","us_pt"],{quantity:"volume",factor:16*q}),t(["uk_pt"],{quantity:"volume",factor:R/8}),t(["qt"],{quantity:"volume",factor:32*q}),t(["uk_qt"],{quantity:"volume",factor:R/4}),t(["gal"],{quantity:"volume",factor:128*q}),t(["uk_gal"],{quantity:"volume",factor:R}),t(["l","L","lt"],e("volume",.001)),t(["barrel"],{quantity:"volume",factor:5376*q}),t(["bushel"],{quantity:"volume",factor:2150.42*u**3}),t(["GRT","regton"],{quantity:"volume",factor:100*s**3}),t(["MTON"],{quantity:"volume",factor:40*s**3}),y(["m3","m^3"],1,!0),y(["ang3","ang^3"],1e-10,!0),y(["ft3","ft^3"],s),y(["in3","in^3"],u),y(["ly3","ly^3"],h),y(["mi3","mi^3"],_),y(["yd3","yd^3"],d),y(["Nmi3","Nmi^3"],g),y(["Pica3","Picapt3","Pica^3","Picapt^3"],k);const m=(a,i,o=!1)=>{t(a,{quantity:"area",factor:i**2,...o?{prefix:2}:{}})};t(["uk_acre"],{quantity:"area",factor:4840*d**2}),t(["us_acre"],{quantity:"area",factor:43560*(1200/3937)**2}),t(["ar"],e("area",100)),t(["ha"],{quantity:"area",factor:1e4}),t(["Morgen"],{quantity:"area",factor:2500}),m(["m2","m^2"],1,!0),m(["ang2","ang^2"],1e-10,!0),m(["ft2","ft^2"],s),m(["in2","in^2"],u),m(["ly2","ly^2"],h),m(["mi2","mi^2"],_),m(["yd2","yd^2"],d),m(["Nmi2","Nmi^2"],g),m(["Pica2","Picapt2","Pica^2","Picapt^2"],k),t(["bit"],{quantity:"information",factor:1,prefix:1,binary:!0}),t(["byte"],{quantity:"information",factor:8,prefix:1,binary:!0}),t(["admkn"],{quantity:"speed",factor:6080*s/3600}),t(["kn"],{quantity:"speed",factor:g/3600}),t(["m/h","m/hr"],e("speed",1/3600)),t(["m/s","m/sec"],e("speed",1)),t(["mph"],{quantity:"speed",factor:_/3600});const U={Y:1e24,Z:1e21,E:1e18,P:1e15,T:1e12,G:1e9,M:1e6,k:1e3,h:100,da:10,e:10,d:.1,c:.01,m:.001,u:1e-6,n:1e-9,p:1e-12,f:1e-15,a:1e-18,z:1e-21,y:1e-24},L={Yi:2**80,Zi:2**70,Ei:2**60,Pi:2**50,Ti:2**40,Gi:2**30,Mi:2**20,ki:2**10},A={C:{toK:a=>a+273.15,fromK:a=>a-273.15},F:{toK:a=>(a-32)*5/9+273.15,fromK:a=>(a-273.15)*9/5+32},K:{toK:a=>a,fromK:a=>a},Rank:{toK:a=>a*5/9,fromK:a=>a*9/5},Reau:{toK:a=>a*5/4+273.15,fromK:a=>(a-273.15)*4/5}},M={C:"C",cel:"C",F:"F",fah:"F",K:"K",kel:"K",Rank:"Rank",Reau:"Reau"};function C(a){const i=M[a];if(i!==void 0)return{kind:"temperature",scale:i,times:1};const o=N.get(a);if(o)return{kind:"unit",quantity:o.quantity,factor:o.factor};for(const[n,r]of Object.entries(U)){if(!a.startsWith(n))continue;const c=a.slice(n.length);if(M[c]==="K")return{kind:"temperature",scale:"K",times:r};const p=N.get(c);if(p?.prefix!==void 0)return{kind:"unit",quantity:p.quantity,factor:p.factor*r**p.prefix}}for(const[n,r]of Object.entries(L)){if(!a.startsWith(n))continue;const c=N.get(a.slice(n.length));if(c?.binary===!0)return{kind:"unit",quantity:c.quantity,factor:c.factor*r}}}export function convert(a,i,o){const n=C(i),r=C(o);if(!n||!r)return l.NA;if(n.kind==="temperature"||r.kind==="temperature"){if(n.kind!=="temperature"||r.kind!=="temperature")return l.NA;const c=A[n.scale],p=A[r.scale];return!c||!p?l.NA:p.fromK(c.toK(a*n.times))/r.times}return n.quantity!==r.quantity?l.NA:a*n.factor/r.factor}w("CONVERT",3,3,(a,i,o)=>{const n=I(a),r=v(i),c=v(o);return n instanceof b?n:r instanceof b?r:c instanceof b?c:convert(n,r,c)});
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as d,ERR as g,Matrix as U}from"../../values.js";import{compare as W,numberOfText as A,sameNumber as N}from"../coerce.js";import{Reference as R}from"../types.js";import{cellsOf as h,many as w,raw as p}from"./define.js";export function indexKey(e){if(typeof e=="number")return`n${String(Number(e.toPrecision(15)))}`;if(typeof e=="string")return`t${e.toUpperCase()}`;if(typeof e=="boolean")return e?"bT":"bF"}export function wildcard(e){let n="";for(let t=0;t<e.length;t++){const s=e.charAt(t);s==="~"&&/[*?~]/u.test(e.charAt(t+1))?(t+=1,n+=e.charAt(t).replace(/[*?]/u,"\\$&")):s==="*"?n+="[\\s\\S]*":s==="?"?n+="[\\s\\S]":n+=s.replace(/[.+^${}()|[\]\\/-]/gu,"\\$&")}const r=new RegExp(`^${n}$`,"iu");return t=>r.test(t)}export const hasWildcard=e=>/[*?~]/u.test(e);function b(e){return n=>{if(typeof n=="number")return N(n,e);if(typeof n!="string")return!1;const r=A(n);return r!==void 0&&N(r,e)}}function q(e,n){const r=t=>e===">"?t>0:e===">="?t>=0:e==="<"?t<0:t<=0;return t=>typeof t==typeof n&&r(W(t,n))}export function criterion(e){if(e===null)return{test:b(0),key:"n0"};if(typeof e=="number")return{test:b(e),key:`n${String(Number(e.toPrecision(15)))}`};if(typeof e=="boolean")return{test:o=>o===e,key:e?"bT":"bF"};if(e instanceof d)return{test:o=>o===e};const n=/^(<>|>=|<=|=|>|<)/u.exec(e),r=n?.[1]??"=",t=n?e.slice(r.length):e,s=o=>o===null;if(t==="")return r==="="?{test:n?s:o=>o===null||o===""}:r==="<>"?{test:o=>o!==null}:{test:()=>!1};const c=A(t),f=/^(?:TRUE|FALSE)$/iu.test(t)?t.toUpperCase()==="TRUE":void 0,l=c??f;if(r==="="||r==="<>"){let o,i;if(c!==void 0)o=b(c),i=indexKey(c);else if(f!==void 0)o=u=>u===f,i=indexKey(f);else if(t.startsWith("#"))o=u=>u instanceof d&&u.code===t.toUpperCase();else if(hasWildcard(t)){const u=wildcard(t);o=a=>typeof a=="string"&&u(a)}else{const u=t.toUpperCase();o=a=>typeof a=="string"&&a.toUpperCase()===u,i=indexKey(t)}return r==="="?i===void 0?{test:o}:{test:o,key:i}:{test:u=>!o(u)}}return{test:q(r,l??t)}}function D(e,n){const r=e.reference;if(r?.cols!==1||e.rows<64)return;const t=`crit:${r.key}`,s=n.calc.indexes.get(t);if(s)return s;const c=new Map;for(let f=0;f<e.rows;f++){const l=e.at(f,0),o=i=>{if(i===void 0)return;const u=c.get(i);u?u.push(f):c.set(i,[f])};if(o(indexKey(l)),typeof l=="string"){const i=A(l);i!==void 0&&o(indexKey(i))}}return n.calc.indexes.set(t,c),c}function I(e,n){const r=n.calc.scalar(e,n.frame);return criterion(r)}function T(e,n){const r=[];for(let s=0;s+1<e.length;s+=2){const c=h(e[s],n);if(c instanceof d)return c;const f=I(e[s+1],n);if(f instanceof d)return f;r.push({cells:c,crit:f})}const t=r[0]?.cells;return t&&r.some(s=>!V(s.cells,t))?g.VALUE:r}const V=(e,n)=>e.cols===n.cols&&(e.reference?.rows??e.rows)===(n.reference?.rows??n.rows);function F(e,n,r){const t=e[0];if(!t)return;const s=e.slice(1),c=(o,i)=>s.every(u=>u.crit.test(u.cells.at(o,i))),f=t.crit.key===void 0?void 0:D(t.cells,n);if(f&&t.crit.key!==void 0){for(const o of f.get(t.crit.key)??[])c(o,0)&&r(o,0);return}const l=Math.max(...e.map(o=>o.cells.rows));for(let o=0;o<l;o++)for(let i=0;i<t.cells.cols;i++)t.crit.test(t.cells.at(o,i))&&c(o,i)&&r(o,i)}function K(e,n){return e instanceof R?(e.rows-n.rows)*e.cols:0}function O(e,n,r,t){let s;return F(n,r,(c,f)=>{if(s)return;const l=e.at(c,f);l instanceof d?s=l:typeof l=="number"&&t(l)}),s}function X(e,n){const r=h(e[0],n);if(r instanceof d)return r;const t=e[2];return t===void 0?r:h(t,n)}const L=e=>(n,r)=>{const t=h(n[0],r);if(t instanceof d)return t;const s=I(n[1],r);if(s instanceof d)return s;const c=X(n,r);if(c instanceof d)return c;const f=[];return O(c,[{cells:t,crit:s}],r,o=>{f.push(o)})??e(f)},x=e=>(n,r)=>{if(n.length%2===0)return g.VALUE;const t=h(n[0],r);if(t instanceof d)return t;const s=T(n.slice(1),r);if(s instanceof d)return s;const c=s[0]?.cells;if(c&&!V(t,c))return g.VALUE;const f=[];return O(t,s,r,o=>{f.push(o)})??e(f)},m=(e,n)=>(r,t)=>{const s=new Map;for(const[i,u]of r.entries()){if(!e(i)||!(u instanceof U||u instanceof R&&!u.single))continue;const a=h(u,t);if(a instanceof d)return a;s.set(i,a)}if(s.size===0)return n(r,t);const c=[...s.values()],f=Math.max(...c.map(i=>i.rows)),l=Math.max(...c.map(i=>i.cols)),o=[];for(let i=0;i<f;i++)for(let u=0;u<l;u++){const a=r.map((G,P)=>{const y=s.get(P);if(!y)return G;const $=y.rows===1?0:i,C=y.cols===1?0:u;return $<y.rows&&C<y.cols?y.at($,C):g.NA}),S=n(a,t);o.push(S instanceof U?S.at(0,0):S)}return new U(f,l,o)},k=e=>e===1,E=e=>e>=2&&e%2===0,j=e=>e%2===1,M=e=>e.reduce((n,r)=>n+r,0),z=e=>e.length===0?g.DIV0:M(e)/e.length,B=e=>e.length===0?0:e.reduce((n,r)=>r<n?r:n),H=e=>e.length===0?0:e.reduce((n,r)=>r>n?r:n);p("SUMIF",2,3,m(k,L(M))),p("AVERAGEIF",2,3,m(k,L(z))),p("SUMIFS",3,w,m(E,x(M))),p("AVERAGEIFS",3,w,m(E,x(z))),p("MINIFS",3,w,m(E,x(B))),p("MAXIFS",3,w,m(E,x(H))),p("COUNTIF",2,2,m(k,(e,n)=>{const r=h(e[0],n);if(r instanceof d)return r;const t=I(e[1],n);if(t instanceof d)return t;let s=0;return F([{cells:r,crit:t}],n,()=>{s+=1}),s+(t.test(null)?K(e[0],r):0)})),p("COUNTIFS",2,w,m(j,(e,n)=>{if(e.length%2===1)return g.VALUE;const r=T(e,n);if(r instanceof d)return r;let t=0;return F(r,n,()=>{t+=1}),t}));
2
+ import{CellError as l,ERR as I}from"../../values.js";import{compare as R,numberOfText as S,sameNumber as b}from"../coerce.js";import{Missing as T,Reference as A}from"../types.js";import{indexKeyOf as k}from"../indexes.js";import{cellsOf as h,raw as p}from"./define.js";export function indexKey(e){if(typeof e=="number")return`n${String(Number(e.toPrecision(15)))}`;if(typeof e=="string")return`t${e.toUpperCase()}`;if(typeof e=="boolean")return e?"bT":"bF"}export function wildcard(e){let r="";for(let t=0;t<e.length;t++){const o=e.charAt(t);o==="~"&&/[*?~]/u.test(e.charAt(t+1))?(t+=1,r+=e.charAt(t).replace(/[*?]/u,"\\$&")):o==="*"?r+="[\\s\\S]*":o==="?"?r+="[\\s\\S]":r+=o.replace(/[.+^${}()|[\]\\/-]/gu,"\\$&")}const n=new RegExp(`^${r}$`,"iu");return t=>n.test(t)}export const hasWildcard=e=>/[*?~]/u.test(e);function g(e){return r=>{if(typeof r=="number")return b(r,e);if(typeof r!="string")return!1;const n=S(r);return n!==void 0&&b(n,e)}}function w(e,r){const n=t=>e===">"?t>0:e===">="?t>=0:e==="<"?t<0:t<=0;return t=>typeof t==typeof r&&n(R(t,r))}export function criterion(e){if(e===null)return{test:g(0),key:"n0"};if(typeof e=="number")return{test:g(e),key:`n${String(Number(e.toPrecision(15)))}`};if(typeof e=="boolean")return{test:s=>s===e,key:e?"bT":"bF"};if(e instanceof l)return{test:s=>s===e};const r=/^(<>|>=|<=|=|>|<)/u.exec(e),n=r?.[1]??"=",t=r?e.slice(n.length):e,o=s=>s===null;if(t==="")return n==="="?{test:r?o:s=>s===null||s===""}:n==="<>"?{test:s=>s!==null}:{test:()=>!1};const i=S(t),c=/^(?:TRUE|FALSE)$/iu.test(t)?t.toUpperCase()==="TRUE":void 0,f=i??c;if(n==="="||n==="<>"){let s,u;if(i!==void 0)s=g(i),u=indexKey(i);else if(c!==void 0)s=d=>d===c,u=indexKey(c);else if(t.startsWith("#"))s=d=>d instanceof l&&d.code===t.toUpperCase();else if(hasWildcard(t)){const d=wildcard(t);s=m=>typeof m=="string"&&d(m)}else{const d=t.toUpperCase();s=m=>typeof m=="string"&&m.toUpperCase()===d,u=indexKey(t)}return n==="="?u===void 0?{test:s}:{test:s,key:u}:{test:d=>!s(d)}}return{test:w(n,f??t)}}function O(e,r){const n=e.reference;if(!(n?.cols!==1||e.rows<64))return r.calc.indexes.of(k("crit",n),[n],()=>{const t=new Map,o=(i,c)=>{if(i===void 0)return;const f=t.get(i);f?f.push(c):t.set(i,[c])};for(let i=0;i<e.rows;i++){const c=e.at(i,0);if(o(indexKey(c),i),typeof c=="string"){const f=S(c);f!==void 0&&o(indexKey(f),i)}}return t})}function F(e,r){const n=r.calc.scalar(e,r.frame);return criterion(n)}function $(e,r){const n=[];for(let o=0;o+1<e.length;o+=2){const i=h(e[o],r);if(i instanceof l)return i;const c=F(e[o+1],r);if(c instanceof l)return c;n.push({cells:i,crit:c})}const t=n[0]?.cells;return t&&n.some(o=>!x(o.cells,t))?I.VALUE:n}const x=(e,r)=>e.cols===r.cols&&(e.reference?.rows??e.rows)===(r.reference?.rows??r.rows);function E(e,r,n){const t=e[0];if(!t)return;let o,i;for(const f of e){if(f.crit.key===void 0)continue;const s=O(f.cells,r);if(!s)continue;const u=s.get(f.crit.key)??[];(o===void 0||u.length<o.length)&&(o=u,i=f)}if(o!==void 0){const f=e.filter(s=>s!==i);for(const s of o)f.every(u=>u.crit.test(u.cells.at(s,0)))&&n(s,0);return}const c=Math.max(...e.map(f=>f.cells.rows));for(let f=0;f<c;f++)for(let s=0;s<t.cells.cols;s++)e.every(u=>u.crit.test(u.cells.at(f,s)))&&n(f,s)}function V(e,r){return e instanceof A?(e.rows-r.rows)*e.cols:0}function M(e,r,n,t){let o;return E(r,n,(i,c)=>{if(o)return;const f=e.at(i,c);f instanceof l?o=f:typeof f=="number"&&t(f)}),o}function G(e,r){const n=h(e[0],r);if(n instanceof l)return n;const t=e[2];return t===void 0?n:h(t,r)}const C=e=>(r,n)=>{const t=h(r[0],n);if(t instanceof l)return t;const o=F(r[1],n);if(o instanceof l)return o;const i=G(r,n);if(i instanceof l)return i;const c=[];return M(i,[{cells:t,crit:o}],n,s=>{c.push(s)})??e(c)},y=e=>(r,n)=>{const t=h(r[0],n);if(t instanceof l)return t;const o=$(r.slice(1),n);if(o instanceof l)return o;const i=o[0]?.cells;if(i&&!x(t,i))return I.VALUE;const c=[];return M(t,o,n,s=>{c.push(s)})??e(c)},a=(e,r)=>(n,t)=>{const o=[],i=[e];for(const u of n)if(u instanceof A)o.push(u),i.push(`r${u.key}`);else if(u instanceof T)i.push("-");else if(u instanceof l)i.push(`e${u.code}`);else if(u===null||typeof u!="object")i.push(`${typeof u}:${String(u)}`);else return r(n,t);if(o.length===0)return r(n,t);const c=i.join("\0"),f=t.calc.results.get(c);if(f!==void 0)return f;const s=r(n,t);return(s===null||typeof s!="object"||s instanceof l)&&t.calc.results.set(c,o,s),s},U=e=>e.reduce((r,n)=>r+n,0),N=e=>e.length===0?I.DIV0:U(e)/e.length,j=e=>e.length===0?0:e.reduce((r,n)=>n<r?n:r),v=e=>e.length===0?0:e.reduce((r,n)=>n>r?n:r);p("SUMIF","rv?r",a("SUMIF",C(U))),p("AVERAGEIF","rv?r",a("AVERAGEIF",C(N))),p("SUMIFS","r(rv)",a("SUMIFS",y(U))),p("AVERAGEIFS","r(rv)",a("AVERAGEIFS",y(N))),p("MINIFS","r(rv)",a("MINIFS",y(j))),p("MAXIFS","r(rv)",a("MAXIFS",y(v))),p("COUNTIF","rv",a("COUNTIF",(e,r)=>{const n=h(e[0],r);if(n instanceof l)return n;const t=F(e[1],r);if(t instanceof l)return t;let o=0;return E([{cells:n,crit:t}],r,()=>{o+=1}),o+(t.test(null)?V(e[0],n):0)})),p("COUNTIFS","(rv)",a("COUNTIFS",(e,r)=>{const n=$(e,r);if(n instanceof l)return n;let t=0;return E(n,r,()=>{t+=1}),t}));
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as s,ERR as c}from"../../values.js";import{compare as U,toText as E}from"../coerce.js";import{FUNCTIONS as p,cellsOf as h,raw as u}from"./define.js";import{criterion as T}from"./criteria.js";function w(n,e){const t=[];for(let o=0;o<n.cols;o++){const f=E(n.at(0,o));if(f instanceof s)return f;t.push(f.toLowerCase())}const r=[];for(let o=1;o<n.rows;o++){let f=e.rows<2;for(let i=1;i<e.rows&&!f;i++){let l=!0;for(let m=0;m<e.cols&&l;m++){const D=e.at(i,m);if(D===null||D==="")continue;const d=E(e.at(0,m));if(d instanceof s)return d;const V=t.indexOf(d.toLowerCase());if(V<0){l=!1;continue}const A=T(D);if(A instanceof s)return A;A.test(n.at(o,V))||(l=!1)}l&&(f=!0)}f&&r.push(o)}return r}function R(n,e){if(typeof e=="number"){const r=Math.trunc(e)-1;return r<0||r>=n.cols?c.VALUE:r}const t=E(e);if(t instanceof s)return t;for(let r=0;r<n.cols;r++){const o=n.at(0,r);if(typeof o=="string"&&U(o,t)===0)return r}return c.VALUE}function a(n,e){const t=h(n[0],e);if(t instanceof s)return t;const r=h(n[2],e);if(r instanceof s)return r;const o=w(t,r);if(o instanceof s)return o;const f=n[1];if(f===void 0)return{list:o.map(()=>null),db:t};const i=R(t,e.calc.scalar(f,e.frame));return i instanceof s?i:{list:o.map(l=>t.at(l,i)),db:t}}function S(n,e){u(n,3,3,(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return f.call([...i.length>0?i:[0]],r)})}for(const[n,e]of[["DSUM","SUM"],["DMAX","MAX"],["DMIN","MIN"],["DPRODUCT","PRODUCT"]])S(n,e);for(const[n,e]of[["DAVERAGE","AVERAGE"],["DSTDEV","STDEV.S"],["DSTDEVP","STDEV.P"],["DVAR","VAR.S"],["DVARP","VAR.P"]])u(n,3,3,(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return i.length===0?c.DIV0:f.call(i,r)});u("DCOUNT",2,3,(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>typeof r=="number").length}),u("DCOUNTA",2,3,(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>r!==null).length}),u("DGET",3,3,(n,e)=>{const t=a(n,e);return t instanceof s?t:t.list.length===0?c.VALUE:t.list.length>1?c.NUM:t.list[0]??null});
2
+ import{CellError as s,ERR as c}from"../../values.js";import{compare as U,toText as E}from"../coerce.js";import{FUNCTIONS as p,cellsOf as h,raw as u}from"./define.js";import{criterion as T}from"./criteria.js";function w(n,e){const t=[];for(let o=0;o<n.cols;o++){const f=E(n.at(0,o));if(f instanceof s)return f;t.push(f.toLowerCase())}const r=[];for(let o=1;o<n.rows;o++){let f=e.rows<2;for(let i=1;i<e.rows&&!f;i++){let l=!0;for(let m=0;m<e.cols&&l;m++){const D=e.at(i,m);if(D===null||D==="")continue;const d=E(e.at(0,m));if(d instanceof s)return d;const V=t.indexOf(d.toLowerCase());if(V<0){l=!1;continue}const A=T(D);if(A instanceof s)return A;A.test(n.at(o,V))||(l=!1)}l&&(f=!0)}f&&r.push(o)}return r}function R(n,e){if(typeof e=="number"){const r=Math.trunc(e)-1;return r<0||r>=n.cols?c.VALUE:r}const t=E(e);if(t instanceof s)return t;for(let r=0;r<n.cols;r++){const o=n.at(0,r);if(typeof o=="string"&&U(o,t)===0)return r}return c.VALUE}function a(n,e){const t=h(n[0],e);if(t instanceof s)return t;const r=h(n[2],e);if(r instanceof s)return r;const o=w(t,r);if(o instanceof s)return o;const f=n[1];if(f===void 0)return{list:o.map(()=>null),db:t};const i=R(t,e.calc.scalar(f,e.frame));return i instanceof s?i:{list:o.map(l=>t.at(l,i)),db:t}}function S(n,e){u(n,"rvr",(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return f.call([...i.length>0?i:[0]],r)})}for(const[n,e]of[["DSUM","SUM"],["DMAX","MAX"],["DMIN","MIN"],["DPRODUCT","PRODUCT"]])S(n,e);for(const[n,e]of[["DAVERAGE","AVERAGE"],["DSTDEV","STDEV.S"],["DSTDEVP","STDEV.P"],["DVAR","VAR.S"],["DVARP","VAR.P"]])u(n,"rvr",(t,r)=>{const o=a(t,r);if(o instanceof s)return o;const f=p.get(e);if(f?.kind!=="raw")return c.VALUE;const i=o.list.filter(l=>typeof l=="number");return i.length===0?c.DIV0:f.call(i,r)});u("DCOUNT","rv?r",(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>typeof r=="number").length}),u("DCOUNTA","rv?r",(n,e)=>{const t=a(n.length===2?[n[0],void 0,n[1]]:n,e);return t instanceof s?t:t.list.filter(r=>r!==null).length}),u("DGET","rvr",(n,e)=>{const t=a(n,e);return t instanceof s?t:t.list.length===0?c.VALUE:t.list.length>1?c.NUM:t.list[0]??null});
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{parseDate as B,parseTime as H,parseValue as I}from"numfmt";import{CellError as c,ERR as i,dateOf as h,serialOf as U}from"../../values.js";import{toBool as X,toNumber as m,toText as Y}from"../coerce.js";import{Missing as O}from"../types.js";import{number as V,numbersOf as b,raw as p,scalar as l}from"./define.js";const d=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.floor(n)},R=r=>r%4===0&&r%100!==0||r%400===0,A=(r,n)=>n===2?R(r)?29:28:[4,6,9,11].includes(n)?30:31,W=r=>r.month===2&&r.day===A(r.year,2);l("DATE",3,3,V((r=0,n=1,e=1)=>{const t=Math.trunc(r);if(t<0||t>9999)return i.NUM;const o=U(t<1900?t+1900:t,Math.trunc(n),Math.trunc(e));return o<0?i.NUM:o})),l("TIME",3,3,V((r=0,n=0,e=0)=>{const t=Math.trunc(r)*3600+Math.trunc(n)*60+Math.trunc(e);return t<0?i.NUM:t%86400/86400})),l("YEAR",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).year}),l("MONTH",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).month}),l("DAY",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).day});const L=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.round((n-Math.floor(n))*86400)%86400};l("HOUR",1,1,r=>{const n=L(r);return n instanceof c?n:Math.floor(n/3600)}),l("MINUTE",1,1,r=>{const n=L(r);return n instanceof c?n:Math.floor(n/60)%60}),l("SECOND",1,1,r=>{const n=L(r);return n instanceof c?n:n%60}),l("DATEVALUE",1,1,r=>{const n=Y(r);if(n instanceof c)return n;const e=B(n)??I(n);return typeof e?.value=="number"?Math.floor(e.value):i.VALUE}),l("TIMEVALUE",1,1,r=>{const n=Y(r);if(n instanceof c)return n;const e=H(n)??I(n);return typeof e?.value!="number"?i.VALUE:e.value-Math.floor(e.value)});const D=r=>(r%7+6)%7;l("WEEKDAY",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;const o=D(e);return t===1?o+1:t===2?(o+6)%7+1:t===3?(o+6)%7:t>=11&&t<=17?(o+7-(t-10)%7)%7+1:i.NUM});const k=r=>{const n=(D(r)+6)%7,e=r-n+3,{year:t}=h(e);return Math.floor((e-U(t,1,1))/7)+1};l("ISOWEEKNUM",1,1,r=>{const n=d(r);return n instanceof c?n:k(n)}),l("WEEKNUM",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;if(t===21)return k(e);const o=t===1?0:t===2?1:t>=11&&t<=17?(t-10)%7:-1;if(o<0)return i.NUM;const a=U(h(e).year,1,1),s=(D(a)+7-o)%7;return Math.floor((e-a+s)/7)+1});const S=(r,n)=>{const{year:e,month:t,day:o}=h(r),a=e*12+t-1+n,s=Math.floor(a/12),f=a-s*12+1;return U(s,f,Math.min(o,A(s,f)))};l("EDATE",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=S(e,Math.trunc(t));return o<0?i.NUM:o}),l("EOMONTH",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=h(S(e,Math.trunc(t))),a=U(o.year,o.month,A(o.year,o.month));return a<0?i.NUM:a}),l("DAYS",2,2,(r,n)=>{const e=d(r),t=d(n);return e instanceof c?e:t instanceof c?t:e-t}),l("DATEDIF",3,3,(r,n,e)=>{const t=d(r),o=d(n),a=Y(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;if(t>o)return i.NUM;const s=h(t),f=h(o),u=(f.year-s.year)*12+f.month-s.month-(f.day<s.day?1:0);switch(a.toUpperCase()){case"D":return o-t;case"M":return u;case"Y":return Math.floor(u/12);case"YM":return u%12;case"MD":{if(f.day>=s.day)return f.day-s.day;const y=f.month===1?12:f.month-1,N=f.month===1?f.year-1:f.year;return A(N,y)-s.day+f.day}case"YD":{const y=f.year-s.year-(u%12<0?1:0),N=Math.floor(u/12),M=S(t,N*12);return y>=0?o-M:i.NUM}default:return i.NUM}});function K(r,n,e){const t=h(r),o=h(n);let a=t.day,s=o.day,f=o.month,u=o.year;return e?(a=Math.min(a,30),s=Math.min(s,30)):(a===A(t.year,t.month)&&(a=30),s===31&&(a<30?(s=1,f+=1,f>12&&(f=1,u+=1)):s=30)),(u-t.year)*360+(f-t.month)*30+s-a}l("DAYS360",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e===void 0?!1:X(e);return t instanceof c?t:o instanceof c?o:a instanceof c?a:K(t,o,a)});export function yearFrac(r,n,e){const[t,o]=r<=n?[r,n]:[n,r],a=h(t),s=h(o),f=o-t;switch(e){case 0:{let u=a.day,y=s.day;return W(a)&&(W(s)&&(y=30),u=30),y===31&&u>=30&&(y=30),u===31&&(u=30),((s.year-a.year)*360+(s.month-a.month)*30+y-u)/360}case 2:return f/360;case 3:return f/365;case 4:return K(t,o,!0)/360;default:{if(a.year===s.year||s.year===a.year+1&&(a.month>s.month||a.month===s.month&&a.day>=s.day)){let M;if(a.year===s.year)M=R(a.year);else{const E=w=>R(w)?U(w,2,29):1/0;M=E(a.year)>=t&&E(a.year)<=o||E(s.year)>=t&&E(s.year)<=o}return f/(M?366:365)}const y=s.year-a.year+1,N=U(s.year+1,1,1)-U(a.year,1,1);return f/(N/y)}}}l("YEARFRAC",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e==null?0:m(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;const s=Math.trunc(a);return s<0||s>4?i.NUM:yearFrac(t,o,s)});function x(r){const n=(...t)=>[0,1,2,3,4,5,6].map(o=>t.includes(o));if(r==null)return n(0,6);if(typeof r=="string"){if(!/^[01]{7}$/u.test(r)||r==="1111111")return i.VALUE;const t=r.split("").map(o=>o==="1");return[t[6]??!1,...t.slice(0,6)]}const e=m(r);return e instanceof c?e:e>=1&&e<=7?n((e+5)%7,(e+6)%7):e>=11&&e<=17?n(e-11):i.NUM}function _(r,n){if(r===void 0||r instanceof O)return new Set;const e=b([r],n);return e instanceof c?e:new Set(e.map(t=>Math.floor(t)))}function j(r,n,e,t){const o=r<=n?1:-1;let a=0;for(let s=r;o>0?s<=n:s>=n;s+=o)e[D(s)]!==!0&&!t.has(s)&&(a+=o);return a}function P(r,n,e,t){if(e.every(Boolean))return i.VALUE;const o=n<0?-1:1;let a=r;for(let s=Math.abs(n);s>0;)a+=o,e[D(a)]!==!0&&!t.has(a)&&(s-=1);return a<0?i.NUM:a}const v=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=d(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=x(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=_(n[r?3:2],e);return f instanceof c?f:j(t,o,s,f)},F=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=m(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=x(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=_(n[r?3:2],e);return f instanceof c?f:P(t,Math.trunc(o),s,f)};p("NETWORKDAYS",2,3,v(!1)),p("NETWORKDAYS.INTL",2,4,v(!0)),p("WORKDAY",2,3,F(!1)),p("WORKDAY.INTL",2,4,F(!0)),p("NOW",0,0,(r,n)=>n.calc.nowSerial(),{volatile:!0}),p("TODAY",0,0,(r,n)=>Math.floor(n.calc.nowSerial()),{volatile:!0});function $(r,n,e){const t=e[0]??0;let o=0;return n.forEach((a,s)=>{o+=a/(1+r)**(((e[s]??t)-t)/365)}),o}const C=(r,n)=>{const e=b([r[0]],n);if(e instanceof c)return e;const t=b([r[1]],n);return t instanceof c?t:e.length!==t.length||e.length===0?i.NUM:{values:e,dates:t.map(Math.floor)}};p("XNPV",3,3,(r,n)=>{const e=m(n.calc.scalar(r[0],n.frame));if(e instanceof c)return e;const t=C(r.slice(1),n);return t instanceof c?t:e<=0?i.NUM:$(e,t.values,t.dates)}),p("XIRR",2,3,(r,n)=>{const e=C(r,n);if(e instanceof c)return e;const{values:t,dates:o}=e;if(!t.some(u=>u>0)||!t.some(u=>u<0))return i.NUM;const a=r[2]===void 0||r[2]instanceof O?.1:m(n.calc.scalar(r[2],n.frame));if(a instanceof c)return a;const s=o[0]??0;let f=a;for(let u=0;u<100;u++){let y=0,N=0;t.forEach((E,w)=>{const T=((o[w]??s)-s)/365;y+=E/(1+f)**T,N-=T*E/(1+f)**(T+1)});const M=f-y/N;if(!Number.isFinite(M))return i.NUM;if(Math.abs(M-f)<1e-10)return M;f=M<=-1?(f-1)/2:M}return i.NUM});
2
+ import{parseDate as B,parseTime as H,parseValue as S}from"numfmt";import{CellError as c,ERR as i,dateOf as h,serialOf as U}from"../../values.js";import{toBool as X,toNumber as m,toText as T}from"../coerce.js";import{Missing as O}from"../types.js";import{number as I,numbersOf as Y,raw as p,scalar as l}from"./define.js";const j=2958465,d=r=>{const n=m(r);return n instanceof c?n:n<0||n>=j+1?i.NUM:Math.floor(n)},b=r=>r%4===0&&r%100!==0||r%400===0,A=(r,n)=>n===2?b(r)?29:28:[4,6,9,11].includes(n)?30:31,V=r=>r.month===2&&r.day===A(r.year,2);l("DATE",3,3,I((r=0,n=1,e=1)=>{const t=Math.trunc(r);if(t<0||t>9999)return i.NUM;const o=U(t<1900?t+1900:t,Math.trunc(n),Math.trunc(e));return o<0?i.NUM:o})),l("TIME",3,3,I((r=0,n=0,e=0)=>{const t=Math.trunc(r)*3600+Math.trunc(n)*60+Math.trunc(e);return t<0?i.NUM:t%86400/86400})),l("YEAR",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).year}),l("MONTH",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).month}),l("DAY",1,1,r=>{const n=d(r);return n instanceof c?n:h(n).day});const R=r=>{const n=m(r);return n instanceof c?n:n<0?i.NUM:Math.round((n-Math.floor(n))*86400)%86400};l("HOUR",1,1,r=>{const n=R(r);return n instanceof c?n:Math.floor(n/3600)}),l("MINUTE",1,1,r=>{const n=R(r);return n instanceof c?n:Math.floor(n/60)%60}),l("SECOND",1,1,r=>{const n=R(r);return n instanceof c?n:n%60}),l("DATEVALUE",1,1,r=>{const n=T(r);if(n instanceof c)return n;const e=B(n)??S(n);return typeof e?.value=="number"?Math.floor(e.value):i.VALUE}),l("TIMEVALUE",1,1,r=>{const n=T(r);if(n instanceof c)return n;const e=H(n)??S(n);return typeof e?.value!="number"?i.VALUE:e.value-Math.floor(e.value)});const D=r=>(r%7+6)%7;l("WEEKDAY",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;const o=D(e);return t===1?o+1:t===2?(o+6)%7+1:t===3?(o+6)%7:t>=11&&t<=17?(o+7-(t-10)%7)%7+1:i.NUM});const W=r=>{const n=(D(r)+6)%7,e=r-n+3,{year:t}=h(e);return Math.floor((e-U(t,1,1))/7)+1};l("ISOWEEKNUM",1,1,r=>{const n=d(r);return n instanceof c?n:W(n)}),l("WEEKNUM",1,2,(r,n)=>{const e=d(r);if(e instanceof c)return e;const t=n==null?1:m(n);if(t instanceof c)return t;if(t===21)return W(e);const o=t===1?0:t===2?1:t>=11&&t<=17?(t-10)%7:-1;if(o<0)return i.NUM;const a=U(h(e).year,1,1),s=(D(a)+7-o)%7;return Math.floor((e-a+s)/7)+1});const L=(r,n)=>{const{year:e,month:t,day:o}=h(r),a=e*12+t-1+n,s=Math.floor(a/12),f=a-s*12+1;return U(s,f,Math.min(o,A(s,f)))};l("EDATE",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=L(e,Math.trunc(t));return o<0?i.NUM:o}),l("EOMONTH",2,2,(r,n)=>{const e=d(r),t=m(n);if(e instanceof c)return e;if(t instanceof c)return t;const o=h(L(e,Math.trunc(t))),a=U(o.year,o.month,A(o.year,o.month));return a<0?i.NUM:a}),l("DAYS",2,2,(r,n)=>{const e=d(r),t=d(n);return e instanceof c?e:t instanceof c?t:e-t}),l("DATEDIF",3,3,(r,n,e)=>{const t=d(r),o=d(n),a=T(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;if(t>o)return i.NUM;const s=h(t),f=h(o),u=(f.year-s.year)*12+f.month-s.month-(f.day<s.day?1:0);switch(a.toUpperCase()){case"D":return o-t;case"M":return u;case"Y":return Math.floor(u/12);case"YM":return u%12;case"MD":{if(f.day>=s.day)return f.day-s.day;const y=f.month===1?12:f.month-1,N=f.month===1?f.year-1:f.year;return A(N,y)-s.day+f.day}case"YD":{const y=f.year-s.year-(u%12<0?1:0),N=Math.floor(u/12),M=L(t,N*12);return y>=0?o-M:i.NUM}default:return i.NUM}});function _(r,n,e){const t=h(r),o=h(n);let a=t.day,s=o.day,f=o.month,u=o.year;return e?(a=Math.min(a,30),s=Math.min(s,30)):(a===A(t.year,t.month)&&(a=30),s===31&&(a<30?(s=1,f+=1,f>12&&(f=1,u+=1)):s=30)),(u-t.year)*360+(f-t.month)*30+s-a}l("DAYS360",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e===void 0?!1:X(e);return t instanceof c?t:o instanceof c?o:a instanceof c?a:_(t,o,a)});export function yearFrac(r,n,e){const[t,o]=r<=n?[r,n]:[n,r],a=h(t),s=h(o),f=o-t;switch(e){case 0:{let u=a.day,y=s.day;return V(a)&&(V(s)&&(y=30),u=30),y===31&&u>=30&&(y=30),u===31&&(u=30),((s.year-a.year)*360+(s.month-a.month)*30+y-u)/360}case 2:return f/360;case 3:return f/365;case 4:return _(t,o,!0)/360;default:{if(a.year===s.year||s.year===a.year+1&&(a.month>s.month||a.month===s.month&&a.day>=s.day)){let M;if(a.year===s.year)M=b(a.year);else{const E=w=>b(w)?U(w,2,29):1/0;M=E(a.year)>=t&&E(a.year)<=o||E(s.year)>=t&&E(s.year)<=o}return f/(M?366:365)}const y=s.year-a.year+1,N=U(s.year+1,1,1)-U(a.year,1,1);return f/(N/y)}}}l("YEARFRAC",2,3,(r,n,e)=>{const t=d(r),o=d(n),a=e==null?0:m(e);if(t instanceof c)return t;if(o instanceof c)return o;if(a instanceof c)return a;const s=Math.trunc(a);return s<0||s>4?i.NUM:yearFrac(t,o,s)});function k(r){const n=(...t)=>[0,1,2,3,4,5,6].map(o=>t.includes(o));if(r==null)return n(0,6);if(typeof r=="string"){if(!/^[01]{7}$/u.test(r)||r==="1111111")return i.VALUE;const t=r.split("").map(o=>o==="1");return[t[6]??!1,...t.slice(0,6)]}const e=m(r);return e instanceof c?e:e>=1&&e<=7?n((e+5)%7,(e+6)%7):e>=11&&e<=17?n(e-11):i.NUM}function K(r,n){if(r===void 0||r instanceof O)return new Set;const e=Y([r],n);return e instanceof c?e:new Set(e.map(t=>Math.floor(t)))}function P(r,n,e,t){const o=r<=n?1:-1;let a=0;for(let s=r;o>0?s<=n:s>=n;s+=o)e[D(s)]!==!0&&!t.has(s)&&(a+=o);return a}function $(r,n,e,t){if(e.every(Boolean))return i.VALUE;const o=n<0?-1:1;let a=r;for(let s=Math.abs(n);s>0;)a+=o,e[D(a)]!==!0&&!t.has(a)&&(s-=1);return a<0?i.NUM:a}const x=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=d(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=k(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=K(n[r?3:2],e);return f instanceof c?f:P(t,o,s,f)},F=r=>(n,e)=>{const t=d(e.calc.scalar(n[0],e.frame)),o=m(e.calc.scalar(n[1],e.frame));if(t instanceof c)return t;if(o instanceof c)return o;const a=r?n[2]:void 0,s=k(a===void 0||a instanceof O?void 0:e.calc.scalar(a,e.frame));if(s instanceof c)return s;const f=K(n[r?3:2],e);return f instanceof c?f:$(t,Math.trunc(o),s,f)};p("NETWORKDAYS","vv?r",x(!1)),p("NETWORKDAYS.INTL","vv?vr",x(!0)),p("WORKDAY","vv?r",F(!1)),p("WORKDAY.INTL","vv?vr",F(!0)),p("NOW","",(r,n)=>n.calc.nowSerial(),{volatile:!0}),p("TODAY","",(r,n)=>Math.floor(n.calc.nowSerial()),{volatile:!0});function g(r,n,e){const t=e[0]??0;let o=0;return n.forEach((a,s)=>{o+=a/(1+r)**(((e[s]??t)-t)/365)}),o}const C=(r,n)=>{const e=Y([r[0]],n);if(e instanceof c)return e;const t=Y([r[1]],n);return t instanceof c?t:e.length!==t.length||e.length===0?i.NUM:{values:e,dates:t.map(Math.floor)}};p("XNPV","vrr",(r,n)=>{const e=m(n.calc.scalar(r[0],n.frame));if(e instanceof c)return e;const t=C(r.slice(1),n);return t instanceof c?t:e<=0?i.NUM:g(e,t.values,t.dates)}),p("XIRR","rr?v",(r,n)=>{const e=C(r,n);if(e instanceof c)return e;const{values:t,dates:o}=e;if(!t.some(u=>u>0)||!t.some(u=>u<0))return i.NUM;const a=r[2]===void 0||r[2]instanceof O?.1:m(n.calc.scalar(r[2],n.frame));if(a instanceof c)return a;const s=o[0]??0;let f=a;for(let u=0;u<100;u++){let y=0,N=0;t.forEach((E,w)=>{const v=((o[w]??s)-s)/365;y+=E/(1+f)**v,N-=v*E/(1+f)**(v+1)});const M=f-y/N;if(!Number.isFinite(M))return i.NUM;if(Math.abs(M-f)<1e-10)return M;f=M<=-1?(f-1)/2:M}return i.NUM});
@@ -15,6 +15,15 @@ interface Base {
15
15
  /** Where it comes from: this repository, or @formulajs/formulajs. */
16
16
  from: "allyhub" | "formulajs";
17
17
  }
18
+ /** How a parameter is taken: a single value, lifted over an array given to it, or the value whole. */
19
+ export type ParamKind = "value" | "whole";
20
+ /** A raw function's parameters, read from its signature (`params`). */
21
+ export interface Params {
22
+ /** The parameters in order, before any that repeat. */
23
+ readonly fixed: readonly ParamKind[];
24
+ /** Parameters that repeat after the fixed ones, as SUMIFS's range and criterion. */
25
+ readonly group: readonly ParamKind[];
26
+ }
18
27
  export type FunctionDef = Base & ({
19
28
  kind: "scalar";
20
29
  call: (...args: (Scalar | undefined)[]) => Scalar;
@@ -22,6 +31,8 @@ export type FunctionDef = Base & ({
22
31
  errors?: boolean;
23
32
  } | {
24
33
  kind: "raw";
34
+ params: Params;
35
+ /** A parameter taken as a single value arrives as a Scalar, or Missing when left empty. */
25
36
  call: (args: readonly Value[], c: Call) => Value;
26
37
  } | {
27
38
  kind: "lazy";
@@ -30,12 +41,27 @@ export type FunctionDef = Base & ({
30
41
  export declare const FUNCTIONS: Map<string, FunctionDef>;
31
42
  /** A function that takes any number of arguments from `min`. */
32
43
  export declare const many = 255;
44
+ /**
45
+ * A signature, a letter per parameter: `v` a single value, `r` the value
46
+ * whole. A `?` marks where the optional ones start; a group in parentheses
47
+ * at the end repeats, once at least unless a `?` comes before it. SUMIFS is
48
+ * `r(rv)`, VLOOKUP `vrv?v`, CONCAT `(r)`, NOW ``.
49
+ */
50
+ export declare function signature(text: string): Params & {
51
+ min: number;
52
+ max: number;
53
+ };
54
+ /** How the parameter at `i` is taken. */
55
+ export declare function paramAt(p: Params, i: number): ParamKind;
56
+ /** Whether `count` arguments fill a repeating group whole, as Excel asks. */
57
+ export declare function fillsGroup(p: Params, count: number): boolean;
33
58
  export declare function scalar(name: string, min: number, max: number, call: (...args: (Scalar | undefined)[]) => Scalar, o?: {
34
59
  errors?: boolean;
35
60
  volatile?: boolean;
36
61
  from?: Base["from"];
37
62
  }): void;
38
- export declare function raw(name: string, min: number, max: number, call: (args: readonly Value[], c: Call) => Value, o?: {
63
+ /** A function that takes some arguments whole, by its signature (`signature`). */
64
+ export declare function raw(name: string, params: string, call: (args: readonly Value[], c: Call) => Value, o?: {
39
65
  volatile?: boolean;
40
66
  from?: Base["from"];
41
67
  }): void;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{CellError as a,ERR as c,Matrix as u}from"../../values.js";import{toBool as h,toNumber as l,toText as b}from"../coerce.js";import{Lambda as i,Missing as p,Reference as m,Union as x}from"../types.js";export const FUNCTIONS=new Map;const d=255;export const many=d;export function scalar(e,r,o,n,t={}){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"scalar",call:n,from:t.from??"allyhub",...t.errors===!0?{errors:!0}:{},...t.volatile===!0?{volatile:!0}:{}})}export function raw(e,r,o,n,t={}){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"raw",call:n,from:t.from??"allyhub",...t.volatile===!0?{volatile:!0}:{}})}export function lazy(e,r,o,n){FUNCTIONS.set(e,{name:e,min:r,max:o,kind:"lazy",call:n,from:"allyhub"})}export function alias(e,r){const o=FUNCTIONS.get(r);o&&FUNCTIONS.set(e,{...o,name:e})}export function cellsOf(e,r){if(e instanceof a)return e;if(e instanceof x)return c.VALUE;if(e instanceof m){const n=Math.min(e.bottom,e.sheet.lastRow);return{rows:Math.max(0,n-e.top+1),cols:e.cols,at:(t,f)=>r.calc.read(e.sheet,e.top+t,e.left+f),reference:e}}if(e instanceof u)return{rows:e.rows,cols:e.cols,at:(n,t)=>e.at(n,t)};if(e instanceof i)return c.VALUE;const o=e instanceof p?null:e;return{rows:1,cols:1,at:()=>o}}export function eachArg(e,r,o){for(const n of e)if(n instanceof m)r.calc.each(n,t=>{o(t,!1)});else if(n instanceof x)for(const t of n.parts)r.calc.each(t,f=>{o(f,!1)});else if(n instanceof u)for(const t of n.data)t!==null&&o(t,!1);else n instanceof p?o(null,!0):n instanceof i?o(c.VALUE,!0):o(n,!0)}export function eachRow(e,r,o){const n=t=>{for(const f of r.calc.matrix(t).data)o(f,!1)};for(const t of e)if(t instanceof m)n(t);else if(t instanceof x)t.parts.forEach(n);else if(t instanceof u)for(const f of t.data)o(f,!1);else t instanceof p?o(null,!0):t instanceof i?o(c.VALUE,!0):o(t,!0)}export function numbersOf(e,r){const o=[];let n;return eachArg(e,r,(t,f)=>{if(!n){if(t instanceof a)n=t;else if(typeof t=="number")o.push(t);else if(f){const s=l(t);s instanceof a?n=s:o.push(s)}}}),n??o}export function numbersOfA(e,r){const o=[];let n;return eachArg(e,r,(t,f)=>{if(!n)if(t instanceof a)n=t;else if(typeof t=="number")o.push(t);else if(typeof t=="boolean")o.push(t?1:0);else if(f){const s=l(t);s instanceof a?n=s:o.push(s)}else typeof t=="string"&&o.push(0)}),n??o}export const number=e=>(...r)=>{const o=[];for(const n of r){const t=l(n);if(t instanceof a)return t;o.push(t)}return e(...o)};export function textArg(e){return b(e)}export function boolArg(e,r){return e==null?r:h(e)}export function numberArg(e,r){return e===void 0?r:l(e)}
2
+ import{CellError as l,ERR as a,Matrix as i}from"../../values.js";import{toBool as w,toNumber as c,toText as A}from"../coerce.js";import{Lambda as h,Missing as p,Reference as g,Union as x}from"../types.js";export const FUNCTIONS=new Map;const d=255;export const many=d;export function signature(e){const r=/^([vr?]*)(?:\(([vr]+)\))?$/u.exec(e),t=r?.[1];if(t===void 0||(t.match(/\?/gu)??[]).length>1)throw new Error(`"${e}" is not a signature.`);const o=m=>Array.from({length:m.length},(y,b)=>m.charAt(b)==="v"?"value":"whole"),n=o(t.replace("?","")),f=o(r?.[2]??""),s=t.indexOf("?"),u=s>=0?s:n.length+f.length;return{fixed:n,group:f,min:u,max:f.length>0?d:n.length}}export function paramAt(e,r){return r<e.fixed.length?e.fixed[r]??"whole":e.group.length===0?"whole":e.group[(r-e.fixed.length)%e.group.length]??"whole"}export function fillsGroup(e,r){return e.group.length===0||r<=e.fixed.length?!0:(r-e.fixed.length)%e.group.length===0}export function scalar(e,r,t,o,n={}){FUNCTIONS.set(e,{name:e,min:r,max:t,kind:"scalar",call:o,from:n.from??"allyhub",...n.errors===!0?{errors:!0}:{},...n.volatile===!0?{volatile:!0}:{}})}export function raw(e,r,t,o={}){const{min:n,max:f,fixed:s,group:u}=signature(r);FUNCTIONS.set(e,{name:e,min:n,max:f,kind:"raw",params:{fixed:s,group:u},call:t,from:o.from??"allyhub",...o.volatile===!0?{volatile:!0}:{}})}export function lazy(e,r,t,o){FUNCTIONS.set(e,{name:e,min:r,max:t,kind:"lazy",call:o,from:"allyhub"})}export function alias(e,r){const t=FUNCTIONS.get(r);t&&FUNCTIONS.set(e,{...t,name:e})}export function cellsOf(e,r){if(e instanceof l)return e;if(e instanceof x)return a.VALUE;if(e instanceof g){const o=Math.min(e.bottom,e.sheet.lastRow);return{rows:Math.max(0,o-e.top+1),cols:e.cols,at:(n,f)=>r.calc.read(e.sheet,e.top+n,e.left+f),reference:e}}if(e instanceof i)return{rows:e.rows,cols:e.cols,at:(o,n)=>e.at(o,n)};if(e instanceof h)return a.VALUE;const t=e instanceof p?null:e;return{rows:1,cols:1,at:()=>t}}export function eachArg(e,r,t){for(const o of e)if(o instanceof g)r.calc.each(o,n=>{t(n,!1)});else if(o instanceof x)for(const n of o.parts)r.calc.each(n,f=>{t(f,!1)});else if(o instanceof i)for(const n of o.data)n!==null&&t(n,!1);else o instanceof p?t(null,!0):o instanceof h?t(a.VALUE,!0):t(o,!0)}export function eachRow(e,r,t){const o=n=>{for(const f of r.calc.matrix(n).data)t(f,!1)};for(const n of e)if(n instanceof g)o(n);else if(n instanceof x)n.parts.forEach(o);else if(n instanceof i)for(const f of n.data)t(f,!1);else n instanceof p?t(null,!0):n instanceof h?t(a.VALUE,!0):t(n,!0)}export function numbersOf(e,r){const t=[];let o;return eachArg(e,r,(n,f)=>{if(!o){if(n instanceof l)o=n;else if(typeof n=="number")t.push(n);else if(f){const s=c(n);s instanceof l?o=s:t.push(s)}}}),o??t}export function numbersOfA(e,r){const t=[];let o;return eachArg(e,r,(n,f)=>{if(!o)if(n instanceof l)o=n;else if(typeof n=="number")t.push(n);else if(typeof n=="boolean")t.push(n?1:0);else if(f){const s=c(n);s instanceof l?o=s:t.push(s)}else typeof n=="string"&&t.push(0)}),o??t}export const number=e=>(...r)=>{const t=[];for(const o of r){const n=c(o);if(n instanceof l)return n;t.push(n)}return e(...t)};export function textArg(e){return A(e)}export function boolArg(e,r){return e==null?r:w(e)}export function numberArg(e,r){return e===void 0?r:c(e)}
@@ -0,0 +1,16 @@
1
+ import { CellError } from "../../values.js";
2
+ import { type Value } from "../types.js";
3
+ import { type Call } from "./define.js";
4
+ /** Case changed a letter at a time, so a place in the result is the same place in the text: ß stays ß, where toUpperCase makes SS. */
5
+ export declare const eachLetter: (s: string, change: (c: string) => string) => string;
6
+ export declare const lowerLetters: (s: string) => string;
7
+ /** The delimiters given: a text, or every text of a range or an array, row by row; empty cells are none. */
8
+ export declare function delimiters(v: Value | undefined, c: Call): string[] | CellError;
9
+ /** Where any of the delimiters occurs in the text, left to right without overlapping; at one place the longest. */
10
+ export declare function occurrences(text: string, by: readonly string[], ignoreCase: boolean): {
11
+ at: number;
12
+ length: number;
13
+ }[];
14
+ /** Text apart at any of the delimiters. */
15
+ export declare function splitAt(text: string, by: readonly string[], ignoreCase: boolean): string[];
16
+ //# sourceMappingURL=delimiters.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{CellError as c}from"../../values.js";import{toText as u}from"../coerce.js";import{Missing as h}from"../types.js";import{cellsOf as p}from"./define.js";export const eachLetter=(t,s)=>Array.from(t,e=>{const n=s(e);return n.length===e.length?n:e}).join(""),lowerLetters=t=>eachLetter(t,s=>s.toLowerCase());export function delimiters(t,s){if(t===void 0||t instanceof h)return[];const e=p(t,s);if(e instanceof c)return e;const n=[];for(let i=0;i<e.rows;i++)for(let o=0;o<e.cols;o++){const l=e.at(i,o);if(l===null)continue;const r=u(l);if(r instanceof c)return r;n.push(r)}return n}export function occurrences(t,s,e){const n=e?lowerLetters(t):t,i=(e?s.map(lowerLetters):[...s]).filter(r=>r!=="").sort((r,f)=>f.length-r.length),o=[];if(i.length===0)return o;let l=0;for(;l<t.length;){const r=i.find(f=>n.startsWith(f,l));r===void 0?l+=1:(o.push({at:l,length:r.length}),l+=r.length)}return o}export function splitAt(t,s,e){const n=[];let i=0;for(const o of occurrences(t,s,e))n.push(t.slice(i,o.at)),i=o.at+o.length;return n.push(t.slice(i)),n}
@@ -1,2 +1,19 @@
1
- export {};
1
+ import { CellError, Matrix, type Scalar } from "../../values.js";
2
+ import { type Value } from "../types.js";
3
+ import { type Call, type Cells } from "./define.js";
4
+ export declare const rowsOfCells: (m: Cells) => Scalar[][];
5
+ export declare const matrixOf: (rows: readonly (readonly Scalar[])[]) => Matrix;
6
+ export declare const transposed: (rows: readonly (readonly Scalar[])[]) => Scalar[][];
7
+ export declare function numberOf(v: Value | undefined, c: Call, otherwise: number): number | CellError;
8
+ export declare function boolOf(v: Value | undefined, c: Call, otherwise: boolean): boolean | CellError;
9
+ /** A list of whole numbers: one, or a row or a column of them. */
10
+ export declare function indexes(v: Value | undefined, c: Call, otherwise: number): number[] | CellError;
11
+ /** Two lines in Excel's order: blanks last either way. */
12
+ export declare function compareBy(a: Scalar, b: Scalar, descending: boolean): number;
13
+ /** Whether a value keeps its row or column in FILTER. */
14
+ export declare function included(v: Scalar): boolean | CellError;
15
+ /** A value as a key: Excel's UNIQUE takes letters whatever their case. */
16
+ export declare const keyOf: (v: Scalar) => string;
17
+ /** What a LAMBDA gave for one cell: a single value. */
18
+ export declare const oneOf: (v: Value, c: Call) => Scalar;
2
19
  //# sourceMappingURL=dynamic.d.ts.map