allyhub 0.21.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/dist/command.js +1 -1
  2. package/dist/commands/dev.js +5 -5
  3. package/dist/commands/export.js +1 -1
  4. package/dist/commands/index.js +1 -1
  5. package/dist/commands/list.js +1 -1
  6. package/dist/commands/run.js +2 -0
  7. package/dist/commands/schedule.js +4 -0
  8. package/dist/commands.json +1 -1
  9. package/dist/main.js +8 -8
  10. package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
  11. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  12. package/dist/node_modules/@allyhub/blocks/package.json +1 -1
  13. package/dist/node_modules/@allyhub/browser/package.json +1 -1
  14. package/dist/node_modules/@allyhub/build/dist/migrate.js +1 -1
  15. package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
  16. package/dist/node_modules/@allyhub/build/dist/project-root.js +1 -1
  17. package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
  18. package/dist/node_modules/@allyhub/build/package.json +1 -1
  19. package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
  20. package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
  21. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  22. package/dist/node_modules/@allyhub/check/package.json +1 -1
  23. package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
  24. package/dist/node_modules/@allyhub/cloud/dist/index.js +1 -1
  25. package/dist/node_modules/@allyhub/cloud/dist/scheduled-tasks.js +2 -0
  26. package/dist/node_modules/@allyhub/cloud/package.json +1 -1
  27. package/dist/node_modules/@allyhub/components/package.json +1 -1
  28. package/dist/node_modules/@allyhub/dev-server/dist/index.js +1 -1
  29. package/dist/node_modules/@allyhub/dev-server/dist/record.js +2 -1
  30. package/dist/node_modules/@allyhub/dev-server/dist/validate.js +2 -2
  31. package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
  32. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  33. package/dist/node_modules/@allyhub/doc/package.json +1 -1
  34. package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
  35. package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
  36. package/dist/node_modules/@allyhub/export/package.json +1 -1
  37. package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
  38. package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
  39. package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +3 -3
  40. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +151 -151
  41. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +173 -173
  42. package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +1 -2
  43. package/dist/node_modules/@allyhub/formats/dist/data/work.js +1 -1
  44. package/dist/node_modules/@allyhub/formats/dist/index.d.ts +1 -1
  45. package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
  46. package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +2 -0
  47. package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
  48. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +106 -101
  49. package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
  50. package/dist/node_modules/@allyhub/formats/dist/tolerant.d.ts +26 -1
  51. package/dist/node_modules/@allyhub/formats/dist/tolerant.js +1 -1
  52. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  53. package/dist/node_modules/@allyhub/html-extension/package.json +1 -1
  54. package/dist/node_modules/@allyhub/i18n/package.json +1 -1
  55. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  56. package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
  57. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  58. package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
  59. package/dist/node_modules/@allyhub/image-render/package.json +1 -1
  60. package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
  61. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  62. package/dist/node_modules/@allyhub/jobs/package.json +1 -1
  63. package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -1
  64. package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
  65. package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
  66. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  67. package/dist/node_modules/@allyhub/media/package.json +1 -1
  68. package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
  69. package/dist/node_modules/@allyhub/model/package.json +1 -1
  70. package/dist/node_modules/@allyhub/office-extension/package.json +1 -1
  71. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  72. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  73. package/dist/node_modules/@allyhub/project/package.json +1 -1
  74. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  75. package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
  76. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  77. package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
  78. package/dist/node_modules/@allyhub/protocol/dist/paywall.js +1 -1
  79. package/dist/node_modules/@allyhub/protocol/dist/scheduled-tasks.js +2 -0
  80. package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
  81. package/dist/node_modules/@allyhub/protocol/package.json +5 -1
  82. package/dist/node_modules/@allyhub/registry/package.json +1 -1
  83. package/dist/node_modules/@allyhub/render/package.json +1 -1
  84. package/dist/node_modules/@allyhub/report-extension/package.json +1 -1
  85. package/dist/node_modules/@allyhub/runtime/package.json +1 -1
  86. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  87. package/dist/node_modules/@allyhub/scaffold/dist/index.js +6 -6
  88. package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
  89. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  90. package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
  91. package/dist/node_modules/@allyhub/sheet/dist/file.js +2 -2
  92. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  93. package/dist/node_modules/@allyhub/sheet-extension/dist/build.js +1 -1
  94. package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
  95. package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
  96. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  97. package/dist/node_modules/@allyhub/slides-extension/dist/build.js +2 -2
  98. package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
  99. package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
  100. package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
  101. package/dist/node_modules/@allyhub/stage/package.json +1 -1
  102. package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
  103. package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
  104. package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
  105. package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
  106. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  107. package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
  108. package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
  109. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  110. package/dist/node_modules/@allyhub/website/package.json +1 -1
  111. package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
  112. package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
  113. package/dist/node_modules/@allyhub/x-model/package.json +1 -1
  114. package/dist/node_modules/@allyhub/x-view/package.json +1 -1
  115. package/dist/package.json +15 -15
  116. package/dist/run-register.js +2 -0
  117. package/dist/works.js +1 -1
  118. package/editor-web/assets/{abnfDiagram-WEYOIA3C-B4tvwU6C.js → abnfDiagram-WEYOIA3C-OIbGwO0P.js} +1 -1
  119. package/editor-web/assets/{architecture-WOLXFQ4H-V2fA0vY2.js → architecture-WOLXFQ4H-i87EDk8h.js} +1 -1
  120. package/editor-web/assets/{architectureDiagram-ZHVYKT53-B6B7XN0M.js → architectureDiagram-ZHVYKT53-DRsgKDbu.js} +1 -1
  121. package/editor-web/assets/article-BVbLqhwK.js +3 -0
  122. package/editor-web/assets/article-BxkgemqI.js +7 -0
  123. package/editor-web/assets/bar-button-BJ-_6g-F.js +1 -0
  124. package/editor-web/assets/{blockDiagram-RJAE7QA3-BizcUGOM.js → blockDiagram-RJAE7QA3-k_lanKyI.js} +1 -1
  125. package/editor-web/assets/{c4Diagram-XDPPPE54-CBHS0dQ0.js → c4Diagram-XDPPPE54-BFJTpM5w.js} +1 -1
  126. package/editor-web/assets/{calc-worker-Cr4a0xmt.js → calc-worker-BpAgQE9E.js} +3 -3
  127. package/editor-web/assets/channel-CDJSUIp1.js +1 -0
  128. package/editor-web/assets/chevron-right-7tjLd0X4.js +1 -0
  129. package/editor-web/assets/chip-lvclIKGj.js +1 -0
  130. package/editor-web/assets/{chunk-2E7WHVMD-CMPBck_Q.js → chunk-2E7WHVMD-Bbfj2q42.js} +1 -1
  131. package/editor-web/assets/{chunk-4EMNKR2T-Df22Adpt.js → chunk-4EMNKR2T-iKWsgYqL.js} +1 -1
  132. package/editor-web/assets/{chunk-55XCU76K-CYrZ6_Q7.js → chunk-55XCU76K-WwcsywWu.js} +1 -1
  133. package/editor-web/assets/{chunk-7S6XSTFO-BfdG9NNW.js → chunk-7S6XSTFO-BEEtZTsQ.js} +1 -1
  134. package/editor-web/assets/{chunk-AQDTSKZB-BCzZMoTJ.js → chunk-AQDTSKZB-ZT2PBdLK.js} +1 -1
  135. package/editor-web/assets/{chunk-DSNLSHJZ-DT0xT8Wf.js → chunk-DSNLSHJZ-BDlY4xos.js} +1 -1
  136. package/editor-web/assets/{chunk-HAGFOTED-Bg3-EotU.js → chunk-HAGFOTED-Yp6V4sx6.js} +1 -1
  137. package/editor-web/assets/{chunk-HNE4Q36P-BrSym24V.js → chunk-HNE4Q36P-C6IdGLw2.js} +1 -1
  138. package/editor-web/assets/{chunk-NQOKRVIF-CMxgkJWF.js → chunk-NQOKRVIF-D3gs_SMr.js} +1 -1
  139. package/editor-web/assets/{chunk-UHW7PFBP-DWEwoyPy.js → chunk-UHW7PFBP-Byf0dX4X.js} +1 -1
  140. package/editor-web/assets/{chunk-VQ5W62QI-eTFh5_T9.js → chunk-VQ5W62QI-n9lsvBOX.js} +1 -1
  141. package/editor-web/assets/{chunk-WQQL4CDK-4PTupr9T.js → chunk-WQQL4CDK-BW540sO1.js} +1 -1
  142. package/editor-web/assets/{chunk-YZO67HFG-D5XAAFWm.js → chunk-YZO67HFG-CWL9cioT.js} +1 -1
  143. package/editor-web/assets/{chunk-ZAUX2LTX-CPsdaisO.js → chunk-ZAUX2LTX-D9zlkFeQ.js} +1 -1
  144. package/editor-web/assets/{chunk-ZCHMQSOR-ClnuUyfy.js → chunk-ZCHMQSOR-nieSgKB5.js} +1 -1
  145. package/editor-web/assets/{classDiagram-v2-4MYWR3UA-CM21waNF.js → classDiagram-v2-4MYWR3UA-BXamBIDc.js} +1 -1
  146. package/editor-web/assets/{color-picker-BmKFn2ww.js → color-picker-XpkmmKxv.js} +1 -1
  147. package/editor-web/assets/context-menu-pSruvRyd.js +1 -0
  148. package/editor-web/assets/{cynefin-EF2NZ3EQ-CJUHTgee.js → cynefin-EF2NZ3EQ-CVKVgqFb.js} +1 -1
  149. package/editor-web/assets/{cynefinDiagram-WF24UDRP-C9RIfuIV.js → cynefinDiagram-WF24UDRP-r0bqUe5X.js} +1 -1
  150. package/editor-web/assets/{dagre-NK4GIZVX-g-01KdpO.js → dagre-NK4GIZVX-4q_IUjiM.js} +1 -1
  151. package/editor-web/assets/deck-cyd6f3QU.js +1 -0
  152. package/editor-web/assets/{diagram-CBK3MWTC-CbOjWUu-.js → diagram-CBK3MWTC-CDh12DaH.js} +1 -1
  153. package/editor-web/assets/{diagram-I5XIIV2D-C6psNS8J.js → diagram-I5XIIV2D-C_sqASp8.js} +1 -1
  154. package/editor-web/assets/{diagram-ODIL2UCW-C9PUE46P.js → diagram-ODIL2UCW-QgoMb-iS.js} +1 -1
  155. package/editor-web/assets/{diagram-PFBEJUXE-vJ_pnB33.js → diagram-PFBEJUXE-Djhv4RT6.js} +1 -1
  156. package/editor-web/assets/{diagram-RJA3I4VV-FwYlEfJ-.js → diagram-RJA3I4VV-CvVswF4l.js} +1 -1
  157. package/editor-web/assets/{diagram-TYUNFSNR-FKpIxeUc.js → diagram-TYUNFSNR-DLnbV741.js} +1 -1
  158. package/editor-web/assets/dist-BK-WZ2ce.js +3 -0
  159. package/editor-web/assets/dist-CQ8-PJqF.js +16 -0
  160. package/editor-web/assets/dist-CQElMvxC.js +4 -0
  161. package/editor-web/assets/{dist-Cg0Z26Kv.js → dist-D49XAtID.js} +4 -4
  162. package/editor-web/assets/{dist-DH8oJJw9.js → dist-DDQLLUz5.js} +3 -3
  163. package/editor-web/assets/{dist-BI_BaYhO.js → dist-DO2VygfS.js} +4 -4
  164. package/editor-web/assets/dist-DOoUVqs_.js +24 -0
  165. package/editor-web/assets/{dist-D2rGVz9C.js → dist-DUyJ8AI0.js} +1 -1
  166. package/editor-web/assets/dist-DlDgR_Er.js +1 -0
  167. package/editor-web/assets/dist-Dw7AH_ip.js +6 -0
  168. package/editor-web/assets/{dist-H0z_DXDz.js → dist-Dx3tLwZ1.js} +17 -17
  169. package/editor-web/assets/{dist-CtYjYJdv.js → dist-F7lLi27Y.js} +1 -1
  170. package/editor-web/assets/dist-OfUZ68xY.js +547 -0
  171. package/editor-web/assets/{dist-CB-_0-X4.js → dist-OyPpS4AG.js} +28 -28
  172. package/editor-web/assets/dist-QCvBWMrp.js +5 -0
  173. package/editor-web/assets/{dist-D07Kj8GR.js → dist-RppJbSHJ.js} +1 -1
  174. package/editor-web/assets/dist-ZFgjTFWK.js +19 -0
  175. package/editor-web/assets/{dist-BqijryYd.js → dist-onYtssQw.js} +1 -1
  176. package/editor-web/assets/{docx-draw-Dxb67W2d.js → docx-draw-BBI4k72R.js} +1 -1
  177. package/editor-web/assets/{ebnfDiagram-V4P3TTPT-DBymUM-F.js → ebnfDiagram-V4P3TTPT-BoiJRPsL.js} +1 -1
  178. package/editor-web/assets/{elk-QONTBCTQ-BNYR3OlS.js → elk-QONTBCTQ-BDiBwn0f.js} +1 -1
  179. package/editor-web/assets/{erDiagram-KYQIGQAA-cTNyOqW6.js → erDiagram-KYQIGQAA-DaA3jdNm.js} +1 -1
  180. package/editor-web/assets/esm-BWIRT8Yl.js +21 -0
  181. package/editor-web/assets/{eventmodeling-K75KTNOO-C6FUZeXP.js → eventmodeling-K75KTNOO-j7ZSOAed.js} +1 -1
  182. package/editor-web/assets/flowDiagram-IUGLLWBU-Cb-xQSAJ.js +1 -0
  183. package/editor-web/assets/{ganttDiagram-R7GPNTJY-LD9mqQ1x.js → ganttDiagram-R7GPNTJY-CyNcjwUZ.js} +1 -1
  184. package/editor-web/assets/{gitGraph-VSP46ZUC-CtCBcQFl.js → gitGraph-VSP46ZUC-BuzoK22Z.js} +1 -1
  185. package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-DYQpOozz.js → gitGraphDiagram-PDYL7XHY--lzum_QP.js} +1 -1
  186. package/editor-web/assets/index-BSd85XUU.js +28 -0
  187. package/editor-web/assets/{info-OHQRW6UA-IXInKPRO.js → info-OHQRW6UA-rs42SY_Y.js} +1 -1
  188. package/editor-web/assets/{infoDiagram-MVDRKAX5-Ds7Cei7T.js → infoDiagram-MVDRKAX5-BjedWKrM.js} +1 -1
  189. package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-DWs3qtAX.js → ishikawaDiagram-HPEHV2GE-Dtqm_gq7.js} +1 -1
  190. package/editor-web/assets/{journeyDiagram-BOSHW7O7-BkNKVYBA.js → journeyDiagram-BOSHW7O7-J0dA2yU0.js} +1 -1
  191. package/editor-web/assets/{kanban-definition-FNSA4HC5-D3dMswnI.js → kanban-definition-FNSA4HC5-DV13v0Uf.js} +1 -1
  192. package/editor-web/assets/layout-CuWN7_3k.js +1 -0
  193. package/editor-web/assets/{mermaid-parser.core-D_W_0X0N.js → mermaid-parser.core-B7bZFHzS.js} +3 -3
  194. package/editor-web/assets/{mermaid.core-Bkirj-s5.js → mermaid.core-DQ10-Otk.js} +4 -4
  195. package/editor-web/assets/{mindmap-definition-6OY57UG3-CMKkAAvI.js → mindmap-definition-6OY57UG3-DgdXGBCF.js} +1 -1
  196. package/editor-web/assets/{packet-JDAUHWVQ-CzCkgCfg.js → packet-JDAUHWVQ-ZNSLC_YL.js} +1 -1
  197. package/editor-web/assets/{panes-BexRuZd2.js → panes-1hRg6CCN.js} +2 -2
  198. package/editor-web/assets/{pegDiagram-ECIUJNBX-C8qHkx7M.js → pegDiagram-ECIUJNBX-nBIsHepE.js} +1 -1
  199. package/editor-web/assets/{pie-XZMESJXO-BJqgxMrD.js → pie-XZMESJXO-CXen6okO.js} +1 -1
  200. package/editor-web/assets/{pieDiagram-GNMPY74T-DyNntV5y.js → pieDiagram-GNMPY74T-BlimMsUq.js} +1 -1
  201. package/editor-web/assets/{quadrantDiagram-D57K4MC3-BHa-69ir.js → quadrantDiagram-D57K4MC3-D_B7p8XB.js} +1 -1
  202. package/editor-web/assets/{radar-ABXABTNO-BeRPjBBR.js → radar-ABXABTNO-DFfRPPEM.js} +1 -1
  203. package/editor-web/assets/{railroad-I3PHUGI6-BaRQqRsK.js → railroad-I3PHUGI6-DS8ly7WZ.js} +1 -1
  204. package/editor-web/assets/{railroad-abnf-LNEFI6M7-BZfwomxZ.js → railroad-abnf-LNEFI6M7-Coohlgpw.js} +1 -1
  205. package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DbgqpEF5.js → railroad-ebnf-DWYD2UWJ-CvcfKbZc.js} +1 -1
  206. package/editor-web/assets/{railroad-peg-JR7BVNR7-BYOf3PsQ.js → railroad-peg-JR7BVNR7-jRtVHKtg.js} +1 -1
  207. package/editor-web/assets/{railroadDiagram-Y72NRBL7-B5OAzOsD.js → railroadDiagram-Y72NRBL7-kWUIDPHg.js} +1 -1
  208. package/editor-web/assets/{requirementDiagram-EQYSW5RA-wqYNoqO0.js → requirementDiagram-EQYSW5RA-C39Gfdi-.js} +1 -1
  209. package/editor-web/assets/ribbon-tabs-5R-_EtHp.js +1 -0
  210. package/editor-web/assets/{sankeyDiagram-SY24JHO5-Crf6GRsa.js → sankeyDiagram-SY24JHO5-DtSQ2N2q.js} +1 -1
  211. package/editor-web/assets/schemas-CnlOL0u4.js +1 -0
  212. package/editor-web/assets/{sequenceDiagram-BLEHNHQU-DUcHz4_d.js → sequenceDiagram-BLEHNHQU-BZx9gAR1.js} +1 -1
  213. package/editor-web/assets/{session--OJYv_B7.js → session-2pd0mFQm.js} +1 -1
  214. package/editor-web/assets/{snapshots-DYooVfOx.js → snapshots-8hCkRemI.js} +1 -1
  215. package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-DbeLdnpS.js → stateDiagram-v2-A6IESKWZ-E9qhWPa3.js} +1 -1
  216. package/editor-web/assets/{swimlanes-B3ENRKFQ-BDi6AeJI.js → swimlanes-B3ENRKFQ-C6vD9fmU.js} +1 -1
  217. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-D_DL_JP0.js +8 -0
  218. package/editor-web/assets/themes-D_ISkWVz.js +1 -0
  219. package/editor-web/assets/{timeline-definition-JXYKGLGB-B0awa2hh.js → timeline-definition-JXYKGLGB-CT8AKsKE.js} +1 -1
  220. package/editor-web/assets/{treeView-D4JQ5SDB-C91G0IGm.js → treeView-D4JQ5SDB-DA2iE5aC.js} +1 -1
  221. package/editor-web/assets/{treemap-SAJKECNS-CiOWiwl2.js → treemap-SAJKECNS-RgrBf6Sq.js} +1 -1
  222. package/editor-web/assets/{updating-D0GEtwnJ.js → updating--4wIxO0k.js} +1 -1
  223. package/editor-web/assets/{usecaseDiagram-WPOLBNNX-DMYM1MRe.js → usecaseDiagram-WPOLBNNX-DfIcy0_F.js} +1 -1
  224. package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DQIJ5vvN.js → vennDiagram-Q3Y3IDCW-DxTSyNH7.js} +1 -1
  225. package/editor-web/assets/{video-mMOFXHYK.js → video-yjnj5UY2.js} +1 -1
  226. package/editor-web/assets/{wardley-7MLQ67FV-C3H9HG8r.js → wardley-7MLQ67FV-pow5gWxU.js} +1 -1
  227. package/editor-web/assets/{wardleyDiagram-IVAIDKWA-DgsjqY1Y.js → wardleyDiagram-IVAIDKWA-Dar0j9HS.js} +1 -1
  228. package/editor-web/assets/{workbook-NtMEyLgf.js → workbook-7fUt0Qgy.js} +1 -1
  229. package/editor-web/assets/{xychartDiagram-4URNHDU4-DzsGI527.js → xychartDiagram-4URNHDU4-qCxuQZMj.js} +1 -1
  230. package/editor-web/index.html +5 -3
  231. package/package.json +2 -2
  232. package/editor-web/assets/article-DW4eD_8K.js +0 -3
  233. package/editor-web/assets/article-Dm2dIEwc.js +0 -7
  234. package/editor-web/assets/bar-button-CJmpgNg4.js +0 -1
  235. package/editor-web/assets/channel-dyUtlVPg.js +0 -1
  236. package/editor-web/assets/chip-BdQRH3FL.js +0 -1
  237. package/editor-web/assets/deck-C0VxrlzX.js +0 -1
  238. package/editor-web/assets/dist-BaWFMuvr.js +0 -1
  239. package/editor-web/assets/dist-BdmMT8fP.js +0 -5
  240. package/editor-web/assets/dist-BgKyM9U6.js +0 -3
  241. package/editor-web/assets/dist-ByguWp3a.js +0 -16
  242. package/editor-web/assets/dist-CCP24Lel.js +0 -19
  243. package/editor-web/assets/dist-D3DwRF1k.js +0 -547
  244. package/editor-web/assets/dist-DCI21ljp.js +0 -6
  245. package/editor-web/assets/dist-DJvfQvM7.js +0 -24
  246. package/editor-web/assets/dist-DmCDcb2_.js +0 -4
  247. package/editor-web/assets/esm-Cl3GKSDd.js +0 -21
  248. package/editor-web/assets/flowDiagram-IUGLLWBU-ukTovy07.js +0 -1
  249. package/editor-web/assets/index-omhSywJb.js +0 -28
  250. package/editor-web/assets/ribbon-tabs-B3IC9WOt.js +0 -1
  251. package/editor-web/assets/schemas-C21MyseF.js +0 -1
  252. package/editor-web/assets/swimlanesDiagram-AYQRV4AK-2wwOmxbv.js +0 -8
  253. package/editor-web/assets/tolerant-DM9s0Mt1.js +0 -1
@@ -1,6 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,b as n,c as r,i,l as a,s as o,t as s}from"./react-Byupo4pA.js";import{$ as c,B as l,G as u,H as d,J as f,K as p,Q as m,U as h,V as g,W as _,X as v,Y as y,Z as b,a as x,et as S,ft as C,gt as w,ht as T,i as ee,it as E,jt as D,mt as O,n as te,nt as k,o as ne,ot as A,q as re,r as ie,rt as j,s as M,st as N,t as ae,ut as P,yt as oe,z as se}from"./x-BAJilkKD.js";import{o as ce,w as le}from"./snapshots-DYooVfOx.js";import{t as ue}from"./jsx-runtime-DePvh3-m.js";import{B as de,C as fe,D as pe,E as me,F as he,G as ge,H as _e,I as ve,L as ye,M as be,N as xe,P as Se,R as Ce,T as we,U as Te,V as Ee,W as De,a as Oe,c as ke,f as Ae,i as je,j as Me,k as Ne,l as Pe,m as Fe,o as Ie,s as Le,t as F,u as Re,v as ze,z as Be}from"./bar-button-CJmpgNg4.js";import{n as Ve,t as He}from"./progress-D1Uv3d1b.js";import{t as I}from"./createLucideIcon-euu7Wcd9.js";import{F as L}from"./index-omhSywJb.js";var R=e(n(),1),z=ue(),Ue=Object.defineProperty,B=(e,t)=>Ue(e,`name`,{value:t,configurable:!0}),We=`Checkbox`,[Ge,Ke]=N(We),[qe,Je]=Ge(We);function Ye(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=E({prop:n,defaultProp:i??!1,onChange:c,caller:We}),[m,h]=R.useState(null),[g,_]=R.useState(null),v=R.useRef(!1),[y,b]=R.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!V(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,z.jsx)(qe,{scope:t,...S,children:rt(d)?d(S):r})}B(Ye,`CheckboxProvider`);var Xe=`CheckboxTrigger`,Ze=R.forwardRef(B(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=Je(Xe,e),g=O(i,u),_=R.useRef(c);return R.useEffect(()=>{let e=a?.form;if(e){let t=B(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,z.jsx)(P.button,{type:`button`,role:`checkbox`,"aria-checked":V(c)?`mixed`:c,"aria-required":l,"data-state":it(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:A(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:A(n,e=>{p(),d(e=>V(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),Qe=R.forwardRef(B(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,z.jsx)(Ye,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ze,{...d,ref:t,__scopeCheckbox:n}),e&&(0,z.jsx)(nt,{__scopeCheckbox:n})]})})},`Checkbox`)),$e=`CheckboxIndicator`,et=R.forwardRef(B(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Je($e,n);return(0,z.jsx)(j,{present:r||V(a.checked)||a.checked===!0,children:(0,z.jsx)(P.span,{"data-state":it(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),tt=`CheckboxBubbleInput`,nt=R.forwardRef(B(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=Je(tt,e),g=O(r,h),_=se(i),v=R.useRef(!1),y=R.useRef(s),b=R.useRef(o);R.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=V(s),n.call(e,!V(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=R.useRef(!V(s)&&s);return(0,z.jsx)(P.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:A(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function rt(e){return typeof e==`function`}B(rt,`isFunction`);function V(e){return e===`indeterminate`}B(V,`isIndeterminate`);function it(e){return V(e)?`indeterminate`:e?`checked`:`unchecked`}B(it,`getState`);var at=Object.defineProperty,H=(e,t)=>at(e,`name`,{value:t,configurable:!0}),ot=`ContextMenu`,[st,ct]=N(ot,[Ee]),U=Ee(),[lt,ut]=st(ot),dt=H(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=R.useRef(!1),[c,l]=E({prop:i,defaultProp:!1,onChange:r,caller:ot}),u=U(t);return(0,z.jsx)(lt,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,z.jsx)(be,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),ft=`ContextMenuTrigger`,pt=R.forwardRef(H(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=ut(ft,n),o=U(n),[s,c]=R.useState({x:0,y:0}),l=R.useMemo(()=>({current:{getBoundingClientRect:H(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=R.useRef(0),d=R.useCallback(()=>window.clearTimeout(u.current),[]),f=H(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return R.useEffect(()=>d,[d]),R.useEffect(()=>void(r&&d()),[r,d]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(xe,{...o,virtualRef:l}),(0,z.jsx)(P.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:A(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:A(e.onPointerDown,W(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:A(e.onPointerMove,W(d)),onPointerCancel:r?e.onPointerCancel:A(e.onPointerCancel,W(d)),onPointerUp:r?e.onPointerUp:A(e.onPointerUp,W(d))})]})},`ContextMenuTrigger`)),mt=H(e=>{let{__scopeContextMenu:t,...n}=e,r=U(t);return(0,z.jsx)(ve,{...r,...n})},`ContextMenuPortal`),ht=`ContextMenuContent`,gt=R.forwardRef(H(function(e,t){let{__scopeContextMenu:n,...r}=e,i=ut(ht,n),a=U(n),o=R.useRef(!1);return(0,z.jsx)(Se,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),_t=R.forwardRef(H(function(e,t){let{__scopeContextMenu:n,...r}=e,i=U(n);return(0,z.jsx)(he,{...i,...r,ref:t})},`ContextMenuItem`)),vt=R.forwardRef(H(function(e,t){let{__scopeContextMenu:n,...r}=e,i=U(n);return(0,z.jsx)(ye,{...i,...r,ref:t})},`ContextMenuSeparator`)),yt=`ContextMenuSub`,bt=H(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=U(t),[s,c]=E({prop:i,defaultProp:a??!1,onChange:r,caller:yt});return(0,z.jsx)(Ce,{...o,open:s,onOpenChange:c,children:n})},`ContextMenuSub`),xt=R.forwardRef(H(function(e,t){let{__scopeContextMenu:n,...r}=e,i=U(n);return(0,z.jsx)(de,{...i,...r,ref:t})},`ContextMenuSubTrigger`)),St=R.forwardRef(H(function(e,t){let{__scopeContextMenu:n,...r}=e,i=U(n);return(0,z.jsx)(Be,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuSubContent`));function W(e){return t=>t.pointerType===`mouse`?void 0:e(t)}H(W,`whenTouchOrPen`);var Ct=Object.defineProperty,G=(e,t)=>Ct(e,`name`,{value:t,configurable:!0}),wt=`Popover`,[Tt,Et]=N(wt,[M]),Dt=M(),[Ot,K]=Tt(wt),kt=G(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Dt(t),c=R.useRef(null),[l,u]=R.useState(!1),[d,f]=R.useState(0),[p,m]=R.useState(0),[h,g]=E({prop:r,defaultProp:i??!1,onChange:a,caller:wt});return(0,z.jsx)(ie,{...s,children:(0,z.jsx)(Ot,{scope:t,contentId:k(),titleId:k(),descriptionId:k(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:R.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:R.useCallback(()=>u(!0),[]),onCustomAnchorRemove:R.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),At=`PopoverAnchor`,jt=R.forwardRef(G(function(e,t){let{__scopePopover:n,...r}=e,i=K(At,n),a=Dt(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return R.useEffect(()=>(o(),()=>s()),[o,s]),(0,z.jsx)(ee,{...a,...r,ref:t})},`PopoverAnchor`)),Mt=`PopoverTrigger`,Nt=R.forwardRef(G(function(e,t){let{__scopePopover:n,...r}=e,i=K(Mt,n),a=Dt(n),o=O(t,i.triggerRef),s=(0,z.jsx)(P.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Gt(i.open),...r,ref:o,onClick:A(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,z.jsx)(ee,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Pt=`PopoverPortal`,[Ft,It]=Tt(Pt,{forceMount:void 0}),Lt=G(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=K(Pt,t);return(0,z.jsx)(Ft,{scope:t,forceMount:n,children:(0,z.jsx)(j,{present:n||a.open,children:(0,z.jsx)(y,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Rt=`PopoverContent`,zt=R.forwardRef(G(function(e,t){let n=It(Rt,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=K(Rt,e.__scopePopover);return(0,z.jsx)(j,{present:r||a.open,children:a.modal?(0,z.jsx)(Vt,{...i,ref:t}):(0,z.jsx)(Ht,{...i,ref:t})})},`PopoverContent`)),Bt=C(`PopoverContent.RemoveScroll`),Vt=R.forwardRef(G(function(e,t){let n=K(Rt,e.__scopePopover),r=R.useRef(null),i=O(t,r),a=R.useRef(!1),{nodes:o,registry:s}=c();return R.useEffect(()=>{let e=r.current;if(e)return p(e)},[]),(0,z.jsx)(re,{as:Bt,allowPinchZoom:!0,shards:R.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,z.jsx)(Ut,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:A(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:A(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:A(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Ht=R.forwardRef(G(function(e,t){let n=K(Rt,e.__scopePopover),r=R.useRef(!1),i=R.useRef(!1);return(0,z.jsx)(Ut,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Ut=R.forwardRef(G(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:p,branchRegistry:h,...g}=e,_=K(Rt,n),y=Dt(n),[x,C]=R.useState(null),w=O(t,C);return m(x),f(),(0,z.jsx)(b,{registry:h,children:(0,z.jsx)(v,{asChild:!0,loop:!0,trapped:r,branches:p,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,z.jsx)(S,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>_.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,z.jsx)(ne,{"data-state":Gt(_.open),role:`dialog`,id:_.contentId,"aria-labelledby":_.titlePresent?_.titleId:void 0,"aria-describedby":_.descriptionPresent?Kt(d,_.descriptionId):d,...y,...g,ref:w,style:{...g.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`)),Wt=R.forwardRef(G(function(e,t){let{__scopePopover:n,...r}=e,i=Dt(n);return(0,z.jsx)(x,{...i,...r,ref:t})},`PopoverArrow`));function Gt(e){return e?`open`:`closed`}G(Gt,`getState`);function Kt(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}G(Kt,`concatAriaDescribedby`);var qt=Object.defineProperty,Jt=(e,t)=>qt(e,`name`,{value:t,configurable:!0}),Yt=`Toggle`,Xt=R.forwardRef(Jt(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=E({prop:n,onChange:i,defaultProp:r??!1,caller:Yt});return(0,z.jsx)(P.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:A(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Zt=Object.defineProperty,q=(e,t)=>Zt(e,`name`,{value:t,configurable:!0}),J=`ToggleGroup`,Qt={Single:`single`,Multiple:`multiple`},[$t,en]=N(J,[De]),tn=De(),nn=R.forwardRef(q(function(e,t){let{type:n,...r}=e;if(n===Qt.Single)return(0,z.jsx)(on,{role:`radiogroup`,...r,ref:t});if(n===Qt.Multiple)return(0,z.jsx)(sn,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${J}\``)},`ToggleGroup`)),[rn,an]=$t(J),on=R.forwardRef(q(function(e,t){let{value:n,defaultValue:r,onValueChange:i=q(()=>{},`onValueChange`),...a}=e,[o,s]=E({prop:n,defaultProp:r??``,onChange:i,caller:J});return(0,z.jsx)(rn,{scope:e.__scopeToggleGroup,type:Qt.Single,value:R.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:R.useCallback(()=>s(``),[s]),children:(0,z.jsx)(un,{...a,ref:t})})},`ToggleGroupImplSingle`)),sn=R.forwardRef(q(function(e,t){let{value:n,defaultValue:r,onValueChange:i=q(()=>{},`onValueChange`),...a}=e,[o,s]=E({prop:n,defaultProp:r??[],onChange:i,caller:J}),c=R.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=R.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,z.jsx)(rn,{scope:e.__scopeToggleGroup,type:Qt.Multiple,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,z.jsx)(un,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[cn,ln]=$t(J),un=R.forwardRef(q(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=tn(n),u=ge(o),d={dir:u,...c};return(0,z.jsx)(cn,{scope:n,rovingFocus:i,disabled:r,children:i?(0,z.jsx)(_e,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,z.jsx)(P.div,{...d,ref:t})}):(0,z.jsx)(P.div,{...d,ref:t})})},`ToggleGroupImpl`)),dn=`ToggleGroupItem`,fn=R.forwardRef(q(function(e,t){let n=an(dn,e.__scopeToggleGroup),r=ln(dn,e.__scopeToggleGroup),i=tn(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=R.useRef(null);return r.rovingFocus?(0,z.jsx)(Te,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,z.jsx)(pn,{...s,ref:t})}):(0,z.jsx)(pn,{...s,ref:t})},`ToggleGroupItem`)),pn=R.forwardRef(q(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=an(dn,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===Qt.Single?o:void 0;return(0,z.jsx)(Xt,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),mn=I(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),hn=I(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),gn=I(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),_n=I(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),vn=I(`file-box`,[[`path`,{d:`M14.5 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.8`,key:`1kchwa`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11.7 14.2 7 17l-4.7-2.8`,key:`1yk8tc`}],[`path`,{d:`M3 13.1a2 2 0 0 0-.999 1.76v3.24a2 2 0 0 0 .969 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01z`,key:`19flxy`}],[`path`,{d:`M7 17v5`,key:`1yj1jh`}]]),yn=I(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),bn=I(`file-chart-column`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 18v-1`,key:`zg0ygc`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`M16 18v-3`,key:`j5jt4h`}]]),xn=I(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Sn=I(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Cn=I(`file-pen-line`,[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),wn=I(`file-output`,[[`path`,{d:`M4.226 20.925A2 2 0 0 0 6 22h12a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.127`,key:`wfxp4w`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 11-3 3`,key:`1dgrs4`}],[`path`,{d:`m5 17-3-3h10`,key:`1mvvaf`}]]),Tn=I(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),En=I(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Dn=I(`file-stack`,[[`path`,{d:`M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1`,key:`likhh7`}],[`path`,{d:`M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1`,key:`17ky3x`}],[`path`,{d:`M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z`,key:`1hyeo0`}]]),On=I(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),kn=I(`file-video-camera`,[[`path`,{d:`M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2`,key:`jrl274`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 17.843 3.033-1.755a.64.64 0 0 1 .967.56v4.704a.65.65 0 0 1-.967.56L10 20.157`,key:`17aeo9`}],[`rect`,{width:`7`,height:`6`,x:`3`,y:`16`,rx:`1`,key:`s27ndx`}]]),An=I(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Y=I(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),jn=I(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Mn=I(`share`,[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]),X=oe({en:{saved:{saved:`Saved`,saving:`Saving…`,unsaved:`Not saved yet`,error:`Not saved`},agentDoing:{editing:e=>`${e} is editing`,looking:e=>`${e} is looking`},follow:e=>`Follow ${e}`,unfollow:e=>`Stop following ${e}`,markUp:`Mark up`,markUpHint:`Mark up what is on show, and AI makes the changes`,moreTools:`More`,download:`Download`,share:`Share`,ready:`Ready`,failed:`Download failed`,format:`Format`,versions:`Languages`,include:`Include`,onShow:`On show`,all:e=>`All ${String(e)} languages`,choose:`Choose…`,chosen:e=>`${String(e)} chosen`,back:`Back`,checking:`Checking…`,blocked:e=>e===1?`1 must-fix problem stops the download`:`${String(e)} must-fix problems stop the download`,queued:`Waiting`,queuedAhead:e=>`Waiting, ${String(e)} ahead`,preparing:e=>`Preparing ${String(e)}%`,cancel:`Cancel`,retry:`Try again`,failedHelp:e=>`Try again, or ask ${e} what went wrong.`,partial:`Some files could not be made.`,nVersions:e=>`${String(e)} versions`,show:`Show in folder`,notStarted:`The download did not start`,option:{pptx:{label:`Slides`,values:{native:`Editable`,picture:`Pictures`}},steps:{label:`Each animation step`},changes:{label:`Changes since its Word original`},scale:{label:`Size`}},type:{mov:`MOV (ProRes)`,srt:`Captions`,cover:`Cover image`,pptx:`PowerPoint`,zip:`ZIP (each board as a PNG)`}},"zh-cn":{saved:{saved:`已保存`,saving:`正在保存…`,unsaved:`尚未保存`,error:`没能保存`},agentDoing:{editing:e=>`${e} 正在编辑`,looking:e=>`${e} 正在查看`},follow:e=>`跟随 ${e}`,unfollow:e=>`停止跟随 ${e}`,markUp:`批改`,markUpHint:`在画面上批改,AI 照着改`,moreTools:`更多`,download:`下载`,share:`分享`,ready:`已就绪`,failed:`下载失败`,format:`格式`,versions:`语言`,include:`附带`,onShow:`当前`,all:e=>`全部 ${String(e)} 种语言`,choose:`选择…`,chosen:e=>`已选 ${String(e)} 个`,back:`返回`,checking:`检查中…`,blocked:e=>`有 ${String(e)} 个必修问题,暂时不能下载`,queued:`排队中`,queuedAhead:e=>`排队中,前面还有 ${String(e)} 个`,preparing:e=>`正在准备 ${String(e)}%`,cancel:`取消`,retry:`重试`,failedHelp:e=>`请重试,或让 ${e} 看看哪里出了问题。`,partial:`部分文件没能生成。`,nVersions:e=>`${String(e)} 个版本`,show:`在文件夹中显示`,notStarted:`无法开始下载`,option:{pptx:{label:`幻灯片`,values:{native:`可编辑`,picture:`图片`}},steps:{label:`每个动画步骤`},changes:{label:`相对原 Word 文件的修订`},scale:{label:`尺寸`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`封面图`,pptx:`PowerPoint`,zip:`ZIP(每个画板一张 PNG)`}},"zh-tw":{saved:{saved:`已儲存`,saving:`正在儲存…`,unsaved:`尚未儲存`,error:`沒能儲存`},agentDoing:{editing:e=>`${e} 正在編輯`,looking:e=>`${e} 正在查看`},follow:e=>`跟隨 ${e}`,unfollow:e=>`停止跟隨 ${e}`,markUp:`批改`,markUpHint:`在畫面上批改,AI 照著改`,moreTools:`更多`,download:`下載`,share:`分享`,ready:`已就緒`,failed:`下載失敗`,format:`格式`,versions:`語言`,include:`附帶`,onShow:`目前`,all:e=>`全部 ${String(e)} 種語言`,choose:`選擇…`,chosen:e=>`已選 ${String(e)} 個`,back:`返回`,checking:`檢查中…`,blocked:e=>`有 ${String(e)} 個必須修正的問題,暫時無法下載`,queued:`排隊中`,queuedAhead:e=>`排隊中,前面還有 ${String(e)} 個`,preparing:e=>`正在準備 ${String(e)}%`,cancel:`取消`,retry:`重試`,failedHelp:e=>`請重試,或讓 ${e} 看看哪裡出了問題。`,partial:`部分檔案沒能產生。`,nVersions:e=>`${String(e)} 個版本`,show:`在資料夾中顯示`,notStarted:`無法開始下載`,option:{pptx:{label:`投影片`,values:{native:`可編輯`,picture:`圖片`}},steps:{label:`每個動畫步驟`},changes:{label:`相對原 Word 檔案的修訂`},scale:{label:`尺寸`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`封面圖`,pptx:`PowerPoint`,zip:`ZIP(每個畫板一張 PNG)`}},ja:{saved:{saved:`保存済み`,saving:`保存中…`,unsaved:`未保存`,error:`保存できませんでした`},agentDoing:{editing:e=>`${e}が編集中`,looking:e=>`${e}が表示中`},follow:e=>`${e}をフォロー`,unfollow:e=>`${e}のフォローをやめる`,markUp:`赤入れ`,markUpHint:`画面に赤を入れると、AI が直します`,moreTools:`その他`,download:`ダウンロード`,share:`共有`,ready:`準備完了`,failed:`ダウンロードに失敗`,format:`形式`,versions:`言語`,include:`追加`,onShow:`表示中`,all:e=>`全 ${String(e)} 言語`,choose:`選択…`,chosen:e=>`${String(e)} 件選択`,back:`戻る`,checking:`チェック中…`,blocked:e=>`要修正の問題が ${String(e)} 件あるためダウンロードできません`,queued:`待機中`,queuedAhead:e=>`待機中、前に ${String(e)} 件`,preparing:e=>`準備中 ${String(e)}%`,cancel:`キャンセル`,retry:`再試行`,failedHelp:e=>`もう一度試すか、${e} に原因を確認してください。`,partial:`一部のファイルを作成できませんでした。`,nVersions:e=>`${String(e)} 個のバージョン`,show:`フォルダに表示`,notStarted:`ダウンロードを開始できませんでした`,option:{pptx:{label:`スライド`,values:{native:`編集可能`,picture:`画像`}},steps:{label:`アニメーションの各ステップ`},changes:{label:`元の Word ファイルからの変更履歴`},scale:{label:`サイズ`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`カバー画像`,pptx:`PowerPoint`,zip:`ZIP(各ボードを PNG で)`}},ko:{saved:{saved:`저장됨`,saving:`저장 중…`,unsaved:`아직 저장되지 않음`,error:`저장되지 않음`},agentDoing:{editing:e=>`${e} 편집 중`,looking:e=>`${e} 보는 중`},follow:e=>`${e} 따라가기`,unfollow:e=>`${e} 따라가기 중지`,markUp:`첨삭`,markUpHint:`화면에 첨삭하면 AI가 고쳐 줍니다`,moreTools:`더보기`,download:`다운로드`,share:`공유`,ready:`준비됨`,failed:`다운로드 실패`,format:`형식`,versions:`언어`,include:`포함`,onShow:`현재`,all:e=>`${String(e)}개 언어 모두`,choose:`선택…`,chosen:e=>`${String(e)}개 선택`,back:`뒤로`,checking:`확인 중…`,blocked:e=>`수정이 필요한 문제 ${String(e)}개 때문에 다운로드할 수 없습니다`,queued:`대기 중`,queuedAhead:e=>`대기 중, 앞에 ${String(e)}개`,preparing:e=>`준비 중 ${String(e)}%`,cancel:`취소`,retry:`다시 시도`,failedHelp:e=>`다시 시도하거나 ${e}에게 원인을 물어보세요.`,partial:`일부 파일을 만들지 못했습니다.`,nVersions:e=>`버전 ${String(e)}개`,show:`폴더에서 보기`,notStarted:`다운로드를 시작하지 못했습니다`,option:{pptx:{label:`슬라이드`,values:{native:`편집 가능`,picture:`이미지`}},steps:{label:`애니메이션 단계별로`},changes:{label:`원본 Word 파일 이후의 변경 내용`},scale:{label:`크기`}},type:{mov:`MOV (ProRes)`,srt:`자막`,cover:`표지 이미지`,pptx:`PowerPoint`,zip:`ZIP (보드마다 PNG)`}},es:{saved:{saved:`Guardado`,saving:`Guardando…`,unsaved:`Aún sin guardar`,error:`No guardado`},agentDoing:{editing:e=>`${e} está editando`,looking:e=>`${e} está mirando`},follow:e=>`Seguir a ${e}`,unfollow:e=>`Dejar de seguir a ${e}`,markUp:`Corregir`,markUpHint:`Corrige lo que ves y la IA hace los cambios`,moreTools:`Más`,download:`Descargar`,share:`Compartir`,ready:`Listo`,failed:`Error al descargar`,format:`Formato`,versions:`Idiomas`,include:`Incluir`,onShow:`Actual`,all:e=>`Los ${String(e)} idiomas`,choose:`Elegir…`,chosen:e=>`${String(e)} elegidos`,back:`Atrás`,checking:`Comprobando…`,blocked:e=>`${String(e)} problemas obligatorios impiden la descarga`,queued:`En espera`,queuedAhead:e=>`En espera, ${String(e)} delante`,preparing:e=>`Preparando ${String(e)} %`,cancel:`Cancelar`,retry:`Reintentar`,failedHelp:e=>`Reinténtalo o pregunta a ${e} qué ha fallado.`,partial:`No se pudieron crear algunos archivos.`,nVersions:e=>`${String(e)} versiones`,show:`Mostrar en la carpeta`,notStarted:`La descarga no se inició`,option:{pptx:{label:`Diapositivas`,values:{native:`Editables`,picture:`Imágenes`}},steps:{label:`Cada paso de animación`},changes:{label:`Cambios desde su Word original`},scale:{label:`Tamaño`}},type:{mov:`MOV (ProRes)`,srt:`Subtítulos`,cover:`Imagen de portada`,pptx:`PowerPoint`,zip:`ZIP (cada mesa de trabajo en PNG)`}},fr:{saved:{saved:`Enregistré`,saving:`Enregistrement…`,unsaved:`Pas encore enregistré`,error:`Non enregistré`},agentDoing:{editing:e=>`${e} modifie`,looking:e=>`${e} regarde`},follow:e=>`Suivre ${e}`,unfollow:e=>`Ne plus suivre ${e}`,markUp:`Annoter`,markUpHint:`Annotez ce qui est affiché, et l'IA fait les changements`,moreTools:`Plus`,download:`Télécharger`,share:`Partager`,ready:`Prêt`,failed:`Échec du téléchargement`,format:`Format`,versions:`Langues`,include:`Inclure`,onShow:`Affichée`,all:e=>`Les ${String(e)} langues`,choose:`Choisir…`,chosen:e=>`${String(e)} choisies`,back:`Retour`,checking:`Vérification…`,blocked:e=>`${String(e)} problèmes à corriger bloquent le téléchargement`,queued:`En attente`,queuedAhead:e=>`En attente, ${String(e)} avant celui-ci`,preparing:e=>`Préparation ${String(e)}\u00a0%`,cancel:`Annuler`,retry:`Réessayer`,failedHelp:e=>`Réessayez ou demandez à ${e} ce qui n’a pas marché.`,partial:`Certains fichiers n’ont pas pu être créés.`,nVersions:e=>`${String(e)} versions`,show:`Afficher dans le dossier`,notStarted:`Le téléchargement n’a pas démarré`,option:{pptx:{label:`Diapositives`,values:{native:`Modifiables`,picture:`Images`}},steps:{label:`Chaque étape d'animation`},changes:{label:`Modifications depuis le Word d'origine`},scale:{label:`Taille`}},type:{mov:`MOV (ProRes)`,srt:`Sous-titres`,cover:`Image de couverture`,pptx:`PowerPoint`,zip:`ZIP (chaque plan de travail en PNG)`}},de:{saved:{saved:`Gespeichert`,saving:`Wird gespeichert…`,unsaved:`Noch nicht gespeichert`,error:`Nicht gespeichert`},agentDoing:{editing:e=>`${e} bearbeitet`,looking:e=>`${e} schaut sich um`},follow:e=>`${e} folgen`,unfollow:e=>`${e} nicht mehr folgen`,markUp:`Korrigieren`,markUpHint:`Korrigieren Sie, was zu sehen ist, und die KI setzt es um`,moreTools:`Mehr`,download:`Herunterladen`,share:`Teilen`,ready:`Bereit`,failed:`Download fehlgeschlagen`,format:`Format`,versions:`Sprachen`,include:`Dazu`,onShow:`Aktuell`,all:e=>`Alle ${String(e)} Sprachen`,choose:`Auswählen…`,chosen:e=>`${String(e)} ausgewählt`,back:`Zurück`,checking:`Wird geprüft…`,blocked:e=>`${String(e)} Probleme verhindern den Download`,queued:`Wartet`,queuedAhead:e=>`Wartet, ${String(e)} davor`,preparing:e=>`Wird vorbereitet: ${String(e)} %`,cancel:`Abbrechen`,retry:`Erneut versuchen`,failedHelp:e=>`Versuche es erneut oder frage ${e}, was schiefgelaufen ist.`,partial:`Einige Dateien konnten nicht erstellt werden.`,nVersions:e=>`${String(e)} Versionen`,show:`Im Ordner zeigen`,notStarted:`Der Download wurde nicht gestartet`,option:{pptx:{label:`Folien`,values:{native:`Bearbeitbar`,picture:`Bilder`}},steps:{label:`Jeden Animationsschritt`},changes:{label:`Änderungen seit dem Word-Original`},scale:{label:`Größe`}},type:{mov:`MOV (ProRes)`,srt:`Untertitel`,cover:`Titelbild`,pptx:`PowerPoint`,zip:`ZIP (jede Zeichenfläche als PNG)`}},pt:{saved:{saved:`Salvo`,saving:`Salvando…`,unsaved:`Ainda não salvo`,error:`Não salvo`},agentDoing:{editing:e=>`${e} está editando`,looking:e=>`${e} está olhando`},follow:e=>`Seguir ${e}`,unfollow:e=>`Parar de seguir ${e}`,markUp:`Corrigir`,markUpHint:`Corrija o que vê e a IA faz as alterações`,moreTools:`Mais`,download:`Baixar`,share:`Compartilhar`,ready:`Pronto`,failed:`Falha ao baixar`,format:`Formato`,versions:`Idiomas`,include:`Incluir`,onShow:`Atual`,all:e=>`Todos os ${String(e)} idiomas`,choose:`Escolher…`,chosen:e=>`${String(e)} escolhidos`,back:`Voltar`,checking:`Verificando…`,blocked:e=>`${String(e)} problemas obrigatórios impedem o download`,queued:`Aguardando`,queuedAhead:e=>`Aguardando, ${String(e)} na frente`,preparing:e=>`Preparando ${String(e)}%`,cancel:`Cancelar`,retry:`Tentar novamente`,failedHelp:e=>`Tente novamente ou pergunte a ${e} o que deu errado.`,partial:`Não foi possível criar alguns arquivos.`,nVersions:e=>`${String(e)} versões`,show:`Mostrar na pasta`,notStarted:`O download não começou`,option:{pptx:{label:`Slides`,values:{native:`Editáveis`,picture:`Imagens`}},steps:{label:`Cada etapa da animação`},changes:{label:`Alterações desde o Word original`},scale:{label:`Tamanho`}},type:{mov:`MOV (ProRes)`,srt:`Legendas`,cover:`Imagem de capa`,pptx:`PowerPoint`,zip:`ZIP (cada prancheta em PNG)`}}});function Nn(){let e=r(),t=X.of(e?.locale);return e=>e.doing===void 0?e.name:t.agentDoing[e.doing](e.name)}function Pn(){let e=r(),n=Nn(),{agent:i,following:a,follow:o,unfollow:c}=t();if(i?.doing===void 0)return null;let l=X.of(e?.locale);return(0,z.jsxs)(F,{[s]:``,"data-testid":`agent-here`,"data-doing":i.doing,"aria-pressed":a,title:a?l.unfollow(i.name):l.follow(i.name),className:`text-agent-text hover:text-agent-text aria-pressed:text-agent-text`,onClick:()=>{a?c():o()},children:[(0,z.jsx)(`span`,{"aria-hidden":!0,className:T(`size-2 flex-none rounded-full`,a?`bg-agent motion-safe:animate-pulse`:`border-agent border`)}),n(i)]})}function Fn(){let e=o(),{agent:n,following:r,follow:i,unfollow:s}=t(),c=n?.doing,l=n?.name;return(0,R.useEffect)(()=>{e[`agent/here`]({...c===void 0||l===void 0?{}:{agent:{name:l,doing:c}},following:r}).catch(()=>void 0)},[e,c,l,r]),a(`editor/command`,({command:e})=>{e===`follow`?i():e===`unfollow`&&s()}),null}function In({checked:e,multiple:t=!1,variant:n=`row`,className:r,children:i,...a}){return(0,z.jsxs)(`button`,{type:`button`,role:t?`checkbox`:`radio`,"aria-checked":e,"data-slot":`choice`,...a,className:T(`text-sm text-ink transition-colors focus-visible:outline focus-visible:-outline-offset-1 focus-visible:outline-pencil disabled:cursor-default disabled:opacity-50`,n===`row`?`flex min-h-8 items-center gap-2.5 rounded-md px-2 py-1 text-left`:`flex flex-col items-center rounded-md border px-2 py-2.5`,e?T(`bg-pencil-wash`,n===`box`&&`border-pencil`):T(`hover:bg-hover active:bg-press`,n===`box`&&`border-rule hover:border-rule-strong`),r),children:[n===`row`&&(0,z.jsx)(`span`,{"aria-hidden":!0,className:T(`flex size-4 flex-none items-center justify-center border text-on-pencil`,t?`rounded-sm`:`rounded-full`,e?t?`border-pencil bg-pencil`:`border-4 border-pencil`:`border-rule-strong`),children:t&&e&&(0,z.jsx)(Me,{className:`size-3`})}),i]})}var Z=16,Ln=8;function Rn(){return(0,z.jsx)(Wt,{asChild:!0,width:Z,height:Ln,children:(0,z.jsxs)(`svg`,{viewBox:`0 0 ${String(Z)} ${String(Ln)}`,"aria-hidden":!0,className:`-mt-px block overflow-visible`,children:[(0,z.jsx)(`path`,{d:`M0 -1 L${String(Z/2)} 7 L${String(Z)} -1 Z`,className:`fill-popover`}),(0,z.jsx)(`path`,{d:`M0 0 L${String(Z/2)} 7 L${String(Z)} 0`,className:`fill-none stroke-border`})]})})}function zn({className:e,...t}){return(0,z.jsx)(Qe,{"data-slot":`checkbox`,className:T(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary`,e),...t,children:(0,z.jsx)(et,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:(0,z.jsx)(Me,{className:`size-3.5`})})})}function Bn({...e}){return(0,z.jsx)(kt,{"data-slot":`popover`,...e})}function Vn({...e}){return(0,z.jsx)(Nt,{"data-slot":`popover-trigger`,...e})}function Hn({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,z.jsx)(Lt,{children:(0,z.jsx)(zt,{"data-slot":`popover-content`,align:t,sideOffset:n,className:T(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}function Un({...e}){return(0,z.jsx)(jt,{"data-slot":`popover-anchor`,...e})}function Wn({...e}){return(0,z.jsx)(l,{"data-slot":`sheet`,...e})}function Gn({...e}){return(0,z.jsx)(_,{"data-slot":`sheet-portal`,...e})}function Kn({className:e,...t}){return(0,z.jsx)(h,{"data-slot":`sheet-overlay`,className:T(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function qn({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,z.jsxs)(Gn,{children:[(0,z.jsx)(Kn,{}),(0,z.jsxs)(d,{"data-slot":`sheet-content`,className:T(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,z.jsxs)(g,{className:`absolute top-2.5 right-2.5 grid size-7 place-items-center rounded-md text-lead ring-offset-background hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus:outline-hidden active:bg-press disabled:pointer-events-none motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,z.jsx)(ae,{className:`size-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Jn({className:e,...t}){return(0,z.jsx)(u,{"data-slot":`sheet-title`,className:T(`font-semibold text-foreground`,e),...t})}var Yn=w(`inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground`},size:{default:`h-9 min-w-9 px-2`,sm:`h-8 min-w-8 px-1.5`,lg:`h-10 min-w-10 px-2.5`}},defaultVariants:{variant:`default`,size:`default`}}),Xn=R.createContext({size:`default`,variant:`default`,spacing:0});function Zn({className:e,variant:t,size:n,spacing:r=0,children:i,...a}){return(0,z.jsx)(nn,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,style:{"--gap":r},className:T(`group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs`,e),...a,children:(0,z.jsx)(Xn.Provider,{value:{variant:t,size:n,spacing:r},children:i})})}function Qn({className:e,children:t,variant:n,size:r,...i}){let a=R.useContext(Xn);return(0,z.jsx)(fn,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:T(Yn({variant:a.variant||n,size:a.size||r}),`w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10`,`data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l`,e),...i,children:t})}function $n(e){if(e?.mode!==`edit`)return{gives:`nothing`};let t=e.commands!==!0,n=le(e.item);return n===`formats`?{gives:`formats`,button:t}:n===`file as it is`?{gives:`file as it is`,path:e.item.entry,button:t}:{gives:`nothing`}}function er(e,t,n){if(!n&&e.state===`done`&&t.has(e.id))return e.files.length===1?e.files[0]:void 0}var tr=5;function nr(e,t){let n=new Set;return e.filter(e=>e.item===t&&e.state!==`cancelled`).reverse().filter(e=>{if(e.state!==`done`||e.files.length===0)return!0;let t=[...e.files].sort().join(`
2
- `);return!n.has(t)&&(n.add(t),!0)}).slice(0,tr)}var Q=e=>e.state===`queued`||e.state===`running`,rr=e=>e.state===`running`&&e.progress===0,ir=6,ar=.95,or=e=>ar*(1-Math.exp(-Math.max(0,e)/ir));function sr(e,t){return e.map(e=>{let n=t.get(e.id);return e.state===`running`&&n!==void 0&&n>e.progress?{...e,progress:Math.min(1,n)}:e})}function cr(e,t,n,r={}){let i=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e));return Q(e)&&i(e.versions,t)&&i(e.types,n)&&lr(e.options??{},r)}var lr=(e,t)=>Object.keys({...e,...t}).every(n=>e[n]===t[n]);function ur(e,t,n){return Object.fromEntries(e.flatMap(e=>{let r=n[e.name];return!e.only.includes(t)||r===void 0?[]:e.values?e.values.includes(String(r))?[[e.name,r]]:[]:r===!0?[[e.name,!0]]:[]}))}function dr(e,t){return Math.max(0,e.filter(Q).map(e=>e.id).indexOf(t))}function fr(e,t,n,r){if(n.length!==0)return e===`all`?[...n]:e===`some`?n.filter(e=>r.includes(e)):t===void 0?[...n]:[t]}function pr(e,t){let n=e.findLast(Q);if(n)return n.state===`running`?{at:`running`,percent:Math.round(n.progress*100)}:{at:`queued`};let r=e[0];return r===void 0||!t.has(r.id)?{at:`idle`}:r.state===`failed`?{at:`failed`}:{at:`done`}}var mr=e=>e.slice(e.lastIndexOf(`/`)+1);async function hr(e,t){let{url:n}=await e[`files/url`]({path:t}),r=document.createElement(`a`);r.href=n,r.download=mr(t),r.click()}var gr={mp4:`MP4`,gif:`GIF`,png:`PNG`,jpeg:`JPEG`,webp:`WebP`,avif:`AVIF`,pdf:`PDF`,html:`HTML`,zip:`ZIP`,psd:`PSD`,docx:`Word`,md:`Markdown`,xlsx:`Excel`,csv:`CSV`,json:`JSON`,glb:`GLB`},_r=(e,t)=>gr[t]??(t in e.type?e.type[t]:t);function vr(){let e=r(),t=X.of(e?.locale),n=e?.item.kindInfo.exports?.names,i=e?.locale??`en`;return e=>{let r=n?.[e];return r?.[i]??r?.en??_r(t,e)}}function yr(){let[e,t]=(0,R.useState)(()=>window.matchMedia(`(max-width: 479px)`).matches);return(0,R.useEffect)(()=>{let e=window.matchMedia(`(max-width: 479px)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function br(e,t){let n=o(),[r,i]=(0,R.useState)([]),[s,c]=(0,R.useState)(new Set),[l,u]=(0,R.useState)(!1),d=(0,R.useRef)(new Set),f=(0,R.useRef)(new Map),p=e=>{let r=er(e,d.current,l);r!==void 0&&(d.current.delete(e.id),hr(n,r).catch(e=>{we.error(t.notStarted,{description:e instanceof Error?e.message:String(e)})}))},m=(0,R.useRef)(new Map),[h,g]=(0,R.useState)(new Map),_=e=>{rr(e)?m.current.has(e.id)||m.current.set(e.id,performance.now()):(m.current.delete(e.id),Q(e)||g(t=>{if(!t.has(e.id))return t;let n=new Map(t);return n.delete(e.id),n}))},v=r.some(rr);(0,R.useEffect)(()=>{if(!v)return;let e=setInterval(()=>{let e=performance.now();g(t=>{let n=new Map(t);for(let[r,i]of m.current)n.set(r,Math.max(t.get(r)??0,or((e-i)/1e3)));return n})},250);return()=>{clearInterval(e)}},[v]);let y=e=>{d.current.add(e.id),p(f.current.get(e.id)??e)};(0,R.useEffect)(()=>{let e=!0;return L(n,`export/list`,{}).then(t=>{e&&(t.jobs.forEach(_),i(t.jobs),u(t.reveal))},()=>void 0),()=>{e=!1}},[n]),a(`export/changed`,({job:t})=>{_(t),i(e=>{let n=e.findIndex(e=>e.id===t.id);return n<0?[...e,t]:e.map((e,r)=>r===n?t:e)}),!Q(t)&&!e&&c(e=>new Set(e).add(t.id)),f.current.set(t.id,t),p(t)});let[b,x]=(0,R.useState)(e);return b!==e&&(x(e),e&&c(new Set)),{all:(0,R.useMemo)(()=>sr(r,h),[r,h]),fresh:s,reveals:l,asked:y}}function xr(e,t){let n=o(),r=`item-bar.export.${e}`,[i,a]=(0,R.useState)({type:t.types[0]??``,extras:[],options:{}});return(0,R.useEffect)(()=>{let e=!0;return n[`storage/get`]({key:r}).then(({value:n})=>{let r=n;if(!e||!r)return;let i=t.types.find(e=>e===r.type);i!==void 0&&a({type:i,extras:t.extras.filter(e=>r.extras?.includes(e)),options:r.options??{}})},()=>void 0),()=>{e=!1}},[n,r,t]),[i,e=>{a(e),n[`storage/set`]({key:r,value:e}).catch(()=>void 0)}]}async function Sr(e,t,n){n&&await L(e,`export/reveal`,{path:t}).then(()=>!0,()=>!1)||await hr(e,t)}function Cr({job:e,versions:t,ahead:n,words:i,reveals:a,onAsked:s}){let c=vr(),l=o(),u=r()?.agent?.name??`AllyHub`,d=Math.round(e.progress*100),f=a?An:hn,p=a?i.show:i.download,m=e.versions.length===0?void 0:e.versions.length>2?i.nVersions(e.versions.length):e.versions.map(e=>t.find(t=>t.key===e)?.label??e).join(`, `),h=[e.types.map(e=>c(e)).join(`, `),...t.length>1&&m!==void 0?[m]:[]].join(` · `);return(0,z.jsxs)(`div`,{className:`border-t py-2 pr-2 pl-4`,"data-testid":`export-job`,"data-state":e.state,children:[Q(e)&&(0,z.jsxs)(`div`,{className:`pr-2`,children:[(0,z.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,children:h}),(0,z.jsx)(`span`,{className:`text-lead text-xs tabular-nums`,children:e.state===`running`?`${String(d)}%`:n>0?i.queuedAhead(n):i.queued}),(0,z.jsx)(F,{icon:!0,"aria-label":i.cancel,title:i.cancel,"data-testid":`export-cancel`,onClick:()=>{L(l,`export/cancel`,{job:e.id}).catch(()=>void 0)},children:(0,z.jsx)(ae,{"aria-hidden":!0})})]}),(0,z.jsx)(He,{value:d,className:`mt-1 h-1`})]}),e.state===`failed`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,z.jsx)(me,{className:`text-destructive size-3.5 flex-none`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`text-dense text-destructive min-w-0 flex-1 truncate`,children:[i.failed,` · `,h]}),(0,z.jsx)(F,{icon:!0,"aria-label":i.retry,title:i.retry,"data-testid":`export-retry`,onClick:()=>{L(l,`export/start`,{item:e.item,versions:e.versions,types:e.types,...e.options?{options:e.options}:{}}).then(e=>{s(e.job)},e=>{we.error(i.notStarted,{description:e instanceof Error?e.message:String(e)})})},children:(0,z.jsx)(jn,{"aria-hidden":!0})})]}),(0,z.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:i.failedHelp(u)})]}),e.files.map(e=>(0,z.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,"data-testid":`export-file`,children:[(0,z.jsx)(Me,{className:`text-success size-3.5 flex-none`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,title:e,children:mr(e)}),(0,z.jsx)(F,{icon:!0,"aria-label":p,title:p,"data-testid":`export-give`,onClick:()=>{Sr(l,e,a)},children:(0,z.jsx)(f,{"aria-hidden":!0})})]},e)),e.state===`done`&&e.error!==void 0&&(0,z.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:i.partial})]})}function wr({versions:e,shown:t,picked:n,onPick:r,onBack:i,words:a}){return(0,z.jsxs)(`div`,{"data-testid":`export-choose`,children:[(0,z.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b pr-4 pl-2`,children:[(0,z.jsx)(F,{icon:!0,"aria-label":a.back,title:a.back,onClick:i,children:(0,z.jsx)(mn,{"aria-hidden":!0})}),(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:a.versions}),(0,z.jsxs)(`span`,{className:`text-lead ml-auto text-xs tabular-nums`,children:[n.length,`/`,e.length]})]}),(0,z.jsx)(`ul`,{className:`max-h-64 overflow-y-auto p-2`,children:e.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`label`,{className:`pressable flex h-8 items-center gap-2 rounded-md px-2 text-sm`,children:[(0,z.jsx)(zn,{checked:n.includes(e.key),"data-version":e.key,onCheckedChange:t=>{r(t===!0?[...n,e.key]:n.filter(t=>t!==e.key))}}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.key===t&&(0,z.jsx)(`span`,{className:`text-lead text-xs`,children:a.onShow})]})},e.key))})]})}function Tr({kind:e,offer:t,item:n,props:r,jobs:i,all:a,words:s,reveals:c,onAsked:l,startRef:u}){let d=vr(),f=o(),p=r.versions??[],m=p.map(e=>e.key),h=p.find(e=>e.key===r.shown)?.label,g=r.unavailable??{},[_,v]=xr(e,t),[y,b]=(0,R.useState)(`shown`),[x,S]=(0,R.useState)(r.shown===void 0?[]:[r.shown]),[C,w]=(0,R.useState)(!1),[ee,E]=(0,R.useState)(!1),D=fr(y,r.shown,m,x),O=D?.length??1,k=[_.type,..._.extras.filter(e=>g[e]===void 0)],ne=t.options.filter(e=>e.only.includes(_.type)),A=ur(ne,_.type,_.options),re=ne.filter(e=>e.values===void 0),ie=(e,t)=>{v({..._,options:{..._.options,[e]:t}})},j=r.check?.waiting===!0,M=j?0:r.check?.problems(D)??0,N=i.some(e=>cr(e,D??[],k,A)),ae=async()=>{E(!0);try{l((await L(f,`export/start`,{item:n,...D?{versions:D}:{},types:k,...Object.keys(A).length>0?{options:A}:{}})).job)}catch(e){if(ce(e))return;we.error(s.notStarted,{description:e instanceof Error?e.message:String(e)})}finally{E(!1)}},P=(0,z.jsx)(Dr,{label:s.format,types:t.types,chosen:_.type,name:d,onChoose:e=>{v({..._,type:e})}}),oe=(0,z.jsx)(te,{ref:u,size:`sm`,disabled:j||M>0||ee||O===0||N,"data-testid":`export-start`,onClick:()=>{ae()},children:j?s.checking:s.download});return(0,z.jsxs)(`div`,{className:`overflow-hidden rounded-lg text-sm`,"data-testid":`export-panel`,children:[C?(0,z.jsx)(wr,{versions:p,shown:r.shown,picked:x,onPick:S,onBack:()=>{w(!1)},words:s}):(0,z.jsxs)(z.Fragment,{children:[t.types.length>1&&(0,z.jsx)(`div`,{className:`px-4 pt-4`,children:P}),(m.length>1||t.extras.length+ne.length>0)&&(0,z.jsxs)(`div`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-3 px-4 pt-4`,children:[ne.map(e=>e.values?(0,z.jsxs)(R.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-lead`,children:s.option[e.name]?.label}),(0,z.jsx)(Zn,{type:`single`,variant:`outline`,size:`sm`,className:`w-full`,"aria-label":s.option[e.name]?.label,"data-testid":`export-option-${e.name}`,value:String(_.options[e.name]??e.values[0]),onValueChange:t=>{t!==``&&ie(e.name,t)},children:e.values.map(t=>(0,z.jsx)(Qn,{value:t,"data-value":t,className:`flex-1`,children:s.option[e.name]?.values?.[t]??t},t))})]},e.name):null),m.length>1&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-lead`,children:s.versions}),(0,z.jsxs)(je,{value:y,onValueChange:e=>{b(e),e===`some`&&w(!0)},children:[(0,z.jsx)(ke,{size:`sm`,"aria-label":s.versions,className:`w-full min-w-0`,"data-testid":`export-scope`,children:(0,z.jsx)(Pe,{})}),(0,z.jsxs)(Oe,{position:`popper`,align:`start`,children:[(0,z.jsx)(Ie,{value:`shown`,children:h??s.onShow}),(0,z.jsx)(Ie,{value:`all`,children:s.all(m.length)}),(0,z.jsx)(Le,{}),(0,z.jsx)(Ie,{value:`some`,onPointerUp:()=>{w(!0)},children:y===`some`?s.chosen(x.length):s.choose})]})]})]}),t.extras.length+re.length>0&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-lead self-start`,children:s.include}),(0,z.jsxs)(`div`,{className:`grid gap-1.5`,"data-testid":`export-include`,children:[re.map(e=>(0,z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(zn,{checked:_.options[e.name]===!0,"data-option":e.name,onCheckedChange:t=>{ie(e.name,t===!0)}}),(0,z.jsx)(`span`,{className:`truncate`,children:s.option[e.name]?.label})]},e.name)),t.extras.map(e=>{let t=g[e];return(0,z.jsxs)(`label`,{title:t,className:T(`flex items-center gap-2`,t!==void 0&&`text-lead-soft`),children:[(0,z.jsx)(zn,{checked:t===void 0&&_.extras.includes(e),disabled:t!==void 0,"data-type":e,onCheckedChange:t=>{v({..._,extras:t===!0?[..._.extras,e]:_.extras.filter(t=>t!==e)})}}),(0,z.jsx)(`span`,{className:`truncate`,children:d(e)})]},e)})]})]})]}),M>0&&(0,z.jsxs)(`p`,{className:`text-dense text-destructive flex items-start gap-1.5 px-4 pt-3`,"data-testid":`export-blocked`,children:[(0,z.jsx)(me,{className:`mt-0.5 size-3.5 flex-none`,"aria-hidden":!0}),s.blocked(M)]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,z.jsx)(`span`,{className:`text-lead min-w-0 flex-1 truncate text-xs`,children:r.facts??(t.types.length===1?d(_.type):void 0)}),oe]})]}),i.length>0&&(0,z.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,children:i.map(e=>(0,z.jsx)(Cr,{job:e,versions:p,ahead:dr(a,e.id),words:s,reveals:c,onAsked:l},e.id))})]})}var Er={png:Sn,jpeg:Sn,webp:Sn,avif:Sn,gif:Tn,mp4:kn,mov:kn,pdf:pe,docx:Cn,md:On,txt:On,html:xn,xlsx:En,csv:En,json:yn,pptx:bn,zip:_n,psd:Dn,glb:vn};function Dr(e){let t=(0,R.useRef)(null),n=e.types.length,r=n<=4?n:Math.min(4,Math.ceil(n/2));return(0,z.jsx)(`div`,{ref:t,role:`radiogroup`,"aria-label":e.label,"data-testid":`export-format`,className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${String(r)}, minmax(0, 1fr))`},onKeyDown:r=>{let i=r.key===`ArrowRight`||r.key===`ArrowDown`?1:r.key===`ArrowLeft`||r.key===`ArrowUp`?-1:0;if(i===0)return;r.preventDefault();let a=e.types[(e.types.indexOf(e.chosen)+i+n)%n];a!==void 0&&(e.onChoose(a),t.current?.querySelector(`[data-type="${a}"]`)?.focus())},children:e.types.map(t=>{let n=Er[t]??wn,r=e.chosen===t;return(0,z.jsxs)(In,{variant:`box`,checked:r,tabIndex:r?0:-1,"data-type":t,title:e.name(t),className:`min-h-16 min-w-0 justify-center gap-1.5 rounded-lg px-1.5 py-2.5`,onClick:()=>{e.onChoose(t)},children:[(0,z.jsx)(n,{"aria-hidden":!0,strokeWidth:1.5,className:T(`size-5`,r?`text-pencil`:`text-lead`)}),(0,z.jsx)(`span`,{className:`line-clamp-2 w-full text-center text-xs leading-tight text-balance break-words`,children:e.name(t)})]},t)})})}function Or(e){let t=/Mac|iPhone|iPad/u.test(navigator.userAgent),n=e.target;return e.code===`KeyE`&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.shiftKey&&!e.altKey&&!(n instanceof HTMLElement&&(n.isContentEditable||n.tagName===`INPUT`||n.tagName===`TEXTAREA`))}function kr(e){let t=$n(r());return t.gives===`nothing`?null:t.gives===`file as it is`?(0,z.jsx)(Ar,{path:t.path,hosted:!t.button}):(0,z.jsx)(jr,{...e})}function Ar({path:e,hosted:t}){let n=o(),i=X.of(r()?.locale),s=()=>{hr(n,e).catch(e=>{we.error(i.notStarted,{description:e instanceof Error?e.message:String(e)})})};a(`editor/command`,({command:e,open:t})=>{e===`export`&&t!==!1&&s()});let c=(0,R.useEffectEvent)(e=>{Or(e)&&(e.preventDefault(),s())});return(0,R.useEffect)(()=>(window.addEventListener(`keydown`,c),()=>{window.removeEventListener(`keydown`,c)}),[]),(0,R.useEffect)(()=>{t&&n[`export/state`]({at:`idle`,open:!1}).catch(()=>void 0)},[n,t]),t?null:(0,z.jsxs)(F,{"data-testid":`export`,"data-state":`idle`,"aria-label":i.download,title:i.download,onClick:s,children:[(0,z.jsx)(hn,{"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`@max-lg/item:hidden`,children:i.download})]})}function jr(e){let t=o(),n=r(),i=n?.commands===!0,s=n?.item.kind,c=n?.item.kindInfo.exports,l=n?.item.id,u=X.of(n?.locale),d=yr(),f=(0,R.useRef)(null),[p,m]=(0,R.useState)(!1),{all:h,fresh:g,reveals:_,asked:v}=br(p,u);a(`editor/command`,({command:e,open:t})=>{e===`export`&&m(e=>t??!e)}),(0,R.useEffect)(()=>{let e=e=>{Or(e)&&(e.preventDefault(),m(e=>!e))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]),(0,R.useEffect)(()=>{if(!p||d)return;let e=()=>{m(!1)};return window.addEventListener(`blur`,e),()=>{window.removeEventListener(`blur`,e)}},[p,d]);let y=c!==void 0,b=l===void 0?[]:nr(h,l),x=pr(b,g),S=x.at===`running`?x.percent:void 0;if((0,R.useEffect)(()=>{i&&y&&t[`export/state`]({at:x.at,...S===void 0?{}:{percent:S},open:p}).catch(()=>void 0)},[t,i,y,x.at,S,p]),s===void 0||l===void 0||c===void 0)return null;let C=x.at===`running`?`${String(x.percent)}%`:x.at===`queued`?u.queued:x.at===`done`?u.ready:x.at===`failed`?u.failed:u.download,w=(0,z.jsxs)(F,{"data-testid":`export`,"data-state":x.at,"aria-pressed":p,"aria-label":x.at===`running`?u.preparing(x.percent):C,title:C,onClick:()=>{d&&m(!0)},children:[x.at===`running`&&(0,z.jsx)(Ve,{value:x.percent/100}),x.at===`queued`&&(0,z.jsx)(Ve,{value:0}),x.at===`done`&&(0,z.jsx)(Me,{className:`text-success`,"aria-hidden":!0}),x.at===`failed`&&(0,z.jsx)(me,{className:`text-destructive`,"aria-hidden":!0}),x.at===`idle`&&(0,z.jsx)(hn,{"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`@max-lg/item:hidden`,children:C})]}),T=(0,z.jsx)(Tr,{kind:s,offer:c,item:l,props:e,jobs:b,all:h,words:u,reveals:_,onAsked:v,startRef:f});return d?(0,z.jsxs)(z.Fragment,{children:[!i&&w,(0,z.jsx)(Wn,{open:p,onOpenChange:m,children:(0,z.jsxs)(qn,{side:`bottom`,showCloseButton:!1,className:`gap-0 rounded-t-lg`,children:[(0,z.jsx)(Jn,{className:`sr-only`,children:u.download}),T]})})]}):(0,z.jsxs)(Bn,{open:p,onOpenChange:m,children:[i?(0,z.jsx)(Un,{className:`pointer-events-none fixed top-0 right-2 size-0`}):(0,z.jsx)(Vn,{asChild:!0,children:w}),(0,z.jsxs)(Hn,{align:`end`,sideOffset:i?4:8,className:`w-88 p-0`,onOpenAutoFocus:e=>{f.current&&!f.current.disabled&&(e.preventDefault(),f.current.focus())},children:[!i&&(0,z.jsx)(Rn,{}),T]})]})}function Mr({...e}){return(0,z.jsx)(dt,{"data-slot":`context-menu`,...e})}function Nr({...e}){return(0,z.jsx)(pt,{"data-slot":`context-menu-trigger`,...e})}function Pr({...e}){return(0,z.jsx)(bt,{"data-slot":`context-menu-sub`,...e})}function Fr({className:e,inset:t,children:n,...r}){return(0,z.jsxs)(xt,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:T(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,z.jsx)(Ne,{className:`ml-auto`})]})}function Ir({className:e,...t}){return(0,z.jsx)(St,{"data-slot":`context-menu-sub-content`,className:T(`z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...t})}var Lr=R.createContext(null),Rr=4;function zr(e){let t=R.useRef(!1);return R.useEffect(()=>{let n=e?.ownerDocument??document,r=0,i=e=>{r+=Math.abs(e.movementX)+Math.abs(e.movementY),r>=Rr&&(t.current=!0,n.removeEventListener(`pointermove`,i,!0))};return n.addEventListener(`pointermove`,i,!0),()=>{n.removeEventListener(`pointermove`,i,!0)}},[e]),t}function Br(e){let t=zr(e.container);return(0,z.jsx)(Lr,{value:t,children:e.children})}function Vr(e){let t=R.useContext(Lr);return n=>{e?.(n),t&&!t.current&&n.preventDefault()}}function Hr({className:e,container:t,children:n,...r}){return(0,z.jsx)(mt,{container:t,children:(0,z.jsx)(gt,{"data-slot":`context-menu-content`,className:T(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r,children:(0,z.jsx)(Br,{container:t,children:n})})})}function Ur({className:e,inset:t,variant:n=`default`,onPointerUp:r,...i}){let a=Vr(r);return(0,z.jsx)(_t,{onPointerUp:a,"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:T(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...i})}function Wr({className:e,...t}){return(0,z.jsx)(vt,{"data-slot":`context-menu-separator`,className:T(`-mx-1 my-1 h-px bg-border`,e),...t})}function Gr({className:e,...t}){return(0,z.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:T(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Kr=150,qr=e=>{if(!(e.currentTarget instanceof Element))return;let t=e.currentTarget.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}},Jr=(e,t,n=!0)=>{let r=qr(t);setTimeout(()=>{e.begin(r,n)},Kr)};function $(){let e=o(),t=r();if(t?.notes!==!0)return;let n=X.of(t.locale);return{label:n.markUp,hint:n.markUpHint,begin:(t,n)=>{e[`note/begin`]({...t?{from:t}:{},...n===!0?{selection:n}:{}}).catch(()=>void 0)}}}function Yr(){let e=$();return e?(0,z.jsxs)(F,{title:e.hint,"data-testid":`mark-up`,className:`text-ink`,onClick:t=>{e.begin(qr(t))},children:[(0,z.jsx)(Y,{"aria-hidden":!0}),e.label]}):null}function Xr(e){let t=$();return t?(0,z.jsx)(`div`,{role:`toolbar`,"aria-label":t.label,"data-note-chrome":``,"data-testid":`mark-up-bar`,className:`border-rule bg-sheet shadow-overlay flex items-center rounded-lg border p-0.5 ${e.className??``}`,style:e.style,onPointerDown:e=>{e.stopPropagation()},children:(0,z.jsxs)(F,{title:t.hint,"data-testid":`mark-up-selected`,className:`text-ink`,onClick:e=>{t.begin(qr(e),!0)},children:[(0,z.jsx)(Y,{"aria-hidden":!0}),t.label]})}):null}function Zr({selection:e=!0}={}){let t=$();return t?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(ze,{}),(0,z.jsxs)(Fe,{title:t.hint,"data-testid":`mark-up-item`,onSelect:n=>{Jr(t,n,e)},children:[(0,z.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),t.label]})]}):null}function Qr(){let e=$();return e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Wr,{}),(0,z.jsxs)(Ur,{title:e.hint,"data-testid":`mark-up-item`,onSelect:t=>{Jr(e,t)},children:[(0,z.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),e.label]})]}):null}var $r=e=>e instanceof Element&&e.closest(`input, textarea`)!==null;function ei(){let e=$(),t=e!==void 0,[n,r]=(0,R.useState)();return(0,R.useEffect)(()=>{if(!t)return;let e=e=>{e.defaultPrevented||$r(e.target)||(e.preventDefault(),r({x:e.clientX,y:e.clientY}))};return document.addEventListener(`contextmenu`,e),()=>{document.removeEventListener(`contextmenu`,e)}},[t]),!e||!n?null:(0,z.jsxs)(Re,{open:!0,onOpenChange:e=>{e||r(void 0)},children:[(0,z.jsx)(fe,{asChild:!0,children:(0,z.jsx)(`span`,{style:{position:`fixed`,left:n.x,top:n.y,width:0,height:0}})}),(0,z.jsx)(Ae,{align:`start`,className:`text-xs`,children:(0,z.jsxs)(Fe,{title:e.hint,"data-testid":`mark-up-item`,onSelect:t=>{Jr(e,t)},children:[(0,z.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),e.label]})})]})}function ti(){let e=r();return e?.share===!0&&e.mode===`edit`&&e.item.kindInfo.share===!0}function ni(){let e=o(),t=r();if(!ti())return null;let n=X.of(t?.locale);return(0,z.jsxs)(F,{"data-testid":`share`,"aria-label":n.share,title:n.share,onClick:()=>{e[`share/begin`]({}).catch(()=>void 0)},children:[(0,z.jsx)(Mn,{"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`@max-lg/item:hidden`,children:n.share})]})}var ri=800;function ii(e){let t=e?.state===`saving`||e?.state===`unsaved`,[n,r]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{r(!0)},ri);return()=>{clearTimeout(e),r(!1)}},[t]),e!==void 0&&e.state!==`saved`&&(!t||n)}function ai({saved:e,words:t}){return(0,z.jsx)(`span`,{"data-testid":`save-state`,"data-state":e.state,title:e.message,className:T(`px-1 text-xs`,e.state===`error`?`text-destructive`:`text-lead`),children:t.saved[e.state]})}function oi({start:e,saved:t,exports:n}){let a=r(),o=ti(),s=X.of(a?.locale),c=ii(t),l=i()?.doing!==void 0;if(a?.mode!==`edit`)return e?(0,z.jsx)(`div`,{className:`bg-background flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:e}):null;if(a.commands===!0)return(0,z.jsxs)(z.Fragment,{children:[e?(0,z.jsx)(`div`,{className:`bg-background @container/item flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:e}):null,(0,z.jsx)(Fn,{}),(0,z.jsx)(kr,{...n}),(0,z.jsx)(ei,{})]});let u=$n(a).gives!==`nothing`;return!e&&!c&&!u&&!o&&!l?(0,z.jsx)(ei,{}):(0,z.jsxs)(`div`,{className:`bg-background @container/item flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:[e,(0,z.jsxs)(`div`,{className:`ml-auto flex flex-none items-center gap-1`,children:[(0,z.jsx)(Pn,{}),t&&c&&(0,z.jsx)(ai,{saved:t,words:s}),(0,z.jsx)(Yr,{}),(0,z.jsx)(kr,{...n}),(0,z.jsx)(ni,{})]}),(0,z.jsx)(ei,{})]})}var si=e(D(),1),ci=`group-data-[compact]/bar:hidden`,li=32,ui={compact:!1,out:[],firsts:[],order:{}},di=(0,R.createContext)(null),fi=(e,t)=>e.compact===t.compact&&e.out.join(`
3
- `)===t.out.join(`
4
- `)&&e.firsts.join(`
5
- `)===t.firsts.join(`
6
- `)&&JSON.stringify(e.order)===JSON.stringify(t.order);function pi({children:e,id:t,priority:n=0,keep:r=!1,ruled:i=!0}){let a=(0,R.useContext)(di),o=(0,R.useId)(),s=t??o,c=a?.fit.firsts.includes(s)??!1,l=a?.touch;(0,R.useLayoutEffect)(()=>(l?.(),l),[l]);let u=(0,z.jsx)(`span`,{className:T(`relative flex h-8 flex-none items-center gap-0.5`,!c&&`pl-2`,!c&&i&&`before:bg-rule before:absolute before:top-2 before:bottom-2 before:left-0.75 before:w-px`),children:e});if(!a)return u;let d=a.fit.out.includes(s);return(0,z.jsx)(`span`,{"data-group":s,"data-priority":n,"data-keep":r?``:void 0,className:d?`hidden`:`flex flex-none`,children:d?a.panel?(0,si.createPortal)((0,z.jsx)(`span`,{"data-group":s,"data-away":``,className:`flex flex-none`,style:{order:a.fit.order[s]??0},children:u}),a.panel):null:u})}function mi({testid:e,className:t,children:n,...i}){let a=r(),o=X.of(a?.locale),s=(0,R.useRef)(null),[c,l]=(0,R.useState)(null),u=(0,R.useRef)(new Map),[d,f]=(0,R.useState)(ui),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(0),_=(0,R.useCallback)(()=>{g(e=>e+1)},[]),v=(0,R.useRef)(null);return(0,R.useLayoutEffect)(()=>{let e=new ResizeObserver(()=>{g(e=>e+1)});return v.current=e,s.current&&e.observe(s.current),()=>{e.disconnect(),v.current=null}},[]),(0,R.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=[],n=new Set,r=!0;for(let i of e.querySelectorAll(`[data-group]:not([data-away]), [data-spacer]`)){if(i.dataset.spacer!==void 0){r=!0;continue}let e=i.dataset.group??``;if(t.push({key:e,priority:Number(i.dataset.priority??0),keep:i.dataset.keep!==void 0,at:t.length}),d.out.includes(e))continue;r&&n.add(e),r=!1,v.current?.observe(i);let a=i.getBoundingClientRect().width;a>0&&u.current.set(`${String(d.compact)}:${e}`,a)}for(let e of c?.querySelectorAll(`[data-away]`)??[]){let t=e.getBoundingClientRect().width;t>0&&u.current.set(`${String(d.compact)}:${e.dataset.group??``}`,t)}let i=e.clientWidth,a=(e,t)=>u.current.get(`${String(e)}:${t.key}`),o=e=>t.every(t=>a(e,t)!==void 0),l=e=>t.reduce((t,n)=>t+(a(e,n)??0),0),h=!1,g=[];if(!o(!1)||l(!1)<=i)h=!1;else if(!o(!0)||l(!0)<=i)h=!0;else{h=!0;let e=t.filter(e=>!e.keep).sort((e,t)=>e.priority-t.priority||t.at-e.at),n=new Set,r=l(!0)+li;for(let t of e){if(r<=i)break;n.add(t.key),r-=a(!0,t)??0}g=t.filter(e=>n.has(e.key)).map(e=>e.key)}let _={compact:h,out:g,firsts:[...n],order:Object.fromEntries(t.map(e=>[e.key,e.at]))};fi(_,d)||f(_),g.length===0&&p&&m(!1)},[d,p,h,c,n]),(0,z.jsx)(di.Provider,{value:{fit:d,panel:p?c:null,touch:_},children:(0,z.jsxs)(`div`,{...i,ref:s,role:i.role??`toolbar`,"data-testid":e,"data-compact":d.compact?``:void 0,className:T(`group/bar relative flex h-8 min-w-0 flex-1 items-center overflow-hidden`,t),children:[n,d.out.length>0?(0,z.jsxs)(Bn,{open:p,onOpenChange:m,children:[(0,z.jsx)(Vn,{asChild:!0,children:(0,z.jsx)(F,{icon:!0,className:`ml-auto flex-none`,"aria-label":o.moreTools,title:o.moreTools,"data-testid":`${e}-more`,onMouseDown:e=>{e.preventDefault()},children:(0,z.jsx)(gn,{})})}),(0,z.jsx)(Hn,{align:`end`,collisionPadding:8,role:`toolbar`,"aria-label":o.moreTools,"data-testid":`${e}-panel`,"data-compact":d.compact?``:void 0,onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onInteractOutside:e=>{let t=e.target;t instanceof Element&&t.closest(`[data-radix-popper-content-wrapper]`)&&e.preventDefault()},className:`group/bar w-auto max-w-[calc(100vw-1rem)] overflow-hidden p-1`,children:(0,z.jsx)(`div`,{ref:l,className:`-ml-2 flex flex-wrap items-center`})})]}):null]})})}export{Vn as C,jn as D,Nn as E,Y as O,Hn as S,In as T,Nr as _,Xr as a,Bn as b,$ as c,Ur as d,Wr as f,Fr as g,Ir as h,oi as i,Cn as k,Mr as l,Pr as m,pi as n,Qr as o,Gr as p,mi as r,Zr as s,ci as t,Hr as u,Zn as v,zn as w,Un as x,Qn as y};
@@ -1,24 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-COiEfhsA.js";import{a as n,b as r,c as i,d as a,f as o,h as s,l as c,m as l,s as u}from"./react-Byupo4pA.js";import{Et as d,Tt as f,bt as p,ht as m,kt as h,n as g,vt as _,yt as v}from"./x-BAJilkKD.js";import{C as y,E as b,S as x,_ as S,a as C,f as w,g as T,l as E,s as D,v as O}from"./schemas-DlRAoVtq.js";import{F as k,S as A,_ as ee,b as te,g as ne,j,x as re}from"./snapshots-DYooVfOx.js";import{t as ie}from"./session--OJYv_B7.js";import{r as ae,t as oe}from"./schemas-C21MyseF.js";import{t as se}from"./jsx-runtime-DePvh3-m.js";import{A as M,O as N,a as P,i as ce,l as F,n as le,o as ue,t as de}from"./bar-button-CJmpgNg4.js";import{D as fe,E as pe,a as me,c as he,i as ge,n as I,r as L}from"./dist-DCI21ljp.js";import{i as _e,n as R,r as z,t as ve}from"./hint-F4fIBnVU.js";import{t as B}from"./createLucideIcon-euu7Wcd9.js";import{t as ye}from"./audio-lines-BFoW_IeO.js";import{n as V,t as be}from"./undo-2-DCbMWoug.js";import{t as xe}from"./scissors-m6QcoEf2.js";import{F as Se,n as Ce,t as we,w as Te}from"./index-omhSywJb.js";import{n as Ee,r as De,t as Oe}from"./updating-D0GEtwnJ.js";import{n as ke,r as Ae,t as je}from"./collaborator-CbTacvkB.js";import{a as Me,c as H,d as Ne,j as Pe,n as U,r as Fe,s as Ie,t as Le}from"./dist-DIJnhQFK.js";var Re=[`error`,`saving`,`unsaved`,`saved`],ze=class e{host;options;sessions=new Map;opening=new Map;done=[];undone=[];stateListeners=new Set;undoListeners=new Set;stops=[];last=`saved`;closed=!1;constructor(e,t){this.host=e,this.options={...t,report:!1}}static async open(t,n,r={}){let i=new e(t,r);return await Promise.all(n.map(e=>i.add(e))),i}add(e){let t=this.sessions.get(e);if(t)return Promise.resolve(t);let n=this.opening.get(e);return n||(n=ie.open(this.host,e,this.options).then(t=>(this.sessions.set(e,t),this.opening.delete(e),this.stops.push(t.onState(()=>{this.stateChanged()})),this.closed&&t.close(),t)),this.opening.set(e,n)),n}file(e){return this.sessions.get(e)}get paths(){return[...this.sessions.keys()]}get state(){let e=[...this.sessions.values()].map(e=>e.state);return Re.find(t=>e.includes(t))??`saved`}get error(){return[...this.sessions.values()].find(e=>e.error!==void 0)?.error}onState(e){return this.stateListeners.add(e),()=>this.stateListeners.delete(e)}stateChanged(){let e=this.state;if(e!==this.last){this.last=e;for(let t of this.stateListeners)t(e);this.host[`editor/state`]&&this.host[`editor/state`]({state:e,...e===`error`&&this.error!==void 0?{message:this.error}:{}}).catch(()=>void 0)}}edited(e){for(let t of e)this.sessions.get(t)?.edited()}pushEdit(e){this.closed||(this.done.push(e),this.undone.length=0,this.edited(e.files),this.undoChanged())}amend(e){let t=this.done.pop();if(!t){this.pushEdit(e);return}let n=[...new Set([...t.files,...e.files])];this.done.push({label:e.label,files:n,undo:()=>{e.undo(),t.undo()},redo:()=>{t.redo(),e.redo()}}),this.undone.length=0,this.edited(e.files),this.undoChanged()}get canUndo(){return this.done.length>0}get canRedo(){return this.undone.length>0}get undoLabel(){return this.done.at(-1)?.label}get redoLabel(){return this.undone.at(-1)?.label}undo(){let e=this.done.pop();return e?(e.undo(),this.undone.push(e),this.edited(e.files),this.undoChanged(),!0):!1}redo(){let e=this.undone.pop();return e?(e.redo(),this.done.push(e),this.edited(e.files),this.undoChanged(),!0):!1}onUndo(e){return this.undoListeners.add(e),()=>this.undoListeners.delete(e)}undoChanged(){for(let e of this.undoListeners)e()}async flush(){await Promise.all([...this.sessions.values()].map(e=>e.flush()))}async close(){this.closed=!0;for(let e of this.stops.splice(0))e();await Promise.all([...this.sessions.values()].map(e=>e.close()))}},Be=B(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),Ve=B(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),W=B(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),G=B(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),He=B(`skip-back`,[[`path`,{d:`M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`15892j`}],[`path`,{d:`M3 20V4`,key:`1ptbpl`}]]),Ue=B(`step-back`,[[`path`,{d:`M13.971 4.285A2 2 0 0 1 17 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`19qhus`}],[`path`,{d:`M21 20V4`,key:`cb8qj8`}]]),We=B(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]),Ge=B(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),Ke=B(`volume-1`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}]]),qe=B(`volume-x`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),K=e(r(),1),q=se(),Je=e=>Number.isFinite(e)&&e>0?e:0,J=e=>{let t=Je(e);return`${String(Math.floor(t/60))}:${String(Math.floor(t%60)).padStart(2,`0`)}`},Ye=e=>{let t=Je(e);return`${String(Math.floor(t/60))}:${(t%60).toFixed(1).padStart(4,`0`)}`},Xe=(e,t)=>Math.floor(e*t+1e-9)/t,Ze=e=>e.split(/[/\\]/u).at(-1)??e,Qe=T({fps:S(),width:S(),height:S(),duration:S(),parts:D(b())}),$e=x({from:w().positive(),to:w().positive()}),et=$e.extend({key:y().min(1),layers:D($e).optional(),sounds:$e.optional(),messages:D($e.extend({key:y().min(1)})).optional()}),tt={"video/versions":k(x({item:j}),x({piece:y(),kind:y(),title:y().optional(),width:S(),height:S(),versions:D(x({key:y(),lang:y().optional()}))}),`A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for.`),"video/stage":k(x({...te,start:x({t:S().nonnegative().optional(),part:y().optional(),offset:S().nonnegative().optional(),dur:S().positive().optional()}).optional(),play:E().optional(),chrome:E().optional(),mode:C([`code`]).optional()}),ne,`The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage.`),"video/timeline":k(x(te),x({timeline:Qe,text:D(b())}),`A version's timeline, drawn nowhere.`),"video/still":k(x({...te,t:S().nonnegative().optional()}),x({t:S(),image:A,width:w().positive(),height:w().positive(),duration:S().nonnegative()}),`A moment of a version as the render draws it, as a picture.`),"video/stills":k(x({...te,moments:D(S().nonnegative()).min(1).max(32)}),x({stills:D(x({t:S(),image:A}))}),"Several moments of a version as the render draws them: what `video/still` gives, on one page."),"video/sources":k(x({item:j}),x({files:D(x({path:j,parts:D(et),music:D($e).optional()}))}),`Where each part, its layers, its sounds and its script's messages are written in the piece's code and its script, by line, and the video's music: what a change to those lines changes.`)},nt=re(tt),rt=v({en:{loading:`Loading the preview`,previewTitle:`Preview`,denoising:`Denoising the speech; playing it as recorded`,uncut:e=>`No person matte for ${e} yet: layers behind the person show in front`,play:`Play`,pause:`Pause`,seek:`Seek`,toStart:`Go to start`,frameBack:`Previous frame`,frameForward:`Next frame`,mute:`Mute`,unmute:`Unmute`,volume:`Volume`,withKey:(e,t)=>`${e} (${t})`,keys:{space:`Space`,home:`Home`},prevPage:`Previous page`,nextPage:`Next page`,pageOf:(e,t)=>`Page ${String(e)} of ${String(t)}`,timeOf:(e,t,n)=>`${e} of ${t}${n?`, ${n}`:``}`,hideTimeline:`Hide timeline`,showTimeline:`Show timeline`,rows:{scenes:`Scenes`,voice:`Speech`,music:`Music`,sound:`Sound`},noVoice:`No speech`,noMusic:`No music`,noCues:`No sound cues`,ducked:`lowered under speech`,version:`Language`,script:`Script`,scriptHint:`Delete words to cut them. Delete struck words to keep them.`,scriptReadOnly:`What the video says.`,noScript:`Nobody speaks in this video.`,undo:`Undo`,redo:`Redo`,undoWhat:e=>`Undo ${e}`,redoWhat:e=>`Redo ${e}`,cutWords:`Cut`,keepWords:`Keep`,noEdits:`Words are cut only in a take whose code names an edits file: ask the agent to add one.`,resizeScript:`Script width`,resizeTimeline:`Timeline height`},"zh-cn":{loading:`正在加载预览`,previewTitle:`预览`,denoising:`正在降噪,先播原声`,uncut:e=>`${e} 还没有人像遮罩:人物后面的图层暂时画在人物前面`,play:`播放`,pause:`暂停`,seek:`进度`,toStart:`回到开头`,frameBack:`上一帧`,frameForward:`下一帧`,mute:`静音`,unmute:`取消静音`,volume:`音量`,withKey:(e,t)=>`${e}(${t})`,keys:{space:`空格`,home:`Home`},prevPage:`上一页`,nextPage:`下一页`,pageOf:(e,t)=>`第 ${String(e)} 页,共 ${String(t)} 页`,timeOf:(e,t,n)=>`${e} / ${t}${n?`,${n}`:``}`,hideTimeline:`收起时间线`,showTimeline:`展开时间线`,rows:{scenes:`分段`,voice:`说话`,music:`音乐`,sound:`音效`},noVoice:`没有人说话`,noMusic:`没有音乐`,noCues:`没有音效`,ducked:`有人说话时压低`,version:`语言`,script:`文稿`,scriptHint:`删掉文字就剪掉这段;删掉划线的文字就恢复。`,scriptReadOnly:`视频里说的话。`,noScript:`这个视频里没有人说话。`,undo:`撤销`,redo:`重做`,undoWhat:e=>`撤销「${e}」`,redoWhat:e=>`重做「${e}」`,cutWords:`剪掉`,keepWords:`保留`,noEdits:`只有代码里给这段录音指定了剪辑文件,才能在这里剪词:可以让 agent 加一个。`,resizeScript:`文稿宽度`,resizeTimeline:`时间线高度`},"zh-tw":{loading:`正在載入預覽`,previewTitle:`預覽`,denoising:`正在降噪,先播放原始錄音`,uncut:e=>`${e} 還沒有人像遮罩:人物後方的圖層暫時顯示在人物前面`,play:`播放`,pause:`暫停`,seek:`播放位置`,toStart:`回到開頭`,frameBack:`上一格`,frameForward:`下一格`,mute:`靜音`,unmute:`取消靜音`,volume:`音量`,withKey:(e,t)=>`${e}(${t})`,keys:{space:`空白鍵`,home:`Home`},prevPage:`上一頁`,nextPage:`下一頁`,pageOf:(e,t)=>`第 ${String(e)} 頁,共 ${String(t)} 頁`,timeOf:(e,t,n)=>`${e} / ${t}${n?`,${n}`:``}`,hideTimeline:`收合時間軸`,showTimeline:`展開時間軸`,rows:{scenes:`段落`,voice:`語音`,music:`音樂`,sound:`音效`},noVoice:`沒有語音`,noMusic:`沒有音樂`,noCues:`沒有音效`,ducked:`有語音時降低音量`,version:`語言`,script:`文稿`,scriptHint:`刪掉文字就剪掉這段;刪掉劃線的文字就復原。`,scriptReadOnly:`影片裡說的話。`,noScript:`這部影片裡沒有人說話。`,undo:`復原`,redo:`重做`,undoWhat:e=>`復原「${e}」`,redoWhat:e=>`重做「${e}」`,cutWords:`剪掉`,keepWords:`保留`,noEdits:`只有程式碼為這段錄音指定了剪輯檔,才能在這裡剪詞:可以請 agent 加一個。`,resizeScript:`文稿寬度`,resizeTimeline:`時間軸高度`},ja:{loading:`プレビューを読み込み中`,previewTitle:`プレビュー`,denoising:`音声のノイズを除去中。録音のまま再生しています`,uncut:e=>`${e} の人物マットはまだありません。人物の後ろのレイヤーが前に表示されます`,play:`再生`,pause:`一時停止`,seek:`再生位置`,toStart:`先頭へ`,frameBack:`前のフレーム`,frameForward:`次のフレーム`,mute:`ミュート`,unmute:`ミュート解除`,volume:`音量`,withKey:(e,t)=>`${e}(${t})`,keys:{space:`スペース`,home:`Home`},prevPage:`前のページ`,nextPage:`次のページ`,pageOf:(e,t)=>`${String(e)} / ${String(t)} ページ`,timeOf:(e,t,n)=>`${e} / ${t}${n?`、${n}`:``}`,hideTimeline:`タイムラインを隠す`,showTimeline:`タイムラインを表示`,rows:{scenes:`シーン`,voice:`音声`,music:`音楽`,sound:`効果音`},noVoice:`音声なし`,noMusic:`音楽なし`,noCues:`効果音なし`,ducked:`音声の間は音量を下げる`,version:`言語`,script:`台本`,scriptHint:`言葉を削除するとカットされます。取り消し線の言葉を削除すると元に戻ります。`,scriptReadOnly:`動画の中で話していること。`,noScript:`この動画では誰も話していません。`,undo:`取り消す`,redo:`やり直す`,undoWhat:e=>`「${e}」を取り消す`,redoWhat:e=>`「${e}」をやり直す`,cutWords:`カット`,keepWords:`残す`,noEdits:`単語をカットできるのは、コードがカットファイルを指定しているテイクだけです。エージェントに追加を頼んでください。`,resizeScript:`台本の幅`,resizeTimeline:`タイムラインの高さ`},ko:{loading:`미리보기를 불러오는 중`,previewTitle:`미리보기`,denoising:`음성의 잡음을 제거하는 중입니다. 녹음된 그대로 재생합니다`,uncut:e=>`${e}의 인물 매트가 아직 없습니다. 인물 뒤 레이어가 앞에 보입니다`,play:`재생`,pause:`일시정지`,seek:`재생 위치`,toStart:`처음으로`,frameBack:`이전 프레임`,frameForward:`다음 프레임`,mute:`음소거`,unmute:`음소거 해제`,volume:`볼륨`,withKey:(e,t)=>`${e} (${t})`,keys:{space:`스페이스`,home:`Home`},prevPage:`이전 페이지`,nextPage:`다음 페이지`,pageOf:(e,t)=>`${String(t)}페이지 중 ${String(e)}페이지`,timeOf:(e,t,n)=>`${e} / ${t}${n?`, ${n}`:``}`,hideTimeline:`타임라인 숨기기`,showTimeline:`타임라인 보기`,rows:{scenes:`장면`,voice:`음성`,music:`음악`,sound:`사운드`},noVoice:`음성 없음`,noMusic:`음악 없음`,noCues:`효과음 없음`,ducked:`음성 아래로 낮춤`,version:`언어`,script:`대본`,scriptHint:`단어를 지우면 잘립니다. 줄 그어진 단어를 지우면 다시 살아납니다.`,scriptReadOnly:`영상에서 하는 말.`,noScript:`이 영상에는 말하는 사람이 없습니다.`,undo:`실행 취소`,redo:`다시 실행`,undoWhat:e=>`'${e}' 실행 취소`,redoWhat:e=>`'${e}' 다시 실행`,cutWords:`자르기`,keepWords:`남기기`,noEdits:`코드에 편집 파일이 지정된 테이크에서만 단어를 잘라낼 수 있습니다. 에이전트에게 추가해 달라고 요청하세요.`,resizeScript:`대본 너비`,resizeTimeline:`타임라인 높이`},es:{loading:`Cargando la vista previa`,previewTitle:`Vista previa`,denoising:`Reduciendo el ruido de la voz; se reproduce tal como se grabó`,uncut:e=>`Aún no hay máscara de persona para ${e}: las capas detrás de la persona se ven delante`,play:`Reproducir`,pause:`Pausa`,seek:`Buscar`,toStart:`Ir al inicio`,frameBack:`Fotograma anterior`,frameForward:`Fotograma siguiente`,mute:`Silenciar`,unmute:`Activar sonido`,volume:`Volumen`,withKey:(e,t)=>`${e} (${t})`,keys:{space:`Espacio`,home:`Inicio`},prevPage:`Página anterior`,nextPage:`Página siguiente`,pageOf:(e,t)=>`Página ${String(e)} de ${String(t)}`,timeOf:(e,t,n)=>`${e} de ${t}${n?`, ${n}`:``}`,hideTimeline:`Ocultar la línea de tiempo`,showTimeline:`Mostrar la línea de tiempo`,rows:{scenes:`Escenas`,voice:`Voz`,music:`Música`,sound:`Sonido`},noVoice:`Sin voz`,noMusic:`Sin música`,noCues:`Sin efectos de sonido`,ducked:`bajada bajo la voz`,version:`Idioma`,script:`Guion`,scriptHint:`Borra palabras para cortarlas. Borra las tachadas para recuperarlas.`,scriptReadOnly:`Lo que dice el vídeo.`,noScript:`Nadie habla en este vídeo.`,undo:`Deshacer`,redo:`Rehacer`,undoWhat:e=>`Deshacer: ${e}`,redoWhat:e=>`Rehacer: ${e}`,cutWords:`Cortar`,keepWords:`Mantener`,noEdits:`Solo se pueden cortar palabras en una toma cuyo código indique un archivo de cortes: pide al agente que añada uno.`,resizeScript:`Ancho del guion`,resizeTimeline:`Altura de la línea de tiempo`},fr:{loading:`Chargement de l’aperçu`,previewTitle:`Aperçu`,denoising:`Débruitage de la voix\xA0; lecture telle qu’enregistrée`,uncut:e=>`Pas encore de masque de personne pour ${e}\u00a0: les calques derrière la personne passent devant`,play:`Lire`,pause:`Pause`,seek:`Position`,toStart:`Aller au début`,frameBack:`Image précédente`,frameForward:`Image suivante`,mute:`Couper le son`,unmute:`Activer le son`,volume:`Volume`,withKey:(e,t)=>`${e} (${t})`,keys:{space:`Espace`,home:`Début`},prevPage:`Page précédente`,nextPage:`Page suivante`,pageOf:(e,t)=>`Page ${String(e)} sur ${String(t)}`,timeOf:(e,t,n)=>`${e} sur ${t}${n?`, ${n}`:``}`,hideTimeline:`Masquer la timeline`,showTimeline:`Afficher la timeline`,rows:{scenes:`Scènes`,voice:`Voix`,music:`Musique`,sound:`Son`},noVoice:`Pas de voix`,noMusic:`Pas de musique`,noCues:`Pas d’effets sonores`,ducked:`baissée sous la voix`,version:`Langue`,script:`Script`,scriptHint:`Supprimez des mots pour les couper. Supprimez des mots barrés pour les garder.`,scriptReadOnly:`Ce que dit la vidéo.`,noScript:`Personne ne parle dans cette vidéo.`,undo:`Annuler`,redo:`Rétablir`,undoWhat:e=>`Annuler : ${e}`,redoWhat:e=>`Rétablir : ${e}`,cutWords:`Couper`,keepWords:`Garder`,noEdits:`On ne coupe des mots que dans une prise dont le code nomme un fichier de coupes : demandez à l’agent d’en ajouter un.`,resizeScript:`Largeur du script`,resizeTimeline:`Hauteur de la chronologie`},de:{loading:`Vorschau wird geladen`,previewTitle:`Vorschau`,denoising:`Sprache wird entrauscht; Wiedergabe wie aufgenommen`,uncut:e=>`Noch keine Personenmaske für ${e}: Ebenen hinter der Person erscheinen davor`,play:`Abspielen`,pause:`Pause`,seek:`Springen`,toStart:`Zum Anfang`,frameBack:`Vorheriges Bild`,frameForward:`Nächstes Bild`,mute:`Stummschalten`,unmute:`Ton an`,volume:`Lautstärke`,withKey:(e,t)=>`${e} (${t})`,keys:{space:`Leertaste`,home:`Pos1`},prevPage:`Vorherige Seite`,nextPage:`Nächste Seite`,pageOf:(e,t)=>`Seite ${String(e)} von ${String(t)}`,timeOf:(e,t,n)=>`${e} von ${t}${n?`, ${n}`:``}`,hideTimeline:`Zeitleiste ausblenden`,showTimeline:`Zeitleiste einblenden`,rows:{scenes:`Szenen`,voice:`Sprache`,music:`Musik`,sound:`Ton`},noVoice:`Keine Sprache`,noMusic:`Keine Musik`,noCues:`Keine Soundeffekte`,ducked:`unter Sprache abgesenkt`,version:`Sprache`,script:`Skript`,scriptHint:`Wörter löschen schneidet sie heraus. Durchgestrichene Wörter löschen behält sie wieder.`,scriptReadOnly:`Was im Video gesagt wird.`,noScript:`In diesem Video spricht niemand.`,undo:`Rückgängig`,redo:`Wiederholen`,undoWhat:e=>`Rückgängig: ${e}`,redoWhat:e=>`Wiederholen: ${e}`,cutWords:`Schneiden`,keepWords:`Behalten`,noEdits:`Wörter lassen sich nur in einer Aufnahme schneiden, deren Code eine Schnittdatei nennt: Bitte den Agenten, eine anzulegen.`,resizeScript:`Breite des Skripts`,resizeTimeline:`Höhe der Zeitleiste`},pt:{loading:`Carregando a prévia`,previewTitle:`Prévia`,denoising:`Removendo o ruído da fala; tocando como foi gravada`,uncut:e=>`Ainda não há máscara de pessoa para ${e}: as camadas atrás da pessoa aparecem na frente`,play:`Reproduzir`,pause:`Pausar`,seek:`Posição`,toStart:`Ir para o início`,frameBack:`Quadro anterior`,frameForward:`Próximo quadro`,mute:`Silenciar`,unmute:`Ativar som`,volume:`Volume`,withKey:(e,t)=>`${e} (${t})`,keys:{space:`Espaço`,home:`Home`},prevPage:`Página anterior`,nextPage:`Próxima página`,pageOf:(e,t)=>`Página ${String(e)} de ${String(t)}`,timeOf:(e,t,n)=>`${e} de ${t}${n?`, ${n}`:``}`,hideTimeline:`Ocultar a linha do tempo`,showTimeline:`Mostrar a linha do tempo`,rows:{scenes:`Cenas`,voice:`Fala`,music:`Música`,sound:`Som`},noVoice:`Sem fala`,noMusic:`Sem música`,noCues:`Sem efeitos sonoros`,ducked:`abaixada sob a fala`,version:`Idioma`,script:`Roteiro`,scriptHint:`Apague palavras para cortá-las. Apague palavras riscadas para mantê-las.`,scriptReadOnly:`O que o vídeo diz.`,noScript:`Ninguém fala neste vídeo.`,undo:`Desfazer`,redo:`Refazer`,undoWhat:e=>`Desfazer: ${e}`,redoWhat:e=>`Refazer: ${e}`,cutWords:`Cortar`,keepWords:`Manter`,noEdits:`Só é possível cortar palavras numa tomada cujo código indique um arquivo de cortes: peça ao agente para adicionar um.`,resizeScript:`Largura do roteiro`,resizeTimeline:`Altura da linha do tempo`}});function Y(){return rt.of(i()?.locale)}var it={...ee,...tt};function at(e,t,n){return ot(it,e,t,n)}function ot(e,t,n,r){let i=u(),[a,o]=(0,K.useState)(),s=JSON.stringify([t,n,...r]);return(0,K.useEffect)(()=>{if(n===void 0)return;let r=!0;return re(e)(i,t,n).then(e=>{r&&o({key:s,data:e})},e=>{r&&o({key:s,error:e instanceof Error?e:Error(String(e))})}),()=>{r=!1}},[i,s]),{data:a?.data,error:a?.key===s?a.error:void 0}}function st(){let[e,t]=(0,K.useState)(0);return c(`project/changed`,e=>{t(e.revision)}),e}function ct(){let e=u(),[t,n]=(0,K.useState)();return(0,K.useEffect)(()=>{let t=!0;return Se(e,`check/results`,{}).then(e=>{t&&n(t=>t??e)},()=>void 0),()=>{t=!1}},[e]),c(`check/changed`,n),t}function lt(e,t){let n=u(),[r,i]=(0,K.useState)();(0,K.useEffect)(()=>{let r=!0;return n[`storage/get`]({key:e}).then(n=>{r&&i({key:e,value:n.value===null?t:n.value})},()=>{r&&i({key:e,value:t})}),()=>{r=!1}},[n,e]);let a=(0,K.useCallback)(t=>{i({key:e,value:t}),n[`storage/set`]({key:e,value:t}).catch(()=>void 0)},[n,e]);return[r?.key===e?r.value:void 0,a]}async function ut(e,t){try{return(await e[`files/url`]({path:t})).url}catch{return}}var dt=O({t:S().nonnegative()});function ft(e){let t=dt.safeParse(e);return t.success?t.data:void 0}var pt=e=>({t:Math.round(Math.max(0,e)*1e3)/1e3});function mt(e,t){return e.versions.find(e=>e.key===t)??e.versions[0]}function ht(e,t,n){return e.filter(e=>e.piece===t&&(e.combo===void 0||n.lang===void 0||e.combo.lang===n.lang))}function gt(e,t){try{return new Intl.DisplayNames([t],{type:`language`}).of(e)??e}catch{return e}}var _t=e=>e.still;function vt(e){let t=e?.t;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:void 0}var yt=e=>e?.sound===!0,bt=(e,t)=>e.from<=t.to&&t.from<=e.to;function xt(e,t){let n=e.find(e=>e.path===t.path);if(!n||t.from===void 0)return;let r={from:t.from,to:t.to??t.from};if(n.music?.some(e=>bt(e,r)))return{music:!0};let i=n.parts.filter(e=>bt(e,r)).sort((e,t)=>e.to-e.from-(t.to-t.from))[0];if(!i)return;let a=i.layers?.findIndex(e=>bt(e,r))??-1,o=i.messages?.find(e=>bt(e,r))?.key,s=i.sounds!==void 0&&bt(i.sounds,r);return{part:i.key,...a>=0?{layer:a}:{},...o===void 0?{}:{message:o},...s?{sounds:s}:{}}}function St(e,t){return e.parts.find(e=>e.speech?.edits===t)?.key}var Ct=new Set([`start`,`end`,`still`,`at`]);function wt(e,t){let n=e.start;return JSON.stringify({part:{...e,steps:e.steps?.map(e=>e-n)},text:t},(e,t)=>typeof t==`number`&&Ct.has(e)?Math.round((t-n)*1e3)/1e3:t)}function Tt(e,t){let n=new Map(e.timeline.parts.map(t=>[t.key,wt(t,e.text.find(e=>e.key===t.key))]));return t.timeline.parts.filter(e=>n.get(e.key)!==wt(e,t.text.find(t=>t.key===e.key))).map(e=>e.key)}function Et(e,t,n={}){let r=e.parts.find(e=>e.key===t);if(r)return{t:_t(r),part:t,...n.layer===void 0?{}:{layer:n.layer},...n.message===void 0?{}:{message:n.message}}}function Dt(e){let t=e.audio.music,n=e.audio.mix;return JSON.stringify({file:t?.file,from:t?.from,loop:t?.loop,bpm:t?.tempo?.source===`given`?t.tempo.bpm:void 0,gain:t?.gain?.map(e=>e.db),mix:n?{music:n.music,musicAlone:n.musicAlone,duck:n.duck,musicFade:n.musicFade}:void 0})}function Ot(e,t){return JSON.stringify(e.filter(e=>e.part===t.key).map(e=>({...e,t:Math.round((e.t-t.start)*1e3)/1e3})))}function kt(e,t){let n=new Map(e.parts.map(t=>[t.key,Ot(e.cues,t)]));return{music:Dt(e)!==Dt(t),cues:t.parts.filter(e=>(n.get(e.key)??`[]`)!==Ot(t.cues,e)).map(e=>e.key)}}function At(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Nt(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&Nt(e.charCodeAt(r)))for(r++;r<e.length&&Nt(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r)}let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101)){if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Nt(e.charCodeAt(r))){for(r++;r<e.length&&Nt(e.charCodeAt(r));)r++;n=r}else d=3}return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
2
- `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r}else{if(a>=0&&a<=31){if(Mt(a)){t+=e.substring(i,r),d=2;break}d=6}r++}}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(jt(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(jt(t));return o=15}if(Mt(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
3
- `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Mt(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,Mt(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!Nt(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(jt(e)||Mt(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function jt(e){return e===32||e===9}function Mt(e){return e===10||e===13}function Nt(e){return e>=48&&e<=57}var Pt;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(Pt||={});var X=Array(20).fill(0).map((e,t)=>` `.repeat(t)),Ft=200,It={" ":{"\n":Array(Ft).fill(0).map((e,t)=>`
4
- `+` `.repeat(t)),"\r":Array(Ft).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(Ft).fill(0).map((e,t)=>`\r
5
- `+` `.repeat(t))}," ":{"\n":Array(Ft).fill(0).map((e,t)=>`
6
- `+` `.repeat(t)),"\r":Array(Ft).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(Ft).fill(0).map((e,t)=>`\r
7
- `+` `.repeat(t))}},Lt=[`
8
- `,`\r`,`\r
9
- `];function Rt(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!Ht(e,a-1);)a--;let c=s;for(;c<e.length&&!Ht(e,c);)c++;i=e.substring(a,c),r=Bt(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=Vt(n,e),l=Lt.includes(c),u=0,d=0,f;f=n.insertSpaces?X[n.tabSize||4]??zt(X[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=At(i,!1),h=!1;function g(){if(u>1)return zt(c,u)+zt(f,r+d);let e=f.length*(r+d);return!l||e>It[p][c].length?c+zt(f,r+d):e<=0?c:It[p][c][e]}function _(){let e=m.scan();for(u=0;e===15||e===14;)e===14&&n.keepLines?u+=1:e===14&&(u=1),e=m.scan();return h=e===16||m.getTokenError()!==0,e}let v=[];function y(n,r,i){!h&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&v.push({offset:r,length:i-r,content:n})}let b=_();if(n.keepLines&&u>0&&y(zt(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?X[f.length*r]:zt(f,r),a,e)}for(;b!==17;){let e=m.getTokenOffset()+m.getTokenLength()+a,t=_(),r=``,i=!1;for(;u===0&&(t===12||t===13);){let n=m.getTokenOffset()+a;y(X[1],e,n),e=m.getTokenOffset()+m.getTokenLength()+a,i=t===12,r=i?g():``,t=_()}if(t===2)b!==1&&d--,n.keepLines&&u>0||!n.keepLines&&b!==1?r=g():n.keepLines&&(r=X[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=X[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():X[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():X[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=X[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=X[1]);break;case 10:n.keepLines&&u>0?r=g():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():(t===12||t===13)&&!i?r=X[1]:t!==5&&t!==17&&(h=!0);break;case 16:h=!0}u>0&&(t===12||t===13)&&(r=g())}t===17&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?c:``);let o=m.getTokenOffset()+a;y(r,e,o),b=t}return v}function zt(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function Bt(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===X[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function Vt(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
10
- `?`\r
11
- `:`\r`;if(n===`
12
- `)return`
13
- `}return e&&e.eol||`
14
- `}function Ht(e,t){return`\r
15
- `.indexOf(e.charAt(t))!==-1}var Ut;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Ut||={});function Wt(e,t=[],n=Ut.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}Kt(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:qt(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function Gt(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function Kt(e,t,n=Ut.DEFAULT){let r=At(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16)}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),k()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function O(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,k()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function k(){switch(r.getToken()){case 3:return O();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):k()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function qt(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function Jt(e,t,n,r){let i=t.slice(),a=Wt(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=Gt(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return Yt(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=Gt(o,[s]);if(t!==void 0){if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return Yt(e,{offset:i,length:a-i,content:``},r)}return Yt(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r)}{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return Yt(e,a,r)}}if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return Yt(e,i,r)}if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return Yt(e,i,r)}if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return Yt(e,t,r)}throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function Yt(e,t,n){if(!n.formattingOptions)return[t];let r=Xt(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!Ht(r,i-1);)i--;for(;a<r.length&&!Ht(r,a);)a++}let o=Rt(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=Xt(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function Xt(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var Zt;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(Zt||={});var Qt;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(Qt||={});var $t=Wt,en=Gt,tn;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(tn||={});function nn(e,t,n,r){return Jt(e,t,n,r)}function rn(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=Xt(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}function an(e){let t=e.includes(`\r
16
- `)?`\r
17
- `:`
18
- `,n=/\n([ \t]+)"/.exec(e)?.[1]??` `;return n.startsWith(` `)?{insertSpaces:!1,tabSize:1,eol:t}:{insertSpaces:!0,tabSize:n.length,eol:t}}var on=80;function sn(e){if(Array.isArray(e))return`[${e.map(sn).join(`, `)}]`;if(typeof e==`object`&&e){let t=Object.entries(e).map(([e,t])=>`${JSON.stringify(e)}: ${sn(t)}`);return t.length?`{ ${t.join(`, `)} }`:`{}`}return JSON.stringify(e)}var cn={type:`object`,offset:0,length:0};function ln(e,t,n,r){let i=an(e);if(t.length===0){let e=i.insertSpaces?i.tabSize:` `;return`${JSON.stringify(n,null,e)}${i.eol??`
19
- `}`}let a=[...t],o=e.trim()===``?`{}
20
- `:e,s=en($t(o)??cn,a),c=s===void 0||!o.slice(s.offset,s.offset+s.length).includes(`
21
- `);if(o=rn(o,nn(o,a,n,{formattingOptions:i,...r?{getInsertionIndex:r}:{}})),typeof n==`object`&&n&&c){let e=en($t(o)??cn,a),t=sn(n);if(e){let n=o.lastIndexOf(`
22
- `,e.offset)+1;e.offset-n+t.length+1<=on&&(o=o.slice(0,e.offset)+t+o.slice(e.offset+e.length))}}return o}var un=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0;function dn(e){if(typeof e!=`object`||!e||Array.isArray(e))return`an edits file is a JSON object: { version: 1, remove, sounds, inWord, maxPause, pad }`;let t=e;if(t.version!==1)return`version is 1`;for(let e of[`take`,`$schema`])if(t[e]!==void 0&&typeof t[e]!=`string`)return`${e} is a string`;let n=Object.keys(t).filter(e=>![`version`,`remove`,`sounds`,`inWord`,`maxPause`,`pad`,`take`,`$schema`].includes(e));if(n.length>0)return`unknown field${n.length>1?`s`:``} ${n.join(`, `)} (an edits file has version, remove, sounds, inWord, maxPause, pad and take)`;let r={};if(t.remove!==void 0){if(!Array.isArray(t.remove))return`remove is a list of { from, to, text }`;let e=[];for(let[n,r]of t.remove.entries()){let t=r,i=t?.from,a=t?.to,o=t?.text;if(typeof i!=`number`||typeof a!=`number`||!Number.isInteger(i)||!Number.isInteger(a)||i<0||a<i||o!==void 0&&typeof o!=`string`)return`remove[${String(n)}] is not { from, to, text } with word indices from ≤ to`;e.push({from:i,to:a,...o===void 0?{}:{text:o}})}r.remove=e}for(let e of[`sounds`,`inWord`]){if(t[e]===void 0)continue;if(!Array.isArray(t[e]))return`${e} is a list of { from, to } in seconds of the take`;let n=[];for(let[r,i]of t[e].entries()){let t=i,a=t?.from,o=t?.to;if(!un(a)||!un(o)||o<=a)return`${e}[${String(r)}] is not { from, to } in seconds with from < to`;n.push({from:a,to:o})}r[e]=n}let i=t.maxPause;if(i!==void 0){if(typeof i!=`number`||!Number.isFinite(i)||i<.05||i>10)return`maxPause is seconds, from 0.05 to 10`;r.maxPause=i}let a=t.pad;if(a!==void 0){let e=a,t=typeof a==`object`&&e!==null&&!Array.isArray(a),n=t?Object.keys(e).filter(e=>e!==`before`&&e!==`after`):[],i=e=>e===void 0||un(e)&&e<=2;if(!t||n.length>0||!i(e.before)||!i(e.after))return`pad is { before, after }: seconds of silence kept before and after each cut, each from 0 to 2`;let o=e.before,s=e.after;r.pad={...o===void 0?{}:{before:o},...s===void 0?{}:{after:s}}}return r}function fn(e,t){if(e.length===0)return 0;let n=e[0];if(!n||t<=n.t)return n?.db??0;for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];if(r&&i&&t<=i.t)return i.t===r.t?i.db:r.db+(i.db-r.db)*(t-r.t)/(i.t-r.t)}return e.at(-1)?.db??0}function pn(e,t){let n=e.speed??1,r=e.cuts&&e.cuts.length>0?e.cuts:[{at:e.start,from:e.from}];for(let i=0;i<r.length;i++){let a=r[i];if(!a)continue;let o=r[i+1]?.at??e.end,s=a.from+(o-a.at)*n;if(t>=a.from-1e-6&&t<s+1e-6)return a.at+(t-a.from)/n}}function mn(e,t){return(e?.remove??[]).some(e=>t>=e.from&&t<=e.to)}function hn(e,t,n){return e.parts.flatMap(e=>{let r=e.speech;if(!r)return[];let i=t.get(r.file);if(!i)return[];let[a,o]=r.words??[0,i.length-1],s=r.edits===void 0?void 0:n.get(r.edits),c=[];for(let e=a;e<=o&&e<i.length;e++){let t=i[e];if(!t)continue;let n=mn(s,e),a=n?void 0:pn(r,t.start),o=n?void 0:pn(r,Math.max(t.start,t.end-1e-4));c.push({i:e,text:t.text,start:t.start,end:t.end,removed:n,...a===void 0?{}:{film:a},...o===void 0?{}:{filmEnd:o}})}return[{part:e.key,title:e.title??e.key,file:r.file,...r.edits===void 0?{}:{edits:r.edits},words:c}]})}function gn(e){let t=[...e].sort((e,t)=>e.from-t.from),n=[];for(let e of t){let t=n.at(-1);t&&e.from<=t.to+1?(t.to=Math.max(t.to,e.to),delete t.text):n.push({...e})}return n}function _n(e,t,n){return e.slice(t,n+1).map(e=>e.text).join(` `)}function vn(e,t){return e.map(e=>({from:e.from,to:e.to,text:_n(t,e.from,e.to)}))}function yn(e,t,n,r){let[i,a]=t<=n?[t,n]:[n,t],o=vn(gn([...e?.remove??[],{from:i,to:a}]),r);return{version:1,...e??{},remove:o}}function bn(e,t,n,r){let[i,a]=t<=n?[t,n]:[n,t],o=[];for(let t of e?.remove??[])t.to<i||t.from>a?o.push(t):(t.from<i&&o.push({from:t.from,to:i-1}),t.to>a&&o.push({from:a+1,to:t.to}));let s={version:1,...e??{},remove:vn(gn(o),r)};return s.remove?.length===0&&delete s.remove,s}function xn(e,t){let n=e=>{let t=new Set;for(let n of e?.remove??[])for(let e=n.from;e<=n.to;e++)t.add(e);return t},r=n(e),i=n(t);return{cut:[...i].filter(e=>!r.has(e)).sort((e,t)=>e-t),kept:[...r].filter(e=>!i.has(e)).sort((e,t)=>e-t)}}var Sn=/[.?!…。?!](["'”’)\]」』]*)$/u;function Cn(e){let t=[[]];for(let n of e)t.at(-1)?.push(n),Sn.test(n.text)&&t.push([]);return t.length>1&&t.at(-1)?.length===0&&t.pop(),t}function wn(e){if(e.trim()!==``)try{let t=dn(JSON.parse(e));return typeof t==`string`?void 0:t}catch{return}}var Tn=class{text;constructor(e){this.text=e}get list(){return wn(this.text)}setRemove(e){let t=e?.length?e:void 0;this.text=this.text.trim()===``?`${JSON.stringify({version:1,...t?{remove:t}:{}},null,2)}\n`:ln(this.text,[`remove`],t)}take(e,t){let n=this.list?.remove,r=JSON.stringify(n)===JSON.stringify(wn(t)?.remove);this.text=r||e.trim()===``?e:ln(e,[`remove`],n)}};function En(e){let t=u(),[n,r]=(0,K.useState)(0),i=(0,K.useCallback)(()=>{r(e=>e+1)},[]),a=(0,K.useRef)(void 0),o=(0,K.useRef)(void 0),s=(0,K.useRef)(new Map),c=(0,K.useRef)(new Map),[l,d]=(0,K.useState)();(0,K.useEffect)(()=>{if(e)return;let n=ze.open(t,[]);a.current=n;let r=s.current,l=c.current,u;return n.then(e=>{o.current=e,u=e.onUndo(i),i()}),()=>{u?.(),a.current=void 0,o.current=void 0,r.clear(),l.clear(),n.then(e=>e.close())}},[t,e,i]);let f=(0,K.useCallback)(e=>{let t=a.current;if(t===void 0)return;let n=c.current.get(e);return n||(n=t.then(async t=>{let n=await t.add(e),r=s.current.get(e);if(r)return r;let a=new Tn(n.text);return n.attach({save:()=>a.text===n.text?void 0:a.text,take:(t,n,r)=>{a.take(t,n),r?.kind===`agent`&&d({path:e,...xn(wn(n),wn(t))}),i()}}),s.current.set(e,a),i(),a}),c.current.set(e,n)),n},[i]),p=t=>{let n=s.current.get(t);if(!n)e||f(t);else return n.list},m=(t,n)=>{let r=o.current;!e&&r&&n.length!==0&&(async()=>{let e=[];for(let t of n){let n=f(t.path);if(n===void 0)return;e.push(n)}let a=await Promise.all(e),o=n.flatMap((e,t)=>{let n=a[t];if(!n)return[];let r=n.list?.remove,i=e.next(n.list).remove;return n.setRemove(i),{undo:()=>{n.setRemove(r)},redo:()=>{n.setRemove(i)}}});r.pushEdit({label:t,files:[...new Set(n.map(e=>e.path))],undo:()=>{for(let e of[...o].reverse())e.undo();i()},redo:()=>{for(let e of o)e.redo();i()}}),i()})()},h=o.current;return{listOf:p,apply:m,undo:()=>{o.current?.undo()},redo:()=>{o.current?.redo()},canUndo:h?.canUndo??!1,canRedo:h?.canRedo??!1,undoLabel:h?.undoLabel,redoLabel:h?.redoLabel,tick:n,byAgent:l}}var Dn=(e,t)=>({...e,outline:e.outline.map(e=>e.map(e=>({x:(e.x-t.x)/t.width,y:(e.y-t.y)/t.height})))}),On=(e,t)=>({...e,outline:e.outline.map(e=>e.map(e=>({x:t.x+e.x*t.width,y:t.y+e.y*t.height})))}),kn=e=>e.outline.map(e=>`M${e.map(e=>`${String(e.x)} ${String(e.y)}`).join(`L`)}Z`).join(``),An=(e,t)=>e!==void 0&&kn(e)===kn(t);function jn({moment:e,box:t,pick:n,label:r,ref:i}){let[a,o]=(0,K.useState)(),[s,c]=(0,K.useState)(),l=t=>t?.moment===e?t.layer:void 0,u=l(s),d=l(a);(0,K.useImperativeHandle)(i,()=>({selected:()=>{let e=t();return u&&e?On(u,e):void 0}}),[u]);let f=(0,K.useRef)({busy:!1,over:!1}),p=(0,K.useRef)(!0);(0,K.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let m=async e=>{let r=t(),i=r?await n(e):void 0;return i&&r?Dn(i,r):void 0},h=t=>{let n=f.current;if(n.over=t!==void 0,t===void 0){delete n.next,o(void 0);return}if(n.next=t,n.busy)return;n.busy=!0;let r=()=>{let t=n.next;delete n.next,t===void 0?n.busy=!1:m(t).then(t=>{p.current&&(n.over&&o(t?{layer:t,moment:e}:void 0),r())})};r()},g=u!==void 0;(0,K.useEffect)(()=>{if(!g)return;let e=e=>{e.key===`Escape`&&c(void 0)};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[g]);let _=u?(e=>{let t=e.outline.flat(),n=t.map(e=>e.x),r=t.map(e=>e.y);return{centre:(Math.min(...n)+Math.max(...n))/2,bottom:Math.max(...r)}})(u):void 0;return(0,q.jsxs)(`div`,{role:`application`,"aria-label":r,"data-testid":`stage-select`,className:`absolute inset-0`,onPointerMove:e=>{e.buttons===0&&h({x:e.clientX,y:e.clientY})},onPointerLeave:()=>{h(void 0)},onPointerDown:t=>{if(t.button!==0&&t.button!==2)return;let n=t.button===2;m({x:t.clientX,y:t.clientY}).then(t=>{p.current&&(t?c({layer:t,moment:e}):n||c(void 0))})},children:[(0,q.jsxs)(`svg`,{"aria-hidden":!0,"data-note-chrome":``,viewBox:`0 0 1 1`,preserveAspectRatio:`none`,className:`pointer-events-none absolute inset-0 size-full overflow-visible`,children:[d&&!An(u,d)?(0,q.jsxs)(`g`,{"data-testid":`stage-hovered`,children:[(0,q.jsx)(`path`,{d:kn(d),vectorEffect:`non-scaling-stroke`,className:`stroke-sheet/80 fill-none stroke-[3px]`}),(0,q.jsx)(`path`,{d:kn(d),vectorEffect:`non-scaling-stroke`,className:`stroke-pencil fill-none stroke-1`})]}):null,u?(0,q.jsxs)(`g`,{"data-testid":`stage-selected`,children:[(0,q.jsx)(`path`,{d:kn(u),vectorEffect:`non-scaling-stroke`,className:`stroke-sheet fill-none stroke-[5px]`}),(0,q.jsx)(`path`,{d:kn(u),vectorEffect:`non-scaling-stroke`,className:`stroke-pencil fill-none stroke-2`})]}):null]}),_?(0,q.jsx)(`div`,{className:`absolute mt-2 -translate-x-1/2`,style:{left:`${String(_.centre*100)}%`,top:`${String(Math.min(1,_.bottom)*100)}%`},children:(0,q.jsx)(me,{})}):null]})}function Mn(e,t){return`${e.file===void 0?e.key===void 0?`the ${e.layer} layer`:`layer ${JSON.stringify(e.key)} (${e.layer})`:`the footage ${e.file}`}${e.name===void 0||e.name===e.key?``:`, at ${JSON.stringify(e.name)} in it,`} of ${t} ${e.part}`}function Nn(e){if(typeof e==`object`&&e&&e.allyhub===!0&&typeof e.type==`string`)return e}function Z(e,t){e?.postMessage({allyhub:!0,...t},`*`)}function Pn(e,t,n,r,i=window){if(!e||t.width===0||t.height===0)return Promise.resolve([]);let a=crypto.randomUUID();return new Promise(o=>{let s=e=>{clearTimeout(l),i.removeEventListener(`message`,c),o(e)},c=t=>{if(t.source!==e)return;let n=Nn(t.data);n?.type===`located`&&n.id===a&&s(n.layers)},l=setTimeout(()=>{s([])},r);i.addEventListener(`message`,c),Z(e,{type:`locate`,id:a,mark:f(n,({x:e,y:n})=>({x:(e-t.x)/t.width,y:(n-t.y)/t.height}))})})}function Fn(e,t,n,r,i=window){if(!e||t.width===0||t.height===0)return Promise.resolve(void 0);let a=crypto.randomUUID();return new Promise(o=>{let s=e=>{clearTimeout(l),i.removeEventListener(`message`,c),o(e&&{...e,outline:e.outline.map(e=>e.map(e=>({x:t.x+e.x*t.width,y:t.y+e.y*t.height})))})},c=t=>{if(t.source!==e)return;let n=Nn(t.data);n?.type===`picked`&&n.id===a&&s(n.picked)},l=setTimeout(()=>{s(void 0)},r);i.addEventListener(`message`,c),Z(e,{type:`pick`,id:a,at:{x:(n.x-t.x)/t.width,y:(n.y-t.y)/t.height}})})}function In(e,t,n){let r=new Map(t.map(e=>[e.key,e])),i=e.parts.flatMap(e=>{let t=e.speech;if(!t)return[];let n=r.get(e.key);return[{...n?.speechKey===void 0?{}:{key:n.speechKey},part:e.key,start:t.start,end:t.end,text:n?.spoken??``,file:t.file,from:t.from,speed:t.speed??1,...t.cuts?{cuts:t.cuts}:{}}]}),a=n?.music,o;if(a&&a.segments.length>0){let t=a.segments[0],n=a.segments.at(-1),r=Math.min(e.duration,a.until??(n?n.at+n.dur:e.duration)),i=[];for(let e=1;e<a.duck.length;e++){let t=a.duck[e-1],n=a.duck[e];if(t&&n&&t.db<0&&n.db<0){let e=i.at(-1);e&&Math.abs(e.end-t.t)<1e-9?e.end=n.t:i.push({start:t.t,end:n.t})}}o={file:a.file,start:t?.at??0,end:r,stretches:a.segments.map(e=>({at:e.at,from:e.from,dur:e.dur})),ducked:i,duck:a.duck,fadeIn:a.fadeIn,fadeOut:a.fadeOut}}return{cues:e.cues,speech:i,music:o}}function Ln(e,t){if(t<e.start||t>=e.end)return;let n=e.start,r=e.from;for(let i of e.cuts??[]){if(i.at>t)break;n=i.at,r=i.from}return r+(t-n)*e.speed}function Rn(e,t){for(let n=e.stretches.length-1;n>=0;n--){let r=e.stretches[n];if(r&&t>=r.at&&t<r.at+r.dur)return r.from+(t-r.at)}}function zn(e,t){let n=10**(fn(e.duck,t)/20);return e.fadeIn>0&&t-e.start<e.fadeIn&&(n*=Math.max(0,t-e.start)/e.fadeIn),e.fadeOut>0&&e.end-t<e.fadeOut&&(n*=Math.max(0,e.end-t)/e.fadeOut),Math.max(0,n)}function Bn(e){let t=new Set((e.index??[]).filter(e=>e.matte===!0).map(e=>e.file));return e.parts.flatMap(n=>{let r=(e.footage??[]).find(e=>e.part===n.key&&t.has(e.file));return r?[{part:n.key,file:r.file}]:[]})}var Vn=48,Hn=20,Un=`allyhub.video.volume`;function Wn(){try{let e=JSON.parse(localStorage.getItem(Un)??`null`);if(typeof e==`object`&&e&&`level`in e&&typeof e.level==`number`&&`muted`in e&&typeof e.muted==`boolean`)return{level:Math.min(1,Math.max(0,e.level)),muted:e.muted}}catch{}return{level:1,muted:!1}}var Gn=e=>e.muted?0:e.level,Kn=1e3,qn=20,Jn=1500,Yn=15e3,Xn=1500,Zn=300,Qn=e=>({timeline:e.timeline,texts:e.text,uncut:Bn(e.timeline)});function $n({item:e,version:t,revision:n,width:r,height:c,start:l,overlay:f,onLoaded:p,onError:g,onState:_,timelineOpen:v,onTimelineOpen:y,ref:b}){let x=Y(),S=u(),C=(0,K.useRef)(null),w=(0,K.useRef)(new Map),[T,E]=(0,K.useState)(),[D,O]=(0,K.useState)(),[k,A]=(0,K.useState)(),[ee,te]=(0,K.useState)(),[ne,j]=(0,K.useState)(),[re,ie]=(0,K.useState)(!1),[ae,oe]=(0,K.useState)(),se=s(ae),[M,N]=(0,K.useState)({t:l?.t??0,part:void 0,playing:!1}),[P,ce]=(0,K.useState)(Wn),F=(0,K.useRef)(P),[le,ue]=(0,K.useState)(0),[de,fe]=(0,K.useState)(),pe=(0,K.useRef)(1),me=(0,K.useRef)(void 0),ge=(0,K.useRef)(!1),I=(0,K.useCallback)(e=>{let t=pt(e);me.current!==t.t&&(me.current=t.t,S[`editor/place`]({place:t}).catch(()=>void 0))},[S]),L=(0,K.useRef)({shown:T,pending:D,play:M,view:ee,onLoaded:p,onError:g,onState:_});(0,K.useEffect)(()=>{L.current={shown:T,pending:D,play:M,view:ee,onLoaded:p,onError:g,onState:_}});let _e=e=>e===void 0?void 0:C.current?.querySelector(`iframe[data-frame="${String(e.id)}"]`)?.contentWindow,R=e=>{Z(_e(L.current.shown),e)};(0,K.useImperativeHandle)(b,()=>({seek:e=>{R({type:`seek`,t:e}),I(e)},play:()=>{R({type:`play`})},pause:()=>{R({type:`pause`})},objects:e=>new Promise(t=>{let n=setTimeout(()=>{w.current.delete(e),t(void 0)},Xn);w.current.set(e,e=>{clearTimeout(n),t(e)}),R({type:`objects`,t:e})})}));let z=n=>nt(S,`video/stage`,{item:e,version:t,start:n,chrome:!1}).then(e=>(oe(e.probe),e.url)),ve=`${e}\n${t}`,B=(0,K.useRef)(e);(0,K.useEffect)(()=>{let{shown:t,play:n}=L.current,r=B.current===e;B.current=e;let i={t:0},a=t?r?{t:n.t}:i:l??i,o=!0;return z(a).then(e=>{o&&(E({id:pe.current++,src:e}),O(void 0),A(void 0),j(void 0))},e=>{if(!o)return;let t=e instanceof Error?e.message:String(e);j(t),L.current.onError?.(t)}),()=>{o=!1}},[ve]);let ye=(0,K.useRef)(n);(0,K.useEffect)(()=>{if(n===ye.current)return;ye.current=n;let{shown:e,play:t,view:r}=L.current;if(!e)return;let i=r?.timeline.parts.find(e=>t.t>=e.start&&t.t<e.end),a=i?{t:t.t,part:i.key,offset:t.t-i.start,dur:i.end-i.start}:{t:t.t},o=!0;return z(a).then(e=>{o&&O({id:pe.current++,src:e,from:t.t})},e=>{o&&L.current.onError?.(e instanceof Error?e.message:String(e))}),()=>{o=!1}},[n]),(0,K.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>{A(void 0)},Zn);return()=>{clearTimeout(e)}},[k]),(0,K.useEffect)(()=>{if(!D)return;let e=setTimeout(()=>{O(void 0),L.current.onError?.(`The stage did not draw within ${String(Yn)} ms.`)},Yn);return()=>{clearTimeout(e)}},[D]),(0,K.useEffect)(()=>{let e=e=>{let t=Nn(e.data);if(!t)return;let{shown:n,pending:r}=L.current,i=[n,r].find(t=>t!==void 0&&_e(t)===e.source);if(!i)return;let a=i.id===r?.id;if(t.type===`objects`){if(a)return;w.current.get(t.t)?.(t),w.current.delete(t.t);let n=L.current.play.t;Math.abs(t.t-n)>1e-6&&Z(e.source,{type:`seek`,t:n})}else if(t.type===`sound`)i.denoising=t.denoising,a||ie(t.denoising);else if(t.type===`loaded`){Z(e.source,{type:`volume`,level:Gn(F.current)});let n={kind:t.kind,timeline:t.timeline,text:t.text,reads:t.reads,problems:t.problems,mix:t.mix};if(a){i.loaded=n;return}te(Qn(n)),j(void 0),L.current.onLoaded?.(n)}else if(t.type===`error`)a?O(void 0):j(t.message),L.current.onError?.(t.message);else if(t.type===`time`){if(a){if(!i.loaded)return;A(n&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?n:void 0),E(i),O(void 0),ue(e=>e+1),ie(i.denoising===!0),te(Qn(i.loaded)),j(void 0),L.current.onLoaded?.(i.loaded);let t=L.current.play.t;if(i.from!==void 0&&Math.abs(t-i.from)>1e-6){Z(e.source,{type:`seek`,t});return}}let r={t:t.t,part:t.part,playing:t.playing};r.playing&&ge.current||I(r.t),ge.current=r.playing,fe(i.id),N(r),L.current.onState?.(r)}};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[I]);let V=ee?.timeline,[be,xe]=V?[V.width,V.height]:[r,c],Se=ee?.uncut.find(e=>e.part===M.part);(0,K.useEffect)(()=>{F.current=P,R({type:`volume`,level:Gn(P)});try{localStorage.setItem(Un,JSON.stringify(P))}catch{}},[P]);let we=M.playing;(0,K.useEffect)(()=>{if(V===void 0)return;let e=1/V.fps,t=Math.max(0,V.duration-e),n=e=>{let n=Math.min(Math.max(Xe(e,V.fps),0),t);Z(_e(L.current.shown),{type:`seek`,t:n}),I(n)},r=r=>{if(r.metaKey||r.ctrlKey||r.altKey||r.defaultPrevented)return;let i=r.target;if(i instanceof HTMLElement&&(i.isContentEditable||i.closest(`input,textarea,select,button,a,[role=slider],[role=menuitem],[role=dialog]`)))return;let a=L.current.play.t,o=r.key.length===1?r.key.toLowerCase():r.key;if(o===` `||o===`k`)Z(_e(L.current.shown),{type:we?`pause`:`play`});else if(o===`ArrowLeft`)n(a-e);else if(o===`ArrowRight`)n(a+e);else if(o===`Home`)n(0);else if(o===`End`)n(t);else if(o===`m`)ce(e=>({...e,muted:!e.muted}));else return;r.preventDefault()};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r)}},[we,V,I]);let Te=e=>{R({type:`seek`,t:e}),I(e)},Ee=(e,t)=>(0,q.jsx)(`iframe`,{"data-frame":e.id,src:e.src,title:x.previewTitle,...se?{sandbox:`allow-scripts`}:{},allow:`autoplay`,"data-testid":t===`shown`?`stage`:t===`pending`?`stage-pending`:`stage-leaving`,className:m(`absolute -inset-0.5 size-[calc(100%+4px)] border-0`,t===`pending`&&`pointer-events-none opacity-0`,t===`leaving`&&`ak-stage-leaving pointer-events-none z-[1]`)},e.id),De=V?`bg-background`:`bg-black`,Oe=()=>{let e=C.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0},ke=he()!==void 0,Ae=(0,K.useRef)(null),je=i()?.item.entry,Me=e=>{let t=e.piece??je;return{name:Mn(e,`part`),...t===void 0?{}:{source:{path:t}},...e.text===void 0?{}:{text:e.text}}},H=()=>{let{t:e,part:t}=L.current.play;return`on the picture at ${e.toFixed(2)} s${t===void 0?``:`, in the part ${t}`}`},Ne=e=>({element:Me(e),outline:e.outline,where:H()}),Pe=e=>{let t=Oe();return t?Fn(_e(L.current.shown),t,e,Jn):Promise.resolve(void 0)},U=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`absolute inset-0 isolate`,children:[k&&se!==void 0?Ee(k,`leaving`):null,T&&se!==void 0?Ee(T,`shown`):null,D&&se!==void 0?Ee(D,`pending`):null]}),ke&&T&&V&&!M.playing&&M.t>=.05?(0,q.jsx)(jn,{ref:Ae,moment:`${String(T.id)}@${M.t.toFixed(4)}`,box:Oe,pick:Pe,label:x.previewTitle}):null,V||ne!==void 0?null:(0,q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,q.jsx)(Ce,{label:x.loading,className:`[&>span]:bg-on-media/80`})}),re?(0,q.jsx)(`span`,{className:`bg-background/90 text-muted-foreground absolute top-2 right-2 rounded-sm px-2 py-0.5 font-mono text-micro`,"data-testid":`denoising`,children:x.denoising}):null,V?(0,q.jsx)(`span`,{"aria-hidden":!0,"data-testid":`play-affordance`,"data-shown":!M.playing&&M.t<.05?``:void 0,className:`bg-foreground/92 text-background pointer-events-none absolute top-1/2 left-1/2 flex size-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-md opacity-0 transition-opacity data-[shown]:opacity-100`,children:(0,q.jsx)(G,{className:`size-6 translate-x-px fill-current`})}):null,Se?(0,q.jsx)(`span`,{className:`bg-background/90 text-muted-foreground absolute top-2 left-2 max-w-[calc(100%-1rem)] rounded-sm px-2 py-0.5 font-mono text-micro`,"data-testid":`uncut`,children:x.uncut(Se.file)}):null,f]}),Fe=de!==void 0&&de===T?.id,Ie=async()=>{R({type:`pause`});let e=Date.now()+Kn;for(;L.current.play.playing&&Date.now()<e;)await new Promise(e=>{setTimeout(e,qn)})};o({hold:async()=>{await Ie();let{t:n,part:r}=L.current.play;return{key:`${e}@${t}@${n.toFixed(3)}@${String(L.current.shown?.id??0)}`,what:`The video ${e}, version ${t}, at ${n.toFixed(2)} s${r===void 0?``:`, in the part ${r}`}`,...je===void 0?{}:{source:{path:je}}}},locate:e=>{let t=Oe(),n=d(e)[0],r=t!==void 0&&n!==void 0&&n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height,i=[...document.querySelectorAll(`[data-row]`)].filter(t=>h(e,t.getBoundingClientRect())).map(e=>({name:`the ${e.dataset.row??``} row of the timeline`}));return Promise.resolve({elements:i,...r?{}:{where:`on the timeline`}})},selected:()=>{let e=Ae.current?.selected();return Promise.resolve(e?[Ne(e)]:[])}}),a({element:()=>T?C.current:void 0,pictures:async()=>{let n=Oe();if(!n)return[];let r=await nt(S,`video/still`,{item:e,version:t,t:L.current.play.t}).catch(()=>void 0);return r?[{rect:n,mime:r.image.mime,data:r.image.data}]:[]},locate:async e=>{let t=Oe(),{t:n,part:r}=L.current.play;return{elements:(t?await Pn(_e(L.current.shown),t,e,Jn):[]).map(Me),where:`on the picture at ${n.toFixed(2)} s${r===void 0?``:`, in the part ${r}`}`}},pick:async e=>{let t=await Pe(e);return t?Ne(t):void 0}});let Le=!v,Re=Vn+(Le?Hn:0)+3,ze=`min(100cqw - 2px, (100cqh - ${String(Re)}px) * ${String(be/xe)})`;return(0,q.jsx)(`div`,{className:`flex h-full min-h-0 flex-col gap-2`,"data-testid":`video-preview`,"data-t":M.t.toFixed(4),"data-ready":Fe?``:void 0,"data-swaps":le,children:(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center [container-type:size]`,children:(0,q.jsxs)(`div`,{className:`box-content overflow-hidden rounded-md border border-ink/20`,style:{width:ze},"data-testid":`player`,children:[(0,q.jsx)(`div`,{ref:C,className:m(`relative mx-auto overflow-hidden`,De),style:{width:ze,height:`calc(${ze} * ${String(xe/be)})`},children:U}),V?(0,q.jsx)(tr,{timeline:V,state:M,folded:Le,volume:P,onVolume:ce,onOpen:y,onToggle:()=>{R({type:M.playing?`pause`:`play`})},onSeek:Te}):(0,q.jsx)(`div`,{className:`border-t`,style:{height:Re-3}})]})})})}var er=2;function tr({timeline:e,state:t,folded:n,volume:r,onVolume:i,onOpen:a,onToggle:o,onSeek:s}){let c=Y(),{duration:l,fps:u}=e,d=Math.max(0,l-1/u),f=e=>{s(Math.min(Math.max(Xe(e,u),0),d))},p=(e,t,n,r,i)=>(0,q.jsx)(g,{size:`icon-sm`,variant:`ghost`,className:m(`text-muted-foreground`,i.className),"aria-label":e,title:c.withKey(e,t),"data-testid":i.testid,onClick:r,children:n});return(0,q.jsxs)(`div`,{className:`border-t [container-type:inline-size]`,"data-testid":`transport`,children:[n?(0,q.jsx)(`div`,{className:`px-3 pt-1`,style:{height:Hn},children:(0,q.jsx)(rr,{timeline:e,state:t,onSeek:s})}):null,(0,q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_1fr] items-center gap-2 px-3`,style:{height:Vn},children:[(0,q.jsxs)(`span`,{className:`min-w-0 justify-self-start truncate font-mono text-xs tabular-nums`,"data-testid":`clock`,children:[J(Math.min(t.t,l)),(0,q.jsxs)(`span`,{className:`text-muted-foreground @max-[18rem]:hidden`,children:[` / `,J(l)]})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[p(c.toStart,c.keys.home,(0,q.jsx)(He,{}),()=>{f(0)},{testid:`to-start`,className:`@max-[22rem]:hidden`}),p(c.frameBack,`←`,(0,q.jsx)(Ue,{}),()=>{f(t.t-1/u)},{testid:`frame-back`,className:`@max-[22rem]:hidden`}),(0,q.jsx)(g,{size:`icon`,className:`mx-1 rounded-full`,"aria-label":t.playing?c.pause:c.play,title:c.withKey(t.playing?c.pause:c.play,c.keys.space),"data-testid":`play`,onClick:o,children:t.playing?(0,q.jsx)(W,{className:`fill-current`}):(0,q.jsx)(G,{className:`translate-x-px fill-current`})}),p(c.frameForward,`→`,(0,q.jsx)(We,{}),()=>{f(t.t+1/u)},{testid:`frame-forward`,className:`@max-[22rem]:hidden`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5 justify-self-end`,children:[(0,q.jsx)(nr,{volume:r,onVolume:i}),n?(0,q.jsx)(g,{size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground -mr-1`,"aria-label":c.showTimeline,title:c.showTimeline,"aria-expanded":!1,"data-testid":`timeline-toggle`,onClick:()=>{a(!0)},children:(0,q.jsx)(N,{})}):null]})]})]})}function nr({volume:e,onVolume:t}){let n=Y(),r=Gn(e),i=r===0?qe:r<.5?Ke:Ge,a=e.muted?n.unmute:n.mute;return(0,q.jsxs)(`div`,{className:`group/volume flex items-center`,"data-testid":`volume`,children:[(0,q.jsx)(`input`,{type:`range`,min:0,max:100,step:1,value:Math.round(r*100),"aria-label":n.volume,"data-testid":`volume-slider`,className:`accent-foreground h-1 w-0 cursor-pointer opacity-0 group-focus-within/volume:mr-1 group-focus-within/volume:w-20 group-focus-within/volume:opacity-100 group-hover/volume:mr-1 group-hover/volume:w-20 group-hover/volume:opacity-100 motion-safe:transition-[width,opacity,margin] motion-safe:duration-150`,onChange:e=>{let n=Number(e.currentTarget.value)/100;t({level:n,muted:n===0})}}),(0,q.jsx)(g,{size:`icon-sm`,variant:`ghost`,className:`text-muted-foreground`,"aria-label":a,title:n.withKey(a,`M`),"aria-pressed":e.muted,"data-testid":`mute`,onClick:()=>{t(e.muted&&e.level===0?{level:1,muted:!1}:{...e,muted:!e.muted})},children:(0,q.jsx)(i,{})})]})}function rr({timeline:e,state:t,onSeek:n}){let r=Y(),{duration:i,fps:a}=e,o=Math.max(0,i-1/a),s=e.parts.length?e.parts.map((e,t)=>({key:e.key,name:e.title??String(t+1),start:e.start,end:e.end})):[{key:``,name:``,start:0,end:i}],c=(s.length-1)*er,[l,u]=(0,K.useState)(),[d,f]=(0,K.useState)(),p=Math.min(l??t.t,i),m=e=>Math.max(0,s.findIndex((t,n)=>n===s.length-1||e<t.end)),h=s[m(p)],g=e=>{let t=e.currentTarget.getBoundingClientRect(),n=Math.min(t.width,Math.max(0,e.clientX-t.left)),r=Math.max(1,t.width-c),l=0,u=i;for(let e of s){let t=r*(e.end-e.start)/Math.max(i,1e-6);if(n<=l+t+er/2){let r=Math.min(1,Math.max(0,(n-l)/Math.max(t,1)));u=e.start+r*(e.end-e.start);break}l+=t+er}return{x:n,t:Math.min(Math.max(Xe(u,a),0),o)}},_=e=>{n(Math.min(Math.max(Xe(e,a),0),o))},v=d?s[m(d.t)]?.name:void 0;return(0,q.jsxs)(`div`,{role:`slider`,tabIndex:0,"aria-label":r.seek,"aria-valuemin":0,"aria-valuemax":Math.round(i*100)/100,"aria-valuenow":Math.round(p*100)/100,"aria-valuetext":r.timeOf(J(p),J(i),h?.name??``),"data-testid":`scrubber`,className:`group/scrub focus-visible:outline-ring relative h-6 min-w-0 flex-1 cursor-pointer touch-none rounded-sm outline-none focus-visible:outline-1 focus-visible:outline-solid focus-visible:-outline-offset-1`,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId);let t=g(e);u(t.t),f(t),n(t.t)},onPointerMove:e=>{let t=g(e);f(t),l!==void 0&&t.t!==l&&(u(t.t),n(t.t))},onPointerUp:()=>{u(void 0)},onPointerCancel:()=>{u(void 0)},onPointerLeave:()=>{f(void 0)},onKeyDown:e=>{if(e.key===`ArrowLeft`)_(t.t-1);else if(e.key===`ArrowRight`)_(t.t+1);else if(e.key===`Home`)_(0);else if(e.key===`End`)_(o);else return;e.preventDefault()},children:[(0,q.jsx)(`div`,{className:`absolute inset-x-0 top-1/2 flex h-1 -translate-y-1/2 transition-[height] duration-100 group-hover/scrub:h-1.5`,style:{gap:er},children:s.map(e=>{let t=Math.max(e.end-e.start,1e-6),n=Math.min(1,Math.max(0,(p-e.start)/t));return(0,q.jsx)(`span`,{"data-chapter":e.key,className:`bg-rule-strong relative min-w-0 overflow-hidden`,style:{flexGrow:t,flexBasis:0},children:(0,q.jsx)(`span`,{className:`bg-foreground absolute inset-y-0 left-0`,style:{width:`${String(n*100)}%`}})},e.key)})}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`bg-foreground ring-background pointer-events-none absolute top-1/2 h-3 w-[3px] -translate-x-1/2 -translate-y-1/2 ring-1`,style:{left:`calc((100% - ${String(c)}px) * ${String(p/Math.max(i,1e-6))} + ${String(m(p)*er)}px)`}}),d?(0,q.jsxs)(`span`,{role:`tooltip`,"data-testid":`scrub-tip`,className:`bg-popover text-popover-foreground shadow-overlay pointer-events-none absolute bottom-full z-10 mb-1.5 flex max-w-[16rem] -translate-x-1/2 items-baseline gap-2 rounded-sm px-2 py-1 whitespace-nowrap`,style:{left:d.x},children:[v?(0,q.jsx)(`span`,{className:`truncate font-serif text-dense`,children:v}):null,(0,q.jsx)(`span`,{className:`text-muted-foreground font-mono text-micro tabular-nums`,children:J(d.t)})]}):null]})}function ir(e){let t=(0,K.useRef)(void 0),n=t=>Math.round(Math.max(e.min,Math.min(e.max,t))),r=e.orientation===`vertical`,i=e.after===!0?-1:1,a=e=>r?e.clientX:e.clientY,[o,s]=r?[`ArrowLeft`,`ArrowRight`]:[`ArrowUp`,`ArrowDown`];return(0,q.jsx)(`div`,{role:`separator`,"aria-orientation":e.orientation,"aria-label":e.label,"aria-valuenow":e.value,"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,"data-testid":e.testid,className:r?`group relative z-30 w-px shrink-0 cursor-col-resize bg-border outline-none before:absolute before:inset-y-0 before:-inset-x-1.5 before:content-['']`:`group relative z-30 h-px shrink-0 cursor-row-resize bg-border outline-none before:absolute before:-inset-y-1.5 before:inset-x-0 before:content-['']`,onPointerDown:n=>{t.current={at:a(n),value:e.value},n.currentTarget.setPointerCapture(n.pointerId)},onPointerMove:r=>{let o=t.current;o&&e.onChange(n(o.value+i*(a(r)-o.at)))},onPointerUp:()=>{t.current=void 0},onKeyDown:t=>{let r=(t.shiftKey?40:8)*i;if(t.key===s)e.onChange(n(e.value+r));else if(t.key===o)e.onChange(n(e.value-r));else return;t.preventDefault()},children:(0,q.jsx)(`span`,{"aria-hidden":!0,className:`group-hover:bg-rule-strong group-focus-visible:bg-pencil pointer-events-none absolute inset-0`})})}function ar(e,t,n,r=4){let i=e.map(({x:e,width:n},r)=>{let i=e+n>t&&e-n>=0?`before`:`after`;return i===`after`?{i:r,side:i,from:e,to:e+n}:{i:r,side:i,from:e-n,to:e}}),a=[],o=e.map(()=>null);for(let e of[...i].sort((e,t)=>e.from-t.from||e.i-t.i)){let t=0;for(;t<n&&(a[t]??-1/0)+r>e.from;)t++;t!==n&&(a[t]=e.to,o[e.i]={lane:t,side:e.side})}return o}var or=.01,sr=new Map;async function cr(e){try{let t=await fetch(e);if(!t.ok)return;let n=await t.arrayBuffer(),r=await new OfflineAudioContext(1,1,44100).decodeAudioData(n),i=r.sampleRate/50,a=Math.ceil(r.length/i),o=new Float32Array(a),s=0;for(let e=0;e<r.numberOfChannels;e++){let t=r.getChannelData(e);for(let e=0;e<a;e++){let n=Math.min(t.length,Math.floor((e+1)*i)),r=o[e]??0;for(let a=Math.floor(e*i);a<n;a++){let e=Math.abs(t[a]??0);e>r&&(r=e)}o[e]=r,r>s&&(s=r)}}if(s<or)return;let c=Float32Array.from(o).sort(),l=c[Math.floor(c.length*.95)]??s;return{duration:r.duration,data:o,max:l>0?l:s}}catch{return}}function lr(e){let t=sr.get(e);return t||(t=cr(e),sr.set(e,t)),t}function ur(e){let[t,n]=(0,K.useState)();(0,K.useEffect)(()=>{if(e===void 0)return;let t=!0;return lr(e).then(r=>{t&&n({url:e,peaks:r})}),()=>{t=!1}},[e]);let r=t?.url===e?t:void 0;return{peaks:r?.peaks,settled:e===void 0||r!==void 0}}function dr(e,t,n){let r=Math.max(0,Math.floor(t*50)),i=Math.min(e.data.length,Math.max(r+1,Math.ceil(n*50))),a=0;for(let t=r;t<i;t++){let n=e.data[t]??0;n>a&&(a=n)}return a}var fr={scenes:`text-track-scene`,voice:`text-track-voice`,music:`text-track-music`,sound:`text-track-sound`},Q={ruler:28,scenes:36,voice:40,music:32,sound:28},pr={parts:[],music:!1,cues:[],listening:!1,round:0};function mr(e){return Q.ruler+1+Q.scenes+1+e.reduce((e,t)=>e+Q[t]+1,0)}var hr=6;function gr(e,t){let n=e=>e.join(` `).replace(/\s+([.,!?;:。,!?;:、])/g,`$1`).trim(),[r,...i]=e;if(r===t&&i.length>0){let e=n(i);if(/^[^a-z]/.test(e))return e}return n(e)}function _r(e){return e<=60?{minor:1,major:5}:e<=180?{minor:1,major:10}:e<=600?{minor:5,major:30}:e<=1800?{minor:10,major:60}:{minor:60,major:300}}var $=(e,t)=>`${String(e/Math.max(t,1e-6)*100)}%`;function vr({title:e,mono:t=!1,time:n,line:r,children:i}){return(0,q.jsxs)(z,{children:[(0,q.jsx)(R,{asChild:!0,children:i}),(0,q.jsx)(_e,{side:`top`,sideOffset:6,className:`max-w-[20rem]`,children:(0,q.jsxs)(`span`,{className:`flex flex-col gap-0.5 text-left`,children:[(0,q.jsx)(`span`,{className:m(t&&`font-mono text-micro`),children:e}),(0,q.jsx)(`span`,{className:`font-mono text-micro tabular-nums opacity-70`,children:n}),r?(0,q.jsx)(`span`,{className:`opacity-80`,children:r}):null]})})]})}function yr(e){let t=u(),[n,r]=(0,K.useState)();return(0,K.useEffect)(()=>{let n=!0;return ut(t,e).then(t=>{n&&r({file:e,url:t})}),()=>{n=!1}},[t,e]),n?.file===e?n.url:void 0}function br({file:e,from:t,to:n,sample:r,alpha:i,className:a}){let o=(0,K.useRef)(null),{peaks:s,settled:c}=ur(yr(e)),[l,u]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{let e=o.current;if(!e||!s)return;let a=()=>{let a=window.devicePixelRatio||1,o=Math.round(e.clientWidth*a),c=Math.round(e.clientHeight*a);if(!o||!c)return;e.width=o,e.height=c;let l=e.getContext(`2d`);if(!l)return;l.fillStyle=getComputedStyle(e).color,l.globalAlpha=i;let d=1/Math.max(s.max,.05),f=n-t,p=c-2*Math.round(2*a);for(let e=0;e<o;e+=2){let n=r(t+e/o*f);if(!n)continue;let i=dr(s,n.at,n.at+2/o*f)*d*n.gain,a=Math.max(1,Math.round(Math.min(1,i)**xr*p));l.fillRect(e,Math.round((c-a)/2),1,a)}u(!0)};a();let c=new ResizeObserver(a);c.observe(e);let l=new MutationObserver(a);return l.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>{c.disconnect(),l.disconnect()}},[s,t,n,r,i]),(0,q.jsx)(`canvas`,{ref:o,"aria-hidden":!0,"data-wave":l?`ready`:c?`none`:`pending`,className:m(`pointer-events-none absolute inset-0 size-full opacity-0 transition-opacity data-[wave=ready]:opacity-100`,a)})}var xr=.7,Sr=`focus-visible:outline-ring absolute inset-y-1 overflow-hidden rounded-xs border focus-visible:outline-1 focus-visible:outline-solid focus-visible:-outline-offset-1`;function Cr({line:e,duration:t,onSeek:n}){let r=(0,K.useCallback)(t=>{let n=Ln(e,t);return n===void 0?void 0:{at:n,gain:1}},[e]);return(0,q.jsx)(vr,{title:e.text,time:`${Ye(e.start)} – ${Ye(e.end)} · ${Ze(e.file)}`,children:(0,q.jsxs)(`button`,{type:`button`,"data-sentence":e.key??e.part,"data-start":e.start.toFixed(4),className:m(Sr,`bg-track-voice/15 border-track-voice/60 hover:bg-track-voice/25 text-left`),style:{left:$(e.start,t),width:$(e.end-e.start,t)},onPointerDown:e=>{e.stopPropagation()},onClick:()=>{n(e.start)},children:[(0,q.jsx)(`span`,{className:`absolute inset-x-1.5 top-0 block h-[14px] truncate text-micro leading-[14px]`,children:e.text}),(0,q.jsx)(`span`,{className:`absolute inset-x-0 top-[14px] bottom-0`,children:(0,q.jsx)(br,{file:e.file,from:e.start,to:e.end,sample:r,alpha:.7,className:`text-track-voice`})})]})})}var wr=2,Tr=.75;function Er({parts:e,duration:t}){let n=(0,K.useRef)(null),r=(0,K.useRef)(new Map),[i,a]=(0,K.useState)(0),[o,s]=(0,K.useState)(()=>new Map),c=e.flatMap(e=>(e.anchors??[]).map(t=>({id:`${e.key}@${t.name}`,part:e.key,anchor:t}))),l=c.map(e=>e.id).join(`
23
- `);(0,K.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{a(e.clientWidth);let t=new Map;for(let[e,n]of r.current)t.set(e,n.offsetWidth);s(e=>e.size===t.size&&[...t].every(([t,n])=>e.get(t)===n)?e:t)};t();let i=new ResizeObserver(t);i.observe(e);for(let e of r.current.values())i.observe(e);return()=>{i.disconnect()}},[l]);let u=ar(c.map(e=>({x:e.anchor.at/Math.max(t,1e-6)*i,width:o.get(e.id)??0})),i,wr);return(0,q.jsx)(`div`,{ref:n,className:`pointer-events-none absolute inset-0`,children:c.map((e,n)=>(0,q.jsx)(Dr,{part:e.part,anchor:e.anchor,duration:t,place:u[n]??null,nameRef:t=>(r.current.set(e.id,t),()=>{r.current.delete(e.id)})},e.id))})}function Dr({part:e,anchor:t,duration:n,place:r,nameRef:i}){let{at:a,end:o}=t,s=(a,o)=>(0,q.jsx)(`span`,{"data-anchor":`${e}:${t.name}${a?`:end`:``}`,"data-time":o.toFixed(4),title:t.name,className:`before:bg-foreground/70 absolute inset-y-0 z-10 -ml-1 w-2 before:absolute before:inset-y-0 before:left-1/2 before:w-px`,style:{left:$(o,n)},children:!a&&(0,q.jsx)(`span`,{ref:i,"data-anchor-lane":r?String(r.lane):void 0,className:m(`bg-sheet text-muted-foreground absolute rounded-xs px-0.5 font-mono text-micro leading-3 whitespace-nowrap`,r?.side===`before`?`right-1/2 mr-px`:`left-1/2 ml-px`,!r&&`invisible`),style:{bottom:`${String((r?.lane??0)*Tr)}rem`},children:t.name})},a?`end`:`at`);return(0,q.jsxs)(q.Fragment,{children:[o!==void 0&&o>a&&(0,q.jsx)(`span`,{className:`bg-foreground/50 pointer-events-none absolute bottom-0 z-10 h-px`,style:{left:$(a,n),width:$(o-a,n)}}),s(!1,a),o!==void 0&&s(!0,o)]})}function Or({music:e,duration:t,ducked:n}){let{start:r,end:i}=e,a=(0,K.useCallback)(t=>{let n=Rn(e,t);return n===void 0?void 0:{at:n,gain:zn(e,t)}},[e]),o=Ze(e.file);return(0,q.jsx)(vr,{mono:!0,title:o,time:`${Ye(r)} – ${Ye(i)}`,line:e.ducked.length?n:void 0,children:(0,q.jsxs)(`div`,{"data-music":o,className:m(Sr,`bg-track-music/15 border-track-music/60`),style:{left:$(r,t),width:$(i-r,t)},children:[(0,q.jsx)(br,{file:e.file,from:r,to:i,sample:a,alpha:.6,className:`text-track-music`}),(0,q.jsx)(`span`,{className:`bg-background/85 text-foreground absolute top-1/2 left-1.5 -translate-y-1/2 rounded-xs px-1 font-mono text-micro leading-[14px]`,children:o})]})})}var kr=(0,K.memo)(function({timeline:e,texts:t,tracks:n,rows:r,current:i,second:a,marks:o,onSeek:s}){let c=Y(),{duration:l,parts:u}=e,d=e=>(0,q.jsx)(`span`,{className:`text-muted-foreground bg-sheet pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 px-1 text-xs leading-4`,children:e}),f=n.speech,p=n.music?[n.music]:[],h=n.cues,g=e=>u.find(t=>t.key===e)?.title??e;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`relative border-t`,style:{height:Q.scenes+1},"data-row":`scenes`,children:[u.map((e,n)=>{let r=e.key===i,o=e.title??e.key,c=t.find(t=>t.key===e.key),u=c?.spoken??gr(c?.onScreen??[],o),d=(e.end-e.start)*a<56;return(0,q.jsx)(vr,{title:(0,q.jsx)(`span`,{className:`font-serif text-dense`,children:o}),time:`${Ye(e.start)} – ${Ye(e.end)}`,line:u||void 0,children:(0,q.jsxs)(`button`,{type:`button`,"data-chapter":e.key,"data-start":e.start.toFixed(4),"aria-current":r?`true`:void 0,className:m(Sr,`flex items-center gap-1.5 px-2 text-left transition-colors`,r?`bg-track-scene/25 border-track-scene`:`bg-track-scene/10 border-track-scene/45 hover:bg-track-scene/20`),style:{left:$(e.start,l),width:`calc(${$(e.end-e.start,l)} - 1px)`},onPointerDown:e=>{e.stopPropagation()},onClick:()=>{s(e.start)},children:[(0,q.jsx)(`span`,{className:m(`font-mono text-micro tabular-nums`,r?`text-foreground/70`:`text-muted-foreground`),children:String(n+1)}),d?null:(0,q.jsx)(`span`,{className:m(`min-w-0 truncate font-serif text-xs`,r?`font-semibold`:`text-foreground/80`),children:o})]})},e.key)}),u.filter(e=>o.parts.includes(e.key)).map(e=>(0,q.jsx)(`span`,{"aria-hidden":!0,"data-testid":`agent-changed`,"data-part":e.key,className:`ak-agent-wash bg-agent/25 outline-agent pointer-events-none absolute inset-y-1 rounded-xs outline-2`,style:{left:$(e.start,l),width:`calc(${$(e.end-e.start,l)} - 1px)`}},`${String(o.round)}:${e.key}`))]}),r.includes(`voice`)?(0,q.jsxs)(`div`,{className:`relative border-t`,style:{height:Q.voice+1},"data-row":`voice`,children:[f.length>0?f.map(e=>(0,q.jsx)(Cr,{line:e,duration:l,onSeek:s},`${e.part}@${String(e.start)}`)):d(c.noVoice),(0,q.jsx)(Er,{parts:u,duration:l})]}):null,r.includes(`music`)?(0,q.jsxs)(`div`,{className:`relative border-t`,style:{height:Q.music+1},"data-row":`music`,children:[p.length?p.map(e=>(0,q.jsx)(Or,{music:e,duration:l,ducked:c.ducked},`${e.file}@${String(e.start)}`)):d(c.noMusic),o.music?p.map(e=>(0,q.jsx)(`span`,{"aria-hidden":!0,"data-testid":`agent-music`,className:`outline-agent pointer-events-none absolute inset-y-1 rounded-xs outline-2`,style:{left:$(e.start,l),width:$(e.end-e.start,l)}},`${e.file}@${String(e.start)}`)):null]}):null,r.includes(`sound`)?(0,q.jsxs)(`div`,{className:`relative border-t`,style:{height:Q.sound+1},"data-row":`sound`,children:[(0,q.jsx)(`span`,{className:`bg-rule-strong absolute inset-x-0 top-1/2 h-px`}),h.length?h.map((e,t)=>(0,q.jsx)(vr,{mono:!0,title:e.sound,time:`${Ye(e.t)} · ${g(e.part)}`,line:e.what,children:(0,q.jsx)(`span`,{"data-cue":e.sound,"data-agent":o.cues.includes(e.part)?``:void 0,className:`absolute top-1/2 block size-[7px] -translate-y-1/2`,style:{left:$(e.t,l)},children:(0,q.jsx)(`span`,{className:m(`block size-full rotate-45`,o.cues.includes(e.part)?`bg-agent`:`bg-track-sound`,e.t*a<5?`translate-x-[2px]`:`-translate-x-1/2`)})})},`${e.sound}@${String(e.t)}#${String(t)}`)):d(c.noCues)]}):null]})});function Ar({timeline:e,texts:t,tracks:n,rows:r,state:i,agent:a,marks:o=pr,transport:s,onSeek:c}){let l=Y(),{duration:u,fps:d,parts:f}=e,p=Math.max(0,u-1/d),h=(0,K.useRef)(null),_=(0,K.useRef)(null),[v,y]=(0,K.useState)(0),[b,x]=(0,K.useState)(!1),[S,C]=(0,K.useState)();(0,K.useLayoutEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{y(e.clientWidth)};t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[]);let w=v>0&&v/u<hr,T=w?Math.ceil(u*hr):v,E=T/Math.max(u,1e-6),{t:D,playing:O}=i;(0,K.useEffect)(()=>{let e=_.current;if(!e)return;let t=t=>{let n=Math.min(Math.max(t,0),u)*E;e.style.transform=`translateX(${String(n)}px)`;let r=h.current;w&&O&&r&&(n<r.scrollLeft+24||n>r.scrollLeft+r.clientWidth-24)&&(r.scrollLeft=Math.max(0,n-r.clientWidth*.2))};if(t(D),!O)return;let n=performance.now(),r=requestAnimationFrame(function e(i){t(Math.min(D+(i-n)/1e3,p)),r=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(r)}},[D,O,E,u,p,w]);let k=e=>{let t=e.currentTarget.getBoundingClientRect(),n=Math.min(t.width,Math.max(0,e.clientX-t.left))/Math.max(t.width,1)*u;return Math.min(Math.max(Xe(n,d),0),p)},A=e=>{c(Math.min(Math.max(Xe(e,d),0),p))},ee=f.find(e=>i.t>=e.start&&i.t<e.end)??f.at(-1),{minor:te,major:ne}=_r(u),j=[];for(let e=0;e<=u+1e-6;e+=te)j.push(e);let re=(e,t)=>(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 overflow-hidden border-t pr-2 pl-3 max-[559px]:justify-center max-[559px]:px-0`,style:{height:Q[e]+1},"data-track":e,children:[(0,q.jsx)(`span`,{role:`img`,"aria-label":l.rows[e],className:m(`shrink-0 [&_svg]:size-3.5`,fr[e]),children:t}),(0,q.jsx)(we,{"aria-hidden":!0,className:`text-micro whitespace-nowrap max-[559px]:hidden`,children:l.rows[e]})]});return(0,q.jsx)(ve,{children:(0,q.jsxs)(`div`,{className:`relative flex`,style:{height:mr(r)},"data-testid":`timeline`,children:[(0,q.jsxs)(`div`,{className:`w-max min-w-20 shrink-0 border-r max-[559px]:w-10 max-[559px]:min-w-10`,children:[s?(0,q.jsx)(`div`,{className:`flex items-center gap-1.5 pr-1 pl-2 max-[559px]:justify-center max-[559px]:px-0`,style:{height:Q.ruler},"data-testid":`timeline-corner`,children:(0,q.jsx)(g,{size:`icon-xs`,variant:`ghost`,className:`text-muted-foreground ml-auto`,"aria-label":l.hideTimeline,title:l.hideTimeline,"aria-expanded":!0,"data-testid":`timeline-toggle`,onClick:s.onFold,children:(0,q.jsx)(M,{})})}):(0,q.jsx)(`div`,{style:{height:Q.ruler}}),re(`scenes`,(0,q.jsx)(Te,{})),r.includes(`voice`)?re(`voice`,(0,q.jsx)(Be,{})):null,r.includes(`music`)?re(`music`,(0,q.jsx)(Ve,{})):null,r.includes(`sound`)?re(`sound`,(0,q.jsx)(ye,{})):null]}),(0,q.jsx)(`div`,{ref:h,className:m(`relative min-w-0 flex-1 overflow-y-hidden border-l border-transparent`,w?`overflow-x-auto`:`overflow-x-hidden`),"data-testid":`tracks`,children:(0,q.jsxs)(`div`,{className:`relative h-full cursor-pointer touch-none`,style:{width:T||`100%`},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),x(!0),c(k(e))},onPointerMove:e=>{let t=k(e);C(t),b&&c(t)},onPointerUp:()=>{x(!1)},onPointerCancel:()=>{x(!1)},onPointerLeave:()=>{C(void 0)},children:[(0,q.jsx)(`div`,{role:`slider`,tabIndex:0,"aria-label":l.seek,"aria-valuemin":0,"aria-valuemax":Math.round(u*100)/100,"aria-valuenow":Math.round(i.t*100)/100,"aria-valuetext":l.timeOf(J(i.t),J(u),ee?.title??``),"data-testid":`scrubber`,className:`focus-visible:outline-ring relative outline-none focus-visible:outline-1 focus-visible:outline-solid focus-visible:-outline-offset-1`,style:{height:Q.ruler},onKeyDown:e=>{if(e.key===`ArrowLeft`)A(i.t-1);else if(e.key===`ArrowRight`)A(i.t+1);else if(e.key===`Home`)A(0);else if(e.key===`End`)A(p);else return;e.preventDefault()},children:j.map(e=>{let t=Math.abs(e/ne-Math.round(e/ne))<1e-6;return(0,q.jsxs)(`span`,{className:`absolute bottom-0`,style:{left:$(e,u)},children:[(0,q.jsx)(`span`,{className:m(`absolute bottom-0 left-0 w-px`,t?`bg-lead-soft h-2`:`bg-rule-strong h-1`)}),t&&(u-e)*E>34?(0,q.jsx)(`span`,{className:`text-muted-foreground absolute bottom-[7px] left-1 font-mono text-micro leading-none tabular-nums`,children:J(e)}):null]},e)})}),(0,q.jsx)(kr,{timeline:e,texts:t,tracks:n,rows:r,current:i.part??ee?.key,second:E,marks:o,onSeek:c}),S===void 0?null:(0,q.jsxs)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 z-10`,style:{transform:`translateX(${String(S*E)}px)`},"data-testid":`hover-guide`,children:[(0,q.jsx)(`span`,{className:`bg-foreground/25 absolute inset-y-0 left-0 w-px`}),(0,q.jsx)(`span`,{className:`bg-popover text-popover-foreground absolute top-0.5 left-1 rounded-xs border px-1 font-mono text-micro leading-[14px] tabular-nums`,children:J(S)})]}),a?.t===void 0?null:(0,q.jsx)(ke,{"aria-hidden":!0,"data-testid":`agent-marker`,className:`z-20`,label:a.label,flag:Math.min(a.t,u)*E>T-140?`before`:`after`,style:{left:Math.min(a.t,u)*E}}),(0,q.jsxs)(`div`,{ref:_,"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 z-20 will-change-transform`,"data-testid":`playhead`,children:[(0,q.jsx)(`span`,{className:`bg-foreground absolute inset-y-0 left-0 w-px`}),(0,q.jsx)(`svg`,{viewBox:`0 0 9 9`,className:`text-foreground absolute top-0 -left-1 size-[9px]`,children:(0,q.jsx)(`path`,{d:`M0 0h9v4L4.5 9 0 4z`,fill:`currentColor`})})]})]})}),a&&o.listening&&r.length>0?(0,q.jsx)(je,{"aria-hidden":!0,"data-testid":`agent-listening`,label:a.label,className:`z-30`,style:{left:0,right:0,top:Q.ruler+1+Q.scenes+1,bottom:0}}):null]})})}var jr=new H(`scriptAgent`),Mr=new Pe({nodes:{doc:{content:`part*`},part:{content:`sentence+`,attrs:{part:{default:``},title:{default:``}},toDOM:e=>[`div`,{"data-part":String(e.attrs.part),class:`ak-script-part`},0]},sentence:{content:`word*`,toDOM:()=>[`div`,{class:`ak-script-sentence`},0]},word:{inline:!0,atom:!0,selectable:!1,group:`inline`,attrs:{part:{default:``},i:{default:0},text:{default:``},removed:{default:!1},film:{default:null}},leafText:e=>`${String(e.attrs.text)} `,toDOM:e=>[`span`,{"data-word":String(e.attrs.i),"data-removed":e.attrs.removed===!0?``:void 0,class:`ak-word`},[`span`,{class:`ak-word-text`},String(e.attrs.text)],` `]},text:{group:`inline`}}});function Nr(e){return Mr.node(`doc`,null,e.map(e=>Mr.node(`part`,{part:e.part,title:e.title},Cn(e.words).map(t=>Mr.node(`sentence`,null,t.map(t=>Mr.node(`word`,{part:e.part,i:t.i,text:t.text,removed:t.removed,film:t.film??null})))))))}function Pr(e,t,n){let r;return e.descendants((e,i)=>{if(e.type.name!==`word`)return!0;let a=i+e.nodeSize;return n===`before`&&a<=t&&(r={from:i,to:a}),n===`after`&&i>=t&&!r&&(r={from:i,to:a}),!1}),r}function Fr(e,t,n){let r=new Map;return e.nodesBetween(t,n,e=>{if(e.type.name!==`word`)return;let t=String(e.attrs.part),n=Number(e.attrs.i),i=e.attrs.removed===!0,a=r.get(t);a?(a.first=Math.min(a.first,n),a.last=Math.max(a.last,n),a.struck=a.struck&&i):r.set(t,{part:t,first:n,last:n,struck:i})}),[...r.values()]}var Ir=44,Lr=48;function Rr(e,t){let n=e.state.selection;if(n.empty||!t)return;let r=Fr(e.state.doc,n.from,n.to);if(r.length===0)return;let i=t.getBoundingClientRect(),a=e.coordsAtPos(n.from,1),o=e.coordsAtPos(n.to,-1),s=a.top-i.top+t.scrollTop-Ir;return{top:s>=t.scrollTop?s:o.bottom-i.top+t.scrollTop+6,left:Math.min(Math.max(Lr,(a.left+o.right)/2-i.left+t.scrollLeft),Math.max(Lr,t.clientWidth-Lr)),runs:r,restore:r.every(e=>e.struck)}}function zr({script:e,t,playing:n=!1,readOnly:r,agent:i,following:a=!1,onSeek:o,onToggle:s,note:c,onCut:l}){let u=Y(),d=(0,K.useRef)(null),f=(0,K.useRef)(null),p=(0,K.useRef)(null),[h,g]=(0,K.useState)(),_=(0,K.useRef)({onSeek:o,onCut:l,onToggle:s,t,readOnly:r});(0,K.useEffect)(()=>{_.current={onSeek:o,onCut:l,onToggle:s,t,readOnly:r}}),(0,K.useEffect)(()=>{let e=d.current;if(!e)return;let t=new Ie({state:{init:()=>-1,apply:(e,n)=>{let r=e.getMeta(t);return typeof r==`number`?r:n}},props:{decorations(e){let n=t.getState(e)??-1;if(n<0)return U.empty;let r;return e.doc.descendants((e,t)=>{if(e.type.name!==`word`)return!0;let i=e.attrs.film;return i!==null&&i<=n&&(r=Le.node(t,t+e.nodeSize,{class:`ak-word-now`})),!0}),r?U.create(e.doc,[r]):U.empty}}}),n=new Ie({key:jr,state:{init:()=>null,apply:(e,t)=>{let n=e.getMeta(jr);return n===void 0?t:n}},props:{decorations(e){let t=jr.getState(e);if(!t)return U.empty;let n=new Set(t.words?.cut),r=new Set(t.words?.kept),i=[];return e.doc.descendants((e,a)=>{if(e.type.name===`part`)return e.attrs.part===t.part&&(i.push(Le.node(a,a+e.nodeSize,{class:`ak-script-agent`,"data-agent":t.label,"data-testid":`script-agent`})),!0);if(e.type.name!==`word`)return!0;let o=e.attrs.i,s=n.has(o)?`cut`:r.has(o)?`kept`:void 0;return s&&i.push(Le.node(a,a+e.nodeSize,{class:`ak-word-agent`,"data-agent-word":s})),!1}),U.create(e.doc,i)}}}),r=new Ie({props:{decorations(e){let{from:t,to:n,empty:r}=e.selection;if(r)return U.empty;let i=[];return e.doc.nodesBetween(t,n,(e,r)=>e.type.name!==`word`||(r<n&&r+e.nodeSize>t&&i.push(Le.node(r,r+e.nodeSize,{class:`ak-word-picked`})),!1)),U.create(e.doc,i)}}}),i=new Fe(e,{state:Me.create({doc:Nr([]),plugins:[t,n,r]}),attributes:{class:`outline-none`,"aria-label":u.script,role:`textbox`,"aria-multiline":`true`,spellcheck:`false`},editable:()=>!_.current.readOnly,dispatchTransaction(e){e.docChanged||(this.updateState(this.state.apply(e)),e.selectionSet&&g(Rr(this,f.current)))},handleKeyDown(e,t){if(t.key===` `&&!t.metaKey&&!t.ctrlKey&&!t.altKey)return _.current.onToggle?.(),!0;if(t.key!==`Backspace`&&t.key!==`Delete`)return t.key.length===1&&!t.metaKey&&!t.ctrlKey;if(_.current.readOnly)return!0;let n=e.state.selection,r=n.from,i=n.to;if(n.empty){let n=Pr(e.state.doc,r,t.key===`Backspace`?`before`:`after`);if(!n)return!0;({from:r,to:i}=n)}let a=Fr(e.state.doc,r,i);return a.length===0||_.current.onCut(a.map(e=>({part:e.part,first:e.first,last:e.last,restore:e.struck}))),!0},handleDoubleClickOn(e,t,n){return n.type.name===`word`&&(e.dispatch(e.state.tr.setSelection(Ne.create(e.state.doc,t,t+n.nodeSize))),!0)},handleClickOn(e,t,n){if(n.type.name!==`word`)return!1;let r=n.attrs.film;return r!==null&&_.current.onSeek(r),!1},handleDOMEvents:{blur:()=>(g(void 0),!1),focus:e=>(g(Rr(e,f.current)),!1)},handlePaste:()=>!0,handleDrop:()=>!0});return p.current=i,()=>{i.destroy(),p.current=null}},[]),(0,K.useEffect)(()=>{let t=p.current;if(!t)return;let n=Nr(e);if(n.eq(t.state.doc))return;let r=t.state.selection,i=n.content.size,a=Me.create({doc:n,plugins:t.state.plugins,selection:Ne.between(n.resolve(Math.min(r.from,i)),n.resolve(Math.min(r.to,i)))});t.updateState(a),t.hasFocus()&&g(Rr(t,f.current))},[e]);let v=i?.part,y=i?.label,b=i?.words,x=JSON.stringify(b??null);return(0,K.useEffect)(()=>{let e=p.current;e&&e.dispatch(e.state.tr.setMeta(jr,v===void 0||y===void 0?null:{part:v,label:y,words:b}))},[v,y,x,e]),(0,K.useEffect)(()=>{if(!a||v===void 0)return;let e=d.current?.querySelector(`[data-part="${CSS.escape(v)}"]`);(e?.querySelector(`.ak-word-agent`)??e)?.scrollIntoView({block:`nearest`})},[a,v,x]),(0,K.useEffect)(()=>{let e=p.current;if(!e)return;let n=e.state.plugins[0];n&&e.dispatch(e.state.tr.setMeta(n,t))},[t]),(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`script`,"data-playing":n?``:void 0,children:[(0,q.jsxs)(`div`,{className:`text-muted-foreground border-b px-3 py-2 text-micro`,children:[e.length===0?u.noScript:r?u.scriptReadOnly:u.scriptHint,c===void 0||e.length===0?null:(0,q.jsx)(`span`,{className:`mt-1 block`,"data-testid":`script-note`,children:c})]}),(0,q.jsxs)(`div`,{ref:f,className:`relative min-h-0 flex-1 overflow-auto`,children:[(0,q.jsx)(`div`,{ref:d,className:m(`px-3 py-2 text-read`,`[&_.ak-script-part]:mb-3 [&_.ak-script-part]:rounded-sm [&_.ak-script-sentence]:mb-1`,`[&_.ak-word]:cursor-pointer [&_.ak-word-text]:-mx-0.5 [&_.ak-word-text]:rounded-[3px] [&_.ak-word-text]:px-0.5 [&_.ak-word:not(.ak-word-now):hover_.ak-word-text]:bg-secondary`,`[&_.ak-word[data-removed]_.ak-word-text]:text-muted-foreground [&_.ak-word[data-removed]_.ak-word-text]:line-through`,`[&_.ak-word-agent_.ak-word-text]:bg-agent/15 [&_.ak-word-agent_.ak-word-text]:text-agent-text`,`[&_.ak-word-now_.ak-word-text]:bg-here [[data-playing]_&_.ak-word-now_.ak-word-text]:bg-highlight [[data-playing]_&_.ak-word-now_.ak-word-text]:text-on-highlight`,`[&_*::selection]:bg-transparent [&_.ak-word.ak-word-picked_.ak-word-text]:bg-[var(--allyhub-pencil-select)] [&_.ak-word.ak-word-picked_.ak-word-text]:text-foreground`)}),h&&!r?(0,q.jsx)(`div`,{className:`bg-sheet border-rule absolute z-10 flex -translate-x-1/2 items-center rounded-lg border p-1 shadow-[var(--shadow-overlay)]`,style:{top:h.top,left:h.left},"data-testid":`script-bar`,children:(0,q.jsxs)(de,{"data-testid":h.restore?`keep-words`:`cut-words`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{l(h.runs.map(e=>({part:e.part,first:e.first,last:e.last,restore:h.restore})))},children:[h.restore?(0,q.jsx)(fe,{}):(0,q.jsx)(xe,{}),h.restore?u.keepWords:u.cutWords]})}):null]})]})}var Br=1200,Vr=4e3,Hr=150,Ur=1e4,Wr=220,Gr=640,Kr={initial:272,least:200,share:.5},qr=[[`voice`,`music`,`sound`],[`voice`],[]],Jr=mr(qr[0]??[]),Yr=mr([]);function Xr(e,t){let n=u(),[r,i]=(0,K.useState)(new Map),[a,o]=(0,K.useState)(),s=e.join(`
24
- `);return(0,K.useEffect)(()=>{let t=!0;return Promise.all(e.map(async e=>{try{let t=await n[`files/read`]({path:ae(e)}),r=oe(`words`,JSON.parse(t.text));return r.ok?[e,r.value.words]:void 0}catch{return}})).then(e=>{t&&(i(new Map(e.filter(e=>e!==void 0))),o(s))}),()=>{t=!1}},[n,s,t]),{words:r,read:a===s}}var Zr=e=>e instanceof HTMLElement&&e.closest(`[data-testid=script]`)===null&&(e.isContentEditable||e.closest(`input,textarea,select,[role=dialog]`)!==null);function Qr({item:e,piece:t,version:r,revision:i,start:a,updating:o=!1,loaded:s,onLoaded:c}){let d=Y(),f=u(),p=l(),h=(0,K.useRef)(null),[_,v]=(0,K.useState)(),[y,b]=(0,K.useState)(),[x,S]=(0,K.useState)({t:a?.t??0,part:void 0,playing:!1}),[C,w]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(_===void 0)return;let e=setTimeout(()=>{b(_)},Br);return()=>{clearTimeout(e)}},[_]);let T=_!==void 0&&y===_?_:void 0,[E,D]=(0,K.useState)(r.key);E!==r.key&&(D(r.key),v(void 0));let O=(0,K.useRef)(null),[k,A]=(0,K.useState)(1/0);(0,K.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>{A(e.clientWidth)});return t.observe(e),()=>{t.disconnect()}},[]);let[ee=Kr.initial,te]=lt(`video-editor.script-width`,Kr.initial),[ne=Jr,j]=lt(`video-editor.timeline-height`,Jr),[re=!0,ie]=lt(`video-editor.timeline`,!0),ae=Math.max(Kr.least,Math.round((Number.isFinite(k)?k:1600)*Kr.share)),oe=Math.min(ae,Math.max(Kr.least,ee)),se=qr.find(e=>mr(e)<=ne)??qr[2]??[],M=(0,K.useMemo)(()=>s?.kind===`video`?In(s.timeline,s.text,s.mix):void 0,[s]),N=s?.kind===`video`?s.timeline:void 0,{words:P,read:ce}=Xr((0,K.useMemo)(()=>[...new Set((N?.parts??[]).flatMap(e=>e.speech?[e.speech.file]:[]))],[N]),i),F=En(p),le=new Map;for(let e of N?.parts??[]){let t=e.speech?.edits;if(t===void 0)continue;let n=F.listOf(t);n&&le.set(t,n)}let ue=(0,K.useMemo)(()=>N?hn(N,P,le):[],[N,P,F.tick]),[de,fe]=(0,K.useState)(!1);!de&&(s!==void 0&&C&&ce||_!==void 0)&&fe(!0),(0,K.useEffect)(()=>{let e=setTimeout(()=>{fe(!0)},Ur);return()=>{clearTimeout(e)}},[]);let[me,he]=(0,K.useState)(!0);(0,K.useEffect)(()=>{if(!de)return;let e=setTimeout(()=>{he(!1)},Wr);return()=>{clearTimeout(e)}},[de]);let ge=ue.filter(e=>e.edits!==void 0),I=p||ge.length===0,L=!p&&ge.length<ue.length?d.noEdits:void 0,_e=e=>{let t=[];for(let n of e){let e=ue.find(e=>e.part===n.part);if(e?.edits===void 0)continue;let r=P.get(e.file)??[];t.push({path:e.edits,next:e=>n.restore?bn(e,n.first,n.last,r):yn(e,n.first,n.last,r)})}F.apply(e.every(e=>e.restore)?d.keepWords:d.cutWords,t)},R=(0,K.useRef)(F);(0,K.useEffect)(()=>{R.current=F}),(0,K.useEffect)(()=>{if(p)return;let e=e=>{if(Zr(e.target))return;let t=e.target instanceof HTMLElement&&e.target.closest(`[data-testid=script]`)!==null;if(e.defaultPrevented&&!t||!(e.metaKey||e.ctrlKey)||e.altKey)return;let n=e.key.toLowerCase(),r=R.current,i=n===`z`&&e.shiftKey||n===`y`&&!e.shiftKey;if(n===`z`&&!e.shiftKey&&r.canUndo)r.undo();else if(i&&r.canRedo)r.redo();else return;e.preventDefault()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[p]);let{agent:z,following:ve}=n(),B=z?.doing!==void 0,ye=pe(),[xe,Se]=(0,K.useState)(),we=z?.source?.path;(0,K.useEffect)(()=>{if(we===void 0||xe?.revision===i)return;let t=!0;return nt(f,`video/sources`,{item:e}).then(e=>{t&&Se({revision:i,files:e.files})},()=>void 0),()=>{t=!1}},[f,e,i,we,xe?.revision]);let[Te,De]=(0,K.useState)(s),[ke,Me]=(0,K.useState)(),[H,Ne]=(0,K.useState)();if(s!==Te&&(De(s),Te&&s&&z?.doing===`editing`)){let e=Tt({timeline:Te.timeline,text:Te.text},s),t=kt(Te.timeline,s.timeline),[n]=e,r=n===void 0?void 0:Et(s.timeline,n);r&&Me(r),(e.length>0||t.music||t.cues.length>0)&&Ne({parts:e,...t,round:(H?.round??0)+1})}(0,K.useEffect)(()=>{if(!H)return;let e=setTimeout(()=>{Ne(void 0)},Vr);return()=>{clearTimeout(e)}},[H]);let[Pe,U]=(0,K.useState)(),[Fe,Ie]=(0,K.useState)(F.byAgent);F.byAgent!==Fe&&(Ie(F.byAgent),U(F.byAgent));let[Le,Re]=(0,K.useState)(B);Le!==B&&(Re(B),B||(Me(void 0),U(void 0)));let ze=B?z.source:void 0,Be=ze&&N?St(N,ze.path):void 0,Ve=ze&&xe&&Be===void 0?xt(xe.files,ze):void 0,W=(()=>{if(!B||!N)return;let e=vt(z.place);return e===void 0?(Be===void 0?Ve?.part===void 0?void 0:Et(N,Ve.part,Ve):Et(N,Be))??ke:{t:e}})(),G=W?.t,He=z?ye(z):``,Ue=Ve?.music===!0,We=Ve?.sounds===!0&&Ve.part!==void 0?Ve.part:void 0,Ge=B&&yt(z.place),Ke=(0,K.useMemo)(()=>({parts:H?.parts??[],music:H?.music===!0||Ue,cues:[...new Set([...H?.cues??[],...We===void 0?[]:[We]])],listening:Ge,round:H?.round??0}),[H,Ue,We,Ge]),qe=Pe&&N&&W?.part!==void 0&&St(N,Pe.path)===W.part?{cut:Pe.cut,kept:Pe.kept}:void 0,Je=(0,K.useRef)(x.t);(0,K.useEffect)(()=>{Je.current=x.t}),(0,K.useEffect)(()=>{ve&&G!==void 0&&!x.playing&&(Math.abs(Je.current-G)<1/240||h.current?.seek(G))},[ve,G,x.playing]);let J=G!==void 0&&!x.playing&&Math.abs(x.t-G)<=1/(N?.fps??30)+1e-6,Ye=W?.part,Xe=W?.layer,Ze=W?.message,Qe=J&&Ye!==void 0&&(Xe!==void 0||Ze!==void 0),[$e,et]=(0,K.useState)();(0,K.useEffect)(()=>{if(!Qe)return;let e=!0,t=setTimeout(()=>{h.current?.objects(x.t).then(t=>{e&&et(t)})},Hr);return()=>{e=!1,clearTimeout(t)}},[Qe,x.t,s]);let tt=Qe&&$e&&Math.abs($e.t-x.t)<1e-6?$e:void 0,rt=(Xe===void 0?void 0:tt?.layers?.find(e=>e.part===Ye&&e.index===Xe)?.box)??(Ze===void 0?void 0:tt?.texts.find(e=>e.keys.includes(Ze))?.box),it=(e,t)=>`${String(e/t*100)}%`,at=()=>{x.playing?h.current?.pause():h.current?.play()},ot=ue.length>0&&k>=Gr,st=(e,t,n,r,i)=>(0,q.jsx)(g,{size:`icon-sm`,variant:`ghost`,"aria-label":e,title:e,disabled:r,"data-testid":i,onClick:n,children:t});return(0,q.jsxs)(`div`,{ref:O,className:`bg-sheet relative flex size-full min-h-0 flex-col`,"data-testid":`workbench`,"data-opened":de?``:void 0,children:[me?(0,q.jsx)(`div`,{className:m(`bg-sheet absolute inset-0 z-20 flex items-center justify-center motion-safe:transition-opacity motion-safe:duration-200`,de&&`pointer-events-none opacity-0`),"data-testid":`opening`,children:de?null:(0,q.jsx)(Ce,{label:d.loading})}):null,(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[ot?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`flex min-h-0 shrink-0`,style:{width:oe},children:(0,q.jsxs)(`aside`,{className:`bg-sheet flex min-h-0 flex-col overflow-hidden w-full`,"aria-label":d.script,children:[(0,q.jsxs)(`div`,{className:`flex h-9 items-center gap-1 border-b pr-1 pl-3`,children:[(0,q.jsx)(`h2`,{className:`flex-1 text-xs font-medium`,children:d.script}),I?null:(0,q.jsxs)(q.Fragment,{children:[st(F.undoLabel===void 0?d.undo:d.undoWhat(F.undoLabel),(0,q.jsx)(be,{}),F.undo,!F.canUndo,`undo`),st(F.redoLabel===void 0?d.redo:d.redoWhat(F.redoLabel),(0,q.jsx)(V,{}),F.redo,!F.canRedo,`redo`)]})]}),(0,q.jsx)(zr,{script:ue,t:x.t,playing:x.playing,readOnly:I,note:L,agent:z&&W?.part!==void 0?{part:W.part,label:He,words:qe}:void 0,following:ve,onSeek:e=>{h.current?.seek(e)},onToggle:at,onCut:_e})]})}),(0,q.jsx)(ir,{orientation:`vertical`,value:oe,min:Kr.least,max:ae,label:d.resizeScript,onChange:te,testid:`script-splitter`})]}):null,(0,q.jsx)(`div`,{className:`bg-sheet min-h-0 min-w-0 flex-1 px-4 py-3 min-[560px]:px-6`,children:(0,q.jsx)($n,{ref:h,item:e,version:r.key,revision:i,start:a,width:t.width,height:t.height,timelineOpen:re,onTimelineOpen:ie,overlay:(0,q.jsxs)(q.Fragment,{children:[z&&J&&N?rt?(0,q.jsx)(je,{"data-testid":`agent-box`,label:He,style:{left:it(rt[0],N.width),top:it(rt[1],N.height),width:it(rt[2],N.width),height:it(rt[3],N.height)}}):(0,q.jsx)(Ae,{"data-testid":`agent-tag`,label:He,className:`absolute top-2 left-2`}):null,T!==void 0&&s===void 0?(0,q.jsx)(Oe,{className:`bg-background absolute inset-0 z-20 flex items-center justify-center`}):o||T!==void 0?(0,q.jsx)(Ee,{}):null]}),onState:e=>{S(e),w(!0)},onLoaded:e=>{c(e),v(void 0)},onError:v})})]}),N&&M&&re?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ir,{orientation:`horizontal`,value:mr(se),min:Yr,max:Jr,after:!0,label:d.resizeTimeline,onChange:j,testid:`timeline-splitter`}),(0,q.jsx)(`div`,{className:`bg-sheet shrink-0`,children:(0,q.jsx)(Ar,{timeline:N,texts:s?.text??[],tracks:M,rows:se,state:x,agent:z?{t:G,label:He}:void 0,marks:Ke,transport:{onFold:()=>{ie(!1)}},onSeek:e=>{h.current?.seek(e)}})})]}):null]})}function $r(e,t,n){let r=t.versions.filter(e=>n?.includes(e.key)!==!1).flatMap(n=>ht(e,t.piece,n)).filter(e=>e.level===`error`).map(e=>`${e.code}: ${e.message}`);return new Set(r).size}function ei(){let e=Y(),t=i(),n=t?.item.id,r=_[p(t?.locale)],a=ft(t?.place),o=st(),{data:s,error:c}=at(`video/versions`,n===void 0?void 0:{item:n},[o]),{shown:l,updating:u}=De(s),[d,f]=lt(`video-editor.version:${n??``}`,``),m=ct(),h=l?mt(l,d):void 0,[g,v]=(0,K.useState)(),y=h&&g?.key===`${n??``}\n${h.key}`?g.loaded:void 0;if(n===void 0||!l&&!c)return(0,q.jsx)(`div`,{className:`bg-sheet flex h-full items-center justify-center`,children:(0,q.jsx)(Ce,{label:e.loading})});if(!l||!h)return(0,q.jsx)(Oe,{className:`bg-sheet flex h-full items-center justify-center`});let b=e=>e.lang===void 0?e.key:gt(e.lang,r),x=l.kind===`video`?y?.timeline:void 0,S=l.kind===`video`&&y!==void 0&&!y.text.some(e=>e.spoken!==void 0);return(0,q.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,"data-testid":`video-editor`,children:[(0,q.jsx)(ge,{start:l.versions.length>1?(0,q.jsx)(L,{testid:`video-bar`,children:(0,q.jsx)(I,{id:`language`,children:(0,q.jsxs)(ce,{value:h.key,onValueChange:e=>{f(e)},children:[(0,q.jsx)(le,{"aria-label":e.version,className:`max-w-[16rem]`,"data-testid":`version`,children:(0,q.jsx)(F,{})}),(0,q.jsx)(P,{position:`popper`,align:`start`,children:l.versions.map(e=>(0,q.jsx)(ue,{value:e.key,className:`text-xs`,title:e.key,children:b(e)},e.key))})]})})}):void 0,exports:{versions:l.versions.map(e=>({key:e.key,label:b(e)})),shown:h.key,facts:[`${String(l.width)} × ${String(l.height)}`,...x?[`${String(x.fps)} fps`,J(x.duration)]:[]].join(` · `),unavailable:S?{srt:e.noVoice}:{},check:{waiting:m?.status===`waiting`||m?.status===`running`,problems:e=>m?.status===`done`?$r(m.problems,l,e):0}}}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,q.jsx)(Qr,{item:n,piece:l,version:h,revision:o,start:a,updating:u,loaded:y,onLoaded:e=>{v({key:`${n}\n${h.key}`,loaded:e})}})})]})}var ti=t({Preview:()=>$n,VideoEditor:()=>ei,WORDS:()=>rt,Workbench:()=>Qr,aboutVersion:()=>ht,default:()=>ei,languageName:()=>gt,locateInStage:()=>Pn,musicAt:()=>Rn,musicGain:()=>zn,mustFix:()=>$r,pickInStage:()=>Fn,placeLabels:()=>ar,postCommand:()=>Z,speechAt:()=>Ln,stageLayerName:()=>Mn,stageMessage:()=>Nn,tracksOf:()=>In,uncutParts:()=>Bn,useCheck:()=>ct,useRevision:()=>st,useStored:()=>lt,useTool:()=>at,useToolOf:()=>ot,useVideoWords:()=>Y,versionNamed:()=>mt});export{G as _,Mn as a,mt as c,lt as d,at as f,Ge as g,qe as h,Fn as i,ct as l,nt as m,$r as n,Nn as o,ot as p,Pn as r,gt as s,ti as t,st as u,W as v};
@@ -1,4 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,b as n,c as r,d as i,f as a,h as o,s}from"./react-Byupo4pA.js";import{Dt as c,Et as l,Ot as u,kt as d,yt as f}from"./x-BAJilkKD.js";import{C as p,E as m,S as h,T as g,_,a as v,b as y,d as b,f as x,h as S,l as C,s as w,u as ee,v as T,w as E}from"./schemas-DlRAoVtq.js";import{F as D,S as te,b as O,g as k,j as A,x as ne}from"./snapshots-DYooVfOx.js";import{t as re}from"./jsx-runtime-DePvh3-m.js";import{A as j,C as ie,f as ae,m as M,t as oe,u as se,y as N}from"./bar-button-CJmpgNg4.js";import{E as ce,_ as le,a as ue,c as de,d as fe,i as P,l as pe,n as me,o as he,p as ge,r as F,u as _e}from"./dist-DCI21ljp.js";import{a as ve,n as ye}from"./index-omhSywJb.js";import{n as be,t as xe}from"./updating-D0GEtwnJ.js";import{t as I}from"./collaborator-CbTacvkB.js";var L=re(),Se=f({en:{loading:`Drawing the boards`,noBoards:`This image has no boards yet`,boards:`Boards`,zoom:`Zoom`,zoomIn:`Zoom In`,zoomOut:`Zoom Out`,zoomFit:`Zoom to Fit`,zoomActual:`Actual Size`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 board`:`${String(e)} boards`},"zh-cn":{loading:`正在绘制画板`,noBoards:`这张图片还没有画板`,boards:`画板`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,zoomFit:`缩放到适合`,zoomActual:`实际大小`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 个画板`},"zh-tw":{loading:`正在繪製畫板`,noBoards:`這張圖片還沒有畫板`,boards:`畫板`,zoom:`縮放`,zoomIn:`放大`,zoomOut:`縮小`,zoomFit:`縮放至適合大小`,zoomActual:`實際大小`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 個畫板`},ja:{loading:`ボードを描画中`,noBoards:`この画像にはまだボードがありません`,boards:`ボード`,zoom:`ズーム`,zoomIn:`拡大`,zoomOut:`縮小`,zoomFit:`全体を表示`,zoomActual:`実寸`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 枚のボード`},ko:{loading:`보드를 그리는 중`,noBoards:`이 이미지에는 아직 보드가 없습니다`,boards:`보드`,zoom:`확대/축소`,zoomIn:`확대`,zoomOut:`축소`,zoomFit:`화면에 맞추기`,zoomActual:`실제 크기`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`보드 ${String(e)}개`},es:{loading:`Dibujando las mesas de trabajo`,noBoards:`Esta imagen aún no tiene mesas de trabajo`,boards:`Mesas de trabajo`,zoom:`Zoom`,zoomIn:`Acercar`,zoomOut:`Alejar`,zoomFit:`Ajustar a la ventana`,zoomActual:`Tamaño real`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 mesa de trabajo`:`${String(e)} mesas de trabajo`},fr:{loading:`Dessin des plans de travail`,noBoards:`Cette image n’a pas encore de plan de travail`,boards:`Plans de travail`,zoom:`Zoom`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,zoomFit:`Ajuster à la fenêtre`,zoomActual:`Taille réelle`,percent:e=>`${String(e)}\u202f%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 plan de travail`:`${String(e)} plans de travail`},de:{loading:`Zeichenflächen werden gezeichnet`,noBoards:`Dieses Bild hat noch keine Zeichenflächen`,boards:`Zeichenflächen`,zoom:`Zoom`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,zoomFit:`An Fenster anpassen`,zoomActual:`Originalgröße`,percent:e=>`${String(e)}\u00a0%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 Zeichenfläche`:`${String(e)} Zeichenflächen`},pt:{loading:`Desenhando as pranchetas`,noBoards:`Esta imagem ainda não tem pranchetas`,boards:`Pranchetas`,zoom:`Zoom`,zoomIn:`Ampliar`,zoomOut:`Reduzir`,zoomFit:`Ajustar à janela`,zoomActual:`Tamanho real`,percent:e=>`${String(e)}%`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 prancheta`:`${String(e)} pranchetas`}});function R(){return Se.of(r()?.locale)}var z=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`)?`⌘`:`Ctrl+`;function Ce(e){let t=R();return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(me,{id:`zoom`,priority:3,children:(0,L.jsxs)(se,{children:[(0,L.jsx)(ie,{asChild:!0,children:(0,L.jsxs)(oe,{"aria-label":t.zoom,title:t.zoom,className:`tabular-nums`,"data-testid":`image-zoom`,children:[t.percent(Math.round(e.zoom*100)),(0,L.jsx)(j,{className:`size-3`})]})}),(0,L.jsxs)(ae,{align:`start`,children:[(0,L.jsx)(`div`,{className:`px-1 pb-1`,children:(0,L.jsx)(ve,{"aria-label":t.zoom,className:`h-7 tabular-nums`,inputMode:`decimal`,defaultValue:t.percent(Math.round(e.zoom*100)),"data-testid":`image-zoom-typed`,onKeyDown:t=>{if(t.stopPropagation(),t.key!==`Enter`)return;let n=parseFloat(t.currentTarget.value.replace(`,`,`.`));Number.isFinite(n)&&n>0&&e.onZoom(n/100)}},Math.round(e.zoom*100))}),(0,L.jsxs)(M,{onSelect:()=>{e.onZoom(`in`)},children:[t.zoomIn,(0,L.jsx)(N,{children:`${z}+`})]}),(0,L.jsxs)(M,{onSelect:()=>{e.onZoom(`out`)},children:[t.zoomOut,(0,L.jsx)(N,{children:`${z}−`})]}),(0,L.jsxs)(M,{"data-testid":`image-zoom-fit`,onSelect:()=>{e.onZoom(`fit`)},children:[t.zoomFit,(0,L.jsx)(N,{children:`⇧1`})]}),(0,L.jsxs)(M,{"data-testid":`image-zoom-actual`,onSelect:()=>{e.onZoom(1)},children:[t.zoomActual,(0,L.jsx)(N,{children:`⇧0`})]})]})]})})})}var we=`normal.dissolve.darken.multiply.colorBurn.linearBurn.darkerColor.lighten.screen.colorDodge.linearDodge.lighterColor.overlay.softLight.hardLight.vividLight.linearLight.pinLight.hardMix.difference.exclusion.subtract.divide.hue.saturation.color.luminosity.passThrough`.split(`.`),Te=e=>typeof e==`object`&&!!e&&(`__allyhubMedia`in e||`sha256`in e),B=_().min(0).max(1),Ee=E([B,B,B,B]).refine(([e,t,n,r])=>n>0&&r>0&&e+n<=1+1e-9&&t+r<=1+1e-9,`[x, y, w, h] as shares of the frame, inside it, its sides more than 0`),De=g([p().min(1),ee(Te,`an imported picture`)]),V=_().min(0).max(100).refine(Number.isFinite,`a percent from 0 to 100`),H=_().min(0).max(1e3).refine(Number.isFinite),Oe=_().min(-360).max(360),U=v(we),ke=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/iu,Ae=/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)$/iu;function je(e){if(typeof e!=`string`)return!1;let t=e.trim();if(ke.test(t)||Ae.test(t))return!0;if(!/^[a-z]+$/iu.test(t))return!1;let n=globalThis.CSS;return n?n.supports(`color`,t):t.length>2}var W=p().refine(je,`a CSS colour (#rrggbb, rgb(…), hsl(…) or a colour's name)`),Me=T({color:W,location:V,midpoint:V.optional()}),Ne=T({stops:w(Me).min(2),style:v([`linear`,`radial`,`angle`,`reflected`,`diamond`]).optional(),angle:Oe.optional(),scale:_().min(10).max(1e3).optional(),reverse:C().optional()});g([T({color:W}),T({gradient:Ne}),T({pattern:De,scale:_().min(1).max(1e3).optional()})]);var Pe=T({src:De.optional(),path:p().min(1).optional(),box:Ee.optional(),mode:v([`alpha`,`luminance`]).optional(),density:V.optional(),feather:H.optional(),invert:C().optional(),enabled:C().optional()}),Fe=g([De,Pe]),G={enabled:C().optional(),blendMode:U.optional(),opacity:V.optional()},Ie={...G,color:W.optional(),angle:Oe.optional(),distance:H.optional(),size:H.optional()},Le=T({dropShadow:T({...Ie,spread:V.optional()}).optional(),innerShadow:T({...Ie,choke:V.optional()}).optional(),outerGlow:T({...G,color:W.optional(),spread:V.optional(),size:H.optional()}).optional(),innerGlow:T({...G,color:W.optional(),choke:V.optional(),size:H.optional(),source:v([`edge`,`center`]).optional()}).optional(),stroke:T({...G,color:W.optional(),size:H.optional(),position:v([`outside`,`inside`,`center`]).optional()}).optional(),colorOverlay:T({...G,color:W.optional()}).optional(),gradientOverlay:T({...G,gradient:Ne.optional()}).optional(),patternOverlay:T({...G,pattern:De,scale:_().min(1).max(1e3).optional()}).optional(),satin:T({...G,color:W.optional(),angle:Oe.optional(),distance:H.optional(),size:H.optional(),invert:C().optional()}).optional(),bevelEmboss:T({...G,style:v([`innerBevel`,`outerBevel`,`emboss`,`pillowEmboss`,`strokeEmboss`]).optional(),technique:v([`smooth`,`chiselHard`,`chiselSoft`]).optional(),depth:_().min(1).max(1e3).optional(),direction:v([`up`,`down`]).optional(),size:H.optional(),soften:H.optional(),angle:Oe.optional(),altitude:_().min(0).max(90).optional(),highlightMode:U.optional(),highlightColor:W.optional(),highlightOpacity:V.optional(),shadowMode:U.optional(),shadowColor:W.optional(),shadowOpacity:V.optional()}).optional()}),Re=T({rotation:_().min(-360).max(360).optional(),flipH:C().optional(),flipV:C().optional()});T({blendMode:U.optional(),opacity:V.optional(),fillOpacity:V.optional(),clipping:C().optional(),mask:Fe.optional(),effects:Le.optional(),transform:Re.optional(),visible:C().optional()});var K=_().min(0).max(255),ze=T({inputBlack:K.optional(),inputWhite:K.optional(),gamma:_().min(.1).max(9.99).optional(),outputBlack:K.optional(),outputWhite:K.optional()}),Be=E([K,K]),Ve=w(Be).min(2).max(16);b(`kind`,[T({kind:S(`levels`),rgb:ze.optional(),red:ze.optional(),green:ze.optional(),blue:ze.optional()}),T({kind:S(`curves`),rgb:Ve.optional(),red:Ve.optional(),green:Ve.optional(),blue:Ve.optional()}),T({kind:S(`brightnessContrast`),brightness:_().min(-150).max(150).optional(),contrast:_().min(-50).max(100).optional(),useLegacy:C().optional()}),T({kind:S(`hueSaturation`),hue:_().min(-180).max(180).optional(),saturation:_().min(-100).max(100).optional(),lightness:_().min(-100).max(100).optional(),colorize:C().optional()}),T({kind:S(`vibrance`),vibrance:_().min(-100).max(100).optional(),saturation:_().min(-100).max(100).optional()}),T({kind:S(`colorBalance`),shadows:E([_(),_(),_()]).optional(),midtones:E([_(),_(),_()]).optional(),highlights:E([_(),_(),_()]).optional(),preserveLuminosity:C().optional()}),T({kind:S(`blackAndWhite`),reds:_().min(-200).max(300).optional(),yellows:_().min(-200).max(300).optional(),greens:_().min(-200).max(300).optional(),cyans:_().min(-200).max(300).optional(),blues:_().min(-200).max(300).optional(),magentas:_().min(-200).max(300).optional()}),T({kind:S(`photoFilter`),color:W.optional(),density:V.optional(),preserveLuminosity:C().optional()}),T({kind:S(`invert`)}),T({kind:S(`threshold`),level:_().int().min(1).max(255).optional()}),T({kind:S(`gradientMap`),gradient:Ne.optional(),reverse:C().optional()}),T({kind:S(`exposure`),exposure:_().min(-20).max(20).optional(),offset:_().min(-.5).max(.5).optional(),gammaCorrection:_().min(.01).max(9.99).optional()})]),T({color:W.optional(),width:H.optional(),alignment:v([`inside`,`center`,`outside`]).optional(),dashes:w(_().min(0).max(1e3)).max(8).optional(),cap:v([`butt`,`round`,`square`]).optional(),join:v([`miter`,`round`,`bevel`]).optional(),opacity:V.optional()}),T({font:p().min(1).optional(),weight:_().int().min(100).max(900).optional(),italic:C().optional(),size:_().min(1).max(4096).optional(),color:W.optional(),tracking:_().min(-1e3).max(1e4).optional(),leading:g([_().min(0).max(5e3),S(`auto`)]).optional(),capitalization:v([`normal`,`allCaps`,`smallCaps`]).optional(),underline:C().optional(),strikeThrough:C().optional()}),T({justification:v([`left`,`center`,`right`,`justifyLeft`,`justifyCenter`,`justifyRight`,`justifyAll`]).optional(),firstLineIndent:_().min(-1296).max(1296).optional(),leftIndent:_().min(0).max(1296).optional(),rightIndent:_().min(0).max(1296).optional(),spaceBefore:_().min(0).max(1296).optional(),spaceAfter:_().min(0).max(1296).optional()});var He=[`pixel`,`type`,`shape`,`smartObject`,`adjustment`,`fill`,`group`],q=e(n(),1),J=E([_(),_(),_(),_()]),Ue=h({text:p(),box:J,size:_(),capHeight:_().optional(),color:p(),font:p(),weight:p(),lineHeight:_(),align:p(),letterSpacing:_().optional()}),We=h({key:p(),component:p(),kind:v(He),parent:p().optional(),hidden:C(),style:y(p(),m()),box:J.optional(),words:w(h({prop:p(),key:p(),text:p()})),texts:w(Ue),picture:h({file:p(),source:E([_(),_()]),whole:J,box:J,fit:p(),position:E([_(),_()]),crop:J.optional()}).optional()}),Ge=h({key:p(),title:p().optional(),width:x().positive(),height:x().positive(),background:p(),picture:te,layers:w(We)}),Ke=h({from:x().positive(),to:x().positive()}),qe=Ke.extend({key:p().min(1)}),Je=Ke.extend({key:p().min(1),layers:w(qe)}),Ye={"image/versions":D(h({item:A}),h({piece:p(),title:p().optional(),script:p().min(1).optional(),versions:w(h({key:p(),lang:p().optional(),variant:p().optional(),script:A.optional()}))}),`An image's versions, one per combo, and its script in each version's language.`),"image/boards":D(h({...O,height:x().min(16).max(2048).optional()}),h({image:te,width:x().positive(),height:x().positive(),boards:w(h({key:p(),width:x().positive(),height:x().positive(),x:x().nonnegative()}))}),`An image version's boards drawn side by side, in order, at one height: its card and its preview.`),"image/edit":D(h({...O,scale:_().min(.05).max(2).optional()}),h({piece:p(),boards:w(Ge)}),`An image version's boards as its viewer shows them: each drawn, and its named layers with what each draws, the messages it shows and its picture (what Mark up finds under a mark).`),"image/stage":D(h({...O,board:p().min(1).optional()}),k,"The address of an image version's stage page, for its viewer's sandboxed frame: a board drawn live, as large as the frame holds it, which moves to another board (`seek` by `part`)."),"image/sources":D(h({item:A}),h({path:A,boards:w(Je)}),`Where each board and its layers are written in the image's module, by line: what a change to those lines changes.`)},Xe=ne(Ye),Ze=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Qe(e,t){for(let n of t){let t=e.find(e=>e.key===n.key);if(!t)return{board:n.key};for(let e of n.layers){let r=t.layers.find(t=>t.key===e.key);if(!r||!Ze(r,e))return{board:n.key,layer:e.key}}if(t.layers.length!==n.layers.length)return{board:n.key}}}var $e=(e,t)=>e.from<=t.to&&t.from<=e.to,et=(e,t)=>e.filter(e=>$e(e,t)).sort((e,t)=>e.to-e.from-(t.to-t.from))[0];function tt(e,t,n=t){let r={from:t,to:n},i=et(e,r);if(!i)return;let a=et(i.layers,r);return{board:i.key,...a?{layer:a.key}:{}}}var nt=1,rt=e=>`data:${e.mime};base64,${e.data}`;function it(e){let t=s(),[n,r]=(0,q.useState)(),[i,a]=(0,q.useState)([]),[o,c]=(0,q.useState)(new Map),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(),[h,g]=(0,q.useState)(),[_,v]=(0,q.useState)(0),y=(0,q.useRef)(0),b=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>t.on(`project/changed`,e=>{y.current=e.revision,v(e=>e+1)}),[t]),(0,q.useEffect)(()=>{if(e===void 0)return;let n={on:!0},i=y.current;return Xe(t,`image/sources`,{item:e}).then(e=>{n.on&&m(e)},()=>void 0),(async()=>{let o=(await Xe(t,`image/versions`,{item:e})).versions.map(e=>({key:e.key,lang:e.lang,variant:e.variant})),s=new Map,l;for(let n of o){let r=await Xe(t,`image/edit`,{item:e,version:n.key,scale:nt});l=r.piece,s.set(n.key,{version:n,boards:r.boards})}if(n.on){for(let[e,t]of s){let n=b.current.get(e),r=n&&Qe(n.boards,t.boards);if(r){g({spot:r,version:e,at:Date.now()});break}}b.current=s,r(l),a(o),c(s),u(void 0),f(i)}})().catch(e=>{n.on&&u(e instanceof Error?e.message:String(e))}),()=>{n.on=!1}},[t,e,_]),{item:e,piece:n,versions:i,drawn:o,revision:d,sources:p,landed:h,error:l}}var at=e=>typeof e==`object`&&!!e&&e.allyhub===!0&&typeof e.type==`string`;function ot(e){let t=s(),[n,r]=(0,q.useState)(),i=o(n),[a,c]=(0,q.useState)(new Map),l=(0,q.useRef)(new Map),u=(0,q.useRef)(1),d=e.wanted.map(e=>e.id).join(`
2
- `);return(0,q.useEffect)(()=>{if(e.item===void 0)return;let n=!0,i=e.item;return Promise.all(e.wanted.slice(0,8).map(e=>Xe(t,`image/stage`,{item:i,version:e.version,board:e.board}).then(t=>({w:e,r:t}),()=>void 0))).then(e=>{if(!n)return;let t=e.find(e=>e!==void 0);t&&r(t.r.probe),c(t=>{let n=new Map;for(let r of e){if(!r)continue;let e=t.get(r.w.id),i=()=>({n:u.current++,src:r.r.url,drawn:!1});e?.shown?e.shown.src===r.r.url?n.set(r.w.id,e):n.set(r.w.id,{shown:e.shown,pending:e.pending?.src===r.r.url?e.pending:i()}):n.set(r.w.id,{shown:i(),pending:void 0})}return n})}),()=>{n=!1}},[t,e.item,d,e.revision]),(0,q.useEffect)(()=>{let e=e=>{if(!at(e.data)||e.data.type!==`ready`)return;let t;for(let[n,r]of l.current)r.contentWindow===e.source&&(t=n);t!==void 0&&c(e=>{let n=!1,r=new Map(e);for(let[i,a]of e)a.shown?.n===t&&!a.shown.drawn?(r.set(i,{...a,shown:{...a.shown,drawn:!0}}),n=!0):a.pending?.n===t&&(r.set(i,{shown:{...a.pending,drawn:!0},pending:void 0}),n=!0);return n?r:e})};return addEventListener(`message`,e),()=>{removeEventListener(`message`,e)}},[]),{frame:(e,t)=>{let n=a.get(e);return!n||i===void 0?null:(0,L.jsx)(ct,{frames:n,sandbox:i,els:l,picture:t})},drawn:e=>a.get(e)?.shown?.drawn===!0}}function st(e){let t=/^data:([^;,]+);base64,(.*)$/su.exec(e);return t?.[1]!==void 0&&t[2]!==void 0?{mime:t[1],data:t[2]}:void 0}function ct({frames:e,sandbox:t,els:n,picture:r}){let a=(0,q.useRef)(null),o=()=>{let e=a.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0};i({element:()=>a.current,pictures:()=>{let e=o(),t=st(r);return Promise.resolve(e&&t?[{rect:e,...t}]:[])}});let s=(e,r)=>(0,L.jsx)(`iframe`,{ref:t=>{t?n.current.set(e.n,t):n.current.delete(e.n),r||(a.current=t)},src:e.src,title:``,tabIndex:-1,...t?{sandbox:`allow-scripts`}:{},"data-testid":r?`image-live-pending`:`image-live`,"data-drawn":e.drawn?``:void 0,className:`pointer-events-none absolute inset-0 size-full border-0`,style:{opacity:!r&&e.drawn?1:0}},e.n);return(0,L.jsxs)(L.Fragment,{children:[e.shown?s(e.shown,!1):null,e.pending?s(e.pending,!0):null]})}function lt(e,t,n,r){let i=e=>({x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}),a=u(n,i),o=t=>ut(e,t),s=[...e.layers].reverse(),c=e=>!e.hidden&&e.shown!==void 0&&d(n,{x:t.x+e.shown.left*t.zoom,y:t.y+e.shown.top*t.zoom,width:e.shown.width*t.zoom,height:e.shown.height*t.zoom}),l=s.filter(e=>e.kind!==`group`&&!o(e)&&c(e)),f=l.length>0?l:s.filter(e=>e.kind!==`group`&&c(e)),p=new Set,m=new Map(e.layers.map(e=>[e.key,e.parent]));for(let e of f)for(let t=e.parent;t!==void 0;t=m.get(t))p.add(t);let h=new Set([...f.map(e=>e.key),...p]);return s.filter(e=>h.has(e.key)).map(o=>{let s=[{in:`board ${e.key}`,width:e.width,height:e.height,...a,scale:1/t.zoom}],c=o.info.picture;if(c&&c.whole[2]>0&&c.whole[3]>0){let[e,r,a,o]=c.whole,[l,d]=c.source;s.push({in:`the picture`,file:c.file,width:l,height:d,...u(n,t=>{let n=i(t);return{x:(n.x-e)*l/a,y:(n.y-r)*d/o}}),scale:l/a/t.zoom})}return{...dt(e,o,r),regions:s}})}var ut=(e,t)=>(t.kind===`adjustment`||t.kind===`fill`)&&t.box!==void 0&&t.box.left<=0&&t.box.top<=0&&t.box.left+t.box.width>=e.width&&t.box.top+t.box.height>=e.height;function dt(e,t,n){let r=t.info.picture,i=t.info.words[0]?.text??t.info.texts[0]?.text,a=n.lineOf(t.key);return{name:`layer ${t.name===t.key?`"${t.key}"`:`"${t.key}" (${t.name})`}, a ${t.kind}${r?` of ${r.file}`:``}, of board ${e.key}`,source:{path:n.file,...a===void 0?{}:{line:a}},...i===void 0?{}:{text:i}}}function ft(e,t,n){let r=(n.x-t.x)/t.zoom,i=(n.y-t.y)/t.zoom,a=e=>!e.hidden&&e.kind!==`group`&&e.shown!==void 0&&r>=e.shown.left&&r<=e.shown.left+e.shown.width&&i>=e.shown.top&&i<=e.shown.top+e.shown.height,o=[...e.layers].reverse();return o.find(t=>a(t)&&!ut(e,t))??o.find(a)}function pt(e,t,n,r){if(n.shown!==void 0)return{element:dt(e,n,r),outline:c({x:t.x+n.shown.left*t.zoom,y:t.y+n.shown.top*t.zoom,width:n.shown.width*t.zoom,height:n.shown.height*t.zoom})}}function mt(e,t){let n=e.split(`
3
- `).findIndex(e=>RegExp(`key:\\s*["'\`]${t.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}["'\`]`,`u`).test(e));return n<0?void 0:n+1}var ht=e=>e===void 0?void 0:{left:e[0],top:e[1],width:e[2],height:e[3]};function gt(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height);return i>n&&a>r?{left:n,top:r,width:i-n,height:a-r}:void 0}function _t(e){let t=new Map;for(let n of e){let e=n.info.style.clipping===!0&&n.kind!==`group`,r=e?t.get(n.parent):void 0;n.shown=r===void 0?n.box:r.shown&&n.box?gt(n.box,r.shown):void 0,e||t.set(n.parent,n)}}function vt(e,t,n){let r=t.layers.map(e=>({key:e.key,name:e.key,component:e.component,kind:e.kind,hidden:e.hidden,parent:e.parent,box:ht(e.box),shown:void 0,info:e}));return _t(r),{version:e,key:t.key,title:t.title??t.key,width:t.width,height:t.height,background:t.background,picture:n,layers:r}}function yt(e,t,n){return e.flatMap(e=>{let r=t.get(e.key);return r?[r.boards.map(t=>vt(e,t,n(t.picture)))]:[]})}var Y=48,bt=80,xt=20,St=22,Ct=26,X=40,Z=(e,t)=>`${e} ${t}`;function wt(e){let t=[];for(let n of e)n.forEach((e,n)=>{t[n]=Math.max(t[n]??0,e.width)});return t}var Tt=e=>Math.max(xt,bt*e);function Et(e,t){let n=wt(e),r=e.length>1;return{width:n.reduce((e,n)=>e+n*t,0)+Tt(t)*Math.max(0,n.length-1)+96,height:e.reduce((e,n)=>e+Math.max(0,...n.map(e=>e.height))*t+St+(r?Ct:0),0)+X*Math.max(0,e.length-1)+96}}function Dt(e,t,n,r){let i=wt(e),a=Tt(t),o=Et(e,t),s=Math.max(0,((r?.width??0)-o.width)/2),c=Math.max(0,((r?.height??0)-o.height)/2),l=new Map,u=[],d=c+Y,f=0,p=e.length>1;for(let r of e){let e=r[0];p&&e&&(u.push({x:s+Y,y:d,label:n(e)}),d+=Ct);let o=d;d+=St;let c=s+Y,m=0;r.forEach((e,n)=>{l.set(Z(e.version.key,e.key),{x:c,y:d,labelY:o}),c+=(i[n]??e.width)*t+a,m=Math.max(m,e.height*t)}),f=Math.max(f,c-a+Y+s),d+=m+X}return{width:f,height:d-X+Y+c,boards:l,rows:u}}function Ot(e,t){let n=wt(e);if(n.length===0||t.width<=0||t.height<=0)return 1;let r=n.reduce((e,t)=>e+t,0),i=n.length-1,a=(t.width-96)/(r+bt*i),o=bt*a>=xt?a:(t.width-96-xt*i)/r,s=e.reduce((e,t)=>e+Math.max(...t.map(e=>e.height)),0),c=e.length*(St+(e.length>1?Ct:0))+X*(e.length-1),l=Math.min(o,(t.height-96-c)/s,1);return Math.max(.02,l)}var Q=e=>`${String(e)}px`,$=e=>`${String(e*100)}%`;function kt(e){let t=e.board.layers.find(t=>t.key===e.layer)?.shown;return t?(0,L.jsx)(`div`,{"data-note-chrome":``,"data-testid":e.selected?`image-selected`:`image-hovered`,"data-layer":e.layer,className:e.selected?`outline-pencil absolute shadow-[0_0_0_4px_var(--color-sheet),inset_0_0_0_2px_var(--color-sheet)] outline-2`:`outline-pencil absolute shadow-[0_0_0_2px_var(--color-sheet),inset_0_0_0_1px_var(--color-sheet)] outline-1`,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)},children:e.selected&&e.bar!==void 0?(0,L.jsx)(`div`,{className:`pointer-events-auto absolute top-full left-1/2 mt-2 -translate-x-1/2`,children:e.bar}):null}):null}function At(e){let t=(e.agent.layer===void 0?void 0:e.board.layers.find(t=>t.key===e.agent.layer))?.box;return t?(0,L.jsx)(I,{"data-testid":`image-agent`,label:e.agent.label,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)}}):(0,L.jsx)(I,{"data-testid":`image-agent`,label:e.agent.label,flag:`end`,className:`inset-0`})}function jt(e){let t=R(),{board:n,zoom:r}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-lead text-micro absolute flex h-5 items-end gap-2 truncate`,style:{left:Q(e.at.x),top:Q(e.at.labelY),width:Q(n.width*r)},"data-testid":`image-board-label`,children:[(0,L.jsx)(`span`,{className:`text-ink truncate font-medium`,children:n.title}),n.title.replace(/\s/gu,``).toLowerCase().replace(`×`,`x`).includes(`${String(n.width)}x${String(n.height)}`)?null:(0,L.jsx)(`span`,{className:`tabular-nums`,children:t.size(n.width,n.height)})]}),(0,L.jsxs)(`div`,{className:`bg-sheet absolute overflow-hidden shadow-[0_0_0_1px_var(--color-rule)]`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},"data-testid":`image-board`,"data-board":n.key,"data-version":n.version.key,children:[(0,L.jsx)(`img`,{src:n.picture,alt:``,draggable:!1,className:`absolute inset-0 size-full max-w-none select-none`}),e.frame]}),e.agent||e.hovered!==void 0||e.selected!==void 0?(0,L.jsxs)(`div`,{className:`pointer-events-none absolute`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},children:[e.agent?(0,L.jsx)(At,{board:n,agent:e.agent}):null,e.hovered===void 0?null:(0,L.jsx)(kt,{board:n,layer:e.hovered,selected:!1}),e.selected===void 0?null:(0,L.jsx)(kt,{board:n,layer:e.selected,selected:!0,bar:e.selectionBar})]}):null]})}function Mt({ref:e,...t}){let n=(0,q.useRef)(null),r=(0,q.useCallback)(t=>{n.current=t,typeof e==`function`?e(t):e&&(e.current=t)},[e]),i=(0,q.useRef)(t.onZoomAt);return(0,q.useEffect)(()=>{i.current=t.onZoomAt}),(0,q.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let n=e.getBoundingClientRect();i.current(Math.exp(-t.deltaY/200),{x:t.clientX-n.left,y:t.clientY-n.top})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[]),(0,L.jsx)(`div`,{ref:r,className:`bg-stone focus-visible:outline-pencil relative min-h-0 min-w-0 flex-1 overflow-auto outline-none focus-visible:-outline-offset-1 focus-visible:outline-1`,tabIndex:0,role:`application`,"aria-label":t.label,"data-testid":`image-surface`,style:{cursor:t.cursor},onPointerDown:t.onPointerDown,onPointerMove:t.onPointerMove,onPointerUp:t.onPointerUp,onPointerCancel:t.onPointerUp,onLostPointerCapture:t.onPointerUp,onPointerLeave:t.onPointerLeave,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,children:(0,L.jsxs)(`div`,{className:`relative`,style:{width:Q(t.layout.width),height:Q(t.layout.height)},"data-testid":`image-world`,children:[t.layout.rows.map(e=>(0,L.jsx)(`div`,{className:`text-lead absolute text-xs font-medium`,style:{left:Q(e.x),top:Q(e.y)},"data-testid":`image-row-label`,children:e.label},e.y)),t.rows.flatMap(e=>e.map(e=>{let n=Z(e.version.key,e.key),r=t.layout.boards.get(n);return r?(0,L.jsx)(jt,{board:e,zoom:t.zoom,at:r,frame:t.frame?.(n,e.picture),agent:t.agent?.id===n?{label:t.agent.label,layer:t.agent.layer}:void 0,hovered:t.hovered?.id===n?t.hovered.layer:void 0,selected:t.selected?.id===n?t.selected.layer:void 0,selectionBar:t.selectionBar},n):null}))]})})}function Nt(e,t){if(e!==void 0)try{return new Intl.DisplayNames([t??`en`],{type:`language`}).of(e)}catch{return e}}var Pt=3e4;function Ft(e){let t=e?.board??e?.part;if(typeof t!=`string`)return;let n=e?.layer;return typeof n==`string`?{board:t,layer:n}:{board:t}}var It=e=>e instanceof Element&&e.closest(`input, textarea, [contenteditable='true'], [role='combobox']`)!==null;function Lt(e){return e.bar(e.tools)}function Rt(e){let n=R(),i=s(),o=r(),c=(0,q.useMemo)(()=>yt(e.data.versions,e.data.drawn,rt),[e.data.versions,e.data.drawn]),u=c.flat(),d=(0,q.useRef)(null),[f,p]=(0,q.useState)(),[m,h]=(0,q.useState)(!0),[g,_]=(0,q.useState)(`default`),[v,y]=(0,q.useState)(!1),b=(0,q.useRef)(void 0),x=e=>[Nt(e.version.lang,o?.locale),e.version.variant].filter(e=>e!==void 0).join(` · `)||e.version.key,[S,C]=(0,q.useState)();(0,q.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{C(t=>t?.width===e.offsetWidth&&t.height===e.offsetHeight?t:{width:e.offsetWidth,height:e.offsetHeight})};t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[]);let w=m&&S&&c.length>0?Ot(c,S):f??1,ee=(0,q.useMemo)(()=>Dt(c,w,x,S),[c,w,o?.locale,S]),T=(0,q.useRef)(void 0);(0,q.useLayoutEffect)(()=>{let e=d.current,t=T.current;if(!e||!t)return;T.current=void 0;let n=w/t.from;e.scrollLeft=(e.scrollLeft+t.at.x)*n-t.at.x,e.scrollTop=(e.scrollTop+t.at.y)*n-t.at.y},[w]);let E=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(E.current||e.board===void 0||c.length===0)return;let t=d.current?.querySelector(`[data-testid="image-board"][data-board="${CSS.escape(e.board)}"]`);t&&(E.current=!0,t.scrollIntoView({block:`nearest`,inline:`nearest`}))},[e.board,c.length,ee]);let{agent:D,following:te}=t(),O=ce(),k=(()=>{if(D?.doing===void 0)return;let{landed:t,sources:n}=e.data,r=D.source,i=r?.path!==void 0&&r.path===n?.path&&r.from!==void 0?tt(n.boards,r.from,r.to):void 0,a=t&&t.at>=D.at-Pt?t:void 0,o=Ft(D.place)??i??a?.spot;if(!o)return;let s=u.filter(e=>e.key===o.board),c=s.find(e=>e.version.key===a?.version)??s[0];if(!c)return;let l=c.layers.some(e=>e.key===o.layer)?o.layer:void 0;return{id:Z(c.version.key,c.key),layer:l,label:O(D)}})(),A=te&&k?`${k.id}\n${k.layer??``}`:void 0;(0,q.useEffect)(()=>{let e=d.current;if(A===void 0||!e)return;let[t=``,n=``]=A.split(`
4
- `),r=u.find(e=>Z(e.version.key,e.key)===t),i=ee.boards.get(t);if(!r||!i)return;let a=r.layers.find(e=>e.key===n)?.box??{left:0,top:0,width:r.width,height:r.height},o=(e,t,n,r)=>t+96>r||e-48<n?e-48:e+t+48>n+r?e+t+48-r:n;e.scrollTo({left:o(i.x+a.left*w,a.width*w,e.scrollLeft,e.clientWidth),top:o(i.y+a.top*w,a.height*w,e.scrollTop,e.clientHeight)})},[A]);let ne=ot({item:e.data.item,wanted:u.map(e=>({id:Z(e.version.key,e.key),version:e.version.key,board:e.key})),revision:e.data.revision}),re=(e,t)=>{h(!1);let n=d.current;T.current={at:t??{x:(n?.clientWidth??0)/2,y:(n?.clientHeight??0)/2},from:w},p(Math.min(8,Math.max(.02,e)))},j=e=>{e===`fit`?h(!0):re(typeof e==`number`?e:w*(e===`in`?1.25:.8))},ie=(e,t)=>d.current?.querySelector(`[data-testid="image-board"][data-version="${CSS.escape(e)}"][data-board="${CSS.escape(t)}"]`)?.getBoundingClientRect(),ae=(0,q.useRef)(``),M=e=>{for(let t of u){let n=ie(t.version.key,t.key);if(n&&e.x>=n.left&&e.x<=n.right&&e.y>=n.top&&e.y<=n.bottom)return{b:t,r:n}}},oe=de()!==void 0,[se,N]=(0,q.useState)(),[P,me]=(0,q.useState)(),F=(e,t)=>({x:e.x,y:e.y,zoom:e.width/t.width}),ve=e=>{let t=M(e),n=t?ft(t.b,F(t.r,t.b),e):void 0;return t&&n?{id:Z(t.b.version.key,t.b.key),layer:n.key}:void 0},ye=(e,t)=>e?.id===t?.id&&e?.layer===t?.layer,xe={file:e.entry,lineOf:e=>mt(ae.current,e)},I=t=>{let n=Nt(t.version.lang,`en`);return`on board ${t.key}${n===void 0||e.data.versions.length<2?``:` (${n})`}`},Se=e=>{d.current?.focus({preventScroll:!0});let t=d.current;if(oe&&!v&&e.button!==1){let t=ve({x:e.clientX,y:e.clientY});(e.button===0||t)&&me(t)}(v||e.button===1)&&t&&(e.currentTarget.setPointerCapture(e.pointerId),b.current={x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},_(`grabbing`))},z=()=>{b.current&&(b.current=void 0,_(v?`grab`:`default`))};return a({hold:async()=>(ae.current=await i[`files/read`]({path:e.entry}).then(e=>e.text,()=>``),{key:`${e.entry}@${String(e.data.revision)}`,what:`The image ${e.entry}, its boards side by side${e.data.versions.length>1?`, a version a row`:``}`,source:{path:e.entry}}),locate:t=>{let n=l(t)[0],r=n?M(n):void 0;if(!n||!r)return Promise.resolve({elements:[]});let i=Nt(r.b.version.lang,`en`),a=e=>`${String(Math.round(Math.min(1,Math.max(0,e))*100))}%`,o=a((n.x-r.r.x)/r.r.width),s=a((n.y-r.r.y)/r.r.height);return Promise.resolve({elements:lt(r.b,{x:r.r.x,y:r.r.y,zoom:r.r.width/r.b.width},t,{file:e.entry,lineOf:e=>mt(ae.current,e)}),where:`on board ${r.b.key}${i===void 0||e.data.versions.length<2?``:` (${i})`}, at ${o} across and ${s} down it`})},pick:e=>{let t=M(e),n=t?ft(t.b,F(t.r,t.b),e):void 0,r=t&&n?pt(t.b,F(t.r,t.b),n,xe):void 0;return Promise.resolve(t&&r?{...r,where:I(t.b)}:void 0)},selected:()=>{let e=u.find(e=>Z(e.version.key,e.key)===P?.id),t=e?.layers.find(e=>e.key===P?.layer),n=e?ie(e.version.key,e.key):void 0,r=e&&t&&n?pt(e,F(n,e),t,xe):void 0;return Promise.resolve(e&&r?[{...r,where:I(e)}]:[])}}),(0,L.jsxs)(`div`,{className:`relative flex size-full min-h-0 flex-col`,"data-testid":`image-viewer`,children:[(0,L.jsx)(Lt,{bar:e.bar,tools:{zoom:w,onZoom:j}}),(0,L.jsxs)(pe,{children:[(0,L.jsx)(le,{asChild:!0,children:(0,L.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[e.data.error===void 0?null:(0,L.jsx)(be,{}),(0,L.jsx)(Mt,{ref:d,rows:c,layout:ee,zoom:w,cursor:v&&g==="default"?`grab`:g,frame:ne.frame,agent:k,hovered:ye(se,P)?void 0:se,selected:P,selectionBar:(0,L.jsx)(ue,{}),onPointerLeave:()=>{N(void 0)},onPointerDown:Se,onPointerMove:e=>{let t=b.current,n=d.current;if(t&&e.buttons===0){z();return}if(t&&n){n.scrollLeft=t.left-(e.clientX-t.x),n.scrollTop=t.top-(e.clientY-t.y);return}if(!oe)return;let r=v||e.buttons!==0?void 0:ve({x:e.clientX,y:e.clientY});ye(r,se)||N(r)},onPointerUp:z,onKeyDown:e=>{if(It(e.target))return;let t=e.metaKey||e.ctrlKey,n=e.key===`Escape`&&P?()=>{me(void 0)}:e.key===` `?()=>{e.repeat||y(!0),_(`grab`)}:e.shiftKey&&e.code===`Digit1`?()=>{j(`fit`)}:e.shiftKey&&e.code===`Digit0`?()=>{j(1)}:t&&(e.key===`=`||e.key===`+`)?()=>{j(`in`)}:t&&e.key===`-`?()=>{j(`out`)}:void 0;n&&(e.preventDefault(),n())},onKeyUp:e=>{e.key===` `&&(y(!1),_(`default`))},onZoomAt:(e,t)=>{re(w*e,t)},label:n.boards})]})}),(0,L.jsxs)(_e,{className:`w-60`,"data-testid":`image-menu`,children:[(0,L.jsxs)(fe,{onSelect:()=>{j(`fit`)},children:[n.zoomFit,(0,L.jsx)(ge,{children:`⇧1`})]}),(0,L.jsx)(he,{})]})]})]})}var zt=e=>typeof e==`object`&&!!e&&typeof e.board==`string`;function Bt(){let e=R(),t=r(),n=it(t?.item.id);if(n.piece===void 0||t===void 0)return(0,L.jsx)(`div`,{className:`text-lead bg-paper flex size-full items-center justify-center text-sm`,"data-testid":`image-editor`,"data-state":n.error===void 0?`loading`:`updating`,children:n.error===void 0?(0,L.jsx)(ye,{label:e.loading}):(0,L.jsx)(xe,{})});let i=zt(t.place)?t.place:void 0;return(0,L.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,"data-testid":`image-editor`,"data-state":`ready`,children:[(0,L.jsx)(Rt,{entry:t.item.entry,data:n,board:i?.board,bar:t=>(0,L.jsx)(P,{start:(0,L.jsx)(F,{testid:`image-bar`,"aria-label":e.zoom,children:(0,L.jsx)(Ce,{...t})}),exports:{versions:n.versions.map(e=>({key:e.key,label:e.lang??e.key})),facts:e.boardCount(n.drawn.values().next().value?.boards.length??0)}})}),n.drawn.size>0&&[...n.drawn.values()].every(e=>e.boards.length===0)?(0,L.jsx)(`p`,{className:`text-lead p-6 text-sm`,children:e.noBoards}):null]})}export{Bt as ImageEditor,Bt as default,Se as WORDS};