@allyhub/sdk 0.1.0-alpha.8 → 0.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/LICENSE.md +241 -0
  2. package/NOTICE +85 -0
  3. package/client.d.ts +45 -1
  4. package/dist/anim.js +2 -75
  5. package/dist/define.d.ts +10 -4
  6. package/dist/define.js +2 -95
  7. package/dist/dom.d.ts +1 -1
  8. package/dist/dom.js +2 -457
  9. package/dist/fit.js +2 -60
  10. package/dist/free.d.ts +18 -0
  11. package/dist/free.js +2 -0
  12. package/dist/index.d.ts +28 -13
  13. package/dist/index.js +2 -11
  14. package/dist/input.d.ts +306 -0
  15. package/dist/input.js +2 -0
  16. package/dist/media.d.ts +3 -6
  17. package/dist/media.js +2 -27
  18. package/dist/messages.d.ts +3 -2
  19. package/dist/messages.js +2 -2
  20. package/dist/module.d.ts +24 -0
  21. package/dist/module.js +2 -0
  22. package/dist/noise.js +2 -233
  23. package/dist/parts.d.ts +98 -22
  24. package/dist/parts.js +2 -414
  25. package/dist/paths.d.ts +1 -1
  26. package/dist/paths.js +2 -720
  27. package/dist/phone.d.ts +26 -0
  28. package/dist/phone.js +2 -0
  29. package/dist/piece.d.ts +106 -35
  30. package/dist/piece.js +2 -38
  31. package/dist/props.d.ts +1 -1
  32. package/dist/props.js +2 -35
  33. package/dist/scenery.d.ts +2 -0
  34. package/dist/scenery.js +2 -0
  35. package/dist/text.js +2 -38
  36. package/dist/written.d.ts +12 -0
  37. package/dist/written.js +2 -0
  38. package/docs/README.md +18 -0
  39. package/docs/batches.md +148 -0
  40. package/docs/contract.md +51 -0
  41. package/docs/defaults.md +703 -0
  42. package/docs/docs.md +148 -0
  43. package/docs/footage.md +249 -0
  44. package/docs/layers.md +317 -0
  45. package/docs/modeling.md +143 -0
  46. package/docs/project.md +265 -0
  47. package/docs/scenery.md +308 -0
  48. package/docs/sheets.md +119 -0
  49. package/docs/slides.md +111 -0
  50. package/docs/sound.md +170 -0
  51. package/docs/speech.md +289 -0
  52. package/docs/video.md +265 -0
  53. package/node_modules/@allyhub-next/audio/LICENSE +241 -0
  54. package/node_modules/@allyhub-next/audio/dist/at-cut.d.ts +52 -0
  55. package/node_modules/@allyhub-next/audio/dist/at-cut.js +2 -0
  56. package/node_modules/@allyhub-next/audio/dist/decode.d.ts +33 -0
  57. package/node_modules/@allyhub-next/audio/dist/decode.js +2 -0
  58. package/node_modules/@allyhub-next/audio/dist/envelope.d.ts +37 -0
  59. package/node_modules/@allyhub-next/audio/dist/envelope.js +2 -0
  60. package/node_modules/@allyhub-next/audio/dist/index.d.ts +17 -0
  61. package/node_modules/@allyhub-next/audio/dist/index.js +2 -0
  62. package/node_modules/@allyhub-next/audio/dist/levels.d.ts +97 -0
  63. package/node_modules/@allyhub-next/audio/dist/levels.js +2 -0
  64. package/node_modules/@allyhub-next/audio/dist/master.d.ts +29 -0
  65. package/node_modules/@allyhub-next/audio/dist/master.js +2 -0
  66. package/node_modules/@allyhub-next/audio/dist/music.d.ts +11 -0
  67. package/node_modules/@allyhub-next/audio/dist/music.js +2 -0
  68. package/node_modules/@allyhub-next/audio/dist/node/decode.d.ts +39 -0
  69. package/node_modules/@allyhub-next/audio/dist/node/decode.js +2 -0
  70. package/node_modules/@allyhub-next/audio/dist/node/ebur128.d.ts +25 -0
  71. package/node_modules/@allyhub-next/audio/dist/node/ebur128.js +2 -0
  72. package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.d.ts +31 -0
  73. package/node_modules/@allyhub-next/audio/dist/node/ffmpeg.js +2 -0
  74. package/node_modules/@allyhub-next/audio/dist/node/index.d.ts +8 -0
  75. package/node_modules/@allyhub-next/audio/dist/node/index.js +2 -0
  76. package/node_modules/@allyhub-next/audio/dist/node/loudness.d.ts +18 -0
  77. package/node_modules/@allyhub-next/audio/dist/node/loudness.js +2 -0
  78. package/node_modules/@allyhub-next/audio/dist/node/master.d.ts +42 -0
  79. package/node_modules/@allyhub-next/audio/dist/node/master.js +2 -0
  80. package/node_modules/@allyhub-next/audio/dist/node/measure.d.ts +60 -0
  81. package/node_modules/@allyhub-next/audio/dist/node/measure.js +2 -0
  82. package/node_modules/@allyhub-next/audio/dist/node/mix.d.ts +31 -0
  83. package/node_modules/@allyhub-next/audio/dist/node/mix.js +2 -0
  84. package/node_modules/@allyhub-next/audio/dist/plan.d.ts +143 -0
  85. package/node_modules/@allyhub-next/audio/dist/plan.js +2 -0
  86. package/node_modules/@allyhub-next/audio/dist/recorded.d.ts +26 -0
  87. package/node_modules/@allyhub-next/audio/dist/recorded.js +2 -0
  88. package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.d.ts +47 -0
  89. package/node_modules/@allyhub-next/audio/dist/recording/bandwidth.js +2 -0
  90. package/node_modules/@allyhub-next/audio/dist/recording/chain.d.ts +89 -0
  91. package/node_modules/@allyhub-next/audio/dist/recording/chain.js +2 -0
  92. package/node_modules/@allyhub-next/audio/dist/recording/dynamics.d.ts +64 -0
  93. package/node_modules/@allyhub-next/audio/dist/recording/dynamics.js +2 -0
  94. package/node_modules/@allyhub-next/audio/dist/recording/fft.d.ts +26 -0
  95. package/node_modules/@allyhub-next/audio/dist/recording/fft.js +2 -0
  96. package/node_modules/@allyhub-next/audio/dist/recording/filters.d.ts +42 -0
  97. package/node_modules/@allyhub-next/audio/dist/recording/filters.js +2 -0
  98. package/node_modules/@allyhub-next/audio/dist/recording/fit.d.ts +56 -0
  99. package/node_modules/@allyhub-next/audio/dist/recording/fit.js +2 -0
  100. package/node_modules/@allyhub-next/audio/dist/recording/index.d.ts +10 -0
  101. package/node_modules/@allyhub-next/audio/dist/recording/index.js +2 -0
  102. package/node_modules/@allyhub-next/audio/dist/recording/loudness.d.ts +12 -0
  103. package/node_modules/@allyhub-next/audio/dist/recording/loudness.js +2 -0
  104. package/node_modules/@allyhub-next/audio/dist/recording/measure.d.ts +67 -0
  105. package/node_modules/@allyhub-next/audio/dist/recording/measure.js +2 -0
  106. package/node_modules/@allyhub-next/audio/dist/recording/mic.d.ts +32 -0
  107. package/node_modules/@allyhub-next/audio/dist/recording/mic.js +2 -0
  108. package/node_modules/@allyhub-next/audio/dist/recording/noise.d.ts +27 -0
  109. package/node_modules/@allyhub-next/audio/dist/recording/noise.js +2 -0
  110. package/node_modules/@allyhub-next/audio/dist/recording/presets.d.ts +64 -0
  111. package/node_modules/@allyhub-next/audio/dist/recording/presets.js +2 -0
  112. package/node_modules/@allyhub-next/audio/dist/recording/room.d.ts +78 -0
  113. package/node_modules/@allyhub-next/audio/dist/recording/room.js +2 -0
  114. package/node_modules/@allyhub-next/audio/dist/recording/setup.d.ts +111 -0
  115. package/node_modules/@allyhub-next/audio/dist/recording/setup.js +2 -0
  116. package/node_modules/@allyhub-next/audio/dist/recording/vec.d.ts +3 -0
  117. package/node_modules/@allyhub-next/audio/dist/recording/vec.js +2 -0
  118. package/node_modules/@allyhub-next/audio/dist/render.d.ts +26 -0
  119. package/node_modules/@allyhub-next/audio/dist/render.js +2 -0
  120. package/node_modules/@allyhub-next/audio/dist/sfx.d.ts +10 -0
  121. package/node_modules/@allyhub-next/audio/dist/sfx.js +2 -0
  122. package/node_modules/@allyhub-next/audio/dist/shape.d.ts +118 -0
  123. package/node_modules/@allyhub-next/audio/dist/shape.js +2 -0
  124. package/node_modules/@allyhub-next/audio/dist/voice.d.ts +45 -0
  125. package/node_modules/@allyhub-next/audio/dist/voice.js +2 -0
  126. package/node_modules/@allyhub-next/audio/package.json +17 -0
  127. package/node_modules/@allyhub-next/formats/LICENSE +241 -0
  128. package/node_modules/@allyhub-next/formats/dist/data/comments.d.ts +94 -0
  129. package/node_modules/@allyhub-next/formats/dist/data/comments.js +2 -0
  130. package/node_modules/@allyhub-next/formats/dist/data/config.d.ts +10 -0
  131. package/node_modules/@allyhub-next/formats/dist/data/config.js +2 -0
  132. package/node_modules/@allyhub-next/formats/dist/data/edits.d.ts +28 -0
  133. package/node_modules/@allyhub-next/formats/dist/data/edits.js +2 -0
  134. package/node_modules/@allyhub-next/formats/dist/data/elements.d.ts +6 -0
  135. package/node_modules/@allyhub-next/formats/dist/data/elements.js +2 -0
  136. package/node_modules/@allyhub-next/formats/dist/data/faces.d.ts +38 -0
  137. package/node_modules/@allyhub-next/formats/dist/data/faces.js +2 -0
  138. package/node_modules/@allyhub-next/formats/dist/data/file.d.ts +11 -0
  139. package/node_modules/@allyhub-next/formats/dist/data/file.js +2 -0
  140. package/node_modules/@allyhub-next/formats/dist/data/gen.d.ts +31 -0
  141. package/node_modules/@allyhub-next/formats/dist/data/gen.js +2 -0
  142. package/node_modules/@allyhub-next/formats/dist/data/messages.d.ts +34 -0
  143. package/node_modules/@allyhub-next/formats/dist/data/messages.js +2 -0
  144. package/node_modules/@allyhub-next/formats/dist/data/reference.d.ts +676 -0
  145. package/node_modules/@allyhub-next/formats/dist/data/reference.js +2 -0
  146. package/node_modules/@allyhub-next/formats/dist/data/script.d.ts +37 -0
  147. package/node_modules/@allyhub-next/formats/dist/data/script.js +2 -0
  148. package/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +214 -0
  149. package/node_modules/@allyhub-next/formats/dist/data/sheet.js +2 -0
  150. package/node_modules/@allyhub-next/formats/dist/data/words.d.ts +25 -0
  151. package/node_modules/@allyhub-next/formats/dist/data/words.js +2 -0
  152. package/node_modules/@allyhub-next/formats/dist/index.d.ts +16 -0
  153. package/node_modules/@allyhub-next/formats/dist/index.js +2 -0
  154. package/node_modules/@allyhub-next/formats/dist/items.d.ts +94 -0
  155. package/node_modules/@allyhub-next/formats/dist/items.js +2 -0
  156. package/node_modules/@allyhub-next/formats/dist/layout.d.ts +50 -0
  157. package/node_modules/@allyhub-next/formats/dist/layout.js +5 -0
  158. package/node_modules/@allyhub-next/formats/dist/schemas.d.ts +301 -0
  159. package/node_modules/@allyhub-next/formats/dist/schemas.js +2 -0
  160. package/node_modules/@allyhub-next/formats/package.json +14 -0
  161. package/node_modules/@allyhub-next/protocol/LICENSE +241 -0
  162. package/node_modules/@allyhub-next/protocol/dist/app.d.ts +98 -0
  163. package/node_modules/@allyhub-next/protocol/dist/app.js +2 -0
  164. package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +116 -0
  165. package/node_modules/@allyhub-next/protocol/dist/auth.js +2 -0
  166. package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +59 -0
  167. package/node_modules/@allyhub-next/protocol/dist/cli.js +2 -0
  168. package/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +274 -0
  169. package/node_modules/@allyhub-next/protocol/dist/cloud.js +2 -0
  170. package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +405 -0
  171. package/node_modules/@allyhub-next/protocol/dist/editor.js +2 -0
  172. package/node_modules/@allyhub-next/protocol/dist/files.d.ts +101 -0
  173. package/node_modules/@allyhub-next/protocol/dist/files.js +2 -0
  174. package/node_modules/@allyhub-next/protocol/dist/index.d.ts +12 -0
  175. package/node_modules/@allyhub-next/protocol/dist/index.js +2 -0
  176. package/node_modules/@allyhub-next/protocol/dist/jsonrpc.d.ts +83 -0
  177. package/node_modules/@allyhub-next/protocol/dist/jsonrpc.js +2 -0
  178. package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +53 -0
  179. package/node_modules/@allyhub-next/protocol/dist/registry.js +2 -0
  180. package/node_modules/@allyhub-next/protocol/dist/runtimes.d.ts +93 -0
  181. package/node_modules/@allyhub-next/protocol/dist/runtimes.js +2 -0
  182. package/node_modules/@allyhub-next/protocol/dist/teams.d.ts +67 -0
  183. package/node_modules/@allyhub-next/protocol/dist/teams.js +2 -0
  184. package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +345 -0
  185. package/node_modules/@allyhub-next/protocol/dist/tools.js +2 -0
  186. package/node_modules/@allyhub-next/protocol/package.json +13 -0
  187. package/node_modules/@allyhub-next/runtimes/LICENSE +241 -0
  188. package/node_modules/@allyhub-next/runtimes/dist/bundled.d.ts +10 -0
  189. package/node_modules/@allyhub-next/runtimes/dist/bundled.js +2 -0
  190. package/node_modules/@allyhub-next/runtimes/dist/download.d.ts +15 -0
  191. package/node_modules/@allyhub-next/runtimes/dist/download.js +2 -0
  192. package/node_modules/@allyhub-next/runtimes/dist/errors.d.ts +16 -0
  193. package/node_modules/@allyhub-next/runtimes/dist/errors.js +2 -0
  194. package/node_modules/@allyhub-next/runtimes/dist/home.d.ts +2 -0
  195. package/node_modules/@allyhub-next/runtimes/dist/home.js +2 -0
  196. package/node_modules/@allyhub-next/runtimes/dist/index.d.ts +9 -0
  197. package/node_modules/@allyhub-next/runtimes/dist/index.js +2 -0
  198. package/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
  199. package/node_modules/@allyhub-next/runtimes/dist/lock.js +2 -0
  200. package/node_modules/@allyhub-next/runtimes/dist/manifest.d.ts +3 -0
  201. package/node_modules/@allyhub-next/runtimes/dist/manifest.js +2 -0
  202. package/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +63 -0
  203. package/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -0
  204. package/node_modules/@allyhub-next/runtimes/dist/unpack.d.ts +7 -0
  205. package/node_modules/@allyhub-next/runtimes/dist/unpack.js +2 -0
  206. package/node_modules/@allyhub-next/runtimes/manifest.json +395 -0
  207. package/node_modules/@allyhub-next/runtimes/package.json +14 -0
  208. package/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +153 -0
  209. package/node_modules/@allyhub-next/scenery/LICENSE +241 -0
  210. package/node_modules/@allyhub-next/scenery/NOTICE +42 -0
  211. package/node_modules/@allyhub-next/scenery/dist/aim.d.ts +55 -0
  212. package/node_modules/@allyhub-next/scenery/dist/aim.js +2 -0
  213. package/node_modules/@allyhub-next/scenery/dist/bake.d.ts +203 -0
  214. package/node_modules/@allyhub-next/scenery/dist/bake.js +2 -0
  215. package/node_modules/@allyhub-next/scenery/dist/camera.d.ts +150 -0
  216. package/node_modules/@allyhub-next/scenery/dist/camera.js +2 -0
  217. package/node_modules/@allyhub-next/scenery/dist/curve.d.ts +40 -0
  218. package/node_modules/@allyhub-next/scenery/dist/curve.js +2 -0
  219. package/node_modules/@allyhub-next/scenery/dist/define.d.ts +164 -0
  220. package/node_modules/@allyhub-next/scenery/dist/define.js +2 -0
  221. package/node_modules/@allyhub-next/scenery/dist/fit.d.ts +64 -0
  222. package/node_modules/@allyhub-next/scenery/dist/fit.js +2 -0
  223. package/node_modules/@allyhub-next/scenery/dist/glass.d.ts +34 -0
  224. package/node_modules/@allyhub-next/scenery/dist/glass.js +2 -0
  225. package/node_modules/@allyhub-next/scenery/dist/handheld.d.ts +184 -0
  226. package/node_modules/@allyhub-next/scenery/dist/handheld.js +2 -0
  227. package/node_modules/@allyhub-next/scenery/dist/hull.d.ts +23 -0
  228. package/node_modules/@allyhub-next/scenery/dist/hull.js +2 -0
  229. package/node_modules/@allyhub-next/scenery/dist/index.d.ts +22 -0
  230. package/node_modules/@allyhub-next/scenery/dist/index.js +2 -0
  231. package/node_modules/@allyhub-next/scenery/dist/lens.d.ts +48 -0
  232. package/node_modules/@allyhub-next/scenery/dist/lens.js +2 -0
  233. package/node_modules/@allyhub-next/scenery/dist/moire.d.ts +136 -0
  234. package/node_modules/@allyhub-next/scenery/dist/moire.js +93 -0
  235. package/node_modules/@allyhub-next/scenery/dist/motion.d.ts +48 -0
  236. package/node_modules/@allyhub-next/scenery/dist/motion.js +2 -0
  237. package/node_modules/@allyhub-next/scenery/dist/move.d.ts +260 -0
  238. package/node_modules/@allyhub-next/scenery/dist/move.js +2 -0
  239. package/node_modules/@allyhub-next/scenery/dist/noise.d.ts +41 -0
  240. package/node_modules/@allyhub-next/scenery/dist/noise.js +2 -0
  241. package/node_modules/@allyhub-next/scenery/dist/phone.d.ts +34 -0
  242. package/node_modules/@allyhub-next/scenery/dist/phone.js +2 -0
  243. package/node_modules/@allyhub-next/scenery/dist/report.d.ts +677 -0
  244. package/node_modules/@allyhub-next/scenery/dist/report.js +2 -0
  245. package/node_modules/@allyhub-next/scenery/dist/screen-focus.d.ts +55 -0
  246. package/node_modules/@allyhub-next/scenery/dist/screen-focus.js +2 -0
  247. package/node_modules/@allyhub-next/scenery/dist/screen.d.ts +71 -0
  248. package/node_modules/@allyhub-next/scenery/dist/screen.js +2 -0
  249. package/node_modules/@allyhub-next/scenery/dist/solve.d.ts +82 -0
  250. package/node_modules/@allyhub-next/scenery/dist/solve.js +2 -0
  251. package/node_modules/@allyhub-next/scenery/dist/timing.d.ts +26 -0
  252. package/node_modules/@allyhub-next/scenery/dist/timing.js +2 -0
  253. package/node_modules/@allyhub-next/scenery/dist/vec.d.ts +19 -0
  254. package/node_modules/@allyhub-next/scenery/dist/vec.js +2 -0
  255. package/node_modules/@allyhub-next/scenery/package.json +13 -0
  256. package/node_modules/@allyhub-next/video-core/LICENSE +241 -0
  257. package/node_modules/@allyhub-next/video-core/dist/anchors.d.ts +164 -0
  258. package/node_modules/@allyhub-next/video-core/dist/anchors.js +2 -0
  259. package/node_modules/@allyhub-next/video-core/dist/audio-types.d.ts +148 -0
  260. package/node_modules/@allyhub-next/video-core/dist/audio-types.js +2 -0
  261. package/node_modules/@allyhub-next/video-core/dist/backdrop.d.ts +87 -0
  262. package/node_modules/@allyhub-next/video-core/dist/backdrop.js +2 -0
  263. package/node_modules/@allyhub-next/video-core/dist/captions.d.ts +122 -0
  264. package/node_modules/@allyhub-next/video-core/dist/captions.js +11 -0
  265. package/node_modules/@allyhub-next/video-core/dist/console.d.ts +91 -0
  266. package/node_modules/@allyhub-next/video-core/dist/console.js +2 -0
  267. package/node_modules/@allyhub-next/video-core/dist/contrast.d.ts +98 -0
  268. package/node_modules/@allyhub-next/video-core/dist/contrast.js +2 -0
  269. package/node_modules/@allyhub-next/video-core/dist/cut-report.d.ts +77 -0
  270. package/node_modules/@allyhub-next/video-core/dist/cut-report.js +2 -0
  271. package/node_modules/@allyhub-next/video-core/dist/edit.d.ts +77 -0
  272. package/node_modules/@allyhub-next/video-core/dist/edit.js +13 -0
  273. package/node_modules/@allyhub-next/video-core/dist/edits.d.ts +163 -0
  274. package/node_modules/@allyhub-next/video-core/dist/edits.js +2 -0
  275. package/node_modules/@allyhub-next/video-core/dist/export.d.ts +96 -0
  276. package/node_modules/@allyhub-next/video-core/dist/export.js +2 -0
  277. package/node_modules/@allyhub-next/video-core/dist/fact.d.ts +965 -0
  278. package/node_modules/@allyhub-next/video-core/dist/fact.js +2 -0
  279. package/node_modules/@allyhub-next/video-core/dist/footage-motion.d.ts +168 -0
  280. package/node_modules/@allyhub-next/video-core/dist/footage-motion.js +2 -0
  281. package/node_modules/@allyhub-next/video-core/dist/formats.d.ts +240 -0
  282. package/node_modules/@allyhub-next/video-core/dist/formats.js +2 -0
  283. package/node_modules/@allyhub-next/video-core/dist/gen.d.ts +37 -0
  284. package/node_modules/@allyhub-next/video-core/dist/gen.js +2 -0
  285. package/node_modules/@allyhub-next/video-core/dist/index.d.ts +40 -0
  286. package/node_modules/@allyhub-next/video-core/dist/index.js +2 -0
  287. package/node_modules/@allyhub-next/video-core/dist/look.d.ts +66 -0
  288. package/node_modules/@allyhub-next/video-core/dist/look.js +2 -0
  289. package/node_modules/@allyhub-next/video-core/dist/marks.d.ts +34 -0
  290. package/node_modules/@allyhub-next/video-core/dist/marks.js +2 -0
  291. package/node_modules/@allyhub-next/video-core/dist/matrix.d.ts +289 -0
  292. package/node_modules/@allyhub-next/video-core/dist/matrix.js +2 -0
  293. package/node_modules/@allyhub-next/video-core/dist/measure.d.ts +465 -0
  294. package/node_modules/@allyhub-next/video-core/dist/measure.js +5 -0
  295. package/node_modules/@allyhub-next/video-core/dist/media.d.ts +226 -0
  296. package/node_modules/@allyhub-next/video-core/dist/media.js +2 -0
  297. package/node_modules/@allyhub-next/video-core/dist/messages.d.ts +88 -0
  298. package/node_modules/@allyhub-next/video-core/dist/messages.js +2 -0
  299. package/node_modules/@allyhub-next/video-core/dist/motion.d.ts +56 -0
  300. package/node_modules/@allyhub-next/video-core/dist/motion.js +2 -0
  301. package/node_modules/@allyhub-next/video-core/dist/music.d.ts +110 -0
  302. package/node_modules/@allyhub-next/video-core/dist/music.js +2 -0
  303. package/node_modules/@allyhub-next/video-core/dist/piece.d.ts +1146 -0
  304. package/node_modules/@allyhub-next/video-core/dist/piece.js +2 -0
  305. package/node_modules/@allyhub-next/video-core/dist/placement.d.ts +37 -0
  306. package/node_modules/@allyhub-next/video-core/dist/placement.js +2 -0
  307. package/node_modules/@allyhub-next/video-core/dist/problem.d.ts +262 -0
  308. package/node_modules/@allyhub-next/video-core/dist/problem.js +2 -0
  309. package/node_modules/@allyhub-next/video-core/dist/render-types.d.ts +49 -0
  310. package/node_modules/@allyhub-next/video-core/dist/render-types.js +2 -0
  311. package/node_modules/@allyhub-next/video-core/dist/schema.d.ts +352 -0
  312. package/node_modules/@allyhub-next/video-core/dist/schema.js +2 -0
  313. package/node_modules/@allyhub-next/video-core/dist/script-edit.d.ts +176 -0
  314. package/node_modules/@allyhub-next/video-core/dist/script-edit.js +2 -0
  315. package/node_modules/@allyhub-next/video-core/dist/script.d.ts +67 -0
  316. package/node_modules/@allyhub-next/video-core/dist/script.js +2 -0
  317. package/node_modules/@allyhub-next/video-core/dist/seams.d.ts +214 -0
  318. package/node_modules/@allyhub-next/video-core/dist/seams.js +2 -0
  319. package/node_modules/@allyhub-next/video-core/dist/slides.d.ts +37 -0
  320. package/node_modules/@allyhub-next/video-core/dist/slides.js +2 -0
  321. package/node_modules/@allyhub-next/video-core/dist/sound-under.d.ts +72 -0
  322. package/node_modules/@allyhub-next/video-core/dist/sound-under.js +2 -0
  323. package/node_modules/@allyhub-next/video-core/dist/speech.d.ts +83 -0
  324. package/node_modules/@allyhub-next/video-core/dist/speech.js +5 -0
  325. package/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +616 -0
  326. package/node_modules/@allyhub-next/video-core/dist/timeline.js +2 -0
  327. package/node_modules/@allyhub-next/video-core/dist/timing.d.ts +88 -0
  328. package/node_modules/@allyhub-next/video-core/dist/timing.js +2 -0
  329. package/node_modules/@allyhub-next/video-core/dist/transcript.d.ts +288 -0
  330. package/node_modules/@allyhub-next/video-core/dist/transcript.js +2 -0
  331. package/node_modules/@allyhub-next/video-core/dist/transition.d.ts +289 -0
  332. package/node_modules/@allyhub-next/video-core/dist/transition.js +2 -0
  333. package/node_modules/@allyhub-next/video-core/dist/voice.d.ts +175 -0
  334. package/node_modules/@allyhub-next/video-core/dist/voice.js +2 -0
  335. package/node_modules/@allyhub-next/video-core/dist/words.d.ts +128 -0
  336. package/node_modules/@allyhub-next/video-core/dist/words.js +2 -0
  337. package/node_modules/@allyhub-next/video-core/package.json +14 -0
  338. package/package.json +52 -41
  339. package/README.md +0 -17
  340. package/dist/anim.d.ts.map +0 -1
  341. package/dist/anim.js.map +0 -1
  342. package/dist/define.d.ts.map +0 -1
  343. package/dist/define.js.map +0 -1
  344. package/dist/dom.d.ts.map +0 -1
  345. package/dist/dom.js.map +0 -1
  346. package/dist/fit.d.ts.map +0 -1
  347. package/dist/fit.js.map +0 -1
  348. package/dist/index.d.ts.map +0 -1
  349. package/dist/index.js.map +0 -1
  350. package/dist/media.d.ts.map +0 -1
  351. package/dist/media.js.map +0 -1
  352. package/dist/messages.d.ts.map +0 -1
  353. package/dist/messages.js.map +0 -1
  354. package/dist/noise.d.ts.map +0 -1
  355. package/dist/noise.js.map +0 -1
  356. package/dist/parts.d.ts.map +0 -1
  357. package/dist/parts.js.map +0 -1
  358. package/dist/paths.d.ts.map +0 -1
  359. package/dist/paths.js.map +0 -1
  360. package/dist/piece.d.ts.map +0 -1
  361. package/dist/piece.js.map +0 -1
  362. package/dist/props.d.ts.map +0 -1
  363. package/dist/props.js.map +0 -1
  364. package/dist/text.d.ts.map +0 -1
  365. package/dist/text.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ const x={"**":"strong","*":"em","~~":"strike","`":"code"},g=/\\([\\*~`])|\*\*|~~|\*|`/g,k=/\s/u;function m(i){const o=[];let d=0;for(const e of i.matchAll(g)){if(e.index>d&&o.push({kind:"text",text:i.slice(d,e.index)}),d=e.index+e[0].length,e[1]!==void 0){o.push({kind:"escape",text:e[1]});continue}const s=i[e.index-1],u=i[d];o.push({kind:"delim",text:e[0],opens:u!==void 0&&!k.test(u),closes:s!==void 0&&!k.test(s)})}return d<i.length&&o.push({kind:"text",text:i.slice(d)}),o}export const hasMarks=i=>/[*~`\\]/.test(i);export function readMarks(i){if(!hasMarks(i))return{text:i,marks:[]};const o=m(i),d=[];for(let t=0;t<o.length;t++){const n=o[t];if(n?.kind!=="delim")continue;if(n.text==="`"){const c=o.findIndex((p,h)=>h>t&&p.kind==="delim"&&p.text==="`");if(c<0)continue;const a=o[c];n.pair=c,a?.kind==="delim"&&(a.pair=t),t=c;continue}let r=-1;if(n.closes)for(let c=d.length-1;c>=0&&r<0;c--)o[d[c]??-1]?.text===n.text&&(r=c);const f=d[r],l=f===void 0?void 0:o[f];f!==void 0&&l?.kind==="delim"&&f<t-1?(l.pair=t,n.pair=f,d.length=r):n.opens&&d.push(t)}let e="";const s=[],u=new Map;for(let t=0;t<o.length;t++){const n=o[t];if(!n)continue;if(n.kind!=="delim"){e+=n.text;continue}if(n.pair===void 0){e+=n.text;continue}const r=x[n.text];if(r===void 0)continue;if(n.pair>t){if(u.set(t,e.length),r!=="code")continue;for(let l=t+1;l<n.pair;l++){const c=o[l];c&&(e+=c.kind==="escape"?`\\${c.text}`:c.text)}t=n.pair-1;continue}const f=u.get(n.pair);f!==void 0&&e.length>f&&s.push({at:f,end:e.length,kind:r})}return s.sort((t,n)=>t.at-n.at||n.end-t.end),{text:e,marks:s}}export const withoutMarks=i=>readMarks(i).text;const M=["strong","em","strike","code"];export function markRuns(i,o=[]){const d=[...new Set([0,i.length,...o.flatMap(s=>[s.at,s.end])])].filter(s=>s>=0&&s<=i.length).sort((s,u)=>s-u),e=[];return d.forEach((s,u)=>{const t=d[u+1];if(t===void 0||t<=s)return;const n=o.filter(r=>r.at<=s&&t<=r.end);e.push({text:i.slice(s,t),kinds:M.filter(r=>n.some(f=>f.kind===r))})}),e}
@@ -0,0 +1,289 @@
1
+ import type { VideoFormat } from "./formats.js";
2
+ /** One point of the matrix: dimension or slot → value, e.g. { lang: "en", hook: "price" }. */
3
+ export type Combo = Record<string, string>;
4
+ /** Dimensions → values, in the order they were declared. */
5
+ export type Dims = Record<string, string[]>;
6
+ /** A candidate of a slot, with tags rules can name (`#price`). */
7
+ export interface Candidate {
8
+ name: string;
9
+ tags?: string[];
10
+ }
11
+ /** A slot whose candidates are the media files of a folder: one per file, named by its stem. */
12
+ export interface PoolSlot {
13
+ /** The folder, relative to the piece's file. */
14
+ pool: string;
15
+ /** Tags every file of the pool has (a file's `<stem>.meta.json` may add its own). */
16
+ tags?: string[];
17
+ }
18
+ /** A slot's candidates: names (or names with tags), or a pool folder. */
19
+ export type SlotDecl = readonly (string | Candidate)[] | PoolSlot;
20
+ /** A condition's value: a name, `#tag`, or any of several. */
21
+ export type MatchValue = string | readonly string[];
22
+ /** Slot, dimension or `structure` → the value it must have. */
23
+ export type Conditions = Record<string, MatchValue>;
24
+ /**
25
+ * A rule: when every `if` condition holds (or there is no `if`), every
26
+ * `require` condition must hold and no `exclude` condition may.
27
+ */
28
+ export interface MatrixRule {
29
+ if?: Conditions;
30
+ require?: Conditions;
31
+ exclude?: Conditions;
32
+ }
33
+ /** How different any two chosen combos must be. */
34
+ export interface Differ {
35
+ /** In at least this many slots (a different structure counts as one). */
36
+ slots?: number;
37
+ /**
38
+ * Their openings differ: the first n slots of each structure, or these
39
+ * slots, are not all the same.
40
+ */
41
+ first?: readonly string[] | number;
42
+ }
43
+ /** A piece's `matrix`: plain data. */
44
+ export interface Matrix {
45
+ /** Dimensions, crossed in full with every chosen slot combination. */
46
+ dims?: Dims;
47
+ /** Slots and their candidates (`ctx.combo.<slot>` is the pick). */
48
+ slots?: Record<string, SlotDecl>;
49
+ /** Named orders of slots; default: one structure of every slot in order. */
50
+ structures?: Record<string, readonly string[]>;
51
+ /**
52
+ * The slot combinations to make, chosen by the agent: each names its
53
+ * structure (when the piece declares structures) and one candidate per
54
+ * slot of it. Ids c01… in this order. Nothing is sampled, so `pick` and
55
+ * `seed` cannot be given with it.
56
+ */
57
+ combos?: readonly Combo[];
58
+ /** How many slot combinations sampling chooses; default: every one the rules allow. */
59
+ pick?: number;
60
+ /** Seeds sampling's choice among equally good combinations; default 1. */
61
+ seed?: number | string;
62
+ differ?: Differ;
63
+ rules?: readonly MatrixRule[];
64
+ }
65
+ /** Names a dimension or slot cannot have. */
66
+ export declare const RESERVED_DIMS: readonly ["size", "format", "piece", "output", "token", "structure", "id"];
67
+ /** The combo key of a matrix's structure, when it declares structures. */
68
+ export declare const STRUCTURE = "structure";
69
+ /**
70
+ * The combo key: names sorted, `name=value` joined by commas, e.g.
71
+ * `hook=price,lang=en`. `default` when there are none.
72
+ */
73
+ export declare function comboKey(c: Combo): string;
74
+ /** `lang=zh-cn,opening=hook` → { lang: "zh-cn", opening: "hook" }. */
75
+ export declare function parseComboKey(key: string): Combo;
76
+ /** Every combo of the dimensions, the first values first. */
77
+ export declare function expandCombos(dims: Dims): Combo[];
78
+ /** A filter's key for a combo id (`--combo c03`). */
79
+ export declare const COMBO_ID = "#id";
80
+ /**
81
+ * Whether a combo matches a filter: every given name equal. A filter
82
+ * `{ "#id": "c03" }` matches the combo whose id is `id`.
83
+ */
84
+ export declare function comboMatches(c: Combo, filter: Combo, id?: string): boolean;
85
+ /**
86
+ * The key the runtime's random seed is built from: the combo key with the
87
+ * format in it as `size=<format>` (`size` is never a dimension). A part's
88
+ * seed is "piece id + output + this key (of the dimensions only) + part
89
+ * key + frame number in the part".
90
+ */
91
+ export declare function seedKey(c: Combo, format: string): string;
92
+ /** The defaults the framework fills in: languages and formats. */
93
+ export interface MatrixDefaults {
94
+ /** Locales of assets/text/, the default first. */
95
+ locales: readonly string[];
96
+ /** Formats of a piece that does not declare `formats`. */
97
+ formats: readonly VideoFormat[];
98
+ }
99
+ /**
100
+ * A piece's dimensions as the framework uses them: `lang` from the
101
+ * messages files when the piece does not say (and there are messages).
102
+ * Declared dimensions keep their order and values.
103
+ */
104
+ export declare function resolveDims(declared: Dims | undefined, defaults: Pick<MatrixDefaults, "locales">): Dims;
105
+ /** A candidate as the build resolved it. */
106
+ export interface SlotCandidate {
107
+ name: string;
108
+ tags: string[];
109
+ /** A pool's file, relative to the project. */
110
+ file?: string;
111
+ }
112
+ /** The slots and structures a combo is made of, as the build resolved them. */
113
+ export interface MatrixSpace {
114
+ /** Slot → candidates, in declared order. */
115
+ slots: Record<string, SlotCandidate[]>;
116
+ /** Structure → its slots in order (one implicit "default" when none are declared). */
117
+ structures: Record<string, string[]>;
118
+ /** The piece declares structures: every combo names its own (`combo.structure`). */
119
+ declared: boolean;
120
+ }
121
+ /** Whether the piece has slots. */
122
+ export declare const hasSlots: (space: MatrixSpace | undefined) => space is MatrixSpace;
123
+ /** The structures a matrix's slots make: its own, or every slot in order. */
124
+ export declare function structuresOf(slots: readonly string[], declared: Record<string, readonly string[]> | undefined): Record<string, string[]>;
125
+ /** The structure a combo has. */
126
+ export declare function structureOf(space: MatrixSpace, c: Combo): string | undefined;
127
+ /** The slots of a combo, in its structure's order. */
128
+ export declare function slotsOf(space: MatrixSpace, c: Combo): string[];
129
+ /** The slot part of a combo: its structure (when declared) and its picks. */
130
+ export declare function slotCombo(space: MatrixSpace, c: Combo): Combo;
131
+ /** The dimension part of a combo. */
132
+ export declare function dimsCombo(dims: Dims, c: Combo): Combo;
133
+ /** Conditions as people read them: `hook=#price cta=sale|trial`. */
134
+ export declare function conditionsText(c: Conditions | undefined): string;
135
+ /** A rule as people read it: `if hook=#price require cta=sale`. */
136
+ export declare function ruleText(r: MatrixRule): string;
137
+ type Verdict = "yes" | "no" | "unknown";
138
+ /**
139
+ * Whether a point keeps a rule: "no" when it breaks it, "unknown" when that
140
+ * depends on a dimension the point does not have yet.
141
+ */
142
+ export declare function keepsRule(space: MatrixSpace, dims: Dims, rule: MatrixRule, point: Combo): Verdict;
143
+ /** Whether a point keeps every rule (unknown counts as kept). */
144
+ export declare function keepsRules(space: MatrixSpace, dims: Dims, rules: readonly MatrixRule[], point: Combo): boolean;
145
+ /** Whether a combo is one the matrix can make: its dimensions, structure and picks are known, and it keeps the rules. */
146
+ export declare function validCombo(space: MatrixSpace | undefined, dims: Dims, rules: readonly MatrixRule[], c: Combo): boolean;
147
+ /**
148
+ * What is wrong with a matrix's slots, structures, rules, pick and differ
149
+ * (AK-X001), as sentences; empty when nothing is.
150
+ */
151
+ export declare function matrixProblems(space: MatrixSpace, dims: Dims, m: Pick<Matrix, "rules" | "differ" | "structures">): string[];
152
+ /** A chosen slot combination: its id, picks and why it was chosen. */
153
+ export interface MatrixPick {
154
+ /** c01, c02…: the order it was chosen in. */
155
+ id: string;
156
+ /** The structure (when the piece declares structures) and one candidate per slot. */
157
+ combo: Combo;
158
+ /** Why it was chosen, in a few words each. */
159
+ why: string[];
160
+ }
161
+ export interface Sampled {
162
+ picks: MatrixPick[];
163
+ /** Slot combinations before the rules, and those the rules allow. */
164
+ total: number;
165
+ valid: number;
166
+ /** Pairs of picks closer than `differ` allows (when it could not hold). */
167
+ tooClose: {
168
+ a: string;
169
+ b: string;
170
+ slots: number;
171
+ opening: boolean;
172
+ }[];
173
+ /** Candidates in no pick (slot → names). */
174
+ unused: Record<string, string[]>;
175
+ }
176
+ /** The most slot combinations sampling looks at. */
177
+ export declare const MAX_COMBINATIONS = 100000;
178
+ /** How many slot combinations the structures make, before the rules. */
179
+ export declare function combinationCount(space: MatrixSpace): number;
180
+ /** In how many slots two slot combinations differ (a different structure counts as one). */
181
+ export declare function comboDistance(space: MatrixSpace, a: Combo, b: Combo): number;
182
+ /** The id of the nth pick (from 0): c01… with as many digits as the count needs. */
183
+ export declare function pickId(n: number, count: number): string;
184
+ /**
185
+ * Chooses `pick` slot combinations the rules allow, deterministic for the
186
+ * same definition. Greedy, best first:
187
+ *
188
+ * 1. combinations that keep `differ` against every earlier pick (when none
189
+ * is left, the closest-to-keeping one, reported in `tooClose`);
190
+ * 2. that use the most candidates (and structures) no pick uses yet, so
191
+ * every candidate appears at least once when it can;
192
+ * 3. whose candidates are used least so far, so use spreads evenly;
193
+ * 4. that make the most pairs of picks not seen together yet;
194
+ * 5. that differ most from the nearest earlier pick;
195
+ * 6. then the seed decides.
196
+ */
197
+ export declare function sampleMatrix(space: MatrixSpace, dims: Dims, m: Pick<Matrix, "pick" | "seed" | "differ" | "rules">): Sampled;
198
+ /**
199
+ * What is wrong with the names of matrix.combos (AK-X001), as sentences:
200
+ * a structure, slot or candidate that does not exist, a slot of its
201
+ * structure it lacks, or a dimension (dimensions are crossed with every
202
+ * combo). Empty when nothing is.
203
+ */
204
+ export declare function combosProblems(space: MatrixSpace, dims: Dims, combos: readonly Combo[]): string[];
205
+ /** The combos matrix.combos chose, with what the rules and differ say of them. */
206
+ export interface ChosenPicks {
207
+ /** In the given order: c01, c02… */
208
+ picks: MatrixPick[];
209
+ /** Slot combinations before the rules. */
210
+ total: number;
211
+ /**
212
+ * Those the rules allow; absent when the slots make more than
213
+ * MAX_COMBINATIONS, which are not counted.
214
+ */
215
+ valid?: number;
216
+ /** Picks a rule rules out (AK-X002): the pick's id and the rules' numbers, from 1. */
217
+ broken: {
218
+ id: string;
219
+ rules: number[];
220
+ }[];
221
+ /**
222
+ * Pairs of picks closer than `differ` allows, or the same (AK-X004).
223
+ * Without differ, only the same combo twice.
224
+ */
225
+ tooClose: Sampled["tooClose"];
226
+ /** Candidates in no pick (slot → names). */
227
+ unused: Record<string, string[]>;
228
+ }
229
+ /**
230
+ * The picks matrix.combos names, in its order, each with its structure
231
+ * (when the piece declares structures) and its slots in the structure's
232
+ * order. Expects names combosProblems finds nothing wrong with.
233
+ */
234
+ export declare function chosenPicks(space: MatrixSpace, dims: Dims, m: Pick<Matrix, "combos" | "differ" | "rules">): ChosenPicks;
235
+ /** A combo the piece makes: its id (pieces with slots), key and the pick it crosses. */
236
+ export interface ChosenCombo {
237
+ /** c01, or c01-zh-cn when there are several points of the dimensions. */
238
+ id: string;
239
+ combo: Combo;
240
+ /** The slot pick's id (c01). */
241
+ pick: string;
242
+ }
243
+ /**
244
+ * The chosen picks crossed with every combo of the dimensions, keeping
245
+ * the rules that name dimensions. Ids add the dimensions' values when
246
+ * there is more than one combo of them.
247
+ */
248
+ export declare function crossPicks(space: MatrixSpace, dims: Dims, rules: readonly MatrixRule[], picks: readonly MatrixPick[]): {
249
+ combos: ChosenCombo[];
250
+ dropped: Combo[];
251
+ };
252
+ /** A piece's matrix as the build resolved and sampled it (pieces with slots). */
253
+ export interface MatrixPlan {
254
+ space: MatrixSpace;
255
+ rules: MatrixRule[];
256
+ /** How the slot combinations were chosen: named in matrix.combos, or sampled. */
257
+ choice: "combos" | "sampling";
258
+ /** What the piece asked sampling for. */
259
+ pick?: number;
260
+ seed?: number | string;
261
+ differ?: Differ;
262
+ /** The chosen slot combinations, in order. */
263
+ picks: MatrixPick[];
264
+ /** The picks crossed with the dimensions: what is checked and rendered. */
265
+ combos: ChosenCombo[];
266
+ /** Slot combinations before the rules. */
267
+ total: number;
268
+ /**
269
+ * Those the rules allow; absent when matrix.combos chose among more
270
+ * than MAX_COMBINATIONS, which are not counted.
271
+ */
272
+ valid?: number;
273
+ /** Crossings a rule naming a dimension left out. */
274
+ dropped: Combo[];
275
+ tooClose: Sampled["tooClose"];
276
+ unused: Sampled["unused"];
277
+ }
278
+ /** A combo's id, when the piece has slots and chose it. */
279
+ export declare function comboIdOf(plan: Pick<MatrixPlan, "combos"> | undefined, combo: Combo): string | undefined;
280
+ /**
281
+ * A few combos that between them have every candidate (and structure) of
282
+ * the others, for each point of the dimensions: the check loads only
283
+ * these, since a part reads only its own slot's pick (AK-X005) and so
284
+ * looks the same in every combo that has it. Indexes into `combos`, in
285
+ * their order; greedy, the combo that adds the most first.
286
+ */
287
+ export declare function coverCombos(space: MatrixSpace, dims: Dims, combos: readonly Combo[]): number[];
288
+ export {};
289
+ //# sourceMappingURL=matrix.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ export const RESERVED_DIMS=["size","format","piece","output","token","structure","id"],STRUCTURE="structure";export function comboKey(t){const o=Object.keys(t).sort();return o.length===0?"default":o.map(n=>`${n}=${t[n]??""}`).join(",")}export function parseComboKey(t){if(t==="default"||t==="")return{};const o={};for(const n of t.split(",")){const e=n.indexOf("=");e<=0||(o[n.slice(0,e).trim()]=n.slice(e+1).trim())}return o}export function expandCombos(t){let o=[{}];for(const[n,e]of Object.entries(t)){const s=[];for(const i of o)for(const u of e)s.push({...i,[n]:u});o=s}return o}export const COMBO_ID="#id";export function comboMatches(t,o,n){return Object.entries(o).every(([e,s])=>e===COMBO_ID?n===s||(n?.startsWith(`${s}-`)??!1):t[e]===s)}export function seedKey(t,o){return comboKey({...t,size:o})}export function resolveDims(t,o){const n={};(!t||!("lang"in t))&&o.locales.length>0&&(n.lang=[...o.locales]);for(const[e,s]of Object.entries(t??{}))n[e]=[...s];return n}export const hasSlots=t=>t!==void 0&&Object.keys(t.slots).length>0;export function structuresOf(t,o){return o&&Object.keys(o).length>0?Object.fromEntries(Object.entries(o).map(([n,e])=>[n,[...e]])):t.length>0?{default:[...t]}:{}}export function structureOf(t,o){return t.declared?o[STRUCTURE]:Object.keys(t.structures)[0]}export function slotsOf(t,o){const n=structureOf(t,o);return n===void 0?[]:t.structures[n]??[]}export function slotCombo(t,o){const n={},e=structureOf(t,o);t.declared&&e!==void 0&&(n[STRUCTURE]=e);for(const s of slotsOf(t,o)){const i=o[s];i!==void 0&&(n[s]=i)}return n}export function dimsCombo(t,o){const n={};for(const e of Object.keys(t)){const s=o[e];s!==void 0&&(n[e]=s)}return n}const P=t=>typeof t=="string"?[t]:t;export function conditionsText(t){return Object.entries(t??{}).map(([o,n])=>`${o}=${P(n).join("|")}`).join(" ")}export function ruleText(t){return[t.if?`if ${conditionsText(t.if)}`:"",t.require?`require ${conditionsText(t.require)}`:"",t.exclude?`exclude ${conditionsText(t.exclude)}`:""].filter(Boolean).join(" ")}function z(t,o,n){return P(t).some(e=>e.startsWith("#")?n?.tags.includes(e.slice(1))??!1:e===o)}function E(t,o,n,e,s){if(e===STRUCTURE){const i=structureOf(t,n);return i!==void 0&&z(s,i,void 0)?"yes":"no"}if(e in t.slots){if(!slotsOf(t,n).includes(e))return"no";const i=n[e];if(i===void 0)return"no";const u=t.slots[e]?.find(c=>c.name===i);return z(s,i,u)?"yes":"no"}if(e in o){const i=n[e];return i===void 0?"unknown":z(s,i,void 0)?"yes":"no"}return"no"}const U=t=>t.includes("no")?"no":t.includes("unknown")?"unknown":"yes";export function keepsRule(t,o,n,e){const s=U(Object.entries(n.if??{}).map(([r,f])=>E(t,o,e,r,f)));if(s==="no")return"yes";const i=Object.entries(n.require??{}).map(([r,f])=>E(t,o,e,r,f)),u=Object.entries(n.exclude??{}).map(([r,f])=>{const d=E(t,o,e,r,f);return d==="yes"?"no":d==="no"?"yes":"unknown"}),c=U([...i,...u]);return c==="yes"?"yes":s==="unknown"||c==="unknown"?"unknown":"no"}export function keepsRules(t,o,n,e){return n.every(s=>keepsRule(t,o,s,e)!=="no")}export function validCombo(t,o,n,e){const s=new Set(Object.keys(e));for(const[u,c]of Object.entries(o)){if(!c.includes(e[u]??""))return!1;s.delete(u)}if(!hasSlots(t))return s.size===0;const i=structureOf(t,e);if(i===void 0||!(i in t.structures))return!1;t.declared&&s.delete(STRUCTURE);for(const u of slotsOf(t,e)){if(!t.slots[u]?.some(c=>c.name===e[u]))return!1;s.delete(u)}return s.size===0&&keepsRules(t,o,n,e)}export function matrixProblems(t,o,n){const e=[],s=Object.keys(t.slots);for(const r of s){r in o&&e.push(`${r} is both a dimension and a slot. Rename one of them.`);const f=t.slots[r]??[];f.length===0&&e.push(`Slot ${r} has no candidates.`);const d=new Set;for(const a of f)d.has(a.name)&&e.push(`Slot ${r} lists the candidate ${a.name} twice.`),d.add(a.name)}for(const[r,f]of Object.entries(n.structures??{})){f.length===0&&e.push(`Structure ${r} has no slots.`);for(const d of f)d in t.slots||e.push(`Structure ${r} names the slot ${d}, which matrix.slots does not declare (slots: ${s.join(", ")||"none"}).`);new Set(f).size!==f.length&&e.push(`Structure ${r} names a slot twice.`)}const i=new Set(Object.values(t.structures).flat());for(const r of s)i.has(r)||e.push(`Slot ${r} is in no structure. Add it to one, or remove it.`);const u=r=>r===STRUCTURE||r in t.slots||r in o;for(const[r,f]of(n.rules??[]).entries()){const d=`Rule ${String(r+1)}`,a=[f.if,f.require,f.exclude];!f.require&&!f.exclude&&e.push(`${d} has neither require nor exclude.`);for(const h of a)for(const[m,b]of Object.entries(h??{})){if(!u(m)){e.push(`${d} names ${m}, which is not a slot, a dimension or structure.`);continue}for(const $ of P(b))if(m===STRUCTURE)$ in t.structures||e.push(`${d} names the structure ${$}, which does not exist.`);else if(m in t.slots){const x=t.slots[m]??[];($.startsWith("#")?x.some(w=>w.tags.includes($.slice(1))):x.some(w=>w.name===$))||e.push($.startsWith("#")?`${d}: no candidate of ${m} has the tag ${$.slice(1)}.`:`${d}: ${m} has no candidate ${$} (candidates: ${x.map(w=>w.name).join(", ")}).`)}else(o[m]??[]).includes($)||e.push(`${d}: the dimension ${m} has no value ${$}.`)}}const c=n.differ?.first;if(Array.isArray(c))for(const r of c)r in t.slots||e.push(`differ.first names ${r}, which is not a slot.`);return e}export const MAX_COMBINATIONS=1e5;function Q(t){let o=2166136261;for(let n=0;n<t.length;n++)o^=t.charCodeAt(n),o=Math.imul(o,16777619);return o>>>0}export function combinationCount(t){let o=0;for(const n of Object.values(t.structures))o+=n.reduce((e,s)=>e*(t.slots[s]?.length??0),1);return o}function Y(t){const o=[];for(const[n,e]of Object.entries(t.structures)){let s=[t.declared?{[STRUCTURE]:n}:{}];for(const i of e){const u=[];for(const c of s)for(const r of t.slots[i]??[])u.push({...c,[i]:r.name});s=u}o.push(...s)}return o}export function comboDistance(t,o,n){let e=structureOf(t,o)===structureOf(t,n)?0:1;for(const s of Object.keys(t.slots)){const i=slotsOf(t,o).includes(s)?o[s]:void 0,u=slotsOf(t,n).includes(s)?n[s]:void 0;i!==u&&e++}return e}function T(t,o,n){return n===void 0?void 0:(typeof n=="number"?slotsOf(t,o).slice(0,n):slotsOf(t,o).filter(s=>n.includes(s))).map(s=>`${s}=${o[s]??""}`).join(",")}export function pickId(t,o){const n=Math.max(2,String(o).length);return`c${String(t+1).padStart(n,"0")}`}const D=(t,o)=>{const n=slotsOf(t,o).map(e=>`${e}=${o[e]??""}`);return t.declared&&n.push(`${STRUCTURE}=${o[STRUCTURE]??""}`),n},Z=(t,o)=>{const n=slotsOf(t,o),e=[];for(let s=0;s<n.length;s++)for(let i=s+1;i<n.length;i++){const u=n[s]??"",c=n[i]??"";e.push(`${u}=${o[u]??""}+${c}=${o[c]??""}`)}return e};export function sampleMatrix(t,o,n){const e=combinationCount(t),s=n.rules??[],i=L(t,o,s)??[],u=Math.min(n.pick??i.length,i.length),c=String(n.seed??1),r=n.differ?.slots??1,f=n.differ?.first,a=i.map(p=>comboKey(p)).map(p=>Q(`${c}:${p}`)),h=i.map(p=>D(t,p)),m=i.map(p=>Z(t,p)),b=i.map(p=>T(t,p,f)),$=i.map(()=>1/0),x=new Set,j=new Map,w=new Set,C=new Set,v=[],I=[],N=[];for(let p=0;p<u;p++){let g=-1,R=[];for(let l=0;l<i.length;l++){if(C.has(l))continue;const O=h[l]??[],k=($[l]??1/0)>=r&&!(b[l]!==void 0&&x.has(b[l]??"")),X=O.filter(S=>!j.has(S)).length,F=O.reduce((S,J)=>S+(j.get(J)??0),0),G=(m[l]??[]).filter(S=>!w.has(S)).length,H=Math.min($[l]??1/0,1e3),K=[k?1:0,X,-F,G,H,a[l]??0];(g<0||tt(K,R))&&(g=l,R=K)}if(g<0)break;const q=i[g]??{},M=h[g]??[],y=[],W=M.filter(l=>!j.has(l));if(p===0&&y.push("first pick"),W.length>0&&p>0)y.push(`first use of ${W.join(", ")}`);else if(p>0){const l=Math.min(...M.map(k=>j.get(k)??0)),O=M.filter(k=>(j.get(k)??0)===l);y.push(`spreads use: ${O.join(", ")} used ${String(l)}× so far`)}const A=(m[g]??[]).filter(l=>!w.has(l)).length;if(p>0&&A>0&&y.push(`${String(A)} new pairing${A===1?"":"s"}`),p>0){const l=$[g]??1/0;R[0]===1?y.push(`differs from every earlier pick in ≥ ${String(l)} slot${l===1?"":"s"}`):y.push(`no combination left keeps differ; closest earlier pick is ${String(l)} slot${l===1?"":"s"} away`)}const _=pickId(p,u);for(const l of I){const O=comboDistance(t,q,i[l]??{}),k=b[g]!==void 0&&b[g]===b[l];(O<r||k)&&N.push({a:v[I.indexOf(l)]?.id??"",b:_,slots:O,opening:k})}C.add(g),I.push(g),v.push({id:_,combo:q,why:y});for(const l of M)j.set(l,(j.get(l)??0)+1);for(const l of m[g]??[])w.add(l);const B=b[g];B!==void 0&&x.add(B);for(let l=0;l<i.length;l++){if(C.has(l))continue;const O=comboDistance(t,i[l]??{},q);O<($[l]??1/0)&&($[l]=O)}}return{picks:v,total:e,valid:i.length,tooClose:N,unused:V(t,v)}}function L(t,o,n){if(!(combinationCount(t)>MAX_COMBINATIONS))return Y(t).filter(e=>keepsRules(t,o,n,e))}function V(t,o){const n=new Set(o.flatMap(s=>D(t,s.combo))),e={};for(const[s,i]of Object.entries(t.slots)){const u=i.map(c=>c.name).filter(c=>!n.has(`${s}=${c}`));u.length>0&&(e[s]=u)}return e}function tt(t,o){for(let n=0;n<t.length;n++){const e=t[n]??0,s=o[n]??0;if(e!==s)return e>s}return!1}export function combosProblems(t,o,n){const e=[],s=Object.keys(t.structures),i=Object.keys(t.slots),u=c=>(t.slots[c]??[]).map(r=>r.name).join(", ");for(const[c,r]of n.entries()){const f=`combos[${String(c)}] (${pickId(c,n.length)})`;let d;const a=r[STRUCTURE];t.declared?a===void 0?e.push(`${f} names no structure: the piece declares structures (${s.join(", ")}). Add structure.`):a in t.structures?d=t.structures[a]:e.push(`${f} names the structure ${a}, which does not exist (structures: ${s.join(", ")}).`):(a!==void 0&&e.push(`${f} names a structure, but the piece declares none. Remove it, or declare matrix.structures.`),d=Object.values(t.structures)[0]);for(const[h,m]of Object.entries(r))h!==STRUCTURE&&(h in o?e.push(`${f} names the dimension ${h}: every combo is made in each of its values. Leave a value out with a rule naming ${h}.`):h in t.slots?d&&!d.includes(h)?e.push(`${f} names the slot ${h}, which the structure ${a??""} does not have (${d.join(", ")}).`):t.slots[h]?.some(b=>b.name===m)||e.push(`${f}: ${h} has no candidate ${m} (candidates: ${u(h)}).`):e.push(`${f} names ${h}, which is not a slot (slots: ${i.join(", ")}).`));for(const h of d??[])r[h]===void 0&&e.push(`${f} has no ${h}, a slot of ${t.declared?`the structure ${a??""}`:"the piece"}. Name one of its candidates (${u(h)}).`)}return e}export function chosenPicks(t,o,n){const e=n.combos??[],s=n.rules??[],i=e.map((a,h)=>{const m={},b=structureOf(t,a);t.declared&&b!==void 0&&(m[STRUCTURE]=b);for(const $ of slotsOf(t,a)){const x=a[$];x!==void 0&&(m[$]=x)}return{id:pickId(h,e.length),combo:m,why:["chosen in matrix.combos"]}}),u=[];for(const a of i){const h=s.flatMap((m,b)=>keepsRule(t,o,m,a.combo)==="no"?[b+1]:[]);h.length>0&&u.push({id:a.id,rules:h})}const c=n.differ?.slots??1,r=n.differ?.first,f=[];for(let a=0;a<i.length;a++)for(let h=0;h<a;h++){const m=i[h],b=i[a];if(!m||!b)continue;const $=comboDistance(t,m.combo,b.combo),x=T(t,m.combo,r),j=x!==void 0&&x===T(t,b.combo,r);($<c||j)&&f.push({a:m.id,b:b.id,slots:$,opening:j})}const d=L(t,o,s);return{picks:i,total:combinationCount(t),...d===void 0?{}:{valid:d.length},broken:u,tooClose:f,unused:V(t,i)}}export function crossPicks(t,o,n,e){const s=expandCombos(o),i=s.length>1,u=[],c=[];for(const r of e)for(const f of s){const d={...f,...r.combo};if(!keepsRules(t,o,n,d)){c.push(d);continue}u.push({id:i?[r.id,...Object.values(f)].join("-"):r.id,combo:d,pick:r.id})}return{combos:u,dropped:c}}export function comboIdOf(t,o){if(!t)return;const n=comboKey(o);return t.combos.find(e=>comboKey(e.combo)===n)?.id}export function coverCombos(t,o,n){const e=n.map(u=>{const c=comboKey(dimsCombo(o,u));return D(t,u).map(r=>`${c}|${r}`)}),s=new Set(e.flat()),i=new Set;for(;s.size>0;){let u=-1,c=0;if(e.forEach((r,f)=>{if(i.has(f))return;const d=r.filter(a=>s.has(a)).length;d>c&&(u=f,c=d)}),u<0)break;i.add(u);for(const r of e[u]??[])s.delete(r)}return[...i].sort((u,c)=>u-c)}