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,3 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{strFromU8 as ie,unzipSync as ae}from"fflate";import{SHEET_ICONS as le,SHEET_OPERATORS as ce,SHEET_VALIDATIONS as de}from"@allyhub-next/formats";import{cellName as J,readAddress as K,readArea as z,readAreas as Q}from"../address.js";import{SHEET_CHART_DEFAULTS as Y}from"../chart.js";import{moveFormula as ue,relativeKey as fe}from"../formula/move.js";import{printFormula as Z}from"../formula/print.js";import{ERR as me,errorOf as he,serialOfDate as pe}from"../values.js";import{OFFICE_THEME as be,colorOf as C,paletteOf as ee,themeColors as ge}from"./colors.js";import{chartAnchors as xe,readChart as ye}from"./charts.js";import{readFileFormula as P}from"./formula.js";import{BUILTIN_FORMATS as we}from"./numfmt.js";import{attr as d,flag as k,numberAttr as x,readXml as ve,readXstring as L,tag as l,tags as b,textOf as F}from"./xml.js";const te=7,ke=o=>Math.floor((256*o+Math.floor(128/te))/256*te),$e=o=>Math.round(o*4/3),B=5;export function placesLine(o){const e=o.slice(0,B).join(", ");return o.length>B?`${e} and ${String(o.length-B)} more`:e}const H=(o,e,t=`${e}s`)=>`${String(o)} ${o===1?e:t}`;class Se{parts;names;constructor(e){this.parts=ae(e),this.names=Object.keys(this.parts)}has(e){return this.parts[e]!==void 0}text(e){const t=this.parts[e];return t?ie(t):void 0}xml(e){const t=this.text(e);return t===void 0?void 0:ve(t)}rels(e){const t=e.lastIndexOf("/"),n=`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`,s=this.xml(n);return b(l(s?.Relationships)?.Relationship).map(r=>{const a=d(r,"Type")??"",c=d(r,"Target")??"",i=d(r,"TargetMode")==="External";return{id:d(r,"Id")??"",type:a.slice(a.lastIndexOf("/")+1),target:i?c:Te(e,c),external:i}})}count(e){return this.names.filter(t=>e.test(t)).length}}function Te(o,e){if(e.startsWith("/"))return e.slice(1);const t=o.split("/").slice(0,-1);for(const n of e.split("/"))n===".."?t.pop():n!=="."&&t.push(n);return t.join("/")}function Ee(o,e){const t=e===void 0?void 0:o.xml(e);return b(l(t?.sst)?.si).map(n=>{const s=b(n.r);return s.length>0?{text:L(s.map(r=>F(r.t)).join("")),rich:!0}:{text:L(F(n.t)),rich:!1}})}function M(o,e){const t=o[e];if(t===void 0)return!1;const n=d(l(t),"val");return n===void 0||n!=="0"&&n!=="false"}const Oe=new Set(["double","singleAccounting","doubleAccounting"]);function Ie(o,e,t){const n={},s=(i,m)=>d(l(i?.[m]),"val");if(M(o,"b")&&(n.bold=!0),M(o,"i")&&(n.italic=!0),M(o,"strike")&&(n.strike=!0),M(o,"u")){const i=s(o,"u");n.underline=i!==void 0&&Oe.has(i)?i:!0}const r=s(o,"name");r!==void 0&&r!==s(e,"name")&&(n.font=r);const a=s(o,"sz");a!==void 0&&a!==s(e,"sz")&&(n.size=Number(a));const c=C(l(o.color),t);return c!==void 0&&c!==C(l(e?.color),t)&&(n.color=c),n}function Ae(o,e){const t=l(o.patternFill),n=d(t,"patternType");if(n===void 0||n==="none")return;const s=C(l(t?.fgColor),e),r=C(l(t?.bgColor),e);return n==="solid"&&s!==void 0?s:{pattern:n,...s===void 0?{}:{color:s},...r===void 0?{}:{background:r}}}function ne(o,e){const t={};for(const n of["left","right","top","bottom"]){const s=l(o[n]),r=d(s,"style");if(r===void 0||r==="none")continue;const a=C(l(s?.color),e);t[n]={style:r,...a===void 0?{}:{color:a}}}return Object.keys(t).length===0?void 0:t}function Ce(o){const e={},t=d(o,"horizontal");t!==void 0&&t!=="general"&&(e.align=t);const n=d(o,"vertical");n!==void 0&&n!=="bottom"&&(e.valign=n),k(o,"wrapText")===!0&&(e.wrap=!0),k(o,"shrinkToFit")===!0&&(e.shrink=!0);const s=x(o,"indent");s!==void 0&&s>0&&(e.indent=s);const r=x(o,"textRotation");return r!==void 0&&r>0&&r<=180&&(e.rotation=r),e}function Fe(o,e){const t={},n=l(o.font);if(n){const i=(f,u)=>{n[f]!==void 0&&(t[u]=M(n,f))};i("b","bold"),i("i","italic"),i("strike","strike"),n.u!==void 0&&(t.underline=M(n,"u"));const m=C(l(n.color),e);m!==void 0&&(t.color=m)}const s=l(l(o.fill)?.patternFill),r=C(l(s?.bgColor),e)??C(l(s?.fgColor),e);r!==void 0&&(t.fill=r);const a=l(o.border),c=a&&ne(a,e);return c!==void 0&&(t.border=c),t}function Re(o,e){const t=l(o?.styleSheet),n=ee(e,t),s=new Map(b(l(t?.numFmts)?.numFmt).map(p=>[x(p,"numFmtId")??-1,d(p,"formatCode")??"General"])),r=b(l(t?.fonts)?.font),a=b(l(t?.fills)?.fill),c=b(l(t?.borders)?.border),i=b(l(t?.cellXfs)?.xf),m=r[x(i[0],"fontId")??0],f=new Set;a.some(p=>p.gradientFill!==void 0)&&f.add("gradient fills");const u=i.map(p=>{const y={},$=r[x(p,"fontId")??0];$&&(Object.assign(y,Ie($,m,n)),$.vertAlign!==void 0&&f.add("superscript and subscript"));const T=a[x(p,"fillId")??0],O=T&&Ae(T,n);O!==void 0&&(y.fill=O);const R=c[x(p,"borderId")??0],I=R&&ne(R,n);I!==void 0&&(y.border=I),R&&d(l(R.diagonal),"style")!==void 0&&f.add("diagonal borders");const w=l(p.alignment);w&&(Object.assign(y,Ce(w)),x(w,"textRotation")===255&&f.add("vertical text"));const S=x(p,"numFmtId")??0,A=s.get(S)??we[S];return A!==void 0&&A!=="General"&&(y.format=A),y}),h=d(l(m?.name),"val"),v=d(l(m?.sz),"val");return{looks:u,dxfs:b(l(t?.dxfs)?.dxf).map(p=>Fe(p,n)),font:{...h===void 0?{}:{name:h},...v===void 0?{}:{size:Number(v)}},lost:[...f]}}function oe(o){const e=new Map;let t=0;for(const n of b(o.filterColumn)){const s=x(n,"colId")??0,r=l(n.filters);if(!r){Object.keys(n).some(c=>c!=="colId"&&c!=="hiddenButton")&&(t+=1);continue}if(r.dateGroupItem!==void 0){t+=1;continue}const a=b(r.filter).map(c=>L(d(c,"val")??""));e.set(s,{...a.length===0?{}:{values:a},...k(r,"blank")===!0?{blanks:!0}:{}})}return{columns:e,unread:t}}function Le(o){const e=l(o?.table),t=z(d(e,"ref")??""),n=d(e,"displayName")??d(e,"name");if(!t||n===void 0)return;const s=l(e?.tableStyleInfo),r=l(e?.autoFilter);return{name:n,ref:t,headers:x(e,"headerRowCount")??1,totals:x(e,"totalsRowCount")??0,columns:b(l(e?.tableColumns)?.tableColumn).map(a=>({name:L(d(a,"name")??"").trim(),calculated:a.calculatedColumnFormula!==void 0})),style:d(s,"name")??"none",...r?{filter:oe(r)}:{}}}function W(o){const e=o.trim();if(e==="")return;const t=/^"((?:[^"]|"")*)"$/u.exec(e);if(t)return(t[1]??"").replaceAll('""','"');const n=Number(e);if(!Number.isNaN(n))return n;const s=P(e,!0);return s.ok?Z(s.node):void 0}const re=o=>o!==void 0&&ce.includes(o);function q(o){const e=d(o,"type")??"num",t=d(o,"val"),n=t===void 0?void 0:W(t);return{at:e,...n===void 0?{}:{value:n}}}const Ne=le;function je(o,e,t,n){const s=d(o,"type")??"",r={range:e,...k(o,"stopIfTrue")===!0?{stop:!0}:{}},a=x(o,"dxfId"),c=a===void 0?{}:t[a]??{},i={...c.bold===void 0?{}:{bold:c.bold},...c.italic===void 0?{}:{italic:c.italic},...c.underline===void 0?{}:{underline:c.underline!==!1},...c.strike===void 0?{}:{strike:c.strike},...c.color===void 0?{}:{color:c.color},...typeof c.fill=="string"?{fill:c.fill}:{},...c.border===void 0?{}:{border:c.border}},m=o.formula,f=(Array.isArray(m)?m:m===void 0?[]:[m]).map(F);switch(s){case"cellIs":{const u=d(o,"operator"),h=f.flatMap(v=>{const p=W(v);return p===void 0?[]:[p]});return!re(u)||h.length===0?`a cellIs rule of ${u??"no operator"}`:{...r,...i,type:"cellIs",operator:u,formula:h}}case"containsText":case"notContainsText":case"beginsWith":case"endsWith":{const u=d(o,"text");return u===void 0?`a ${s} rule with no text`:{...r,...i,type:"containsText",...s==="containsText"?{}:{operator:s==="notContainsText"?"notContains":s},text:L(u)}}case"duplicateValues":case"uniqueValues":return{...r,...i,type:s};case"top10":return{...r,...i,type:"top10",rank:x(o,"rank")??10,...k(o,"percent")===!0?{percent:!0}:{},...k(o,"bottom")===!0?{bottom:!0}:{}};case"aboveAverage":return{...r,...i,type:"aboveAverage",...k(o,"aboveAverage")===!1?{below:!0}:{},...k(o,"equalAverage")===!0?{equal:!0}:{}};case"expression":{const u=f[0]===void 0?void 0:P(f[0],!0);return u?.ok?{...r,...i,type:"expression",formula:Z(u.node)}:"an expression rule that cannot be read"}case"dataBar":{const u=l(o.dataBar),h=C(l(u?.color),n),[v,p]=b(u?.cfvo).map(q);return h===void 0?"a data bar with no colour":{...r,type:"dataBar",color:h,...v&&v.at!=="min"?{min:v}:{},...p&&p.at!=="max"?{max:p}:{},...k(u,"showValue")===!1?{show:!1}:{}}}case"colorScale":{const u=l(o.colorScale),h=b(u?.cfvo).map(q),v=b(u?.color).map(y=>C(y,n)),p=h.flatMap((y,$)=>{const T=v[$];return T===void 0?[]:[{...y,color:T}]});return p.length<2?"a colour scale with too few stops":{...r,type:"colorScale",stops:p.slice(0,3)}}case"iconSet":{const u=l(o.iconSet),h=d(u,"iconSet")??"3TrafficLights1";if(!Ne.includes(h))return`the icon set ${h}`;const v=b(u?.cfvo).map(q);return{...r,type:"iconSet",icons:h,...v.length>=3?{stops:v.slice(0,5)}:{},...k(u,"reverse")===!0?{reverse:!0}:{},...k(u,"showValue")===!1?{show:!1}:{}}}default:return`a ${s} rule`}}function Me(o,e,t){const n=[],s=[];for(const r of b(o.conditionalFormatting)){const a=d(r,"sqref")??"";if(!Q(a)){s.push(`a rule on ${a}`);continue}for(const c of b(r.cfRule)){const i=je(c,a,e,t);typeof i=="string"?s.push(`${i} on ${a}`):n.push({priority:x(c,"priority")??0,rule:i})}}return{rules:n.sort((r,a)=>r.priority-a.priority).map(r=>r.rule),unread:s}}const De=de;function Ve(o){const e=[],t=[];for(const n of b(l(o.dataValidations)?.dataValidation)){const s=d(n,"sqref")??"",r=d(n,"type")??"none";if(r==="none"&&d(n,"prompt")===void 0)continue;if(!De.includes(r)||!Q(s)){t.push(`a ${r} rule on ${s}`);continue}const a=F(n.formula1),c=F(n.formula2),i=/^"((?:[^"]|"")*)"$/u.exec(a.trim()),m=r==="list"&&i?(i[1]??"").replaceAll('""','"').split(","):void 0,f=[a,c].flatMap(T=>{const O=W(T);return O===void 0?[]:[O]}),u=d(n,"operator"),h=T=>Object.fromEntries(Object.entries(T).filter(([,O])=>O!==void 0)),v=h({title:d(n,"promptTitle"),message:d(n,"prompt")}),p=h({style:d(n,"errorStyle"),title:d(n,"errorTitle"),message:d(n,"error")}),y=k(n,"showInputMessage")!==!0,$=k(n,"showErrorMessage")!==!0;e.push({range:s,type:r,...re(u)&&u!=="between"?{operator:u}:{},...m?{values:m}:{formula:f},...k(n,"allowBlank")===!0?{}:{blank:!1},...k(n,"showDropDown")===!0?{dropdown:!1}:{},...y||Object.keys(v).length>0?{prompt:{...v,...y?{show:!1}:{}}}:{},...$||Object.keys(p).length>0?{error:{...p,...$?{show:!1}:{}}}:{}})}return{rules:e,unread:t}}function U(o,e){const t=P(o,e);return t.ok?{node:t.node}:{unread:o}}class ze{cells=[];rich=[];masters=new Map;strings;constructor(e){this.strings=e}value(e,t){const n=d(e,"t")??"n",s=e.v;if(n==="inlineStr"){const a=l(e.is),c=b(a?.r);return c.length>0?{value:L(c.map(i=>F(i.t)).join("")),rich:!0}:{value:L(F(a?.t))}}if(s===void 0)return{value:void 0};const r=F(s);switch(n){case"s":{const a=this.strings[Number(r)];return a?{value:a.text,...a.rich?{rich:!0}:{}}:{value:""}}case"str":return{value:L(r)};case"b":return{value:r.trim()==="1"||r.trim()==="true"};case"e":return{value:he(r.trim())??me.VALUE};case"d":{const a=new Date(r.trim());return{value:Number.isNaN(a.getTime())?r:pe(a)}}default:{if(r.trim()==="")return{value:void 0};const a=Number(r);if(Number.isNaN(a))throw new Error(`${t} says it holds a number and holds ${r}.`);return{value:a}}}}formula(e,t,n,s){const r=e.f;if(r===void 0)return;const a=l(r),c=d(a,"t")??"normal",i=F(r);if(c==="dataTable"){s.unread=`a data table's {=TABLE(${d(a,"r1")??""})}`;return}if(c==="array"){const m=e.cm!==void 0;Object.assign(s,U(i,!0));const f=z(d(a,"ref")??"");f&&(s.array=f),m&&(s.dynamic=!0);return}if(c==="shared"){const m=d(a,"si")??"";if(i!==""){const u=U(i,!1);this.masters.set(m,{node:u.node,unread:u.unread,row:t,col:n,key:u.node?fe(u.node,t,n):"",dynamicArray:!1}),Object.assign(s,u),u.node&&(s.key=this.masters.get(m)?.key??"");return}const f=this.masters.get(m);if(!f){s.unread=`a shared formula of a group that has no first cell (${m})`;return}f.node?(s.node=ue(f.node,t-f.row,n-f.col),s.key=f.key):f.unread!==void 0&&(s.unread=f.unread);return}i!==""&&Object.assign(s,U(i,!1))}readRows(e){let t=0;for(const n of e){const s=x(n,"r"),r=s===void 0?t:s-1;t=r+1;let a=0;for(const c of b(n.c)){const i=d(c,"r"),f=(i===void 0?void 0:K(i))?.col??a;a=f+1;const u=i??J({row:r,col:f}),{value:h,rich:v}=this.value(c,u),p={row:r,col:f,value:h,style:x(c,"s")??0};v===!0&&(p.rich=!0,this.rich.push(u)),this.formula(c,r,f,p),this.cells.push(p)}}}}function He(o,e,t){const n=[],s=i=>n.push(`${o}: ${i}`);t.length>0&&s(`${H(t.length,"cell")} of rich text, kept as plain text (${placesLine(t)})`);const r=b(l(e.hyperlinks)?.hyperlink);r.length>0&&s(`${H(r.length,"hyperlink")} (${placesLine(r.map(i=>d(i,"ref")??""))})`),e.sortState!==void 0&&s("a sort"),k(l(e.sheetProtection),"sheet")===!0&&s("protection"),e.protectedRanges!==void 0&&s("protected ranges"),e.headerFooter!==void 0&&F(e.headerFooter).trim()!==""&&s("its print header and footer"),l(e.headerFooter)?.oddHeader!==void 0&&s("its print header"),l(e.headerFooter)?.oddFooter!==void 0&&s("its print footer"),(e.rowBreaks!==void 0||e.colBreaks!==void 0)&&s("its page breaks"),e.oleObjects!==void 0&&s("embedded objects"),e.controls!==void 0&&s("form controls"),e.dataConsolidate!==void 0&&s("a consolidation"),e.customSheetViews!==void 0&&s("custom views"),b(l(e.sheetViews)?.sheetView).some(i=>d(l(i.pane),"state")==="split")&&s("a split, not frozen, window");const c=JSON.stringify(e.extLst??"");return c.includes("sparklineGroups")&&s("sparklines"),X(e.extLst)&&s("conditional formats of Excel 2010 and later"),c.includes("dataValidations")&&s("data validations of Excel 2010 and later"),c.includes("slicerList")&&s("slicers"),n}function X(o){if(typeof o!="object"||o===null)return!1;if(Array.isArray(o))return o.some(X);const e=o;return b(e.cfRule).some(t=>d(t,"type")!=="dataBar")&&e.cfRule!==void 0?!0:Object.values(e).some(X)}function _e(o){const e=[],t=(n,s,r)=>{const a=o.count(n);a>0&&e.push(H(a,s,r))};return o.has("xl/vbaProject.bin")&&e.push("VBA macros"),t(/^xl\/pivotTables\/pivotTable\d*\.xml$/u,"pivot table"),t(/^xl\/chartsheets\/[^/]+\.xml$/u,"chart sheet"),t(/^xl\/dialogsheets\/[^/]+\.xml$/u,"dialog sheet"),t(/^xl\/macrosheets\/[^/]+\.xml$/u,"macro sheet"),t(/^xl\/media\//u,"image"),t(/^xl\/embeddings\//u,"embedded object"),t(/^xl\/comments\d*\.xml$/u,"sheet's comments","sheets' comments"),t(/^xl\/threadedComments\//u,"sheet's threaded comments","sheets' threaded comments"),t(/^xl\/slicers\/[^/]+\.xml$/u,"slicer part"),t(/^xl\/timelines\/[^/]+\.xml$/u,"timeline part"),t(/^xl\/ctrlProps\/[^/]+\.xml$/u,"form control"),t(/^xl\/activeX\/[^/]+\.xml$/u,"ActiveX control"),t(/^xl\/queryTables\/[^/]+\.xml$/u,"query table"),o.has("xl/connections.xml")&&e.push("data connections"),o.names.some(n=>n.startsWith("xl/richData/"))&&e.push("rich values (data types, pictures in cells)"),o.names.some(n=>/^customXml\/item\d+\.xml$/u.test(n)&&(o.text(n)??"").includes("DataMashup"))&&e.push("Power Query queries"),e}function Pe(o,e,t,n,s,r,a){const c=o.xml(e),i=l(c?.worksheet);if(!i)throw new Error(`${e} is not a worksheet.`);const m=new ze(s);m.readRows(b(l(i.sheetData)?.row));const f=b(l(i.cols)?.col).map(g=>{const E=x(g,"width"),D=x(g,"style");return{min:(x(g,"min")??1)-1,max:(x(g,"max")??1)-1,...E===void 0||k(g,"customWidth")===!1?{}:{width:ke(E)},...k(g,"hidden")===!0?{hidden:!0}:{},...D===void 0||D===0?{}:{style:D}}}),u=[];let h=b(l(i.cols)?.col).some(g=>(x(g,"outlineLevel")??0)>0);b(l(i.sheetData)?.row).forEach((g,E)=>{const D=(x(g,"r")??E+1)-1;(x(g,"outlineLevel")??0)>0&&(h=!0);const G=x(g,"ht"),_=x(g,"s"),V={row:D};G!==void 0&&k(g,"customHeight")===!0&&(V.height=$e(G)),k(g,"hidden")===!0&&(V.hidden=!0),_!==void 0&&_!==0&&k(g,"customFormat")===!0&&(V.style=_),Object.keys(V).length>1&&u.push(V)});const v=b(l(i.mergeCells)?.mergeCell).flatMap(g=>{const E=z(d(g,"ref")??"");return E?[E]:[]}),p=b(l(i.sheetViews)?.sheetView)[0],y=l(p?.pane);let $;const T=d(y,"state");if(T==="frozen"||T==="frozenSplit"){const g=K(d(p,"topLeftCell")??"A1")??{row:0,col:0};$={row:g.row+(x(y,"ySplit")??0),col:g.col+(x(y,"xSplit")??0)}}const O=o.rels(e).filter(g=>g.type==="table").flatMap(g=>{const E=Le(o.xml(g.target));return E?[E]:[]}),R=C(l(l(i.sheetPr)?.tabColor),r),I=He(t,i,m.rich);h&&I.push(`${t}: its grouped rows or columns, left ungrouped`);const w=Me(i,a,r),S=Ve(i);for(const g of w.unread)I.push(`${t}: a conditional format, ${g}`);for(const g of S.unread)I.push(`${t}: a data validation, ${g}`);const A=l(i.autoFilter),j=z(d(A,"ref")??""),N=A&&j?{ref:j,...oe(A)}:void 0;N&&N.unread>0&&I.push(`${t}: ${H(N.unread,"filter")} by condition on ${d(A,"ref")??""}, its rows left as they were hidden`);const se=qe(o,e,t,f,u,I);return{sheet:{name:t,state:n,cells:m.cells,merges:v,...$?{freeze:$}:{},...d(p,"showGridLines")==="0"?{gridlines:!1}:{},...R===void 0?{}:{tab:R},columns:f,rows:u,tables:O,conditional:w.rules,validations:S.rules,scenarios:b(l(i.scenarios)?.scenario).map(g=>({name:d(g,"name")??"",cells:b(g.inputCells).map(E=>({at:d(E,"r")??"",value:d(E,"val")??""}))})),...N?{filter:N}:{},charts:se},lost:I}}const Be=64,We=20;function qe(o,e,t,n,s,r){const a=m=>n.find(f=>m>=f.min&&m<=f.max)?.width??Be,c=m=>s.find(f=>f.row===m)?.height??We,i=[];for(const m of o.rels(e).filter(f=>f.type==="drawing")){const{anchors:f}=xe(o.xml(m.target),a,c),u=o.rels(m.target);for(const h of f){const v=u.find($=>$.id===h.id),p=ye(v?o.xml(v.target):void 0),y=J(h.at);if(typeof p=="string"){r.push(`${t}: the chart at ${y}, as ${p}`);continue}i.push({...p,at:y,...h.x===void 0?{}:{x:h.x},...h.y===void 0?{}:{y:h.y},...h.width===Y.width?{}:{width:h.width},...h.height===Y.height?{}:{height:h.height}})}}return i}export function readXlsx(o){let e;try{e=new Se(o)}catch{throw new Error("It is not a zip file, as an .xlsx file is.")}const n=e.rels("").find(w=>w.type==="officeDocument")?.target??"xl/workbook.xml";if(n.endsWith(".bin"))throw new Error("It is a binary workbook (.xlsb): save it as .xlsx.");const s=e.xml(n),r=l(s?.workbook);if(!r)throw new Error("It has no workbook part.");const a=e.rels(n),c=w=>a.find(S=>S.type===w)?.target,i=(()=>{const w=c("theme");return w===void 0?void 0:e.text(w)})(),m=i===void 0?be:ge(i),f=c("styles"),u=f===void 0?void 0:e.xml(f),h=Re(u,m),v=ee(m,l(u?.styleSheet)),p=Ee(e,c("sharedStrings")),y=[..._e(e)];for(const w of h.lost)y.push(w);const $=l(r.workbookPr),T=l(r.calcPr);k(T,"iterate")===!0&&y.push("iterative calculation");const O=l(r.workbookProtection);(k(O,"lockStructure")===!0||k(O,"lockWindows")===!0)&&y.push("the workbook's protection"),r.fileSharing!==void 0&&y.push("its write protection");const R=[],I=new Map(a.map(w=>[w.id,w]));for(const w of b(l(r.sheets)?.sheet)){const S=I.get(d(w,"id")??""),A=L(d(w,"name")??"");if(S?.type!=="worksheet"){S?.type!=="chartsheet"&&S?.type!=="dialogsheet"&&y.push(`${A}: a sheet of a kind this cannot read`);continue}const j=d(w,"state"),N=Pe(e,S.target,A,j==="hidden"||j==="veryHidden"?j:"visible",p,v,h.dxfs);R.push(N.sheet),y.push(...N.lost)}return{sheets:R,names:b(l(r.definedNames)?.definedName).map(w=>{const S=x(w,"localSheetId");return{name:d(w,"name")??"",text:L(F(w)),...S===void 0?{}:{sheet:S}}}),looks:h.looks,dxfs:h.dxfs,date1904:k($,"date1904")===!0,font:h.font,lost:y}}
2
+ import{ZipLimitError as ve}from"@allyhub-next/formats";import{SHEET_ICONS as Se,SHEET_MARGINS as de,SHEET_OPERATORS as Ce,SHEET_PAPERS as Ee,SHEET_VALIDATIONS as Ne}from"@allyhub-next/formats";import{MAX_COLUMNS as q,MAX_ROWS as K,cellName as Y,columnLetter as Ae,readAddress as Oe,readArea as G,readAreas as ee}from"../address.js";import{SHEET_CHART_DEFAULTS as ce}from"../chart.js";import{moveFormula as Te,relativeKey as Ie}from"../formula/move.js";import{printFormula as fe}from"../formula/print.js";import{ERR as Le,errorOf as Re,serialOfDate as Me}from"../values.js";import{OFFICE_THEME as Fe,colorOf as F,paletteOf as le,themeColors as De}from"./colors.js";import{chartAnchors as je,readChart as Pe}from"./charts.js";import{isRangeText as ze,readFileFormula as te}from"./formula.js";import{BUILTIN_FORMATS as _e}from"./numfmt.js";import{XmlStream as ue}from"./sax.js";import{attr as u,flag as v,numberAttr as k,readXml as he,readXstring as A,tag as d,tags as x,textOf as E}from"./xml.js";import{ZipIn as He}from"./zip.js";const pe=7,Ve=r=>Math.floor((256*r+Math.floor(128/pe))/256*pe),Ue=r=>Math.round(r*4/3),ne=5;export function placesLine(r){const e=r.slice(0,ne).join(", ");return r.length>ne?`${e} and ${String(r.length-ne)} more`:e}const H=(r,e,t=`${e}s`)=>`${String(r)} ${r===1?e:t}`;export const GRID_END=`Excel's grid ends at ${Ae(q-1)}${String(K)} (${K.toLocaleString("en-US")} rows, ${q.toLocaleString("en-US")} columns)`;function We(r,e){let t=0,n=0;const o=r.length;for(;t<o;t++){const i=r.charCodeAt(t),c=i>=65&&i<=90,a=i>=97&&i<=122;if(!c&&!a)break;n=n*26+(c?i-64:i-96)}if(t===0||t===o)return;let s=0;for(let i=t;i<o;i++){const c=r.charCodeAt(i);if(c<48||c>57)return;s=s*10+c-48}if(s!==0){if(t>3||n>q||s>K)throw new Error(`${e} has a cell at ${r}, and ${GRID_END}.`);return{row:s-1,col:n-1}}}class Be{zip;constructor(e,t){this.zip=new He(e,t)}get names(){return this.zip.names}has(e){return this.zip.has(e)}text(e){return this.zip.text(e)}bytes(e){return this.zip.bytesOf(e)}xml(e){const t=this.text(e);return t===void 0?void 0:he(t)}stream(e,t){const n=this.zip.streamText(e,o=>{t.push(o)});return n&&t.end(),n}rels(e){const t=e.lastIndexOf("/"),n=`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`,o=this.xml(n);return x(d(o?.Relationships)?.Relationship).map(s=>{const i=u(s,"Type")??"",c=u(s,"Target")??"",a=u(s,"TargetMode")==="External";return{id:u(s,"Id")??"",type:i.slice(i.lastIndexOf("/")+1),target:a?c:Xe(e,c),external:a}})}count(e){return this.names.filter(t=>e.test(t)).length}}function Xe(r,e){if(e.startsWith("/"))return e.slice(1);const t=r.split("/").slice(0,-1);for(const n of e.split("/"))n===".."?t.pop():n!=="."&&t.push(n);return t.join("/")}function qe(r,e){const t=[];if(e===void 0)return t;let n,o=0,s=!1;const i={open(c){if(c==="si"){n={text:"",rich:!1};return}if(n){if(o>0||c==="rPh"||c==="phoneticPr"||c==="extLst"){o+=1;return}c==="r"&&(n.rich=!0),c==="t"&&(s=!0)}},close(c){if(o>0){o-=1;return}if(c==="si"){n&&t.push({...n,text:A(n.text)}),n=void 0;return}c==="t"&&(s=!1)},text(c){n&&s&&o===0&&(n.text+=c)}};return r.stream(e,new ue(i)),t}function W(r,e){const t=r[e];if(t===void 0)return!1;const n=u(d(t),"val");return n===void 0||n!=="0"&&n!=="false"}const Ge=new Set(["double","singleAccounting","doubleAccounting"]);function Ze(r,e,t){const n={},o=(a,l)=>u(d(a?.[l]),"val");if(W(r,"b")&&(n.bold=!0),W(r,"i")&&(n.italic=!0),W(r,"strike")&&(n.strike=!0),W(r,"u")){const a=o(r,"u");n.underline=a!==void 0&&Ge.has(a)?a:!0}const s=o(r,"name");s!==void 0&&s!==o(e,"name")&&(n.font=s);const i=o(r,"sz");i!==void 0&&i!==o(e,"sz")&&(n.size=Number(i));const c=F(d(r.color),t);return c!==void 0&&c!==F(d(e?.color),t)&&(n.color=c),n}function Je(r,e){const t=d(r.patternFill),n=u(t,"patternType");if(n===void 0||n==="none")return;const o=F(d(t?.fgColor),e),s=F(d(t?.bgColor),e);return n==="solid"&&o!==void 0?o:{pattern:n,...o===void 0?{}:{color:o},...s===void 0?{}:{background:s}}}function me(r,e){const t={};for(const n of["left","right","top","bottom"]){const o=d(r[n]),s=u(o,"style");if(s===void 0||s==="none")continue;const i=F(d(o?.color),e);t[n]={style:s,...i===void 0?{}:{color:i}}}return Object.keys(t).length===0?void 0:t}function Ke(r){const e={},t=u(r,"horizontal");t!==void 0&&t!=="general"&&(e.align=t);const n=u(r,"vertical");n!==void 0&&n!=="bottom"&&(e.valign=n),v(r,"wrapText")===!0&&(e.wrap=!0),v(r,"shrinkToFit")===!0&&(e.shrink=!0);const o=k(r,"indent");o!==void 0&&o>0&&(e.indent=o);const s=k(r,"textRotation");return s!==void 0&&s>0&&s<=180&&(e.rotation=s),e}function ge(r,e){const t={},n=d(r.font);if(n){const a=(f,p)=>{n[f]!==void 0&&(t[p]=W(n,f))};a("b","bold"),a("i","italic"),a("strike","strike"),n.u!==void 0&&(t.underline=W(n,"u"));const l=F(d(n.color),e);l!==void 0&&(t.color=l)}const o=d(d(r.fill)?.patternFill),s=F(d(o?.bgColor),e)??F(d(o?.fgColor),e);s!==void 0&&(t.fill=s);const i=d(r.border),c=i&&me(i,e);return c!==void 0&&(t.border=c),t}function Qe(r,e){const t=d(r?.styleSheet),n=le(e,t),o=new Map(x(d(t?.numFmts)?.numFmt).map(w=>[k(w,"numFmtId")??-1,u(w,"formatCode")??"General"])),s=x(d(t?.fonts)?.font),i=x(d(t?.fills)?.fill),c=x(d(t?.borders)?.border),a=x(d(t?.cellXfs)?.xf),l=s[k(a[0],"fontId")??0],f=new Set;i.some(w=>w.gradientFill!==void 0)&&f.add("gradient fills");const p=a.map(w=>{const m={},$=s[k(w,"fontId")??0];$&&(Object.assign(m,Ze($,l,n)),$.vertAlign!==void 0&&f.add("superscript and subscript"));const S=i[k(w,"fillId")??0],O=S&&Je(S,n);O!==void 0&&(m.fill=O);const T=c[k(w,"borderId")??0],z=T&&me(T,n);z!==void 0&&(m.border=z),T&&u(d(T.diagonal),"style")!==void 0&&f.add("diagonal borders");const D=d(w.alignment);D&&(Object.assign(m,Ke(D)),k(D,"textRotation")===255&&f.add("vertical text"));const I=k(w,"numFmtId")??0,M=o.get(I)??_e[I];return M!==void 0&&M!=="General"&&(m.format=M),m}),h=u(d(l?.name),"val"),b=u(d(l?.sz),"val");return{looks:p,dxfs:x(d(t?.dxfs)?.dxf).map(w=>ge(w,n)),font:{...h===void 0?{}:{name:h},...b===void 0?{}:{size:Number(b)}},lost:[...f]}}function be(r){const e=new Map;let t=0;for(const n of x(r.filterColumn)){const o=k(n,"colId")??0,s=d(n.filters);if(!s){Object.keys(n).some(c=>c!=="colId"&&c!=="hiddenButton")&&(t+=1);continue}if(s.dateGroupItem!==void 0){t+=1;continue}const i=x(s.filter).map(c=>A(u(c,"val")??""));e.set(o,{...i.length===0?{}:{values:i},...v(s,"blank")===!0?{blanks:!0}:{}})}return{columns:e,unread:t}}function Ye(r){const e=d(r?.table),t=G(u(e,"ref")??""),n=u(e,"displayName")??u(e,"name");if(!t||n===void 0)return;const o=d(e?.tableStyleInfo),s=d(e?.autoFilter);return{name:n,ref:t,headers:k(e,"headerRowCount")??1,totals:k(e,"totalsRowCount")??0,columns:x(d(e?.tableColumns)?.tableColumn).map(i=>({name:A(u(i,"name")??"").trim(),calculated:i.calculatedColumnFormula!==void 0})),style:u(o,"name")??"none",...s?{filter:be(s)}:{}}}function oe(r){const e=r.trim();if(e==="")return;const t=/^"((?:[^"]|"")*)"$/u.exec(e);if(t)return(t[1]??"").replaceAll('""','"');const n=Number(e);if(!Number.isNaN(n))return n;const o=te(e,!0);return o.ok?fe(o.node):void 0}const xe=r=>r!==void 0&&Ce.includes(r);function re(r){const e=u(r,"type")??"num",t=u(r,"val")??(r.f===void 0?void 0:E(r.f)),n=t===void 0?void 0:oe(t);return{at:e,...n===void 0?{}:{value:n}}}const et=Se,tt=r=>{const e=r.formula??r.f;return(Array.isArray(e)?e:e===void 0?[]:[e]).map(E)};function nt(r,e,t,n){const o=u(r,"type")??"",s={range:e,...v(r,"stopIfTrue")===!0?{stop:!0}:{}},i={...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.underline===void 0?{}:{underline:t.underline!==!1},...t.strike===void 0?{}:{strike:t.strike},...t.color===void 0?{}:{color:t.color},...typeof t.fill=="string"?{fill:t.fill}:{},...t.border===void 0?{}:{border:t.border}},c=tt(r);switch(o){case"cellIs":{const a=u(r,"operator"),l=c.flatMap(f=>{const p=oe(f);return p===void 0?[]:[p]});return!xe(a)||l.length===0?`a cellIs rule of ${a??"no operator"}`:{...s,...i,type:"cellIs",operator:a,formula:l}}case"containsText":case"notContainsText":case"beginsWith":case"endsWith":{const a=u(r,"text");return a===void 0?`a ${o} rule with no text`:{...s,...i,type:"containsText",...o==="containsText"?{}:{operator:o==="notContainsText"?"notContains":o},text:A(a)}}case"duplicateValues":case"uniqueValues":return{...s,...i,type:o};case"top10":return{...s,...i,type:"top10",rank:k(r,"rank")??10,...v(r,"percent")===!0?{percent:!0}:{},...v(r,"bottom")===!0?{bottom:!0}:{}};case"aboveAverage":return{...s,...i,type:"aboveAverage",...v(r,"aboveAverage")===!1?{below:!0}:{},...v(r,"equalAverage")===!0?{equal:!0}:{}};case"expression":{const a=c[0]===void 0?void 0:te(c[0],!0);return a?.ok?{...s,...i,type:"expression",formula:fe(a.node)}:"an expression rule that cannot be read"}case"dataBar":{const a=d(r.dataBar),l=F(d(a?.color??a?.fillColor),n),[f,p]=x(a?.cfvo).map(re);return l===void 0?"a data bar with no colour":{...s,type:"dataBar",color:l,...f&&f.at!=="min"?{min:f}:{},...p&&p.at!=="max"?{max:p}:{},...v(a,"showValue")===!1?{show:!1}:{}}}case"colorScale":{const a=d(r.colorScale),l=x(a?.cfvo).map(re),f=x(a?.color).map(h=>F(h,n)),p=l.flatMap((h,b)=>{const w=f[b];return w===void 0?[]:[{...h,color:w}]});return p.length<2?"a colour scale with too few stops":{...s,type:"colorScale",stops:p.slice(0,3)}}case"iconSet":{const a=d(r.iconSet),l=u(a,"iconSet")??"3TrafficLights1";if(!et.includes(l))return`the icon set ${l}`;if(a?.cfIcon!==void 0)return"an icon set of icons chosen one by one";const f=x(a?.cfvo).map(re);return{...s,type:"iconSet",icons:l,...f.length>=3?{stops:f.slice(0,5)}:{},...v(a,"reverse")===!0?{reverse:!0}:{},...v(a,"showValue")===!1?{show:!1}:{}}}default:return`a ${o} rule`}}const we={conditional:"{78C0D931-6437-407d-A8EE-F0AAD7539E65}",validations:"{CCE6A557-97BC-4b89-ADB6-D9C93CAAB3DF}"},ye=(r,e)=>x(d(r.extLst)?.ext).find(t=>u(t,"uri")?.toUpperCase()===e.toUpperCase());function ot(r,e,t){const n=[],o=[],s=new Set,i=(a,l,f)=>{const p=nt(a,l,f,t);typeof p=="string"?o.push(`${p} on ${l}`):n.push({priority:k(a,"priority")??0,rule:p})};for(const a of x(r.conditionalFormatting)){const l=u(a,"sqref")??"";if(!ee(l)){o.push(`a rule on ${l}`);continue}for(const f of x(a.cfRule)){const p=E(d(d(f.extLst)?.ext)?.id);p!==""&&s.add(p.toUpperCase());const h=k(f,"dxfId");i(f,l,h===void 0?{}:e[h]??{})}}const c=d(ye(r,we.conditional)?.conditionalFormattings);for(const a of x(c?.conditionalFormatting)){const l=E(a.sqref).trim();for(const f of x(a.cfRule)){if(s.has((u(f,"id")??"").toUpperCase()))continue;if(!ee(l)){o.push(`a rule on ${l}`);continue}const p=d(f.dxf);i(f,l,p?ge(p,t):{})}}return{rules:n.sort((a,l)=>a.priority-l.priority).map(a=>a.rule),unread:o}}const rt=Ne;function $e(r,e,t,n){const o=u(r,"type")??"none";if(o==="none"&&u(r,"prompt")===void 0)return;if(!rt.includes(o)||!ee(e))return`a ${o} rule on ${e}`;const s=/^"((?:[^"]|"")*)"$/u.exec(t.trim()),i=o==="list"&&s?(s[1]??"").replaceAll('""','"').split(","):void 0,c=[t,n].flatMap(w=>{const m=oe(w);return m===void 0?[]:[m]}),a=u(r,"operator"),l=w=>Object.fromEntries(Object.entries(w).filter(([,m])=>m!==void 0)),f=l({title:u(r,"promptTitle"),message:u(r,"prompt")}),p=l({style:u(r,"errorStyle"),title:u(r,"errorTitle"),message:u(r,"error")}),h=v(r,"showInputMessage")!==!0,b=v(r,"showErrorMessage")!==!0;return{range:e,type:o,...xe(a)&&a!=="between"?{operator:a}:{},...i?{values:i}:{formula:c},...v(r,"allowBlank")===!0?{}:{blank:!1},...v(r,"showDropDown")===!0?{dropdown:!1}:{},...h||Object.keys(f).length>0?{prompt:{...f,...h?{show:!1}:{}}}:{},...b||Object.keys(p).length>0?{error:{...p,...b?{show:!1}:{}}}:{}}}function st(r){const e=[],t=[],n=s=>{typeof s=="string"?t.push(s):s&&e.push(s)};for(const s of x(d(r.dataValidations)?.dataValidation))n($e(s,u(s,"sqref")??"",E(s.formula1),E(s.formula2)));const o=d(ye(r,we.validations)?.dataValidations);for(const s of x(o?.dataValidation))n($e(s,E(s.sqref).trim(),E(d(s.formula1)?.f),E(d(s.formula2)?.f)));return{rules:e,unread:t}}function it(r){const e=/^(-?\d{4,})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(\.\d+)?)?)?(?:Z|[+-]\d{2}:?\d{2})?$/u.exec(r)??/^()()()(\d{2}):(\d{2})(?::(\d{2})(\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/u.exec(r);if(!e)return;const t=e[1]==="",n=t?1899:Number(e[1]),o=t?12:Number(e[2]),s=t?30:Number(e[3]),i=Number(e[4]??0)*3600+Number(e[5]??0)*60+Number(e[6]??0)+Number(e[7]??0),c=new Date(Date.UTC(n,o-1,s)+i*1e3);if(Number.isNaN(c.getTime()))return;const a=Me(c);return t?a-Math.floor(a):a}function se(r,e,t){const n=te(r,e,t);return n.ok?{node:n.node}:{unread:r}}class at{cells=[];rows=[];rich=[];outlined=!1;rest=[];xml;masters=new Map;strings;name;isRangeName;inData=!1;row=-1;nextRow=0;nextCol=0;cell;target;buffer="";skip=0;constructor(e,t,n){this.strings=e,this.name=t,this.isRangeName=n,this.xml=new ue(this),this.xml.capture=this.rest}open(e,t){if(!this.inData){e==="sheetData"&&(this.inData=!0,this.xml.capture=void 0);return}const n=this.cell;if(n){if(this.skip>0){this.skip+=1;return}switch(e){case"v":this.target="v",this.buffer="";return;case"f":n.f={...t,text:""},this.target="f",this.buffer="";return;case"is":n.inline={text:"",rich:!1};return;case"r":n.inline&&(n.inline.rich=!0);return;case"t":n.inline&&(this.target="t",this.buffer="");return;case"rPh":case"phoneticPr":case"extLst":this.skip=1;return;default:return}}e==="row"?this.openRow(t):e==="c"&&(this.cell={r:t.r,s:t.s,t:t.t,cm:t.cm,v:void 0,f:void 0,inline:void 0})}close(e){if(!this.inData)return;const t=this.cell;if(!t){e==="sheetData"&&(this.inData=!1,this.xml.capture=this.rest);return}if(this.skip>0){this.skip-=1;return}if(e===this.target){e==="v"?t.v=this.buffer:e==="f"&&t.f?t.f.text=this.buffer:t.inline&&(t.inline.text+=this.buffer),this.target=void 0;return}e==="c"&&(this.cell=void 0,this.readCell(t))}text(e){this.target!==void 0&&this.skip===0&&(this.buffer+=e)}openRow(e){const t=e.r,n=t===void 0?void 0:Number(t);if(n!==void 0&&Number.isInteger(n)&&n>K)throw new Error(`${this.name} has a row ${t??""}, and ${GRID_END}.`);const o=n!==void 0&&Number.isInteger(n)&&n>0?n-1:this.nextRow;this.row=o,this.nextRow=o+1,this.nextCol=0;const s={row:o},i=e.ht===void 0?void 0:Number(e.ht),c=f=>f==="1"||f==="true";i!==void 0&&Number.isFinite(i)&&c(e.customHeight)&&(s.height=Ue(i)),c(e.hidden)&&(s.hidden=!0);const a=e.s===void 0?void 0:Number(e.s);a!==void 0&&a!==0&&c(e.customFormat)&&(s.style=a);const l=Number(e.outlineLevel??0);l>0&&(s.level=Math.min(7,l),this.outlined=!0),Object.keys(s).length>1&&this.rows.push(s)}value(e,t){const n=e.t??"n";if(n==="inlineStr"){const s=e.inline;return s?{value:A(s.text),...s.rich?{rich:!0}:{}}:{value:e.v===void 0?"":A(e.v)}}const o=e.v;if(o===void 0)return{value:void 0};switch(n){case"s":{const s=this.strings[Number(o)];return s?{value:s.text,...s.rich?{rich:!0}:{}}:{value:""}}case"str":return{value:A(o)};case"b":return{value:o.trim()==="1"||o.trim()==="true"};case"e":return{value:Re(o.trim())??Le.VALUE};case"d":return{value:it(o.trim())??o};default:{if(o.trim()==="")return{value:void 0};const s=Number(o);if(Number.isNaN(s))throw new Error(`${t} says it holds a number and holds ${o}.`);return{value:s}}}}formula(e,t,n,o){const s=e.f;if(s===void 0)return;const i=s.t??"normal",c=s.text;if(i==="dataTable"){o.unread=`a data table's {=TABLE(${s.r1??""})}`;return}if(i==="array"){Object.assign(o,se(c,!0,this.isRangeName));const a=G(s.ref??"");a&&(o.array=a),e.cm!==void 0&&(o.dynamic=!0);return}if(i==="shared"){const a=s.si??"";if(c!==""){const f=se(c,!1,this.isRangeName),p=f.node?Ie(f.node,t,n):"";this.masters.set(a,{node:f.node,unread:f.unread,row:t,col:n,key:p}),Object.assign(o,f),f.node&&(o.key=p);return}const l=this.masters.get(a);if(!l){o.unread=`a shared formula of a group that has no first cell (${a})`;return}l.node?(o.node=Te(l.node,t-l.row,n-l.col),o.key=l.key):l.unread!==void 0&&(o.unread=l.unread);return}c!==""&&Object.assign(o,se(c,!1,this.isRangeName))}readCell(e){const t=e.r===void 0?void 0:We(e.r,this.name),n=t?.row??this.row,o=t?.col??this.nextCol;if(o>=q)throw new Error(`${this.name} has a cell past its last column, and ${GRID_END}.`);this.nextCol=o+1;const s=e.r??Y({row:n,col:o}),{value:i,rich:c}=this.value(e,s),a={row:n,col:o,value:i,style:e.s===void 0?0:Number(e.s)||0};c===!0&&(a.rich=!0,this.rich.push(s)),this.formula(e,n,o,a),this.cells.push(a)}}function dt(r,e,t){const n=[],o=p=>n.push(`${r}: ${p}`);t.length>0&&o(`${H(t.length,"cell")} of rich text, kept as plain text (${placesLine(t)})`);const s=x(d(e.hyperlinks)?.hyperlink).filter(p=>u(p,"tooltip")!==void 0);s.length>0&&o(`the tooltips of ${H(s.length,"link")} (${placesLine(s.map(p=>u(p,"ref")??""))})`),e.sortState!==void 0&&o("a sort");const i=d(e.sheetProtection);v(i,"sheet")===!0&&(u(i,"password")!==void 0||u(i,"hashValue")!==void 0)&&o("its protection's password: it is protected with none"),e.protectedRanges!==void 0&&o("protected ranges");const c=d(e.headerFooter);(c?.evenHeader!==void 0||c?.evenFooter!==void 0||c?.firstHeader!==void 0||c?.firstFooter!==void 0)&&o("its print header and footer of the first or even pages");const a=d(e.printOptions);a&&["gridLines","headings","horizontalCentered","verticalCentered"].some(p=>v(a,p)===!0)&&o("its print options (gridlines, headings, centring)"),(e.rowBreaks!==void 0||e.colBreaks!==void 0)&&o("its page breaks"),e.oleObjects!==void 0&&o("embedded objects"),e.controls!==void 0&&o("form controls"),e.dataConsolidate!==void 0&&o("a consolidation"),e.customSheetViews!==void 0&&o("custom views"),x(d(e.sheetViews)?.sheetView).some(p=>u(d(p.pane),"state")==="split")&&o("a split, not frozen, window");const f=JSON.stringify(e.extLst??"");return f.includes("sparklineGroups")&&o("sparklines"),f.includes("slicerList")&&o("slicers"),n}function ct(r,e){const t=[],n=(s,i,c)=>{const a=r.count(s);a>0&&t.push(H(a,i,c))};r.has("xl/vbaProject.bin")&&t.push("VBA macros"),n(/^xl\/pivotTables\/pivotTable\d*\.xml$/u,"pivot table"),n(/^xl\/chartsheets\/[^/]+\.xml$/u,"chart sheet"),n(/^xl\/dialogsheets\/[^/]+\.xml$/u,"dialog sheet"),n(/^xl\/macrosheets\/[^/]+\.xml$/u,"macro sheet");const o=r.names.filter(s=>s.startsWith("xl/media/")&&!e.has(s)).length;return o>0&&t.push(H(o,"image")),n(/^xl\/embeddings\//u,"embedded object"),n(/^xl\/slicers\/[^/]+\.xml$/u,"slicer part"),n(/^xl\/timelines\/[^/]+\.xml$/u,"timeline part"),n(/^xl\/ctrlProps\/[^/]+\.xml$/u,"form control"),n(/^xl\/activeX\/[^/]+\.xml$/u,"ActiveX control"),n(/^xl\/queryTables\/[^/]+\.xml$/u,"query table"),r.has("xl/connections.xml")&&t.push("data connections"),r.names.some(s=>s.startsWith("xl/richData/"))&&t.push("rich values (data types, pictures in cells)"),r.names.some(s=>/^customXml\/item\d+\.xml$/u.test(s)&&(r.text(s)??"").includes("DataMashup"))&&t.push("Power Query queries"),t}export function readHeaderFooter(r){const e={left:"",center:"",right:""};let t="center",n=new Set;for(let o=0;o<r.length;o++){const s=r[o],i=r[o+1];if(s==="&"&&(i==="L"||i==="C"||i==="R")){t=i==="L"?"left":i==="C"?"center":"right",n=new Set([...n,t]),o+=1;continue}if(s==="&"&&i==="&"){e[t]+="&&",o+=1;continue}e[t]+=s??""}return Object.fromEntries(Object.entries(e).filter(([o,s])=>s!==""||n.has(o)))}const ft=new Map(Object.entries(Ee).map(([r,e])=>[e,r]));function lt(r,e,t){const n={},o=d(r.pageSetup),s=u(o,"orientation");(s==="portrait"||s==="landscape")&&(n.orientation=s);const i=k(o,"paperSize");if(i!==void 0){const h=ft.get(i);h?n.paper=h:t.push(`${e}: its paper size, Excel's number ${String(i)}`)}v(d(d(r.sheetPr)?.pageSetUpPr),"fitToPage")===!0&&(n.fit={width:k(o,"fitToWidth")??1,height:k(o,"fitToHeight")??1});const c=d(r.pageMargins),a={};for(const h of Object.keys(de)){const b=k(c,h);b!==void 0&&b!==de[h]&&(a[h]=b)}Object.keys(a).length>0&&(n.margins=a);const l=d(r.headerFooter),f=E(l?.oddHeader),p=E(l?.oddFooter);return f!==""&&(n.header=readHeaderFooter(A(f))),p!==""&&(n.footer=readHeaderFooter(A(p))),n}function ut(r,e,t,n,o){const s=r.rels(e),i=new Map;for(const a of s.filter(l=>l.type==="comments")){const l=d(r.xml(a.target)?.comments),f=d(l?.authors)?.author,p=(Array.isArray(f)?f:f===void 0?[]:[f]).map(h=>A(E(h)));for(const h of x(d(l?.commentList)?.comment)){const b=u(h,"ref")??"",w=d(h.text),m=x(w?.r),$=A(m.length>0?m.map(O=>E(O.t)).join(""):E(w?.t)),S=p[k(h,"authorId")??-1];b!==""&&$!==""&&i.set(b,{ref:b,text:$,...S===void 0||S===""?{}:{author:S}})}}let c=0;for(const a of s.filter(l=>l.type==="threadedComment")){const l=d(r.xml(a.target)?.ThreadedComments),f=new Map;for(const p of x(l?.threadedComment)){const h=u(p,"ref")??"",b=A(E(p.text)),w=f.get(h)??{texts:[]};if(w.texts.length===0){const m=n.get(u(p,"personId")??"");m!==void 0&&(w.author=m)}w.texts.push(b),f.set(h,w)}for(const[p,h]of f)c+=1,i.set(p,{ref:p,text:h.texts.join(`
3
+ `),...h.author===void 0?{}:{author:h.author}})}return c>0&&o.push(`${t}: ${H(c,"threaded comment")}, kept as notes, replies after the first line`),[...i.values()]}function ht(r,e,t,n,o,s,i,c,a,l){const f=new at(o,t,a);if(!r.stream(e,f.xml))throw new Error(`${e} is not in the file.`);const p=he(f.rest.join("")),h=d(p.worksheet);if(!h)throw new Error(`${e} is not a worksheet.`);const b=x(d(h.cols)?.col).map(y=>{const C=k(y,"width"),R=k(y,"style"),P=k(y,"outlineLevel")??0,L=(k(y,"min")??1)-1,ie=(k(y,"max")??1)-1;if(ie>=q)throw new Error(`${t} sets a column past its last, and ${GRID_END}.`);const ae=v(y,"customWidth"),Q=C===void 0?void 0:Ve(C);return{min:L,max:ie,...Q!==void 0&&(ae===!0||ae===void 0&&Q!==ke)?{width:Q}:{},...v(y,"hidden")===!0?{hidden:!0}:{},...R===void 0||R===0?{}:{style:R},...P>0?{level:Math.min(7,P)}:{}}}),w=x(d(h.mergeCells)?.mergeCell).flatMap(y=>{const C=G(u(y,"ref")??"");return C?[C]:[]}),m=x(d(h.sheetViews)?.sheetView)[0],$=d(m?.pane);let S;const O=u($,"state");if(O==="frozen"||O==="frozenSplit"){const y=Oe(u(m,"topLeftCell")??"A1")??{row:0,col:0};S={row:y.row+(k($,"ySplit")??0),col:y.col+(k($,"xSplit")??0)}}const T=r.rels(e),z=T.filter(y=>y.type==="table").flatMap(y=>{const C=Ye(r.xml(y.target));return C?[C]:[]}),D=F(d(d(h.sheetPr)?.tabColor),s),I=dt(t,h,f.rich),M=ot(h,i,s),B=st(h);for(const y of M.unread)I.push(`${t}: a conditional format, ${y}`);for(const y of B.unread)I.push(`${t}: a data validation, ${y}`);const V=d(h.autoFilter),Z=G(u(V,"ref")??""),j=V&&Z?{ref:Z,...be(V)}:void 0;j&&j.unread>0&&I.push(`${t}: ${H(j.unread,"filter")} by condition on ${u(V,"ref")??""}, its rows left as they were hidden`);const{charts:X,pictures:J}=mt(r,e,t,b,f.rows,I,l),U={},g=new Map(T.map(y=>[y.id,y]));for(const y of x(d(h.hyperlinks)?.hyperlink)){const C=u(y,"ref");if(C===void 0)continue;const R=u(y,"location"),P=u(y,"id"),L=P===void 0?void 0:g.get(P)?.target;L!==void 0?U[C]=R===void 0?L:`${L}#${R}`:R!==void 0&&(U[C]=`#${R}`)}const N=d(h.sheetProtection),_=lt(h,t,I);return{sheet:{name:t,state:n,cells:f.cells,merges:w,...S?{freeze:S}:{},...u(m,"showGridLines")==="0"?{gridlines:!1}:{},...D===void 0?{}:{tab:D},columns:b,rows:f.rows,tables:z,conditional:M.rules,validations:B.rules,scenarios:x(d(h.scenarios)?.scenario).map(y=>({name:u(y,"name")??"",cells:x(y.inputCells).map(C=>({at:u(C,"r")??"",value:u(C,"val")??""}))})),...j?{filter:j}:{},charts:X,links:U,notes:ut(r,e,t,c,I),pictures:J,...v(N,"sheet")===!0?{protect:!0}:{},...Object.keys(_).length>0?{print:_}:{}},lost:I}}const ke=64,pt=20;function mt(r,e,t,n,o,s,i){const c=h=>n.find(b=>h>=b.min&&h<=b.max)?.width??ke,a=new Map(o.map(h=>[h.row,h.height])),l=h=>a.get(h)??pt,f=[],p=[];for(const h of r.rels(e).filter(b=>b.type==="drawing")){const b=je(r.xml(h.target),c,l),w=r.rels(h.target);for(const m of b.anchors){const $=w.find(T=>T.id===m.id),S=Pe($?r.xml($.target):void 0),O=Y(m.at);if(typeof S=="string"){s.push(`${t}: the chart at ${O}, as ${S}`);continue}f.push({...S,at:O,...m.x===void 0?{}:{x:m.x},...m.y===void 0?{}:{y:m.y},...m.width===ce.width?{}:{width:m.width},...m.height===ce.height?{}:{height:m.height}})}for(const m of b.pictures){const $=w.find(T=>T.id===m.id),S=$&&!$.external?r.bytes($.target):void 0;if(!$||!S){s.push(`${t}: the picture at ${Y(m.at)}, whose image is not in the file`);continue}i.add($.target);const O=$.target.slice($.target.lastIndexOf(".")+1).toLowerCase();p.push({row:m.at.row,col:m.at.col,...m.x===void 0?{}:{x:m.x},...m.y===void 0?{}:{y:m.y},width:m.width,height:m.height,...m.name===void 0?{}:{name:m.name},...m.descr===void 0?{}:{descr:m.descr},bytes:S,type:O})}b.others>0&&s.push(`${t}: ${H(b.others,"shape")} of its drawing`)}return{charts:f,pictures:p}}function gt(r,e,t){for(const n of r){if(n.sheet===void 0)continue;const o=e[n.sheet];if(!o)continue;const s=n.text.split(",").map(i=>i.slice(i.lastIndexOf("!")+1).replaceAll("$",""));if(n.name==="_xlnm.Print_Area"){const[i]=s;s.length>1&&t.push(`${o.name}: its print area's ranges after the first`),i!==void 0&&G(i)&&(o.print={...o.print,area:i})}else if(n.name==="_xlnm.Print_Titles")for(const i of s)/^\d+:\d+$/u.test(i)?o.print={...o.print,title_rows:i}:/^[A-Za-z]+:[A-Za-z]+$/u.test(i)&&(o.print={...o.print,title_cols:i})}}export function readXlsx(r,e){let t;try{t=new Be(r,e)}catch(g){throw g instanceof ve?g:new Error("It is not a zip file, as an .xlsx file is.")}const n=t.rels(""),o=n.find(g=>g.type==="officeDocument")?.target??"xl/workbook.xml";if(o.endsWith(".bin"))throw new Error("It is a binary workbook (.xlsb): save it as .xlsx.");const s=t.xml(o),i=d(s?.workbook);if(!i)throw new Error("It has no workbook part.");const c=t.rels(o),a=g=>c.find(N=>N.type===g)?.target,l=(()=>{const g=a("theme");return g===void 0?void 0:t.text(g)})(),f=l===void 0?Fe:De(l),p=a("styles"),h=p===void 0?void 0:t.xml(p),b=Qe(h,f),w=le(f,d(h?.styleSheet)),m=qe(t,a("sharedStrings")),$=[];for(const g of b.lost)$.push(g);const S=d(i.workbookPr),O=d(i.calcPr);v(O,"iterate")===!0&&$.push("iterative calculation");const T=d(i.workbookProtection);(v(T,"lockStructure")===!0||v(T,"lockWindows")===!0)&&$.push("the workbook's protection"),i.fileSharing!==void 0&&$.push("its write protection");const z=new Map,D=a("person");if(D!==void 0)for(const g of x(d(t.xml(D)?.personList)?.person))z.set(u(g,"id")??"",A(u(g,"displayName")??""));const I=x(d(i.definedNames)?.definedName).map(g=>{const N=k(g,"localSheetId");return{name:u(g,"name")??"",text:A(E(g)),...N===void 0?{}:{sheet:N},...v(g,"hidden")===!0?{hidden:!0}:{}}}),M=[],B=new Set,V=new Map(c.map(g=>[g.id,g])),Z=x(d(i.sheets)?.sheet);for(const[g,N]of Z.entries()){const _=V.get(u(N,"id")??""),y=A(u(N,"name")??"");if(_?.type!=="worksheet"){_?.type!=="chartsheet"&&_?.type!=="dialogsheet"&&$.push(`${y}: a sheet of a kind this cannot read`);continue}const C=new Map;for(const L of I)(L.sheet===void 0||L.sheet===g)&&(L.sheet!==void 0||!C.has(L.name.toLowerCase()))&&C.set(L.name.toLowerCase(),ze(L.text));const R=u(N,"state"),P=ht(t,_.target,y,R==="hidden"||R==="veryHidden"?R:"visible",m,w,b.dxfs,z,L=>C.get(L.toLowerCase())===!0,B);M[g]=P.sheet,$.push(...P.lost)}gt(I,M,$);const j=n.find(g=>g.type==="core-properties")?.target,X=j===void 0?void 0:E(d(t.xml(j)?.coreProperties)?.title).trim(),J=M.filter(g=>g!==void 0),U=new Map;return M.forEach((g,N)=>{g!==void 0&&U.set(N,J.indexOf(g))}),{sheets:J,names:I.flatMap(g=>{if(g.sheet===void 0)return[g];const N=U.get(g.sheet);return N===void 0?[]:[{...g,sheet:N}]}),looks:b.looks,dxfs:b.dxfs,date1904:v(S,"date1904")===!0,font:b.font,...X===void 0||X===""?{}:{title:X},lost:[...ct(t,B),...$]}}
@@ -0,0 +1,23 @@
1
+ export type XmlAttrs = Record<string, string>;
2
+ export interface XmlHandler {
3
+ open(name: string, attrs: XmlAttrs, empty: boolean): void;
4
+ close(name: string): void;
5
+ /** Text, its entities read. */
6
+ text(text: string): void;
7
+ }
8
+ /** Text with its entities read. */
9
+ export declare function unescapeXml(text: string): string;
10
+ /** An XML stream: text pushed in pieces, events out as soon as each is whole. */
11
+ export declare class XmlStream {
12
+ /** When set, the source text of each token is kept here as it is read. */
13
+ capture: string[] | undefined;
14
+ private buffer;
15
+ private readonly handler;
16
+ private depth;
17
+ constructor(handler: XmlHandler);
18
+ push(text: string): void;
19
+ end(): void;
20
+ private emitText;
21
+ private run;
22
+ }
23
+ //# sourceMappingURL=sax.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ const b={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};export function unescapeXml(r){return r.includes("&")?r.replace(/&(#x[0-9A-Fa-f]+|#\d+|[A-Za-z]+);/gu,(e,o)=>o.startsWith("#x")?String.fromCodePoint(Number.parseInt(o.slice(2),16)):o.startsWith("#")?String.fromCodePoint(Number.parseInt(o.slice(1),10)):b[o]??e):r}const d=r=>{const e=r.indexOf(":");return e<0?r:r.slice(e+1)},p=r=>r===32||r===9||r===10||r===13;function x(r,e,o){let i=0;const t=r.length;for(;i<t&&!p(r.charCodeAt(i));)i++;const f=d(r.slice(0,i)),c={};for(;i<t;){for(;i<t&&p(r.charCodeAt(i));)i++;if(i>=t)break;const h=r.indexOf("=",i);if(h<0)throw new Error(`An attribute of <${f}> has no value.`);const u=r.slice(i,h).trim();let l=h+1;for(;l<t&&p(r.charCodeAt(l));)l++;const a=r[l];if(a!=='"'&&a!=="'")throw new Error(`An attribute of <${f}> is not quoted.`);const s=r.indexOf(a,l+1);if(s<0)throw new Error(`An attribute of <${f}> is not closed.`);u!=="xmlns"&&!u.startsWith("xmlns:")&&(c[d(u)]=unescapeXml(r.slice(l+1,s))),i=s+1}return e.open(f,c,o),f}export class XmlStream{capture;buffer="";handler;depth=0;constructor(e){this.handler=e}push(e){this.buffer=this.buffer===""?e:this.buffer+e,this.run()}end(){if(this.run(),this.buffer.trim()!=="")throw new Error("The XML ends inside a tag or a comment.");if(this.depth>0)throw new Error("The XML ends before its elements do.")}emitText(e){e!==""&&(this.capture?.push(e),this.handler.text(unescapeXml(e)))}run(){const e=this.buffer,o=e.length;let i=0;for(;;){const t=e.indexOf("<",i);if(t<0){const s=e.lastIndexOf("&"),n=s>=i&&!e.includes(";",s)?s:o;this.emitText(e.slice(i,n)),i=n;break}t>i&&this.emitText(e.slice(i,t)),i=t;const f=e.charCodeAt(t+1);if(Number.isNaN(f))break;if(f===33){if(e.startsWith("<!--",t)){const n=e.indexOf("-->",t+4);if(n<0)break;this.capture?.push(e.slice(t,n+3)),i=n+3;continue}if(e.startsWith("<![CDATA[",t)){const n=e.indexOf("]]>",t+9);if(n<0)break;this.capture?.push(e.slice(t,n+3)),this.handler.text(e.slice(t+9,n)),i=n+3;continue}if(o-t<9)break;const s=e.indexOf(">",t);if(s<0)break;if(e.lastIndexOf("[",s)>t){const n=e.indexOf("]>",t);if(n<0)break;i=n+2}else i=s+1;continue}if(f===63){const s=e.indexOf("?>",t+2);if(s<0)break;this.capture?.push(e.slice(t,s+2)),i=s+2;continue}if(f===47){const s=e.indexOf(">",t+2);if(s<0)break;this.capture?.push(e.slice(t,s+1)),this.depth-=1,this.handler.close(d(e.slice(t+2,s).trim())),i=s+1;continue}let c=t+1,h=0;for(;c<o;c++){const s=e.charCodeAt(c);if(h!==0)s===h&&(h=0);else if(s===34||s===39)h=s;else if(s===62)break}if(c>=o)break;const u=e.charCodeAt(c-1)===47,l=e.slice(t,c+1),a=x(e.slice(t+1,u?c-1:c),this.handler,u);this.capture?.push(l),u?this.handler.close(a):this.depth+=1,i=c+1}this.buffer=i>=o?"":e.slice(i)}}
@@ -18,6 +18,8 @@ export declare class Styles {
18
18
  xf(look: CellLook): number;
19
19
  /** The differential format of what a rule gives a cell. */
20
20
  dxf(look: CellLook): number;
21
+ /** What a rule gives a cell, as an element of its own: Excel 2010's rules hold theirs. */
22
+ dxfXml(look: CellLook, name: string): string;
21
23
  xml(): string;
22
24
  }
23
25
  //# sourceMappingURL=styles.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{FIRST_CUSTOM as p,builtinId as g}from"./numfmt.js";import{NS as y,el as e}from"./xml.js";export const DEFAULT_FONT={name:"Calibri",size:11};const s=t=>`FF${t.slice(1).toUpperCase()}`;class l{items=[];index=new Map;add(n){const r=this.index.get(n);if(r!==void 0)return r;const i=this.items.length;return this.items.push(n),this.index.set(n,i),i}}function b(t){const{underline:n}=t;return e("font",{},t.bold===!0?"<b/>":"",t.italic===!0?"<i/>":"",t.strike===!0?"<strike/>":"",n===!0||n==="single"?"<u/>":n?e("u",{val:n}):"",e("sz",{val:t.size??DEFAULT_FONT.size}),t.color===void 0?e("color",{theme:1}):e("color",{rgb:s(t.color)}),e("name",{val:t.font??DEFAULT_FONT.name}),e("family",{val:2}),t.font===void 0?e("scheme",{val:"minor"}):"")}function x(t){const{pattern:n,color:r,background:i}=typeof t=="string"?{pattern:"solid",color:t,background:void 0}:t;return e("fill",{},e("patternFill",{patternType:n},r===void 0?"":e("fgColor",{rgb:s(r)}),i===void 0?n==="solid"?e("bgColor",{indexed:64}):"":e("bgColor",{rgb:s(i)})))}function f(t,n){return n?e(t,{style:n.style},n.color===void 0?e("color",{auto:1}):e("color",{rgb:s(n.color)})):e(t)}function h(t){return e("border",{},f("left",t.left),f("right",t.right),f("top",t.top),f("bottom",t.bottom),e("diagonal"))}function F(t){const{underline:n}=t,r=[t.bold===void 0?"":e("b",{val:t.bold}),t.italic===void 0?"":e("i",{val:t.italic}),t.strike===void 0?"":e("strike",{val:t.strike}),n===!0?"<u/>":"",t.color===void 0?"":e("color",{rgb:s(t.color)})].join(""),{fill:i,border:d}=t;return e("dxf",{},r===""?"":e("font",{},r),typeof i=="string"?e("fill",{},e("patternFill",{},e("bgColor",{rgb:s(i)}))):"",d?h(d):"")}const I=t=>t<0?90-t:t;function v(t){const n={horizontal:t.align,vertical:t.valign,textRotation:t.rotation===void 0?void 0:I(t.rotation),wrapText:t.wrap===!0?!0:void 0,indent:t.indent,shrinkToFit:t.shrink===!0?!0:void 0};return Object.values(n).every(r=>r===void 0)?"":e("alignment",n)}export class Styles{fonts=new l;fills=new l;borders=new l;formats=new Map;xfs=new l;byLook=new Map;dxfs=new l;constructor(){this.fonts.add(b({})),this.fills.add(e("fill",{},e("patternFill",{patternType:"none"}))),this.fills.add(e("fill",{},e("patternFill",{patternType:"gray125"}))),this.borders.add(e("border",{},e("left"),e("right"),e("top"),e("bottom"),e("diagonal"))),this.xfs.add(e("xf",{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}))}format(n){if(n===void 0)return 0;const r=g(n);if(r!==void 0)return r;let i=this.formats.get(n);return i===void 0&&(i=p+this.formats.size,this.formats.set(n,i)),i}xf(n){const r=JSON.stringify(n),i=this.byLook.get(r);if(i!==void 0)return i;const d=this.format(n.format),o=this.fonts.add(b(n)),a=n.fill===void 0?0:this.fills.add(x(n.fill)),u=n.border===void 0?0:this.borders.add(h(n.border)),c=v(n),m=this.xfs.add(e("xf",{numFmtId:d,fontId:o,fillId:a,borderId:u,xfId:0,applyNumberFormat:d===0?void 0:!0,applyFont:o===0?void 0:!0,applyFill:a===0?void 0:!0,applyBorder:u===0?void 0:!0,applyAlignment:c===""?void 0:!0},c));return this.byLook.set(r,m),m}dxf(n){return this.dxfs.add(F(n))}xml(){const n=(i,d)=>e(i,{count:d.length},...d),r=[...this.formats].map(([i,d])=>e("numFmt",{numFmtId:d,formatCode:i}));return e("styleSheet",{xmlns:y.main},r.length>0?n("numFmts",r):"",n("fonts",this.fonts.items),n("fills",this.fills.items),n("borders",this.borders.items),n("cellStyleXfs",[e("xf",{numFmtId:0,fontId:0,fillId:0,borderId:0})]),n("cellXfs",this.xfs.items),n("cellStyles",[e("cellStyle",{name:"Normal",xfId:0,builtinId:0})]),this.dxfs.items.length===0?e("dxfs",{count:0}):n("dxfs",this.dxfs.items),e("tableStyles",{count:0,defaultTableStyle:"TableStyleMedium2",defaultPivotStyle:"PivotStyleLight16"}))}}
2
+ import{FIRST_CUSTOM as g,builtinId as y}from"./numfmt.js";import{NS as x,el as n}from"./xml.js";export const DEFAULT_FONT={name:"Calibri",size:11};const s=t=>`FF${t.slice(1).toUpperCase()}`;class f{items=[];index=new Map;add(e){const i=this.index.get(e);if(i!==void 0)return i;const r=this.items.length;return this.items.push(e),this.index.set(e,r),r}}function b(t){const{underline:e}=t;return n("font",{},t.bold===!0?"<b/>":"",t.italic===!0?"<i/>":"",t.strike===!0?"<strike/>":"",e===!0||e==="single"?"<u/>":e?n("u",{val:e}):"",n("sz",{val:t.size??DEFAULT_FONT.size}),t.color===void 0?n("color",{theme:1}):n("color",{rgb:s(t.color)}),n("name",{val:t.font??DEFAULT_FONT.name}),n("family",{val:2}),t.font===void 0?n("scheme",{val:"minor"}):"")}function F(t){const{pattern:e,color:i,background:r}=typeof t=="string"?{pattern:"solid",color:t,background:void 0}:t;return n("fill",{},n("patternFill",{patternType:e},i===void 0?"":n("fgColor",{rgb:s(i)}),r===void 0?e==="solid"?n("bgColor",{indexed:64}):"":n("bgColor",{rgb:s(r)})))}function o(t,e){return e?n(t,{style:e.style},e.color===void 0?n("color",{auto:1}):n("color",{rgb:s(e.color)})):n(t)}function h(t){return n("border",{},o("left",t.left),o("right",t.right),o("top",t.top),o("bottom",t.bottom),n("diagonal"))}function p(t,e="dxf"){const{underline:i}=t,r=[t.bold===void 0?"":n("b",{val:t.bold}),t.italic===void 0?"":n("i",{val:t.italic}),t.strike===void 0?"":n("strike",{val:t.strike}),i===!0?"<u/>":"",t.color===void 0?"":n("color",{rgb:s(t.color)})].join(""),{fill:d,border:l}=t;return n(e,{},r===""?"":n("font",{},r),typeof d=="string"?n("fill",{},n("patternFill",{},n("bgColor",{rgb:s(d)}))):"",l?h(l):"")}const I=t=>t<0?90-t:t;function v(t){const e={horizontal:t.align,vertical:t.valign,textRotation:t.rotation===void 0?void 0:I(t.rotation),wrapText:t.wrap===!0?!0:void 0,indent:t.indent,shrinkToFit:t.shrink===!0?!0:void 0};return Object.values(e).every(i=>i===void 0)?"":n("alignment",e)}export class Styles{fonts=new f;fills=new f;borders=new f;formats=new Map;xfs=new f;byLook=new Map;dxfs=new f;constructor(){this.fonts.add(b({})),this.fills.add(n("fill",{},n("patternFill",{patternType:"none"}))),this.fills.add(n("fill",{},n("patternFill",{patternType:"gray125"}))),this.borders.add(n("border",{},n("left"),n("right"),n("top"),n("bottom"),n("diagonal"))),this.xfs.add(n("xf",{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}))}format(e){if(e===void 0)return 0;const i=y(e);if(i!==void 0)return i;let r=this.formats.get(e);return r===void 0&&(r=g+this.formats.size,this.formats.set(e,r)),r}xf(e){const i=JSON.stringify(e),r=this.byLook.get(i);if(r!==void 0)return r;const d=this.format(e.format),l=this.fonts.add(b(e)),a=e.fill===void 0?0:this.fills.add(F(e.fill)),u=e.border===void 0?0:this.borders.add(h(e.border)),m=v(e),c=this.xfs.add(n("xf",{numFmtId:d,fontId:l,fillId:a,borderId:u,xfId:0,applyNumberFormat:d===0?void 0:!0,applyFont:l===0?void 0:!0,applyFill:a===0?void 0:!0,applyBorder:u===0?void 0:!0,applyAlignment:m===""?void 0:!0},m));return this.byLook.set(i,c),c}dxf(e){return this.dxfs.add(p(e))}dxfXml(e,i){return p(e,i)}xml(){const e=(r,d)=>n(r,{count:d.length},d.join("")),i=[...this.formats].map(([r,d])=>n("numFmt",{numFmtId:d,formatCode:r}));return n("styleSheet",{xmlns:x.main},i.length>0?e("numFmts",i):"",e("fonts",this.fonts.items),e("fills",this.fills.items),e("borders",this.borders.items),e("cellStyleXfs",[n("xf",{numFmtId:0,fontId:0,fillId:0,borderId:0})]),e("cellXfs",this.xfs.items),e("cellStyles",[n("cellStyle",{name:"Normal",xfId:0,builtinId:0})]),this.dxfs.items.length===0?n("dxfs",{count:0}):e("dxfs",this.dxfs.items),n("tableStyles",{count:0,defaultTableStyle:"TableStyleMedium2",defaultPivotStyle:"PivotStyleLight16"}))}}
@@ -1,6 +1,12 @@
1
1
  import type { Calc } from "../calc/engine.js";
2
2
  /** A table's style when sheet.yaml names none. */
3
3
  export declare const DEFAULT_TABLE_STYLE = "TableStyleMedium2";
4
+ /**
5
+ * The very hidden sheet a list's choices are written in when a validation
6
+ * cannot spell them out: one holds a comma, a quote, or all of them more
7
+ * than 255 characters. A reader finds the choices again by this name.
8
+ */
9
+ export declare const LISTS_SHEET = "AllyHub lists";
4
10
  export interface WriteOptions {
5
11
  /** false leaves out what formulas compute: the file has to be computed by what opens it. */
6
12
  cached?: boolean;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{zipSync as se}from"fflate";import{cellName as R,columnIndex as ne,columnLetter as Y,rangeName as E}from"../address.js";import{parseFormula as oe}from"../formula/parse.js";import{sheetPrefix as re}from"../formula/print.js";import{fileCells as ie,isPicture as ae,pictureHeight as le,pictureSize as ce}from"../files.js";import{scenariosByCell as de}from"../scenario.js";import{CellError as P,readTyped as he}from"../values.js";import{FormulaCell as me}from"../workbook.js";import{chartPart as fe,drawingPart as ue}from"./charts.js";import{fileFormula as O,needsArray as V}from"./formula.js";import{Styles as pe}from"./styles.js";import{THEME_XML as ge}from"./theme.js";import{HEAD as g,NS as y,el as o,xstring as x}from"./xml.js";const $={sheet:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",worksheet:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",styles:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",strings:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",theme:"application/vnd.openxmlformats-officedocument.theme+xml",table:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",metadata:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",drawing:"application/vnd.openxmlformats-officedocument.drawing+xml",chart:"application/vnd.openxmlformats-officedocument.drawingml.chart+xml",core:"application/vnd.openxmlformats-package.core-properties+xml",app:"application/vnd.openxmlformats-officedocument.extended-properties+xml"},w=`${y.rel}/`,G=new Date(1980,0,1),xe=191029;export const DEFAULT_TABLE_STYLE="TableStyleMedium2";const $e=64,we=7,be=l=>Math.min(255,Math.floor(l/we*256)/256),ye=l=>Math.min(409.5,l*3/4),z=32767,B=255,Se=2e5,ke=o("metadata",{xmlns:y.main,"xmlns:xda":"http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray"},o("metadataTypes",{count:1},o("metadataType",{name:"XLDAPR",minSupportedVersion:12e4,copy:1,pasteAll:1,pasteValues:1,merge:1,splitFirst:1,rowColShift:1,clearFormats:1,clearComments:1,assign:1,coerce:1,cellMeta:1})),o("futureMetadata",{name:"XLDAPR",count:1},o("bk",{},o("extLst",{},o("ext",{uri:"{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}"},o("xda:dynamicArrayProperties",{fDynamic:1,fCollapsed:0}))))),o("cellMetadata",{count:1},o("bk",{},o("rc",{t:1,v:0}))));class ve{index=new Map;count=0;of(t){this.count+=1;let e=this.index.get(t);return e===void 0&&(e=this.index.size,this.index.set(t,e)),e}xml(){const t=[...this.index.keys()].map(e=>`<si><t${/^\s|\s$|\n/u.test(e)?' xml:space="preserve"':""}>${x(e)}</t></si>`);return o("sst",{xmlns:y.main,count:this.count,uniqueCount:this.index.size},...t)}}const H=l=>x(l),Te="Base case";function Ce(l){const t=new Map;for(const n of l.scenarios)for(const r of n.cells)t.set(R(r),r);const e=(n,r)=>o("inputCells",{r:R(n),val:r===null||r instanceof P?"":typeof r=="boolean"?r?"1":"0":String(r)}),s=(n,r)=>o("scenario",{name:n,locked:!0,count:r.length,user:"AllyHub"},...r);return o("scenarios",{current:0,show:0,sqref:[...t.keys()].join(" ")},s(Te,[...t.values()].map(n=>e(n,n.base))),...l.scenarios.map(n=>s(n.name,n.cells.map(r=>e(r,r.value)))))}function Ae(l,t,e,s){const n=[];let r=0;for(const{row:d,col:h,paths:a,column:i}of ie(l,t)){let c=0;const u=le(i);for(const S of a){const b=ae(S)?e?.(S):void 0,k=b&&ce(b);if(!b||!k){r+=1;continue}const M=Math.round(k.width/k.height*u);n.push({row:d,col:h,x:c,width:M,height:u,name:S.split("/").pop()??S,file:`.${k.type==="jpeg"?"jpg":k.type}`,bytes:b}),c+=M+4}}return r>0&&s.push(`${l.name}: ${String(r)} file${r===1?"":"s"} in a cell, which stay${r===1?"s":""} a name`),n}class Ee{arrays=!1;places=new Map;sheet;calc;styles;strings;wb;cached;left;isTable;isRangeName;hiddenRows;tall;scenarios;drawn;constructor(t,e,s,n,r,d,h=[],a){this.sheet=t,this.calc=e,this.wb=e.wb,this.styles=s,this.strings=n,this.cached=r,this.left=d,this.isTable=c=>this.wb.table(c)!==void 0,this.isRangeName=c=>{const u=this.wb.name(c)?.formula?.node;return this.isTable(c)||u!==void 0&&V({kind:"unary",op:"-",arg:u})},this.hiddenRows=e.filtered(t),this.scenarios=a,this.drawn=t.charts.length>0||h.length>0;const i=new Map;for(const c of h)i.set(c.row,Math.max(i.get(c.row)??0,c.height));this.tall=i}add(t,e){let s=this.places.get(t);s||(s=new Set,this.places.set(t,s)),s.add(e)}gather(){const{sheet:t}=this;for(let e=0;e<t.columnsUsed;e++){const[s,n]=t.span(e,0,Number.MAX_SAFE_INTEGER);for(let r=s;r<=n;r++)(t.at(r,e)!==void 0||t.spillAt(r,e))&&this.add(r,e)}for(const{area:e}of t.styledAreas()){const s=(e.bottom-e.top+1)*(e.right-e.left+1);if(s>Se){this.left.push(`${t.name}!${E(e)}: its look on the cells that hold something, ${String(s)} cells being too many to write empty`);continue}for(let n=e.top;n<=e.bottom;n++)for(let r=e.left;r<=e.right;r++)this.add(n,r)}for(const e of t.keys.keys())this.add(Math.floor(e/16384),e%16384)}styleOf(t,e){const s=this.sheet.lookAt(t,e);return Object.keys(s).length===0?void 0:this.styles.xf(s)}held(t,e){return e.length<=z?e:(this.left.push(`${this.sheet.name}!${t} past Excel's ${String(z)} characters, of its ${String(e.length)}`),e.slice(0,z))}value(t,e,s){return s===null?o("c",{r:t,s:e}):typeof s=="number"?`<c r="${t}"${p(e)}><v>${String(s)}</v></c>`:typeof s=="boolean"?`<c r="${t}"${p(e)} t="b"><v>${s?"1":"0"}</v></c>`:s instanceof P?Z(s)?`<c r="${t}"${p(e)} t="e"><v>${s.code}</v></c>`:`<c r="${t}"${p(e)} t="s"><v>${String(this.strings.of(s.code))}</v></c>`:`<c r="${t}"${p(e)} t="s"><v>${String(this.strings.of(this.held(t,s)))}</v></c>`}table(t){return this.sheet.tableAt(t.row,t.col)?.name}formula(t,e,s){const n=this.calc.value(s.sheet,s.row,s.col),{node:r}=s.shared;if(!r)return`<c r="${t}"${p(e)} t="e"><v>#NAME?</v></c>`;const d=s.moved,h=s.array!==void 0||s.blocked!==void 0||V(d,this.isRangeName),a=O(d,{table:this.table(s),isTable:this.isTable,array:h});let i=`<f>${H(a)}</f>`,c="";if(h){this.arrays=!0;const u=s.spill??{top:s.row,left:s.col,bottom:s.row,right:s.col};i=`<f t="array" ref="${E(u)}">${H(a)}</f>`,c=' cm="1"'}return this.cached?n===null||typeof n=="number"?`<c r="${t}"${p(e)}${c}>${i}<v>${String(n??0)}</v></c>`:typeof n=="boolean"?`<c r="${t}"${p(e)} t="b"${c}>${i}<v>${n?"1":"0"}</v></c>`:n instanceof P?Z(n)?`<c r="${t}"${p(e)} t="e"${c}>${i}<v>${n.code}</v></c>`:`<c r="${t}"${p(e)}${c}>${i}<v>0</v></c>`:`<c r="${t}"${p(e)} t="str"${c}>${i}<v>${x(this.held(t,n))}</v></c>`:`<c r="${t}"${p(e)}${c}>${i}</c>`}cell(t,e){const s=R({row:t,col:e}),n=this.styleOf(t,e),r=this.sheet.at(t,e);return r instanceof me?this.formula(s,n,r):r===void 0&&this.sheet.spillAt(t,e)&&this.cached?this.value(s,n,this.calc.value(this.sheet,t,e)):this.value(s,n,r??null)}columns(){const{sheet:t}=this,{spec:e}=t,s=new Map,n=new Map;for(const a of t.tables)for(const i of a.columns)i.spec?.width!==void 0&&n.set(a.at.col+i.index,i.spec.width);const r=new Set(n.keys()),d=new Map;for(const[a,i]of Object.entries(e.columns??{})){const c=ne(a);c!==void 0&&(d.set(c,i),r.add(c))}for(const a of r){const i=d.get(a),c=i?.width??n.get(a),u=J(i);s.set(a,o("col",{min:a+1,max:a+1,width:be(c??$e),style:u===void 0?void 0:this.styles.xf(u),hidden:i?.hidden===!0?!0:void 0,customWidth:c===void 0?void 0:!0}))}const h=[...s.keys()].sort((a,i)=>a-i).map(a=>s.get(a)??"");return h.length===0?"":o("cols",{},...h)}rowAttrs(t){const e=this.sheet.spec.rows?.[String(t+1)],s=J(e),n=e?.height??this.tall.get(t);return{r:t+1,s:s===void 0?void 0:this.styles.xf(s),customFormat:s===void 0?void 0:!0,ht:n===void 0?void 0:ye(n),customHeight:n===void 0?void 0:!0,hidden:e?.hidden===!0||this.hiddenRows.has(t)?!0:void 0}}rows(){const{sheet:t}=this,e=new Set(this.places.keys());for(const n of Object.keys(t.spec.rows??{}))e.add(Number(n)-1);for(const n of this.hiddenRows)e.add(n);const s=[];for(const n of[...e].sort((r,d)=>r-d)){const r=[...this.places.get(n)??[]].sort((a,i)=>a-i),d=o("row",this.rowAttrs(n)).slice(4,-2);if(r.length===0){s.push(`<row${d}/>`);continue}let h=`<row${d}>`;for(const a of r)h+=this.cell(n,a);s.push(`${h}</row>`)}return s.join("")}view(t){const{freeze:e}=this.sheet;let s="";if(e&&(e.row>0||e.col>0)){const n=e.row>0&&e.col>0?"bottomRight":e.row>0?"bottomLeft":"topRight";s=o("pane",{xSplit:e.col>0?e.col:void 0,ySplit:e.row>0?e.row:void 0,topLeftCell:R(e),activePane:n,state:"frozen"})}return o("sheetViews",{},o("sheetView",{showGridLines:this.sheet.spec.gridlines===!1?!1:void 0,tabSelected:t?!0:void 0,workbookViewId:0},s))}write(t,e){const{sheet:s}=this;this.gather();const n=_e(this.places),r=this.rows(),d=s.merges.map(i=>o("mergeCell",{ref:E(i)})),h=s.tables.map((i,c)=>o("tablePart",{"r:id":`rId${String(c+1)}`}));return{xml:g+o("worksheet",{xmlns:y.main,"xmlns:r":y.rel},s.spec.tab===void 0?"":o("sheetPr",{},o("tabColor",{rgb:`FF${s.spec.tab.slice(1).toUpperCase()}`})),o("dimension",{ref:n?E(n):"A1"}),this.view(t),o("sheetFormatPr",{defaultRowHeight:15}),this.columns(),r===""?o("sheetData"):`<sheetData>${r}</sheetData>`,this.scenarios?Ce(this.scenarios):"",this.sheetFilter(),d.length>0?o("mergeCells",{count:d.length},...d):"",...s.conditions.map((i,c)=>this.condition(i,c+1)),this.validations(),o("pageMargins",{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3}),this.drawn?o("drawing",{"r:id":`rId${String(h.length+1)}`}):"",h.length>0?o("tableParts",{count:h.length},...h):""),tables:s.tables.map((i,c)=>this.tableXml(i,e+c))}}bound(t){if(t===void 0)return"";if(typeof t=="number")return String(t);if(!t.startsWith("=")){const s=he(t);return typeof s.value=="number"&&s.formula===void 0?String(s.value):`"${t.replaceAll('"','""')}"`}const e=oe(t);return e.ok?O(e.node,{isTable:this.isTable,array:!0}):t.slice(1)}cfvo(t){return o("cfvo",{type:t.at,val:t.value===void 0?void 0:typeof t.value=="number"?t.value:this.bound(t.value)})}condition(t,e){const{spec:s}=t,n=s.range,r=(i,...c)=>o("conditionalFormatting",{sqref:n},o("cfRule",{...i,priority:e,stopIfTrue:s.stop===!0?!0:void 0},...c)),d=()=>{const i=Me(s);return Object.keys(i).length===0?void 0:this.styles.dxf(i)},h=t.areas[0],a=h?R({row:h.top,col:h.left}):"A1";switch(s.type){case"cellIs":return r({type:"cellIs",dxfId:d(),operator:s.operator},...s.formula.map(i=>o("formula",{},x(this.bound(i)))));case"containsText":{const i=s.operator??"contains",c=`"${s.text.replaceAll('"','""')}"`,u=i==="contains"?`NOT(ISERROR(SEARCH(${c},${a})))`:i==="notContains"?`ISERROR(SEARCH(${c},${a}))`:i==="beginsWith"?`LEFT(${a},LEN(${c}))=${c}`:`RIGHT(${a},LEN(${c}))=${c}`;return r({type:i==="contains"?"containsText":i==="notContains"?"notContainsText":i,dxfId:d(),operator:i==="contains"?"containsText":i,text:s.text},o("formula",{},x(u)))}case"duplicateValues":case"uniqueValues":return r({type:s.type,dxfId:d()});case"top10":return r({type:"top10",dxfId:d(),percent:s.percent===!0?!0:void 0,bottom:s.bottom===!0?!0:void 0,rank:s.rank});case"aboveAverage":return r({type:"aboveAverage",dxfId:d(),aboveAverage:s.below===!0?!1:void 0,equalAverage:s.equal===!0?!0:void 0});case"expression":return r({type:"expression",dxfId:d()},o("formula",{},x(this.bound(s.formula.startsWith("=")?s.formula:`=${s.formula}`))));case"dataBar":return r({type:"dataBar"},o("dataBar",{showValue:s.show===!1?!1:void 0},this.cfvo(s.min??{at:"min"}),this.cfvo(s.max??{at:"max"}),o("color",{rgb:K(s.color)})));case"colorScale":return r({type:"colorScale"},o("colorScale",{},...s.stops.map(i=>this.cfvo(i)),...s.stops.map(i=>o("color",{rgb:K(i.color)}))));case"iconSet":{const i=Number.parseInt(s.icons,10),c=s.stops??Array.from({length:i},(u,S)=>({at:"percent",value:Math.round(S*100/i)}));return r({type:"iconSet"},o("iconSet",{iconSet:s.icons,showValue:s.show===!1?!1:void 0,reverse:s.reverse===!0?!0:void 0},...c.map(u=>this.cfvo(u))))}}}validation(t){const{spec:e}=t;let s="";if(e.values){const h=e.values.join(",");(h.length>B||e.values.some(a=>a.includes(",")))&&this.left.push(`${this.sheet.name}!${e.range}: a list a file's cell cannot spell out, its values longer than ${String(B)} characters or holding a comma`),s=`"${h.slice(0,B)}"`}else s=this.bound(e.formula?.[0]);const n=this.bound(e.formula?.[1]),{error:r,prompt:d}=e;return e.multiple===!0&&this.left.push(`${this.sheet.name}!${e.range}: several choices in a cell: its text stays, and Excel's list offers one at a time`),o("dataValidation",{type:e.type,errorStyle:r?.style===void 0||r.style==="stop"?void 0:r.style,operator:e.operator===void 0||e.operator==="between"?void 0:e.operator,allowBlank:e.blank===!1?void 0:!0,showDropDown:e.dropdown===!1?!0:void 0,showInputMessage:d?.show===!1?void 0:!0,showErrorMessage:r?.show===!1||e.multiple===!0?void 0:!0,errorTitle:r?.title,error:r?.message,promptTitle:d?.title,prompt:d?.message,sqref:e.range},s===""?"":o("formula1",{},x(s)),n===""?"":o("formula2",{},x(n)))}validations(){const t=this.sheet.validations;return t.length===0?"":o("dataValidations",{count:t.length},...t.map(e=>this.validation(e)))}filterColumns(t){return[...t.columns.entries()].sort(([e],[s])=>e-s).map(([e,s])=>Ie(e-t.area.left,s))}sheetFilter(){const t=this.sheet.filters.find(e=>!e.table);return t?o("autoFilter",{ref:E(t.area)},...this.filterColumns(t)):""}columnFormula(t,e){if(!e?.node)return"";const s=V(e.node,this.isRangeName),n=O(e.node,{table:t.name,isTable:this.isTable,array:s});return o("calculatedColumnFormula",{array:s?!0:void 0},H(n))}tableXml(t,e){const s=t.area,n=E({...s,bottom:Math.max(s.bottom,s.top+1)}),r=t.spec.style??DEFAULT_TABLE_STYLE,d=this.sheet.filters.find(h=>h.table===t);return g+o("table",{xmlns:y.main,id:e,name:t.name,displayName:t.name,ref:n,totalsRowShown:0},d?o("autoFilter",{ref:n},...this.filterColumns(d)):"",o("tableColumns",{count:t.columns.length},...t.columns.map((h,a)=>o("tableColumn",{id:a+1,name:h.name},this.columnFormula(t,h.formula)))),r==="none"?o("tableStyleInfo",{showFirstColumn:0,showLastColumn:0,showRowStripes:1,showColumnStripes:0}):o("tableStyleInfo",{name:r,showFirstColumn:0,showLastColumn:0,showRowStripes:1,showColumnStripes:0}))}}const K=l=>`FF${l.slice(1).toUpperCase()}`;function Me(l){if(l.type==="dataBar"||l.type==="colorScale"||l.type==="iconSet")return{};const t={};for(const e of["bold","italic","underline","strike","color","fill","border"])l[e]!==void 0&&(t[e]=l[e]);return t}function Ie(l,t){return o("filterColumn",{colId:l},o("filters",{blank:t.blanks===!0?!0:void 0},...(t.values??[]).map(e=>o("filter",{val:e}))))}const p=l=>l===void 0?"":` s="${String(l)}"`,Z=l=>l.code!=="#CYCLE!";function _e(l){let t;for(const[e,s]of l)for(const n of s)t?(t.top=Math.min(t.top,e),t.bottom=Math.max(t.bottom,e),t.left=Math.min(t.left,n),t.right=Math.max(t.right,n)):t={top:e,bottom:e,left:n,right:n};return t}const Re=new Set(["width","height","hidden"]);function J(l){if(!l)return;const t=Object.fromEntries(Object.entries(l).filter(([e])=>!Re.has(e)));return Object.keys(t).length===0?void 0:t}const D=l=>g+o("Relationships",{xmlns:y.pkg},...l.map(([t,e],s)=>o("Relationship",{Id:`rId${String(s+1)}`,Type:t,Target:e})));function Le(l,t){const e=l.name(t);if(!e)return;const s=e.formula?.node;if(s)return O(s,{isTable:r=>l.table(r)!==void 0,array:!0});const{value:n}=e;return n==null?'""':typeof n=="string"?`"${n.replaceAll('"','""')}"`:typeof n=="boolean"?n?"TRUE":"FALSE":n instanceof P?n.code:String(n)}const Fe=(l,t)=>l.length===t.length&&l.every((e,s)=>e===t[s]),Pe=l=>`$${Y(l.left)}$${String(l.top+1)}:$${Y(l.right)}$${String(l.bottom+1)}`;export function writeXlsx(l,t={}){const e=l.wb,s=[];e.checks.length>0&&s.push(`${String(e.checks.length)} check${e.checks.length===1?"":"s"}: a file has no such thing`);const n=de(l);s.push(...n.left);const r=new pe,d=new ve,h=new TextEncoder,a={},i=[["/xl/workbook.xml",$.sheet]],c=Math.max(0,e.sheets.findIndex(m=>m.spec.hidden!==!0));let u=1,S=!1;const b=new Map;let k=0,M=0;for(const[m,f]of e.sheets.entries()){const v=String(m+1),T=Ae(f,l,t.file,s),q=new Ee(f,l,r,d,t.cached!==!1,s,T,n.sheets.find(C=>C.sheet===f)),U=q.write(m===c,u);S||=q.arrays,a[`xl/worksheets/sheet${v}.xml`]=U.xml,i.push([`/xl/worksheets/sheet${v}.xml`,$.worksheet]);const L=[];for(const C of U.tables){const A=`table${String(u)}.xml`;u+=1,a[`xl/tables/${A}`]=C,i.push([`/xl/tables/${A}`,$.table]),L.push([`${w}table`,`../tables/${A}`])}if(f.charts.length>0||T.length>0){k+=1;const C=`drawing${String(k)}.xml`;a[`xl/drawings/${C}`]=ue(f.charts,T),i.push([`/xl/drawings/${C}`,$.drawing]),L.push([`${w}drawing`,`../drawings/${C}`]);const A=f.charts.map(_=>{M+=1;const F=`chart${String(M)}.xml`;return a[`xl/charts/${F}`]=fe(l,f,_),i.push([`/xl/charts/${F}`,$.chart]),[`${w}chart`,`../charts/${F}`]});for(const _ of T){const W=[...b].find(([,te])=>Fe(te,_.bytes))?.[0]??`image${String(b.size+1)}${_.file}`;b.set(W,_.bytes),A.push([`${w}image`,`../media/${W}`])}a[`xl/drawings/_rels/${C}.rels`]=D(A)}L.length>0&&(a[`xl/worksheets/_rels/sheet${v}.xml.rels`]=D(L))}const Q=e.sheets.length,I=e.sheets.map((m,f)=>[`${w}worksheet`,`worksheets/sheet${String(f+1)}.xml`]);I.push([`${w}theme`,"theme/theme1.xml"]),I.push([`${w}styles`,"styles.xml"]),I.push([`${w}sharedStrings`,"sharedStrings.xml"]),S&&(I.push([`${w}sheetMetadata`,"metadata.xml"]),a["xl/metadata.xml"]=g+ke,i.push(["/xl/metadata.xml",$.metadata]));const N=[...e.names.values()].flatMap(m=>{const f=Le(e,m.name);return f===void 0?[]:[o("definedName",{name:m.name},x(f))]});e.sheets.forEach((m,f)=>{const v=m.filters.find(T=>!T.table);v&&N.push(o("definedName",{name:"_xlnm._FilterDatabase",localSheetId:f,hidden:!0},x(`${re(m.name)}${Pe(v.area)}`)))}),a["xl/workbook.xml"]=g+o("workbook",{xmlns:y.main,"xmlns:r":y.rel},o("workbookPr",{}),o("bookViews",{},o("workbookView",{activeTab:c===0?void 0:c})),o("sheets",{},...e.sheets.map((m,f)=>o("sheet",{name:m.name,sheetId:f+1,state:m.spec.hidden===!0?"hidden":void 0,"r:id":`rId${String(f+1)}`}))),N.length>0?o("definedNames",{},...N):"",o("calcPr",{calcId:xe,fullCalcOnLoad:!0})),a["xl/_rels/workbook.xml.rels"]=D(I),a["xl/styles.xml"]=g+r.xml(),a["xl/sharedStrings.xml"]=g+d.xml(),a["xl/theme/theme1.xml"]=g+ge,a["docProps/core.xml"]=g+o("cp:coreProperties",{"xmlns:cp":"http://schemas.openxmlformats.org/package/2006/metadata/core-properties","xmlns:dc":"http://purl.org/dc/elements/1.1/"},e.title===void 0?"":o("dc:title",{},x(e.title))),a["docProps/app.xml"]=g+o("Properties",{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"},o("Application",{},"AllyHub")),a["_rels/.rels"]=D([[`${w}officeDocument`,"xl/workbook.xml"],["http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"],[`${w}extended-properties`,"docProps/app.xml"]]),i.push(["/xl/styles.xml",$.styles],["/xl/sharedStrings.xml",$.strings],["/xl/theme/theme1.xml",$.theme],["/docProps/core.xml",$.core],["/docProps/app.xml",$.app]),a["[Content_Types].xml"]=g+o("Types",{xmlns:y.types},o("Default",{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}),o("Default",{Extension:"xml",ContentType:"application/xml"}),...[...new Set([...b.keys()].map(m=>m.split(".").pop()??""))].sort().map(m=>o("Default",{Extension:m,ContentType:`image/${m==="jpg"?"jpeg":m}`})),...i.map(([m,f])=>o("Override",{PartName:m,ContentType:f})));const X=["[Content_Types].xml","_rels/.rels","docProps/app.xml","docProps/core.xml","xl/workbook.xml","xl/_rels/workbook.xml.rels",...Array.from({length:Q},(m,f)=>`xl/worksheets/sheet${String(f+1)}.xml`)],ee=[...X,...Object.keys(a).filter(m=>!X.includes(m)).sort()],j={};for(const m of ee)j[m]=[h.encode(a[m]??""),{mtime:G}];for(const[m,f]of[...b].sort(([v],[T])=>v.localeCompare(T)))j[`xl/media/${m}`]=[f,{mtime:G}];return{bytes:se(j),left:s}}
2
+ import{SHEET_MARGINS as pe,SHEET_NOTE_AUTHOR as K,SHEET_PAPERS as we}from"@allyhub-next/formats";import{MAX_COLUMNS as Q,MAX_ROWS as ee,cellName as _,columnIndex as xe,columnLetter as D,rangeName as M,readAddress as te,readArea as ge}from"../address.js";import{parseFormula as $e}from"../formula/parse.js";import{sheetPrefix as X}from"../formula/print.js";import{walk as ye}from"../formula/walk.js";import{fileCells as be,isPicture as ve,pictureHeight as Se,pictureSize as se}from"../files.js";import{scenariosByCell as ke}from"../scenario.js";import{CellError as P,readTyped as Ae}from"../values.js";import{FormulaCell as Ce}from"../workbook.js";import{chartPart as Ee,drawingPart as Te}from"./charts.js";import{fileFormula as N,needsArray as B}from"./formula.js";import{GRID_END as W}from"./read.js";import{Styles as Me}from"./styles.js";import{THEME_XML as Re}from"./theme.js";import{HEAD as S,NS as k,el as o,xstring as x}from"./xml.js";import{ZipOut as _e}from"./zip.js";const A={comments:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",sheet:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",worksheet:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",styles:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",strings:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",theme:"application/vnd.openxmlformats-officedocument.theme+xml",table:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",metadata:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",drawing:"application/vnd.openxmlformats-officedocument.drawing+xml",chart:"application/vnd.openxmlformats-officedocument.drawingml.chart+xml",core:"application/vnd.openxmlformats-package.core-properties+xml",app:"application/vnd.openxmlformats-officedocument.extended-properties+xml"},v=`${k.rel}/`,ne="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main",oe="http://schemas.microsoft.com/office/excel/2006/main",re={conditional:"{78C0D931-6437-407d-A8EE-F0AAD7539E65}",validations:"{CCE6A557-97BC-4b89-ADB6-D9C93CAAB3DF}"},je=191029;export const DEFAULT_TABLE_STYLE="TableStyleMedium2",LISTS_SHEET="AllyHub lists";const Le=64,Oe=7,Fe=a=>Math.min(255,Math.floor(a/Oe*256)/256),Ie=a=>Math.min(409.5,a*3/4),q=32767,De=255,Pe=2e5,Ne=o("metadata",{xmlns:k.main,"xmlns:xda":"http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray"},o("metadataTypes",{count:1},o("metadataType",{name:"XLDAPR",minSupportedVersion:12e4,copy:1,pasteAll:1,pasteValues:1,merge:1,splitFirst:1,rowColShift:1,clearFormats:1,clearComments:1,assign:1,coerce:1,cellMeta:1})),o("futureMetadata",{name:"XLDAPR",count:1},o("bk",{},o("extLst",{},o("ext",{uri:"{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}"},o("xda:dynamicArrayProperties",{fDynamic:1,fCollapsed:0}))))),o("cellMetadata",{count:1},o("bk",{},o("rc",{t:1,v:0}))));class Ve{index=new Map;count=0;of(t){this.count+=1;let s=this.index.get(t);return s===void 0&&(s=this.index.size,this.index.set(t,s)),s}write(t){t.write(`${S}<sst xmlns="${k.main}" count="${String(this.count)}" uniqueCount="${String(this.index.size)}">`);for(const s of this.index.keys()){const e=/^\s|\s$|\n/u.test(s);t.write(`<si><t${e?' xml:space="preserve"':""}>${x(s)}</t></si>`)}t.write("</sst>"),t.end()}}function ze(a){for(const t in a)if(Object.hasOwn(a,t))return!1;return!0}const He=a=>o("x",a).slice(2,-2),Ue="Base case";function Xe(a){const t=new Map;for(const n of a.scenarios)for(const r of n.cells)t.set(_(r),r);const s=(n,r)=>o("inputCells",{r:_(n),val:r===null||r instanceof P?"":typeof r=="boolean"?r?"1":"0":String(r)}),e=(n,r)=>o("scenario",{name:n,locked:!0,count:r.length,user:"AllyHub"},r.join(""));return o("scenarios",{current:0,show:0,sqref:[...t.keys()].join(" ")},e(Ue,[...t.values()].map(n=>s(n,n.base))),...a.scenarios.map(n=>e(n.name,n.cells.map(r=>s(r,r.value)))))}function Be(a,t,s,e){const n=[];let r=0;for(const{row:l,col:h,paths:c,column:i}of be(a,t)){let d=0;const f=Se(i);for(const m of c){const u=ve(m)?s?.(m):void 0,$=u&&se(u);if(!u||!$){r+=1;continue}const T=Math.round($.width/$.height*f);n.push({row:l,col:h,x:d,width:T,height:f,name:m.split("/").pop()??m,path:m,file:`.${$.type==="jpeg"?"jpg":$.type}`,bytes:u}),d+=T+4}}for(const l of a.spec.pictures??[]){const h=te(l.at),c=s?.(l.file),i=c&&se(c);if(!h||!c||!i)continue;const d=i.width/i.height,f=l.width??(l.height===void 0?i.width:l.height*d);n.push({row:h.row,col:h.col,x:l.x??0,y:l.y??0,width:Math.round(f),height:Math.round(l.height??f/d),name:l.file.split("/").pop()??l.file,path:l.file,file:`.${i.type==="jpeg"?"jpg":i.type}`,bytes:c})}return r>0&&e.push(`${a.name}: ${String(r)} file${r===1?"":"s"} in a cell, which stay${r===1?"s":""} a name`),n}class We{name;columns=[];known=new Map;constructor(t){let s=LISTS_SHEET;for(let e=2;t.sheet(s);e++)s=`${LISTS_SHEET} (${String(e)})`;this.name=s}place(t){const s=JSON.stringify(t);let e=this.known.get(s);e===void 0&&(e=this.columns.length,this.columns.push(t),this.known.set(s,e));const n=D(e);return`${X(this.name)}$${n}$1:$${n}$${String(Math.max(1,t.length))}`}xml(t){const s=[],e=Math.max(0,...this.columns.map(n=>n.length));for(let n=0;n<e;n++){let r=`<row r="${String(n+1)}">`;this.columns.forEach((l,h)=>{const c=l[n];c!==void 0&&(r+=`<c r="${_({row:n,col:h})}" t="s"><v>${String(t.of(c))}</v></c>`)}),s.push(`${r}</row>`)}return`${S}<worksheet xmlns="${k.main}" xmlns:r="${k.rel}"><dimension ref="${M({top:0,left:0,bottom:Math.max(0,e-1),right:Math.max(0,this.columns.length-1)})}"/><sheetViews><sheetView workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/><sheetData>${s.join("")}</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>`}}class qe{rows=new Int32Array(1024);cols=new Int32Array(1024);size=0;add(t,s){if(this.size===this.rows.length){const e=new Int32Array(this.size*2);e.set(this.rows),this.rows=e;const n=new Int32Array(this.size*2);n.set(this.cols),this.cols=n}this.rows[this.size]=t,this.cols[this.size]=s,this.size+=1}byRow(){const{size:t}=this;if(t===0)return{start:new Uint32Array(1),cols:new Int32Array(0),top:0,used:void 0};let s=1/0,e=-1,n=1/0,r=-1;for(let i=0;i<t;i++){const d=this.rows[i]??0,f=this.cols[i]??0;d<s&&(s=d),d>e&&(e=d),f<n&&(n=f),f>r&&(r=f)}const l=new Uint32Array(e-s+2);for(let i=0;i<t;i++){const d=(this.rows[i]??0)-s+1;l[d]=(l[d]??0)+1}for(let i=1;i<l.length;i++)l[i]=(l[i]??0)+(l[i-1]??0);const h=l.slice(0,-1),c=new Int32Array(t);for(let i=0;i<t;i++){const d=(this.rows[i]??0)-s,f=h[d]??0;c[f]=this.cols[i]??0,h[d]=f+1}return{start:l,cols:c,top:s,used:{top:s,bottom:e,left:n,right:r}}}}function Ge(a,t){if(!a)return!1;let s=!1;const e=t.toLowerCase();return ye(a,n=>{(n.kind==="ref"||n.kind==="name")&&n.sheet!==void 0&&n.sheet.toLowerCase()!==e&&(s=!0)}),s}const Ye=(a,t)=>`{00000000-0000-4000-8000-${(a*65536+t).toString(16).toUpperCase().padStart(12,"0")}}`;class Ze{arrays=!1;sheet;calc;styles;strings;wb;cached;left;lists;index;isTable;isRangeName;hiddenRows;tall;scenarios;drawn;newerRules=[];newerValidations=[];shapes=new Map;groups=new Map;constructor(t,s,e,n,r,l,h,c,i=[],d){this.sheet=t,this.calc=s,this.wb=s.wb,this.styles=e,this.strings=n,this.cached=r,this.left=l,this.lists=h,this.index=c,this.isTable=m=>this.wb.table(m)!==void 0,this.isRangeName=m=>{const u=this.wb.name(m,t)?.formula?.node;return this.isTable(m)||u!==void 0&&B({kind:"unary",op:"-",arg:u})},this.hiddenRows=s.filtered(t),this.scenarios=d,this.drawn=t.charts.length>0||i.length>0;const f=new Map;for(const m of i)m.y===void 0&&f.set(m.row,Math.max(f.get(m.row)??0,m.height));this.tall=f}grid(){const{sheet:t}=this;if(t.lastRow>=ee)throw new Error(`${t.name} reaches row ${(t.lastRow+1).toLocaleString("en-US")}, and ${W}: an Excel file cannot hold it.`);if(t.columnsUsed>Q)throw new Error(`${t.name} reaches past column ${D(Q-1)}, and ${W}: an Excel file cannot hold it.`);for(const s of Object.keys(t.spec.rows??{}))if(Number(s)>ee)throw new Error(`${t.name} sets row ${s}, and ${W}: an Excel file cannot hold it.`)}gather(){const{sheet:t}=this,s=new qe;for(let e=0;e<t.columnsUsed;e++){const[n,r]=t.span(e,0,Number.MAX_SAFE_INTEGER);for(let l=n;l<=r;l++)(t.at(l,e)!==void 0||t.spillAt(l,e))&&s.add(l,e)}for(const{area:e}of t.styledAreas()){const n=(e.bottom-e.top+1)*(e.right-e.left+1);if(n>Pe){this.left.push(`${t.name}!${M(e)}: its look on the cells that hold something, ${String(n)} cells being too many to write empty`);continue}for(let r=e.top;r<=e.bottom;r++)for(let l=e.left;l<=e.right;l++)s.add(r,l)}for(const e of t.keys.keys())s.add(Math.floor(e/16384),e%16384);return s.byRow()}styleOf(t,s){const e=this.sheet.lookAt(t,s);return ze(e)?void 0:this.styles.xf(e)}held(t,s){return s.length<=q?s:(this.left.push(`${this.sheet.name}!${t} past Excel's ${String(q)} characters, of its ${String(s.length)}`),s.slice(0,q))}value(t,s,e){return e===null?`<c r="${t}"${C(s)}/>`:typeof e=="number"?`<c r="${t}"${C(s)}><v>${String(e)}</v></c>`:typeof e=="boolean"?`<c r="${t}"${C(s)} t="b"><v>${e?"1":"0"}</v></c>`:e instanceof P?ce(e)?`<c r="${t}"${C(s)} t="e"><v>${e.code}</v></c>`:`<c r="${t}"${C(s)} t="s"><v>${String(this.strings.of(e.code))}</v></c>`:`<c r="${t}"${C(s)} t="s"><v>${String(this.strings.of(this.held(t,e)))}</v></c>`}table(t){return this.sheet.tableAt(t.row,t.col)?.name}formula(t,s,e){const n=this.calc.value(e.sheet,e.row,e.col),{shared:r}=e,{node:l}=r;if(!l)return`<c r="${t}"${C(s)} t="e"><v>#NAME?</v></c>`;let h=this.shapes.get(r);h===void 0&&(h=B(l,this.isRangeName),this.shapes.set(r,h));const c=e.array!==void 0||e.blocked!==void 0||h;let i=c?void 0:this.groups.get(r);i?.written===!1&&(e.row!==i.ref.top||e.col!==i.ref.left)&&(i=void 0);let d,f="";if(i?.written===!0)d=`<f t="shared" si="${String(i.si)}"/>`;else{const m=N(e.moved,{table:this.table(e),isTable:this.isTable,array:c});d=i?`<f t="shared" ref="${M(i.ref)}" si="${String(i.si)}">${x(m)}</f>`:`<f>${x(m)}</f>`,i&&(i.written=!0),c&&(d=this.arrayFormula(e,m))}return c&&(this.arrays=!0,f=' cm="1"'),this.cached?n===null||typeof n=="number"?`<c r="${t}"${C(s)}${f}>${d}<v>${String(n??0)}</v></c>`:typeof n=="boolean"?`<c r="${t}"${C(s)} t="b"${f}>${d}<v>${n?"1":"0"}</v></c>`:n instanceof P?ce(n)?`<c r="${t}"${C(s)} t="e"${f}>${d}<v>${n.code}</v></c>`:`<c r="${t}"${C(s)}${f}>${d}<v>0</v></c>`:`<c r="${t}"${C(s)} t="str"${f}>${d}<v>${x(this.held(t,n))}</v></c>`:`<c r="${t}"${C(s)}${f}>${d}</c>`}arrayFormula(t,s){const e=t.spill??{top:t.row,left:t.col,bottom:t.row,right:t.col};return`<f t="array" ref="${M(e)}">${x(s)}</f>`}shareFormulas(){const t=new Map;for(const e of this.sheet.formulas){const n=t.get(e.shared);if(!n)t.set(e.shared,{area:{top:e.row,bottom:e.row,left:e.col,right:e.col},first:e,n:1});else{const{area:r}=n;e.row<r.top&&(r.top=e.row),e.row>r.bottom&&(r.bottom=e.row),e.col<r.left&&(r.left=e.col),e.col>r.right&&(r.right=e.col),(e.row<n.first.row||e.row===n.first.row&&e.col<n.first.col)&&(n.first=e),n.n+=1}}let s=0;for(const[e,{area:n,first:r,n:l}]of t)l>1&&r.row===n.top&&r.col===n.left&&(this.groups.set(e,{si:s,ref:n,written:!1}),s+=1)}cell(t,s){const e=_({row:t,col:s}),n=this.styleOf(t,s),r=this.sheet.at(t,s);return r instanceof Ce?this.formula(e,n,r):r===void 0&&this.cached&&this.sheet.spillAt(t,s)?this.value(e,n,this.calc.value(this.sheet,t,s)):this.value(e,n,r??null)}columns(){const{sheet:t}=this,{spec:s}=t,e=new Map,n=new Map;for(const c of t.tables)for(const i of c.columns)i.spec?.width!==void 0&&n.set(c.at.col+i.index,i.spec.width);const r=new Set(n.keys()),l=new Map;for(const[c,i]of Object.entries(s.columns??{})){const d=xe(c);d!==void 0&&(l.set(d,i),r.add(d))}for(const c of r){const i=l.get(c),d=i?.width??n.get(c),f=de(i);e.set(c,o("col",{min:c+1,max:c+1,width:Fe(d??Le),style:f===void 0?void 0:this.styles.xf(f),hidden:i?.hidden===!0?!0:void 0,customWidth:d===void 0?void 0:!0,outlineLevel:i?.level}))}const h=[...e.keys()].sort((c,i)=>c-i).map(c=>e.get(c)??"");return h.length===0?"":`<cols>${h.join("")}</cols>`}rowAttrs(t){const s=this.sheet.spec.rows?.[String(t+1)],e=de(s),n=s?.height??this.tall.get(t);return He({r:t+1,s:e===void 0?void 0:this.styles.xf(e),customFormat:e===void 0?void 0:!0,ht:n===void 0?void 0:Ie(n),customHeight:n===void 0?void 0:!0,hidden:s?.hidden===!0||this.hiddenRows.has(t)?!0:void 0,outlineLevel:s?.level})}rows(t,s){const{sheet:e}=this,n=new Set(this.hiddenRows);for(const d of Object.keys(e.spec.rows??{}))n.add(Number(d)-1);const{start:r,cols:l,top:h}=s;let c=s.used?h:1/0,i=s.used?s.used.bottom:-1;for(const d of n)d<c&&(c=d),d>i&&(i=d);for(let d=Math.max(0,c);d<=i;d++){const f=d-h,m=f>=0&&f<r.length-1?r[f]??0:0,u=f>=0&&f<r.length-1?r[f+1]??0:0;if(m===u&&!n.has(d))continue;if(m===u){t.write(`<row${this.rowAttrs(d)}/>`);continue}const $=l.subarray(m,u).sort();let T=`<row${this.rowAttrs(d)}>`,y=-1;for(const b of $)b!==y&&(y=b,T+=this.cell(d,b));t.write(`${T}</row>`)}}view(t){const{freeze:s}=this.sheet;let e="";if(s&&(s.row>0||s.col>0)){const n=s.row>0&&s.col>0?"bottomRight":s.row>0?"bottomLeft":"topRight";e=o("pane",{xSplit:s.col>0?s.col:void 0,ySplit:s.row>0?s.row:void 0,topLeftCell:_(s),activePane:n,state:"frozen"})}return o("sheetViews",{},o("sheetView",{showGridLines:this.sheet.spec.gridlines===!1?!1:void 0,tabSelected:t?!0:void 0,workbookViewId:0},e))}write(t,s,e){const{sheet:n}=this;this.grid();const r=this.gather();this.shareFormulas();const l=n.tables.map((y,b)=>o("tablePart",{"r:id":`rId${String(b+1)}`})),{print:h}=n.spec,c=h?.fit,i=Object.keys(n.spec.notes??{}).length>0;t.write(`${S}<worksheet xmlns="${k.main}" xmlns:r="${k.rel}">`+(n.spec.tab===void 0&&c===void 0?"":o("sheetPr",{},n.spec.tab===void 0?"":o("tabColor",{rgb:`FF${n.spec.tab.slice(1).toUpperCase()}`}),c===void 0?"":o("pageSetUpPr",{fitToPage:!0})))+o("dimension",{ref:r.used?M(r.used):"A1"})+this.view(s)+o("sheetFormatPr",{defaultRowHeight:15,outlineLevelRow:ie(n.spec.rows),outlineLevelCol:ie(n.spec.columns)})+this.columns()+"<sheetData>"),this.rows(t,r);const d=l.length+1+(this.drawn?1:0)+(i?2:0);let f=0;const m=Object.entries(n.spec.links??{}).map(([y,b])=>b.startsWith("#")?o("hyperlink",{ref:y,location:b.slice(1)}):o("hyperlink",{ref:y,"r:id":`rId${String(d+f++)}`})),u=n.merges.map(y=>o("mergeCell",{ref:M(y)})),$=n.conditions.map((y,b)=>this.condition(y,b+1)).join(""),T=this.validations();return t.write("</sheetData>"+(n.spec.protect===!0?o("sheetProtection",{sheet:!0,objects:!0,scenarios:!0}):"")+(this.scenarios?Xe(this.scenarios):"")+this.sheetFilter()+(u.length>0?o("mergeCells",{count:u.length},u.join("")):"")+$+T+(m.length>0?o("hyperlinks",{},m.join("")):"")+o("pageMargins",{...pe,...h?.margins})+(h?.orientation!==void 0||h?.paper!==void 0||c!==void 0?o("pageSetup",{paperSize:h?.paper===void 0?void 0:we[h.paper],fitToWidth:c?.width,fitToHeight:c?.height,orientation:h?.orientation}):"")+(h?.header||h?.footer?o("headerFooter",{},h.header?o("oddHeader",{},x(ae(h.header))):"",h.footer?o("oddFooter",{},x(ae(h.footer))):""):"")+(this.drawn?o("drawing",{"r:id":`rId${String(l.length+1)}`}):"")+(i?o("legacyDrawing",{"r:id":`rId${String(l.length+(this.drawn?2:1))}`}):"")+(l.length>0?o("tableParts",{count:l.length},l.join("")):"")+this.extensions()+"</worksheet>"),t.end(),n.tables.map((y,b)=>this.tableXml(y,e+b))}extensions(){const t=[];return this.newerRules.length>0&&t.push(o("ext",{uri:re.conditional,"xmlns:x14":ne},o("x14:conditionalFormattings",{},this.newerRules.join("")))),this.newerValidations.length>0&&t.push(o("ext",{uri:re.validations,"xmlns:x14":ne},o("x14:dataValidations",{count:this.newerValidations.length,"xmlns:xm":oe},this.newerValidations.join("")))),t.length===0?"":o("extLst",{},t.join(""))}bound(t){if(t===void 0)return"";if(typeof t=="number")return String(t);if(!t.startsWith("=")){const e=Ae(t);return typeof e.value=="number"&&e.formula===void 0?String(e.value):`"${t.replaceAll('"','""')}"`}const s=$e(t);return s.ok?N(s.node,{isTable:this.isTable,array:!0}):t.slice(1)}cfvo(t,s){const e=t.value===void 0?void 0:typeof t.value=="number"?String(t.value):this.bound(t.value);return s?o("x14:cfvo",{type:t.at},e===void 0?"":o("xm:f",{},x(e))):o("cfvo",{type:t.at,val:e})}crosses(t){return t.some(s=>Ge(s?.node,this.sheet.name))}condition(t,s){const{spec:e}=t,n=e.range,r=e.type!=="dataBar"&&this.crosses(t.formulas),l=(f,m,...u)=>{if(!r){const $=Object.keys(m).length===0?void 0:this.styles.dxf(m);return o("conditionalFormatting",{sqref:n},o("cfRule",{...f,dxfId:$,priority:s,stopIfTrue:e.stop===!0?!0:void 0},...u))}return this.newerRules.push(o("x14:conditionalFormatting",{"xmlns:xm":oe},o("x14:cfRule",{...f,priority:s,stopIfTrue:e.stop===!0?!0:void 0,id:Ye(this.index,s)},...u.map($=>$.replace(/^<formula>(.*)<\/formula>$/su,"<xm:f>$1</xm:f>")),Object.keys(m).length===0?"":this.styles.dxfXml(m,"x14:dxf")),o("xm:sqref",{},n))),""},h=et(e),c=t.areas[0],i=c?_({row:c.top,col:c.left}):"A1",d=f=>o("formula",{},x(f));switch(e.type){case"cellIs":return l({type:"cellIs",operator:e.operator},h,...e.formula.map(f=>d(this.bound(f))));case"containsText":{const f=e.operator??"contains",m=`"${e.text.replaceAll('"','""')}"`,u=f==="contains"?`NOT(ISERROR(SEARCH(${m},${i})))`:f==="notContains"?`ISERROR(SEARCH(${m},${i}))`:f==="beginsWith"?`LEFT(${i},LEN(${m}))=${m}`:`RIGHT(${i},LEN(${m}))=${m}`;return l({type:f==="contains"?"containsText":f==="notContains"?"notContainsText":f,operator:f==="contains"?"containsText":f,text:e.text},h,d(u))}case"duplicateValues":case"uniqueValues":return l({type:e.type},h);case"top10":return l({type:"top10",percent:e.percent===!0?!0:void 0,bottom:e.bottom===!0?!0:void 0,rank:e.rank},h);case"aboveAverage":return l({type:"aboveAverage",aboveAverage:e.below===!0?!1:void 0,equalAverage:e.equal===!0?!0:void 0},h);case"expression":return l({type:"expression"},h,d(this.bound(e.formula.startsWith("=")?e.formula:`=${e.formula}`)));case"dataBar":return l({type:"dataBar"},{},o("dataBar",{showValue:e.show===!1?!1:void 0},this.cfvo(e.min??{at:"min"},!1),this.cfvo(e.max??{at:"max"},!1),o("color",{rgb:le(e.color)})));case"colorScale":{const f=r?"x14:":"";return l({type:"colorScale"},{},o(`${f}colorScale`,{},...e.stops.map(m=>this.cfvo(m,r)),...e.stops.map(m=>o(`${f}color`,{rgb:le(m.color)}))))}case"iconSet":{const f=Number.parseInt(e.icons,10),m=e.stops??Array.from({length:f},(u,$)=>({at:"percent",value:Math.round($*100/f)}));return l({type:"iconSet"},{},o(r?"x14:iconSet":"iconSet",{iconSet:e.icons,showValue:e.show===!1?!1:void 0,reverse:e.reverse===!0?!0:void 0},...m.map(u=>this.cfvo(u,r))))}}}validation(t){const{spec:s}=t;let e="",n=this.crosses(t.formulas);if(s.values){const i=s.values.join(",");i.length>De||s.values.some(d=>d.includes(",")||d.includes('"'))?(e=this.lists.place(s.values),n=!0):e=`"${i}"`}else e=this.bound(s.formula?.[0]);const r=this.bound(s.formula?.[1]),{error:l,prompt:h}=s;s.multiple===!0&&this.left.push(`${this.sheet.name}!${s.range}: several choices in a cell: its text stays, and Excel's list offers one at a time`);const c={type:s.type,errorStyle:l?.style===void 0||l.style==="stop"?void 0:l.style,operator:s.operator===void 0||s.operator==="between"?void 0:s.operator,allowBlank:s.blank===!1?void 0:!0,showDropDown:s.dropdown===!1?!0:void 0,showInputMessage:h?.show===!1?void 0:!0,showErrorMessage:l?.show===!1||s.multiple===!0?void 0:!0,errorTitle:l?.title,error:l?.message,promptTitle:h?.title,prompt:h?.message};return n?(this.newerValidations.push(o("x14:dataValidation",c,e===""?"":o("x14:formula1",{},o("xm:f",{},x(e))),r===""?"":o("x14:formula2",{},o("xm:f",{},x(r))),o("xm:sqref",{},s.range))),""):o("dataValidation",{...c,sqref:s.range},e===""?"":o("formula1",{},x(e)),r===""?"":o("formula2",{},x(r)))}validations(){const t=this.sheet.validations.map(s=>this.validation(s)).filter(s=>s!=="");return t.length===0?"":o("dataValidations",{count:t.length},t.join(""))}filterColumns(t){return[...t.columns.entries()].sort(([s],[e])=>s-e).map(([s,e])=>tt(s-t.area.left,e))}sheetFilter(){const t=this.sheet.filters.find(s=>!s.table);return t?o("autoFilter",{ref:M(t.area)},...this.filterColumns(t)):""}columnFormula(t,s){if(!s?.node)return"";const e=B(s.node,this.isRangeName),n=N(s.node,{table:t.name,isTable:this.isTable,array:e});return o("calculatedColumnFormula",{array:e?!0:void 0},x(n))}tableXml(t,s){const e=t.area,n=M({...e,bottom:Math.max(e.bottom,e.top+1)}),r=t.spec.style??DEFAULT_TABLE_STYLE,l=this.sheet.filters.find(h=>h.table===t);return S+o("table",{xmlns:k.main,id:s,name:t.name,displayName:t.name,ref:n,totalsRowShown:0},l?o("autoFilter",{ref:n},...this.filterColumns(l)):"",o("tableColumns",{count:t.columns.length},t.columns.map((h,c)=>o("tableColumn",{id:c+1,name:h.name},this.columnFormula(t,h.formula))).join("")),r==="none"?o("tableStyleInfo",{showFirstColumn:0,showLastColumn:0,showRowStripes:1,showColumnStripes:0}):o("tableStyleInfo",{name:r,showFirstColumn:0,showLastColumn:0,showRowStripes:1,showColumnStripes:0}))}}const ie=a=>{let t;for(const s of Object.values(a??{}))s.level!==void 0&&(t=Math.max(t??0,s.level));return t},ae=a=>[a.left===void 0?"":`&L${a.left}`,a.center===void 0?"":`&C${a.center}`,a.right===void 0?"":`&R${a.right}`].join(""),Je=a=>typeof a=="string"?{text:a,author:K}:{text:a.text,author:a.author??K};function Ke(a){const t=a.map(([e,n])=>({ref:e,...Je(n)})),s=[...new Set(t.map(e=>e.author))];return S+o("comments",{xmlns:k.main},o("authors",{},s.map(e=>o("author",{},x(e))).join("")),o("commentList",{},t.map(e=>o("comment",{ref:e.ref,authorId:s.indexOf(e.author)},o("text",{},o("r",{},o("t",/^\s|\s$|\n/u.test(e.text)?{"xml:space":"preserve"}:{},x(e.text)))))).join("")))}function Qe(a){return`<xml xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout><v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>${a.flatMap(([s],e)=>{const n=te(s);return n?[`<v:shape id="_x0000_s${String(1025+e)}" type="#_x0000_t202" style="position:absolute;margin-left:80pt;margin-top:5pt;width:120pt;height:60pt;z-index:${String(e+1)};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto"><v:fill color2="#ffffe1"/><v:shadow on="t" color="black" obscured="t"/><v:path o:connecttype="none"/><v:textbox style="mso-direction-alt:auto"><div style="text-align:left"></div></v:textbox><x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${String(n.col+1)}, 15, ${String(n.row)}, 2, ${String(n.col+3)}, 15, ${String(n.row+4)}, 4</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${String(n.row)}</x:Row><x:Column>${String(n.col)}</x:Column></x:ClientData></v:shape>`]:[]}).join("")}</xml>`}const le=a=>`FF${a.slice(1).toUpperCase()}`;function et(a){if(a.type==="dataBar"||a.type==="colorScale"||a.type==="iconSet")return{};const t={};for(const s of["bold","italic","underline","strike","color","fill","border"])a[s]!==void 0&&(t[s]=a[s]);return t}function tt(a,t){return o("filterColumn",{colId:a},o("filters",{blank:t.blanks===!0?!0:void 0},(t.values??[]).map(s=>o("filter",{val:s})).join("")))}const C=a=>a===void 0?"":` s="${String(a)}"`,ce=a=>a.code!=="#CYCLE!",st=new Set(["width","height","hidden"]);function de(a){if(!a)return;const t=Object.fromEntries(Object.entries(a).filter(([s])=>!st.has(s)));return Object.keys(t).length===0?void 0:t}const V=a=>S+o("Relationships",{xmlns:k.pkg},a.map(([t,s,e],n)=>o("Relationship",{Id:`rId${String(n+1)}`,Type:t,Target:s,TargetMode:e})).join(""));function nt(a,t){const s=t.formula?.node;if(s)return N(s,{isTable:n=>a.table(n)!==void 0,array:!0});const{value:e}=t;return e==null?'""':typeof e=="string"?`"${e.replaceAll('"','""')}"`:typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof P?e.code:String(e)}const ot=(a,t)=>a.length===t.length&&a.every((s,e)=>s===t[e]),he=a=>`$${D(a.left)}$${String(a.top+1)}:$${D(a.right)}$${String(a.bottom+1)}`;function rt(a){const t=[],s=(e,n)=>o("definedName",{name:e.name,localSheetId:n,hidden:e.hidden===!0?!0:void 0},x(nt(a,e)));for(const e of a.names.values())t.push(s(e));return a.sheets.forEach((e,n)=>{for(const d of e.names.values())t.push(s(d,n));const r=e.filters.find(d=>!d.table);r&&t.push(o("definedName",{name:"_xlnm._FilterDatabase",localSheetId:n,hidden:!0},x(`${X(e.name)}${he(r.area)}`)));const l=X(e.name),h=e.spec.print,c=h?.area===void 0?void 0:ge(h.area);c&&t.push(o("definedName",{name:"_xlnm.Print_Area",localSheetId:n},x(`${l}${he(c)}`)));const i=[h?.title_cols?.toUpperCase().replace(/([A-Z]+):([A-Z]+)/u,"$$$1:$$$2"),h?.title_rows?.replace(/(\d+):(\d+)/u,"$$$1:$$$2")].flatMap(d=>d===void 0?[]:[`${l}${d}`]);i.length>0&&t.push(o("definedName",{name:"_xlnm.Print_Titles",localSheetId:n},x(i.join(","))))}),t}export function writeXlsx(a,t={}){const s=a.wb,e=[];s.checks.length>0&&e.push(`${String(s.checks.length)} check${s.checks.length===1?"":"s"}: a file has no such thing`);const n=ke(a);e.push(...n.left);const r=new Me,l=new Ve,h=new We(s),c=new _e,i=[["/xl/workbook.xml",A.sheet]],d=Math.max(0,s.sheets.findIndex(p=>p.spec.hidden!==!0));let f=1,m=!1;const u=new Map;let $=0,T=0,y=0;for(const[p,w]of s.sheets.entries()){const H=String(p+1),O=Be(w,a,t.file,e),F=w.charts.filter(({spec:g})=>[g.categories,...g.series.flatMap(E=>[E.values,E.x])].some(E=>E?.endsWith("#"))).length;F>0&&e.push(`${w.name}: ${String(F)} chart${F===1?"":"s"} on a spill: ${F===1?"it reads":"they read"} the cells the spill covers now, and will not grow with it`);const Z=new Ze(w,a,r,l,t.cached!==!1,e,h,p,O,n.sheets.find(g=>g.sheet===w)),me=Z.write(c.part(`xl/worksheets/sheet${H}.xml`),p===d,f);m||=Z.arrays,i.push([`/xl/worksheets/sheet${H}.xml`,A.worksheet]);const R=[];for(const g of me){const E=`table${String(f)}.xml`;f+=1,c.add(`xl/tables/${E}`,g),i.push([`/xl/tables/${E}`,A.table]),R.push([`${v}table`,`../tables/${E}`])}if(w.charts.length>0||O.length>0){$+=1;const g=`drawing${String($)}.xml`;c.add(`xl/drawings/${g}`,Te(w.charts,O)),i.push([`/xl/drawings/${g}`,A.drawing]),R.push([`${v}drawing`,`../drawings/${g}`]);const E=w.charts.map(L=>{T+=1;const I=`chart${String(T)}.xml`;return c.add(`xl/charts/${I}`,Ee(a,w,L)),i.push([`/xl/charts/${I}`,A.chart]),[`${v}chart`,`../charts/${I}`]});for(const L of O){const J=[...u].find(([,ue])=>ot(ue,L.bytes))?.[0]??`image${String(u.size+1)}${L.file}`;u.set(J,L.bytes),E.push([`${v}image`,`../media/${J}`])}c.add(`xl/drawings/_rels/${g}.rels`,V(E))}const U=Object.entries(w.spec.notes??{});if(U.length>0){y+=1;const g=String(y);c.add(`xl/comments${g}.xml`,Ke(U)),i.push([`/xl/comments${g}.xml`,A.comments]),c.add(`xl/drawings/vmlDrawing${g}.vml`,Qe(U)),R.push([`${v}vmlDrawing`,`../drawings/vmlDrawing${g}.vml`]),R.push([`${v}comments`,`../comments${g}.xml`])}for(const g of Object.values(w.spec.links??{}))g.startsWith("#")||R.push([`${v}hyperlink`,g,"External"]);R.length>0&&c.add(`xl/worksheets/_rels/sheet${H}.xml.rels`,V(R))}const b=s.sheets.length,z=h.columns.length>0;if(z){const p=`xl/worksheets/sheet${String(b+1)}.xml`;c.add(p,h.xml(l)),i.push([`/${p}`,A.worksheet])}const j=[...s.sheets,...z?[void 0]:[]].map((p,w)=>[`${v}worksheet`,`worksheets/sheet${String(w+1)}.xml`]);j.push([`${v}theme`,"theme/theme1.xml"]),j.push([`${v}styles`,"styles.xml"]),j.push([`${v}sharedStrings`,"sharedStrings.xml"]),m&&(j.push([`${v}sheetMetadata`,"metadata.xml"]),i.push(["/xl/metadata.xml",A.metadata]));const G=rt(s),Y=s.sheets.map((p,w)=>o("sheet",{name:p.name,sheetId:w+1,state:p.spec.hidden===!0?"hidden":void 0,"r:id":`rId${String(w+1)}`}));z&&Y.push(o("sheet",{name:h.name,sheetId:b+1,state:"veryHidden","r:id":`rId${String(b+1)}`})),c.add("xl/workbook.xml",S+o("workbook",{xmlns:k.main,"xmlns:r":k.rel},o("workbookPr",{}),o("bookViews",{},o("workbookView",{activeTab:d===0?void 0:d})),o("sheets",{},Y.join("")),G.length>0?o("definedNames",{},G.join("")):"",o("calcPr",{calcId:je,fullCalcOnLoad:!0}))),c.add("xl/_rels/workbook.xml.rels",V(j)),c.add("xl/styles.xml",S+r.xml()),l.write(c.part("xl/sharedStrings.xml")),c.add("xl/theme/theme1.xml",S+Re),m&&c.add("xl/metadata.xml",S+Ne),c.add("docProps/core.xml",S+o("cp:coreProperties",{"xmlns:cp":"http://schemas.openxmlformats.org/package/2006/metadata/core-properties","xmlns:dc":"http://purl.org/dc/elements/1.1/"},s.title===void 0?"":o("dc:title",{},x(s.title)))),c.add("docProps/app.xml",S+o("Properties",{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"},o("Application",{},"AllyHub"))),c.add("_rels/.rels",V([[`${v}officeDocument`,"xl/workbook.xml"],["http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"],[`${v}extended-properties`,"docProps/app.xml"]])),i.push(["/xl/styles.xml",A.styles],["/xl/sharedStrings.xml",A.strings],["/xl/theme/theme1.xml",A.theme],["/docProps/core.xml",A.core],["/docProps/app.xml",A.app]);const fe=[...u].sort(([p],[w])=>p.localeCompare(w));for(const[p,w]of fe)c.add(`xl/media/${p}`,w);return c.add("[Content_Types].xml",S+o("Types",{xmlns:k.types},o("Default",{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}),o("Default",{Extension:"xml",ContentType:"application/xml"}),y>0?o("Default",{Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"}):"",[...new Set([...u.keys()].map(p=>p.split(".").pop()??""))].sort().map(p=>o("Default",{Extension:p,ContentType:`image/${p==="jpg"?"jpeg":p}`})).join(""),i.map(([p,w])=>o("Override",{PartName:p,ContentType:w})).join(""))),{bytes:c.finish(),left:e}}
@@ -0,0 +1,40 @@
1
+ import { type ZipLimits } from "@allyhub-next/formats";
2
+ /** A part being written: text in order, then its end. */
3
+ export interface PartWriter {
4
+ write(text: string): void;
5
+ end(): void;
6
+ }
7
+ /** A zip written a part at a time, one part after another. */
8
+ export declare class ZipOut {
9
+ private readonly chunks;
10
+ private readonly zip;
11
+ private readonly encoder;
12
+ private open;
13
+ constructor();
14
+ private entry;
15
+ /** A part written in pieces. */
16
+ part(path: string): PartWriter;
17
+ /** A whole part at once. */
18
+ add(path: string, content: string | Uint8Array): void;
19
+ /** The zip's bytes; nothing can be added after. */
20
+ finish(): Uint8Array;
21
+ }
22
+ /** A zip read through its central directory: any part, when it is asked for. */
23
+ export declare class ZipIn {
24
+ private readonly bytes;
25
+ private readonly entries;
26
+ private readonly lower;
27
+ constructor(bytes: Uint8Array, limits?: Partial<ZipLimits>);
28
+ get names(): string[];
29
+ private find;
30
+ has(path: string): boolean;
31
+ /** Its parts as the central directory lists them. */
32
+ private directory;
33
+ /** A part's bytes, a piece at a time; never more than the directory says it holds. */
34
+ stream(path: string, onBytes: (chunk: Uint8Array) => void): boolean;
35
+ /** A part's text, a piece at a time. */
36
+ streamText(path: string, onText: (text: string) => void): boolean;
37
+ bytesOf(path: string): Uint8Array | undefined;
38
+ text(path: string): string | undefined;
39
+ }
40
+ //# sourceMappingURL=zip.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{Inflate as C,Zip as D,ZipDeflate as M}from"fflate";import{withinZip as U,ZipLimitError as E}from"@allyhub-next/formats";const O=new Date(1980,0,1),_=1<<20;export class ZipOut{chunks=[];zip;encoder=new TextEncoder;open=!1;constructor(){this.zip=new D((t,e)=>{if(t)throw t;this.chunks.push(e)})}entry(t){if(this.open)throw new Error(`${t} is written while a part is open.`);const e=new M(t,{level:6});return e.mtime=O,this.zip.add(e),e}part(t){const e=this.entry(t);this.open=!0;let n=[],s=0;const i=o=>{const r=n.length===1?n[0]??"":n.join("");n=[],s=0,e.push(this.encoder.encode(r),o)};return{write:o=>{n.push(o),s+=o.length,s>=_&&i(!1)},end:()=>{i(!0),this.open=!1}}}add(t,e){this.entry(t).push(typeof e=="string"?this.encoder.encode(e):e,!0)}finish(){this.zip.end();let t=0;for(const s of this.chunks)t+=s.length;const e=new Uint8Array(t);let n=0;for(const s of this.chunks)e.set(s,n),n+=s.length;return e}}const g=65536,h=(f,t)=>(f[t]??0)|(f[t+1]??0)<<8,a=(f,t)=>(h(f,t)|h(f,t+2)<<16)>>>0,d=(f,t)=>a(f,t)+a(f,t+4)*4294967296,A=f=>{let t="";for(const e of f)t+=String.fromCharCode(e);return t};export class ZipIn{bytes;entries=new Map;lower=new Map;constructor(t,e){this.bytes=t;const n=U(e);for(const s of this.directory())n({name:s.name,originalSize:s.size}),this.entries.set(s.name,s),this.lower.set(s.name.toLowerCase(),s)}get names(){return[...this.entries.keys()]}find(t){return this.entries.get(t)??this.lower.get(t.toLowerCase())}has(t){return this.find(t)!==void 0}*directory(){const t=this.bytes;let e=-1;for(let r=t.length-22;r>=Math.max(0,t.length-22-65535);r--)if(a(t,r)===101010256){e=r;break}if(e<0)throw new Error("It has no zip directory.");let n=h(t,e+10),s=a(t,e+16);if((n===65535||s===4294967295)&&a(t,e-20)===117853008){const r=d(t,e-12);if(a(t,r)!==101075792)throw new Error("Its zip64 end is lost.");n=d(t,r+32),s=d(t,r+48)}const i=new TextDecoder;let o=s;for(let r=0;r<n;r++){if(a(t,o)!==33639248)throw new Error("Its zip directory is damaged.");const I=h(t,o+8),Z=h(t,o+10);let w=a(t,o+20),m=a(t,o+24);const y=h(t,o+28),L=h(t,o+30),T=h(t,o+32);let c=a(t,o+42);const x=t.subarray(o+46,o+46+y),p=I&2048?i.decode(x):A(x);let l=o+46+y;const z=l+L;for(;l+4<=z;){const $=h(t,l),k=h(t,l+2);if($===1){let u=l+4;m===4294967295&&(m=d(t,u),u+=8),w===4294967295&&(w=d(t,u),u+=8),c===4294967295&&(c=d(t,u))}l+=4+k}if(o=z+T,a(t,c)!==67324752)throw new Error(`Its part ${p} is lost.`);const b=c+30+h(t,c+26)+h(t,c+28);if(b+w>t.length)throw new Error(`Its part ${p} is cut short.`);p.endsWith("/")||(yield{name:p,method:Z,start:b,compressed:w,size:m})}}stream(t,e){const n=this.find(t);if(!n)return!1;const s=this.bytes.subarray(n.start,n.start+n.compressed);if(n.method===0){if(s.length>n.size)throw new E(`${n.name} holds more than it says.`);return e(s),!0}if(n.method!==8)throw new Error(`${n.name} is compressed in a way a zip reader here does not know.`);let i=0;const o=new C(r=>{if(i+=r.length,i>n.size)throw new E(`${n.name} unzips to more than it says.`);e(r)});for(let r=0;r<s.length;r+=g)o.push(s.subarray(r,r+g),r+g>=s.length);return s.length===0&&o.push(s,!0),!0}streamText(t,e){const n=new TextDecoder;if(!this.stream(t,o=>{const r=n.decode(o,{stream:!0});r!==""&&e(r)}))return!1;const i=n.decode();return i!==""&&e(i),!0}bytesOf(t){const e=this.find(t);if(!e)return;const n=new Uint8Array(e.size);let s=0;return this.stream(t,i=>{n.set(i,s),s+=i.length}),s===n.length?n:n.subarray(0,s)}text(t){const e=this.bytesOf(t);return e===void 0?void 0:new TextDecoder().decode(e)}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/sheet",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{pathSteps as g}from"./path.js";import{EMU_PER_PT as h}from"./units.js";export const ANIMATION_DURATIONS={appear:0,fade:.5,wipe:.5,"fly-in":.5,zoom:.5,disappear:0,"fade-out":.5,"wipe-out":.5,"fly-out":.5,"zoom-out":.5,pulse:.5,path:2};const S=new Set(["disappear","fade-out","wipe-out","fly-out","zoom-out"]),M=new Set(["appear","fade","wipe","fly-in","zoom"]);export const isExit=t=>S.has(t),isEntrance=t=>M.has(t),TRANSITION_DURATIONS={fade:.7,push:1,wipe:1,morph:2},resolveTransition=t=>({type:t.type,direction:t.direction??"from-right",duration:t.duration??TRANSITION_DURATIONS[t.type]});const w={"from-left":{x:-1,y:0},"from-right":{x:1,y:0},"from-top":{x:0,y:-1},"from-bottom":{x:0,y:1}};export function transitionAt(t,o){const e={opacity:1,x:0,y:0};if(t.type==="fade")return{incoming:{...e,opacity:o},outgoing:{x:0,y:0}};if(t.type==="push"){const n=w[t.direction];return{incoming:{...e,x:n.x*(1-o),y:n.y*(1-o)},outgoing:{x:-n.x*o,y:-n.y*o}}}return t.type==="wipe"?{incoming:{...e,clip:d(t.direction,1-o)},outgoing:{x:0,y:0}}:{incoming:e,outgoing:{x:0,y:0}}}export function morphFrame(t,o,e){const n=e*e*(3-2*e),i=(p,f)=>p+(f-p)*n;return{left:i(t.left,o.left),top:i(t.top,o.top),width:i(t.width,o.width),height:i(t.height,o.height)}}export function resolveAnimation(t){const o=t.path===void 0?void 0:g(t.path);if(!(t.path!==void 0&&!o)&&!(t.effect==="path"&&!o))return{shape:t.shape,...t.paragraph===void 0?{}:{paragraph:t.paragraph},effect:t.effect,direction:t.direction??"from-bottom",start:t.start??"on-click",duration:t.duration??ANIMATION_DURATIONS[t.effect],delay:t.delay??0,...o?{path:o.map(e=>e.op==="close"?e:e.op!=="curve"?{...e,x:e.x*h,y:e.y*h}:{op:"curve",x1:e.x1*h,y1:e.y1*h,x2:e.x2*h,y2:e.y2*h,x:e.x*h,y:e.y*h})}:{}}}export function slideClock(t,o,e,n=0,i=0){const p=new Set(t.filter(s=>isEntrance(s.effect)).map(s=>s.shape));let f=i+(o.some(s=>!p.has(s))?e:0);if(t.length===0)return{timed:[],rests:[Math.max(e,i)]};const r=[],c=[];let a=0,u=i;for(const s of t){s.start==="on-click"?(r.push(f),a++,f+=n,u=f):s.start==="after-previous"&&(u=f);const y=u+s.delay,l=y+s.duration;c.push({...s,step:a,from:y,to:l}),f=Math.max(f,l),o.includes(s.shape)&&isEntrance(s.effect)&&(f=Math.max(f,y+e))}return r.push(f),{timed:c,rests:r}}export const SLIDE_SECONDS=4,DECK_FPS=30;const E=t=>Math.ceil(t*DECK_FPS-1e-6)/DECK_FPS;export function clockOf(t,o){const e=o?0:t.transition?.duration??0,n=slideClock(t.animations,t.shapes.flatMap(i=>i.component?[i.name]:[]),SLIDE_SECONDS-1/DECK_FPS,1/DECK_FPS,e);return{timed:n.timed,rests:n.rests.map(E),lead:e,comesOn:i=>n.timed.find(p=>p.shape===i&&isEntrance(p.effect))?.from??e,goesOff:i=>n.timed.find(p=>p.shape===i&&isExit(p.effect))?.to}}const T=1e-6,x={hidden:!1,opacity:1,x:0,y:0,scale:1},N=t=>1-(1-t)*(1-t);function A(t){const o=[];let e={x:0,y:0};for(const n of t){if(n.op==="close")continue;if(n.op!=="curve"){e={x:n.x,y:n.y},o.push(e);continue}const i=e;for(let p=1;p<=24;p++){const f=p/24,r=1-f,c=(a,u,s,y)=>r*r*r*a+3*r*r*f*u+3*r*f*f*s+f*f*f*y;o.push({x:c(i.x,n.x1,n.x2,n.x),y:c(i.y,n.y1,n.y2,n.y)})}e={x:n.x,y:n.y}}return o}export function pathPoint(t,o){const e=A(t),[n]=e;if(!n)return{x:0,y:0};let i=0;for(let f=1;f<e.length;f++){const[r,c]=[e[f-1]??n,e[f]??n];i+=Math.hypot(c.x-r.x,c.y-r.y)}let p=i*o;for(let f=1;f<e.length;f++){const[r,c]=[e[f-1]??n,e[f]??n],a=Math.hypot(c.x-r.x,c.y-r.y);if(p<=a&&a>0){const u=p/a;return{x:r.x+(c.x-r.x)*u,y:r.y+(c.y-r.y)*u}}p-=a}return e.at(-1)??n}function I(t,o,e){return t==="from-left"?{x:-(o.left+o.width),y:0}:t==="from-right"?{x:e.width-o.left,y:0}:t==="from-top"?{x:0,y:-(o.top+o.height)}:{x:0,y:e.height-o.top}}function d(t,o){const e={top:0,right:0,bottom:0,left:0};return t==="from-left"?e.right=o:t==="from-right"?e.left=o:t==="from-top"?e.bottom=o:e.top=o,e}function m(t,o,e,n){if(t.effect==="fade"||t.effect==="fade-out")return{opacity:o};if(t.effect==="zoom"||t.effect==="zoom-out")return{scale:o,opacity:o};if(t.effect==="wipe"||t.effect==="wipe-out")return{clip:d(t.direction,1-o)};if(t.effect==="fly-in"||t.effect==="fly-out"){const i=I(t.direction,e,n);return{x:i.x*(1-o),y:i.y*(1-o)}}return{}}export function drawnAt(t,o,e,n){let i={...x};const[p]=t,f=r=>o<r-T;if(p&&isEntrance(p.effect)&&f(p.from))return{...x,hidden:!0};for(const r of t){if(f(r.from))break;const c=r.to>r.from?Math.min(1,(o-r.from)/(r.to-r.from)):1;if(r.effect==="path"&&r.path){const a=pathPoint(r.path,c);i={...i,x:a.x,y:a.y}}else r.effect==="pulse"?i={...i,scale:1+.05*Math.sin(c*Math.PI)}:isExit(r.effect)?i=c>=1?{...x,hidden:!0}:{...i,...m(r,1-(r.effect==="fly-out"?c*c:c),e,n)}:i={...x,...c<1?m(r,r.effect==="fly-in"?N(c):c,e,n):{}}}return i}export function animationTargets(t){const o=new Map;for(const e of t){const n=JSON.stringify([e.shape,e.paragraph??null]),i=o.get(n);i?i.animations.push(e):o.set(n,{shape:e.shape,...e.paragraph===void 0?{}:{paragraph:e.paragraph},animations:[e]})}return[...o.values()]}
2
+ import{pathSteps as S}from"./path.js";import{EMU_PER_PT as h}from"./units.js";export const ANIMATION_DURATIONS={appear:0,fade:.5,wipe:.5,"fly-in":.5,zoom:.5,disappear:0,"fade-out":.5,"wipe-out":.5,"fly-out":.5,"zoom-out":.5,pulse:.5,path:2};const M=new Set(["disappear","fade-out","wipe-out","fly-out","zoom-out"]),w=new Set(["appear","fade","wipe","fly-in","zoom"]);export const isExit=t=>M.has(t),isEntrance=t=>w.has(t),TRANSITION_DURATIONS={fade:.7,push:1,wipe:1,morph:2},resolveTransition=t=>({type:t.type,direction:t.direction??"from-right",duration:t.duration??TRANSITION_DURATIONS[t.type]});const E={"from-left":{x:-1,y:0},"from-right":{x:1,y:0},"from-top":{x:0,y:-1},"from-bottom":{x:0,y:1}};export function transitionAt(t,o){const e={opacity:1,x:0,y:0};if(t.type==="fade")return{incoming:{...e,opacity:o},outgoing:{x:0,y:0}};if(t.type==="push"){const n=E[t.direction];return{incoming:{...e,x:n.x*(1-o),y:n.y*(1-o)},outgoing:{x:-n.x*o,y:-n.y*o}}}return t.type==="wipe"?{incoming:{...e,clip:m(t.direction,1-o)},outgoing:{x:0,y:0}}:{incoming:e,outgoing:{x:0,y:0}}}export function morphFrame(t,o,e){const n=e*e*(3-2*e),i=(p,f)=>p+(f-p)*n;return{left:i(t.left,o.left),top:i(t.top,o.top),width:i(t.width,o.width),height:i(t.height,o.height)}}export function resolveAnimation(t){const o=t.path===void 0?void 0:S(t.path);if(!(t.path!==void 0&&!o)&&!(t.effect==="path"&&!o))return{shape:t.shape,...t.paragraph===void 0?{}:{paragraph:t.paragraph},effect:t.effect,direction:t.direction??"from-bottom",start:t.start??"on-click",duration:t.duration??ANIMATION_DURATIONS[t.effect],delay:t.delay??0,...o?{path:o.map(e=>e.op==="close"?e:e.op!=="curve"?{...e,x:e.x*h,y:e.y*h}:{op:"curve",x1:e.x1*h,y1:e.y1*h,x2:e.x2*h,y2:e.y2*h,x:e.x*h,y:e.y*h})}:{}}}export function slideClock(t,o,e,n=0,i=0){const p=new Set(t.filter(s=>isEntrance(s.effect)).map(s=>s.shape));let f=i+(o.some(s=>!p.has(s))?e:0);if(t.length===0)return{timed:[],rests:[Math.max(e,i)]};const r=[],c=[];let a=0,u=i;for(const s of t){s.start==="on-click"?(r.push(f),a++,f+=n,u=f):s.start==="after-previous"&&(u=f);const y=u+s.delay,l=y+s.duration;c.push({...s,step:a,from:y,to:l}),f=Math.max(f,l),o.includes(s.shape)&&isEntrance(s.effect)&&(f=Math.max(f,y+e))}return r.push(f),{timed:c,rests:r}}export const SLIDE_SECONDS=4,DECK_FPS=30;const T=t=>Math.ceil(t*DECK_FPS-1e-6)/DECK_FPS;export function clockOf(t,o){const e=o?0:t.transition?.duration??0,n=slideClock(t.animations,t.shapes.flatMap(i=>i.component?[i.name]:[]),SLIDE_SECONDS-1/DECK_FPS,1/DECK_FPS,e);return{timed:n.timed,rests:n.rests.map(T),lead:e,comesOn:i=>n.timed.find(p=>p.shape===i&&isEntrance(p.effect))?.from??e,goesOff:i=>n.timed.find(p=>p.shape===i&&isExit(p.effect))?.to}}const d=1e-6,x={hidden:!1,opacity:1,x:0,y:0,scale:1},N=t=>1-(1-t)*(1-t);function A(t){const o=[];let e={x:0,y:0};for(const n of t){if(n.op==="close")continue;if(n.op!=="curve"){e={x:n.x,y:n.y},o.push(e);continue}const i=e;for(let p=1;p<=24;p++){const f=p/24,r=1-f,c=(a,u,s,y)=>r*r*r*a+3*r*r*f*u+3*r*f*f*s+f*f*f*y;o.push({x:c(i.x,n.x1,n.x2,n.x),y:c(i.y,n.y1,n.y2,n.y)})}e={x:n.x,y:n.y}}return o}export function pathPoint(t,o){const e=A(t),[n]=e;if(!n)return{x:0,y:0};let i=0;for(let f=1;f<e.length;f++){const[r,c]=[e[f-1]??n,e[f]??n];i+=Math.hypot(c.x-r.x,c.y-r.y)}let p=i*o;for(let f=1;f<e.length;f++){const[r,c]=[e[f-1]??n,e[f]??n],a=Math.hypot(c.x-r.x,c.y-r.y);if(p<=a&&a>0){const u=p/a;return{x:r.x+(c.x-r.x)*u,y:r.y+(c.y-r.y)*u}}p-=a}return e.at(-1)??n}function I(t,o,e){return t==="from-left"?{x:-(o.left+o.width),y:0}:t==="from-right"?{x:e.width-o.left,y:0}:t==="from-top"?{x:0,y:-(o.top+o.height)}:{x:0,y:e.height-o.top}}function m(t,o){const e={top:0,right:0,bottom:0,left:0};return t==="from-left"?e.right=o:t==="from-right"?e.left=o:t==="from-top"?e.bottom=o:e.top=o,e}function g(t,o,e,n){if(t.effect==="fade"||t.effect==="fade-out")return{opacity:o};if(t.effect==="zoom"||t.effect==="zoom-out")return{scale:o,opacity:o};if(t.effect==="wipe"||t.effect==="wipe-out")return{clip:m(t.direction,1-o)};if(t.effect==="fly-in"||t.effect==="fly-out"){const i=I(t.direction,e,n);return{x:i.x*(1-o),y:i.y*(1-o)}}return{}}export function drawnAt(t,o,e,n){let i={...x};const[p]=t,f=r=>o<r-d;if(p&&isEntrance(p.effect)&&f(p.from))return{...x,hidden:!0};for(const r of t){if(f(r.from))break;const c=r.to>r.from&&o<r.to-d?Math.min(1,(o-r.from)/(r.to-r.from)):1;if(r.effect==="path"&&r.path){const a=pathPoint(r.path,c);i={...i,x:a.x,y:a.y}}else r.effect==="pulse"?i={...i,scale:1+.05*Math.sin(c*Math.PI)}:isExit(r.effect)?i=c>=1?{...x,hidden:!0}:{...i,...g(r,1-(r.effect==="fly-out"?c*c:c),e,n)}:i={...x,...c<1?g(r,r.effect==="fly-in"?N(c):c,e,n):{}}}return i}export function animationTargets(t){const o=new Map;for(const e of t){const n=JSON.stringify([e.shape,e.paragraph??null]),i=o.get(n);i?i.animations.push(e):o.set(n,{shape:e.shape,...e.paragraph===void 0?{}:{paragraph:e.paragraph},animations:[e]})}return[...o.values()]}