allyhub 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (632) hide show
  1. package/dist/audio-text.js +1 -1
  2. package/dist/commands/add.js +2 -2
  3. package/dist/commands/cloud-tools.js +5 -5
  4. package/dist/commands/dev.js +1 -1
  5. package/dist/commands/frames/piece.js +1 -1
  6. package/dist/commands/frames/sheet.js +1 -1
  7. package/dist/commands/frames.js +8 -8
  8. package/dist/commands/index.js +1 -1
  9. package/dist/commands/inspect/common.js +1 -1
  10. package/dist/commands/inspect/layout.js +1 -1
  11. package/dist/commands/render.js +1 -1
  12. package/dist/commands/sheet.js +7 -7
  13. package/dist/commands/site.js +3 -2
  14. package/dist/commands/skills.js +3 -3
  15. package/dist/commands/slides.js +2 -2
  16. package/dist/node_modules/@allyhub-next/audio/dist/node/index.js +1 -1
  17. package/dist/node_modules/@allyhub-next/audio/dist/node/master.js +1 -1
  18. package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
  19. package/dist/node_modules/@allyhub-next/browser/dist/html.js +1 -1
  20. package/dist/node_modules/@allyhub-next/browser/package.json +1 -1
  21. package/dist/node_modules/@allyhub-next/build/dist/content.d.ts +4 -0
  22. package/dist/node_modules/@allyhub-next/build/dist/content.js +1 -1
  23. package/dist/node_modules/@allyhub-next/build/dist/index.d.ts +2 -2
  24. package/dist/node_modules/@allyhub-next/build/dist/index.js +1 -1
  25. package/dist/node_modules/@allyhub-next/build/dist/meta-worker.d.ts +2 -2
  26. package/dist/node_modules/@allyhub-next/build/dist/meta-worker.js +3 -3
  27. package/dist/node_modules/@allyhub-next/build/dist/move-refs.d.ts +1 -1
  28. package/dist/node_modules/@allyhub-next/build/dist/move-refs.js +1 -1
  29. package/dist/node_modules/@allyhub-next/build/dist/plugin.d.ts +12 -3
  30. package/dist/node_modules/@allyhub-next/build/dist/plugin.js +7 -6
  31. package/dist/node_modules/@allyhub-next/build/dist/prepare.d.ts +9 -5
  32. package/dist/node_modules/@allyhub-next/build/dist/prepare.js +2 -2
  33. package/dist/node_modules/@allyhub-next/build/dist/vite.d.ts +10 -0
  34. package/dist/node_modules/@allyhub-next/build/dist/vite.js +2 -2
  35. package/dist/node_modules/@allyhub-next/build/package.json +1 -1
  36. package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +2 -2
  37. package/dist/node_modules/@allyhub-next/chart/dist/chart.d.ts +14 -5
  38. package/dist/node_modules/@allyhub-next/chart/dist/chart.js +1 -1
  39. package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
  40. package/dist/node_modules/@allyhub-next/check/dist/check.js +3 -3
  41. package/dist/node_modules/@allyhub-next/check/package.json +1 -1
  42. package/dist/node_modules/@allyhub-next/cloud/dist/blobs.js +2 -0
  43. package/dist/node_modules/@allyhub-next/cloud/dist/call.js +4 -2
  44. package/dist/node_modules/@allyhub-next/cloud/dist/client.js +1 -1
  45. package/dist/node_modules/@allyhub-next/cloud/dist/errors.js +1 -1
  46. package/dist/node_modules/@allyhub-next/cloud/dist/hashes.js +2 -0
  47. package/dist/node_modules/@allyhub-next/cloud/dist/index.js +1 -1
  48. package/dist/node_modules/@allyhub-next/cloud/dist/sites.js +2 -0
  49. package/dist/node_modules/@allyhub-next/cloud/dist/voice.js +1 -1
  50. package/dist/node_modules/@allyhub-next/cloud/package.json +1 -1
  51. package/dist/node_modules/@allyhub-next/components/package.json +1 -1
  52. package/dist/node_modules/@allyhub-next/components/r/caption-subtitle.json +1 -1
  53. package/dist/node_modules/@allyhub-next/components/src/caption-subtitle.ts +54 -16
  54. package/dist/node_modules/@allyhub-next/dev-server/dist/background.js +1 -1
  55. package/dist/node_modules/@allyhub-next/dev-server/dist/exports.js +1 -1
  56. package/dist/node_modules/@allyhub-next/dev-server/dist/fonts.js +2 -0
  57. package/dist/node_modules/@allyhub-next/dev-server/dist/index.js +1 -1
  58. package/dist/node_modules/@allyhub-next/dev-server/dist/live.js +1 -1
  59. package/dist/node_modules/@allyhub-next/dev-server/dist/project.js +1 -1
  60. package/dist/node_modules/@allyhub-next/dev-server/dist/reach.js +2 -0
  61. package/dist/node_modules/@allyhub-next/dev-server/dist/record.js +2 -0
  62. package/dist/node_modules/@allyhub-next/dev-server/dist/server.js +2 -2
  63. package/dist/node_modules/@allyhub-next/dev-server/dist/tools.js +1 -1
  64. package/dist/node_modules/@allyhub-next/dev-server/dist/tree.js +2 -0
  65. package/dist/node_modules/@allyhub-next/dev-server/package.json +1 -1
  66. package/dist/node_modules/@allyhub-next/doc/package.json +1 -1
  67. package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.js +1 -1
  68. package/dist/node_modules/@allyhub-next/export/dist/export.js +5 -5
  69. package/dist/node_modules/@allyhub-next/export/dist/index.js +1 -1
  70. package/dist/node_modules/@allyhub-next/export/package.json +1 -1
  71. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.d.ts +205 -0
  72. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.js +2 -0
  73. package/dist/node_modules/@allyhub-next/formats/dist/data/script.d.ts +4 -1
  74. package/dist/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
  75. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +248 -18
  76. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +1 -1
  77. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +1114 -91
  78. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
  79. package/dist/node_modules/@allyhub-next/formats/dist/data/website.d.ts +20 -0
  80. package/dist/node_modules/@allyhub-next/formats/dist/data/website.js +2 -0
  81. package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +4 -0
  82. package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
  83. package/dist/node_modules/@allyhub-next/formats/dist/items.d.ts +1 -1
  84. package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
  85. package/dist/node_modules/@allyhub-next/formats/dist/media-type.d.ts +3 -0
  86. package/dist/node_modules/@allyhub-next/formats/dist/media-type.js +2 -0
  87. package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +625 -30
  88. package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
  89. package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +2 -0
  90. package/dist/node_modules/@allyhub-next/formats/dist/strict.js +1 -1
  91. package/dist/node_modules/@allyhub-next/formats/dist/zip.d.ts +17 -0
  92. package/dist/node_modules/@allyhub-next/formats/dist/zip.js +2 -0
  93. package/dist/node_modules/@allyhub-next/formats/package.json +2 -1
  94. package/dist/node_modules/@allyhub-next/measure/package.json +1 -1
  95. package/dist/node_modules/@allyhub-next/media/dist/index.d.ts +1 -1
  96. package/dist/node_modules/@allyhub-next/media/dist/index.js +1 -1
  97. package/dist/node_modules/@allyhub-next/media/dist/sheet.d.ts +2 -0
  98. package/dist/node_modules/@allyhub-next/media/dist/sheet.js +7 -7
  99. package/dist/node_modules/@allyhub-next/media/package.json +1 -1
  100. package/dist/node_modules/@allyhub-next/model/package.json +1 -1
  101. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.d.ts +31 -0
  102. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.js +2 -0
  103. package/dist/node_modules/@allyhub-next/ooxml/dist/color.d.ts +33 -0
  104. package/dist/node_modules/@allyhub-next/ooxml/dist/color.js +2 -0
  105. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.d.ts +13 -0
  106. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.js +2 -0
  107. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.d.ts +79 -0
  108. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.js +2 -0
  109. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.d.ts +132 -0
  110. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.js +2 -0
  111. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.d.ts +28 -0
  112. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.js +2 -0
  113. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.d.ts +4708 -0
  114. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.js +2 -0
  115. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.d.ts +57 -0
  116. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.js +2 -0
  117. package/dist/node_modules/@allyhub-next/ooxml/dist/index.d.ts +10 -0
  118. package/dist/node_modules/@allyhub-next/ooxml/dist/index.js +2 -0
  119. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.d.ts +12 -0
  120. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.js +2 -0
  121. package/dist/node_modules/@allyhub-next/ooxml/dist/node.d.ts +111 -0
  122. package/dist/node_modules/@allyhub-next/ooxml/dist/node.js +2 -0
  123. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.d.ts +45 -0
  124. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.js +2 -0
  125. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.d.ts +48 -0
  126. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.js +2 -0
  127. package/dist/node_modules/@allyhub-next/ooxml/dist/report.d.ts +45 -0
  128. package/dist/node_modules/@allyhub-next/ooxml/dist/report.js +2 -0
  129. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.d.ts +28 -0
  130. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.js +2 -0
  131. package/dist/node_modules/@allyhub-next/ooxml/package.json +26 -0
  132. package/dist/node_modules/@allyhub-next/project/dist/deck-keys.js +2 -0
  133. package/dist/node_modules/@allyhub-next/project/dist/deck-measure.js +2 -0
  134. package/dist/node_modules/@allyhub-next/project/dist/deck-pool.js +2 -0
  135. package/dist/node_modules/@allyhub-next/project/dist/index.js +1 -1
  136. package/dist/node_modules/@allyhub-next/project/dist/session.js +1 -1
  137. package/dist/node_modules/@allyhub-next/project/dist/stills.js +2 -0
  138. package/dist/node_modules/@allyhub-next/project/package.json +1 -1
  139. package/dist/node_modules/@allyhub-next/protocol/dist/account.d.ts +338 -0
  140. package/dist/node_modules/@allyhub-next/protocol/dist/account.js +2 -0
  141. package/dist/node_modules/@allyhub-next/protocol/dist/auth.d.ts +12 -13
  142. package/dist/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
  143. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.d.ts +35 -0
  144. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.js +2 -0
  145. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +101 -32
  146. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
  147. package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +89 -5
  148. package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
  149. package/dist/node_modules/@allyhub-next/protocol/dist/files.d.ts +2 -2
  150. package/dist/node_modules/@allyhub-next/protocol/dist/index.d.ts +6 -0
  151. package/dist/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
  152. package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +23 -0
  153. package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
  154. package/dist/node_modules/@allyhub-next/protocol/dist/open.d.ts +13 -0
  155. package/dist/node_modules/@allyhub-next/protocol/dist/open.js +2 -0
  156. package/dist/node_modules/@allyhub-next/protocol/dist/registry.d.ts +73 -59
  157. package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
  158. package/dist/node_modules/@allyhub-next/protocol/dist/routes.d.ts +1 -1
  159. package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
  160. package/dist/node_modules/@allyhub-next/protocol/dist/shares.d.ts +115 -0
  161. package/dist/node_modules/@allyhub-next/protocol/dist/shares.js +2 -0
  162. package/dist/node_modules/@allyhub-next/protocol/dist/sites.d.ts +293 -0
  163. package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +2 -0
  164. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +377 -0
  165. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +2 -0
  166. package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +27 -9
  167. package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
  168. package/dist/node_modules/@allyhub-next/protocol/dist/tools.d.ts +53 -14
  169. package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
  170. package/dist/node_modules/@allyhub-next/protocol/package.json +2 -1
  171. package/dist/node_modules/@allyhub-next/registry/package.json +1 -1
  172. package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.js +3 -2
  173. package/dist/node_modules/@allyhub-next/render/dist/doc/index.js +1 -1
  174. package/dist/node_modules/@allyhub-next/render/dist/doc/pdf.js +34 -0
  175. package/dist/node_modules/@allyhub-next/render/dist/doc/print.js +4 -4
  176. package/dist/node_modules/@allyhub-next/render/dist/exports.js +2 -2
  177. package/dist/node_modules/@allyhub-next/render/dist/pdf.js +2 -0
  178. package/dist/node_modules/@allyhub-next/render/package.json +1 -1
  179. package/dist/node_modules/@allyhub-next/runtime/dist/fonts.js +1 -1
  180. package/dist/node_modules/@allyhub-next/runtime/dist/music.js +1 -1
  181. package/dist/node_modules/@allyhub-next/runtime/package.json +1 -1
  182. package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
  183. package/dist/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +25 -5
  184. package/dist/node_modules/@allyhub-next/scaffold/dist/index.js +4 -4
  185. package/dist/node_modules/@allyhub-next/scaffold/package.json +1 -1
  186. package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
  187. package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.d.ts +10 -0
  188. package/dist/node_modules/@allyhub-next/scenery-host/dist/bundle.js +3 -3
  189. package/dist/node_modules/@allyhub-next/scenery-host/package.json +1 -1
  190. package/dist/node_modules/@allyhub-next/sheet/dist/api/capabilities.js +1 -1
  191. package/dist/node_modules/@allyhub-next/sheet/dist/api/index.d.ts +1 -0
  192. package/dist/node_modules/@allyhub-next/sheet/dist/api/index.js +1 -1
  193. package/dist/node_modules/@allyhub-next/sheet/dist/api/page.d.ts +83 -0
  194. package/dist/node_modules/@allyhub-next/sheet/dist/api/page.js +2 -0
  195. package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.d.ts +40 -1
  196. package/dist/node_modules/@allyhub-next/sheet/dist/api/workbook.js +1 -1
  197. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +9 -3
  198. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +1 -1
  199. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +5 -1
  200. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +1 -1
  201. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +60 -13
  202. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +1 -1
  203. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +1 -1
  204. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.d.ts +4 -0
  205. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.js +2 -0
  206. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +1 -1
  207. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +1 -1
  208. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +1 -1
  209. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +27 -1
  210. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +1 -1
  211. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.d.ts +16 -0
  212. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.js +2 -0
  213. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +18 -1
  214. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +1 -1
  215. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +1 -1
  216. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +2 -0
  217. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +1 -1
  218. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +1 -1
  219. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +1 -1
  220. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +1 -1
  221. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +1 -1
  222. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +1 -1
  223. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.d.ts +2 -0
  224. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.js +2 -0
  225. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +1 -1
  226. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.d.ts +38 -0
  227. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.js +2 -0
  228. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.d.ts +19 -0
  229. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.js +2 -0
  230. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.d.ts +49 -0
  231. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.js +2 -0
  232. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.d.ts +82 -0
  233. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.js +2 -0
  234. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +6 -1
  235. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +1 -1
  236. package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +1 -1
  237. package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
  238. package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +15 -0
  239. package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +1 -1
  240. package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +29 -8
  241. package/dist/node_modules/@allyhub-next/sheet/dist/export.js +3 -4
  242. package/dist/node_modules/@allyhub-next/sheet/dist/file.js +2 -2
  243. package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +8 -2
  244. package/dist/node_modules/@allyhub-next/sheet/dist/format.js +1 -1
  245. package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +52 -4
  246. package/dist/node_modules/@allyhub-next/sheet/dist/html.js +43 -11
  247. package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +7 -3
  248. package/dist/node_modules/@allyhub-next/sheet/dist/index.js +1 -1
  249. package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +1 -1
  250. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.d.ts +98 -0
  251. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.js +2 -0
  252. package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
  253. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.d.ts +32 -0
  254. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.js +2 -0
  255. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.d.ts +3 -0
  256. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.js +2 -0
  257. package/dist/node_modules/@allyhub-next/sheet/dist/values.js +1 -1
  258. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +10 -1
  259. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +1 -1
  260. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +12 -1
  261. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
  262. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +14 -4
  263. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +2 -2
  264. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +11 -1
  265. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +36 -16
  266. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +6 -1
  267. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +1 -1
  268. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +44 -2
  269. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -1
  270. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.d.ts +23 -0
  271. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.js +2 -0
  272. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +2 -0
  273. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +1 -1
  274. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +6 -0
  275. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
  276. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.d.ts +40 -0
  277. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +2 -0
  278. package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
  279. package/dist/node_modules/@allyhub-next/slides-core/dist/animation.js +1 -1
  280. package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +121 -44
  281. package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +2 -2
  282. package/dist/node_modules/@allyhub-next/slides-core/dist/capabilities.js +1 -1
  283. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +50 -13
  284. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
  285. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-file.js +1 -1
  286. package/dist/node_modules/@allyhub-next/slides-core/dist/check.js +1 -1
  287. package/dist/node_modules/@allyhub-next/slides-core/dist/code.d.ts +33 -0
  288. package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +2 -0
  289. package/dist/node_modules/@allyhub-next/slides-core/dist/components.d.ts +31 -0
  290. package/dist/node_modules/@allyhub-next/slides-core/dist/components.js +2 -0
  291. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +188 -5
  292. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
  293. package/dist/node_modules/@allyhub-next/slides-core/dist/file.d.ts +43 -21
  294. package/dist/node_modules/@allyhub-next/slides-core/dist/file.js +3 -3
  295. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.d.ts +17 -0
  296. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.js +2 -0
  297. package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +5 -0
  298. package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
  299. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.d.ts +6 -0
  300. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.js +2 -0
  301. package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +1 -1
  302. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.d.ts +58 -0
  303. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +2 -0
  304. package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +38 -4
  305. package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +27 -1
  306. package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
  307. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +26 -5
  308. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
  309. package/dist/node_modules/@allyhub-next/slides-core/dist/script.d.ts +18 -16
  310. package/dist/node_modules/@allyhub-next/slides-core/dist/script.js +2 -2
  311. package/dist/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +51 -53
  312. package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +1 -1
  313. package/dist/node_modules/@allyhub-next/slides-core/dist/units.d.ts +27 -0
  314. package/dist/node_modules/@allyhub-next/slides-core/dist/units.js +1 -1
  315. package/dist/node_modules/@allyhub-next/slides-core/dist/values.d.ts +7 -0
  316. package/dist/node_modules/@allyhub-next/slides-core/dist/values.js +2 -0
  317. package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
  318. package/dist/node_modules/@allyhub-next/slides-pptx/dist/charts.js +1 -1
  319. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/code.js +4 -0
  320. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/index.js +3 -0
  321. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/names.js +2 -0
  322. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import/script.js +2 -0
  323. package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.js +1 -1
  324. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/chart.js +2 -0
  325. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/common.js +2 -0
  326. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/index.js +4 -0
  327. package/dist/{site.js → node_modules/@allyhub-next/slides-pptx/dist/read/model.js} +1 -1
  328. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/shapes.js +2 -0
  329. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/table.js +2 -0
  330. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/text.js +2 -0
  331. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read/timing.js +2 -0
  332. package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.js +1 -1
  333. package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.js +1 -1
  334. package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.js +1 -1
  335. package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.js +1 -1
  336. package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.js +2 -2
  337. package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.js +2 -2
  338. package/dist/node_modules/@allyhub-next/slides-pptx/package.json +1 -1
  339. package/dist/node_modules/@allyhub-next/slides-runtime/dist/component.js +2 -0
  340. package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.js +2 -2
  341. package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.js +1 -1
  342. package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.js +5 -5
  343. package/dist/node_modules/@allyhub-next/slides-runtime/package.json +5 -1
  344. package/dist/node_modules/@allyhub-next/stage/dist/graphics.js +1 -1
  345. package/dist/node_modules/@allyhub-next/stage/dist/index.js +1 -1
  346. package/dist/node_modules/@allyhub-next/stage/dist/page.js +22 -12
  347. package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.js +5 -5
  348. package/dist/node_modules/@allyhub-next/stage/dist/server.js +1 -1
  349. package/dist/node_modules/@allyhub-next/stage/package.json +1 -1
  350. package/dist/node_modules/@allyhub-next/stage-page/dist/host.js +1 -20
  351. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/probe.html +8 -0
  352. package/dist/{astro.js → node_modules/@allyhub-next/stage-page/dist/runtime/probe.js} +1 -1
  353. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/runtime.js +79 -0
  354. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.html +21 -0
  355. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/stage.js +3 -0
  356. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.html +9 -0
  357. package/dist/node_modules/@allyhub-next/stage-page/dist/runtime/viewer.js +3 -0
  358. package/dist/node_modules/@allyhub-next/stage-page/package.json +2 -3
  359. package/dist/node_modules/@allyhub-next/video-core/dist/captions.js +6 -6
  360. package/dist/node_modules/@allyhub-next/video-core/dist/fact.d.ts +47 -8
  361. package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
  362. package/dist/node_modules/@allyhub-next/video-core/dist/index.d.ts +1 -0
  363. package/dist/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
  364. package/dist/node_modules/@allyhub-next/video-core/dist/marks.d.ts +14 -0
  365. package/dist/node_modules/@allyhub-next/video-core/dist/marks.js +1 -1
  366. package/dist/node_modules/@allyhub-next/video-core/dist/music.d.ts +2 -1
  367. package/dist/node_modules/@allyhub-next/video-core/dist/piece.d.ts +11 -2
  368. package/dist/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
  369. package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
  370. package/dist/node_modules/@allyhub-next/video-core/dist/schema.d.ts +2 -2
  371. package/dist/node_modules/@allyhub-next/video-core/dist/schema.js +1 -1
  372. package/dist/node_modules/@allyhub-next/video-core/dist/script.d.ts +2 -1
  373. package/dist/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
  374. package/dist/node_modules/@allyhub-next/video-core/dist/source.d.ts +7 -0
  375. package/dist/node_modules/@allyhub-next/video-core/dist/source.js +2 -0
  376. package/dist/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +10 -33
  377. package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
  378. package/dist/node_modules/@allyhub-next/website/LICENSE +241 -0
  379. package/dist/node_modules/@allyhub-next/website/dist/index.js +2 -0
  380. package/dist/node_modules/@allyhub-next/website/dist/publish.js +3 -0
  381. package/dist/node_modules/@allyhub-next/website/dist/rules.js +2 -0
  382. package/dist/node_modules/@allyhub-next/website/dist/website.js +4 -0
  383. package/dist/node_modules/@allyhub-next/website/package.json +13 -0
  384. package/dist/text/facts-text.js +4 -4
  385. package/dist/works.js +1 -1
  386. package/editor-web/assets/calc-worker-Bz9r26p1.js +158 -0
  387. package/editor-web/assets/dist-0emakyZE.js +36 -0
  388. package/editor-web/assets/dist-B3UoDUa5.js +37 -0
  389. package/editor-web/assets/dist-B6KzR3pN.js +10 -0
  390. package/editor-web/assets/dist-Bc5iA5k1.js +1 -0
  391. package/editor-web/assets/dist-CTQIm8Im.js +10 -0
  392. package/editor-web/assets/dist-CiHNHwyq.js +2 -0
  393. package/editor-web/assets/dist-DNZ8PQ-E.js +224 -0
  394. package/editor-web/assets/index-CFt3ovRY.js +69 -0
  395. package/editor-web/assets/index-ujKjdu_s.css +2 -0
  396. package/editor-web/assets/minus-BhoPZC5P.js +1 -0
  397. package/editor-web/assets/react-C_-rEEBU.js +101 -0
  398. package/editor-web/assets/tabs-Den4gHrU.js +105 -0
  399. package/editor-web/assets/text-align-start-CsW4nqqL.js +1 -0
  400. package/editor-web/index.html +5 -5
  401. package/package.json +8 -14
  402. package/dist/astro.d.ts +0 -2
  403. package/dist/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +0 -52
  404. package/dist/node_modules/@allyhub-next/audio/dist/decode.d.ts +0 -33
  405. package/dist/node_modules/@allyhub-next/audio/dist/envelope.d.ts +0 -37
  406. package/dist/node_modules/@allyhub-next/audio/dist/index.d.ts +0 -17
  407. package/dist/node_modules/@allyhub-next/audio/dist/levels.d.ts +0 -97
  408. package/dist/node_modules/@allyhub-next/audio/dist/master.d.ts +0 -29
  409. package/dist/node_modules/@allyhub-next/audio/dist/music.d.ts +0 -11
  410. package/dist/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +0 -39
  411. package/dist/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +0 -25
  412. package/dist/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +0 -31
  413. package/dist/node_modules/@allyhub-next/audio/dist/node/index.d.ts +0 -8
  414. package/dist/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +0 -18
  415. package/dist/node_modules/@allyhub-next/audio/dist/node/master.d.ts +0 -42
  416. package/dist/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +0 -60
  417. package/dist/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +0 -31
  418. package/dist/node_modules/@allyhub-next/audio/dist/plan.d.ts +0 -143
  419. package/dist/node_modules/@allyhub-next/audio/dist/recorded.d.ts +0 -26
  420. package/dist/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +0 -47
  421. package/dist/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +0 -89
  422. package/dist/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +0 -64
  423. package/dist/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +0 -26
  424. package/dist/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +0 -42
  425. package/dist/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +0 -56
  426. package/dist/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +0 -10
  427. package/dist/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +0 -12
  428. package/dist/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +0 -67
  429. package/dist/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +0 -32
  430. package/dist/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +0 -27
  431. package/dist/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +0 -64
  432. package/dist/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +0 -78
  433. package/dist/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +0 -111
  434. package/dist/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +0 -3
  435. package/dist/node_modules/@allyhub-next/audio/dist/render.d.ts +0 -26
  436. package/dist/node_modules/@allyhub-next/audio/dist/sfx.d.ts +0 -10
  437. package/dist/node_modules/@allyhub-next/audio/dist/shape.d.ts +0 -118
  438. package/dist/node_modules/@allyhub-next/audio/dist/voice.d.ts +0 -45
  439. package/dist/node_modules/@allyhub-next/browser/dist/browser.d.ts +0 -24
  440. package/dist/node_modules/@allyhub-next/browser/dist/capture.d.ts +0 -61
  441. package/dist/node_modules/@allyhub-next/browser/dist/cdp.d.ts +0 -51
  442. package/dist/node_modules/@allyhub-next/browser/dist/flags.d.ts +0 -13
  443. package/dist/node_modules/@allyhub-next/browser/dist/frames.d.ts +0 -35
  444. package/dist/node_modules/@allyhub-next/browser/dist/html.d.ts +0 -19
  445. package/dist/node_modules/@allyhub-next/browser/dist/index.d.ts +0 -10
  446. package/dist/node_modules/@allyhub-next/browser/dist/launch.d.ts +0 -35
  447. package/dist/node_modules/@allyhub-next/browser/dist/page.d.ts +0 -67
  448. package/dist/node_modules/@allyhub-next/browser/dist/server.d.ts +0 -26
  449. package/dist/node_modules/@allyhub-next/check/dist/cache.d.ts +0 -46
  450. package/dist/node_modules/@allyhub-next/check/dist/check.d.ts +0 -142
  451. package/dist/node_modules/@allyhub-next/check/dist/generated.d.ts +0 -22
  452. package/dist/node_modules/@allyhub-next/check/dist/index.d.ts +0 -7
  453. package/dist/node_modules/@allyhub-next/check/dist/plans.d.ts +0 -111
  454. package/dist/node_modules/@allyhub-next/check/dist/result.d.ts +0 -12
  455. package/dist/node_modules/@allyhub-next/check/dist/scenery.d.ts +0 -23
  456. package/dist/node_modules/@allyhub-next/dev-server/dist/background.d.ts +0 -50
  457. package/dist/node_modules/@allyhub-next/dev-server/dist/card.d.ts +0 -17
  458. package/dist/node_modules/@allyhub-next/dev-server/dist/exports.d.ts +0 -18
  459. package/dist/node_modules/@allyhub-next/dev-server/dist/index.d.ts +0 -11
  460. package/dist/node_modules/@allyhub-next/dev-server/dist/live.d.ts +0 -77
  461. package/dist/node_modules/@allyhub-next/dev-server/dist/mime.d.ts +0 -2
  462. package/dist/node_modules/@allyhub-next/dev-server/dist/mime.js +0 -2
  463. package/dist/node_modules/@allyhub-next/dev-server/dist/paths.d.ts +0 -27
  464. package/dist/node_modules/@allyhub-next/dev-server/dist/project.d.ts +0 -153
  465. package/dist/node_modules/@allyhub-next/dev-server/dist/reveal.d.ts +0 -6
  466. package/dist/node_modules/@allyhub-next/dev-server/dist/server.d.ts +0 -47
  467. package/dist/node_modules/@allyhub-next/dev-server/dist/sound.d.ts +0 -21
  468. package/dist/node_modules/@allyhub-next/dev-server/dist/stage.d.ts +0 -82
  469. package/dist/node_modules/@allyhub-next/dev-server/dist/stage.js +0 -121
  470. package/dist/node_modules/@allyhub-next/dev-server/dist/tools.d.ts +0 -24
  471. package/dist/node_modules/@allyhub-next/dev-server/dist/validate.d.ts +0 -6
  472. package/dist/node_modules/@allyhub-next/dev-server/dist/watcher.d.ts +0 -47
  473. package/dist/node_modules/@allyhub-next/dev-server/dist/writer.d.ts +0 -51
  474. package/dist/node_modules/@allyhub-next/export/dist/batch.d.ts +0 -70
  475. package/dist/node_modules/@allyhub-next/export/dist/deck-fonts.d.ts +0 -24
  476. package/dist/node_modules/@allyhub-next/export/dist/deck-pptx.d.ts +0 -12
  477. package/dist/node_modules/@allyhub-next/export/dist/export.d.ts +0 -123
  478. package/dist/node_modules/@allyhub-next/export/dist/index.d.ts +0 -5
  479. package/dist/node_modules/@allyhub-next/export/dist/names.d.ts +0 -36
  480. package/dist/node_modules/@allyhub-next/measure/dist/compare.d.ts +0 -195
  481. package/dist/node_modules/@allyhub-next/measure/dist/contrast.d.ts +0 -14
  482. package/dist/node_modules/@allyhub-next/measure/dist/cut-sheet.d.ts +0 -90
  483. package/dist/node_modules/@allyhub-next/measure/dist/cuts.d.ts +0 -108
  484. package/dist/node_modules/@allyhub-next/measure/dist/facts.d.ts +0 -60
  485. package/dist/node_modules/@allyhub-next/measure/dist/fidelity.d.ts +0 -40
  486. package/dist/node_modules/@allyhub-next/measure/dist/flat.d.ts +0 -42
  487. package/dist/node_modules/@allyhub-next/measure/dist/index.d.ts +0 -24
  488. package/dist/node_modules/@allyhub-next/measure/dist/loop.d.ts +0 -22
  489. package/dist/node_modules/@allyhub-next/measure/dist/overlay.d.ts +0 -57
  490. package/dist/node_modules/@allyhub-next/measure/dist/recording-report.d.ts +0 -66
  491. package/dist/node_modules/@allyhub-next/measure/dist/reference/compare.d.ts +0 -118
  492. package/dist/node_modules/@allyhub-next/measure/dist/reference/folder.d.ts +0 -75
  493. package/dist/node_modules/@allyhub-next/measure/dist/reference/interpret.d.ts +0 -39
  494. package/dist/node_modules/@allyhub-next/measure/dist/reference/piece.d.ts +0 -53
  495. package/dist/node_modules/@allyhub-next/measure/dist/reference/sections.d.ts +0 -53
  496. package/dist/node_modules/@allyhub-next/measure/dist/reference/sets.d.ts +0 -84
  497. package/dist/node_modules/@allyhub-next/measure/dist/reference/text.d.ts +0 -27
  498. package/dist/node_modules/@allyhub-next/measure/dist/reference/video.d.ts +0 -55
  499. package/dist/node_modules/@allyhub-next/measure/dist/seams.d.ts +0 -46
  500. package/dist/node_modules/@allyhub-next/measure/dist/sound-measures.d.ts +0 -74
  501. package/dist/node_modules/@allyhub-next/measure/dist/sound-report.d.ts +0 -156
  502. package/dist/node_modules/@allyhub-next/measure/dist/still.d.ts +0 -58
  503. package/dist/node_modules/@allyhub-next/measure/dist/version-voice.d.ts +0 -12
  504. package/dist/node_modules/@allyhub-next/project/dist/console.d.ts +0 -34
  505. package/dist/node_modules/@allyhub-next/project/dist/digest.d.ts +0 -9
  506. package/dist/node_modules/@allyhub-next/project/dist/index.d.ts +0 -11
  507. package/dist/node_modules/@allyhub-next/project/dist/ledger.d.ts +0 -17
  508. package/dist/node_modules/@allyhub-next/project/dist/media-index.d.ts +0 -27
  509. package/dist/node_modules/@allyhub-next/project/dist/page.d.ts +0 -119
  510. package/dist/node_modules/@allyhub-next/project/dist/says.d.ts +0 -15
  511. package/dist/node_modules/@allyhub-next/project/dist/scenery.d.ts +0 -35
  512. package/dist/node_modules/@allyhub-next/project/dist/session.d.ts +0 -37
  513. package/dist/node_modules/@allyhub-next/project/dist/stretch.d.ts +0 -38
  514. package/dist/node_modules/@allyhub-next/project/dist/version.d.ts +0 -114
  515. package/dist/node_modules/@allyhub-next/render/dist/cap.d.ts +0 -41
  516. package/dist/node_modules/@allyhub-next/render/dist/capture.d.ts +0 -78
  517. package/dist/node_modules/@allyhub-next/render/dist/clip.d.ts +0 -27
  518. package/dist/node_modules/@allyhub-next/render/dist/composite.d.ts +0 -106
  519. package/dist/node_modules/@allyhub-next/render/dist/delivery.d.ts +0 -18
  520. package/dist/node_modules/@allyhub-next/render/dist/doc/fonts.d.ts +0 -3
  521. package/dist/node_modules/@allyhub-next/render/dist/doc/index.d.ts +0 -3
  522. package/dist/node_modules/@allyhub-next/render/dist/doc/print.d.ts +0 -51
  523. package/dist/node_modules/@allyhub-next/render/dist/encode.d.ts +0 -111
  524. package/dist/node_modules/@allyhub-next/render/dist/errors.d.ts +0 -15
  525. package/dist/node_modules/@allyhub-next/render/dist/exports.d.ts +0 -76
  526. package/dist/node_modules/@allyhub-next/render/dist/ffmpeg.d.ts +0 -75
  527. package/dist/node_modules/@allyhub-next/render/dist/footage.d.ts +0 -169
  528. package/dist/node_modules/@allyhub-next/render/dist/image.d.ts +0 -16
  529. package/dist/node_modules/@allyhub-next/render/dist/index.d.ts +0 -26
  530. package/dist/node_modules/@allyhub-next/render/dist/junction.d.ts +0 -70
  531. package/dist/node_modules/@allyhub-next/render/dist/look.d.ts +0 -21
  532. package/dist/node_modules/@allyhub-next/render/dist/page.d.ts +0 -186
  533. package/dist/node_modules/@allyhub-next/render/dist/parts.d.ts +0 -140
  534. package/dist/node_modules/@allyhub-next/render/dist/png.d.ts +0 -37
  535. package/dist/node_modules/@allyhub-next/render/dist/pool.d.ts +0 -54
  536. package/dist/node_modules/@allyhub-next/render/dist/post-probe.d.ts +0 -27
  537. package/dist/node_modules/@allyhub-next/render/dist/post.d.ts +0 -27
  538. package/dist/node_modules/@allyhub-next/render/dist/render.d.ts +0 -151
  539. package/dist/node_modules/@allyhub-next/render/dist/segments.d.ts +0 -40
  540. package/dist/node_modules/@allyhub-next/render/dist/sound.d.ts +0 -24
  541. package/dist/node_modules/@allyhub-next/render/dist/stills.d.ts +0 -41
  542. package/dist/node_modules/@allyhub-next/render/dist/tools.d.ts +0 -25
  543. package/dist/node_modules/@allyhub-next/render/dist/webp.d.ts +0 -17
  544. package/dist/node_modules/@allyhub-next/runtime/dist/bridge.d.ts +0 -211
  545. package/dist/node_modules/@allyhub-next/runtime/dist/captions.d.ts +0 -24
  546. package/dist/node_modules/@allyhub-next/runtime/dist/clock.d.ts +0 -32
  547. package/dist/node_modules/@allyhub-next/runtime/dist/compose.d.ts +0 -149
  548. package/dist/node_modules/@allyhub-next/runtime/dist/console.d.ts +0 -21
  549. package/dist/node_modules/@allyhub-next/runtime/dist/contrast.d.ts +0 -13
  550. package/dist/node_modules/@allyhub-next/runtime/dist/embed.d.ts +0 -50
  551. package/dist/node_modules/@allyhub-next/runtime/dist/env.d.ts +0 -101
  552. package/dist/node_modules/@allyhub-next/runtime/dist/errors.d.ts +0 -21
  553. package/dist/node_modules/@allyhub-next/runtime/dist/facade.d.ts +0 -42
  554. package/dist/node_modules/@allyhub-next/runtime/dist/fonts.d.ts +0 -110
  555. package/dist/node_modules/@allyhub-next/runtime/dist/footage.d.ts +0 -52
  556. package/dist/node_modules/@allyhub-next/runtime/dist/frame.d.ts +0 -61
  557. package/dist/node_modules/@allyhub-next/runtime/dist/guards.d.ts +0 -32
  558. package/dist/node_modules/@allyhub-next/runtime/dist/index.d.ts +0 -14
  559. package/dist/node_modules/@allyhub-next/runtime/dist/inspect.d.ts +0 -112
  560. package/dist/node_modules/@allyhub-next/runtime/dist/locate.d.ts +0 -11
  561. package/dist/node_modules/@allyhub-next/runtime/dist/measure.d.ts +0 -41
  562. package/dist/node_modules/@allyhub-next/runtime/dist/mix-plan.d.ts +0 -42
  563. package/dist/node_modules/@allyhub-next/runtime/dist/music.d.ts +0 -29
  564. package/dist/node_modules/@allyhub-next/runtime/dist/output.d.ts +0 -5
  565. package/dist/node_modules/@allyhub-next/runtime/dist/pictures.d.ts +0 -39
  566. package/dist/node_modules/@allyhub-next/runtime/dist/piece.d.ts +0 -34
  567. package/dist/node_modules/@allyhub-next/runtime/dist/player/clips.d.ts +0 -41
  568. package/dist/node_modules/@allyhub-next/runtime/dist/player/cutout.d.ts +0 -57
  569. package/dist/node_modules/@allyhub-next/runtime/dist/player/player.d.ts +0 -78
  570. package/dist/node_modules/@allyhub-next/runtime/dist/reads.d.ts +0 -132
  571. package/dist/node_modules/@allyhub-next/runtime/dist/sound.d.ts +0 -22
  572. package/dist/node_modules/@allyhub-next/runtime/dist/speech.d.ts +0 -107
  573. package/dist/node_modules/@allyhub-next/runtime/dist/stage-kit.d.ts +0 -12
  574. package/dist/node_modules/@allyhub-next/runtime/dist/stage.d.ts +0 -34
  575. package/dist/node_modules/@allyhub-next/runtime/dist/styles.d.ts +0 -35
  576. package/dist/node_modules/@allyhub-next/runtime/dist/takes.d.ts +0 -72
  577. package/dist/node_modules/@allyhub-next/runtime/dist/titles.d.ts +0 -10
  578. package/dist/node_modules/@allyhub-next/runtime/dist/transitions.d.ts +0 -26
  579. package/dist/node_modules/@allyhub-next/site/dist/assets.d.ts +0 -59
  580. package/dist/node_modules/@allyhub-next/site/dist/assets.js +0 -2
  581. package/dist/node_modules/@allyhub-next/site/dist/astro.d.ts +0 -22
  582. package/dist/node_modules/@allyhub-next/site/dist/astro.js +0 -3
  583. package/dist/node_modules/@allyhub-next/site/dist/lockfile.d.ts +0 -40
  584. package/dist/node_modules/@allyhub-next/site/dist/lockfile.js +0 -3
  585. package/dist/node_modules/@allyhub-next/site/dist/media.d.ts +0 -24
  586. package/dist/node_modules/@allyhub-next/site/dist/media.js +0 -4
  587. package/dist/node_modules/@allyhub-next/site/package.json +0 -25
  588. package/dist/node_modules/@allyhub-next/slides-pptx/dist/charts.d.ts +0 -6
  589. package/dist/node_modules/@allyhub-next/slides-pptx/dist/fonts.d.ts +0 -45
  590. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.d.ts +0 -18
  591. package/dist/node_modules/@allyhub-next/slides-pptx/dist/import.js +0 -3
  592. package/dist/node_modules/@allyhub-next/slides-pptx/dist/index.d.ts +0 -5
  593. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.d.ts +0 -55
  594. package/dist/node_modules/@allyhub-next/slides-pptx/dist/read.js +0 -4
  595. package/dist/node_modules/@allyhub-next/slides-pptx/dist/shapes.d.ts +0 -67
  596. package/dist/node_modules/@allyhub-next/slides-pptx/dist/text.d.ts +0 -21
  597. package/dist/node_modules/@allyhub-next/slides-pptx/dist/theme.d.ts +0 -4
  598. package/dist/node_modules/@allyhub-next/slides-pptx/dist/timing.d.ts +0 -32
  599. package/dist/node_modules/@allyhub-next/slides-pptx/dist/write.d.ts +0 -32
  600. package/dist/node_modules/@allyhub-next/slides-pptx/dist/xml.d.ts +0 -26
  601. package/dist/node_modules/@allyhub-next/slides-runtime/dist/draw.d.ts +0 -40
  602. package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.d.ts +0 -4
  603. package/dist/node_modules/@allyhub-next/slides-runtime/dist/edit.js +0 -2
  604. package/dist/node_modules/@allyhub-next/slides-runtime/dist/index.d.ts +0 -4
  605. package/dist/node_modules/@allyhub-next/slides-runtime/dist/ink.d.ts +0 -10
  606. package/dist/node_modules/@allyhub-next/slides-runtime/dist/load.d.ts +0 -6
  607. package/dist/node_modules/@allyhub-next/stage/dist/bakes.d.ts +0 -42
  608. package/dist/node_modules/@allyhub-next/stage/dist/graphics.d.ts +0 -7
  609. package/dist/node_modules/@allyhub-next/stage/dist/identity.d.ts +0 -2
  610. package/dist/node_modules/@allyhub-next/stage/dist/index.d.ts +0 -9
  611. package/dist/node_modules/@allyhub-next/stage/dist/page.d.ts +0 -87
  612. package/dist/node_modules/@allyhub-next/stage/dist/scenery-page.d.ts +0 -69
  613. package/dist/node_modules/@allyhub-next/stage/dist/scenery-solve.d.ts +0 -49
  614. package/dist/node_modules/@allyhub-next/stage/dist/scenery.d.ts +0 -8
  615. package/dist/node_modules/@allyhub-next/stage/dist/server.d.ts +0 -21
  616. package/dist/node_modules/@allyhub-next/stage-page/dist/host.d.ts +0 -22
  617. package/dist/node_modules/@allyhub-next/stage-page/dist/page.js +0 -79
  618. package/dist/site.d.ts +0 -2
  619. package/editor-web/assets/dist-Cg2PdedY.js +0 -6
  620. package/editor-web/assets/dist-CuW84oPe.js +0 -233
  621. package/editor-web/assets/dist-CxAS_vp7.js +0 -2
  622. package/editor-web/assets/dist-DCVaj9i1.js +0 -4
  623. package/editor-web/assets/dist-DGVUuVPB.js +0 -33
  624. package/editor-web/assets/dist-Yi3sy7Ea.js +0 -1
  625. package/editor-web/assets/index-B7S9RZhL.css +0 -2
  626. package/editor-web/assets/index-pwRfZ2Jv.js +0 -69
  627. package/editor-web/assets/minus-BizJdinJ.js +0 -1
  628. package/editor-web/assets/react-D54s6gwK.js +0 -101
  629. package/editor-web/assets/textarea-CvxipnGW.js +0 -105
  630. package/editor-web/assets/trash-2-Bq1Dt8XG.js +0 -1
  631. package/editor-web/assets/undo-2-Djhvu4xt.js +0 -1
  632. /package/dist/node_modules/@allyhub-next/{site → ooxml}/LICENSE +0 -0
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{readFile as b,rm as m}from"node:fs/promises";import{join as c}from"node:path";import{fileLoudness as v}from"@allyhub-next/audio/node";import{startBrowser as g}from"@allyhub-next/browser";import{allyhubPlugin as y,hasSheetCode as S,listFiles as $,loadUserVite as D,prepare as C,readMedia as k,readSheetSource as j,sourceOf as B}from"@allyhub-next/build";import{CACHE_DIR as O,entryKind as R}from"@allyhub-next/formats";import{CheckSession as U,ProjectError as P,pickTarget as E,parseCombo as M}from"@allyhub-next/project";import{RPC_ERROR as p,RpcError as f}from"@allyhub-next/protocol";import{bundleScenery as F,writeModelStage as x}from"@allyhub-next/scenery-host/bundle";import{sceneryHost as w,serveDecoders as H}from"@allyhub-next/stage";export const stageMedia=(o,e)=>`${o}media/${e.split("/").map(encodeURIComponent).join("/")}`;export function rpcErrorOf(o){return o instanceof P?new f(o.kind==="not-found"?p.notFound:p.invalid,o.hint?`${o.message} ${o.hint}`:o.message):o}export class Live{root;stageBase;buildDir;revision=0;prep;last;lease;old=new Set;browserStarted;gpu;sceneries=new Map;building=Promise.resolve();closed=!1;sheetCodes=new Map;constructor(e,t,s={}){this.root=e,this.stageBase=t,this.buildDir=c(e,O,"build",`dev-${String(process.pid)}`),this.gpu=s.gpu}moved(e){this.revision=e,this.lease&&this.lease.revision!==e&&this.retire(this.lease)}prepared(){const e=this.revision;if(this.prep?.revision===e)return this.prep.promise;const t=this.building.then(()=>e===this.revision?this.build():void 0);this.building=t.catch(()=>{});const s=t.then(i=>i??this.prepared());return this.prep={revision:e,promise:s},s.catch(()=>{this.prep?.promise===s&&(this.prep=void 0)}),s}async build(){const e=await C(this.root,{buildDir:c(this.buildDir,"stage"),mediaUrl:t=>stageMedia(this.stageBase,t),host:w(this.root)});return e.bundle&&await H(e.bundle.dir),this.last=e,e}async sheetCode(e){if(!S(this.root,e))return{failed:!1};const t=this.sheetCodes.get(e),s=t?.revision===this.revision?t.promise:j(this.root,e).catch(()=>{});this.sheetCodes.set(e,{revision:this.revision,promise:s});const i=await s;return{failed:i?.failed??!0,...i?.generated?{generated:i.generated}:{}}}latest(){return this.last}async target(e,t){const s=await this.prepared();try{const{piece:i,target:r}=E(s,e,t===void 0?void 0:[M(t)]);return{prepared:s,piece:i,combo:r.combo}}catch(i){throw rpcErrorOf(i)}}async source(e,t){const s=await this.prepared(),i=s.pieces.find(n=>n.id===e);if(!i)throw new f(p.notFound,`No piece ${e}.`);const r=B(s,i,`${t}${this.stageBase}build/`,n=>`${t}${stageMedia(this.stageBase,n)}`),h={...r.media},u=(n,a)=>`${t}${this.stageBase}${n}/${a.split("/").map(encodeURIComponent).join("/")}`;return await Promise.all(Object.entries(h).map(async([n,a])=>{let d=a;if(a.kind==="video"&&a.matte===!0&&(d={...d,matteUrl:u("matte",n)}),a.kind==="audio"||a.kind==="video"&&a.audio===!0){d={...d,denoisedUrl:u("sound",n)};const l=await v(c(this.root,n)).catch(()=>{});l!==void 0&&(d={...d,loudness:l.lufs,...l.by==="level"?{loudnessBy:"level"}:{}})}h[n]=d})),{...r,media:h}}browser(){return this.browserStarted??=g(this.gpu===void 0?{}:{gpu:this.gpu}),this.browserStarted}async withSession(e){this.refuseStopped();let t=this.lease;if(t?.revision!==this.revision){t&&this.retire(t);const s=await this.browser();if(this.refuseStopped(),t=this.lease,t?.revision!==this.revision){t&&this.retire(t);const i=c(this.buildDir,`session-${String(this.revision)}`),r={revision:this.revision,session:U.open({root:this.root,browser:s,buildDir:i}),users:0,retired:!1,dir:i};t=r,this.lease=r,r.session.catch(()=>{this.lease===r&&(this.lease=void 0)})}}t.users++;try{return await e(await t.session)}finally{t.users--,t.retired&&t.users===0&&this.end(t)}}refuseStopped(){if(this.closed)throw new f(p.unavailable,"allyhub dev is stopping.")}retire(e){e.retired=!0,this.lease===e&&(this.lease=void 0),this.old.add(e),e.users===0&&this.end(e)}end(e){return e.ended??=(async()=>{this.old.delete(e),await e.session.then(t=>t.close()).catch(()=>{}),await m(e.dir,{recursive:!0,force:!0})})(),e.ended}scenery(e){const t=this.sceneries.get(e);if(t?.revision===this.revision)return t.promise;const s=this.bundleScenery(e);return this.sceneries.set(e,{revision:this.revision,promise:s}),s.catch(()=>{this.sceneries.get(e)?.promise===s&&this.sceneries.delete(e)}),s}async bundleScenery(e){const t=await $(this.root),s=await k(this.root,t),i=await I(this.root),r=w(this.root),h=await D(this.root),u=c(this.buildDir,"scenery"),n=R(e)==="model"?await x({root:this.root,model:e,outDir:u}):e;return{...await F({root:this.root,file:n,outDir:u,dependencies:i,plugins:[y({root:this.root,media:s,dependencies:i,lent:r.lent,mediaUrl:d=>stageMedia(this.stageBase,d)})],...h?{user:h}:{}}),media:Object.keys(s)}}async close(){this.closed=!0;const e=[...this.old,...this.lease?[this.lease]:[]];this.lease&&this.retire(this.lease),await Promise.all(e.map(t=>this.end(t))),await this.browserStarted?.then(t=>t.close()).catch(()=>{}),await m(this.buildDir,{recursive:!0,force:!0})}}async function I(o){try{const e=JSON.parse(await b(c(o,"package.json"),"utf8")),t=new Set;for(const s of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const i=e[s];if(i&&typeof i=="object")for(const r of Object.keys(i))t.add(r)}return t}catch{return new Set}}
2
+ import{readFile as v,rm as w}from"node:fs/promises";import{join as c}from"node:path";import{fileLoudness as y}from"@allyhub-next/audio/node";import{startBrowser as g}from"@allyhub-next/browser";import{allyhubPlugin as S,hasSheetCode as D,listFiles as k,loadUserVite as O,mediaHref as C,prepare as E,readMedia as R,readSheetSource as $,sourceOf as j}from"@allyhub-next/build";import{CACHE_DIR as P,entryKind as F}from"@allyhub-next/formats";import{CheckSession as H,ProjectError as N,pickTarget as _,parseCombo as M}from"@allyhub-next/project";import{RPC_ERROR as u,RpcError as f,SNAPSHOT_TREE as m,SOUND_FOLDER as T}from"@allyhub-next/protocol";import{SCENERY_STAGE as U,bundleScenery as W,sceneryHref as l,writeModelStage as A}from"@allyhub-next/scenery-host/bundle";import{bakesOnDisk as L,sceneryHost as b,serveDecoders as x}from"@allyhub-next/stage";export function rpcErrorOf(d){return d instanceof N?new f(d.kind==="not-found"?u.notFound:u.invalid,d.hint?`${d.message} ${d.hint}`:d.message):d}export class Live{root;buildDir;revision=0;prep;last;lease;old=new Set;browserStarted;gpu;sceneries=new Map;building=Promise.resolve();closed=!1;sheetCodes=new Map;constructor(e,i={}){this.root=e,this.buildDir=c(e,P,"build",`dev-${String(process.pid)}`),this.gpu=i.gpu}moved(e){this.revision=e,this.lease&&this.lease.revision!==e&&this.retire(this.lease)}prepared(){const e=this.revision;if(this.prep?.revision===e)return this.prep.promise;const i=this.building.then(()=>e===this.revision?this.build():void 0);this.building=i.catch(()=>{});const t=i.then(s=>s??this.prepared());return this.prep={revision:e,promise:t},t.catch(()=>{this.prep?.promise===t&&(this.prep=void 0)}),t}async build(){const e=await E(this.root,{buildDir:this.pieceDir,host:b(this.root)});return e.bundle&&await x(e.bundle.dir),this.last=e,e}async sheetCode(e){if(!D(this.root,e))return{failed:!1};const i=this.sheetCodes.get(e),t=i?.revision===this.revision?i.promise:$(this.root,e).catch(()=>{});this.sheetCodes.set(e,{revision:this.revision,promise:t});const s=await t;return{failed:s?.failed??!0,...s?.generated?{generated:s.generated}:{}}}get pieceDir(){return c(this.buildDir,"stage")}get sceneryDir(){return c(this.buildDir,"scenery",U)}latest(){return this.last}async target(e,i){const t=await this.prepared();try{const{piece:s,target:r}=_(t,e,i===void 0?void 0:[M(i)]);return{prepared:t,piece:s,combo:r.combo}}catch(s){throw rpcErrorOf(s)}}async source(e){const i=await this.prepared(),t=i.pieces.find(n=>n.id===e);if(!t)throw new f(u.notFound,`No piece ${e}.`);const s=j(i,t),r={...s.media},h=(n,a)=>`${n}${C(a).slice(m.media.length)}`;return await Promise.all(Object.entries(r).map(async([n,a])=>{let o=a;if(a.kind==="video"&&a.matte===!0&&(o={...o,matteUrl:h(m.matte,n)}),a.kind==="audio"||a.kind==="video"&&a.audio===!0){o={...o,denoisedUrl:h(T,n)};const p=await y(c(this.root,n)).catch(()=>{});p!==void 0&&(o={...o,loudness:p.lufs,...p.by==="level"?{loudnessBy:"level"}:{}})}r[n]=o})),{...s,media:r}}browser(){return this.browserStarted??=g(this.gpu===void 0?{}:{gpu:this.gpu}),this.browserStarted}async withSession(e){this.refuseStopped();let i=this.lease;if(i?.revision!==this.revision){i&&this.retire(i);const t=await this.browser();if(this.refuseStopped(),i=this.lease,i?.revision!==this.revision){i&&this.retire(i);const s=c(this.buildDir,`session-${String(this.revision)}`),r={revision:this.revision,session:H.open({root:this.root,browser:t,buildDir:s}),users:0,retired:!1,dir:s};i=r,this.lease=r,r.session.catch(()=>{this.lease===r&&(this.lease=void 0)})}}i.users++;try{return await e(await i.session)}finally{i.users--,i.retired&&i.users===0&&this.end(i)}}refuseStopped(){if(this.closed)throw new f(u.unavailable,"allyhub dev is stopping.")}retire(e){e.retired=!0,this.lease===e&&(this.lease=void 0),this.old.add(e),e.users===0&&this.end(e)}end(e){return e.ended??=(async()=>{this.old.delete(e),await e.session.then(i=>i.close()).catch(()=>{}),await w(e.dir,{recursive:!0,force:!0})})(),e.ended}scenery(e){const i=this.sceneries.get(e);if(i?.revision===this.revision)return i.promise;const t=this.bundleScenery(e);return this.sceneries.set(e,{revision:this.revision,promise:t}),t.catch(()=>{this.sceneries.get(e)?.promise===t&&this.sceneries.delete(e)}),t}async scenerySource(e){const i=await this.scenery(e),t=s=>`${m.scenery}${s}`;return{module:t(i.module),decoders:t(i.decoders),manifoldWasm:t(i.manifoldWasm),bakes:[...await L(this.root)]}}async bundleScenery(e){const i=await k(this.root),t=await R(this.root,i),s=await B(this.root),r=b(this.root),h=await O(this.root),n=c(this.buildDir,"scenery"),a=F(e)==="model"?await A({root:this.root,model:e,outDir:n}):e,o=await W({root:this.root,file:a,outDir:n,dependencies:s,plugins:[S({root:this.root,media:t,dependencies:s,lent:r.lent})],...h?{user:h}:{}});return{module:l(o.module),decoders:l(o.decoders),manifoldWasm:l(o.manifoldWasm),output:o.output.map(l),media:Object.keys(t)}}async close(){this.closed=!0;const e=[...this.old,...this.lease?[this.lease]:[]];this.lease&&this.retire(this.lease),await Promise.all(e.map(i=>this.end(i))),await this.browserStarted?.then(i=>i.close()).catch(()=>{}),await w(this.buildDir,{recursive:!0,force:!0})}}async function B(d){try{const e=JSON.parse(await v(c(d,"package.json"),"utf8")),i=new Set;for(const t of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const s=e[t];if(s&&typeof s=="object")for(const r of Object.keys(s))i.add(r)}return i}catch{return new Set}}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{randomBytes as w}from"node:crypto";import{resolve as v}from"node:path";import{FILE_METHODS as g,HOST_METHODS as u,JSONRPC as c,PROJECT_TOOLS as h,RPC_ERROR as l,RequestSchema as y,RpcError as d,answer as f}from"@allyhub-next/protocol";import{Checker as O,Indexer as x}from"./background.js";import{Exports as S}from"./exports.js";import{hasFileManager as k,revealFile as R}from"./reveal.js";import{Live as E}from"./live.js";import{fileIn as p}from"./paths.js";import{toolHandlers as m}from"./tools.js";import{Watcher as T}from"./watcher.js";import{Writer as N}from"./writer.js";export const SERVER_METHODS={...g,"tools/call":u["tools/call"]};export class ProjectServer{root;writer;watcher;live;exports;reveal;checker;serving;indexer;clients=new Map;constructor(r){this.root=v(r.root),this.live=new E(this.root,r.stageBase??`/s/${w(18).toString("base64url")}/`,r.gpu===void 0?{}:{gpu:r.gpu}),this.watcher=new T(this.root,(e,i)=>{this.sendTo(this.watchOwner(e),"files/changed",{watch:e,changes:i})},e=>{this.live.moved(e),this.notify("project/changed",{revision:e}),this.checker?.schedule()}),this.writer=new N(this.root,(e,i)=>{this.watcher.wrote(e,i)}),this.reveal=r.reveal===!1?void 0:r.reveal??(k()?R:void 0),this.exports=new S(this.root,e=>{this.notify("export/changed",{job:e})});const s=r.index??process.env.ALLYHUB_NO_INDEX!=="1";if(r.check!==!1){const e=s?new x({root:this.root,emit:i=>{this.notify("index/changed",{jobs:i})},made:()=>{this.checker?.schedule(!0)}}):void 0;this.indexer=e,this.checker=new O({live:this.live,emit:i=>{this.notify("check/changed",i)},...e?{needs:i=>{e.want(i)}}:{},...r.settle===void 0?{}:{settle:r.settle}})}}static open(r){const s=new ProjectServer(r);return s.watcher.start(),s.checker?.schedule(),Promise.resolve(s)}owners=new Map;watchOwner(r){return this.owners.get(r)}connect(r,s={}){const e=`c${w(6).toString("hex")}`;this.clients.set(e,r);const i=this.handlersFor(e,s.origin);return{id:e,receive:async o=>{const t=await this.answerOne(i,o);t&&r(t)},close:()=>{this.clients.delete(e),this.watcher.forget(e);for(const[o,t]of this.owners)t===e&&this.owners.delete(o)}}}channel(){const r=new Set,s=this.connect(e=>{const i=JSON.parse(JSON.stringify(e));queueMicrotask(()=>{for(const o of r)o(i)})});return{send:e=>{s.receive(JSON.parse(JSON.stringify(e)))},listen:e=>(r.add(e),()=>r.delete(e)),close:()=>{s.close()}}}notify(r,s){for(const e of this.clients.values())e({jsonrpc:c,method:r,params:s})}sendTo(r,s,e){r!==void 0&&this.clients.get(r)?.({jsonrpc:c,method:s,params:e})}async answerOne(r,s){const e=y.safeParse(s);if(!e.success){const o=s?.id;return typeof o!="string"&&typeof o!="number"?void 0:{jsonrpc:c,id:o,error:{code:l.invalidRequest,message:"Not a JSON-RPC request."}}}const i=e.data;return Object.hasOwn(u,i.method)&&i.method!=="tools/call"?{jsonrpc:c,id:i.id,error:{code:l.methodNotFound,message:`${i.method} is answered by the page that hosts the editor, not by allyhub dev's server.`}}:f(SERVER_METHODS,r,i)}handlersFor(r,s){const{writer:e,watcher:i}=this,o=m({live:this.live,checker:this.checker,exports:this.exports,reveal:this.reveal,addresses:()=>this.serving?.pages(s)});return{"files/read":({path:t})=>e.read(t),"files/write":async({path:t,text:a,over:n})=>({version:await e.write(t,a,n,r)}),"files/upload":async({dir:t,name:a,data:n})=>({path:await e.upload(t,a,Buffer.from(n,"base64"),r)}),"files/url":async({path:t})=>{if(await p(this.root,t),!this.serving)throw new d(l.unavailable,"This server serves no files over HTTP: only allyhub dev's does.");return{url:this.serving.file(s,t)}},"files/list":({dir:t})=>e.list(t),"files/move":async({from:t,to:a})=>({rewritten:await e.move(t,a,r)}),"files/remove":async({path:t})=>({trash:await e.remove(t,r)}),"files/trash":async()=>({entries:await e.trash()}),"files/restore":async({id:t})=>({path:await e.restore(t,r)}),"files/watch":async({paths:t})=>{for(const n of t)await p(this.root,n);const a=await i.watch(r,t);return this.owners.set(a,r),{watch:a}},"files/unwatch":({watch:t})=>(this.owners.get(t)===r&&(i.unwatch(t),this.owners.delete(t)),Promise.resolve({})),"tools/call":async({name:t,arguments:a})=>{const n=await f(h,o,{jsonrpc:c,id:0,method:t,params:a});if("error"in n)throw new d(n.error.code,n.error.message,n.error.data);return{result:n.result}}}}async tool(r,s){const e=await f(h,m({live:this.live,checker:this.checker,exports:this.exports,reveal:this.reveal,addresses:()=>this.serving?.pages(void 0)}),{jsonrpc:c,id:0,method:r,params:s});if("error"in e)throw new d(e.error.code,e.error.message,e.error.data);return h[r].result.parse(e.result)}async close(){this.watcher.close(),this.clients.clear(),await this.checker?.close(),await this.indexer?.close(),await this.exports.close(),await this.live.close()}}
2
+ import{randomBytes as m}from"node:crypto";import{resolve as v}from"node:path";import{FILE_METHODS as y,HOST_METHODS as w,JSONRPC as c,PROJECT_TOOLS as h,RPC_ERROR as l,RequestSchema as g,RpcError as d,answer as f}from"@allyhub-next/protocol";import{Checker as O,Indexer as x}from"./background.js";import{Exports as S}from"./exports.js";import{hasFileManager as k,revealFile as R}from"./reveal.js";import{Live as E}from"./live.js";import{fileIn as u}from"./paths.js";import{toolHandlers as p}from"./tools.js";import{Watcher as T}from"./watcher.js";import{Writer as N}from"./writer.js";export const SERVER_METHODS={...y,"tools/call":w["tools/call"]};export class ProjectServer{root;writer;watcher;live;exports;reveal;checker;serving;indexer;clients=new Map;constructor(r){this.root=v(r.root),this.live=new E(this.root,r.gpu===void 0?{}:{gpu:r.gpu}),this.watcher=new T(this.root,(e,s)=>{this.sendTo(this.watchOwner(e),"files/changed",{watch:e,changes:s})},e=>{this.live.moved(e),this.notify("project/changed",{revision:e}),this.checker?.schedule()}),this.writer=new N(this.root,(e,s)=>{this.watcher.wrote(e,s)}),this.reveal=r.reveal===!1?void 0:r.reveal??(k()?R:void 0),this.exports=new S(this.root,e=>{this.notify("export/changed",{job:e})});const i=r.index??process.env.ALLYHUB_NO_INDEX!=="1";if(r.check!==!1){const e=i?new x({root:this.root,emit:s=>{this.notify("index/changed",{jobs:s})},made:()=>{this.checker?.schedule(!0)}}):void 0;this.indexer=e,this.checker=new O({live:this.live,emit:s=>{this.notify("check/changed",s)},...e?{needs:s=>{e.want(s)}}:{},...r.settle===void 0?{}:{settle:r.settle}})}}static open(r){const i=new ProjectServer(r);return i.watcher.start(),i.checker?.schedule(),Promise.resolve(i)}owners=new Map;watchOwner(r){return this.owners.get(r)}connect(r,i={}){const e=`c${m(6).toString("hex")}`;this.clients.set(e,r);const s=this.handlersFor(e,i.origin);return{id:e,receive:async o=>{const t=await this.answerOne(s,o);t&&r(t)},close:()=>{this.clients.delete(e),this.watcher.forget(e);for(const[o,t]of this.owners)t===e&&this.owners.delete(o)}}}channel(){const r=new Set,i=this.connect(e=>{const s=JSON.parse(JSON.stringify(e));queueMicrotask(()=>{for(const o of r)o(s)})});return{send:e=>{i.receive(JSON.parse(JSON.stringify(e)))},listen:e=>(r.add(e),()=>r.delete(e)),close:()=>{i.close()}}}notify(r,i){for(const e of this.clients.values())e({jsonrpc:c,method:r,params:i})}sendTo(r,i,e){r!==void 0&&this.clients.get(r)?.({jsonrpc:c,method:i,params:e})}async answerOne(r,i){const e=g.safeParse(i);if(!e.success){const o=i?.id;return typeof o!="string"&&typeof o!="number"?void 0:{jsonrpc:c,id:o,error:{code:l.invalidRequest,message:"Not a JSON-RPC request."}}}const s=e.data;return Object.hasOwn(w,s.method)&&s.method!=="tools/call"?{jsonrpc:c,id:s.id,error:{code:l.methodNotFound,message:`${s.method} is answered by the page that hosts the editor, not by allyhub dev's server.`}}:f(SERVER_METHODS,r,s)}handlersFor(r,i){const{writer:e,watcher:s}=this,o=p({live:this.live,checker:this.checker,exports:this.exports,reveal:this.reveal,tree:()=>this.serving?.tree(i)});return{"files/read":({path:t})=>e.read(t),"files/write":async({path:t,text:a,over:n})=>({version:await e.write(t,a,n,r)}),"files/upload":async({dir:t,name:a,data:n})=>({path:await e.upload(t,a,Buffer.from(n,"base64"),r)}),"files/url":async({path:t})=>{if(await u(this.root,t),!this.serving)throw new d(l.unavailable,"This server serves no files over HTTP: only allyhub dev's does.");return{url:this.serving.file(i,t)}},"files/list":({dir:t})=>e.list(t),"files/move":async({from:t,to:a})=>({rewritten:await e.move(t,a,r)}),"files/remove":async({path:t})=>({trash:await e.remove(t,r)}),"files/trash":async()=>({entries:await e.trash()}),"files/restore":async({id:t})=>({path:await e.restore(t,r)}),"files/watch":async({paths:t})=>{for(const n of t)await u(this.root,n);const a=await s.watch(r,t);return this.owners.set(a,r),{watch:a}},"files/unwatch":({watch:t})=>(this.owners.get(t)===r&&(s.unwatch(t),this.owners.delete(t)),Promise.resolve({})),"tools/call":async({name:t,arguments:a})=>{const n=await f(h,o,{jsonrpc:c,id:0,method:t,params:a});if("error"in n)throw new d(n.error.code,n.error.message,n.error.data);return{result:n.result}}}}async tool(r,i,e={}){const s=await f(h,p({live:this.live,checker:this.checker,exports:this.exports,reveal:this.reveal,tree:()=>e.tree??this.serving?.tree(void 0)}),{jsonrpc:c,id:0,method:r,params:i});if("error"in s)throw new d(s.error.code,s.error.message,s.error.data);return h[r].result.parse(s.result)}async close(){this.watcher.close(),this.clients.clear(),await this.checker?.close(),await this.indexer?.close(),await this.exports.close(),await this.live.close()}}
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{isAbsolute as h,relative as p,sep as m}from"node:path";import{within as l}from"@allyhub-next/formats";import{SHARED_KINDS as u,SNAPSHOT_TREE as d}from"@allyhub-next/protocol";import{THREE_LIBS as w}from"@allyhub-next/scenery-host/bundle";export const REACH_SHARED=[d.editor,d.runtime,`${d.build}${w}/`];const O="comments.json",S=t=>u.includes(t);export class Reach{reaching=new Map;dirs;files;constructor(r,n){this.files=n,this.dirs=r.map(s=>s.dir).sort((s,i)=>i.split("/").length-s.split("/").length);for(const s of r)S(s.kind)&&this.reaching.set(s.dir,{tree:new Set,files:new Set,own:[]})}get items(){return[...this.reaching.keys()]}itemOf(r){return this.dirs.find(n=>n!==""&&l(r,n))??(this.dirs.includes("")?"":void 0)}of(r){return this.reaching.get(r)}done(r){for(const s of this.files)if(s.split("/").pop()!==O){const i=this.itemOf(s);i!==void 0&&this.reaching.get(i)?.files.add(s)}const n={};for(const[s,i]of this.reaching)n[s]={tree:[...i.tree].filter(a=>r.has(a)).sort(),files:[...i.files].sort(),own:i.own};return{shared:[...REACH_SHARED],items:n}}}export function pieceBundle(t,r){const n=new Set,s=new Set,i=new Set,a=c=>{if(i.has(c))return;i.add(c);const e=t?.chunks[c];if(e){n.add(e.file);for(const f of[...e.css,...e.assets])n.add(f);for(const f of e.modules)s.add(f);for(const f of[...e.imports,...e.dynamicImports])a(f)}},o=t?.entries[r.replaceAll("/","__")];return o&&a(o.file),{files:n,modules:s}}export function projectPathOf(t,r){const n=t.replace(/[?#].*$/u,"");if(h(n))for(const s of r){const i=p(s,n);if(i!==""&&!i.startsWith("..")&&!h(i))return i.split(m).join("/")}}export function pieceNames(t){const{prepared:r,piece:n,reach:s}=t,i=e=>s.itemOf(e)===n.dir,a=new Set,o=new Set,c=e=>Object.hasOwn(r.media,e);for(const e of t.modules){const f=projectPathOf(e,t.roots);f!==void 0&&c(f)&&a.add(f)}for(const e of Object.keys(r.media))(i(e)||e.startsWith(".allyhub/"))&&a.add(e);for(const e of[...t.reads?.media??[],...t.shows?.media??[]])c(e)&&a.add(e);for(const e of Object.keys(r.data))i(e.split("#")[0]??e)&&o.add(e);for(const e of[...t.reads?.data??[],...t.shows?.data??[]])Object.hasOwn(r.data,e)&&o.add(e);return{media:a,data:o}}export function reachedSource(t,r,n){const s=(o,c)=>Object.fromEntries(Object.entries(o).filter(([e])=>c(e))),i=o=>!n.some(c=>o.startsWith(`${c}.`)),a=o=>Object.fromEntries(Object.entries(o).map(([c,e])=>[c,s(e,i)]));return{...t,media:s(t.media,o=>r.media.has(o)),...t.data?{data:s(t.data,o=>r.data.has(o))}:{},messages:a(t.messages),...t.anchors?{anchors:a(t.anchors)}:{}}}export function reachedCheck(t,r,n){const s=i=>{const a=i.where?.file;return typeof i.piece=="string"&&r.has(i.piece)||typeof a=="string"&&n(a)};return{...t,problems:t.problems.filter(s),facts:t.facts.filter(s)}}
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{readFile as Q,readdir as U,realpath as V,stat as Y}from"node:fs/promises";import{join as l,sep as Z}from"node:path";import{THREE_LIBS as _}from"@allyhub-next/scenery-host/bundle";import{BAKE_DIR as ee}from"@allyhub-next/scenery-host";import{KeyedStore as te}from"@allyhub-next/project";import{COMPONENT_STILLS_MAX as W,RpcError as ie,SNAPSHOT_TREE as p,pieceSourcePath as se,scenerySourcePath as oe,snapshotAnswerPath as P,snapshotPreviewPath as ne,stillPath as J,stillsIndexKey as re,stillsIndexPath as ce}from"@allyhub-next/protocol";import{deckComponents as ae,isDeckCode as de,readScript as fe,readSlidesFile as le,resolveDeck as pe,scriptWords as me}from"@allyhub-next/slides-core";import{bakesOnDisk as ue}from"@allyhub-next/stage";import{runtimeFiles as he}from"@allyhub-next/stage-page";import{itemPreview as we}from"./card.js";import{mediaTypeOf as H}from"@allyhub-next/formats";import{Reach as ye,pieceBundle as ke,pieceNames as $e,reachedCheck as ge,reachedSource as be}from"./reach.js";import{matteFile as Se}from"./tree.js";const T="https://tree.invalid/";function R(s){return typeof s=="string"?s.startsWith(T)?s.slice(T.length):s:Array.isArray(s)?s.map(R):s!==null&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([y,d])=>[y,R(d)])):s}const b=s=>new TextEncoder().encode(JSON.stringify(s));async function A(s){return(await U(s,{recursive:!0,withFileTypes:!0}).catch(()=>[])).filter(d=>d.isFile()).map(d=>l(d.parentPath,d.name).slice(s.length+1).split(Z).join("/"))}const je=s=>Y(s).then(y=>y.isFile(),()=>!1);export async function recordTree(s,y={}){const{project:d}=s,{live:f,root:w}=d;await d.watcher.settled();const O=new Map,u=(e,t,i=H(e))=>{O.set(e,{path:e,type:i,file:t})},S=(e,t,i=H(e))=>{O.set(e,{path:e,type:i,bytes:t})},z=f.revision,m=await f.prepared(),x=new Map;if(s.ui!==void 0)for(const e of await A(s.ui))u(`${p.editor}${e}`,l(s.ui,e));for(const[e,t]of await he())u(`${p.runtime}${e}`,t);const k=async(e,t)=>{let i;try{i={result:R(await d.tool(e,t,{tree:T}))}}catch(c){i={error:c instanceof ie?{code:c.code,message:c.message}:{code:-32603,message:c instanceof Error?c.message:""}}}const r=P(e,t);S(r,b(i));const o=t.item;return typeof o=="string"&&x.set(o,[...x.get(o)??[],r]),i.result},X=async(e,t,i)=>{if(!de(i.code))return;const r=D=>Q(l(w,D),"utf8").catch(()=>{}),o=await r(i.file),c=o===void 0?void 0:le(o).file;if(!c)return;const a=t.lang??Object.keys(i.scripts)[0],n=a===void 0?void 0:await r(i.scripts[a]??`${e}/script.${a}.yaml`),v=(n===void 0?void 0:fe(n))??{parts:[],slides:[]};return pe({code:i.code,file:c,words:me(v,i.prefix),prefix:i.prefix,base:i.file.split("/").slice(0,-1).join("/"),theme:i.theme}).deck},q=async(e,t,i,r)=>{const o=new Map;for(const $ of ae(r,i))o.set(re($.at),$.at);if(o.size===0)return;const c=te.of(w,"stills"),a={stills:{}},n=h.of(e),v=[...o];for(let $=0;$<v.length;$+=W){const K=v.slice($,$+W);(await d.tool("slides/component-stills",{item:e,version:t.key,components:K.map(([,g])=>g)},{tree:T}).catch(()=>{}))?.stills.forEach((g,G)=>{const L=K[G]?.[0];!g||L===void 0||(a.stills[L]=g.key,u(J(g.key),c.path(`${g.key}.webp`),"image/webp"),n?.tree.add(J(g.key)))})}const D=ce(e,t.key);S(D,b(a),"application/json"),n?.tree.add(D)},F=await k("project/items",{}),E=F?.items??[],h=new ye(E,m.files),j=d.checker?.state,M=j===void 0||j.status==="waiting"||j.status==="running"?{status:"off",revision:f.revision,problems:j?.problems??[],facts:j?.facts??[]}:j;S(P("check/results",{}),b({result:M}));for(const e of h.items){const t=h.of(e),i=new Set(m.pieces.filter(o=>o.dir===e).map(o=>o.id)),r=o=>h.itemOf(o)===e;t?.own.push({path:P("project/items",{}),type:"application/json",bytes:b({result:{...F,items:E.filter(o=>o.dir===e)}})},{path:P("check/results",{}),type:"application/json",bytes:b({result:ge(M,i,r)})})}for(const e of m.bundle?.chunks.files??[])u(`${p.build}${e}`,l(f.pieceDir,e));for(const e of await A(l(f.pieceDir,_)))u(`${p.build}${_}/${e}`,l(f.pieceDir,_,e));const N=new Set(Object.keys(m.media));for(const e of Object.keys(m.media)){const t=Se(w,m.media[e]);t!==void 0&&await je(t)&&u(`${p.matte}${e}`,t,"video/mp4")}const C=new Map;for(const e of E)if(e.kind==="video"||e.kind==="slides"){const t=await k("video/versions",{item:e.dir});await k("video/stage",{item:e.dir});for(const i of t?.versions??[])await k("video/stage",{item:e.dir,version:i.key});if(e.kind==="slides"){const i=await k("slides/deck",{item:e.dir});await k("slides/fonts",{item:e.dir});const r={media:new Set,data:new Set};if(C.set(e.dir,r),i&&t)for(const o of t.versions){const c=await X(e.dir,o,i);if(c){for(const a of c.slides){a.background_picture!==void 0&&r.media.add(a.background_picture);for(const n of a.shapes)n.media&&r.media.add(n.media.path),n.chart?.source!==void 0&&r.data.add(n.chart.source)}await q(e.dir,o,t.width,c)}}}}else if(e.kind==="sheet")await k("sheet/generated",{item:e.dir});else if(e.kind==="scenery"||e.kind==="model"){const t=await f.scenery(e.entry).catch(()=>{});if(!t)continue;for(const i of t.output)u(`${p.scenery}${i}`,l(f.sceneryDir,i));for(const i of await A(l(f.sceneryDir,t.decoders)))u(`${p.scenery}${t.decoders}${i}`,l(f.sceneryDir,t.decoders,i));u(`${p.scenery}${t.manifoldWasm}`,l(f.sceneryDir,t.manifoldWasm)),S(oe(e.entry),b(await f.scenerySource(e.entry)));for(const i of t.media)N.add(i)}for(const e of N)u(`${p.media}${e}`,l(w,e));for(const e of await ue(w))u(`${p.bakes}${e}.bin`,l(w,ee,`${e}.bin`));const I=[w,await V(w).catch(()=>w)];for(const e of m.pieces){const t=await f.source(e.id).catch(()=>{});if(!t)continue;const i=ke(m.bundle?.chunks,e.id),r=$e({prepared:m,piece:e,reach:h,modules:i.modules,roots:I,reads:d.checker?.reads.get(e.id),shows:C.get(e.dir)}),o=m.pieces.filter(n=>n.id!==e.id&&!I.some(v=>i.modules.has(l(v,n.file)))).map(n=>n.id),c=se(e.id);S(c,b(be(t,r,o)));const a=h.of(e.dir);if(a){a.tree.add(c);for(const n of i.files)a.tree.add(`${p.build}${n}`);for(const n of r.media)a.tree.add(`${p.media}${n}`),a.tree.add(`${p.matte}${n}`),a.files.add(n)}}for(const[e,t]of x)for(const i of t)h.of(e)?.tree.add(i);for(const e of m.docs)for(const t of e.shows)h.of(e.dir)?.files.add(t);for(const e of m.sheets)for(const t of e.files)h.of(e.dir)?.files.add(t);const B=y.preview===!1?void 0:y.preview??(e=>we(s,e));if(B)for(const e of E){const t=await B(e).catch(()=>{});if(t===void 0)continue;const i=ne(e.dir);S(i,Buffer.from(JSON.stringify(t)),"application/json"),h.of(e.dir)?.tree.add(i)}return{revision:z,files:[...O.values()],reach:h.done(new Set(O.keys()))}}
@@ -1,6 +1,6 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{randomBytes as R}from"node:crypto";import{indexPath as T}from"@allyhub-next/video-core";import{MadeSounds as M,decodeAsOf as J}from"./sound.js";import{createReadStream as G}from"node:fs";import{readFile as K,stat as Y}from"node:fs/promises";import{createServer as Q}from"node:http";import{Readable as V}from"node:stream";import{join as F,normalize as X,resolve as A,sep as I}from"node:path";import{getRequestListener as Z}from"@hono/node-server";import{Hono as ee}from"hono";import{WebSocketServer as te}from"ws";import{stageFiles as ne}from"@allyhub-next/stage-page";import{BAKE_DIR as re}from"@allyhub-next/scenery-host";import{bakesOnDisk as oe}from"@allyhub-next/stage";import{stageMedia as se}from"./live.js";import{typeOf as ie}from"./mime.js";import{pathProblem as W}from"./paths.js";import{ProjectServer as ae}from"./project.js";import{stageCsp as _,stagePage as ce,viewerPage as de}from"./stage.js";export const RPC_PATH="/rpc",RAW_PATH="/files/raw/";const m={"access-control-allow-origin":"*"};function w(r,a){const u=X(F(r,a));return u.startsWith(r.endsWith(I)?r:`${r}${I}`)?u:void 0}async function S(r,a,u){const v=await Y(r).catch(()=>{});if(!v?.isFile())return new Response("not found",{status:404,headers:u});const o={"content-type":ie(r),"cache-control":"no-cache","accept-ranges":"bytes",...u},i=v.size,p=a?/^bytes=(\d*)-(\d*)$/u.exec(a.trim()):null,h=(k,N)=>V.toWeb(G(r,{start:k,end:N}));if(!p||p[1]===""&&p[2]===""||i===0)return new Response(i===0?null:h(0,i-1),{status:200,headers:{...o,"content-length":String(i)}});let b,y;return p[1]===""?(b=Math.max(0,i-Number(p[2])),y=i-1):(b=Number(p[1]),y=p[2]===""?i-1:Math.min(Number(p[2]),i-1)),b>=i||b>y?new Response(null,{status:416,headers:{...o,"content-range":`bytes */${String(i)}`}}):new Response(h(b,y),{status:206,headers:{...o,"content-length":String(y-b+1),"content-range":`bytes ${String(b)}-${String(y)}/${String(i)}`}})}const E=/^[a-z][a-z0-9+.-]*:\/\/[a-z0-9.-]+(:\d{1,5})?$/u;export const ALLYHUB_FORWARDED="allyhub-forwarded";export function forwardedHost(r){const a=r[ALLYHUB_FORWARDED],v=(r.forwarded??(Array.isArray(a)?a[0]:a))?.split(",")[0]?.split(";").map(i=>i.trim().split("=")).find(([i])=>i?.toLowerCase()==="host")?.[1];if(v!==void 0)return v.replace(/^"(.*)"$/u,"$1");const o=r["x-forwarded-host"];return(Array.isArray(o)?o[0]:o)?.split(",")[0]?.trim()}export async function startDevServer(r){const a=A(r.root);if(r.embedder!==void 0&&!E.test(r.embedder))throw new Error(`Not an origin: ${r.embedder}`);if(r.publicOrigin!==void 0&&!E.test(r.publicOrigin.replace("{port}","1")))throw new Error(`Not an origin: ${r.publicOrigin}`);const u=r.token??R(18).toString("base64url"),o=`/s/${R(18).toString("base64url")}/`,i=await ae.open({...r,root:a,stageBase:o,...r.publicOrigin===void 0?{}:{reveal:!1}}),p=ne();let h=0;const b=()=>h===0?void 0:r.publicOrigin?.replace("{port}",String(h)),y=()=>{const e=b();return e===void 0?void 0:new URL(e).host},k=()=>{const e=y();return new Set([`127.0.0.1:${String(h)}`,`localhost:${String(h)}`,...e===void 0?[]:[e]])},N=e=>e===y()?b()??"":`http://${e}`,C=e=>N(e.req.header("host")??""),U=e=>{const t=y();t!==void 0&&forwardedHost(e.headers)===t&&(e.headers.host=t)},P=e=>e??`http://127.0.0.1:${String(h)}`;i.serving={file:(e,t)=>`${P(e)}${RAW_PATH}${t.split("/").map(encodeURIComponent).join("/")}?token=${encodeURIComponent(u)}`,pages:e=>({stage:t=>`${P(e)}${o}stage?${t.toString()}`,viewer:t=>`${P(e)}${o}viewer?${t.toString()}`,probe:`${P(e)}${o}probe`})};const l=new ee,B=async e=>{if(!r.ui)return e.text("allyhub dev serves its editors here.",200);const t=await K(F(r.ui,"index.html"),"utf8").catch(()=>{});if(t===void 0)return e.text("The page's files are missing: build them first (pnpm --filter @allyhub-next/editor-web build).",500);const n=R(16).toString("base64");return e.html(t.replace(/<script/gu,`<script nonce="${n}"`).replace("</head>",`<meta name="allyhub-token" content="${u}"></head>`),200,{"content-security-policy":["default-src 'self'",`script-src 'self' 'nonce-${n}'`,"style-src 'self' 'unsafe-inline'","img-src 'self' data: blob:","media-src 'self' blob:","font-src 'self' data:",`connect-src 'self' ws://${e.req.header("host")??""}`,"frame-src 'self'",`frame-ancestors ${r.embedder??"'none'"}`].join("; "),"cache-control":"no-store"})};l.get("/",B),l.get(`${RAW_PATH}*`,async e=>{if(e.req.query("token")!==u)return e.text("forbidden",403);const t=decodeURIComponent(e.req.path.slice(RAW_PATH.length));if(W(t)!==void 0)return e.text("forbidden",403);const n=w(a,t);return n?S(n,e.req.header("range"),{"x-content-type-options":"nosniff","content-security-policy":"sandbox; default-src 'none'; img-src 'self'; media-src 'self'; style-src 'unsafe-inline'"}):e.text("forbidden",403)}),l.get("/__allyhub/*",async e=>{const t=e.req.path.slice(11);let n;if(t==="runtime.js")n=p.runtime;else for(const[s,c]of Object.entries(p.fonts))t.startsWith(`${s}/`)&&(n=w(c,t.slice(s.length+1)));return n?S(n,void 0,{...m,"cache-control":t==="runtime.js"?"no-cache":"public, max-age=86400"}):e.notFound()}),l.use("/s/*",async(e,t)=>{if(!e.req.path.startsWith(o))return e.notFound();await t()});const g=(e,t)=>{const n=e.req.query(t);return n===void 0||n===""?void 0:n},H=(e,t)=>{const n=g(e,t),s=n===void 0?void 0:Number(n);return s!==void 0&&Number.isFinite(s)?s:void 0};l.get(`${o}stage`,e=>{const t=g(e,"piece")??"",n=Object.fromEntries((g(e,"combo")??"default")==="default"?[]:(g(e,"combo")??"").split(",").map(f=>{const q=f.indexOf("=");return[f.slice(0,q),f.slice(q+1)]})),s={};for(const f of["t","offset","dur"]){const q=H(e,f);q!==void 0&&(s[f]=q)}const c=g(e,"part");c!==void 0&&(s.part=c);const d=C(e),$=R(16).toString("base64");return e.html(ce({runtime:`${d}/__allyhub/`,nonce:$,config:{source:`${d}${o}source?${new URLSearchParams({piece:t}).toString()}`,combo:n,start:s,...g(e,"play")==="1"?{play:!0}:{},...g(e,"chrome")==="0"?{chrome:!1}:{},...g(e,"edit")==="1"?{edit:!0}:{}}}),200,{"content-security-policy":_(d,o,$,r.embedder),"cache-control":"no-store"})}),l.get(`${o}probe`,e=>{const t=R(16).toString("base64");return e.html(`<!doctype html><script nonce="${t}">parent.postMessage({ allyhub: true, type: "probe" }, "*");<\/script>`,200,{"content-security-policy":`default-src 'none'; script-src 'nonce-${t}'; frame-ancestors ${C(e)}${r.embedder?` ${r.embedder}`:""}`,"cache-control":"no-store"})}),l.get(`${o}source`,async e=>{try{const t=await i.live.source(g(e,"piece")??"",C(e));return e.json(t,200,{...m,"cache-control":"no-store"})}catch(t){return e.json({error:{message:t instanceof Error?t.message:String(t)}},404,m)}}),l.get(`${o}build/*`,e=>{const t=w(F(i.live.buildDir,"stage"),decodeURIComponent(e.req.path.slice(`${o}build/`.length)));return t?S(t,void 0,m):e.notFound()}),l.get(`${o}scenery/*`,e=>{const t=w(F(i.live.buildDir,"scenery"),decodeURIComponent(e.req.path.slice(`${o}scenery/`.length)));return t?S(t,void 0,m):e.notFound()});const j=new Set;l.get(`${o}media/*`,e=>{const t=decodeURIComponent(e.req.path.slice(`${o}media/`.length)),s=Object.hasOwn(i.live.latest()?.media??{},t)||j.has(t)?w(a,t):void 0;return s?S(s,e.req.header("range"),m):e.notFound()});const z=new M(a);l.get(`${o}sound/*`,async e=>{const t=decodeURIComponent(e.req.path.slice(`${o}sound/`.length)),n=i.live.latest()?.media[t],s=n?w(a,t):void 0;if(!n||!s)return e.notFound();const c=J({db:e.req.query("db"),speed:e.req.query("speed"),filter:e.req.query("filter")});if(typeof c=="string")return e.text(c,400,m);try{const d=await z.made(s,n.sha256,c,e.req.query("wait")!=="0");return d===void 0?e.body(null,202,m):await S(d,e.req.header("range"),{...m,"content-type":"audio/flac"})}catch(d){return e.text(d instanceof Error?d.message:String(d),500,m)}}),l.get(`${o}matte/*`,e=>{const t=decodeURIComponent(e.req.path.slice(`${o}matte/`.length)),n=i.live.latest()?.media[t];if(!n?.matte)return e.notFound();const s=w(a,T(n.sha256,"matte.mp4"));return s?S(s,e.req.header("range"),{...m,"content-type":"video/mp4"}):e.notFound()}),l.get(`${o}bakes/*`,e=>{const t=decodeURIComponent(e.req.path.slice(`${o}bakes/`.length));if(!/^[0-9a-f]+\.[a-z0-9-]+\.bin$/u.test(t))return e.notFound();const n=w(F(a,re),t);return n?S(n,void 0,m):e.notFound()}),l.get(`${o}viewer`,async e=>{const t=g(e,"file")??"";let n;try{n=JSON.parse(g(e,"camera")??"null")}catch{n=null}if(W(t)!==void 0||!w(a,t))return e.text("No such scenery.",404);const s=C(e);let c;try{c=await i.live.scenery(t)}catch(f){return e.text(f instanceof Error?f.message:String(f),500)}for(const f of c.media)j.add(f);const d=R(16).toString("base64"),$=`${s}${o}scenery/`;return e.html(de({nonce:d,config:{module:`${$}${c.module}`,file:t,media:`${s}${se(o,"")}`,decoders:`${$}${c.decoders}`,manifoldWasm:`${$}${c.manifoldWasm}`,bakes:[...await oe(a)],bakeBase:`${s}${o}bakes/`,...ue(n)?{camera:n}:{}}}),200,{"content-security-policy":_(s,o,d,r.embedder),"cache-control":"no-store"})}),l.get("/*",async e=>{if(!r.ui)return e.notFound();const t=w(A(r.ui),decodeURIComponent(e.req.path.slice(1)));return t?S(t,void 0,{"cache-control":"public, max-age=3600"}):e.notFound()});const O=new te({noServer:!0,maxPayload:512*1024*1024});O.on("connection",(e,t)=>{const n=i.connect(s=>{e.readyState===e.OPEN&&e.send(JSON.stringify(s))},{origin:`http://${t.headers.host??""}`});e.on("message",(s,c)=>{if(c||!Buffer.isBuffer(s))return;let d;try{d=JSON.parse(s.toString("utf8"))}catch{e.send(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Not JSON."}}));return}n.receive(d)}),e.on("close",()=>{n.close()})});const D=Z(l.fetch),L=(e,t)=>{e.writeHead(403,{"content-type":"text/plain; charset=utf-8"}),e.end(t)},x=Q((e,t)=>{if(U(e),!k().has(e.headers.host??"")){L(t,"forbidden host");return}D(e,t)});x.on("upgrade",(e,t,n)=>{const s=new URL(e.url??"/","http://x"),c=($,f)=>{t.end(`HTTP/1.1 ${String($)} ${f}\r
2
+ import{randomBytes as E}from"node:crypto";import{createReadStream as z}from"node:fs";import{readFile as M,stat as W}from"node:fs/promises";import{createServer as J}from"node:http";import{Readable as K}from"node:stream";import{join as P,normalize as G,resolve as q,sep as C}from"node:path";import{getRequestListener as Y}from"@hono/node-server";import{Hono as Q}from"hono";import{WebSocketServer as V}from"ws";import{KeyedStore as X}from"@allyhub-next/project";import{SNAPSHOT_TREE as w,SOUND_FOLDER as Z,TREE_PAGES as ee,stageCsp as te}from"@allyhub-next/protocol";import{BAKE_DIR as ne}from"@allyhub-next/scenery-host";import{runtimeFile as re}from"@allyhub-next/stage-page";import{mediaTypeOf as oe}from"@allyhub-next/formats";import{pathProblem as U}from"./paths.js";import{ProjectServer as se}from"./project.js";import{MadeSounds as ie,decodeAsOf as ae}from"./sound.js";import{BAKE_NAME as ce,STILL_NAME as de,matteFile as ue,sourceName as H}from"./tree.js";export const RPC_PATH="/rpc",RAW_PATH="/files/raw/";const d={"access-control-allow-origin":"*"};function y(t,a){const f=G(P(t,a));return f.startsWith(t.endsWith(C)?t:`${t}${C}`)?f:void 0}async function h(t,a,f){const S=await W(t).catch(()=>{});if(!S?.isFile())return new Response("not found",{status:404,headers:f});const l={"content-type":oe(t),"cache-control":"no-cache","accept-ranges":"bytes",...f},r=S.size,c=a?/^bytes=(\d*)-(\d*)$/u.exec(a.trim()):null,v=(N,A)=>K.toWeb(z(t,{start:N,end:A}));if(!c||c[1]===""&&c[2]===""||r===0)return new Response(r===0?null:v(0,r-1),{status:200,headers:{...l,"content-length":String(r)}});let m,g;return c[1]===""?(m=Math.max(0,r-Number(c[2])),g=r-1):(m=Number(c[1]),g=c[2]===""?r-1:Math.min(Number(c[2]),r-1)),m>=r||m>g?new Response(null,{status:416,headers:{...l,"content-range":`bytes */${String(r)}`}}):new Response(v(m,g),{status:206,headers:{...l,"content-length":String(g-m+1),"content-range":`bytes ${String(m)}-${String(g)}/${String(r)}`}})}const I=/^[a-z][a-z0-9+.-]*:\/\/[a-z0-9.-]+(:\d{1,5})?$/u;export const ALLYHUB_FORWARDED="allyhub-forwarded";export function forwardedHost(t){const a=t[ALLYHUB_FORWARDED],S=(t.forwarded??(Array.isArray(a)?a[0]:a))?.split(",")[0]?.split(";").map(r=>r.trim().split("=")).find(([r])=>r?.toLowerCase()==="host")?.[1];if(S!==void 0)return S.replace(/^"(.*)"$/u,"$1");const l=t["x-forwarded-host"];return(Array.isArray(l)?l[0]:l)?.split(",")[0]?.trim()}export async function startDevServer(t){const a=q(t.root);if(t.embedder!==void 0&&!I.test(t.embedder))throw new Error(`Not an origin: ${t.embedder}`);if(t.publicOrigin!==void 0&&!I.test(t.publicOrigin.replace("{port}","1")))throw new Error(`Not an origin: ${t.publicOrigin}`);const f=t.token??E(18).toString("base64url"),l=`/s/${E(18).toString("base64url")}/`,r=await se.open({...t,root:a,...t.publicOrigin===void 0?{}:{reveal:!1}});let c=0;const v=()=>c===0?void 0:t.publicOrigin?.replace("{port}",String(c)),m=()=>{const e=v();return e===void 0?void 0:new URL(e).host},g=()=>{const e=m();return new Set([`127.0.0.1:${String(c)}`,`localhost:${String(c)}`,...e===void 0?[]:[e]])},N=e=>e===m()?v()??"":`http://${e}`,A=e=>N(e.req.header("host")??""),k=e=>{const n=m();n!==void 0&&forwardedHost(e.headers)===n&&(e.headers.host=n)},T=e=>e??`http://127.0.0.1:${String(c)}`;r.serving={file:(e,n)=>`${T(e)}${RAW_PATH}${n.split("/").map(encodeURIComponent).join("/")}?token=${encodeURIComponent(f)}`,tree:e=>`${T(e)}${l}`};const j=new Set,L=new ie(a),R=new Q,_=async e=>{if(!t.ui)return e.text("allyhub dev serves its editors here.",200);const n=await M(P(t.ui,"index.html"),"utf8").catch(()=>{});if(n===void 0)return e.text("The page's files are missing: build them first (pnpm --filter @allyhub-next/editor-web build).",500);const u=E(16).toString("base64");return e.html(n.replace(/<script/gu,`<script nonce="${u}"`).replace("</head>",`<meta name="allyhub-token" content="${f}"></head>`),200,{"content-security-policy":["default-src 'self'",`script-src 'self' 'nonce-${u}'`,"style-src 'self' 'unsafe-inline'","img-src 'self' data: blob:","media-src 'self' blob:","font-src 'self' data:",`connect-src 'self' ws://${e.req.header("host")??""}`,"frame-src 'self'",`frame-ancestors ${t.embedder??"'none'"}`].join("; "),"cache-control":"no-store"})};R.get("/",_),R.get(`${RAW_PATH}*`,async e=>{if(e.req.query("token")!==f)return e.text("forbidden",403);const n=decodeURIComponent(e.req.path.slice(RAW_PATH.length));if(U(n)!==void 0)return e.text("forbidden",403);const u=y(a,n);return u?h(u,e.req.header("range"),{"x-content-type-options":"nosniff","content-security-policy":"sandbox; default-src 'none'; img-src 'self'; media-src 'self'; style-src 'unsafe-inline'"}):e.text("forbidden",403)}),R.get(`${l}*`,async e=>{let n;try{n=decodeURIComponent(e.req.path.slice(l.length))}catch{return e.notFound()}const u=e.req.header("range"),p=A(e),b=n.slice(0,n.indexOf("/")+1),i=n.slice(b.length);switch(b){case w.runtime:{const o=re(i);if(!o)return e.notFound();const s=Object.values(ee).includes(n);return h(o,void 0,{...d,...s?{"content-security-policy":te(`${p}${l}`,[p,...t.embedder?[t.embedder]:[]])}:{}})}case w.build:{const o=H(i);if(o===void 0){const s=y(r.live.pieceDir,i);return s?h(s,void 0,d):e.notFound()}try{return e.json(await r.live.source(o),200,{...d,"cache-control":"no-store"})}catch(s){return e.json({error:{message:s instanceof Error?s.message:String(s)}},404,d)}}case w.scenery:{const o=H(i);if(o===void 0){const s=y(r.live.sceneryDir,i);return s?h(s,void 0,d):e.notFound()}if(U(o)!==void 0||!y(a,o))return e.text("No such scenery.",404,d);try{const s=await r.live.scenery(o);for(const O of s.media)j.add(O);return e.json(await r.live.scenerySource(o),200,{...d,"cache-control":"no-store"})}catch(s){return e.text(s instanceof Error?s.message:String(s),500,d)}}case w.media:{const s=Object.hasOwn(r.live.latest()?.media??{},i)||j.has(i)?y(a,i):void 0;return s?h(s,u,d):e.notFound()}case Z:{const o=r.live.latest()?.media[i],s=o?y(a,i):void 0;if(!o||!s)return e.notFound();const O=ae({db:e.req.query("db"),speed:e.req.query("speed"),filter:e.req.query("filter")});if(typeof O=="string")return e.text(O,400,d);try{const x=await L.made(s,o.sha256,O,e.req.query("wait")!=="0");return x===void 0?e.body(null,202,d):await h(x,u,{...d,"content-type":"audio/flac"})}catch(x){return e.text(x instanceof Error?x.message:String(x),500,d)}}case w.matte:{const o=ue(a,r.live.latest()?.media[i]);return o?h(o,u,{...d,"content-type":"video/mp4"}):e.notFound()}case w.bakes:{if(!ce.test(i))return e.notFound();const o=y(P(a,ne),i);return o?h(o,void 0,d):e.notFound()}case w.stills:return de.test(i)?h(X.of(a,"stills").path(i),void 0,{...d,"cache-control":"public, max-age=31536000, immutable"}):e.notFound();default:return e.notFound()}}),R.get("/*",async e=>{if(!t.ui)return e.notFound();const n=y(q(t.ui),decodeURIComponent(e.req.path.slice(1)));return n?h(n,void 0,{"cache-control":"public, max-age=3600"}):e.notFound()});const F=new V({noServer:!0,maxPayload:512*1024*1024});F.on("connection",(e,n)=>{const u=r.connect(p=>{e.readyState===e.OPEN&&e.send(JSON.stringify(p))},{origin:`http://${n.headers.host??""}`});e.on("message",(p,b)=>{if(b||!Buffer.isBuffer(p))return;let i;try{i=JSON.parse(p.toString("utf8"))}catch{e.send(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Not JSON."}}));return}u.receive(i)}),e.on("close",()=>{u.close()})});const D=Y(R.fetch),B=(e,n)=>{e.writeHead(403,{"content-type":"text/plain; charset=utf-8"}),e.end(n)},$=J((e,n)=>{if(k(e),!g().has(e.headers.host??"")){B(n,"forbidden host");return}D(e,n)});$.on("upgrade",(e,n,u)=>{const p=new URL(e.url??"/","http://x"),b=(o,s)=>{n.end(`HTTP/1.1 ${String(o)} ${s}\r
3
3
  connection: close\r
4
4
  content-length: 0\r
5
5
  \r
6
- `)};U(e);const d=e.headers.host??"";if(!k().has(d)){c(403,"Forbidden");return}if(s.pathname!==RPC_PATH){c(404,"Not Found");return}if(e.headers.origin!==N(d)){c(403,"Forbidden");return}if(s.searchParams.get("token")!==u){c(403,"Forbidden");return}O.handleUpgrade(e,t,n,$=>{O.emit("connection",$,e)})});try{await new Promise((e,t)=>{x.once("error",t),x.listen(r.port??0,"127.0.0.1",()=>{e()})})}catch(e){throw await i.close(),e}return h=x.address().port,{url:`http://127.0.0.1:${String(h)}/`,port:h,token:u,project:i,async close(){for(const e of O.clients)e.terminate();O.close(),await new Promise(e=>{x.closeAllConnections(),x.close(()=>{e()})}),await i.close()}}}const ue=r=>{const a=u=>Array.isArray(u)&&u.length===3&&u.every(v=>typeof v=="number");return typeof r=="object"&&r!==null&&a(r.position)&&a(r.target)};
6
+ `)};k(e);const i=e.headers.host??"";if(!g().has(i)){b(403,"Forbidden");return}if(p.pathname!==RPC_PATH){b(404,"Not Found");return}if(e.headers.origin!==N(i)){b(403,"Forbidden");return}if(p.searchParams.get("token")!==f){b(403,"Forbidden");return}F.handleUpgrade(e,n,u,o=>{F.emit("connection",o,e)})});try{await new Promise((e,n)=>{$.once("error",n),$.listen(t.port??0,"127.0.0.1",()=>{e()})})}catch(e){throw await r.close(),e}return c=$.address().port,{url:`http://127.0.0.1:${String(c)}/`,port:c,token:f,tree:`http://127.0.0.1:${String(c)}${l}`,ui:t.ui,project:r,async close(){for(const e of F.clients)e.terminate();F.close(),await new Promise(e=>{$.closeAllConnections(),$.close(()=>{e()})}),await r.close()}}}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{access as E,readFile as b}from"node:fs/promises";import{basename as R,join as h}from"node:path";import{listFiles as y}from"@allyhub-next/build";import{splitTitle as S,parseDoc as O,titleText as j}from"@allyhub-next/doc";import{ITEM_KINDS as k,OUT_DIR as D,scanItems as g,scriptFileFor as I,slidesFileFor as N}from"@allyhub-next/formats";import{OpenedVersion as _,parseCombo as C}from"@allyhub-next/project";import{RPC_ERROR as d,RpcError as f}from"@allyhub-next/protocol";import{readSheetFile as K}from"@allyhub-next/sheet";import{comboKey as v,formatInfo as x,messagePrefix as M}from"@allyhub-next/video-core";import{rpcErrorOf as U}from"./live.js";import{loose as q}from"./paths.js";const F=i=>{const o=i.addresses?.();if(!o)throw new f(d.unavailable,"This server serves no pages: only allyhub dev's does.");return o},$=i=>({mime:"image/webp",data:i.toString("base64")});async function L(i,o,p){try{if(o.kind==="doc"){const m=await b(h(i,o.entry),"utf8");return j(S(O(m).blocks).title)||void 0}if(o.kind==="sheet"){const m=await b(h(i,o.entry),"utf8");return K(m).file?.title}}catch{return}return p.get(o.dir)}const W=512;export function toolHandlers(i){const{live:o}=i,p=new Map,m=async(t,e,s,r)=>{try{return await o.withSession(async a=>{const n=await _.open({root:o.root,item:t,...e===void 0?{}:{combos:[C(e)]},purpose:s,session:a});try{return await r(n)}finally{await n.close()}})}catch(a){throw U(a)}};return{"project/items":async()=>{const t=await y(o.root),e=g(t),r=e.items.some(n=>n.kind==="video"||n.kind==="slides")?await o.prepared().catch(()=>o.latest()):void 0,a=new Map;for(const n of r?.pieces??[]){const c=typeof n.title=="string"?n.title:void 0;c&&a.set(n.dir,c)}return{items:await Promise.all(e.items.map(async n=>{const c=await L(o.root,n,a);return{...n,...c?{title:c}:{}}})),folder:o.root,name:R(o.root),revision:o.revision}},"sheet/generated":async({item:t})=>{const e=await o.sheetCode(t);return{failed:e.failed,...e.generated?{generated:e.generated}:{}}},"video/versions":async({item:t})=>{const{piece:e}=await o.target(t),s=[...new Set(e.combos.map(r=>r.lang))];return{piece:e.id,kind:e.kind,...typeof e.title=="string"?{title:e.title}:{},width:x(e.formatEntry)?.width??0,height:x(e.formatEntry)?.height??0,versions:s.map(r=>r===void 0?{key:v({})}:{key:v({lang:r}),lang:r})}},"slides/deck":async({item:t})=>{const{prepared:e,piece:s}=await o.target(t);if(s.kind!=="slides")throw new Error(`${t} is a video, not a deck.`);return{piece:s.id,file:N(s.dir),prefix:M(s.id),layouts:s.deck?.layouts??[],components:s.deck?.components??{},generators:s.deck?.generators??[],scripts:Object.fromEntries(e.messages.locales.map(r=>[r,I(s.dir,r)]))}},"video/stage":async({item:t,version:e,start:s,play:r,chrome:a,edit:n})=>{const{piece:c,combo:w}=await o.target(t,e),l=new URLSearchParams({piece:c.id,combo:v(w)});for(const[P,T]of Object.entries(s??{}))l.set(P,String(T));r&&l.set("play","1"),a===!1&&l.set("chrome","0"),n===!0&&l.set("edit","1");const u=F(i);return{url:u.stage(l),probe:u.probe}},"video/timeline":async({item:t,version:e})=>m(t,e,"play",s=>Promise.resolve({timeline:q(s.timeline),text:s.version.summary?.text??[]})),"video/still":async({item:t,version:e,t:s})=>m(t,e,"render",async r=>{const a=s??r.timeline.parts[0]?.still??0;return{t:a,image:$(await r.still(a,{format:"webp"})),width:r.timeline.width,height:r.timeline.height,duration:r.timeline.duration}}),"video/stills":async({item:t,version:e,moments:s})=>m(t,e,"render",async r=>{const a=[];for(const n of s){const c=await r.version.sign(n),w=`${t}\0${e??""}\0${c??""}`,l=c===void 0?void 0:p.get(w),u=l??$(await r.still(n,{format:"webp"}));c!==void 0&&!l&&(p.size>=W&&p.clear(),p.set(w,u)),a.push({t:n,image:u})}return{stills:a}}),"check/results":()=>Promise.resolve(i.checker?.state??{status:"off",revision:o.revision,problems:[],facts:[]}),"check/run":()=>{if(!i.checker)throw new f(d.unavailable,"This server runs no check.");return i.checker.schedule(!0),Promise.resolve({})},"export/start":async({item:t,versions:e,types:s,options:r})=>{const a=await y(o.root);if(!g(a).items.some(n=>n.dir===t))throw new f(d.notFound,`There is no item ${t}.`);return{job:i.exports.start(t,e??[],s??[],r)}},"export/cancel":({job:t})=>{if(!i.exports.cancel(t))throw new f(d.notFound,`No export ${t} is under way.`);return Promise.resolve({})},"export/list":()=>Promise.resolve({jobs:i.exports.list(),reveal:i.reveal!==void 0}),"export/reveal":async({path:t})=>{if(!i.reveal)throw new f(d.unavailable,"This server is not on the person's computer: download the file.");if(!t.startsWith(`${D}/`))throw new f(d.notFound,`${t} is no exported file.`);const e=h(o.root,t);return await E(e).catch(()=>{throw new f(d.notFound,`There is no file ${t}.`)}),await i.reveal(e),{}},"scenery/viewer":async({item:t,camera:e})=>{const s=await y(o.root),r=g(s).items.find(c=>c.dir===t&&(c.kind==="scenery"||c.kind==="model"));if(!r)throw new f(d.notFound,`There is no scenery or 3D model ${t}: a scenery is a folder with a ${k.scenery.entries[0]??"scenery.ts"}, a model one with a ${k.model.entries[0]??"model.ts"}.`);const a=new URLSearchParams({file:r.entry});e&&a.set("camera",JSON.stringify(e));const n=F(i);return{url:n.viewer(a),probe:n.probe}}}}
2
+ import{createHash as j}from"node:crypto";import{access as C,readFile as T}from"node:fs/promises";import{basename as I,join as $}from"node:path";import{listFiles as F,sourceOf as A}from"@allyhub-next/build";import{splitTitle as U,parseDoc as H,titleText as q}from"@allyhub-next/doc";import{ITEM_KINDS as R,OUT_DIR as W,scanItems as E,scriptFileFor as z,slidesFileFor as G}from"@allyhub-next/formats";import{KeyedStore as J,OpenedVersion as V,componentKey as B,deckDigests as Q,parseCombo as X}from"@allyhub-next/project";import{runtimeFile as Y,stageFiles as Z}from"@allyhub-next/stage-page";import{RPC_ERROR as f,RpcError as p,SNAPSHOT_TREE as O,TREE_PAGES as P,stillPath as ee}from"@allyhub-next/protocol";import{readSheetFile as te}from"@allyhub-next/sheet";import{themeOfLook as oe}from"@allyhub-next/slides-core";import{CLEAN_LOOK as re,comboKey as S,formatInfo as M,looksOf as ie,messagePrefix as se}from"@allyhub-next/video-core";import{fontFaces as ne}from"./fonts.js";import{rpcErrorOf as D}from"./live.js";import{loose as ae}from"./paths.js";const ce=n=>j("sha256").update(n).digest("base64url").slice(0,16),k=(n,r)=>{const d=n.tree();if(d===void 0)throw new p(f.unavailable,"This server serves no pages: only allyhub dev's does.");return new URL(r,d).href},_=(n,r,d)=>({url:k(n,`${r}?${d.toString()}`),probe:k(n,P.probe)}),K=n=>({mime:"image/webp",data:n.toString("base64")});async function le(n,r,d){try{if(r.kind==="doc"){const h=await T($(n,r.entry),"utf8");return q(U(H(h).blocks).title)||void 0}if(r.kind==="sheet"){const h=await T($(n,r.entry),"utf8");return te(h).file?.title}}catch{return}return d.get(r.dir)}const de=512;export function toolHandlers(n){const{live:r}=n,d=new Map,h=async(e,t,o,i)=>{try{return await r.withSession(async a=>{const s=await V.open({root:r.root,item:e,...t===void 0?{}:{combos:[X(t)]},purpose:o,session:a});try{return await i(s)}finally{await s.close()}})}catch(a){throw D(a)}};return{"project/items":async()=>{const e=await F(r.root),t=E(e),i=t.items.some(s=>s.kind==="video"||s.kind==="slides")?await r.prepared().catch(()=>r.latest()):void 0,a=new Map;for(const s of i?.pieces??[]){const c=typeof s.title=="string"?s.title:void 0;c&&a.set(s.dir,c)}return{items:await Promise.all(t.items.map(async s=>{const c=await le(r.root,s,a);return{...s,...c?{title:c}:{}}})),name:I(r.root),scope:ce(r.root),revision:r.revision}},"sheet/generated":async({item:e})=>{const t=await r.sheetCode(e);return{failed:t.failed,...t.generated?{generated:t.generated}:{}}},"video/versions":async({item:e})=>{const{piece:t}=await r.target(e),o=[...new Set(t.combos.map(i=>i.lang))];return{piece:t.id,kind:t.kind,...typeof t.title=="string"?{title:t.title}:{},width:M(t.formatEntry)?.width??0,height:M(t.formatEntry)?.height??0,versions:o.map(i=>i===void 0?{key:S({})}:{key:S({lang:i}),lang:i})}},"slides/deck":async({item:e})=>{const{prepared:t,piece:o}=await r.target(e);if(o.kind!=="slides"||!o.deck)throw new Error(`${e} is a video, not a deck.`);const i=ie(t.config).looks;return{piece:o.id,file:G(o.dir),prefix:se(o.id),layouts:o.deck.layouts,components:o.deck.components,generators:o.deck.generators,code:o.deck.code,theme:oe(i?.clean??re),scripts:Object.fromEntries(t.messages.locales.map(a=>[a,z(o.dir,a)]))}},"video/stage":async({item:e,version:t,start:o,play:i,chrome:a,mode:s})=>{const{piece:c,combo:m}=await r.target(e,t),l=new URLSearchParams({piece:c.id,combo:S(m)});for(const[y,g]of Object.entries(o??{}))l.set(y,String(g));return i&&l.set("play","1"),a===!1&&l.set("chrome","0"),s!==void 0&&l.set("mode",s),_(n,P.stage,l)},"video/timeline":async({item:e,version:t})=>h(e,t,"play",o=>Promise.resolve({timeline:ae(o.timeline),text:o.version.summary?.text??[]})),"video/still":async({item:e,version:t,t:o})=>h(e,t,"render",async i=>{const a=o??i.timeline.parts[0]?.still??0;return{t:a,image:K(await i.still(a,{format:"webp"})),width:i.timeline.width,height:i.timeline.height,duration:i.timeline.duration}}),"video/stills":async({item:e,version:t,moments:o})=>h(e,t,"render",async i=>{const a=[];for(const s of o){const c=await i.version.sign(s),m=`${e}\0${t??""}\0${c??""}`,l=c===void 0?void 0:d.get(m),y=l??K(await i.still(s,{format:"webp"}));c!==void 0&&!l&&(d.size>=de&&d.clear(),d.set(m,y)),a.push({t:s,image:y})}return{stills:a}}),"slides/fonts":async({item:e})=>{const{prepared:t,piece:o}=await r.target(e);if(o.kind!=="slides")throw new Error(`${e} is a video, not a deck.`);const i=Z().fontCss.flatMap(c=>{const m=Y(c);return m===void 0?[]:[{file:m,url:k(n,`${O.runtime}${c}`)}]}),a=A(t,o).styles??[],s=[...i,...a.map(c=>({file:$(r.pieceDir,c.slice(O.build.length)),url:k(n,c)}))];return{faces:(await Promise.all(s.map(c=>ne(c)))).flat()}},"slides/component-stills":async({item:e,version:t,components:o})=>{k(n,O.stills);try{const{prepared:i,piece:a,combo:s}=await r.target(e,t);if(a.kind!=="slides")throw new p(f.notFound,`${e} is not a deck.`);const c=await Q(i,a),{gpu:m}=await r.browser(),l=J.of(r.root,"stills"),y=o.map(w=>B(w,{digests:c,gpu:m})),g=[];for(const[w,v]of o.entries()){const u=y[w]??"";await l.get(`${u}.webp`)===void 0&&!g.some(x=>x.key===u)&&g.push({at:v,key:u})}return g.length>0&&await r.withSession(async w=>{const v=w.prepared.pieces.find(b=>b.id===a.id);if(v?.kind!=="slides")throw new p(f.notFound,`${e} is not a deck.`);const{stage:u,source:x}=await w.stage(v);try{for(const{at:b,key:L}of g){await u.component(x,{combo:s,purpose:"render"},b);const N=await u.drawing.frame({format:"webp",alpha:!0,clip:{x:0,y:0,width:Math.min(Math.ceil(b.width),u.page.width),height:Math.min(Math.ceil(b.height),u.page.height)}});await l.put(`${L}.webp`,N)}}finally{await u.close()}await l.sweep()}),{stills:y.map(w=>({key:w,url:k(n,ee(w))}))}}catch(i){throw D(i)}},"check/results":()=>Promise.resolve(n.checker?.state??{status:"off",revision:r.revision,problems:[],facts:[]}),"check/run":()=>{if(!n.checker)throw new p(f.unavailable,"This server runs no check.");return n.checker.schedule(!0),Promise.resolve({})},"export/start":async({item:e,versions:t,types:o,options:i})=>{const a=await F(r.root);if(!E(a).items.some(s=>s.dir===e))throw new p(f.notFound,`There is no item ${e}.`);return{job:n.exports.start(e,t??[],o??[],i)}},"export/cancel":({job:e})=>{if(!n.exports.cancel(e))throw new p(f.notFound,`No export ${e} is under way.`);return Promise.resolve({})},"export/list":()=>Promise.resolve({jobs:n.exports.list(),reveal:n.reveal!==void 0}),"export/reveal":async({path:e})=>{if(!n.reveal)throw new p(f.unavailable,"This server is not on the person's computer: download the file.");if(!e.startsWith(`${W}/`))throw new p(f.notFound,`${e} is no exported file.`);const t=$(r.root,e);return await C(t).catch(()=>{throw new p(f.notFound,`There is no file ${e}.`)}),await n.reveal(t),{}},"scenery/viewer":async({item:e,camera:t})=>{const o=await F(r.root),i=E(o).items.find(s=>s.dir===e&&(s.kind==="scenery"||s.kind==="model"));if(!i)throw new p(f.notFound,`There is no scenery or 3D model ${e}: a scenery is a folder with a ${R.scenery.entries[0]??"scenery.ts"}, a model one with a ${R.model.entries[0]??"model.ts"}.`);const a=new URLSearchParams({file:i.entry});return t&&a.set("camera",JSON.stringify(t)),_(n,P.viewer,a)}}}
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{join as n}from"node:path";import{indexPath as o}from"@allyhub-next/video-core";export const BAKE_NAME=/^[0-9a-f]+\.[a-z0-9-]+\.bin$/u,STILL_NAME=/^[0-9a-f]{64}\.webp$/u;export function sourceName(t){const e=/^sources\/([^/]+)\.json$/u.exec(t);if(e?.[1])try{return decodeURIComponent(e[1])}catch{return}}export function matteFile(t,e){return e?.matte===!0?n(t,o(e.sha256,"matte.mp4")):void 0}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/dev-server",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/doc",
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{execFile as B}from"node:child_process";import{mkdir as K,mkdtemp as T,readFile as _,rm as U,writeFile as b}from"node:fs/promises";import{tmpdir as V}from"node:os";import{dirname as $,join as p}from"node:path";import{promisify as q}from"node:util";import{cropImage as C,ffmpegOf as G,finalStill as N,readPng as I,writePng as L}from"@allyhub-next/render";import{clockOf as H,DECK_FPS as J,SLIDE_SECONDS as Q}from"@allyhub-next/slides-core";import{filesOf as R,picturedShapes as W,writePptx as X}from"@allyhub-next/slides-pptx";import{deckFonts as Y}from"./deck-fonts.js";const Z=q(B),ee=Q,y=J/2;async function te(t){const o=await T(p(V(),"allyhub-deck-movie-"));try{await Promise.all(t.map((s,m)=>b(p(o,`${String(m).padStart(5,"0")}.png`),s)));const c=p(o,"movie.mp4");return await Z(await G(),["-y","-loglevel","error","-framerate",String(y),"-i",p(o,"%05d.png"),"-vf","pad=ceil(iw/2)*2:ceil(ih/2)*2","-c:v","libx264","-crf","18","-pix_fmt","yuv420p","-movflags","+faststart",c]),new Uint8Array(await _(c))}finally{await U(o,{recursive:!0,force:!0})}}async function ie(t){return await t.graphics().deck?.()}export async function renderDeckPptx(t,o,c={}){const s=await ie(t);if(!s)return;const m=c.only===void 0?void 0:s.slides[c.only];if(c.only!==void 0&&!m)return;const f=m?{...s,slides:[{...m,hidden:!1}]}:s,d=t.graphics(),a=d.timeline.width/f.width,w=new Map,k=W(f);for(const e of new Set(k.map(r=>r.slide))){const r=d.timeline.parts.find(n=>n.key===e);if(!r)continue;const u=I(await N(d,r.still,{target:t.target,look:t.look,media:t.media}));for(const n of k.filter(l=>l.slide===e)){const l=C(u,[n.frame.left*a,n.frame.top*a,n.frame.width*a,n.frame.height*a]);l&&w.set(n.key,L(l))}}const S=new Map;for(const e of k){const r=f.slides.find(i=>i.id===e.slide),u=r?.shapes.find(i=>i.name===e.shape),n=d.timeline.parts.find(i=>i.key===e.slide);if(!r||!n||!u?.component)continue;const l=[e.frame.left*a,e.frame.top*a,e.frame.width*a,e.frame.height*a],z=H(r,s.slides[0]?.id===r.id),M=n.start+z.comesOn(u.name),E=async i=>{const h=I(await N(d,i,{target:t.target,look:t.look,media:t.media})),D=C(h,l);return D?L(D):void 0},g=await E(M),F=w.get(e.key);if(!g||!F||Buffer.compare(g,F)===0)continue;const O=[g],A=Math.ceil(ee*y);for(let i=1;i<A;i++){const h=await E(M+i/y);h&&O.push(h)}S.set(e.key,{bytes:await te(O),seconds:O.length/y}),w.set(e.key,g)}const P=new Map;for(const e of R(f))try{P.set(e,await _(p(t.prepared.root,e)))}catch{}const x=d.timeline.parts[0]?.title,{fonts:j,left:v}=await Y(f,t.prepared.root,t.prepared.config);return await K($(o),{recursive:!0}),await b(o,X({deck:f,file:e=>P.get(e),pictures:w,...S.size>0?{movies:S}:{},fonts:j,...x===void 0?{}:{title:x}})),{files:[o],fontsLeft:v}}
2
+ import{execFile as U}from"node:child_process";import{mkdir as V,mkdtemp as q,readFile as D,rm as G,writeFile as C}from"node:fs/promises";import{tmpdir as H}from"node:os";import{dirname as J,join as p}from"node:path";import{promisify as Q}from"node:util";import{cropImage as v,ffmpegOf as R,ffprobeOf as W,finalStill as I,readPng as z,writePng as L}from"@allyhub-next/render";import{clockOf as X,DECK_FPS as Y,SLIDE_SECONDS as Z}from"@allyhub-next/slides-core";import{filesOf as ee,picturedShapes as te,writePptx as ie}from"@allyhub-next/slides-pptx";import{deckFonts as oe}from"./deck-fonts.js";const $=Q(U),ne=Z,y=Y/2;async function re(t){const a=await q(p(H(),"allyhub-deck-movie-"));try{await Promise.all(t.map((c,u)=>C(p(a,`${String(u).padStart(5,"0")}.png`),c)));const d=p(a,"movie.mp4");return await $(await R(),["-y","-loglevel","error","-framerate",String(y),"-i",p(a,"%05d.png"),"-vf","pad=ceil(iw/2)*2:ceil(ih/2)*2","-c:v","libx264","-crf","18","-pix_fmt","yuv420p","-movflags","+faststart",d]),new Uint8Array(await D(d))}finally{await G(a,{recursive:!0,force:!0})}}async function ae(t){return await t.graphics().deck?.()}export async function renderDeckPptx(t,a,d={}){const c=await ae(t);if(!c)return;const u=d.only===void 0?void 0:c.slides[d.only];if(d.only!==void 0&&!u)return;const f=u?{...c,slides:[{...u,hidden:!1}]}:c,l=t.graphics(),s=l.timeline.width/f.width,w=new Map,k=te(f);for(const e of new Set(k.map(i=>i.slide))){const i=l.timeline.parts.find(r=>r.key===e);if(!i)continue;const n=z(await I(l,i.still,{target:t.target,look:t.look,media:t.media}));for(const r of k.filter(m=>m.slide===e)){const m=v(n,[r.frame.left*s,r.frame.top*s,r.frame.width*s,r.frame.height*s]);m&&w.set(r.key,L(m))}}const S=new Map;for(const e of k){const i=f.slides.find(o=>o.id===e.slide),n=i?.shapes.find(o=>o.name===e.shape),r=l.timeline.parts.find(o=>o.key===e.slide);if(!i||!r||!n?.component)continue;const m=[e.frame.left*s,e.frame.top*s,e.frame.width*s,e.frame.height*s],K=X(i,c.slides[0]?.id===i.id),F=r.start+K.comesOn(n.name),E=async o=>{const g=z(await I(l,o,{target:t.target,look:t.look,media:t.media})),x=v(g,m);return x?L(x):void 0},h=await E(F),_=w.get(e.key);if(!h||!_||Buffer.compare(h,_)===0)continue;const b=[h],T=Math.ceil(ne*y);for(let o=1;o<T;o++){const g=await E(F+o/y);g&&b.push(g)}S.set(e.key,{bytes:await re(b),seconds:b.length/y}),w.set(e.key,h)}const M=new Map;for(const e of ee(f))try{M.set(e,await D(p(t.prepared.root,e)))}catch{}const O=new Map,P=[],j=await W();for(const e of new Set(f.slides.flatMap(i=>i.shapes.flatMap(n=>n.kind==="movie"&&n.media?[n.media.path]:[])))){const i=await $(j,["-v","error","-show_entries","format=duration","-of","csv=p=0",p(t.prepared.root,e)]).then(n=>Number(n.stdout.trim()),()=>Number.NaN);Number.isFinite(i)&&i>0?O.set(e,i):P.push(`${e}: its length could not be measured, so it plays on a click in PowerPoint`)}const N=l.timeline.parts[0]?.title,{fonts:A,left:B}=await oe(f,t.prepared.root,t.prepared.config);return await V(J(a),{recursive:!0}),await C(a,ie({deck:f,file:e=>M.get(e),pictures:w,...S.size>0?{movies:S}:{},...O.size>0?{lengths:O}:{},fonts:A,...N===void 0?{}:{title:N}})),{files:[a],fontsLeft:B,missing:P}}
@@ -1,7 +1,7 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{renderDeckPptx as xe}from"./deck-pptx.js";import{readFileSync as be}from"node:fs";import{mkdir as D,readFile as $e,stat as ne,writeFile as R}from"node:fs/promises";import{cpus as ke}from"node:os";import{basename as G,dirname as se,isAbsolute as ye,join as w,posix as oe,relative as ie,sep as Pe}from"node:path";import{parseDoc as Se,markdownOf as je}from"@allyhub-next/doc";import{createPackages as Oe}from"@allyhub-next/runtimes";import{codeOf as Ce,fontsDigest as Ee,readSheetSource as Me,workbookFiles as Ne}from"@allyhub-next/build";import{RenderError as ve,VIDEO_TYPES as Fe,renderCaptions as Te,renderCover as Ae,renderPdf as Ie,renderPng as Le,renderPptx as _e,renderVideo as De,mixSound as Re,requireEncoder as We,requireFfmpeg as Ve}from"@allyhub-next/render";import{docFontsCss as Ye,printPage as ze,renderDoc as Ge,renderWord as He}from"@allyhub-next/render/doc";import{checkWorkbook as Ue,csvOf as qe,jsonOf as Je,markdownOf as re,seededRandom as Be,sheetHtml as Ke}from"@allyhub-next/sheet";import{writeXlsx as Xe}from"@allyhub-next/sheet/xlsx";import{CACHE_DIR as Qe}from"@allyhub-next/formats";import{buildModule as Ze}from"@allyhub-next/model/build";import{graphicsPage as et,stageIdentity as tt}from"@allyhub-next/stage";import{DEFAULT_TYPES as nt,FILE_TYPES as ae,comboKey as H,exportProblem as st,pieceIs as U,pieceNamed as ce}from"@allyhub-next/video-core";import{runCheck as ot}from"@allyhub-next/check";import{batchCsv as it,batchRows as rt}from"./batch.js";import{batchName as at,checkName as ct,exportName as le,exportNames as lt}from"./names.js";import{ConsolePool as dt,mergeConsole as ft,dedupe as de,indexNeeds as pt,makeIndex as mt,CheckSession as ut,OpenedVersion as ht,ProjectError as I,versionLabel as fe}from"@allyhub-next/project";const pe=e=>Fe.includes(e);async function gt(e){const o=Oe(),c=()=>e?.("Getting docx, once, to write Word documents…"),[t,p]=await Promise.all([o.load("docx",{onFetch:c}),o.load("docx",{module:"fflate",onFetch:c})]);return{docx:t,zip:p}}export async function exportVersion(e,o,c,t={}){await D(se(c),{recursive:!0});const p={page:e.graphics(),target:e.target,look:e.look,media:e.media,out:c,...t.steps===!0?{steps:!0}:{},...t.pptx&&t.pptx!=="native"?{pptx:t.pptx}:{}};if(o==="pptx"&&e.piece.kind==="slides"&&(t.pptx??"native")==="native"){const d=await xe(e,c);if(d)return t.onProgress?.(1),d}if(o==="wav"){const d=await Re({timeline:e.timeline,sound:await e.sound(),out:c});return t.onProgress?.(1),{files:[c],duration:Math.round(e.timeline.duration*e.timeline.fps)/e.timeline.fps,...d.loudness?{loudness:d.loudness}:{},master:{...d}}}if(pe(o)&&(o!=="png"||e.piece.kind==="video")){const d=e.prepared,i=await Ee(d.root,d.files,d.fonts),a=await De({target:e.target,look:e.look,media:e.media,pages:[e.graphics()],openPage:async()=>{const m=await e.session.open(e.piece,e.target,"render");return et(m.stage,{gpu:e.session.gpu})},...o==="gif"?{}:{sound:await e.sound()},out:c,type:o,...t.encode?{encode:t.encode}:{},...t.workers===void 0?{}:{workers:t.workers},...t.onProgress?{onProgress:t.onProgress}:{},code:await Ce(d,e.piece,tt(i)),...t.partCache===!1?{partCache:!1}:{},...t.signal?{signal:t.signal}:{}});return{files:a.files??[a.out],duration:a.duration,parts:a.parts,...a.junctions?{junctions:a.junctions}:{},...a.loudness?{loudness:a.loudness}:{},...a.master?{master:{...a.master}}:{},timings:a.timings}}const u=o==="srt"||o==="vtt"?await Te({...p,type:o,...t.captions?{captions:t.captions}:{}}):o==="pdf"?await Ie(p):o==="pptx"?await _e(p):o==="png"?await Le(p):await Ae(p);return t.onProgress?.(1),{files:u.files??[u.out]}}export const exportsAtOnce=e=>Math.max(1,Math.min(e,Math.floor(ke().length/4))),DOC_TYPES=["pdf","docx","png","md"],SHEET_TYPES=["xlsx","pdf","png","csv","md","json"],MODEL_TYPES=["glb"];const q=(e,o)=>`${String(e)} ${o}${e===1?"":"s"}`,J=(e,o)=>U({id:e,path:e},o)||U({id:e,path:e},`content/${o}`);function wt(e){if(e===void 0)return;const o=new Set([...Object.keys(ae),...DOC_TYPES,...SHEET_TYPES,...MODEL_TYPES]);for(const c of e)if(!o.has(c))throw new I("bad-type",`Cannot render ${c}.`,"usage",`Types: ${[...o].join(", ")}.`);return[...e]}export async function exportProject(e){const o=wt(e.types);e.name!==void 0&&ct(e.name);const c=e.items??[],t=c.length>0,p=f=>c.some(P=>J(f,P)),u=[],d=[],i=[],a=()=>ut.open({root:e.root,...e.gpu===void 0?{}:{gpu:e.gpu},...e.consoleLimit===void 0?{}:{consoleLimit:e.consoleLimit}});let m=await a();try{const f=m.prepared,P=f.docs.filter(n=>!t||p(n.place)),b=f.sheets.filter(n=>!t||p(n.place)),L=f.items.filter(n=>n.kind==="model"&&(!t||p(n.dir))),x=c.filter(n=>!f.items.some(s=>s.kind==="model"&&U({id:s.dir,path:s.dir},n))&&!f.docs.some(s=>J(s.place,n))&&!f.sheets.some(s=>J(s.place,n)));for(const n of x)if(!f.pieces.some(s=>ce({id:s.id,path:s.place},n)))throw new I("no-item",`No item ${n}.`,"not-found",`Items: ${[...f.pieces.map(s=>s.id),...f.docs.map(s=>s.place),...f.sheets.map(s=>s.place),...f.items.filter(s=>s.kind==="model").map(s=>s.dir)].join(", ")||"none"}.`);const T=t&&x.length===0,_=o?.filter(n=>n in ae),$=T?[]:f.pieces.filter(n=>x.length===0||x.some(s=>ce({id:n.id,path:n.place},s))),S=o?.includes("csv")===!0?$.filter(n=>n.matrix!==void 0):[];if(o?.includes("csv")===!0&&x.length>0&&S.length===0)throw new I("bad-type",`${x.join(", ")} has no slots (matrix.slots), so there is no table of ads to write as csv.`,"usage","csv is a batch's table of ads, or a sheet's rows.");let g=[...f.problems];const N=new dt(m.consoleLimit),W=new Set([...f.docs.map(n=>n.file),...f.sheets.flatMap(n=>n.files)]),ue=n=>n.where?.file!==void 0&&W.has(n.where.file),B=n=>n.filter(s=>s.level==="error"&&!ue(s)).length;if(!T&&(_?.length!==0||S.length>0)&&(f.pieces.length>0||B(f.problems)>0)){e.log?.("Checking…");const n=()=>bt(m,e.root,x,e.combos);let s=await n();const A=e.index===!1?[]:pt(s.results);if(A.length>0){const r=await mt(f.root,A,$t(e.log),e.signal);i.push(...r.failed.map(l=>({file:l.need.file,error:l.error}))),r.done.length>0&&(await m.close(),m=await a(),s=await n())}g=s.problems,N.addReport(s.console);const F=B(s.problems);if(F>0)throw new I("check-failed",`The check found ${q(F,"must-fix problem")}, so nothing is rendered.`,"failed","allyhub check lists them; fix them, then render.");for(const r of S){const l=performance.now(),j=at(r.id),C=rt(r,s.plans,m.prepared.media,xt(e.root,e.out),e.name);await D(se(w(e.out,j)),{recursive:!0}),await R(w(e.out,j),it(C));const E=s.targets.filter(k=>k.piece===r.id).length;C.length<E&&e.log?.(`${j}: ${q(E-C.length,"ad")} not listed, which did not load (allyhub check says why).`),u.push(await M(e.out,j,r.id,"csv",l))}const O=[],V=new Set;for(const r of s.targets){const l=m.prepared.pieces.find(h=>h.id===r.piece);if(!l)continue;if(!t&&l.options.deliverable===!1){V.add(r.piece);continue}const j=l.kind,C=s.results.find(h=>h.piece===r.piece&&H(h.combo)===r.key&&h.format===r.format),E=s.plans.find(h=>h.piece===r.piece&&H(h.combo)===r.key&&h.format===r.format),k=C?.timeline?(C.timeline.audio.speech?.length??0)>0:E?.parts.some(h=>h.speech!==void 0)??!1,v={piece:r.piece,output:r.output,combo:r.combo,format:r.format,...r.id===void 0?{}:{id:r.id}};for(const h of _??nt[j]){const y=st({kind:j,speech:k},h);if(!(y?.code==="bad_type"&&!t)){if(y&&y.code!=="no_speech")throw new I("bad-type",`${fe(v)}: ${y.message}`,"usage",y.hint);O.push({target:v,type:h,...y?{refused:{name:le(v,h,e),piece:v.piece,type:h,code:"no-speech",message:`${fe(v)}: ${y.message}`,...y.hint?{hint:y.hint}:{}}}:{}})}}}if(V.size>0&&e.log?.(`Not rendered, shown only inside another video (deliverable: false): ${[...V].join(", ")}. Name one to render it.`),O.some(r=>pe(r.type)||r.type==="wav")){await Ve();for(const r of new Set(O.map(l=>l.type)))await We(r,e.encode?.codec)}const Q=lt(O,e.name,e);O.forEach((r,l)=>{r.refused&&(r.refused.name=Q[l]??r.refused.name)});const Z=[],Y=new Array(O.length).fill(0),z=(r,l)=>{Y[r]=Math.max(Y[r]??0,l),e.onProgress?.(Y.reduce((j,C)=>j+C,0)/O.length)};let ee=0,he=0;const ge=async()=>{for(let r=ee++;r<O.length;r=ee++){e.signal?.throwIfAborted();const l=O[r];if(!l)continue;const j=Q[r]??le(l.target,l.type,e);if(l.refused){d.push(l.refused),z(r,1);continue}const C=performance.now(),E=await ht.open({root:e.root,session:m,item:l.target.piece,combos:[l.target.combo],purpose:"render"});try{const k=await exportVersion(E,l.type,w(e.out,j),{...e,onProgress:y=>{z(r,y)}}),v=(await Promise.all(k.files.map(y=>ne(y)))).reduce((y,we)=>y+we.size,0),h=Math.round((performance.now()-C)/10)/100;u.push({...k,name:me(ie(e.out,k.files[0]??"")),path:k.files[0]??w(e.out,j),piece:l.target.piece,type:l.type,combo:l.target.combo,key:H(l.target.combo),format:l.target.format,bytes:v,seconds:h}),e.log?.(`[${String(++he)}/${String(O.length)}] ${j} (${h.toFixed(1)} s)`)}catch(k){if(e.signal?.aborted||!(k instanceof ve))throw k;d.push({name:j,piece:l.target.piece,type:l.type,code:k.code,message:k.message,...k.hint?{hint:k.hint}:{}})}finally{Z.push(...await E.problems()),N.add(l.target,await E.console()),await E.close(),z(r,1)}}};O.length>0&&e.log?.(`Rendering ${q(O.length,"file")}…`);const te=(await Promise.allSettled(Array.from({length:exportsAtOnce(O.length)},ge))).find(r=>r.status==="rejected");if(te)throw te.reason;g=de([...g,...Z])}const K=n=>f.problems.find(s=>s.level==="error"&&s.where?.file!==void 0&&n.includes(s.where.file));for(const n of[...P,...b]){const s=K("files"in n?n.files:[n.file]);s&&d.push({name:n.place,piece:n.place,type:"files"in n?"xlsx":"pdf",code:"check-failed",message:`${s.where?.file??n.place}: ${s.message}`,hint:"Fix it, then render again."})}e.signal?.throwIfAborted();const X=n=>n.filter(s=>K("files"in s?s.files:[s.file])===void 0);if(u.push(...await kt(e.root,X(P),o,e.out,e.log),...await yt(e.root,X(b),o,e.out,e.log)),o===void 0||o.includes("glb"))for(const n of L){e.log?.(`Building ${n.entry}…`);const s=performance.now(),A=`${n.dir}/${G(n.dir)}.glb`;try{await Ze(w(e.root,n.entry),{root:e.root,out:w(e.out,A),cache:w(e.root,Qe,"model"),log:()=>{}}),u.push(await M(e.out,A,n.dir,"glb",s))}catch(F){d.push({name:n.dir,piece:n.dir,type:"glb",code:"model-failed",message:`${n.entry}: ${F instanceof Error?F.message:String(F)}`,hint:"Fix it, then render again."})}}return{out:e.out,files:u,failed:d,problems:g,console:N.report(),unindexed:i}}finally{await m.close()}}const me=e=>e.split(Pe).join("/");function xt(e,o){const c=ie(e,o);return c===""?".":c.startsWith("..")||ye(c)?o:me(c)}async function bt(e,o,c,t){const p=[];for(const a of c.length>0?c:[void 0])p.push(await ot({dir:o,session:e,facts:!1,...a===void 0?{}:{piece:a},...t?{combos:[...t]}:{}}));const u=new Set,d=p.flatMap(a=>a.targets).filter(a=>{const m=`${a.piece}\0${a.key}\0${a.format}`;return u.has(m)?!1:(u.add(m),!0)}),i=de(p.flatMap(a=>a.problems));return{targets:d,results:p.flatMap(a=>a.results),plans:p.flatMap(a=>a.plans),problems:i,errors:i.filter(a=>a.level==="error").length,console:ft(e.consoleLimit,...p.map(a=>a.console))}}function $t(e){let o="";return c=>{const t=c.status==="failed"?`Could not index ${c.file}: ${c.message}`:c.message;c.status==="running"&&c.share!==void 0||t!==o&&(o=t,e?.(t))}}async function M(e,o,c,t,p){const u=w(e,o);return{files:[u],name:o,path:u,piece:c,type:t,bytes:(await ne(u)).size,seconds:Math.round((performance.now()-p)/10)/100}}async function kt(e,o,c,t,p){const u=(c??["pdf"]).filter(i=>DOC_TYPES.includes(i)),d=[];for(const i of o){if(u.length===0)break;p?.(`Rendering ${i.file}…`);const a=performance.now(),m=G(i.place);if(u.includes("md")){const b=await $e(w(e,i.file),"utf8");await D(w(t,i.place),{recursive:!0}),await R(w(t,i.place,`${m}.md`),je(Se(b).blocks)),d.push(await M(t,`${i.place}/${m}.md`,i.place,"md",a))}if(u.includes("docx")){const b=`${i.place}/${m}.docx`;await He({root:e,doc:{file:i.file,dir:i.dir,path:i.place,title:i.title},out:w(t,b),...await gt(p)}),d.push(await M(t,b,i.place,"docx",a))}const f=u.filter(b=>b==="pdf"||b==="png");if(f.length===0)continue;const P=await Ge({root:e,doc:{file:i.file,dir:i.dir,path:i.place,title:i.title},out:w(t,i.place),name:m,types:f});for(const b of P)d.push(await M(t,`${i.place}/${b}`,i.place,b.endsWith(".png")?"png":"pdf",a))}return d}export const PNG_ROWS=700,PNG_COLUMNS=200;async function yt(e,o,c,t,p){const u=(c??["xlsx"]).filter(i=>SHEET_TYPES.includes(i)),d=[];for(const i of o){if(u.length===0)break;p?.(`Writing ${i.file}…`);const a=performance.now(),m=await Me(e,i.dir);if(m.failed){p?.(`${i.file}: its sheet.ts does not run. allyhub check says why.`);continue}const{workbook:f,calc:P}=Ue(Ne(e,m),{random:Be([m.text,...m.csv.values(),m.generated?JSON.stringify(m.generated):""].join(`
3
- `))});if(!f||!P)continue;const b=$=>{const S=oe.normalize(oe.join(i.dir,$));try{return S.startsWith("..")?void 0:new Uint8Array(be(w(e,S)))}catch{return}};await D(w(t,i.place),{recursive:!0});const L=G(i.place),x=`${i.place}/${L}`,T=f.sheets.length>1,_=async $=>{const S=Ke(P,{css:await Ye(),font:"Commissioner Variable",file:b,...$==="png"?{rows:PNG_ROWS,columns:PNG_COLUMNS,headings:!1}:{}});for(const g of S.cut)p?.(`${x}.png: ${g}`);await ze({html:S.html,out:w(t,i.place),name:L,types:[$]}),d.push(await M(t,`${x}.${$}`,i.place,$,a))};for(const $ of u){if($==="pdf"||$==="png"){await _($);continue}if($==="xlsx"){const{bytes:g,left:N}=Xe(P,{file:b});await R(w(t,`${x}.xlsx`),g);for(const W of N)p?.(`${x}.xlsx does not hold ${W}.`);d.push(await M(t,`${x}.xlsx`,i.place,"xlsx",a));continue}const S=[];if($==="csv")for(const g of f.sheets)S.push([T?`${x}-${g.name.replace(/\W+/gu,"-")}.csv`:`${x}.csv`,qe(P,g)]);else $==="md"?S.push([`${x}.md`,f.sheets.map(g=>T?`## ${g.name}
2
+ import{renderDeckPptx as ye}from"./deck-pptx.js";import{readFileSync as $e}from"node:fs";import{mkdir as L,readFile as ke,stat as se,writeFile as W}from"node:fs/promises";import{cpus as Pe}from"node:os";import{basename as G,dirname as oe,isAbsolute as Se,join as x,posix as ie,relative as re,sep as Ee}from"node:path";import{parseDoc as je,markdownOf as Oe}from"@allyhub-next/doc";import{createPackages as Ce}from"@allyhub-next/runtimes";import{codeOf as Ne,fontsDigest as Me,readSheetSource as Te,workbookFiles as _e}from"@allyhub-next/build";import{RenderError as Fe,VIDEO_TYPES as Ae,renderCaptions as De,renderCover as Re,renderPdf as Ie,renderPng as Le,renderPptx as We,renderVideo as ze,mixSound as Ye,requireEncoder as ve,requireFfmpeg as He}from"@allyhub-next/render";import{printPage as Ve,printPdf as Ge,renderDoc as Ue,renderWord as qe,SHEET_FONT as ae,sheetFontsCss as ce}from"@allyhub-next/render/doc";import{checkWorkbook as Je,csvOf as Be,jsonOf as Ke,markdownOf as le,seededRandom as Xe,sheetHtml as Qe,SheetPrint as Ze}from"@allyhub-next/sheet";import{writeXlsx as et}from"@allyhub-next/sheet/xlsx";import{CACHE_DIR as tt}from"@allyhub-next/formats";import{buildModule as nt}from"@allyhub-next/model/build";import{graphicsPage as st,stageIdentity as ot}from"@allyhub-next/stage";import{DEFAULT_TYPES as it,FILE_TYPES as de,comboKey as U,exportProblem as rt,pieceIs as q,pieceNamed as fe}from"@allyhub-next/video-core";import{runCheck as at}from"@allyhub-next/check";import{batchCsv as ct,batchRows as lt}from"./batch.js";import{batchName as dt,checkName as ft,exportName as pe,exportNames as pt}from"./names.js";import{ConsolePool as mt,mergeConsole as ut,dedupe as me,indexNeeds as ht,makeIndex as gt,CheckSession as wt,DeckPool as bt,OpenedVersion as xt,ProjectError as I,versionLabel as ue}from"@allyhub-next/project";const he=e=>Ae.includes(e);async function yt(e){const t=Ce(),i=()=>e?.("Getting docx, once, to write Word documents…"),[n,f]=await Promise.all([t.load("docx",{onFetch:i}),t.load("docx",{module:"fflate",onFetch:i})]);return{docx:n,zip:f}}export async function exportVersion(e,t,i,n={}){await L(oe(i),{recursive:!0});const f=e.piece.kind==="slides"&&(t==="png"||t==="pptx")?await bt.on(e.session,e.piece,e.target,e.version.stage):void 0,p=e.piece.title,g=typeof p=="string"?p:p===void 0?void 0:p[e.target.combo.lang??""]??Object.values(p)[0],c={page:e.graphics(),target:e.target,look:e.look,media:e.media,out:i,...n.steps===!0?{steps:!0}:{},...f?{stills:l=>f.stills(l.map(d=>({slide:d.part.key,step:d.step,width:f.timeline.width,format:"png"})))}:{},...g===void 0?{}:{title:g}};if(t==="pptx"&&e.piece.kind==="slides"&&(n.pptx??"native")==="native"){const l=await ye(e,i);if(l)return n.onProgress?.(1),l}if(t==="wav"){const l=await Ye({timeline:e.timeline,sound:await e.sound(),out:i});return n.onProgress?.(1),{files:[i],duration:Math.round(e.timeline.duration*e.timeline.fps)/e.timeline.fps,...l.loudness?{loudness:l.loudness}:{},master:{...l}}}if(he(t)&&(t!=="png"||e.piece.kind==="video")){const l=e.prepared,d=await Me(l.root,l.files,l.fonts),u=await ze({target:e.target,look:e.look,media:e.media,pages:[e.graphics()],openPage:async()=>{const h=await e.session.open(e.piece,e.target,"render");return st(h.stage,{gpu:e.session.gpu})},...t==="gif"?{}:{sound:await e.sound()},out:i,type:t,...n.encode?{encode:n.encode}:{},...n.workers===void 0?{}:{workers:n.workers},...n.onProgress?{onProgress:n.onProgress}:{},code:await Ne(l,e.piece,ot(d)),...n.partCache===!1?{partCache:!1}:{},...n.signal?{signal:n.signal}:{}});return{files:u.files??[u.out],duration:u.duration,parts:u.parts,...u.junctions?{junctions:u.junctions}:{},...u.loudness?{loudness:u.loudness}:{},...u.master?{master:{...u.master}}:{},timings:u.timings}}const r=t==="srt"||t==="vtt"?await De({...c,type:t,...n.captions?{captions:n.captions}:{}}):t==="pdf"?await Ie(c):t==="pptx"?await We(c):t==="png"?await Le(c):await Re(c);return n.onProgress?.(1),{files:r.files??[r.out]}}export const exportsAtOnce=e=>Math.max(1,Math.min(e,Math.floor(Pe().length/4))),DOC_TYPES=["pdf","docx","png","md"],SHEET_TYPES=["xlsx","pdf","png","csv","md","json"],MODEL_TYPES=["glb"];const J=(e,t)=>`${String(e)} ${t}${e===1?"":"s"}`,B=(e,t)=>q({id:e,path:e},t)||q({id:e,path:e},`content/${t}`);function $t(e){if(e===void 0)return;const t=new Set([...Object.keys(de),...DOC_TYPES,...SHEET_TYPES,...MODEL_TYPES]);for(const i of e)if(!t.has(i))throw new I("bad-type",`Cannot render ${i}.`,"usage",`Types: ${[...t].join(", ")}.`);return[...e]}export async function exportProject(e){const t=$t(e.types);e.name!==void 0&&ft(e.name);const i=e.items??[],n=i.length>0,f=d=>i.some(u=>B(d,u)),p=[],g=[],c=[],r=()=>wt.open({root:e.root,...e.gpu===void 0?{}:{gpu:e.gpu},...e.consoleLimit===void 0?{}:{consoleLimit:e.consoleLimit}});let l=await r();try{const d=l.prepared,u=d.docs.filter(s=>!n||f(s.place)),h=d.sheets.filter(s=>!n||f(s.place)),A=d.items.filter(s=>s.kind==="model"&&(!n||f(s.dir))),E=i.filter(s=>!d.items.some(o=>o.kind==="model"&&q({id:o.dir,path:o.dir},s))&&!d.docs.some(o=>B(o.place,s))&&!d.sheets.some(o=>B(o.place,s)));for(const s of E)if(!d.pieces.some(o=>fe({id:o.id,path:o.place},s)))throw new I("no-item",`No item ${s}.`,"not-found",`Items: ${[...d.pieces.map(o=>o.id),...d.docs.map(o=>o.place),...d.sheets.map(o=>o.place),...d.items.filter(o=>o.kind==="model").map(o=>o.dir)].join(", ")||"none"}.`);const k=n&&E.length===0,D=t?.filter(s=>s in de),z=k?[]:d.pieces.filter(s=>E.length===0||E.some(o=>fe({id:s.id,path:s.place},o))),j=t?.includes("csv")===!0?z.filter(s=>s.matrix!==void 0):[];if(t?.includes("csv")===!0&&E.length>0&&j.length===0)throw new I("bad-type",`${E.join(", ")} has no slots (matrix.slots), so there is no table of ads to write as csv.`,"usage","csv is a batch's table of ads, or a sheet's rows.");let O=[...d.problems];const w=new mt(l.consoleLimit),T=new Set([...d.docs.map(s=>s.file),...d.sheets.flatMap(s=>s.files)]),Y=s=>s.where?.file!==void 0&&T.has(s.where.file),K=s=>s.filter(o=>o.level==="error"&&!Y(o)).length;if(!k&&(D?.length!==0||j.length>0)&&(d.pieces.length>0||K(d.problems)>0)){e.log?.("Checking…");const s=()=>Pt(l,e.root,E,e.combos);let o=await s();const R=e.index===!1?[]:ht(o.results);if(R.length>0){const a=await gt(d.root,R,St(e.log),e.signal);c.push(...a.failed.map(m=>({file:m.need.file,error:m.error}))),a.done.length>0&&(await l.close(),l=await r(),o=await s())}O=o.problems,w.addReport(o.console);const F=K(o.problems);if(F>0)throw new I("check-failed",`The check found ${J(F,"must-fix problem")}, so nothing is rendered.`,"failed","allyhub check lists them; fix them, then render.");for(const a of j){const m=performance.now(),P=dt(a.id),C=lt(a,o.plans,l.prepared.media,kt(e.root,e.out),e.name);await L(oe(x(e.out,P)),{recursive:!0}),await W(x(e.out,P),ct(C));const N=o.targets.filter(y=>y.piece===a.id).length;C.length<N&&e.log?.(`${P}: ${J(N-C.length,"ad")} not listed, which did not load (allyhub check says why).`),p.push(await M(e.out,P,a.id,"csv",m))}const S=[],v=new Set;for(const a of o.targets){const m=l.prepared.pieces.find(b=>b.id===a.piece);if(!m)continue;if(!n&&m.options.deliverable===!1){v.add(a.piece);continue}const P=m.kind,C=o.results.find(b=>b.piece===a.piece&&U(b.combo)===a.key&&b.format===a.format),N=o.plans.find(b=>b.piece===a.piece&&U(b.combo)===a.key&&b.format===a.format),y=C?.timeline?(C.timeline.audio.speech?.length??0)>0:N?.parts.some(b=>b.speech!==void 0)??!1,_={piece:a.piece,output:a.output,combo:a.combo,format:a.format,...a.id===void 0?{}:{id:a.id}};for(const b of D??it[P]){const $=rt({kind:P,speech:y},b);if(!($?.code==="bad_type"&&!n)){if($&&$.code!=="no_speech")throw new I("bad-type",`${ue(_)}: ${$.message}`,"usage",$.hint);S.push({target:_,type:b,...$?{refused:{name:pe(_,b,e),piece:_.piece,type:b,code:"no-speech",message:`${ue(_)}: ${$.message}`,...$.hint?{hint:$.hint}:{}}}:{}})}}}if(v.size>0&&e.log?.(`Not rendered, shown only inside another video (deliverable: false): ${[...v].join(", ")}. Name one to render it.`),S.some(a=>he(a.type)||a.type==="wav")){await He();for(const a of new Set(S.map(m=>m.type)))await ve(a,e.encode?.codec)}const Z=pt(S,e.name,e);S.forEach((a,m)=>{a.refused&&(a.refused.name=Z[m]??a.refused.name)});const ee=[],H=new Array(S.length).fill(0),V=(a,m)=>{H[a]=Math.max(H[a]??0,m),e.onProgress?.(H.reduce((P,C)=>P+C,0)/S.length)};let te=0,we=0;const be=async()=>{for(let a=te++;a<S.length;a=te++){e.signal?.throwIfAborted();const m=S[a];if(!m)continue;const P=Z[a]??pe(m.target,m.type,e);if(m.refused){g.push(m.refused),V(a,1);continue}const C=performance.now(),N=await xt.open({root:e.root,session:l,item:m.target.piece,combos:[m.target.combo],purpose:"render"});try{const y=await exportVersion(N,m.type,x(e.out,P),{...e,onProgress:$=>{V(a,$)}}),_=(await Promise.all(y.files.map($=>se($)))).reduce(($,xe)=>$+xe.size,0),b=Math.round((performance.now()-C)/10)/100;p.push({...y,name:ge(re(e.out,y.files[0]??"")),path:y.files[0]??x(e.out,P),piece:m.target.piece,type:m.type,combo:m.target.combo,key:U(m.target.combo),format:m.target.format,bytes:_,seconds:b}),e.log?.(`[${String(++we)}/${String(S.length)}] ${P} (${b.toFixed(1)} s)`)}catch(y){if(e.signal?.aborted||!(y instanceof Fe))throw y;g.push({name:P,piece:m.target.piece,type:m.type,code:y.code,message:y.message,...y.hint?{hint:y.hint}:{}})}finally{ee.push(...await N.problems()),w.add(m.target,await N.console()),await N.close(),V(a,1)}}};S.length>0&&e.log?.(`Rendering ${J(S.length,"file")}…`);const ne=(await Promise.allSettled(Array.from({length:exportsAtOnce(S.length)},be))).find(a=>a.status==="rejected");if(ne)throw ne.reason;O=me([...O,...ee])}const X=s=>d.problems.find(o=>o.level==="error"&&o.where?.file!==void 0&&s.includes(o.where.file));for(const s of[...u,...h]){const o=X("files"in s?s.files:[s.file]);o&&g.push({name:s.place,piece:s.place,type:"files"in s?"xlsx":"pdf",code:"check-failed",message:`${o.where?.file??s.place}: ${o.message}`,hint:"Fix it, then render again."})}e.signal?.throwIfAborted();const Q=s=>s.filter(o=>X("files"in o?o.files:[o.file])===void 0);if(p.push(...await Et(e.root,Q(u),t,e.out,e.log),...await Mt(e.root,Q(h),t,e.out,e.sheet??{},e.log)),t===void 0||t.includes("glb"))for(const s of A){e.log?.(`Building ${s.entry}…`);const o=performance.now(),R=`${s.dir}/${G(s.dir)}.glb`;try{await nt(x(e.root,s.entry),{root:e.root,out:x(e.out,R),cache:x(e.root,tt,"model"),log:()=>{}}),p.push(await M(e.out,R,s.dir,"glb",o))}catch(F){g.push({name:s.dir,piece:s.dir,type:"glb",code:"model-failed",message:`${s.entry}: ${F instanceof Error?F.message:String(F)}`,hint:"Fix it, then render again."})}}return{out:e.out,files:p,failed:g,problems:O,console:w.report(),unindexed:c}}finally{await l.close()}}const ge=e=>e.split(Ee).join("/");function kt(e,t){const i=re(e,t);return i===""?".":i.startsWith("..")||Se(i)?t:ge(i)}async function Pt(e,t,i,n){const f=[];for(const r of i.length>0?i:[void 0])f.push(await at({dir:t,session:e,facts:!1,...r===void 0?{}:{piece:r},...n?{combos:[...n]}:{}}));const p=new Set,g=f.flatMap(r=>r.targets).filter(r=>{const l=`${r.piece}\0${r.key}\0${r.format}`;return p.has(l)?!1:(p.add(l),!0)}),c=me(f.flatMap(r=>r.problems));return{targets:g,results:f.flatMap(r=>r.results),plans:f.flatMap(r=>r.plans),problems:c,errors:c.filter(r=>r.level==="error").length,console:ut(e.consoleLimit,...f.map(r=>r.console))}}function St(e){let t="";return i=>{const n=i.status==="failed"?`Could not index ${i.file}: ${i.message}`:i.message;i.status==="running"&&i.share!==void 0||n!==t&&(t=n,e?.(n))}}async function M(e,t,i,n,f){const p=x(e,t);return{files:[p],name:t,path:p,piece:i,type:n,bytes:(await se(p)).size,seconds:Math.round((performance.now()-f)/10)/100}}async function Et(e,t,i,n,f){const p=(i??["pdf"]).filter(c=>DOC_TYPES.includes(c)),g=[];for(const c of t){if(p.length===0)break;f?.(`Rendering ${c.file}…`);const r=performance.now(),l=G(c.place);if(p.includes("md")){const h=await ke(x(e,c.file),"utf8");await L(x(n,c.place),{recursive:!0}),await W(x(n,c.place,`${l}.md`),Oe(je(h).blocks)),g.push(await M(n,`${c.place}/${l}.md`,c.place,"md",r))}if(p.includes("docx")){const h=`${c.place}/${l}.docx`;await qe({root:e,doc:{file:c.file,dir:c.dir,path:c.place,title:c.title},out:x(n,h),...await yt(f)}),g.push(await M(n,h,c.place,"docx",r))}const d=p.filter(h=>h==="pdf"||h==="png");if(d.length===0)continue;const u=await Ue({root:e,doc:{file:c.file,dir:c.dir,path:c.place,title:c.title},out:x(n,c.place),name:l,types:d});for(const h of u)g.push(await M(n,`${c.place}/${h}`,c.place,h.endsWith(".png")?"png":"pdf",r))}return g}export const PNG_ROWS=700,PNG_COLUMNS=200;const jt=1e4,Ot=40;function Ct(e){const t=[];let i=0,n=0;return e.job.pages.forEach((f,p)=>{const g=(f.down.to-f.down.from+f.of.titleRows.length)*(f.across.to-f.across.from+f.of.titleCols.length);p>i&&(n+g>jt||p-i>=Ot)&&(t.push([i,p]),i=p,n=0),n+=g}),i<e.job.pages.length&&t.push([i,e.job.pages.length]),t}function Nt(){const e=Number(process.env.SOURCE_DATE_EPOCH);return Number.isFinite(e)&&e>0?new Date(e*1e3):new Date}export async function printSheet(e,t){const i=new Ze(e,t.picture===void 0?{}:{file:t.picture}),n=Ct(i),f=t.date??Nt();return await Ge({file:t.file,title:t.title,tagged:!1,...t.signal===void 0?{}:{signal:t.signal},parts:{count:Math.max(1,n.length),html:async p=>{const[g,c]=n[p]??[0,0],r=i.html(g,c,{name:t.name,date:f,font:ae});return r.replace("<style>",`<style>${await ce(r)}`)}}}),i.job.pages.length}async function Mt(e,t,i,n,f,p){const g=(i??["xlsx"]).filter(r=>SHEET_TYPES.includes(r)),c=[];for(const r of t){if(g.length===0)break;p?.(`Rendering ${r.file}…`);const l=performance.now(),d=await Te(e,r.dir);if(d.failed){p?.(`${r.file}: its sheet.ts does not run. allyhub check says why.`);continue}const{workbook:u,calc:h}=Je(_e(e,d),{random:Xe([d.text,...d.csv.values(),d.generated?JSON.stringify(d.generated):""].join(`
3
+ `))});if(!u||!h)continue;const A=j=>{const O=ie.normalize(ie.join(r.dir,j));try{return O.startsWith("..")?void 0:new Uint8Array($e(x(e,O)))}catch{return}};await L(x(n,r.place),{recursive:!0});const E=G(r.place),k=`${r.place}/${E}`,D=u.sheets.length>1,z=u.title??r.title??E;for(const j of g){if(j==="pdf"){await printSheet(h,{file:x(n,`${k}.pdf`),name:E,title:z,picture:A}),c.push(await M(n,`${k}.pdf`,r.place,"pdf",l));continue}if(j==="png"){const w=Qe(h,{font:ae,file:A,rows:PNG_ROWS,columns:PNG_COLUMNS,headings:!1});for(const T of w.cut)p?.(`${k}.png: ${T}`);await Ve({html:w.html.replace("<style>",`<style>${await ce(w.html)}`),out:x(n,r.place),name:E,types:["png"],width:w.width+48,pictureCss:"body{padding:24px}"}),c.push(await M(n,`${k}.png`,r.place,"png",l));continue}if(j==="xlsx"){const{bytes:w,left:T}=et(h,{file:A});await W(x(n,`${k}.xlsx`),w);for(const Y of T)p?.(`${k}.xlsx does not hold ${Y}.`);c.push(await M(n,`${k}.xlsx`,r.place,"xlsx",l));continue}const O=[];if(j==="csv")for(const w of u.sheets)O.push([D?`${k}-${w.name.replace(/\W+/gu,"-")}.csv`:`${k}.csv`,Be(h,w,f)]);else j==="md"?O.push([`${k}.md`,u.sheets.map(w=>D?`## ${w.name}
4
4
 
5
- ${re(P,g)}`:re(P,g)).join(`
6
- `)]):S.push([`${x}.json`,`${JSON.stringify(Je(P),null,2)}
7
- `]);for(const[g,N]of S)await R(w(t,g),N),d.push(await M(t,g,i.place,$,a))}}return d}
5
+ ${le(h,w,f)}`:le(h,w,f)).join(`
6
+ `)]):O.push([`${k}.json`,`${JSON.stringify(Ke(h,f),null,2)}
7
+ `]);for(const[w,T]of O)await W(x(n,w),T),c.push(await M(n,w,r.place,j,l))}}return c}
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- export{DOC_TYPES,SHEET_TYPES,exportProject,exportVersion,exportsAtOnce}from"./export.js";export{batchName,checkName,exportName,exportNames,versionSuffixes}from"./names.js";export{batchCsv,batchOf,batchRows}from"./batch.js";export{renderDeckPptx}from"./deck-pptx.js";
2
+ export{DOC_TYPES,SHEET_TYPES,exportProject,exportVersion,exportsAtOnce,printSheet}from"./export.js";export{batchName,checkName,exportName,exportNames,versionSuffixes}from"./names.js";export{batchCsv,batchOf,batchRows}from"./batch.js";export{renderDeckPptx}from"./deck-pptx.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/export",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -0,0 +1,205 @@
1
+ import { z } from "zod";
2
+ export declare const DeckCodeSchema: z.ZodObject<{
3
+ slide_width: z.ZodNumber;
4
+ slide_height: z.ZodNumber;
5
+ theme: z.ZodOptional<z.ZodObject<{
6
+ name: z.ZodOptional<z.ZodString>;
7
+ colors: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
8
+ dk1: "dk1";
9
+ lt1: "lt1";
10
+ dk2: "dk2";
11
+ lt2: "lt2";
12
+ accent1: "accent1";
13
+ accent2: "accent2";
14
+ accent3: "accent3";
15
+ accent4: "accent4";
16
+ accent5: "accent5";
17
+ accent6: "accent6";
18
+ hlink: "hlink";
19
+ folHlink: "folHlink";
20
+ }> & z.core.$partial, z.ZodString>>;
21
+ fonts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
22
+ }, z.core.$strict>>;
23
+ masters: z.ZodArray<z.ZodObject<{
24
+ name: z.ZodString;
25
+ background: z.ZodUnion<readonly [z.ZodEnum<{
26
+ dk1: "dk1";
27
+ lt1: "lt1";
28
+ dk2: "dk2";
29
+ lt2: "lt2";
30
+ accent1: "accent1";
31
+ accent2: "accent2";
32
+ accent3: "accent3";
33
+ accent4: "accent4";
34
+ accent5: "accent5";
35
+ accent6: "accent6";
36
+ hlink: "hlink";
37
+ folHlink: "folHlink";
38
+ }>, z.ZodObject<{
39
+ theme_color: z.ZodEnum<{
40
+ dk1: "dk1";
41
+ lt1: "lt1";
42
+ dk2: "dk2";
43
+ lt2: "lt2";
44
+ accent1: "accent1";
45
+ accent2: "accent2";
46
+ accent3: "accent3";
47
+ accent4: "accent4";
48
+ accent5: "accent5";
49
+ accent6: "accent6";
50
+ hlink: "hlink";
51
+ folHlink: "folHlink";
52
+ }>;
53
+ brightness: z.ZodNumber;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ rgb: z.ZodString;
56
+ }, z.core.$strict>]>;
57
+ text_styles: z.ZodObject<{
58
+ title: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
59
+ body: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
60
+ other: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
61
+ }, z.core.$strict>;
62
+ shapes: z.ZodArray<z.ZodObject<{
63
+ name: z.ZodString;
64
+ kind: z.ZodEnum<{
65
+ picture: "picture";
66
+ textbox: "textbox";
67
+ movie: "movie";
68
+ table: "table";
69
+ chart: "chart";
70
+ component: "component";
71
+ placeholder: "placeholder";
72
+ autoshape: "autoshape";
73
+ }>;
74
+ frame: z.ZodOptional<z.ZodObject<{
75
+ left: z.ZodNumber;
76
+ top: z.ZodNumber;
77
+ width: z.ZodNumber;
78
+ height: z.ZodNumber;
79
+ }, z.core.$strict>>;
80
+ placeholder: z.ZodOptional<z.ZodObject<{
81
+ type: z.ZodString;
82
+ idx: z.ZodNumber;
83
+ }, z.core.$strict>>;
84
+ text: z.ZodOptional<z.ZodObject<{
85
+ paragraphs: z.ZodArray<z.ZodObject<{
86
+ level: z.ZodNumber;
87
+ runs: z.ZodArray<z.ZodObject<{
88
+ text: z.ZodString;
89
+ }, z.core.$loose>>;
90
+ }, z.core.$loose>>;
91
+ levels: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
92
+ }, z.core.$loose>>;
93
+ media: z.ZodOptional<z.ZodObject<{
94
+ path: z.ZodString;
95
+ base: z.ZodString;
96
+ }, z.core.$loose>>;
97
+ component: z.ZodOptional<z.ZodObject<{
98
+ name: z.ZodString;
99
+ props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
100
+ }, z.core.$strict>>;
101
+ }, z.core.$loose>>;
102
+ layouts: z.ZodArray<z.ZodObject<{
103
+ name: z.ZodString;
104
+ master: z.ZodString;
105
+ shapes: z.ZodArray<z.ZodObject<{
106
+ name: z.ZodString;
107
+ kind: z.ZodEnum<{
108
+ picture: "picture";
109
+ textbox: "textbox";
110
+ movie: "movie";
111
+ table: "table";
112
+ chart: "chart";
113
+ component: "component";
114
+ placeholder: "placeholder";
115
+ autoshape: "autoshape";
116
+ }>;
117
+ frame: z.ZodOptional<z.ZodObject<{
118
+ left: z.ZodNumber;
119
+ top: z.ZodNumber;
120
+ width: z.ZodNumber;
121
+ height: z.ZodNumber;
122
+ }, z.core.$strict>>;
123
+ placeholder: z.ZodOptional<z.ZodObject<{
124
+ type: z.ZodString;
125
+ idx: z.ZodNumber;
126
+ }, z.core.$strict>>;
127
+ text: z.ZodOptional<z.ZodObject<{
128
+ paragraphs: z.ZodArray<z.ZodObject<{
129
+ level: z.ZodNumber;
130
+ runs: z.ZodArray<z.ZodObject<{
131
+ text: z.ZodString;
132
+ }, z.core.$loose>>;
133
+ }, z.core.$loose>>;
134
+ levels: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
135
+ }, z.core.$loose>>;
136
+ media: z.ZodOptional<z.ZodObject<{
137
+ path: z.ZodString;
138
+ base: z.ZodString;
139
+ }, z.core.$loose>>;
140
+ component: z.ZodOptional<z.ZodObject<{
141
+ name: z.ZodString;
142
+ props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
143
+ }, z.core.$strict>>;
144
+ }, z.core.$loose>>;
145
+ }, z.core.$loose>>;
146
+ }, z.core.$loose>>;
147
+ components: z.ZodRecord<z.ZodString, z.ZodObject<{
148
+ props: z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
149
+ }, z.core.$strict>>;
150
+ generators: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
151
+ id: z.ZodString;
152
+ layout: z.ZodString;
153
+ shapes: z.ZodArray<z.ZodObject<{
154
+ name: z.ZodString;
155
+ kind: z.ZodEnum<{
156
+ picture: "picture";
157
+ textbox: "textbox";
158
+ movie: "movie";
159
+ table: "table";
160
+ chart: "chart";
161
+ component: "component";
162
+ placeholder: "placeholder";
163
+ autoshape: "autoshape";
164
+ }>;
165
+ frame: z.ZodOptional<z.ZodObject<{
166
+ left: z.ZodNumber;
167
+ top: z.ZodNumber;
168
+ width: z.ZodNumber;
169
+ height: z.ZodNumber;
170
+ }, z.core.$strict>>;
171
+ placeholder: z.ZodOptional<z.ZodObject<{
172
+ type: z.ZodString;
173
+ idx: z.ZodNumber;
174
+ }, z.core.$strict>>;
175
+ text: z.ZodOptional<z.ZodObject<{
176
+ paragraphs: z.ZodArray<z.ZodObject<{
177
+ level: z.ZodNumber;
178
+ runs: z.ZodArray<z.ZodObject<{
179
+ text: z.ZodString;
180
+ }, z.core.$loose>>;
181
+ }, z.core.$loose>>;
182
+ levels: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
183
+ }, z.core.$loose>>;
184
+ media: z.ZodOptional<z.ZodObject<{
185
+ path: z.ZodString;
186
+ base: z.ZodString;
187
+ }, z.core.$loose>>;
188
+ component: z.ZodOptional<z.ZodObject<{
189
+ name: z.ZodString;
190
+ props: z.ZodRecord<z.ZodString, z.ZodUnknown>;
191
+ }, z.core.$strict>>;
192
+ }, z.core.$loose>>;
193
+ text: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
194
+ level: z.ZodNumber;
195
+ runs: z.ZodArray<z.ZodObject<{
196
+ text: z.ZodString;
197
+ }, z.core.$loose>>;
198
+ }, z.core.$loose>>>;
199
+ notes: z.ZodOptional<z.ZodString>;
200
+ }, z.core.$loose>>, z.ZodObject<{
201
+ error: z.ZodString;
202
+ stack: z.ZodOptional<z.ZodString>;
203
+ }, z.core.$strict>]>>;
204
+ }, z.core.$strict>;
205
+ //# sourceMappingURL=deck-code.d.ts.map