allyhub 0.14.0 → 0.15.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 (256) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/commands/frames.js +9 -11
  3. package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
  4. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  5. package/dist/node_modules/@allyhub/browser/package.json +1 -1
  6. package/dist/node_modules/@allyhub/build/package.json +1 -1
  7. package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
  8. package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
  9. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  10. package/dist/node_modules/@allyhub/check/package.json +1 -1
  11. package/dist/node_modules/@allyhub/cloud/package.json +1 -1
  12. package/dist/node_modules/@allyhub/components/package.json +1 -1
  13. package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
  14. package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
  15. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  16. package/dist/node_modules/@allyhub/doc/package.json +1 -1
  17. package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
  18. package/dist/node_modules/@allyhub/doc-print/dist/drawn.js +4 -4
  19. package/dist/node_modules/@allyhub/doc-print/dist/fonts.js +3 -3
  20. package/dist/node_modules/@allyhub/doc-print/dist/layout.js +4 -4
  21. package/dist/node_modules/@allyhub/doc-print/dist/pdf.js +4 -4
  22. package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
  23. package/dist/node_modules/@allyhub/export/package.json +1 -1
  24. package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
  25. package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
  26. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  27. package/dist/node_modules/@allyhub/i18n/package.json +1 -1
  28. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  29. package/dist/node_modules/@allyhub/image-extension/dist/cli.js +1 -1
  30. package/dist/node_modules/@allyhub/image-extension/dist/export.js +2 -2
  31. package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
  32. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  33. package/dist/node_modules/@allyhub/image-psd/dist/ag-psd.js +2 -0
  34. package/dist/node_modules/@allyhub/image-psd/dist/read.js +12 -12
  35. package/dist/node_modules/@allyhub/image-psd/dist/write.js +1 -1
  36. package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
  37. package/dist/node_modules/@allyhub/image-render/dist/pdf.js +1 -1
  38. package/dist/node_modules/@allyhub/image-render/package.json +1 -1
  39. package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
  40. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  41. package/dist/node_modules/@allyhub/jobs/package.json +1 -1
  42. package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -1
  43. package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
  44. package/dist/node_modules/@allyhub/linkedin-view/dist/stage.js +65 -1
  45. package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
  46. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  47. package/dist/node_modules/@allyhub/media/package.json +1 -1
  48. package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
  49. package/dist/node_modules/@allyhub/model/package.json +1 -1
  50. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  51. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  52. package/dist/node_modules/@allyhub/project/package.json +1 -1
  53. package/dist/node_modules/@allyhub/protocol/package.json +1 -1
  54. package/dist/node_modules/@allyhub/registry/package.json +1 -1
  55. package/dist/node_modules/@allyhub/render/dist/exports.js +2 -2
  56. package/dist/node_modules/@allyhub/render/package.json +1 -1
  57. package/dist/node_modules/@allyhub/runtime/package.json +1 -1
  58. package/dist/node_modules/@allyhub/runtimes/dist/index.d.ts +1 -1
  59. package/dist/node_modules/@allyhub/runtimes/dist/index.js +1 -1
  60. package/dist/node_modules/@allyhub/runtimes/dist/packages.d.ts +17 -0
  61. package/dist/node_modules/@allyhub/runtimes/dist/packages.js +3 -3
  62. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  63. package/dist/node_modules/@allyhub/runtimes/pins/ag-psd/package-lock.json +49 -0
  64. package/dist/node_modules/@allyhub/runtimes/pins/ag-psd/package.json +7 -0
  65. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-caladea/package-lock.json +24 -0
  66. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-caladea/package.json +23 -0
  67. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-carlito/package-lock.json +24 -0
  68. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-carlito/package.json +23 -0
  69. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-cousine/package-lock.json +24 -0
  70. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-cousine/package.json +23 -0
  71. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-lxgw-wenkai/package-lock.json +24 -0
  72. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-lxgw-wenkai/package.json +19 -0
  73. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-color-emoji/package-lock.json +24 -0
  74. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-color-emoji/package.json +17 -0
  75. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-sans-sc/package-lock.json +24 -0
  76. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-sans-sc/package.json +19 -0
  77. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-serif-sc/package-lock.json +24 -0
  78. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-noto-serif-sc/package.json +19 -0
  79. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-tinos/package-lock.json +24 -0
  80. package/dist/node_modules/@allyhub/runtimes/pins/fontsource-tinos/package.json +23 -0
  81. package/dist/node_modules/@allyhub/runtimes/pins/mermaid/package-lock.json +19 -0
  82. package/dist/node_modules/@allyhub/runtimes/pins/mermaid/package.json +15 -0
  83. package/dist/node_modules/@allyhub/runtimes/pins/pdf-lib/package-lock.json +55 -0
  84. package/dist/node_modules/@allyhub/runtimes/pins/pdf-lib/package.json +7 -0
  85. package/dist/node_modules/@allyhub/runtimes/pins/pptxgenjs/package-lock.json +169 -0
  86. package/dist/node_modules/@allyhub/runtimes/pins/pptxgenjs/package.json +7 -0
  87. package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
  88. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  89. package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
  90. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  91. package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
  92. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  93. package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
  94. package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
  95. package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
  96. package/dist/node_modules/@allyhub/stage/package.json +1 -1
  97. package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
  98. package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
  99. package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
  100. package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
  101. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  102. package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
  103. package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
  104. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  105. package/dist/node_modules/@allyhub/website/package.json +1 -1
  106. package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
  107. package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
  108. package/dist/node_modules/@allyhub/x-model/package.json +1 -1
  109. package/dist/node_modules/@allyhub/x-view/dist/stage.js +325 -1
  110. package/dist/node_modules/@allyhub/x-view/package.json +1 -1
  111. package/dist/package.json +12 -13
  112. package/dist/works.js +1 -1
  113. package/editor-web/assets/{abnfDiagram-WEYOIA3C-8aObBFjX.js → abnfDiagram-WEYOIA3C-BHI0AbUY.js} +1 -1
  114. package/editor-web/assets/{architecture-WOLXFQ4H-CUdbx3Bt.js → architecture-WOLXFQ4H-BMQS-OKZ.js} +1 -1
  115. package/editor-web/assets/{architectureDiagram-ZHVYKT53-CMsMcKog.js → architectureDiagram-ZHVYKT53-DZp9CM6P.js} +1 -1
  116. package/editor-web/assets/{article-Cp3YwYpj.js → article-C_mBG5a1.js} +4 -4
  117. package/editor-web/assets/{article-DNZHN4zd.js → article-DWBxNvX0.js} +2 -2
  118. package/editor-web/assets/{blockDiagram-RJAE7QA3-DfIz96sD.js → blockDiagram-RJAE7QA3-h6LWaev4.js} +1 -1
  119. package/editor-web/assets/{c4Diagram-XDPPPE54-CNYzslEF.js → c4Diagram-XDPPPE54-BvSMs7J4.js} +1 -1
  120. package/editor-web/assets/channel-BFHB0S0f.js +1 -0
  121. package/editor-web/assets/{chunk-2E7WHVMD-HL6GVd-n.js → chunk-2E7WHVMD-0EJTAmDF.js} +1 -1
  122. package/editor-web/assets/{chunk-4EMNKR2T-H7j6JGIP.js → chunk-4EMNKR2T-BeYB4AEY.js} +1 -1
  123. package/editor-web/assets/{chunk-55XCU76K-CG-CNnUw.js → chunk-55XCU76K-BPFOPTBe.js} +1 -1
  124. package/editor-web/assets/{chunk-7S6XSTFO-DBjGjTwH.js → chunk-7S6XSTFO-CZ2C7ULu.js} +1 -1
  125. package/editor-web/assets/{chunk-AQDTSKZB-C_-ymsUC.js → chunk-AQDTSKZB-B5RtsZkj.js} +1 -1
  126. package/editor-web/assets/{chunk-DSNLSHJZ-CHNAY_-p.js → chunk-DSNLSHJZ-_3G4hddj.js} +1 -1
  127. package/editor-web/assets/{chunk-HAGFOTED-Crk51Pir.js → chunk-HAGFOTED-DO5b4ll2.js} +1 -1
  128. package/editor-web/assets/{chunk-HNE4Q36P-wRakUuQt.js → chunk-HNE4Q36P-C6XNI71Q.js} +1 -1
  129. package/editor-web/assets/{chunk-NQOKRVIF-vbSfGzYF.js → chunk-NQOKRVIF-nDCX29rQ.js} +1 -1
  130. package/editor-web/assets/{chunk-UHW7PFBP-CBB6AHxp.js → chunk-UHW7PFBP-CRCOiitq.js} +1 -1
  131. package/editor-web/assets/{chunk-VQ5W62QI-B4LA3hAv.js → chunk-VQ5W62QI-hNPKKjCN.js} +1 -1
  132. package/editor-web/assets/{chunk-WQQL4CDK-BlkMq03F.js → chunk-WQQL4CDK-KlnVtIDc.js} +1 -1
  133. package/editor-web/assets/{chunk-YZO67HFG-zZbW2WUw.js → chunk-YZO67HFG-B76hDUrM.js} +1 -1
  134. package/editor-web/assets/{chunk-ZAUX2LTX-CyhuRyRc.js → chunk-ZAUX2LTX-D9m1N0wI.js} +1 -1
  135. package/editor-web/assets/{chunk-ZCHMQSOR-Z4gsBK-s.js → chunk-ZCHMQSOR-443euxzo.js} +1 -1
  136. package/editor-web/assets/{classDiagram-v2-4MYWR3UA-BO3pSpA3.js → classDiagram-v2-4MYWR3UA-Bbw-8Ons.js} +1 -1
  137. package/editor-web/assets/{cynefin-EF2NZ3EQ-BeGktmde.js → cynefin-EF2NZ3EQ-C4E7TlUr.js} +1 -1
  138. package/editor-web/assets/{cynefinDiagram-WF24UDRP-D4slNgjw.js → cynefinDiagram-WF24UDRP-PBPGa_HS.js} +1 -1
  139. package/editor-web/assets/{dagre-NK4GIZVX-CHX5BABb.js → dagre-NK4GIZVX-DwXdEtQG.js} +1 -1
  140. package/editor-web/assets/{diagram-CBK3MWTC-B_DCSy7B.js → diagram-CBK3MWTC-BE3FwdX7.js} +1 -1
  141. package/editor-web/assets/{diagram-I5XIIV2D-C87ZLuZE.js → diagram-I5XIIV2D-BPl2ZY33.js} +1 -1
  142. package/editor-web/assets/{diagram-ODIL2UCW-qqQWBi5z.js → diagram-ODIL2UCW-BLVPYSzw.js} +1 -1
  143. package/editor-web/assets/{diagram-PFBEJUXE-51Kpu1XH.js → diagram-PFBEJUXE-BVZk62FO.js} +1 -1
  144. package/editor-web/assets/{diagram-RJA3I4VV-BYCd_UhW.js → diagram-RJA3I4VV-Z75LSbxH.js} +1 -1
  145. package/editor-web/assets/{diagram-TYUNFSNR-ti0bjc0a.js → diagram-TYUNFSNR-BynGqDAg.js} +1 -1
  146. package/editor-web/assets/{dist-m2WnTa2Z.js → dist--ijXGgvi.js} +3 -3
  147. package/editor-web/assets/{dist-DrnrJj5f.js → dist-C-yi9AAi.js} +14 -14
  148. package/editor-web/assets/dist-CIQUbiAd.js +38 -0
  149. package/editor-web/assets/{dist-CLraEmr5.js → dist-Ch34PllS.js} +1 -1
  150. package/editor-web/assets/dist-CxlIyluY.js +43 -0
  151. package/editor-web/assets/dist-DWKEqAou.js +6 -0
  152. package/editor-web/assets/{dist-BzZrQT5-.js → dist-DX0VLTRV.js} +3 -3
  153. package/editor-web/assets/dist-D_xVYGnk.js +45 -0
  154. package/editor-web/assets/{dist-DhGv_Zov.js → dist-Nc_h0Jye.js} +3 -3
  155. package/editor-web/assets/dist-UG2TIZxP.js +16 -0
  156. package/editor-web/assets/dist-VP4ECMOk.js +1 -0
  157. package/editor-web/assets/dist-cUeSwqws.js +1 -0
  158. package/editor-web/assets/dist-xpAaABxb.js +24 -0
  159. package/editor-web/assets/{ebnfDiagram-V4P3TTPT-47g4MzmE.js → ebnfDiagram-V4P3TTPT-SwhqbeK4.js} +1 -1
  160. package/editor-web/assets/{elk-QONTBCTQ-D-MJPm-u.js → elk-QONTBCTQ-Bb1GSt2Z.js} +1 -1
  161. package/editor-web/assets/{erDiagram-KYQIGQAA-Cf6zVz1i.js → erDiagram-KYQIGQAA-qUy0NDKn.js} +1 -1
  162. package/editor-web/assets/{eventmodeling-K75KTNOO-DfgBzRXB.js → eventmodeling-K75KTNOO-BYBYso_j.js} +1 -1
  163. package/editor-web/assets/file-exclamation-point-C_fX4fpI.js +1 -0
  164. package/editor-web/assets/flowDiagram-IUGLLWBU-BSCBBtP3.js +1 -0
  165. package/editor-web/assets/{ganttDiagram-R7GPNTJY-ChnlDXK8.js → ganttDiagram-R7GPNTJY-Cw-BkZT8.js} +1 -1
  166. package/editor-web/assets/{gitGraph-VSP46ZUC-CNvvzSaC.js → gitGraph-VSP46ZUC-CTXzWPq_.js} +1 -1
  167. package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-C9UYgumu.js → gitGraphDiagram-PDYL7XHY-Jd9HU3WA.js} +1 -1
  168. package/editor-web/assets/index-Br4a-QEv.css +2 -0
  169. package/editor-web/assets/{index-DmztYiAy.js → index-CglHrLRS.js} +2 -2
  170. package/editor-web/assets/{info-OHQRW6UA-D61jDQBy.js → info-OHQRW6UA-C4oj5BpF.js} +1 -1
  171. package/editor-web/assets/{infoDiagram-MVDRKAX5-ChN_DTt7.js → infoDiagram-MVDRKAX5-D09aYJ28.js} +1 -1
  172. package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-BYLy6pVq.js → ishikawaDiagram-HPEHV2GE-BEdXoXb2.js} +1 -1
  173. package/editor-web/assets/{journeyDiagram-BOSHW7O7-CPZ_qfLP.js → journeyDiagram-BOSHW7O7-DE-_0aww.js} +1 -1
  174. package/editor-web/assets/{kanban-definition-FNSA4HC5-CVwcgf4Q.js → kanban-definition-FNSA4HC5-Cn3_bvPS.js} +1 -1
  175. package/editor-web/assets/{mermaid-parser.core-C-N4DR9l.js → mermaid-parser.core-BK52JMZH.js} +3 -3
  176. package/editor-web/assets/{mermaid.core-DA4RESHs.js → mermaid.core-CmfBU89G.js} +4 -4
  177. package/editor-web/assets/{mindmap-definition-6OY57UG3-CYTwW2kr.js → mindmap-definition-6OY57UG3-CtUhkv9I.js} +1 -1
  178. package/editor-web/assets/{packet-JDAUHWVQ-ChMUmP4L.js → packet-JDAUHWVQ-C7nciBNp.js} +1 -1
  179. package/editor-web/assets/{pegDiagram-ECIUJNBX-BhEQqZjT.js → pegDiagram-ECIUJNBX-DUkbAcTs.js} +1 -1
  180. package/editor-web/assets/{pie-XZMESJXO-BNR0TC-m.js → pie-XZMESJXO-BIGyKhav.js} +1 -1
  181. package/editor-web/assets/{pieDiagram-GNMPY74T-Yp8QKrUl.js → pieDiagram-GNMPY74T-DrYj-JeG.js} +1 -1
  182. package/editor-web/assets/{props-form-DhAZXuUd.js → props-form-DrZYDmSM.js} +1 -1
  183. package/editor-web/assets/{quadrantDiagram-D57K4MC3-DWx6h-WX.js → quadrantDiagram-D57K4MC3-qkBoh1ep.js} +1 -1
  184. package/editor-web/assets/{radar-ABXABTNO-CTYk7YEu.js → radar-ABXABTNO-BkJmvR6a.js} +1 -1
  185. package/editor-web/assets/{railroad-I3PHUGI6-BlyTPvKD.js → railroad-I3PHUGI6-BFH-ip4B.js} +1 -1
  186. package/editor-web/assets/{railroad-abnf-LNEFI6M7-CZ2V2N02.js → railroad-abnf-LNEFI6M7-BBlzHL6Z.js} +1 -1
  187. package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-CBgU-FLz.js → railroad-ebnf-DWYD2UWJ-CCVsG0ui.js} +1 -1
  188. package/editor-web/assets/{railroad-peg-JR7BVNR7-CflVoiT7.js → railroad-peg-JR7BVNR7-Puo7BFPl.js} +1 -1
  189. package/editor-web/assets/{railroadDiagram-Y72NRBL7-CYZ2kXNJ.js → railroadDiagram-Y72NRBL7-DCwfkv35.js} +1 -1
  190. package/editor-web/assets/{requirementDiagram-EQYSW5RA-D4eEJPbs.js → requirementDiagram-EQYSW5RA-DSTcDj32.js} +1 -1
  191. package/editor-web/assets/{sankeyDiagram-SY24JHO5-CSOvThfE.js → sankeyDiagram-SY24JHO5-Kqq4fCvG.js} +1 -1
  192. package/editor-web/assets/schemas-B89k2jEC.js +1 -0
  193. package/editor-web/assets/scissors-BURkYWPv.js +1 -0
  194. package/editor-web/assets/search-jKDvFIEU.js +1 -0
  195. package/editor-web/assets/{sequenceDiagram-BLEHNHQU-Daz5aJOq.js → sequenceDiagram-BLEHNHQU-B1uodEgL.js} +1 -1
  196. package/editor-web/assets/{split-BRdiwbHG.js → split-Cu0fidVK.js} +1 -1
  197. package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-7fYxau3w.js → stateDiagram-v2-A6IESKWZ-B6gG3vUm.js} +1 -1
  198. package/editor-web/assets/surface-D9qJjJQL.js +1 -0
  199. package/editor-web/assets/swatch-S8YuBYyj.js +1 -0
  200. package/editor-web/assets/{swimlanes-B3ENRKFQ-PvWj6MaB.js → swimlanes-B3ENRKFQ-CZayRtvU.js} +1 -1
  201. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-B9tLTrym.js +8 -0
  202. package/editor-web/assets/syntax-DSsHrzWF.js +1 -0
  203. package/editor-web/assets/tabs-B_K0Db1I.js +1 -0
  204. package/editor-web/assets/{timeline-definition-JXYKGLGB-DM74MMtl.js → timeline-definition-JXYKGLGB-5YoY8Xhw.js} +1 -1
  205. package/editor-web/assets/{treeView-D4JQ5SDB-CpxiEjIR.js → treeView-D4JQ5SDB-Brd_NUPx.js} +1 -1
  206. package/editor-web/assets/{treemap-SAJKECNS-qiS2PdWZ.js → treemap-SAJKECNS-DmfdnlWl.js} +1 -1
  207. package/editor-web/assets/{usecaseDiagram-WPOLBNNX-CtqoB1RY.js → usecaseDiagram-WPOLBNNX-lcAkMviI.js} +1 -1
  208. package/editor-web/assets/{vennDiagram-Q3Y3IDCW-CzTC1h8Z.js → vennDiagram-Q3Y3IDCW-DY_n48hQ.js} +1 -1
  209. package/editor-web/assets/{video-_FVN5Mu3.js → video-Bv3rETBU.js} +1 -1
  210. package/editor-web/assets/{wardley-7MLQ67FV-CzagHSqx.js → wardley-7MLQ67FV-DzIFSBQz.js} +1 -1
  211. package/editor-web/assets/{wardleyDiagram-IVAIDKWA-DHnCuUHn.js → wardleyDiagram-IVAIDKWA-CsXNajIg.js} +1 -1
  212. package/editor-web/assets/whole-word-6DliXke2.js +1 -0
  213. package/editor-web/assets/{words-Cn65rXEp.js → words-BTRrBFUo.js} +1 -1
  214. package/editor-web/assets/{words-4adjjnra.js → words-ll_94CD2.js} +1 -1
  215. package/editor-web/assets/{xychartDiagram-4URNHDU4-H8q7BDE8.js → xychartDiagram-4URNHDU4-DDpGFEum.js} +1 -1
  216. package/editor-web/index.html +2 -2
  217. package/package.json +2 -25
  218. package/dist/commands/frames/report.js +0 -2
  219. package/dist/node_modules/@allyhub/report-extension/LICENSE +0 -241
  220. package/dist/node_modules/@allyhub/report-extension/dist/build.js +0 -2
  221. package/dist/node_modules/@allyhub/report-extension/dist/check.js +0 -3
  222. package/dist/node_modules/@allyhub/report-extension/dist/cli/find.js +0 -2
  223. package/dist/node_modules/@allyhub/report-extension/dist/cli/index.js +0 -5
  224. package/dist/node_modules/@allyhub/report-extension/dist/cli/picture.js +0 -30
  225. package/dist/node_modules/@allyhub/report-extension/dist/export.js +0 -2
  226. package/dist/node_modules/@allyhub/report-extension/dist/inline.js +0 -58
  227. package/dist/node_modules/@allyhub/report-extension/dist/page.js +0 -21
  228. package/dist/node_modules/@allyhub/report-extension/dist/project-tools.js +0 -21
  229. package/dist/node_modules/@allyhub/report-extension/dist/styles.js +0 -5
  230. package/dist/node_modules/@allyhub/report-extension/dist/theme.js +0 -2
  231. package/dist/node_modules/@allyhub/report-extension/dist/tools.js +0 -2
  232. package/dist/node_modules/@allyhub/report-extension/dist/workspace.js +0 -2
  233. package/dist/node_modules/@allyhub/report-extension/package.json +0 -182
  234. package/dist/node_modules/@allyhub/report-extension/styles/allyhub/STYLE.md +0 -139
  235. package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.css +0 -109
  236. package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.json +0 -17
  237. package/dist/node_modules/@allyhub/report-extension/styles/allyhub/tokens.js +0 -40
  238. package/editor-web/assets/channel-DuEnPkZu.js +0 -1
  239. package/editor-web/assets/dist-4inJBAbI.js +0 -24
  240. package/editor-web/assets/dist-B11DCgsH.js +0 -38
  241. package/editor-web/assets/dist-C18O6_l8.js +0 -1
  242. package/editor-web/assets/dist-C69j8GuG.js +0 -1
  243. package/editor-web/assets/dist-CbaaskK_.js +0 -6
  244. package/editor-web/assets/dist-Cr8czubC.js +0 -1
  245. package/editor-web/assets/dist-CyFisBsr.js +0 -45
  246. package/editor-web/assets/dist-D75YCIy5.js +0 -16
  247. package/editor-web/assets/dist-R8wzgFQU.js +0 -43
  248. package/editor-web/assets/flowDiagram-IUGLLWBU-D-udv3hH.js +0 -1
  249. package/editor-web/assets/index-BVal6wRX.css +0 -2
  250. package/editor-web/assets/palette-INFK0Zsr.js +0 -1
  251. package/editor-web/assets/scissors-DhC0iSGF.js +0 -1
  252. package/editor-web/assets/swatch-xE61Svqb.js +0 -1
  253. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-Ckm9Zo5K.js +0 -8
  254. package/editor-web/assets/syntax-9LD8MzGy.js +0 -1
  255. package/editor-web/assets/tabs-DaoN-PPw.js +0 -1
  256. package/editor-web/assets/trash-2-DrnRa91l.js +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  Feature highlights from each AllyHub release.
4
4
 
5
+ ## 0.15.1
6
+
7
+ - **A much smaller install.** A new project installs a fraction of what it did. Fonts, diagrams and the tools only some work uses are downloaded the first time a project needs them, once for the computer, and kept for every project.
8
+
9
+ ## 0.15.0
10
+
11
+ - **Reports are set aside.** AllyHub no longer makes reports, and `allyhub report style` is gone. Write a page of findings as a doc, a sheet or a deck instead.
12
+
13
+ ## 0.14.1
14
+
15
+ - **Plain files read better.** Notes and plain text read as a page, ⌘F is a find bar with replace, and a PDF opens with its pages one under another.
16
+ - **The right viewer whatever a name's case**, and a file that cannot be shown as text, or is too large, says so instead of being read.
17
+
5
18
  ## 0.14.0
6
19
 
7
20
  - **Any file opens.** A note, data, a config, a log, subtitles or a loose picture, video or sound opens as text or media, edited by hand beside the agent and marked up like any other work. The agent can show any file, listed in the project or not.
@@ -1,12 +1,10 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{relative as _,sep as G}from"node:path";import{z as r}from"zod";import{formatConsole as H,formatProblem as N}from"../text/index.js";import{sizeOf as B}from"@allyhub/build";import{COMPARE_DEFAULTS as U}from"@allyhub/measure";import{CUT_REVIEW_DEFAULTS as J,cutLine as V,dbText as x,silenceText as q}from"@allyhub/video-measure";import{consoleJson as T}from"@allyhub/project";import{PAGE_CAPTURE_DEFAULTS as j}from"@allyhub/browser";import{itemIdOf as X}from"@allyhub/formats";import{EXIT as C}from"@allyhub/protocol";import{defineCommand as w}from"../command.js";import{dir as O}from"../fields.js";import{parameters as D}from"../parameters.js";import{tellPresence as E}from"../presence.js";import{projectRoot as $}from"../project.js";import{VERSION_FIELDS as k,commandError as P,withVersion as y}from"../version.js";import{compareText as W,comparePictures as z}from"./frames/compare.js";import{isPicture as A,isVideo as M,usage as m}from"./frames/common.js";import{cutSheets as K}from"./frames/cuts.js";import{fileFrames as Q}from"./frames/file.js";import{pageShot as Y}from"./frames/page.js";import{pieceMoments as Z,stillsSheet as ee}from"./frames/piece.js";import{docPicture as te}from"./frames/doc.js";import{findDoc as re}from"@allyhub/doc-extension/cli";import{sheetPicture as oe}from"./frames/sheet.js";import{findSheet as I}from"@allyhub/sheet-extension/cli";import{reportFrames as ae}from"./frames/report.js";import{findReport as ne}from"@allyhub/report-extension/cli";function v(e){return[...e.problems.filter(a=>a.level==="error").map(N),...H(T(e.console))]}const S=e=>({problems:e.problems,...T(e.console)}),F=(e,i)=>$(e,i),ie=r.strictObject({...k,item:r.string().optional().describe("The piece (its id, its file without its extension, or its file; default the project's only one), a sheet, a doc, a report, or a video file: a path ending in .mp4, .mov, .webm, .m4v, .qt, .mkv or .avi is a file"),range:r.string().optional().describe("A sheet's: what to draw, a sheet (Summary), a range (Summary!B3:D9, or B3:D9 on the first sheet), columns (A:C) or rows (1:20); default its sheets, from A1"),page:r.string().optional().describe("A doc's: the pages to draw large, counted from 1 (2, 2-4, 1,5); default every page, small, tiled"),at:r.array(r.string()).optional().describe("Moments: seconds (from the start of --part when given) or anchors (@press, @/map a stretch's end, @press+0.2); a video file's are seconds. One is written as the frame itself, several are tiled. Without it, --part's still, or every part's still on one sheet. A report's: a CSS selector, that element alone"),width:r.number().int().min(200).max(3840).optional().describe("A report's: the page's width, CSS pixels (default 1440; 375 a phone's)"),dark:r.boolean().default(!1).describe("A report's: drawn as a reader who asks for dark sees it"),print:r.boolean().default(!1).describe("A report's: laid out for paper (@media print) at the width given, as one long picture"),part:r.string().optional().describe("The part --at, --from and --to count from; alone, its still"),from:r.number().optional().describe("A stretch of consecutive frames from this second (with --to), instead of --at"),to:r.number().optional().describe("The stretch's last second"),clip:r.string().optional().describe("Write the stretch as a small silent video, .gif, .mp4 or .webm by its extension; with --out, the grid too"),overlay:r.boolean().default(!1).describe("Draw over each tile the face boxes with ids, the person matte's outline, the covered areas and the text boxes (a deck's: each shape's box and name, and the lines nearly in line); places nothing. Alone, over every part's still"),beside:r.string().optional().describe("Another video file (a reference) whose frame at the same time goes on each tile's left"),grid:r.number().int().min(4).optional().describe("A video file at one --at: the frame at its own size with numbered lines every this many pixels"),out:r.string().optional().describe("Where the picture goes, always a WebP whatever the extension; default under .allyhub/work/frames/")});function se(e){const i=[["--combo",e.combo!==void 0],["--part",e.part!==void 0],["--beside",e.beside!==void 0],["--overlay",e.overlay]].filter(([,a])=>a).map(([a])=>a);if(i.length>0)throw m("bad-option",`${i.join(" and ")} ${i.length===1?"is":"are"} a piece's: a video file has no combos or parts.`)}function de(e){const i=[["--at",e.at!==void 0],["--part",e.part!==void 0],["--from",e.from!==void 0],["--to",e.to!==void 0],["--clip",e.clip!==void 0],["--overlay",e.overlay],["--beside",e.beside!==void 0],["--range",e.range!==void 0],["--combo",e.combo!==void 0]].filter(([,a])=>a).map(([a])=>a);if(i.length>0)throw m("bad-option",`${i.join(" and ")} ${i.length===1?"is":"are"} not a doc's: a doc has pages (--page), not moments.`)}function le(e){const i=[["--part",e.part!==void 0],["--from",e.from!==void 0],["--to",e.to!==void 0],["--clip",e.clip!==void 0],["--overlay",e.overlay],["--beside",e.beside!==void 0],["--range",e.range!==void 0],["--page",e.page!==void 0],["--combo",e.combo!==void 0],["--at with more than one selector",(e.at?.length??0)>1]].filter(([,a])=>a).map(([a])=>a);if(i.length>0)throw m("bad-option",`${i.join(" and ")} ${i.length===1?"is":"are"} not a report's: a report is one page (--width, --dark, --print, --at <selector>).`)}export const frames=w({name:"frames",summary:"Pictures of a piece over time, drawn as the render draws them: every part's still on a sheet (default), a moment, a stretch tiled or as a clip, overlays; a sheet's cells, or a range of them; a doc's pages as they print, with how many; a report's page at a width, light or dark, or laid out for print; or any video file's frames",input:ie,positional:["item"],output:r.looseObject({mode:r.enum(["sheet","frame","grid","clip"])}),examples:["allyhub frames launch/film","allyhub frames launch/film --at 2.5","allyhub frames launch/film --part hook --from 0 --to 1 --clip hook.gif","allyhub frames launch/film --at 1,2,3 --overlay","allyhub frames reference.mp4 --at 0,1,2","allyhub frames reference.mp4 --at 3 --grid 50","allyhub frames finance/budget --range 'Summary!A1:F20'","allyhub frames launch/plan","allyhub frames launch/plan --page 2-3","allyhub frames research/channels/channels --width 375","allyhub frames research/channels/channels --at '#tiers'"]},async(e,i)=>{const a=i.cwd;if(e.item!==void 0&&M(e.item)){se(e);const t=await Q({cwd:a,root:await F(a,e.dir),file:e.item,at:e.at,from:e.from,to:e.to,clip:e.clip,out:e.out,grid:e.grid}).catch(b=>{throw P(b)}),n=t.video,d=`${t.file} · ${n.duration.toFixed(2)} s · ${String(n.width)}×${String(n.height)} · ${String(n.fps)} fps`,g="clip"in t&&t.clip?`${t.clip.out} (${t.clip.type}, ${String(t.clip.frames)} frames at ${String(t.clip.fps)} fps, no sound)`:void 0;return{value:t,text:[d,..."out"in t?[`${t.out}${"tiles"in t?` (${String(t.tiles.length)} moments in ${String(t.cols)} columns)`:""}`]:[],...g?[g]:[]].join(`
3
- `)}}if(e.grid!==void 0)throw m("bad-option","--grid draws a video file's frame at its own size: give the file.");const l=await $(a,e.dir);if(e.item!==void 0&&await I(l,a,e.item)!==void 0){const t=await oe({cwd:a,root:l,item:e.item,range:e.range,out:e.out}),n=await I(l,a,e.item);return n!==void 0&&Object.keys(t.at).length>0&&await E(l,{doing:"looking",item:X(_(l,n).split(G).join("/")),place:t.at}),{value:t,text:[t.out,...t.cut].join(`
4
- `)}}const c=e.item===void 0?void 0:await ne(l,a,e.item);if(c!==void 0){le(e);const t=await ae({cwd:a,root:l,file:c,width:e.width,dark:e.dark,print:e.print,at:e.at?.[0],out:e.out}),n=[...t.missing.map(d=>`asks for ${d.path}, not in the project`),...t.outside.map(d=>`asks for ${d}, outside the project: refused`),...t.thrown.map(d=>`threw ${d.text.split(`
5
- `)[0]??""}`),...t.unsettled===void 0?[]:[t.unsettled],...t.blankCanvases.map(d=>`${d.canvas} (${String(d.width)} × ${String(d.height)} px) has nothing drawn on it`)];return{value:t,text:[t.out,`${t.report}: ${String(t.width)} px wide, ${String(t.pageHeight)} px tall${t.bands>1?`, in ${String(t.bands)} bands side by side`:""}`,...n.map(d=>`${t.report}: ${d}`)].join(`
6
- `)}}if(e.width!==void 0||e.dark||e.print)throw m("bad-option","--width, --dark and --print are a report's: name the report.");const s=e.item===void 0?void 0:await re(l,a,e.item);if(s!==void 0){de(e);const t=await te({cwd:a,root:l,file:s,page:e.page,out:e.out,progress:d=>{i.progress(d)}}),n=t.drawn.length===t.pages?"every page":`page${t.drawn.length===1?"":"s"} ${t.drawn.join(", ")}`;return{value:t,text:[t.out,`${t.doc}: ${String(t.pages)} page${t.pages===1?"":"s"} on ${String(t.paper.width)} × ${String(t.paper.height)} mm paper; ${n} drawn`].join(`
7
- `)}}if(e.page!==void 0)throw m("bad-option","--page is a doc's: name the doc.");if(e.range!==void 0)throw m("bad-option","--range is a sheet's: name the sheet.");const h=e.at!==void 0||e.part!==void 0||e.from!==void 0||e.to!==void 0;if(!h&&(e.clip!==void 0||e.beside!==void 0))throw m("bad-option","--clip and --beside draw moments: give --at, --part, or --from and --to.");if(!h&&!e.overlay){const{result:t,...n}=await y(e,i,"render",b=>ee(b,{cwd:a,root:l,out:e.out})),{unit:d,...g}=t;return{value:{...g,...S(n)},text:[`${t.out} (${t.piece} · ${t.format} · ${String(t.parts.length)} ${t.parts.length===1?d.noun:d.plural})`,...v(n)].join(`
8
- `)}}const f=!h&&e.overlay,{result:o,...p}=await y(e,i,"render",async t=>{const n=await Z(t,{cwd:a,root:l,at:f?t.timeline.parts.map(L=>String(L.still)):e.at,part:e.part,from:e.from,to:e.to,clip:e.clip,out:e.out,overlay:e.overlay,beside:e.beside}),d="tiles"in n?n.tiles[0]:void 0,g=n.mode==="frame"?n.t:n.stretch?.from??d?.t,b=n.mode==="frame"?n.part:d?.part;return g!==void 0&&!f&&await E(l,{doing:"looking",item:t.piece.place,place:{t:g,...b===void 0?{}:{part:b}}}),n}),u=[];if(o.mode==="frame"&&u.push(`${o.out} (${o.piece} · ${o.format} · ${o.part} · ${o.t.toFixed(2)} s)`),o.mode==="grid"){u.push(`${o.out} (${o.piece} · ${String(o.tiles.length)} moments in ${String(o.cols)} columns)`,` ${o.tiles.map(n=>`${n.t.toFixed(o.stretch?3:2)} ${n.part}`).join(" · ")}`);const t=[...new Set(o.tiles.flatMap(n=>n.overlay?.missing??[]))];t.length>0&&u.push(` Not measured: ${t.join(", ")}.`)}return o.stretch&&u.push(` Stretch ${o.stretch.from.toFixed(3)}–${o.stretch.to.toFixed(3)} s, one frame in ${String(o.stretch.every)}: ${String(o.stretch.frames)} frames.`),"clip"in o&&o.clip&&u.push(`${o.clip.out} (${o.clip.type}, ${String(o.clip.frames)} frames at ${String(o.clip.fps)} fps, no sound)`),{value:{...o,...S(p)},text:[...u,...v(p)].join(`
9
- `)}}),framesCuts=w({name:"frames cuts",summary:"A review sheet per cut of a video (a cut take's jumps, part joins, a scenery camera's cuts): frames around it, waveform and level, the words each side, the sound at it",input:r.strictObject({...k,part:r.string().optional().describe("Only this part's cuts and its joins"),out:r.string().optional().describe("The folder the sheets go in; default .allyhub/work/cuts/"),params:D({span:r.number().positive().max(10).default(J.span).describe("Seconds shown on each side of a cut")})}),positional:["item"],output:r.looseObject({out:r.string(),cuts:r.array(r.looseObject({sheet:r.string()}))}),examples:["allyhub frames cuts launch/film","allyhub frames cuts launch/film --part hook"]},async(e,i)=>{const a=i.cwd,l=await $(a,e.dir),{result:c,...s}=await y(e,i,"render",o=>K(o,{cwd:a,root:l,part:e.part,out:e.out,review:{span:e.params.span}})),h=c.part===void 0?`${String(c.cuts.length)} cut${c.cuts.length===1?"":"s"}`:`${String(c.cuts.length)} of ${String(c.total)} cuts (part ${c.part} and its joins)`,f=[`${c.piece} · ${c.format} · ${h}; silence is sound under ${String(c.threshold)} dBFS`];for(const o of c.cuts){const p=o.sound?`level ${x(o.sound.levelDb)} / around ${x(o.sound.aroundDb)} dBFS, peak ${x(o.sound.peakDb)}, step ${o.sound.jumpDb<0?"−":"+"}${Math.abs(o.sound.jumpDb).toFixed(1)} dB`:"no sound";f.push(`${String(o.index).padStart(3)} ${o.t.toFixed(3).padStart(7)} s ${o.kind.padEnd(6)} ${V(o)}`,` silence at the cut: ${q(o.silence)} · ${p}`,` “${o.said.before}” | “${o.said.after}”${o.across?` · across the cut: “${o.across}”`:""}`,` ${o.sheet}`)}return{value:{...c,...S(s)},text:[...f,...v(s)].join(`
10
- `)}});const R=U;export const framesCompare=w({name:"frames compare",summary:"How a candidate picture differs from a reference, as numbers (ΔE, channels, SSIM, levels, grain, edges, regions) with a heatmap and a side-by-side: a piece's moment, a picture file or a video file's frame",input:r.strictObject({reference:r.string().describe("The reference picture (PNG, WebP, JPEG…)"),candidate:r.string().optional().describe("A piece (its id, its file without its extension, or its file; default the project's only one) at --at or --part's still; or a file by its extension: a picture (.png, .jpg, .webp…), or a video file's frame at --at (.mp4, .mov, .webm…)"),combo:k.combo,dir:O,at:r.string().optional().describe("The moment: seconds (from the start of --part when given) or an anchor of the piece; a video file's are seconds (default 0)"),part:r.string().optional().describe("The piece's part --at counts from; alone, its still"),refCrop:r.string().optional().describe("Cut the reference to x,y,width,height, or to an element of the elements.json beside it (frames web writes one)"),crop:r.string().optional().describe("Cut the candidate to x,y,width,height before any resize"),encode:r.string().optional().describe("Draw the candidate through this encode first, as a platform serves it: codec:kbps, h264 or hevc (hevc:618)"),out:r.string().optional().describe("Where its files go, a path without extension; default under .allyhub/work/compare/"),params:D({resize:r.enum(["stretch","width","none"]).default(R.resize).describe("When sizes differ: stretch the candidate to the reference, scale it to its width, or compare the common area"),shift:r.number().int().min(0).max(32).default(R.shift).describe("Search the best offset within this many pixels each way")})}),positional:["reference","candidate"],output:r.looseObject({reference:r.string(),files:r.looseObject({side:r.string(),heatmap:r.string()})}),examples:["allyhub frames compare reference.png launch/film --at 2.5 --encode hevc:618","allyhub frames compare reference.png shot.webp --ref-crop cta","allyhub frames compare reference.png theirs.mp4 --at 3"]},async(e,i)=>{const a=i.cwd,l=e.params;if(!A(e.reference))throw m("bad-reference",`${e.reference} is not a picture: the reference comes first, a picture file (PNG, WebP, JPEG…), then the piece or file to compare with it.`,`For example: allyhub frames compare ${e.candidate!==void 0&&A(e.candidate)?e.candidate:"reference.png"} ${e.reference}`);const c=e.candidate!==void 0&&(A(e.candidate)||M(e.candidate))?e.candidate:void 0,s=p=>({cwd:a,root:p,reference:e.reference,file:c,at:e.at===void 0?void 0:[e.at],part:e.part,refCrop:e.refCrop,crop:e.crop,encode:e.encode,out:e.out,options:{shift:l.shift,resize:l.resize}});if(c!==void 0){if(e.combo!==void 0||e.part!==void 0)throw m("bad-option","--combo and --part are a piece's: the candidate is a file.");const p=await z(s(await F(a,e.dir)),void 0).catch(u=>{throw P(u)});return{value:p,text:W(p)}}const h=await $(a,e.dir),{result:f,...o}=await y({...e,item:e.candidate},i,"render",p=>z(s(h),p));return{value:{...f,...S(o)},text:[W(f),...v(o)].join(`
11
- `)}}),framesWeb=w({name:"frames web",summary:"A web page's screenshot with its named elements' boxes in the image's pixels, for a screen demo",input:r.strictObject({url:r.string().describe("The page: an address, or an HTML file on this computer"),el:r.array(r.string()).optional().describe("An element to locate, name=selector (CSS, or text=<words>); [data-el] elements are found too"),click:r.array(r.string()).optional().describe("Selectors clicked in order before the shot (close a banner, open a dialog)"),full:r.boolean().default(!1).describe("The whole page, not one viewport"),out:r.string().optional().describe("Where the picture goes (a WebP), its boxes in <out>.elements.json beside it; default under .allyhub/work/pages/"),dir:O,size:r.string().default(`${String(j.width)}x${String(j.height)}`).describe("The viewport, WIDTHxHEIGHT in CSS pixels"),scale:r.number().min(1).max(4).default(j.scale).describe("Image pixels per CSS pixel; 2 draws a high-density screen, sharp when a camera goes in"),wait:r.number().int().min(0).optional().describe("Milliseconds to wait after loading and clicking")}),positional:["url"],output:r.looseObject({out:r.string(),elementsFile:r.string()}),examples:["allyhub frames web https://example.com --el cta=text=Sign\\ up --scale 2 --out assets/media/home","allyhub frames web page.html --click '#accept' --full"]},async(e,i)=>{const a=i.cwd,[l,c]=B(e.size),s=await Y({cwd:a,root:await F(a,e.dir),url:e.url,out:e.out,el:e.el,click:e.click,width:l,height:c,scale:e.scale,full:e.full,wait:e.wait});return{value:s,text:[`${s.out}: ${String(s.width)}×${String(s.height)}${s.scale===1?"":` (${String(s.scale)} image pixels per CSS pixel)`}, ${String(Object.keys(s.elements).length)} elements (${Object.keys(s.elements).join(", ")||"none"}) in ${s.elementsFile}`,...s.missing.length>0?[`Not found: ${s.missing.join(", ")} (the selector is wrong, or something must be opened with --click first).`]:[]].join(`
12
- `),exit:s.missing.length>0?C.failed:C.ok}}),FRAMES_COMMANDS=[frames,framesCuts,framesCompare,framesWeb];
2
+ import{relative as _,sep as G}from"node:path";import{z as t}from"zod";import{formatConsole as N,formatProblem as R}from"../text/index.js";import{sizeOf as B}from"@allyhub/build";import{COMPARE_DEFAULTS as H}from"@allyhub/measure";import{CUT_REVIEW_DEFAULTS as U,cutLine as J,dbText as S,silenceText as V}from"@allyhub/video-measure";import{consoleJson as T}from"@allyhub/project";import{PAGE_CAPTURE_DEFAULTS as x}from"@allyhub/browser";import{itemIdOf as q}from"@allyhub/formats";import{EXIT as A}from"@allyhub/protocol";import{defineCommand as b}from"../command.js";import{dir as O}from"../fields.js";import{parameters as C}from"../parameters.js";import{tellPresence as D}from"../presence.js";import{projectRoot as w}from"../project.js";import{VERSION_FIELDS as j,commandError as E,withVersion as $}from"../version.js";import{compareText as P,comparePictures as W}from"./frames/compare.js";import{isPicture as k,isVideo as z,usage as f}from"./frames/common.js";import{cutSheets as X}from"./frames/cuts.js";import{fileFrames as K}from"./frames/file.js";import{pageShot as Q}from"./frames/page.js";import{pieceMoments as Y,stillsSheet as Z}from"./frames/piece.js";import{docPicture as ee}from"./frames/doc.js";import{findDoc as te}from"@allyhub/doc-extension/cli";import{sheetPicture as re}from"./frames/sheet.js";import{findSheet as M}from"@allyhub/sheet-extension/cli";function y(e){return[...e.problems.filter(a=>a.level==="error").map(R),...N(T(e.console))]}const v=e=>({problems:e.problems,...T(e.console)}),F=(e,s)=>w(e,s),oe=t.strictObject({...j,item:t.string().optional().describe("The piece (its id, its file without its extension, or its file; default the project's only one), a sheet, a doc, or a video file: a path ending in .mp4, .mov, .webm, .m4v, .qt, .mkv or .avi is a file"),range:t.string().optional().describe("A sheet's: what to draw, a sheet (Summary), a range (Summary!B3:D9, or B3:D9 on the first sheet), columns (A:C) or rows (1:20); default its sheets, from A1"),page:t.string().optional().describe("A doc's: the pages to draw large, counted from 1 (2, 2-4, 1,5); default every page, small, tiled"),at:t.array(t.string()).optional().describe("Moments: seconds (from the start of --part when given) or anchors (@press, @/map a stretch's end, @press+0.2); a video file's are seconds. One is written as the frame itself, several are tiled. Without it, --part's still, or every part's still on one sheet."),part:t.string().optional().describe("The part --at, --from and --to count from; alone, its still"),from:t.number().optional().describe("A stretch of consecutive frames from this second (with --to), instead of --at"),to:t.number().optional().describe("The stretch's last second"),clip:t.string().optional().describe("Write the stretch as a small silent video, .gif, .mp4 or .webm by its extension; with --out, the grid too"),overlay:t.boolean().default(!1).describe("Draw over each tile the face boxes with ids, the person matte's outline, the covered areas and the text boxes (a deck's: each shape's box and name, and the lines nearly in line); places nothing. Alone, over every part's still"),beside:t.string().optional().describe("Another video file (a reference) whose frame at the same time goes on each tile's left"),grid:t.number().int().min(4).optional().describe("A video file at one --at: the frame at its own size with numbered lines every this many pixels"),out:t.string().optional().describe("Where the picture goes, always a WebP whatever the extension; default under .allyhub/work/frames/")});function ae(e){const s=[["--combo",e.combo!==void 0],["--part",e.part!==void 0],["--beside",e.beside!==void 0],["--overlay",e.overlay]].filter(([,a])=>a).map(([a])=>a);if(s.length>0)throw f("bad-option",`${s.join(" and ")} ${s.length===1?"is":"are"} a piece's: a video file has no combos or parts.`)}function ne(e){const s=[["--at",e.at!==void 0],["--part",e.part!==void 0],["--from",e.from!==void 0],["--to",e.to!==void 0],["--clip",e.clip!==void 0],["--overlay",e.overlay],["--beside",e.beside!==void 0],["--range",e.range!==void 0],["--combo",e.combo!==void 0]].filter(([,a])=>a).map(([a])=>a);if(s.length>0)throw f("bad-option",`${s.join(" and ")} ${s.length===1?"is":"are"} not a doc's: a doc has pages (--page), not moments.`)}export const frames=b({name:"frames",summary:"Pictures of a piece over time, drawn as the render draws them: every part's still on a sheet (default), a moment, a stretch tiled or as a clip, overlays; a sheet's cells, or a range of them; a doc's pages as they print, with how many; or any video file's frames",input:oe,positional:["item"],output:t.looseObject({mode:t.enum(["sheet","frame","grid","clip"])}),examples:["allyhub frames launch/film","allyhub frames launch/film --at 2.5","allyhub frames launch/film --part hook --from 0 --to 1 --clip hook.gif","allyhub frames launch/film --at 1,2,3 --overlay","allyhub frames reference.mp4 --at 0,1,2","allyhub frames reference.mp4 --at 3 --grid 50","allyhub frames finance/budget --range 'Summary!A1:F20'","allyhub frames launch/plan","allyhub frames launch/plan --page 2-3"]},async(e,s)=>{const a=s.cwd;if(e.item!==void 0&&z(e.item)){ae(e);const r=await K({cwd:a,root:await F(a,e.dir),file:e.item,at:e.at,from:e.from,to:e.to,clip:e.clip,out:e.out,grid:e.grid}).catch(g=>{throw E(g)}),n=r.video,p=`${r.file} · ${n.duration.toFixed(2)} s · ${String(n.width)}×${String(n.height)} · ${String(n.fps)} fps`,u="clip"in r&&r.clip?`${r.clip.out} (${r.clip.type}, ${String(r.clip.frames)} frames at ${String(r.clip.fps)} fps, no sound)`:void 0;return{value:r,text:[p,..."out"in r?[`${r.out}${"tiles"in r?` (${String(r.tiles.length)} moments in ${String(r.cols)} columns)`:""}`]:[],...u?[u]:[]].join(`
3
+ `)}}if(e.grid!==void 0)throw f("bad-option","--grid draws a video file's frame at its own size: give the file.");const d=await w(a,e.dir);if(e.item!==void 0&&await M(d,a,e.item)!==void 0){const r=await re({cwd:a,root:d,item:e.item,range:e.range,out:e.out}),n=await M(d,a,e.item);return n!==void 0&&Object.keys(r.at).length>0&&await D(d,{doing:"looking",item:q(_(d,n).split(G).join("/")),place:r.at}),{value:r,text:[r.out,...r.cut].join(`
4
+ `)}}const c=e.item===void 0?void 0:await te(d,a,e.item);if(c!==void 0){ne(e);const r=await ee({cwd:a,root:d,file:c,page:e.page,out:e.out,progress:p=>{s.progress(p)}}),n=r.drawn.length===r.pages?"every page":`page${r.drawn.length===1?"":"s"} ${r.drawn.join(", ")}`;return{value:r,text:[r.out,`${r.doc}: ${String(r.pages)} page${r.pages===1?"":"s"} on ${String(r.paper.width)} × ${String(r.paper.height)} mm paper; ${n} drawn`].join(`
5
+ `)}}if(e.page!==void 0)throw f("bad-option","--page is a doc's: name the doc.");if(e.range!==void 0)throw f("bad-option","--range is a sheet's: name the sheet.");const l=e.at!==void 0||e.part!==void 0||e.from!==void 0||e.to!==void 0;if(!l&&(e.clip!==void 0||e.beside!==void 0))throw f("bad-option","--clip and --beside draw moments: give --at, --part, or --from and --to.");if(!l&&!e.overlay){const{result:r,...n}=await $(e,s,"render",g=>Z(g,{cwd:a,root:d,out:e.out})),{unit:p,...u}=r;return{value:{...u,...v(n)},text:[`${r.out} (${r.piece} · ${r.format} · ${String(r.parts.length)} ${r.parts.length===1?p.noun:p.plural})`,...y(n)].join(`
6
+ `)}}const h=!l&&e.overlay,{result:o,...i}=await $(e,s,"render",async r=>{const n=await Y(r,{cwd:a,root:d,at:h?r.timeline.parts.map(L=>String(L.still)):e.at,part:e.part,from:e.from,to:e.to,clip:e.clip,out:e.out,overlay:e.overlay,beside:e.beside}),p="tiles"in n?n.tiles[0]:void 0,u=n.mode==="frame"?n.t:n.stretch?.from??p?.t,g=n.mode==="frame"?n.part:p?.part;return u!==void 0&&!h&&await D(d,{doing:"looking",item:r.piece.place,place:{t:u,...g===void 0?{}:{part:g}}}),n}),m=[];if(o.mode==="frame"&&m.push(`${o.out} (${o.piece} · ${o.format} · ${o.part} · ${o.t.toFixed(2)} s)`),o.mode==="grid"){m.push(`${o.out} (${o.piece} · ${String(o.tiles.length)} moments in ${String(o.cols)} columns)`,` ${o.tiles.map(n=>`${n.t.toFixed(o.stretch?3:2)} ${n.part}`).join(" · ")}`);const r=[...new Set(o.tiles.flatMap(n=>n.overlay?.missing??[]))];r.length>0&&m.push(` Not measured: ${r.join(", ")}.`)}return o.stretch&&m.push(` Stretch ${o.stretch.from.toFixed(3)}–${o.stretch.to.toFixed(3)} s, one frame in ${String(o.stretch.every)}: ${String(o.stretch.frames)} frames.`),"clip"in o&&o.clip&&m.push(`${o.clip.out} (${o.clip.type}, ${String(o.clip.frames)} frames at ${String(o.clip.fps)} fps, no sound)`),{value:{...o,...v(i)},text:[...m,...y(i)].join(`
7
+ `)}}),framesCuts=b({name:"frames cuts",summary:"A review sheet per cut of a video (a cut take's jumps, part joins, a scenery camera's cuts): frames around it, waveform and level, the words each side, the sound at it",input:t.strictObject({...j,part:t.string().optional().describe("Only this part's cuts and its joins"),out:t.string().optional().describe("The folder the sheets go in; default .allyhub/work/cuts/"),params:C({span:t.number().positive().max(10).default(U.span).describe("Seconds shown on each side of a cut")})}),positional:["item"],output:t.looseObject({out:t.string(),cuts:t.array(t.looseObject({sheet:t.string()}))}),examples:["allyhub frames cuts launch/film","allyhub frames cuts launch/film --part hook"]},async(e,s)=>{const a=s.cwd,d=await w(a,e.dir),{result:c,...l}=await $(e,s,"render",i=>X(i,{cwd:a,root:d,part:e.part,out:e.out,review:{span:e.params.span}})),h=c.part===void 0?`${String(c.cuts.length)} cut${c.cuts.length===1?"":"s"}`:`${String(c.cuts.length)} of ${String(c.total)} cuts (part ${c.part} and its joins)`,o=[`${c.piece} · ${c.format} · ${h}; silence is sound under ${String(c.threshold)} dBFS`];for(const i of c.cuts){const m=i.sound?`level ${S(i.sound.levelDb)} / around ${S(i.sound.aroundDb)} dBFS, peak ${S(i.sound.peakDb)}, step ${i.sound.jumpDb<0?"−":"+"}${Math.abs(i.sound.jumpDb).toFixed(1)} dB`:"no sound";o.push(`${String(i.index).padStart(3)} ${i.t.toFixed(3).padStart(7)} s ${i.kind.padEnd(6)} ${J(i)}`,` silence at the cut: ${V(i.silence)} · ${m}`,` “${i.said.before}” | “${i.said.after}”${i.across?` · across the cut: “${i.across}”`:""}`,` ${i.sheet}`)}return{value:{...c,...v(l)},text:[...o,...y(l)].join(`
8
+ `)}});const I=H;export const framesCompare=b({name:"frames compare",summary:"How a candidate picture differs from a reference, as numbers (ΔE, channels, SSIM, levels, grain, edges, regions) with a heatmap and a side-by-side: a piece's moment, a picture file or a video file's frame",input:t.strictObject({reference:t.string().describe("The reference picture (PNG, WebP, JPEG…)"),candidate:t.string().optional().describe("A piece (its id, its file without its extension, or its file; default the project's only one) at --at or --part's still; or a file by its extension: a picture (.png, .jpg, .webp…), or a video file's frame at --at (.mp4, .mov, .webm…)"),combo:j.combo,dir:O,at:t.string().optional().describe("The moment: seconds (from the start of --part when given) or an anchor of the piece; a video file's are seconds (default 0)"),part:t.string().optional().describe("The piece's part --at counts from; alone, its still"),refCrop:t.string().optional().describe("Cut the reference to x,y,width,height, or to an element of the elements.json beside it (frames web writes one)"),crop:t.string().optional().describe("Cut the candidate to x,y,width,height before any resize"),encode:t.string().optional().describe("Draw the candidate through this encode first, as a platform serves it: codec:kbps, h264 or hevc (hevc:618)"),out:t.string().optional().describe("Where its files go, a path without extension; default under .allyhub/work/compare/"),params:C({resize:t.enum(["stretch","width","none"]).default(I.resize).describe("When sizes differ: stretch the candidate to the reference, scale it to its width, or compare the common area"),shift:t.number().int().min(0).max(32).default(I.shift).describe("Search the best offset within this many pixels each way")})}),positional:["reference","candidate"],output:t.looseObject({reference:t.string(),files:t.looseObject({side:t.string(),heatmap:t.string()})}),examples:["allyhub frames compare reference.png launch/film --at 2.5 --encode hevc:618","allyhub frames compare reference.png shot.webp --ref-crop cta","allyhub frames compare reference.png theirs.mp4 --at 3"]},async(e,s)=>{const a=s.cwd,d=e.params;if(!k(e.reference))throw f("bad-reference",`${e.reference} is not a picture: the reference comes first, a picture file (PNG, WebP, JPEG…), then the piece or file to compare with it.`,`For example: allyhub frames compare ${e.candidate!==void 0&&k(e.candidate)?e.candidate:"reference.png"} ${e.reference}`);const c=e.candidate!==void 0&&(k(e.candidate)||z(e.candidate))?e.candidate:void 0,l=m=>({cwd:a,root:m,reference:e.reference,file:c,at:e.at===void 0?void 0:[e.at],part:e.part,refCrop:e.refCrop,crop:e.crop,encode:e.encode,out:e.out,options:{shift:d.shift,resize:d.resize}});if(c!==void 0){if(e.combo!==void 0||e.part!==void 0)throw f("bad-option","--combo and --part are a piece's: the candidate is a file.");const m=await W(l(await F(a,e.dir)),void 0).catch(r=>{throw E(r)});return{value:m,text:P(m)}}const h=await w(a,e.dir),{result:o,...i}=await $({...e,item:e.candidate},s,"render",m=>W(l(h),m));return{value:{...o,...v(i)},text:[P(o),...y(i)].join(`
9
+ `)}}),framesWeb=b({name:"frames web",summary:"A web page's screenshot with its named elements' boxes in the image's pixels, for a screen demo",input:t.strictObject({url:t.string().describe("The page: an address, or an HTML file on this computer"),el:t.array(t.string()).optional().describe("An element to locate, name=selector (CSS, or text=<words>); [data-el] elements are found too"),click:t.array(t.string()).optional().describe("Selectors clicked in order before the shot (close a banner, open a dialog)"),full:t.boolean().default(!1).describe("The whole page, not one viewport"),out:t.string().optional().describe("Where the picture goes (a WebP), its boxes in <out>.elements.json beside it; default under .allyhub/work/pages/"),dir:O,size:t.string().default(`${String(x.width)}x${String(x.height)}`).describe("The viewport, WIDTHxHEIGHT in CSS pixels"),scale:t.number().min(1).max(4).default(x.scale).describe("Image pixels per CSS pixel; 2 draws a high-density screen, sharp when a camera goes in"),wait:t.number().int().min(0).optional().describe("Milliseconds to wait after loading and clicking")}),positional:["url"],output:t.looseObject({out:t.string(),elementsFile:t.string()}),examples:["allyhub frames web https://example.com --el cta=text=Sign\\ up --scale 2 --out assets/media/home","allyhub frames web page.html --click '#accept' --full"]},async(e,s)=>{const a=s.cwd,[d,c]=B(e.size),l=await Q({cwd:a,root:await F(a,e.dir),url:e.url,out:e.out,el:e.el,click:e.click,width:d,height:c,scale:e.scale,full:e.full,wait:e.wait});return{value:l,text:[`${l.out}: ${String(l.width)}×${String(l.height)}${l.scale===1?"":` (${String(l.scale)} image pixels per CSS pixel)`}, ${String(Object.keys(l.elements).length)} elements (${Object.keys(l.elements).join(", ")||"none"}) in ${l.elementsFile}`,...l.missing.length>0?[`Not found: ${l.missing.join(", ")} (the selector is wrong, or something must be opened with --click first).`]:[]].join(`
10
+ `),exit:l.missing.length>0?A.failed:A.ok}}),FRAMES_COMMANDS=[frames,framesCuts,framesCompare,framesWeb];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/3d-extension",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./tools": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/audio",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/browser",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/build",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/canvas-extension",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/canvas-model",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/chart",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/check",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/cloud",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/components",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -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 F}from"node:crypto";import{readFile as z}from"node:fs/promises";import{createServer as D}from"node:http";import{join as J,resolve as C}from"node:path";import{getRequestListener as M}from"@hono/node-server";import{Hono as W}from"hono";import{WebSocketServer as G}from"ws";import{KeyedStore as K}from"@allyhub/project";import{CollaboratorStateSchema as Y,PRESENCE_PATH as Q,SNAPSHOT_TREE as $,TREE_PAGES as V,stageCsp as X}from"@allyhub/protocol";import{runtimeFile as Z}from"@allyhub/stage-page";import{pathProblem as ee}from"./paths.js";import{fileResponse as g}from"./respond.js";import{ProjectServer as te}from"./project.js";import{STILL_NAME as ne,inside as x,matteFile as re,sourceName as oe}from"./tree.js";export const RPC_PATH="/rpc",RAW_PATH="/files/raw/";const p={"access-control-allow-origin":"*"},T=/^[a-z][a-z0-9+.-]*:\/\/[a-z0-9.-]+(:\d{1,5})?$/u;export const PING_MS=3e4,ALLYHUB_FORWARDED="allyhub-forwarded";export function forwardedHost(n){const d=n[ALLYHUB_FORWARDED],y=(n.forwarded??(Array.isArray(d)?d[0]:d))?.split(",")[0]?.split(";").map(i=>i.trim().split("=")).find(([i])=>i?.toLowerCase()==="host")?.[1];if(y!==void 0)return y.replace(/^"(.*)"$/u,"$1");const u=n["x-forwarded-host"];return(Array.isArray(u)?u[0]:u)?.split(",")[0]?.trim()}export function frameSources(n){const d=["'self'","http://127.0.0.1:*","http://localhost:*"];if(n===void 0)return d;const a=new URL(n.replace("{port}","1")),y=new URL(n.replace("{port}","2"));if(a.port!==y.port)return[...d,`${a.protocol}//${a.hostname}:*`];const u=a.hostname.slice(a.hostname.indexOf(".")+1);return[...d,`${a.protocol}//*.${u}`]}export async function startDevServer(n){const d=C(n.root);if(n.embedder!==void 0&&!T.test(n.embedder))throw new Error(`Not an origin: ${n.embedder}`);if(n.publicOrigin!==void 0&&!T.test(n.publicOrigin.replace("{port}","1")))throw new Error(`Not an origin: ${n.publicOrigin}`);const a=n.token??F(18).toString("base64url"),u=`/s/${F(18).toString("base64url")}/`,i=await te.open({...n,root:d,...n.publicOrigin===void 0?{}:{reveal:!1}});let f=0;const P=()=>f===0?void 0:n.publicOrigin?.replace("{port}",String(f)),v=()=>{const e=P();return e===void 0?void 0:new URL(e).host},E=()=>{const e=v();return new Set([`127.0.0.1:${String(f)}`,`localhost:${String(f)}`,...e===void 0?[]:[e]])},R=e=>e===v()?P()??"":`http://${e}`,U=e=>R(e.req.header("host")??""),N=e=>{const t=v();t!==void 0&&forwardedHost(e.headers)===t&&(e.headers.host=t)},A=e=>e??`http://127.0.0.1:${String(f)}`;i.serving={file:(e,t)=>`${A(e)}${RAW_PATH}${t.split("/").map(encodeURIComponent).join("/")}?token=${encodeURIComponent(a)}`,tree:e=>`${A(e)}${u}`};const{routes:O}=i.live,b=new W,I=async e=>{if(!n.ui)return e.text("allyhub dev serves its editors here.",200);const t=await z(J(n.ui,"index.html"),"utf8").catch(()=>{});if(t===void 0)return e.text("The page's files are missing: build them first (pnpm --filter @allyhub/editor-web build).",500);const c=F(16).toString("base64");return e.html(t.replace(/<script/gu,`<script nonce="${c}"`).replace("</head>",`<meta name="allyhub-token" content="${a}"></head>`),200,{"content-security-policy":["default-src 'self'",`script-src 'self' 'nonce-${c}'`,"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 ${frameSources(n.publicOrigin).join(" ")}`,`frame-ancestors ${n.embedder??"'none'"}`].join("; "),"cache-control":"no-store"})};b.get("/",I),b.post(Q,async e=>{if(e.req.header("authorization")!==`Bearer ${a}`)return e.text("forbidden",403);const t=Y.safeParse(await e.req.json().catch(()=>{}));return t.success?(i.presence.agent(t.data),e.body(null,204)):e.text(t.error.message,400)}),b.get(`${RAW_PATH}*`,async e=>{if(e.req.query("token")!==a)return e.text("forbidden",403);const t=decodeURIComponent(e.req.path.slice(RAW_PATH.length));if(ee(t)!==void 0)return e.text("forbidden",403);const c=x(d,t);return c?g(c,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)}),b.get(`${u}*`,async e=>{let t;try{t=decodeURIComponent(e.req.path.slice(u.length))}catch{return e.notFound()}const c=e.req.header("range"),m=U(e),l=t.slice(0,t.indexOf("/")+1),s=t.slice(l.length);switch(l){case $.runtime:{const r=Z(s);if(!r)return e.notFound();const o=Object.values(V).includes(t);return g(r,void 0,{...p,...o?{"content-security-policy":X(`${m}${u}`,[m,...n.embedder?[n.embedder]:[],...n.framers??[]],O.loads())}:{}})}case $.build:{const r=oe(s);if(r===void 0){const o=x(i.live.pieceDir,s);return o?g(o,void 0,p):e.notFound()}try{return e.json(await i.live.source(r),200,{...p,"cache-control":"no-store"})}catch(o){return e.json({error:{message:o instanceof Error?o.message:String(o)}},404,p)}}case $.media:{const o=Object.hasOwn(i.live.latest()?.media??{},s)||O.allowed(s)?x(d,s):void 0;return o?g(o,c,p):e.notFound()}case $.matte:{const r=re(d,i.live.latest()?.media[s]);return r?g(r,c,{...p,"content-type":"video/mp4"}):e.notFound()}case $.stills:return ne.test(s)?g(K.of(d,"stills").path(s),void 0,{...p,"cache-control":"public, max-age=31536000, immutable"}):e.notFound();default:try{const r=await O.route(l);if(!r)return await e.notFound();const o=new WeakSet,h=await r.route.serve({path:s,query:new URL(e.req.url).searchParams,file:async(_,q,B)=>{const j=x(_,q);if(!j)return;const k=await g(j,c,{...p,...B});return o.add(k),k}},r.context);return h?(!o.has(h)&&!h.headers.has("access-control-allow-origin")&&h.headers.set("access-control-allow-origin","*"),h):await e.notFound()}catch(r){return e.text(r instanceof Error?r.message:String(r),500,{...p})}}}),b.get("/*",async e=>{if(!n.ui)return e.notFound();const t=x(C(n.ui),decodeURIComponent(e.req.path.slice(1)));return t?g(t,void 0,{"cache-control":"public, max-age=3600"}):e.notFound()});const S=new G({noServer:!0,maxPayload:512*1024*1024});S.on("connection",(e,t)=>{const c=i.connect(r=>{e.readyState===e.OPEN&&e.send(JSON.stringify(r))},{origin:R(t.headers.host??"")});e.on("message",(r,o)=>{if(o||!Buffer.isBuffer(r))return;let h;try{h=JSON.parse(r.toString("utf8"))}catch{e.send(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Not JSON."}}));return}c.receive(h)});const m=n.pingMs??PING_MS;let l=!0;e.on("pong",()=>{l=!0});const s=m>0?setInterval(()=>{if(!l){e.terminate();return}l=!1,e.ping()},m):void 0;s?.unref(),e.on("close",()=>{clearInterval(s),c.close()})});const L=M(b.fetch),H=(e,t)=>{e.writeHead(403,{"content-type":"text/plain; charset=utf-8"}),e.end(t)},w=D((e,t)=>{if(N(e),!E().has(e.headers.host??"")){H(t,"forbidden host");return}L(e,t)});w.on("upgrade",(e,t,c)=>{const m=new URL(e.url??"/","http://x"),l=(r,o)=>{t.end(`HTTP/1.1 ${String(r)} ${o}\r
2
+ import{randomBytes as F}from"node:crypto";import{readFile as D}from"node:fs/promises";import{createServer as J}from"node:http";import{join as M,resolve as C}from"node:path";import{getRequestListener as W}from"@hono/node-server";import{Hono as G}from"hono";import{WebSocketServer as K}from"ws";import{KeyedStore as Y}from"@allyhub/project";import{CollaboratorStateSchema as Q,PRESENCE_PATH as V,SNAPSHOT_TREE as $,TREE_PAGES as X,stageCsp as Z}from"@allyhub/protocol";import{runtimeFile as ee}from"@allyhub/stage-page";import{pathProblem as te}from"./paths.js";import{fileResponse as g}from"./respond.js";import{ProjectServer as ne}from"./project.js";import{STILL_NAME as re,inside as x,matteFile as oe,sourceName as se}from"./tree.js";export const RPC_PATH="/rpc",RAW_PATH="/files/raw/";const p={"access-control-allow-origin":"*"},L=/^[a-z][a-z0-9+.-]*:\/\/[a-z0-9.-]+(:\d{1,5})?$/u;export const PING_MS=3e4,ALLYHUB_FORWARDED="allyhub-forwarded";export function forwardedHost(n){const d=n[ALLYHUB_FORWARDED],y=(n.forwarded??(Array.isArray(d)?d[0]:d))?.split(",")[0]?.split(";").map(i=>i.trim().split("=")).find(([i])=>i?.toLowerCase()==="host")?.[1];if(y!==void 0)return y.replace(/^"(.*)"$/u,"$1");const u=n["x-forwarded-host"];return(Array.isArray(u)?u[0]:u)?.split(",")[0]?.trim()}export function frameSources(n){const d=["'self'","http://127.0.0.1:*","http://localhost:*"];if(n===void 0)return d;const a=new URL(n.replace("{port}","1")),y=new URL(n.replace("{port}","2"));if(a.port!==y.port)return[...d,`${a.protocol}//${a.hostname}:*`];const u=a.hostname.slice(a.hostname.indexOf(".")+1);return[...d,`${a.protocol}//*.${u}`]}export async function startDevServer(n){const d=C(n.root);if(n.embedder!==void 0&&!L.test(n.embedder))throw new Error(`Not an origin: ${n.embedder}`);if(n.publicOrigin!==void 0&&!L.test(n.publicOrigin.replace("{port}","1")))throw new Error(`Not an origin: ${n.publicOrigin}`);const a=n.token??F(18).toString("base64url"),u=`/s/${F(18).toString("base64url")}/`,i=await ne.open({...n,root:d,...n.publicOrigin===void 0?{}:{reveal:!1}});let f=0;const P=()=>f===0?void 0:n.publicOrigin?.replace("{port}",String(f)),v=()=>{const e=P();return e===void 0?void 0:new URL(e).host},E=()=>{const e=v();return new Set([`127.0.0.1:${String(f)}`,`localhost:${String(f)}`,...e===void 0?[]:[e]])},R=e=>e===v()?P()??"":`http://${e}`,N=e=>new URL(e.req.url).host,T=e=>R(N(e)),A=e=>{const t=v();t!==void 0&&forwardedHost(e.headers)===t&&(e.headers.host=t)},U=e=>e??`http://127.0.0.1:${String(f)}`;i.serving={file:(e,t)=>`${U(e)}${RAW_PATH}${t.split("/").map(encodeURIComponent).join("/")}?token=${encodeURIComponent(a)}`,tree:e=>`${U(e)}${u}`};const{routes:O}=i.live,b=new G,I=async e=>{if(!n.ui)return e.text("allyhub dev serves its editors here.",200);const t=await D(M(n.ui,"index.html"),"utf8").catch(()=>{});if(t===void 0)return e.text("The page's files are missing: build them first (pnpm --filter @allyhub/editor-web build).",500);const c=F(16).toString("base64");return e.html(t.replace(/<script/gu,`<script nonce="${c}"`).replace("</head>",`<meta name="allyhub-token" content="${a}"></head>`),200,{"content-security-policy":["default-src 'self'",`script-src 'self' 'nonce-${c}'`,"style-src 'self' 'unsafe-inline'","img-src 'self' data: blob:","media-src 'self' blob:","font-src 'self' data:",`connect-src 'self' ws://${N(e)}`,`frame-src ${frameSources(n.publicOrigin).join(" ")}`,`frame-ancestors ${n.embedder??"'none'"}`].join("; "),"cache-control":"no-store"})};b.get("/",I),b.post(V,async e=>{if(e.req.header("authorization")!==`Bearer ${a}`)return e.text("forbidden",403);const t=Q.safeParse(await e.req.json().catch(()=>{}));return t.success?(i.presence.agent(t.data),e.body(null,204)):e.text(t.error.message,400)}),b.get(`${RAW_PATH}*`,async e=>{if(e.req.query("token")!==a)return e.text("forbidden",403);const t=decodeURIComponent(e.req.path.slice(RAW_PATH.length));if(te(t)!==void 0)return e.text("forbidden",403);const c=x(d,t);return c?g(c,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)}),b.get(`${u}*`,async e=>{let t;try{t=decodeURIComponent(e.req.path.slice(u.length))}catch{return e.notFound()}const c=e.req.header("range"),m=T(e),l=t.slice(0,t.indexOf("/")+1),s=t.slice(l.length);switch(l){case $.runtime:{const r=ee(s);if(!r)return e.notFound();const o=Object.values(X).includes(t);return g(r,void 0,{...p,...o?{"content-security-policy":Z(`${m}${u}`,[m,...n.embedder?[n.embedder]:[],...n.framers??[]],O.loads())}:{}})}case $.build:{const r=se(s);if(r===void 0){const o=x(i.live.pieceDir,s);return o?g(o,void 0,p):e.notFound()}try{return e.json(await i.live.source(r),200,{...p,"cache-control":"no-store"})}catch(o){return e.json({error:{message:o instanceof Error?o.message:String(o)}},404,p)}}case $.media:{const o=Object.hasOwn(i.live.latest()?.media??{},s)||O.allowed(s)?x(d,s):void 0;return o?g(o,c,p):e.notFound()}case $.matte:{const r=oe(d,i.live.latest()?.media[s]);return r?g(r,c,{...p,"content-type":"video/mp4"}):e.notFound()}case $.stills:return re.test(s)?g(Y.of(d,"stills").path(s),void 0,{...p,"cache-control":"public, max-age=31536000, immutable"}):e.notFound();default:try{const r=await O.route(l);if(!r)return await e.notFound();const o=new WeakSet,h=await r.route.serve({path:s,query:new URL(e.req.url).searchParams,file:async(B,q,z)=>{const j=x(B,q);if(!j)return;const k=await g(j,c,{...p,...z});return o.add(k),k}},r.context);return h?(!o.has(h)&&!h.headers.has("access-control-allow-origin")&&h.headers.set("access-control-allow-origin","*"),h):await e.notFound()}catch(r){return e.text(r instanceof Error?r.message:String(r),500,{...p})}}}),b.get("/*",async e=>{if(!n.ui)return e.notFound();const t=x(C(n.ui),decodeURIComponent(e.req.path.slice(1)));return t?g(t,void 0,{"cache-control":"public, max-age=3600"}):e.notFound()});const S=new K({noServer:!0,maxPayload:512*1024*1024});S.on("connection",(e,t)=>{const c=i.connect(r=>{e.readyState===e.OPEN&&e.send(JSON.stringify(r))},{origin:R(t.headers.host??"")});e.on("message",(r,o)=>{if(o||!Buffer.isBuffer(r))return;let h;try{h=JSON.parse(r.toString("utf8"))}catch{e.send(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Not JSON."}}));return}c.receive(h)});const m=n.pingMs??PING_MS;let l=!0;e.on("pong",()=>{l=!0});const s=m>0?setInterval(()=>{if(!l){e.terminate();return}l=!1,e.ping()},m):void 0;s?.unref(),e.on("close",()=>{clearInterval(s),c.close()})});const H=W(b.fetch),_=(e,t)=>{e.writeHead(403,{"content-type":"text/plain; charset=utf-8"}),e.end(t)},w=J((e,t)=>{if(A(e),!E().has(e.headers.host??"")){_(t,"forbidden host");return}H(e,t)});w.on("upgrade",(e,t,c)=>{const m=new URL(e.url??"/","http://x"),l=(r,o)=>{t.end(`HTTP/1.1 ${String(r)} ${o}\r
3
3
  connection: close\r
4
4
  content-length: 0\r
5
5
  \r
6
- `)};N(e);const s=e.headers.host??"";if(!E().has(s)){l(403,"Forbidden");return}if(m.pathname!==RPC_PATH){l(404,"Not Found");return}if(e.headers.origin!==R(s)){l(403,"Forbidden");return}if(m.searchParams.get("token")!==a){l(403,"Forbidden");return}S.handleUpgrade(e,t,c,r=>{S.emit("connection",r,e)})});try{await new Promise((e,t)=>{w.once("error",t),w.listen(n.port??0,"127.0.0.1",()=>{e()})})}catch(e){throw await i.close(),e}return f=w.address().port,{url:`http://127.0.0.1:${String(f)}/`,port:f,token:a,tree:`http://127.0.0.1:${String(f)}${u}`,ui:n.ui,project:i,async close(){for(const e of S.clients)e.terminate();S.close(),await new Promise(e=>{w.closeAllConnections(),w.close(()=>{e()})}),await i.close()}}}
6
+ `)};A(e);const s=e.headers.host??"";if(!E().has(s)){l(403,"Forbidden");return}if(m.pathname!==RPC_PATH){l(404,"Not Found");return}if(e.headers.origin!==R(s)){l(403,"Forbidden");return}if(m.searchParams.get("token")!==a){l(403,"Forbidden");return}S.handleUpgrade(e,t,c,r=>{S.emit("connection",r,e)})});try{await new Promise((e,t)=>{w.once("error",t),w.listen(n.port??0,"127.0.0.1",()=>{e()})})}catch(e){throw await i.close(),e}return f=w.address().port,{url:`http://127.0.0.1:${String(f)}/`,port:f,token:a,tree:`http://127.0.0.1:${String(f)}${u}`,ui:n.ui,project:i,async close(){for(const e of S.clients)e.terminate();S.close(),await new Promise(e=>{w.closeAllConnections(),w.close(()=>{e()})}),await i.close()}}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/dev-server",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/diagnostics",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/doc",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/doc-extension",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./cli": {
@@ -1,7 +1,7 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{readFile as d}from"node:fs/promises";import{createRequire as g}from"node:module";import{dirname as p,join as y}from"node:path";import{openPage as l}from"@allyhub/browser";import{diagramConfig as v}from"@allyhub/doc";const h=g(import.meta.url);let m;export function katexCss(){return m??=(async()=>{const i=h.resolve("katex/dist/katex.min.css"),n=await d(i,"utf8"),o=[...n.matchAll(/src:url\((fonts\/[^)]+\.woff2)\) format\("woff2"\)[^;}]*/gu)];let a=n;for(const[t,e]of o){if(e===void 0)continue;const r=await d(y(p(i),e));a=a.replace(t,`src:url(data:font/woff2;base64,${r.toString("base64")}) format("woff2")`)}return a})(),m}let u;const x=()=>(u??=d(h.resolve("mermaid/dist/mermaid.min.js"),"utf8"),u);export async function drawDiagrams(i,n,o){const a=v(o),t=new Map,e=[...new Set(n)];if(e.length===0)return t;const r=await l(i,{width:900,height:1200,allow:()=>!1});try{await f(r,`<!doctype html><html><head><meta charset="utf-8"></head><body><script>${(await x()).replace(/<\/script/giu,"<\\/script")}<\/script></body></html>`);const s=await r.evaluate(`(async () => {
3
- const codes = ${JSON.stringify(e)};
4
- window.mermaid.initialize(${JSON.stringify(a)});
2
+ import{readFile as l}from"node:fs/promises";import{createRequire as y}from"node:module";import{dirname as p,join as m}from"node:path";import{openPage as u}from"@allyhub/browser";import{diagramConfig as v}from"@allyhub/doc";import{createPackages as x}from"@allyhub/runtimes";const h=y(import.meta.url);let f;export function katexCss(){return f??=(async()=>{const e=h.resolve("katex/dist/katex.min.css"),a=await l(e,"utf8"),n=[...a.matchAll(/src:url\((fonts\/[^)]+\.woff2)\) format\("woff2"\)[^;}]*/gu)];let r=a;for(const[i,t]of n){if(t===void 0)continue;const o=await l(m(p(e),t));r=r.replace(i,`src:url(data:font/woff2;base64,${o.toString("base64")}) format("woff2")`)}return r})(),f}let c;const b=()=>(c??=(async()=>{let e;try{e=h.resolve("mermaid/dist/mermaid.min.js")}catch{const{dir:a}=await x().ensure("mermaid");e=m(a,"node_modules","mermaid","dist","mermaid.min.js")}return l(e,"utf8")})(),c.catch(()=>{c=void 0}),c);export async function drawDiagrams(e,a,n){const r=v(n),i=new Map,t=[...new Set(a)];if(t.length===0)return i;const o=await u(e,{width:900,height:1200,allow:()=>!1});try{await w(o,`<!doctype html><html><head><meta charset="utf-8"></head><body><script>${(await b()).replace(/<\/script/giu,"<\\/script")}<\/script></body></html>`);const s=await o.evaluate(`(async () => {
3
+ const codes = ${JSON.stringify(t)};
4
+ window.mermaid.initialize(${JSON.stringify(r)});
5
5
  const out = [];
6
6
  for (let i = 0; i < codes.length; i++) {
7
7
  try {
@@ -24,4 +24,4 @@ import{readFile as d}from"node:fs/promises";import{createRequire as g}from"node:
24
24
  }
25
25
  }
26
26
  return out;
27
- })()`);e.forEach((c,w)=>{t.set(c,s[w]??{error:"Mermaid drew nothing"})})}finally{await r.close()}return t}async function f(i,n){const{frameTree:o}=await i.session.send("Page.getFrameTree");await i.session.send("Page.setDocumentContent",{frameId:o.frame.id,html:n}),await i.evaluate("new Promise((r) => (document.readyState === 'complete' ? r(true) : addEventListener('load', () => r(true), { once: true })))")}const b=2;export async function mathPictures(i,n){const o=new Map,a=[...new Set(n)];if(a.length===0)return o;const t=await l(i,{width:900,height:1200,scale:b,allow:()=>!1});try{await f(t,`<!doctype html><html><head><meta charset="utf-8"><style>${await katexCss()} body{margin:0;background:#fff} .eq{display:inline-block;padding:2px 4px} .katex-display{margin:0}</style></head><body>${a.map((e,r)=>`<div><div class="eq" id="eq${String(r)}">${e}</div></div>`).join("")}</body></html>`),await t.evaluate("document.fonts.ready.then(() => true)");for(let e=0;e<a.length;e++){const r=a[e];if(r===void 0)continue;const s=await t.evaluate(`(() => { const r = document.getElementById("eq${String(e)}")?.getBoundingClientRect(); return r ? { x: r.x, y: r.y + scrollY, width: r.width, height: r.height } : null; })()`);if(!s||s.width===0||s.height===0)continue;const c=await t.session.send("Page.captureScreenshot",{format:"png",clip:{...s,scale:1},captureBeyondViewport:!0});o.set(r,{data:Buffer.from(c.data,"base64"),width:Math.ceil(s.width),height:Math.ceil(s.height)})}}finally{await t.close()}return o}
27
+ })()`);t.forEach((d,g)=>{i.set(d,s[g]??{error:"Mermaid drew nothing"})})}finally{await o.close()}return i}async function w(e,a){const{frameTree:n}=await e.session.send("Page.getFrameTree");await e.session.send("Page.setDocumentContent",{frameId:n.frame.id,html:a}),await e.evaluate("new Promise((r) => (document.readyState === 'complete' ? r(true) : addEventListener('load', () => r(true), { once: true })))")}const S=2;export async function mathPictures(e,a){const n=new Map,r=[...new Set(a)];if(r.length===0)return n;const i=await u(e,{width:900,height:1200,scale:S,allow:()=>!1});try{await w(i,`<!doctype html><html><head><meta charset="utf-8"><style>${await katexCss()} body{margin:0;background:#fff} .eq{display:inline-block;padding:2px 4px} .katex-display{margin:0}</style></head><body>${r.map((t,o)=>`<div><div class="eq" id="eq${String(o)}">${t}</div></div>`).join("")}</body></html>`),await i.evaluate("document.fonts.ready.then(() => true)");for(let t=0;t<r.length;t++){const o=r[t];if(o===void 0)continue;const s=await i.evaluate(`(() => { const r = document.getElementById("eq${String(t)}")?.getBoundingClientRect(); return r ? { x: r.x, y: r.y + scrollY, width: r.width, height: r.height } : null; })()`);if(!s||s.width===0||s.height===0)continue;const d=await i.session.send("Page.captureScreenshot",{format:"png",clip:{...s,scale:1},captureBeyondViewport:!0});n.set(o,{data:Buffer.from(d.data,"base64"),width:Math.ceil(s.width),height:Math.ceil(s.height)})}}finally{await i.close()}return n}
@@ -1,4 +1,4 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{readFile as d}from"node:fs/promises";import{createRequire as T}from"node:module";import{dirname as m,join as p}from"node:path";import{EMOJI_PATTERN as $,effectiveLook as b}from"@allyhub/doc";const A=T(import.meta.url),R=["@fontsource/carlito/400.css","@fontsource/carlito/400-italic.css","@fontsource/carlito/700.css","@fontsource/carlito/700-italic.css","@fontsource/noto-sans-sc/400.css","@fontsource/noto-sans-sc/700.css"];export const SHEET_FONT="Carlito";let w;async function g(s=R){const n=[];for(const t of s){const o=A.resolve(t),e=await d(o,"utf8");for(const[r]of e.matchAll(/@font-face\s*\{[^}]*\}/gu)){const c=/url\(\.\/(files\/[^)]+\.woff2)\)/u.exec(r)?.[1];if(c===void 0)continue;const f=(/unicode-range:\s*([^;}]+)/u.exec(r)?.[1]??"U+0-10FFFF").split(",").map(u=>{const[l="0",x]=u.trim().replace(/^U\+/iu,"").split("-"),S=Number.parseInt(l.replaceAll("?","0"),16),j=Number.parseInt((x??l).replaceAll("?","F"),16);return[S,j]});n.push({css:r.replace(/src:[^;]+;/u,`src: url(${p(m(o),c)}) format('woff2');`),file:p(m(o),c),ranges:f})}}return n}export async function sheetFontsCss(s){return w??=g(),E(await w,s)}const i=s=>[`@fontsource/${s}/400.css`,`@fontsource/${s}/400-italic.css`,`@fontsource/${s}/700.css`,`@fontsource/${s}/700-italic.css`],C={carlito:i("carlito"),caladea:i("caladea"),cousine:i("cousine"),tinos:i("tinos"),"noto-sans-sc":["@fontsource/noto-sans-sc/400.css","@fontsource/noto-sans-sc/700.css"],"noto-serif-sc":["@fontsource/noto-serif-sc/400.css","@fontsource/noto-serif-sc/700.css"],"lxgw-wenkai":["@fontsource/lxgw-wenkai/500.css","@fontsource/lxgw-wenkai/700.css"],"noto-color-emoji":["@fontsource/noto-color-emoji/emoji.css"]},O={sans:["carlito","noto-sans-sc"],serif:["caladea","noto-serif-sc"],mono:["cousine","noto-sans-sc"],times:["tinos","noto-serif-sc"],song:["noto-serif-sc"],hei:["noto-sans-sc"],fangsong:["noto-serif-sc"],kai:["lxgw-wenkai","noto-serif-sc"],xiaobiaosong:["noto-serif-sc"]};export function docFaces(s){const n=b(s),t=[n.font??"sans","mono",...[n.title?.font,...Object.values(n.headings??{}).map(o=>o.font),n.header===!1?void 0:n.header?.font,n.footer===!1?void 0:n.footer?.font].filter(o=>o!==void 0)];return[...new Set([...t.flatMap(o=>O[o]),"noto-color-emoji"])]}const h=new Map;export async function docFontsCss(s,n){const t=[];for(const o of new Set(n)){let e=h.get(o);e===void 0&&(e=g(C[o]),h.set(o,e)),t.push(await E(await e,o==="noto-color-emoji"?(s.match(new RegExp($,"gu"))??[]).join(""):s))}return t.filter(o=>o!=="").join(`
3
- `)}async function E(s,n){const t=new Set;for(const e of n)t.add(e.codePointAt(0)??0);const o=[];for(const e of s){if(![...t].some(a=>e.ranges.some(([f,u])=>a>=f&&a<=u)))continue;let c=F.get(e.file);c===void 0&&(c=`url(data:font/woff2;base64,${(await d(e.file)).toString("base64")})`,F.set(e.file,c)),o.push(e.css.replace(`url(${e.file})`,c))}return o.join(`
4
- `)}const F=new Map;
2
+ import{readFile as h}from"node:fs/promises";import{createRequire as b}from"node:module";import{dirname as O,join as l}from"node:path";import{EMOJI_PATTERN as T,effectiveLook as $}from"@allyhub/doc";import{createPackages as C}from"@allyhub/runtimes";const g=new Map;function M(o){let e=g.get(o);if(e===void 0){const n=`@fontsource/${o}`;e=(async()=>{try{return O(b(import.meta.url).resolve(`${n}/package.json`))}catch{}const{dir:r}=await C().ensure(`fontsource-${o}`);return l(r,"node_modules",n)})(),e.catch(()=>g.delete(o)),g.set(o,e)}return e}export const SHEET_FONT="Carlito";async function P(o,e){const n=await M(o),r=[];for(const t of e){const f=await h(l(n,t),"utf8");for(const[i]of f.matchAll(/@font-face\s*\{[^}]*\}/gu)){const a=/url\(\.\/(files\/[^)]+\.woff2)\)/u.exec(i)?.[1];if(a===void 0)continue;const c=(/unicode-range:\s*([^;}]+)/u.exec(i)?.[1]??"U+0-10FFFF").split(",").map(m=>{const[u="0",p]=m.trim().replace(/^U\+/iu,"").split("-"),A=Number.parseInt(u.replaceAll("?","0"),16),R=Number.parseInt((p??u).replaceAll("?","F"),16);return[A,R]});r.push({css:i.replace(/src:[^;]+;/u,`src: url(${l(n,a)}) format('woff2');`),file:l(n,a),ranges:c})}}return r}export function sheetFontsCss(o){return k(o,["carlito","noto-sans-sc"])}const d=["400.css","400-italic.css","700.css","700-italic.css"],I={carlito:d,caladea:d,cousine:d,tinos:d,"noto-sans-sc":["400.css","700.css"],"noto-serif-sc":["400.css","700.css"],"lxgw-wenkai":["500.css","700.css"],"noto-color-emoji":["emoji.css"]},F=new Set(["noto-sans-sc","noto-serif-sc","lxgw-wenkai","noto-color-emoji"]),j={sans:["carlito","noto-sans-sc"],serif:["caladea","noto-serif-sc"],mono:["cousine","noto-sans-sc"],times:["tinos","noto-serif-sc"],song:["noto-serif-sc"],hei:["noto-sans-sc"],fangsong:["noto-serif-sc"],kai:["lxgw-wenkai","noto-serif-sc"],xiaobiaosong:["noto-serif-sc"]};function N(o){const e=$(o);return[e.font??"sans","mono",...[e.title?.font,...Object.values(e.headings??{}).map(n=>n.font),e.header===!1?void 0:e.header?.font,e.footer===!1?void 0:e.footer?.font].filter(n=>n!==void 0)]}export function docFaces(o){const e=N(o);return{faces:[...new Set([...e.flatMap(n=>j[n]),"noto-color-emoji"])],leading:[...new Set(e.map(n=>j[n][0]).filter(n=>n!==void 0))]}}const w=new Map;function S(o){let e=w.get(o);return e===void 0&&(e=P(o,I[o]),e.catch(()=>w.delete(o)),w.set(o,e)),e}export function docFontsCss(o,e){return k(o,e.faces,e.leading)}async function k(o,e,n=[]){const r=new RegExp(T,"gu"),t=[],f=[];for(const s of new Set(e)){if(F.has(s))continue;const c=await S(s);f.push(...c),t.push(await x(c,o))}const i=[...new Set(o.replace(r,""))].filter(s=>{const c=s.codePointAt(0)??0;return c>32&&!/\s/u.test(s)&&!f.some(m=>m.ranges.some(([u,p])=>c>=u&&c<=p))}).join(""),a=(o.match(r)??[]).join("");for(const s of new Set(e)){if(!F.has(s))continue;const c=s==="noto-color-emoji"?a:n.includes(s)?o:i;c!==""&&t.push(await x(await S(s),c))}return t.filter(s=>s!=="").join(`
3
+ `)}async function x(o,e){const n=new Set;for(const t of e)n.add(t.codePointAt(0)??0);const r=[];for(const t of o){if(![...n].some(a=>t.ranges.some(([s,c])=>a>=s&&a<=c)))continue;let i=E.get(t.file);i===void 0&&(i=`url(data:font/woff2;base64,${(await h(t.file)).toString("base64")})`,E.set(t.file,i)),r.push(t.css.replace(`url(${t.file})`,i))}return r.join(`
4
+ `)}const E=new Map;
@@ -1,5 +1,5 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{mkdir as nt,mkdtemp as at,readFile as T,rm as st}from"node:fs/promises";import{tmpdir as ot}from"node:os";import{dirname as it,join as F}from"node:path";import{openPage as j,startBrowser as rt}from"@allyhub/browser";import{PAPER as q,blockNumbers as O,docParts as lt,effectiveLook as ct,everyBlock as L,headingAnchors as dt,pageFaces as _,parseDoc as ft,resolvePage as pt,shownBlocks as H,sizePt as ht,splitTitle as U,titleText as gt}from"@allyhub/doc";import{PDFArray as W,PDFDict as G,PDFDocument as B,PDFName as A,PDFNumber as ut,PDFString as mt}from"pdf-lib";import{PdfJoiner as J}from"./pdf.js";import{docPage as wt,PICTURE_DPI as bt,printOne as K,setContent as V,shrinkPictures as yt}from"./print.js";const $=25.4/72,xt=96/25.4,I="https://allyhub.invalid/",kt=3,vt=t=>`(() => {
2
+ import{mkdir as Z,mkdtemp as tt,readFile as T,rm as et}from"node:fs/promises";import{tmpdir as nt}from"node:os";import{dirname as at,join as B}from"node:path";import{openPage as j,startBrowser as st}from"@allyhub/browser";import{PAPER as q,blockNumbers as L,docParts as ot,effectiveLook as it,everyBlock as O,headingAnchors as rt,pageFaces as _,parseDoc as lt,resolvePage as ct,shownBlocks as H,sizePt as dt,splitTitle as U,titleText as ft}from"@allyhub/doc";import{PdfJoiner as W,pdfLib as G}from"./pdf.js";import{docPage as pt,PICTURE_DPI as ht,printOne as J,setContent as K,shrinkPictures as gt}from"./print.js";const A=25.4/72,ut=96/25.4,I="https://allyhub.invalid/",mt=3,wt=t=>`(() => {
3
3
  const H = ${JSON.stringify(I)};
4
4
  const style = document.createElement("style");
5
5
  style.textContent = "a.allyhub-m{position:absolute;width:1px;height:1lh;margin:0;padding:0;border:0}a.allyhub-box{left:0;top:0;width:100%;height:100%}";
@@ -15,7 +15,7 @@ import{mkdir as nt,mkdtemp as at,readFile as T,rm as st}from"node:fs/promises";i
15
15
  const placed = (el) => {
16
16
  if (getComputedStyle(el).position === "static") el.style.position = "relative";
17
17
  };
18
- const px = ${String(xt)};
18
+ const px = ${String(ut)};
19
19
  const out = { lines: {}, over: {}, drawn: {} };
20
20
  const range = document.createRange();
21
21
  const els = [...document.querySelectorAll("[data-b]")];
@@ -106,11 +106,11 @@ import{mkdir as nt,mkdtemp as at,readFile as T,rm as st}from"node:fs/promises";i
106
106
  }
107
107
  }
108
108
  return out;
109
- })()`;async function Pt(t,n,s,i,c){const o=await j(t,{width:1200,height:1200,allow:()=>!1});try{await V(o,n),c!==!1&&await yt(o,c);const e=i?await o.evaluate(vt(s)):void 0;return{pdf:await K(o,!i),...e===void 0?{}:{marks:e}}}finally{await o.close()}}async function St(t,n){const s=await B.load(t,{updateMetadata:!1}),i=[],c=[];return s.getPages().forEach((o,e)=>{const{width:a,height:r}=o.getSize();i.push({width:a*$,height:r*$});const p=o.node.lookupMaybe(A.of("Annots"),W);if(p)for(let m=0;m<p.size();m++){const l=p.lookupMaybe(m,G),u=l?.lookupMaybe(A.of("A"),G)?.lookupMaybe(A.of("URI"),mt),h=l?.lookupMaybe(A.of("Rect"),W);if(!u||!h)continue;const w=u.decodeText();if(!w.startsWith(I))continue;const[y=0,b=0,g=0,k=0]=h.asArray().map(P=>P instanceof ut?P.asNumber():0),[v="",...M]=w.slice(I.length).split("/");c.push({kind:v,parts:M,at:{page:n+e+1,top:(r-Math.max(b,k))*$,bottom:(r-Math.min(b,k))*$,left:Math.min(y,g)*$,right:Math.max(y,g)*$}})}}),{pages:i,marks:c}}async function $t(t,n,s,i){const c=[],o=new Map;for(const e of t){const a=e.marks??{lines:{},over:{},drawn:{}},{pages:r,marks:p}=await St(e.pdf,c.length);for(const l of r){const f=c.length,{top:u,right:h,bottom:w,left:y}=n.margins;c.push({n:f+1,width:l.width,height:l.height,landscape:l.width>l.height,text:{top:f===0&&s.cover!==void 0?0:u,bottom:l.height-w,left:y,right:l.width-h}})}const m=l=>{let f=o.get(l);if(!f){const u=a.over[String(l)],h=a.drawn[String(l)];f={n:l,boxes:[],lines:[],rows:[],past:u?.past??0,pastPaper:u?.pastPaper??0,...h===void 0?{}:{drawn:h}},o.set(l,f)}return f};for(const{kind:l,parts:f,at:u}of p){const h=Number(f[0]);if(!Number.isInteger(h))continue;const w=m(h);if(l==="B")w.boxes.push(u);else if(l==="E")w.end=u;else if(l==="R")w.rows.push({...u,row:Number(f[1])});else if(l==="L"){const y=Number(f[1]),b=a.lines[String(h)]?.[y];w.lines[y]={...u,chars:b?.chars??0,letters:b?.letters??0,first:b?.first??"",last:b?.last??""}}}}for(const e of o.values())e.lines=Object.values(e.lines),e.boxes.sort((a,r)=>a.page-r.page||a.top-r.top),e.rows.sort((a,r)=>a.row-r.row);return{pages:c,blocks:o,numbered:i,page:n}}export function headingPages(t,n){const s=O(n),i=new Map;for(const[c,o]of dt(n)){const e=s.get(c),a=e===void 0?void 0:t.blocks.get(e),r=a?.lines[0]?.page??a?.boxes[0]?.page;r!==void 0&&i.set(o,r)}return i}const Mt=(t,n)=>t.size===n.size&&[...t].every(([s,i])=>n.get(s)===i);export async function printDoc(t){const n=await T(F(t.root,t.doc.file),"utf8"),s=ft(n),i=pt(s.page),c=O(s.blocks),o=[...L(s.blocks)].some(a=>a.type==="toc"),e=await rt({gpu:!1,htmlInCanvas:!1});try{let a=o?new Map:void 0;const r=g=>g===void 0?void 0:k=>g.get(k)??88;let p,m=0,l=!0;const f=lt(s.blocks),u=g=>f[g]?.landscape===!0?i.height:i.width,h=async g=>{const k=[];for(let v=0;v<f.length;v++){t.signal?.throwIfAborted();const M=await wt(t.root,t.doc,t.stills,{...g?{ids:!0}:{},headingPage:r(a),...f.length>1?{part:v}:{}});k.push(await Pt(e,M,u(v),g,s.page.pictureDpi??bt))}return k};for(;m+=1,p=await $t(await h(!0),i,s.page,c),a!==void 0;){const g=headingPages(p,s.blocks);if(Mt(g,a))break;if(a=g,m>=kt){l=!1;break}}const w=await At((await h(!1)).map(g=>g.pdf)),y=await Ct(e,p,s.blocks,s.page,t.doc);return{pdf:await Ft(w,y),layout:p,passes:m,settled:l}}finally{await e.close()}}async function At(t){if(t.length===1&&t[0]!==void 0)return t[0];const n=await at(F(ot(),"allyhub-doc-parts-"));try{const s=F(n,"doc.pdf"),i=await J.create(s);try{for(const c of t)await i.add(c)}finally{await i.close({})}return await T(s)}finally{await st(n,{recursive:!0,force:!0})}}export async function writeDocPdf(t){const n=await printDoc(t);await nt(it(t.file),{recursive:!0});const s=await J.create(t.file);try{await s.add(n.pdf)}finally{await s.close(t.title===void 0?{}:{title:t.title})}return n}const Rt=(t,n)=>t.replaceAll("{title}",n.title).replaceAll("{section}",n.section).replaceAll("{page}",String(n.page)).replaceAll("{pages}",String(n.pages)),Nt=t=>t.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;");function Et(t,n){const{title:s}=U(H(n)),i=[...L(n)].filter(e=>e.type==="heading"&&e!==s),c=Math.min(...i.map(e=>e.level)),o=i.filter(e=>e.level===c).map(e=>{const a=t.numbered.get(e),r=a===void 0?void 0:t.blocks.get(a);return{page:r?.lines[0]?.page??r?.boxes[0]?.page??0,words:e.content.map(p=>p.text).join("")}}).filter(e=>e.page>0);return t.pages.map(e=>{const a=o.find(r=>r.page===e.n);return a?a.words:o.filter(r=>r.page<e.n).at(-1)?.words??""})}async function Ct(t,n,s,i,c){const o=n.page,{header:e,footer:a}=o;if(e===void 0&&a===void 0)return null;const r=ct(i),p=gt(U(H(s)).title).trim(),m=p!==""?p:c.title??c.path,l=Et(n,s),f=_(i),u=n.pages.length,h=(d,x,R,X)=>{const Y={title:m,section:l[x.n-1]??"",page:x.n,pages:u},z=x.n%2===1,S={left:[],center:[],right:[]};d.left!==void 0&&S.left.push(d.left),d.center!==void 0&&S.center.push(d.center),d.right!==void 0&&S.right.push(d.right),d.outside!==void 0&&S[z?"right":"left"].push(d.outside),d.inside!==void 0&&S[z?"left":"right"].push(d.inside);const Q=d.size===void 0?Math.max(7.5,o.size*.75):ht(d.size),Z=(d.font===void 0?f.text:Bt(d.font)).replaceAll('"',"'"),D=C=>Math.min(7,C/2),tt=R==="head"?`top:${String(x.text.top-D(o.margins.top))}mm;transform:translateY(-100%)`:`top:${String(x.text.bottom+D(o.margins.bottom))}mm`,N=C=>Nt(S[C].map(et=>Rt(et,Y)).join(" ")),E="white-space:nowrap;overflow:hidden;text-overflow:ellipsis";return`<div style="position:absolute;left:${String(x.text.left)}mm;width:${String(x.text.right-x.text.left)}mm;${tt};display:flex;justify-content:space-between;gap:6mm;font-family:${Z};font-size:${String(Q)}pt;line-height:1.2;color:${X?q.leadSoft:q.ink}"><span style="min-width:0;${E}">${N("left")}</span><span style="position:absolute;left:0;right:0;text-align:center;${E}">${N("center")}</span><span style="min-width:0;text-align:right;${E}">${N("right")}</span></div>`},w=r.footer===void 0,b=n.pages.map(d=>{const x=e!==void 0&&!(d.n===1&&r.cover!==void 0)?h(e,d,"head",r.header===void 0):"",R=a===void 0?"":h(a,d,"foot",w);return`<div class="sheet${d.landscape?" turned":""}" style="width:${String(d.width)}mm;height:${String(d.height)}mm">${x}${R}</div>`}).join(""),{docFaces:g,docFontsCss:k}=await import("./fonts.js"),M=`<!doctype html><html><head><meta charset="utf-8"><style>${await k(`${m}${l.join("")}${b}`,g(i))}</style><style>
109
+ })()`;async function bt(t,n,s,i,d){const o=await j(t,{width:1200,height:1200,allow:()=>!1});try{await K(o,n),d!==!1&&await gt(o,d);const e=i?await o.evaluate(wt(s)):void 0;return{pdf:await J(o,!i),...e===void 0?{}:{marks:e}}}finally{await o.close()}}async function yt(t,n){const{PDFArray:s,PDFDict:i,PDFDocument:d,PDFName:o,PDFNumber:e,PDFString:a}=await G(),r=await d.load(t,{updateMetadata:!1}),h=[],w=[];return r.getPages().forEach((l,f)=>{const{width:g,height:p}=l.getSize();h.push({width:g*A,height:p*A});const m=l.node.lookupMaybe(o.of("Annots"),s);if(m)for(let y=0;y<m.size();y++){const x=m.lookupMaybe(y,i),k=x?.lookupMaybe(o.of("A"),i)?.lookupMaybe(o.of("URI"),a),v=x?.lookupMaybe(o.of("Rect"),s);if(!k||!v)continue;const P=k.decodeText();if(!P.startsWith(I))continue;const[S=0,c=0,b=0,$=0]=v.asArray().map(R=>R instanceof e?R.asNumber():0),[N="",...E]=P.slice(I.length).split("/");w.push({kind:N,parts:E,at:{page:n+f+1,top:(p-Math.max(c,$))*A,bottom:(p-Math.min(c,$))*A,left:Math.min(S,b)*A,right:Math.max(S,b)*A}})}}),{pages:h,marks:w}}async function xt(t,n,s,i){const d=[],o=new Map;for(const e of t){const a=e.marks??{lines:{},over:{},drawn:{}},{pages:r,marks:h}=await yt(e.pdf,d.length);for(const l of r){const f=d.length,{top:g,right:p,bottom:m,left:y}=n.margins;d.push({n:f+1,width:l.width,height:l.height,landscape:l.width>l.height,text:{top:f===0&&s.cover!==void 0?0:g,bottom:l.height-m,left:y,right:l.width-p}})}const w=l=>{let f=o.get(l);if(!f){const g=a.over[String(l)],p=a.drawn[String(l)];f={n:l,boxes:[],lines:[],rows:[],past:g?.past??0,pastPaper:g?.pastPaper??0,...p===void 0?{}:{drawn:p}},o.set(l,f)}return f};for(const{kind:l,parts:f,at:g}of h){const p=Number(f[0]);if(!Number.isInteger(p))continue;const m=w(p);if(l==="B")m.boxes.push(g);else if(l==="E")m.end=g;else if(l==="R")m.rows.push({...g,row:Number(f[1])});else if(l==="L"){const y=Number(f[1]),x=a.lines[String(p)]?.[y];m.lines[y]={...g,chars:x?.chars??0,letters:x?.letters??0,first:x?.first??"",last:x?.last??""}}}}for(const e of o.values())e.lines=Object.values(e.lines),e.boxes.sort((a,r)=>a.page-r.page||a.top-r.top),e.rows.sort((a,r)=>a.row-r.row);return{pages:d,blocks:o,numbered:i,page:n}}export function headingPages(t,n){const s=L(n),i=new Map;for(const[d,o]of rt(n)){const e=s.get(d),a=e===void 0?void 0:t.blocks.get(e),r=a?.lines[0]?.page??a?.boxes[0]?.page;r!==void 0&&i.set(o,r)}return i}const kt=(t,n)=>t.size===n.size&&[...t].every(([s,i])=>n.get(s)===i);export async function printDoc(t){const n=await T(B(t.root,t.doc.file),"utf8"),s=lt(n),i=ct(s.page),d=L(s.blocks),o=[...O(s.blocks)].some(a=>a.type==="toc"),e=await st({gpu:!1,htmlInCanvas:!1});try{let a=o?new Map:void 0;const r=u=>u===void 0?void 0:k=>u.get(k)??88;let h,w=0,l=!0;const f=ot(s.blocks),g=u=>f[u]?.landscape===!0?i.height:i.width,p=async u=>{const k=[];for(let v=0;v<f.length;v++){t.signal?.throwIfAborted();const P=await pt(t.root,t.doc,t.stills,{...u?{ids:!0}:{},headingPage:r(a),...f.length>1?{part:v}:{}});k.push(await bt(e,P,g(v),u,s.page.pictureDpi??ht))}return k};for(;w+=1,h=await xt(await p(!0),i,s.page,d),a!==void 0;){const u=headingPages(h,s.blocks);if(kt(u,a))break;if(a=u,w>=mt){l=!1;break}}const m=await vt((await p(!1)).map(u=>u.pdf)),y=await Mt(e,h,s.blocks,s.page,t.doc);return{pdf:await At(m,y),layout:h,passes:w,settled:l}}finally{await e.close()}}async function vt(t){if(t.length===1&&t[0]!==void 0)return t[0];const n=await tt(B(nt(),"allyhub-doc-parts-"));try{const s=B(n,"doc.pdf"),i=await W.create(s);try{for(const d of t)await i.add(d)}finally{await i.close({})}return await T(s)}finally{await et(n,{recursive:!0,force:!0})}}export async function writeDocPdf(t){const n=await printDoc(t);await Z(at(t.file),{recursive:!0});const s=await W.create(t.file);try{await s.add(n.pdf)}finally{await s.close(t.title===void 0?{}:{title:t.title})}return n}const Pt=(t,n)=>t.replaceAll("{title}",n.title).replaceAll("{section}",n.section).replaceAll("{page}",String(n.page)).replaceAll("{pages}",String(n.pages)),St=t=>t.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;");function $t(t,n){const{title:s}=U(H(n)),i=[...O(n)].filter(e=>e.type==="heading"&&e!==s),d=Math.min(...i.map(e=>e.level)),o=i.filter(e=>e.level===d).map(e=>{const a=t.numbered.get(e),r=a===void 0?void 0:t.blocks.get(a);return{page:r?.lines[0]?.page??r?.boxes[0]?.page??0,words:e.content.map(h=>h.text).join("")}}).filter(e=>e.page>0);return t.pages.map(e=>{const a=o.find(r=>r.page===e.n);return a?a.words:o.filter(r=>r.page<e.n).at(-1)?.words??""})}async function Mt(t,n,s,i,d){const o=n.page,{header:e,footer:a}=o;if(e===void 0&&a===void 0)return null;const r=it(i),h=ft(U(H(s)).title).trim(),w=h!==""?h:d.title??d.path,l=$t(n,s),f=_(i),g=n.pages.length,p=(c,b,$,N)=>{const E={title:w,section:l[b.n-1]??"",page:b.n,pages:g},R=b.n%2===1,M={left:[],center:[],right:[]};c.left!==void 0&&M.left.push(c.left),c.center!==void 0&&M.center.push(c.center),c.right!==void 0&&M.right.push(c.right),c.outside!==void 0&&M[R?"right":"left"].push(c.outside),c.inside!==void 0&&M[R?"left":"right"].push(c.inside);const V=c.size===void 0?Math.max(7.5,o.size*.75):dt(c.size),X=(c.font===void 0?f.text:Rt(c.font)).replaceAll('"',"'"),z=D=>Math.min(7,D/2),Y=$==="head"?`top:${String(b.text.top-z(o.margins.top))}mm;transform:translateY(-100%)`:`top:${String(b.text.bottom+z(o.margins.bottom))}mm`,F=D=>St(M[D].map(Q=>Pt(Q,E)).join(" ")),C="white-space:nowrap;overflow:hidden;text-overflow:ellipsis";return`<div style="position:absolute;left:${String(b.text.left)}mm;width:${String(b.text.right-b.text.left)}mm;${Y};display:flex;justify-content:space-between;gap:6mm;font-family:${X};font-size:${String(V)}pt;line-height:1.2;color:${N?q.leadSoft:q.ink}"><span style="min-width:0;${C}">${F("left")}</span><span style="position:absolute;left:0;right:0;text-align:center;${C}">${F("center")}</span><span style="min-width:0;text-align:right;${C}">${F("right")}</span></div>`},m=r.footer===void 0,x=n.pages.map(c=>{const b=e!==void 0&&!(c.n===1&&r.cover!==void 0)?p(e,c,"head",r.header===void 0):"",$=a===void 0?"":p(a,c,"foot",m);return`<div class="sheet${c.landscape?" turned":""}" style="width:${String(c.width)}mm;height:${String(c.height)}mm">${b}${$}</div>`}).join(""),{docFaces:u,docFontsCss:k}=await import("./fonts.js"),P=`<!doctype html><html><head><meta charset="utf-8"><style>${await k(`${w}${l.join("")}${x}`,u(i))}</style><style>
110
110
  @page { size: ${String(o.width)}mm ${String(o.height)}mm; margin: 0; }
111
111
  @page turned { size: ${String(o.height)}mm ${String(o.width)}mm; margin: 0; }
112
112
  html, body { margin: 0; padding: 0; background: transparent; }
113
113
  .sheet { position: relative; overflow: hidden; break-after: page; }
114
114
  .sheet:last-child { break-after: auto; }
115
115
  .sheet.turned { page: turned; }
116
- </style></head><body>${b}</body></html>`,P=await j(t,{width:1200,height:1200,allow:()=>!1});try{return await V(P,M),await K(P,!1)}finally{await P.close()}}async function Ft(t,n){if(n===null)return t;const s=await B.load(t,{updateMetadata:!1}),i=await B.load(n,{updateMetadata:!1}),c=s.getPages(),o=await s.embedPdf(i,c.map((e,a)=>Math.min(a,i.getPageCount()-1)));return c.forEach((e,a)=>{const r=o[a];if(r===void 0)return;const{width:p,height:m}=e.getSize();e.drawPage(r,{x:0,y:0,width:p,height:m})}),Buffer.from(await s.save({useObjectStreams:!1}))}function Bt(t){return _({font:t}).text}
116
+ </style></head><body>${x}</body></html>`,S=await j(t,{width:1200,height:1200,allow:()=>!1});try{return await K(S,P),await J(S,!1)}finally{await S.close()}}async function At(t,n){if(n===null)return t;const{PDFDocument:s}=await G(),i=await s.load(t,{updateMetadata:!1}),d=await s.load(n,{updateMetadata:!1}),o=i.getPages(),e=await i.embedPdf(d,o.map((a,r)=>Math.min(r,d.getPageCount()-1)));return o.forEach((a,r)=>{const h=e[r];if(h===void 0)return;const{width:w,height:l}=a.getSize();a.drawPage(h,{x:0,y:0,width:w,height:l})}),Buffer.from(await i.save({useObjectStreams:!1}))}function Rt(t){return _({font:t}).text}
@@ -1,7 +1,7 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{open as D}from"node:fs/promises";const v=new Set([0,9,10,12,13,32]),F=new Set(Buffer.from("()<>[]{}/%","latin1"));class B{bytes;text;at=0;offsets=new Map;trailer;constructor(t){this.bytes=t,this.text=t.toString("latin1");const e=/startxref\s+(\d+)\s+%%EOF\s*$/u.exec(this.text);if(!e)throw new Error("Not a PDF: no startxref.");if(this.at=Number(e[1]),!this.text.startsWith("xref",this.at))throw new Error("This PDF keeps its cross-references in a stream, which this reader does not read.");for(this.at+=4;this.skip(),!this.text.startsWith("trailer",this.at);){const s=this.number(),i=this.number();this.skip();for(let d=0;d<i;d++){const g=this.text.slice(this.at,this.at+20);g[17]==="n"&&this.offsets.set(s+d,Number(g.slice(0,10))),this.at+=20}}this.at+=7;const r=this.value();if(r.t!=="dict")throw new Error("Not a PDF: its trailer is no dictionary.");this.trailer=r.v}numbers(){return[...this.offsets.keys()].sort((t,e)=>t-e)}skip(){const{bytes:t}=this;for(;;){const e=t[this.at];if(e===void 0)return;if(v.has(e))this.at++;else if(e===37)for(;this.at<t.length&&t[this.at]!==10&&t[this.at]!==13;)this.at++;else return}}regular(){const t=this.at;for(;this.at<this.bytes.length;){const e=this.bytes[this.at]??0;if(v.has(e)||F.has(e))break;this.at++}return this.text.slice(t,this.at)}number(){this.skip();const t=this.regular(),e=Number(t);if(t===""||Number.isNaN(e))throw new Error(`Not a number at ${String(this.at)}: ${t}`);return e}value(){this.skip();const{text:t}=this,e=t[this.at];if(t.startsWith("<<",this.at)){this.at+=2;const s=new Map;for(;;){if(this.skip(),t.startsWith(">>",this.at))return this.at+=2,{t:"dict",v:s};const i=this.value();if(i.t!=="raw"||!i.s.startsWith("/"))throw new Error(`A dictionary's key is no name at ${String(this.at)}.`);s.set(i.s,this.value())}}if(e==="["){this.at++;const s=[];for(;;){if(this.skip(),t[this.at]==="]")return this.at++,{t:"arr",v:s};s.push(this.value())}}if(e==="("){const s=this.at;let i=0;for(;this.at<t.length;this.at++){const d=t[this.at];if(d==="\\")this.at++;else if(d==="(")i++;else if(d===")"&&--i===0)break}return this.at++,{t:"raw",s:t.slice(s,this.at)}}if(e==="<"){const s=t.indexOf(">",this.at),i=t.slice(this.at,s+1);return this.at=s+1,{t:"raw",s:i}}if(e==="/")return this.at++,{t:"raw",s:`/${this.regular()}`};const r=this.regular();if(r==="")throw new Error(`Unexpected ${String(e)} at ${String(this.at)}.`);if(/^\d+$/u.test(r)){const s=this.at;this.skip();const i=this.regular();if(/^\d+$/u.test(i)&&(this.skip(),t[this.at]==="R"&&(v.has(this.bytes[this.at+1]??32)||F.has(this.bytes[this.at+1]??32))))return this.at++,{t:"ref",n:Number(r)};this.at=s}return{t:"raw",s:r}}object(t){const e=this.offsets.get(t);if(e===void 0)throw new Error(`No object ${String(t)}.`);if(this.at=e,this.number(),this.number(),this.skip(),!this.text.startsWith("obj",this.at))throw new Error(`Object ${String(t)} is not where its entry says.`);this.at+=3;const r=this.value();if(this.skip(),!this.text.startsWith("stream",this.at))return{value:r};this.at+=6,this.text[this.at]==="\r"&&this.at++,this.text[this.at]===`
2
+ import{open as D}from"node:fs/promises";import{firstUse as B}from"@allyhub/runtimes";export const pdfLib=B("pdf-lib",()=>import("pdf-lib"));const v=new Set([0,9,10,12,13,32]),F=new Set(Buffer.from("()<>[]{}/%","latin1"));class I{bytes;text;at=0;offsets=new Map;trailer;constructor(t){this.bytes=t,this.text=t.toString("latin1");const e=/startxref\s+(\d+)\s+%%EOF\s*$/u.exec(this.text);if(!e)throw new Error("Not a PDF: no startxref.");if(this.at=Number(e[1]),!this.text.startsWith("xref",this.at))throw new Error("This PDF keeps its cross-references in a stream, which this reader does not read.");for(this.at+=4;this.skip(),!this.text.startsWith("trailer",this.at);){const s=this.number(),i=this.number();this.skip();for(let d=0;d<i;d++){const g=this.text.slice(this.at,this.at+20);g[17]==="n"&&this.offsets.set(s+d,Number(g.slice(0,10))),this.at+=20}}this.at+=7;const r=this.value();if(r.t!=="dict")throw new Error("Not a PDF: its trailer is no dictionary.");this.trailer=r.v}numbers(){return[...this.offsets.keys()].sort((t,e)=>t-e)}skip(){const{bytes:t}=this;for(;;){const e=t[this.at];if(e===void 0)return;if(v.has(e))this.at++;else if(e===37)for(;this.at<t.length&&t[this.at]!==10&&t[this.at]!==13;)this.at++;else return}}regular(){const t=this.at;for(;this.at<this.bytes.length;){const e=this.bytes[this.at]??0;if(v.has(e)||F.has(e))break;this.at++}return this.text.slice(t,this.at)}number(){this.skip();const t=this.regular(),e=Number(t);if(t===""||Number.isNaN(e))throw new Error(`Not a number at ${String(this.at)}: ${t}`);return e}value(){this.skip();const{text:t}=this,e=t[this.at];if(t.startsWith("<<",this.at)){this.at+=2;const s=new Map;for(;;){if(this.skip(),t.startsWith(">>",this.at))return this.at+=2,{t:"dict",v:s};const i=this.value();if(i.t!=="raw"||!i.s.startsWith("/"))throw new Error(`A dictionary's key is no name at ${String(this.at)}.`);s.set(i.s,this.value())}}if(e==="["){this.at++;const s=[];for(;;){if(this.skip(),t[this.at]==="]")return this.at++,{t:"arr",v:s};s.push(this.value())}}if(e==="("){const s=this.at;let i=0;for(;this.at<t.length;this.at++){const d=t[this.at];if(d==="\\")this.at++;else if(d==="(")i++;else if(d===")"&&--i===0)break}return this.at++,{t:"raw",s:t.slice(s,this.at)}}if(e==="<"){const s=t.indexOf(">",this.at),i=t.slice(this.at,s+1);return this.at=s+1,{t:"raw",s:i}}if(e==="/")return this.at++,{t:"raw",s:`/${this.regular()}`};const r=this.regular();if(r==="")throw new Error(`Unexpected ${String(e)} at ${String(this.at)}.`);if(/^\d+$/u.test(r)){const s=this.at;this.skip();const i=this.regular();if(/^\d+$/u.test(i)&&(this.skip(),t[this.at]==="R"&&(v.has(this.bytes[this.at+1]??32)||F.has(this.bytes[this.at+1]??32))))return this.at++,{t:"ref",n:Number(r)};this.at=s}return{t:"raw",s:r}}object(t){const e=this.offsets.get(t);if(e===void 0)throw new Error(`No object ${String(t)}.`);if(this.at=e,this.number(),this.number(),this.skip(),!this.text.startsWith("obj",this.at))throw new Error(`Object ${String(t)} is not where its entry says.`);this.at+=3;const r=this.value();if(this.skip(),!this.text.startsWith("stream",this.at))return{value:r};this.at+=6,this.text[this.at]==="\r"&&this.at++,this.text[this.at]===`
3
3
  `&&this.at++;const s=r.t==="dict"?r.v.get("/Length"):void 0,i=s?.t==="raw"?Number(s.s):s?.t==="ref"?Number(this.object(s.n).value.s):Number.NaN;if(!Number.isFinite(i))throw new Error(`Object ${String(t)}'s stream has no length.`);return{value:r,stream:this.bytes.subarray(this.at,this.at+i)}}}const $=a=>a?.t==="dict"?a.v:void 0,y=a=>a?.t==="raw"?a.s:void 0,p=a=>a?.t==="ref"?a.n:void 0;function m(a,t){switch(a.t){case"raw":return a.s;case"ref":return`${String(t(a.n))} 0 R`;case"arr":return`[${a.v.map(e=>m(e,t)).join(" ")}]`;case"dict":return`<<${[...a.v].map(([e,r])=>`${e} ${m(r,t)}`).join(`
4
- `)}>>`}}function I(a){if(/^[\x20-\x7e]*$/u.test(a))return`(${a.replace(/[\\()]/gu,"\\$&")})`;let t="FEFF";for(let e=0;e<a.length;e++)t+=a.charCodeAt(e).toString(16).padStart(4,"0").toUpperCase();return`<${t}>`}const K=["/Resources","/MediaBox","/CropBox","/Rotate"];export class PdfJoiner{file;offset=0;next=1;offsets=[];pages=[];structure=[];parents=[];keys=0;lang;root;tree;constructor(t){this.file=t,this.tree=this.next++,this.root=this.next++}static async create(t){const e=new PdfJoiner(await D(t,"w"));return await e.put(Buffer.from(`%PDF-1.4
4
+ `)}>>`}}function K(a){if(/^[\x20-\x7e]*$/u.test(a))return`(${a.replace(/[\\()]/gu,"\\$&")})`;let t="FEFF";for(let e=0;e<a.length;e++)t+=a.charCodeAt(e).toString(16).padStart(4,"0").toUpperCase();return`<${t}>`}const W=["/Resources","/MediaBox","/CropBox","/Rotate"];export class PdfJoiner{file;offset=0;next=1;offsets=[];pages=[];structure=[];parents=[];keys=0;lang;root;tree;constructor(t){this.file=t,this.tree=this.next++,this.root=this.next++}static async create(t){const e=new PdfJoiner(await D(t,"w"));return await e.put(Buffer.from(`%PDF-1.4
5
5
  %âãÏÓ
6
6
  `,"latin1")),e}async put(t){await this.file.write(t,0,t.length,this.offset),this.offset+=t.length}async object(t,e,r){if(this.offsets[t]=this.offset,r===void 0){await this.put(Buffer.from(`${String(t)} 0 obj
7
7
  ${e}
@@ -12,13 +12,13 @@ stream
12
12
  `,"latin1")),await this.put(r),await this.put(Buffer.from(`
13
13
  endstream
14
14
  endobj
15
- `,"latin1"))}async add(t){const e=new B(t),r=p(e.trailer.get("/Root"));if(r===void 0)throw new Error("A PDF without a catalog.");const s=$(e.object(r).value)??new Map;this.lang??=s.get("/Lang");const i=new Set([r]),d=p(e.trailer.get("/Info"));d!==void 0&&i.add(d);const g=[],f=(n,u)=>{const c=$(e.object(n).value);if(c)if(y(c.get("/Type"))==="/Pages"){i.add(n);const l=new Map(u);for(const h of K){const o=c.get(h);o!==void 0&&l.set(h,o)}for(const h of c.get("/Kids")?.t==="arr"?c.get("/Kids").v:[]){const o=p(h);o!==void 0&&f(o,l)}}else g.push({n,inherits:u})},w=p(s.get("/Pages"));w!==void 0&&f(w,new Map);const b=p(s.get("/StructTreeRoot")),S=b===void 0?void 0:$(e.object(b).value),k=this.keys,E=[],R=[];if(b!==void 0&&S){i.add(b);const n=S.get("/K");for(const h of n?.t==="arr"?n.v:n?[n]:[]){const o=p(h);o!==void 0&&E.push(o)}const u=p(S.get("/ParentTree")),c=[],l=h=>{i.add(h);const o=$(e.object(h).value),x=o?.get("/Nums");x?.t==="arr"&&c.push(...x.v);const T=o?.get("/Kids");for(const A of T?.t==="arr"?T.v:[]){const P=p(A);P!==void 0&&l(P)}};u!==void 0&&l(u);for(let h=0;h+1<c.length;h+=2){const o=c[h+1];o&&R.push([k+Number(y(c[h])),o])}this.keys=k+Number(y(S.get("/ParentTreeNextKey"))??"0")}const j=new Map;for(const n of e.numbers())i.has(n)||j.set(n,this.next++);const N=n=>{if(n===b)return this.root;if(i.has(n))return this.tree;const u=j.get(n);if(u===void 0)throw new Error(`A reference to object ${String(n)}, which is not there.`);return u};this.structure.push(...E.map(N));for(const[n,u]of R)this.parents.push([n,{t:"raw",s:m(u,N)}]);const M=new Map(g.map(n=>[n.n,n.inherits]));for(const[n,u]of j){const c=e.object(n),l=$(c.value);if(l){const h=M.get(n);if(h){this.pages.push(u);for(const[o,x]of h)l.has(o)||l.set(o,x)}for(const o of["/StructParents","/StructParent"]){const x=y(l.get(o));x!==void 0&&l.set(o,{t:"raw",s:String(k+Number(x))})}}await this.object(u,m(c.value,N),c.stream)}}async close(t={}){try{await this.object(this.tree,`<</Type /Pages
15
+ `,"latin1"))}async add(t){const e=new I(t),r=p(e.trailer.get("/Root"));if(r===void 0)throw new Error("A PDF without a catalog.");const s=$(e.object(r).value)??new Map;this.lang??=s.get("/Lang");const i=new Set([r]),d=p(e.trailer.get("/Info"));d!==void 0&&i.add(d);const g=[],f=(n,u)=>{const c=$(e.object(n).value);if(c)if(y(c.get("/Type"))==="/Pages"){i.add(n);const l=new Map(u);for(const h of W){const o=c.get(h);o!==void 0&&l.set(h,o)}for(const h of c.get("/Kids")?.t==="arr"?c.get("/Kids").v:[]){const o=p(h);o!==void 0&&f(o,l)}}else g.push({n,inherits:u})},w=p(s.get("/Pages"));w!==void 0&&f(w,new Map);const b=p(s.get("/StructTreeRoot")),S=b===void 0?void 0:$(e.object(b).value),k=this.keys,E=[],R=[];if(b!==void 0&&S){i.add(b);const n=S.get("/K");for(const h of n?.t==="arr"?n.v:n?[n]:[]){const o=p(h);o!==void 0&&E.push(o)}const u=p(S.get("/ParentTree")),c=[],l=h=>{i.add(h);const o=$(e.object(h).value),x=o?.get("/Nums");x?.t==="arr"&&c.push(...x.v);const T=o?.get("/Kids");for(const A of T?.t==="arr"?T.v:[]){const P=p(A);P!==void 0&&l(P)}};u!==void 0&&l(u);for(let h=0;h+1<c.length;h+=2){const o=c[h+1];o&&R.push([k+Number(y(c[h])),o])}this.keys=k+Number(y(S.get("/ParentTreeNextKey"))??"0")}const j=new Map;for(const n of e.numbers())i.has(n)||j.set(n,this.next++);const N=n=>{if(n===b)return this.root;if(i.has(n))return this.tree;const u=j.get(n);if(u===void 0)throw new Error(`A reference to object ${String(n)}, which is not there.`);return u};this.structure.push(...E.map(N));for(const[n,u]of R)this.parents.push([n,{t:"raw",s:m(u,N)}]);const M=new Map(g.map(n=>[n.n,n.inherits]));for(const[n,u]of j){const c=e.object(n),l=$(c.value);if(l){const h=M.get(n);if(h){this.pages.push(u);for(const[o,x]of h)l.has(o)||l.set(o,x)}for(const o of["/StructParents","/StructParent"]){const x=y(l.get(o));x!==void 0&&l.set(o,{t:"raw",s:String(k+Number(x))})}}await this.object(u,m(c.value,N),c.stream)}}async close(t={}){try{await this.object(this.tree,`<</Type /Pages
16
16
  /Count ${String(this.pages.length)}
17
17
  /Kids [${this.pages.map(f=>`${String(f)} 0 R`).join(" ")}]>>`);const e=this.structure.length>0,r=this.next++;e&&(await this.object(this.root,`<</Type /StructTreeRoot
18
18
  /K [${this.structure.map(f=>`${String(f)} 0 R`).join(" ")}]
19
19
  /ParentTree ${String(r)} 0 R
20
20
  /ParentTreeNextKey ${String(this.keys)}>>`),await this.object(r,`<</Nums [${this.parents.map(([f,w])=>`${String(f)} ${m(w,b=>b)}`).join(" ")}]>>`));const s=this.next++;await this.object(s,["<</Type /Catalog",`/Pages ${String(this.tree)} 0 R`,...e?["/MarkInfo <</Marked true>>",`/StructTreeRoot ${String(this.root)} 0 R`]:[],...this.lang?[`/Lang ${m(this.lang,f=>f)}`]:[],...t.title===void 0?[]:["/ViewerPreferences <</DisplayDocTitle true>>"],">>"].join(`
21
- `));const i=this.next++;await this.object(i,`<<${t.title===void 0?"":`/Title ${I(t.title)}
21
+ `));const i=this.next++;await this.object(i,`<<${t.title===void 0?"":`/Title ${K(t.title)}
22
22
  `}/Producer (AllyHub)>>`);const d=this.offset,g=[`xref
23
23
  0 ${String(this.next)}
24
24
  `,`0000000000 65535 f
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/doc-print",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/export",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/extension-api",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/extension-host",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub/formats",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {