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.
- package/dist/command.js +1 -1
- package/dist/commands/dev.js +5 -5
- package/dist/commands/export.js +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/list.js +1 -1
- package/dist/commands/run.js +2 -0
- package/dist/commands/schedule.js +4 -0
- package/dist/commands.json +1 -1
- package/dist/main.js +8 -8
- package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/blocks/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/migrate.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
- package/dist/node_modules/@allyhub/build/dist/project-root.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/scheduled-tasks.js +2 -0
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +2 -1
- package/dist/node_modules/@allyhub/dev-server/dist/validate.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/deck-code.d.ts +3 -3
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +151 -151
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +173 -173
- package/dist/node_modules/@allyhub/formats/dist/data/work.d.ts +1 -2
- package/dist/node_modules/@allyhub/formats/dist/data/work.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +2 -0
- package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +106 -101
- package/dist/node_modules/@allyhub/formats/dist/schemas.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/tolerant.d.ts +26 -1
- package/dist/node_modules/@allyhub/formats/dist/tolerant.js +1 -1
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/html-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/paywall.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/scheduled-tasks.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/package.json +5 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/report-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/dist/index.js +6 -6
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/file.js +2 -2
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/file.js +3 -3
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/build.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/package.json +1 -1
- package/dist/node_modules/@allyhub/text-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +15 -15
- package/dist/run-register.js +2 -0
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-B4tvwU6C.js → abnfDiagram-WEYOIA3C-OIbGwO0P.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-V2fA0vY2.js → architecture-WOLXFQ4H-i87EDk8h.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-B6B7XN0M.js → architectureDiagram-ZHVYKT53-DRsgKDbu.js} +1 -1
- package/editor-web/assets/article-BVbLqhwK.js +3 -0
- package/editor-web/assets/article-BxkgemqI.js +7 -0
- package/editor-web/assets/bar-button-BJ-_6g-F.js +1 -0
- package/editor-web/assets/{blockDiagram-RJAE7QA3-BizcUGOM.js → blockDiagram-RJAE7QA3-k_lanKyI.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-CBHS0dQ0.js → c4Diagram-XDPPPE54-BFJTpM5w.js} +1 -1
- package/editor-web/assets/{calc-worker-Cr4a0xmt.js → calc-worker-BpAgQE9E.js} +3 -3
- package/editor-web/assets/channel-CDJSUIp1.js +1 -0
- package/editor-web/assets/chevron-right-7tjLd0X4.js +1 -0
- package/editor-web/assets/chip-lvclIKGj.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-CMPBck_Q.js → chunk-2E7WHVMD-Bbfj2q42.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-Df22Adpt.js → chunk-4EMNKR2T-iKWsgYqL.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-CYrZ6_Q7.js → chunk-55XCU76K-WwcsywWu.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-BfdG9NNW.js → chunk-7S6XSTFO-BEEtZTsQ.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-BCzZMoTJ.js → chunk-AQDTSKZB-ZT2PBdLK.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-DT0xT8Wf.js → chunk-DSNLSHJZ-BDlY4xos.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-Bg3-EotU.js → chunk-HAGFOTED-Yp6V4sx6.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-BrSym24V.js → chunk-HNE4Q36P-C6IdGLw2.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-CMxgkJWF.js → chunk-NQOKRVIF-D3gs_SMr.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-DWEwoyPy.js → chunk-UHW7PFBP-Byf0dX4X.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-eTFh5_T9.js → chunk-VQ5W62QI-n9lsvBOX.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-4PTupr9T.js → chunk-WQQL4CDK-BW540sO1.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-D5XAAFWm.js → chunk-YZO67HFG-CWL9cioT.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-CPsdaisO.js → chunk-ZAUX2LTX-D9zlkFeQ.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-ClnuUyfy.js → chunk-ZCHMQSOR-nieSgKB5.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-CM21waNF.js → classDiagram-v2-4MYWR3UA-BXamBIDc.js} +1 -1
- package/editor-web/assets/{color-picker-BmKFn2ww.js → color-picker-XpkmmKxv.js} +1 -1
- package/editor-web/assets/context-menu-pSruvRyd.js +1 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-CJUHTgee.js → cynefin-EF2NZ3EQ-CVKVgqFb.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-C9RIfuIV.js → cynefinDiagram-WF24UDRP-r0bqUe5X.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-g-01KdpO.js → dagre-NK4GIZVX-4q_IUjiM.js} +1 -1
- package/editor-web/assets/deck-cyd6f3QU.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-CbOjWUu-.js → diagram-CBK3MWTC-CDh12DaH.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-C6psNS8J.js → diagram-I5XIIV2D-C_sqASp8.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-C9PUE46P.js → diagram-ODIL2UCW-QgoMb-iS.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-vJ_pnB33.js → diagram-PFBEJUXE-Djhv4RT6.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-FwYlEfJ-.js → diagram-RJA3I4VV-CvVswF4l.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-FKpIxeUc.js → diagram-TYUNFSNR-DLnbV741.js} +1 -1
- package/editor-web/assets/dist-BK-WZ2ce.js +3 -0
- package/editor-web/assets/dist-CQ8-PJqF.js +16 -0
- package/editor-web/assets/dist-CQElMvxC.js +4 -0
- package/editor-web/assets/{dist-Cg0Z26Kv.js → dist-D49XAtID.js} +4 -4
- package/editor-web/assets/{dist-DH8oJJw9.js → dist-DDQLLUz5.js} +3 -3
- package/editor-web/assets/{dist-BI_BaYhO.js → dist-DO2VygfS.js} +4 -4
- package/editor-web/assets/dist-DOoUVqs_.js +24 -0
- package/editor-web/assets/{dist-D2rGVz9C.js → dist-DUyJ8AI0.js} +1 -1
- package/editor-web/assets/dist-DlDgR_Er.js +1 -0
- package/editor-web/assets/dist-Dw7AH_ip.js +6 -0
- package/editor-web/assets/{dist-H0z_DXDz.js → dist-Dx3tLwZ1.js} +17 -17
- package/editor-web/assets/{dist-CtYjYJdv.js → dist-F7lLi27Y.js} +1 -1
- package/editor-web/assets/dist-OfUZ68xY.js +547 -0
- package/editor-web/assets/{dist-CB-_0-X4.js → dist-OyPpS4AG.js} +28 -28
- package/editor-web/assets/dist-QCvBWMrp.js +5 -0
- package/editor-web/assets/{dist-D07Kj8GR.js → dist-RppJbSHJ.js} +1 -1
- package/editor-web/assets/dist-ZFgjTFWK.js +19 -0
- package/editor-web/assets/{dist-BqijryYd.js → dist-onYtssQw.js} +1 -1
- package/editor-web/assets/{docx-draw-Dxb67W2d.js → docx-draw-BBI4k72R.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-DBymUM-F.js → ebnfDiagram-V4P3TTPT-BoiJRPsL.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-BNYR3OlS.js → elk-QONTBCTQ-BDiBwn0f.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-cTNyOqW6.js → erDiagram-KYQIGQAA-DaA3jdNm.js} +1 -1
- package/editor-web/assets/esm-BWIRT8Yl.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-C6FUZeXP.js → eventmodeling-K75KTNOO-j7ZSOAed.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-Cb-xQSAJ.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-LD9mqQ1x.js → ganttDiagram-R7GPNTJY-CyNcjwUZ.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-CtCBcQFl.js → gitGraph-VSP46ZUC-BuzoK22Z.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-DYQpOozz.js → gitGraphDiagram-PDYL7XHY--lzum_QP.js} +1 -1
- package/editor-web/assets/index-BSd85XUU.js +28 -0
- package/editor-web/assets/{info-OHQRW6UA-IXInKPRO.js → info-OHQRW6UA-rs42SY_Y.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-Ds7Cei7T.js → infoDiagram-MVDRKAX5-BjedWKrM.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-DWs3qtAX.js → ishikawaDiagram-HPEHV2GE-Dtqm_gq7.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-BkNKVYBA.js → journeyDiagram-BOSHW7O7-J0dA2yU0.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-D3dMswnI.js → kanban-definition-FNSA4HC5-DV13v0Uf.js} +1 -1
- package/editor-web/assets/layout-CuWN7_3k.js +1 -0
- package/editor-web/assets/{mermaid-parser.core-D_W_0X0N.js → mermaid-parser.core-B7bZFHzS.js} +3 -3
- package/editor-web/assets/{mermaid.core-Bkirj-s5.js → mermaid.core-DQ10-Otk.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-CMKkAAvI.js → mindmap-definition-6OY57UG3-DgdXGBCF.js} +1 -1
- package/editor-web/assets/{packet-JDAUHWVQ-CzCkgCfg.js → packet-JDAUHWVQ-ZNSLC_YL.js} +1 -1
- package/editor-web/assets/{panes-BexRuZd2.js → panes-1hRg6CCN.js} +2 -2
- package/editor-web/assets/{pegDiagram-ECIUJNBX-C8qHkx7M.js → pegDiagram-ECIUJNBX-nBIsHepE.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-BJqgxMrD.js → pie-XZMESJXO-CXen6okO.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-DyNntV5y.js → pieDiagram-GNMPY74T-BlimMsUq.js} +1 -1
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-BHa-69ir.js → quadrantDiagram-D57K4MC3-D_B7p8XB.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-BeRPjBBR.js → radar-ABXABTNO-DFfRPPEM.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-BaRQqRsK.js → railroad-I3PHUGI6-DS8ly7WZ.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-BZfwomxZ.js → railroad-abnf-LNEFI6M7-Coohlgpw.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DbgqpEF5.js → railroad-ebnf-DWYD2UWJ-CvcfKbZc.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-BYOf3PsQ.js → railroad-peg-JR7BVNR7-jRtVHKtg.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-B5OAzOsD.js → railroadDiagram-Y72NRBL7-kWUIDPHg.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-wqYNoqO0.js → requirementDiagram-EQYSW5RA-C39Gfdi-.js} +1 -1
- package/editor-web/assets/ribbon-tabs-5R-_EtHp.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-Crf6GRsa.js → sankeyDiagram-SY24JHO5-DtSQ2N2q.js} +1 -1
- package/editor-web/assets/schemas-CnlOL0u4.js +1 -0
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-DUcHz4_d.js → sequenceDiagram-BLEHNHQU-BZx9gAR1.js} +1 -1
- package/editor-web/assets/{session--OJYv_B7.js → session-2pd0mFQm.js} +1 -1
- package/editor-web/assets/{snapshots-DYooVfOx.js → snapshots-8hCkRemI.js} +1 -1
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-DbeLdnpS.js → stateDiagram-v2-A6IESKWZ-E9qhWPa3.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-BDi6AeJI.js → swimlanes-B3ENRKFQ-C6vD9fmU.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-D_DL_JP0.js +8 -0
- package/editor-web/assets/themes-D_ISkWVz.js +1 -0
- package/editor-web/assets/{timeline-definition-JXYKGLGB-B0awa2hh.js → timeline-definition-JXYKGLGB-CT8AKsKE.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-C91G0IGm.js → treeView-D4JQ5SDB-DA2iE5aC.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-CiOWiwl2.js → treemap-SAJKECNS-RgrBf6Sq.js} +1 -1
- package/editor-web/assets/{updating-D0GEtwnJ.js → updating--4wIxO0k.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-DMYM1MRe.js → usecaseDiagram-WPOLBNNX-DfIcy0_F.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DQIJ5vvN.js → vennDiagram-Q3Y3IDCW-DxTSyNH7.js} +1 -1
- package/editor-web/assets/{video-mMOFXHYK.js → video-yjnj5UY2.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-C3H9HG8r.js → wardley-7MLQ67FV-pow5gWxU.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-DgsjqY1Y.js → wardleyDiagram-IVAIDKWA-Dar0j9HS.js} +1 -1
- package/editor-web/assets/{workbook-NtMEyLgf.js → workbook-7fUt0Qgy.js} +1 -1
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DzsGI527.js → xychartDiagram-4URNHDU4-qCxuQZMj.js} +1 -1
- package/editor-web/index.html +5 -3
- package/package.json +2 -2
- package/editor-web/assets/article-DW4eD_8K.js +0 -3
- package/editor-web/assets/article-Dm2dIEwc.js +0 -7
- package/editor-web/assets/bar-button-CJmpgNg4.js +0 -1
- package/editor-web/assets/channel-dyUtlVPg.js +0 -1
- package/editor-web/assets/chip-BdQRH3FL.js +0 -1
- package/editor-web/assets/deck-C0VxrlzX.js +0 -1
- package/editor-web/assets/dist-BaWFMuvr.js +0 -1
- package/editor-web/assets/dist-BdmMT8fP.js +0 -5
- package/editor-web/assets/dist-BgKyM9U6.js +0 -3
- package/editor-web/assets/dist-ByguWp3a.js +0 -16
- package/editor-web/assets/dist-CCP24Lel.js +0 -19
- package/editor-web/assets/dist-D3DwRF1k.js +0 -547
- package/editor-web/assets/dist-DCI21ljp.js +0 -6
- package/editor-web/assets/dist-DJvfQvM7.js +0 -24
- package/editor-web/assets/dist-DmCDcb2_.js +0 -4
- package/editor-web/assets/esm-Cl3GKSDd.js +0 -21
- package/editor-web/assets/flowDiagram-IUGLLWBU-ukTovy07.js +0 -1
- package/editor-web/assets/index-omhSywJb.js +0 -28
- package/editor-web/assets/ribbon-tabs-B3IC9WOt.js +0 -1
- package/editor-web/assets/schemas-C21MyseF.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-2wwOmxbv.js +0 -8
- package/editor-web/assets/tolerant-DM9s0Mt1.js +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
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,M as ee,N as te,S as ne,_ as re,b as A,g as ie,j,x as ae}from"./snapshots-8hCkRemI.js";import{t as oe}from"./session-2pd0mFQm.js";import{r as se,t as ce}from"./schemas-CnlOL0u4.js";import{t as M}from"./jsx-runtime-DePvh3-m.js";import{a as N,h as le,i as P,l as ue,m as de,n as fe,o as pe,t as me}from"./bar-button-BJ-_6g-F.js";import{a as he,h as ge,i as _e,m as ve,n as ye,r as F}from"./dist-Dw7AH_ip.js";import{i as I,n as be,r as L,t as R}from"./hint-F4fIBnVU.js";import{t as z}from"./createLucideIcon-euu7Wcd9.js";import{t as xe}from"./audio-lines-BFoW_IeO.js";import{n as Se,t as Ce}from"./undo-2-DCbMWoug.js";import{t as B}from"./scissors-m6QcoEf2.js";import{J as we,R as Te,n as Ee,t as De}from"./index-BSd85XUU.js";import{n as Oe,r as ke,t as Ae}from"./updating--4wIxO0k.js";import{n as V,r as je,t as Me}from"./collaborator-CbTacvkB.js";import{a as Ne,c as Pe,d as Fe,j as Ie,n as H,r as Le,s as Re,t as ze}from"./dist-DIJnhQFK.js";var Be=[`error`,`saving`,`unsaved`,`saved`],U=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=oe.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 Be.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()))}},W=z(`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`}]]),G=z(`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`}]]),Ve=z(`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`}]]),He=z(`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`}]]),Ue=z(`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`}]]),We=z(`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`}]]),Ge=z(`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`}]]),Ke=z(`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`}]]),qe=z(`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`}]]),Je=z(`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=M(),Ye=e=>Number.isFinite(e)&&e>0?e:0,J=e=>{let t=Ye(e);return`${String(Math.floor(t/60))}:${String(Math.floor(t%60)).padStart(2,`0`)}`},Y=e=>{let t=Ye(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({...A,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()}),ie,`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(A),x({timeline:Qe,text:D(b())}),`A version's timeline, drawn nowhere.`),"video/still":k(x({...A,t:S().nonnegative().optional()}),x({t:S(),image:ne,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({...A,moments:D(S().nonnegative()).min(1).max(32)}),x({stills:D(x({t:S(),image:ne}))}),"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=ae(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`,undo:`Undo`,redo:`Redo`,undoWhat:e=>`Undo ${e}`,redoWhat:e=>`Redo ${e}`,cutWords:`Cut`,keepWords:`Keep`,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:`文稿`,undo:`撤销`,redo:`重做`,undoWhat:e=>`撤销「${e}」`,redoWhat:e=>`重做「${e}」`,cutWords:`剪掉`,keepWords:`保留`,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:`文稿`,undo:`復原`,redo:`重做`,undoWhat:e=>`復原「${e}」`,redoWhat:e=>`重做「${e}」`,cutWords:`剪掉`,keepWords:`保留`,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:`台本`,undo:`取り消す`,redo:`やり直す`,undoWhat:e=>`「${e}」を取り消す`,redoWhat:e=>`「${e}」をやり直す`,cutWords:`カット`,keepWords:`残す`,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:`대본`,undo:`실행 취소`,redo:`다시 실행`,undoWhat:e=>`'${e}' 실행 취소`,redoWhat:e=>`'${e}' 다시 실행`,cutWords:`자르기`,keepWords:`남기기`,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`,undo:`Deshacer`,redo:`Rehacer`,undoWhat:e=>`Deshacer: ${e}`,redoWhat:e=>`Rehacer: ${e}`,cutWords:`Cortar`,keepWords:`Mantener`,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`,undo:`Annuler`,redo:`Rétablir`,undoWhat:e=>`Annuler : ${e}`,redoWhat:e=>`Rétablir : ${e}`,cutWords:`Couper`,keepWords:`Garder`,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`,undo:`Rückgängig`,redo:`Wiederholen`,undoWhat:e=>`Rückgängig: ${e}`,redoWhat:e=>`Wiederholen: ${e}`,cutWords:`Schneiden`,keepWords:`Behalten`,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`,undo:`Desfazer`,redo:`Refazer`,undoWhat:e=>`Desfazer: ${e}`,redoWhat:e=>`Refazer: ${e}`,cutWords:`Cortar`,keepWords:`Manter`,resizeScript:`Largura do roteiro`,resizeTimeline:`Altura da linha do tempo`}});function X(){return rt.of(i()?.locale)}var it={...re,...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 ae(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 we(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 Z=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?Z[n.tabSize||4]??zt(Z[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?Z[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(Z[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=Z[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=Z[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():Z[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():Z[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=Z[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=Z[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=Z[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===Z[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=U.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={jumpAtLeast:1,endWithin:.25},On=e=>Math.round(e*10)/10,kn=class{o;seconds=0;at;constructor(e){this.o={...Dn,...e}}heard(e,t,n){this.at===void 0?t&&(this.at=e):(this.count(e),t||this.end(e>=n-this.o.endWithin,n))}left(e){this.at!==void 0&&this.end(!1,e)}count(e){if(this.at===void 0)return;let t=e-this.at;t>0&&t<this.o.jumpAtLeast&&(this.seconds+=t),this.at=e}end(e,t){this.o.told({seconds:On(this.seconds),length:On(t),ended:e}),this.seconds=0,this.at=void 0}},An=(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})))}),jn=(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})))}),Mn=e=>e.outline.map(e=>`M${e.map(e=>`${String(e.x)} ${String(e.y)}`).join(`L`)}Z`).join(``),Nn=(e,t)=>e!==void 0&&Mn(e)===Mn(t);function Pn({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?jn(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?An(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;return(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]),(0,q.jsx)(`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&&!Nn(u,d)?(0,q.jsxs)(`g`,{"data-testid":`stage-hovered`,children:[(0,q.jsx)(`path`,{d:Mn(d),vectorEffect:`non-scaling-stroke`,className:`stroke-sheet/80 fill-none stroke-[3px]`}),(0,q.jsx)(`path`,{d:Mn(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:Mn(u),vectorEffect:`non-scaling-stroke`,className:`stroke-sheet fill-none stroke-[5px]`}),(0,q.jsx)(`path`,{d:Mn(u),vectorEffect:`non-scaling-stroke`,className:`stroke-pencil fill-none stroke-2`})]}):null]})})}function Fn(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 In(e){if(typeof e==`object`&&e&&e.allyhub===!0&&typeof e.type==`string`)return e}function Ln(e,t){e?.postMessage({allyhub:!0,...t},`*`)}function Rn(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=In(t.data);n?.type===`located`&&n.id===a&&s(n.layers)},l=setTimeout(()=>{s([])},r);i.addEventListener(`message`,c),Ln(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 zn(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=In(t.data);n?.type===`picked`&&n.id===a&&s(n.picked)},l=setTimeout(()=>{s(void 0)},r);i.addEventListener(`message`,c),Ln(e,{type:`pick`,id:a,at:{x:(n.x-t.x)/t.width,y:(n.y-t.y)/t.height}})})}function Bn(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 Vn(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 Hn(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 Un(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 Wn(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 Gn=48,Kn=20,qn=`allyhub.video.volume`;function Jn(){try{let e=JSON.parse(localStorage.getItem(qn)??`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 Yn=e=>e.muted?0:e.level,Xn=1e3,Zn=20,Qn=1500,$n=15e3,er=1500,tr=300,nr=e=>({timeline:e.timeline,texts:e.text,uncut:Wn(e.timeline)});function rr({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=X(),S=u(),C=(0,K.useRef)(null),w=(0,K.useRef)(new Map),[T,E]=(0,K.useState)(),[D,O]=(0,K.useState)(),[k,ne]=(0,K.useState)(),[re,A]=(0,K.useState)(),[ie,j]=(0,K.useState)(),[ae,oe]=(0,K.useState)(!1),[se,ce]=(0,K.useState)(),M=s(se),[N,le]=(0,K.useState)({t:l?.t??0,part:void 0,playing:!1}),[P,ue]=(0,K.useState)(Jn),de=(0,K.useRef)(P),[fe,pe]=(0,K.useState)(0),[me,he]=(0,K.useState)(),ge=(0,K.useRef)(1),ve=(0,K.useRef)(void 0),ye=(0,K.useRef)(!1),F=(0,K.useCallback)(e=>{let t=pt(e);ve.current!==t.t&&(ve.current=t.t,S[`editor/place`]({place:t}).catch(()=>void 0))},[S]),I=(0,K.useRef)({shown:T,pending:D,play:N,view:re,onLoaded:p,onError:g,onState:_});(0,K.useEffect)(()=>{I.current={shown:T,pending:D,play:N,view:re,onLoaded:p,onError:g,onState:_}});let be=(0,K.useMemo)(()=>new kn({told:e=>{S[`editor/played`](e).catch(e=>{if(!(e instanceof te&&(e.code===ee.methodNotFound||e.code===ee.unavailable)))throw e})}}),[S]);(0,K.useEffect)(()=>{let e=()=>I.current.view?.timeline.duration??0,t=()=>{document.visibilityState===`hidden`&&be.left(e())};return document.addEventListener(`visibilitychange`,t),()=>{document.removeEventListener(`visibilitychange`,t),be.left(e())}},[be]);let L=e=>e===void 0?void 0:C.current?.querySelector(`iframe[data-frame="${String(e.id)}"]`)?.contentWindow,R=e=>{Ln(L(I.current.shown),e)};(0,K.useImperativeHandle)(b,()=>({seek:e=>{R({type:`seek`,t:e}),F(e)},play:()=>{R({type:`play`})},pause:()=>{R({type:`pause`})},objects:e=>new Promise(t=>{let n=setTimeout(()=>{w.current.delete(e),t(void 0)},er);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=>(ce(e.probe),e.url)),xe=`${e}\n${t}`,Se=(0,K.useRef)(e);(0,K.useEffect)(()=>{let{shown:t,play:n}=I.current,r=Se.current===e;Se.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:ge.current++,src:e}),O(void 0),ne(void 0),j(void 0))},e=>{if(!o)return;let t=e instanceof Error?e.message:String(e);j(t),I.current.onError?.(t)}),()=>{o=!1}},[xe]);let Ce=(0,K.useRef)(n);(0,K.useEffect)(()=>{if(n===Ce.current)return;Ce.current=n;let{shown:e,play:t,view:r}=I.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:ge.current++,src:e,from:t.t})},e=>{o&&I.current.onError?.(e instanceof Error?e.message:String(e))}),()=>{o=!1}},[n]),(0,K.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>{ne(void 0)},tr);return()=>{clearTimeout(e)}},[k]),(0,K.useEffect)(()=>{if(!D)return;let e=setTimeout(()=>{O(void 0),I.current.onError?.(`The stage did not draw within ${String($n)} ms.`)},$n);return()=>{clearTimeout(e)}},[D]),(0,K.useEffect)(()=>{let e=e=>{let t=In(e.data);if(!t)return;let{shown:n,pending:r}=I.current,i=[n,r].find(t=>t!==void 0&&L(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=I.current.play.t;Math.abs(t.t-n)>1e-6&&Ln(e.source,{type:`seek`,t:n})}else if(t.type===`sound`)i.denoising=t.denoising,a||oe(t.denoising);else if(t.type===`loaded`){Ln(e.source,{type:`volume`,level:Yn(de.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}A(nr(n)),j(void 0),I.current.onLoaded?.(n)}else if(t.type===`error`)a?O(void 0):j(t.message),I.current.onError?.(t.message);else if(t.type===`time`){if(a){if(!i.loaded)return;ne(n&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?n:void 0),E(i),O(void 0),pe(e=>e+1),oe(i.denoising===!0),A(nr(i.loaded)),j(void 0),I.current.onLoaded?.(i.loaded);let t=I.current.play.t;if(i.from!==void 0&&Math.abs(t-i.from)>1e-6){Ln(e.source,{type:`seek`,t});return}}let r={t:t.t,part:t.part,playing:t.playing};be.heard(r.t,r.playing,I.current.view?.timeline.duration??0),r.playing&&ye.current||F(r.t),ye.current=r.playing,he(i.id),le(r),I.current.onState?.(r)}};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[F,be]);let B=re?.timeline,[we,Te]=B?[B.width,B.height]:[r,c],De=re?.uncut.find(e=>e.part===N.part);(0,K.useEffect)(()=>{de.current=P,R({type:`volume`,level:Yn(P)});try{localStorage.setItem(qn,JSON.stringify(P))}catch{}},[P]);let Oe=N.playing;(0,K.useEffect)(()=>{if(B===void 0)return;let e=1/B.fps,t=Math.max(0,B.duration-e),n=e=>{let n=Math.min(Math.max(Xe(e,B.fps),0),t);Ln(L(I.current.shown),{type:`seek`,t:n}),F(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=I.current.play.t,o=r.key.length===1?r.key.toLowerCase():r.key;if(o===` `||o===`k`)Ln(L(I.current.shown),{type:Oe?`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`)ue(e=>({...e,muted:!e.muted}));else return;r.preventDefault()};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r)}},[Oe,B,F]);let ke=e=>{R({type:`seek`,t:e}),F(e)},Ae=(e,t)=>(0,q.jsx)(`iframe`,{"data-frame":e.id,src:e.src,title:x.previewTitle,...M?{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),V=B?`bg-background`:`bg-black`,je=()=>{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},Me=_e(),Ne=(0,K.useRef)(null),Pe=i()?.item.entry,Fe=e=>{let t=e.piece??Pe;return{name:Fn(e,`part`),...t===void 0?{}:{source:{path:t}},...e.text===void 0?{}:{text:e.text}}},Ie=()=>{let{t:e,part:t}=I.current.play;return`on the picture at ${e.toFixed(2)} s${t===void 0?``:`, in the part ${t}`}`},H=e=>({element:Fe(e),outline:e.outline,where:Ie()}),Le=e=>{let t=je();return t?zn(L(I.current.shown),t,e,Qn):Promise.resolve(void 0)},Re=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`absolute inset-0 isolate`,children:[k&&M!==void 0?Ae(k,`leaving`):null,T&&M!==void 0?Ae(T,`shown`):null,D&&M!==void 0?Ae(D,`pending`):null]}),Me&&T&&B&&!N.playing&&N.t>=.05?(0,q.jsx)(Pn,{ref:Ne,moment:`${String(T.id)}@${N.t.toFixed(4)}`,box:je,pick:Le,label:x.previewTitle}):null,B||ie!==void 0?null:(0,q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,q.jsx)(Ee,{label:x.loading,className:`[&>span]:bg-on-media/80`})}),ae?(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,B?(0,q.jsx)(`span`,{"aria-hidden":!0,"data-testid":`play-affordance`,"data-shown":!N.playing&&N.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)(He,{className:`size-6 translate-x-px fill-current`})}):null,De?(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(De.file)}):null,f]}),ze=me!==void 0&&me===T?.id,Be=async()=>{R({type:`pause`});let e=Date.now()+Xn;for(;I.current.play.playing&&Date.now()<e;)await new Promise(e=>{setTimeout(e,Zn)})};o({hold:async()=>{await Be();let{t:n,part:r}=I.current.play;return{key:`${e}@${t}@${n.toFixed(3)}@${String(I.current.shown?.id??0)}`,what:`The video ${e}, version ${t}, at ${n.toFixed(2)} s${r===void 0?``:`, in the part ${r}`}`,...Pe===void 0?{}:{source:{path:Pe}}}},locate:e=>{let t=je(),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=Ne.current?.selected();return Promise.resolve(e?[H(e)]:[])}}),a({element:()=>T?C.current:void 0,pictures:async()=>{let n=je();if(!n)return[];let r=await nt(S,`video/still`,{item:e,version:t,t:I.current.play.t}).catch(()=>void 0);return r?[{rect:n,mime:r.image.mime,data:r.image.data}]:[]},locate:async e=>{let t=je(),{t:n,part:r}=I.current.play;return{elements:(t?await Rn(L(I.current.shown),t,e,Qn):[]).map(Fe),where:`on the picture at ${n.toFixed(2)} s${r===void 0?``:`, in the part ${r}`}`}},pick:async e=>{let t=await Le(e);return t?H(t):void 0}});let U=!v,W=Gn+(U?Kn:0)+3,G=`min(100cqw - 2px, (100cqh - ${String(W)}px) * ${String(we/Te)})`;return(0,q.jsx)(`div`,{className:`flex h-full min-h-0 flex-col gap-2`,"data-testid":`video-preview`,"data-t":N.t.toFixed(4),"data-ready":ze?``:void 0,"data-swaps":fe,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:G},"data-testid":`player`,children:[(0,q.jsx)(`div`,{ref:C,className:m(`relative mx-auto overflow-hidden`,V),style:{width:G,height:`calc(${G} * ${String(Te/we)})`},children:Re}),B?(0,q.jsx)(ar,{timeline:B,state:N,folded:U,volume:P,onVolume:ue,onOpen:y,onToggle:()=>{R({type:N.playing?`pause`:`play`})},onSeek:ke}):(0,q.jsx)(`div`,{className:`border-t`,style:{height:W-3}})]})})})}var ir=2;function ar({timeline:e,state:t,folded:n,volume:r,onVolume:i,onOpen:a,onToggle:o,onSeek:s}){let c=X(),{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:Kn},children:(0,q.jsx)(sr,{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:Gn},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)(Ue,{}),()=>{f(0)},{testid:`to-start`,className:`@max-[22rem]:hidden`}),p(c.frameBack,`←`,(0,q.jsx)(We,{}),()=>{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)(Ve,{className:`fill-current`}):(0,q.jsx)(He,{className:`translate-x-px fill-current`})}),p(c.frameForward,`→`,(0,q.jsx)(Ge,{}),()=>{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)(or,{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)(de,{})}):null]})]})]})}function or({volume:e,onVolume:t}){let n=X(),r=Yn(e),i=r===0?Je:r<.5?qe:Ke,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 sr({timeline:e,state:t,onSeek:n}){let r=X(),{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)*ir,[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+ir/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+ir}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:ir},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)*ir)}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 cr(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 lr(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 ur=.01,dr=new Map;async function fr(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<ur)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 pr(e){let t=dr.get(e);return t||(t=fr(e),dr.set(e,t)),t}function mr(e){let[t,n]=(0,K.useState)();(0,K.useEffect)(()=>{if(e===void 0)return;let t=!0;return pr(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 hr(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 gr={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},_r={parts:[],music:!1,cues:[],listening:!1,round:0};function vr(e){return Q.ruler+1+Q.scenes+1+e.reduce((e,t)=>e+Q[t]+1,0)}var yr=6;function br(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 xr(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 Sr({title:e,mono:t=!1,time:n,line:r,children:i}){return(0,q.jsxs)(L,{children:[(0,q.jsx)(be,{asChild:!0,children:i}),(0,q.jsx)(I,{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 Cr(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 wr({file:e,from:t,to:n,sample:r,alpha:i,className:a}){let o=(0,K.useRef)(null),{peaks:s,settled:c}=mr(Cr(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=hr(s,n.at,n.at+2/o*f)*d*n.gain,a=Math.max(1,Math.round(Math.min(1,i)**Tr*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 Tr=.7,Er=`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 Dr({line:e,duration:t,onSeek:n}){let r=(0,K.useCallback)(t=>{let n=Vn(e,t);return n===void 0?void 0:{at:n,gain:1}},[e]);return(0,q.jsx)(Sr,{title:e.text,time:`${Y(e.start)} – ${Y(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(Er,`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)(wr,{file:e.file,from:e.start,to:e.end,sample:r,alpha:.7,className:`text-track-voice`})})]})})}var Or=2,kr=.75;function Ar({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=lr(c.map(e=>({x:e.anchor.at/Math.max(t,1e-6)*i,width:o.get(e.id)??0})),i,Or);return(0,q.jsx)(`div`,{ref:n,className:`pointer-events-none absolute inset-0`,children:c.map((e,n)=>(0,q.jsx)(jr,{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 jr({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)*kr)}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 Mr({music:e,duration:t,ducked:n}){let{start:r,end:i}=e,a=(0,K.useCallback)(t=>{let n=Hn(e,t);return n===void 0?void 0:{at:n,gain:Un(e,t)}},[e]),o=Ze(e.file);return(0,q.jsx)(Sr,{mono:!0,title:o,time:`${Y(r)} – ${Y(i)}`,line:e.ducked.length?n:void 0,children:(0,q.jsxs)(`div`,{"data-music":o,className:m(Er,`bg-track-music/15 border-track-music/60`),style:{left:$(r,t),width:$(i-r,t)},children:[(0,q.jsx)(wr,{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 Nr=(0,K.memo)(function({timeline:e,texts:t,tracks:n,rows:r,current:i,second:a,marks:o,onSeek:s}){let c=X(),{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??br(c?.onScreen??[],o),d=(e.end-e.start)*a<56;return(0,q.jsx)(Sr,{title:(0,q.jsx)(`span`,{className:`font-serif text-dense`,children:o}),time:`${Y(e.start)} – ${Y(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(Er,`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)(Dr,{line:e,duration:l,onSeek:s},`${e.part}@${String(e.start)}`)):d(c.noVoice),(0,q.jsx)(Ar,{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)(Mr,{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)(Sr,{mono:!0,title:e.sound,time:`${Y(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 Pr({timeline:e,texts:t,tracks:n,rows:r,state:i,agent:a,marks:o=_r,transport:s,onSeek:c}){let l=X(),{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<yr,T=w?Math.ceil(u*yr):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)},ee=e=>{c(Math.min(Math.max(Xe(e,d),0),p))},te=f.find(e=>i.t>=e.start&&i.t<e.end)??f.at(-1),{minor:ne,major:re}=xr(u),A=[];for(let e=0;e<=u+1e-6;e+=ne)A.push(e);let ie=(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`,gr[e]),children:t}),(0,q.jsx)(De,{"aria-hidden":!0,className:`text-micro whitespace-nowrap max-[559px]:hidden`,children:l.rows[e]})]});return(0,q.jsx)(R,{children:(0,q.jsxs)(`div`,{className:`relative flex`,style:{height:vr(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)(le,{})})}):(0,q.jsx)(`div`,{style:{height:Q.ruler}}),ie(`scenes`,(0,q.jsx)(Te,{})),r.includes(`voice`)?ie(`voice`,(0,q.jsx)(W,{})):null,r.includes(`music`)?ie(`music`,(0,q.jsx)(G,{})):null,r.includes(`sound`)?ie(`sound`,(0,q.jsx)(xe,{})):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),te?.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`)ee(i.t-1);else if(e.key===`ArrowRight`)ee(i.t+1);else if(e.key===`Home`)ee(0);else if(e.key===`End`)ee(p);else return;e.preventDefault()},children:A.map(e=>{let t=Math.abs(e/re-Math.round(e/re))<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)(Nr,{timeline:e,texts:t,tracks:n,rows:r,current:i.part??te?.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)(V,{"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)(Me,{"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 Fr=new Pe(`scriptAgent`),Ir=new Ie({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 Lr(e){return Ir.node(`doc`,null,e.map(e=>Ir.node(`part`,{part:e.part,title:e.title},Cn(e.words).map(t=>Ir.node(`sentence`,null,t.map(t=>Ir.node(`word`,{part:e.part,i:t.i,text:t.text,removed:t.removed,film:t.film??null})))))))}function Rr(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 zr(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 Br=44,Vr=48;function Hr(e,t){let n=e.state.selection;if(n.empty||!t)return;let r=zr(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-Br;return{top:s>=t.scrollTop?s:o.bottom-i.top+t.scrollTop+6,left:Math.min(Math.max(Vr,(a.left+o.right)/2-i.left+t.scrollLeft),Math.max(Vr,t.clientWidth-Vr)),runs:r,restore:r.every(e=>e.struck)}}function Ur({script:e,t,playing:n=!1,readOnly:r,agent:i,following:a=!1,onSeek:o,onToggle:s,onCut:c}){let l=X(),u=(0,K.useRef)(null),d=(0,K.useRef)(null),f=(0,K.useRef)(null),[p,h]=(0,K.useState)(),g=(0,K.useRef)({onSeek:o,onCut:c,onToggle:s,t,readOnly:r});(0,K.useEffect)(()=>{g.current={onSeek:o,onCut:c,onToggle:s,t,readOnly:r}}),(0,K.useEffect)(()=>{let e=u.current;if(!e)return;let t=new Re({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 H.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=ze.node(t,t+e.nodeSize,{class:`ak-word-now`})),!0}),r?H.create(e.doc,[r]):H.empty}}}),n=new Re({key:Fr,state:{init:()=>null,apply:(e,t)=>{let n=e.getMeta(Fr);return n===void 0?t:n}},props:{decorations(e){let t=Fr.getState(e);if(!t)return H.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(ze.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(ze.node(a,a+e.nodeSize,{class:`ak-word-agent`,"data-agent-word":s})),!1}),H.create(e.doc,i)}}}),r=new Re({props:{decorations(e){let{from:t,to:n,empty:r}=e.selection;if(r)return H.empty;let i=[];return e.doc.nodesBetween(t,n,(e,r)=>e.type.name!==`word`||(r<n&&r+e.nodeSize>t&&i.push(ze.node(r,r+e.nodeSize,{class:`ak-word-picked`})),!1)),H.create(e.doc,i)}}}),i=new Le(e,{state:Ne.create({doc:Lr([]),plugins:[t,n,r]}),attributes:{class:`outline-none`,"aria-label":l.script,role:`textbox`,"aria-multiline":`true`,spellcheck:`false`},editable:()=>!g.current.readOnly,dispatchTransaction(e){e.docChanged||(this.updateState(this.state.apply(e)),e.selectionSet&&h(Hr(this,d.current)))},handleKeyDown(e,t){if(t.key===` `&&!t.metaKey&&!t.ctrlKey&&!t.altKey)return g.current.onToggle?.(),!0;if(t.key!==`Backspace`&&t.key!==`Delete`)return t.key.length===1&&!t.metaKey&&!t.ctrlKey;if(g.current.readOnly)return!0;let n=e.state.selection,r=n.from,i=n.to;if(n.empty){let n=Rr(e.state.doc,r,t.key===`Backspace`?`before`:`after`);if(!n)return!0;({from:r,to:i}=n)}let a=zr(e.state.doc,r,i);return a.length===0||g.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(Fe.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&&g.current.onSeek(r),!1},handleDOMEvents:{blur:()=>(h(void 0),!1),focus:e=>(h(Hr(e,d.current)),!1)},handlePaste:()=>!0,handleDrop:()=>!0});return f.current=i,()=>{i.destroy(),f.current=null}},[]),(0,K.useEffect)(()=>{let t=f.current;if(!t)return;let n=Lr(e);if(n.eq(t.state.doc))return;let r=t.state.selection,i=n.content.size,a=Ne.create({doc:n,plugins:t.state.plugins,selection:Fe.between(n.resolve(Math.min(r.from,i)),n.resolve(Math.min(r.to,i)))});t.updateState(a),t.hasFocus()&&h(Hr(t,d.current))},[e]);let _=i?.part,v=i?.label,y=i?.words,b=JSON.stringify(y??null);return(0,K.useEffect)(()=>{let e=f.current;e&&e.dispatch(e.state.tr.setMeta(Fr,_===void 0||v===void 0?null:{part:_,label:v,words:y}))},[_,v,b,e]),(0,K.useEffect)(()=>{if(!a||_===void 0)return;let e=u.current?.querySelector(`[data-part="${CSS.escape(_)}"]`);(e?.querySelector(`.ak-word-agent`)??e)?.scrollIntoView({block:`nearest`})},[a,_,b]),(0,K.useEffect)(()=>{let e=f.current;if(!e)return;let n=e.state.plugins[0];n&&e.dispatch(e.state.tr.setMeta(n,t))},[t]),(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`script`,"data-playing":n?``:void 0,children:(0,q.jsxs)(`div`,{ref:d,className:`relative min-h-0 flex-1 overflow-auto`,children:[(0,q.jsx)(`div`,{ref:u,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`)}),p&&!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:p.top,left:p.left},"data-testid":`script-bar`,children:(0,q.jsxs)(me,{"data-testid":p.restore?`keep-words`:`cut-words`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{c(p.runs.map(e=>({part:e.part,first:e.first,last:e.last,restore:p.restore})))},children:[p.restore?(0,q.jsx)(ge,{}):(0,q.jsx)(B,{}),p.restore?l.keepWords:l.cutWords]})}):null]})})}var Wr=1200,Gr=4e3,Kr=150,qr=1e4,Jr=220,Yr=640,Xr={initial:272,least:200,share:.5},Zr=[[`voice`,`music`,`sound`],[`voice`],[]],Qr=vr(Zr[0]??[]),$r=vr([]);function ei(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:se(e)}),r=ce(`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 ti=e=>e instanceof HTMLElement&&e.closest(`[data-testid=script]`)===null&&(e.isContentEditable||e.closest(`input,textarea,select,[role=dialog]`)!==null);function ni({item:e,piece:t,version:r,revision:i,start:a,updating:o=!1,loaded:s,onLoaded:c}){let d=X(),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(_)},Wr);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,ee]=(0,K.useState)(1/0);(0,K.useEffect)(()=>{let e=O.current;if(!e)return;let t=new ResizeObserver(()=>{ee(e.clientWidth)});return t.observe(e),()=>{t.disconnect()}},[]);let[te=Xr.initial,ne]=lt(`video-editor.script-width`,Xr.initial),[re=Qr,A]=lt(`video-editor.timeline-height`,Qr),[ie=!0,j]=lt(`video-editor.timeline`,!0),ae=Math.max(Xr.least,Math.round((Number.isFinite(k)?k:1600)*Xr.share)),oe=Math.min(ae,Math.max(Xr.least,te)),se=Zr.find(e=>vr(e)<=re)??Zr[2]??[],ce=(0,K.useMemo)(()=>s?.kind===`video`?Bn(s.timeline,s.text,s.mix):void 0,[s]),M=s?.kind===`video`?s.timeline:void 0,{words:N,read:le}=ei((0,K.useMemo)(()=>[...new Set((M?.parts??[]).flatMap(e=>e.speech?[e.speech.file]:[]))],[M]),i),P=En(p),ue=new Map;for(let e of M?.parts??[]){let t=e.speech?.edits;if(t===void 0)continue;let n=P.listOf(t);n&&ue.set(t,n)}let de=(0,K.useMemo)(()=>M?hn(M,N,ue):[],[M,N,P.tick]),[fe,pe]=(0,K.useState)(!1);!fe&&(s!==void 0&&C&&le||_!==void 0)&&pe(!0),(0,K.useEffect)(()=>{let e=setTimeout(()=>{pe(!0)},qr);return()=>{clearTimeout(e)}},[]);let[me,he]=(0,K.useState)(!0);(0,K.useEffect)(()=>{if(!fe)return;let e=setTimeout(()=>{he(!1)},Jr);return()=>{clearTimeout(e)}},[fe]);let ge=de.filter(e=>e.edits!==void 0),_e=p||ge.length===0,ye=e=>{let t=[];for(let n of e){let e=de.find(e=>e.part===n.part);if(e?.edits===void 0)continue;let r=N.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)})}P.apply(e.every(e=>e.restore)?d.keepWords:d.cutWords,t)},F=(0,K.useRef)(P);(0,K.useEffect)(()=>{F.current=P}),(0,K.useEffect)(()=>{if(p)return;let e=e=>{if(ti(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=F.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:I,following:be}=n(),L=I?.doing!==void 0,R=ve(),[z,xe]=(0,K.useState)(),B=I?.source?.path;(0,K.useEffect)(()=>{if(B===void 0||z?.revision===i)return;let t=!0;return nt(f,`video/sources`,{item:e}).then(e=>{t&&xe({revision:i,files:e.files})},()=>void 0),()=>{t=!1}},[f,e,i,B,z?.revision]);let[we,Te]=(0,K.useState)(s),[De,ke]=(0,K.useState)(),[V,Ne]=(0,K.useState)();if(s!==we&&(Te(s),we&&s&&I?.doing===`editing`)){let e=Tt({timeline:we.timeline,text:we.text},s),t=kt(we.timeline,s.timeline),[n]=e,r=n===void 0?void 0:Et(s.timeline,n);r&&ke(r),(e.length>0||t.music||t.cues.length>0)&&Ne({parts:e,...t,round:(V?.round??0)+1})}(0,K.useEffect)(()=>{if(!V)return;let e=setTimeout(()=>{Ne(void 0)},Gr);return()=>{clearTimeout(e)}},[V]);let[Pe,Fe]=(0,K.useState)(),[Ie,H]=(0,K.useState)(P.byAgent);P.byAgent!==Ie&&(H(P.byAgent),Fe(P.byAgent));let[Le,Re]=(0,K.useState)(L);Le!==L&&(Re(L),L||(ke(void 0),Fe(void 0)));let ze=L?I.source:void 0,Be=ze&&M?St(M,ze.path):void 0,U=ze&&z&&Be===void 0?xt(z.files,ze):void 0,W=(()=>{if(!L||!M)return;let e=vt(I.place);return e===void 0?(Be===void 0?U?.part===void 0?void 0:Et(M,U.part,U):Et(M,Be))??De:{t:e}})(),G=W?.t,Ve=I?R(I):``,He=U?.music===!0,Ue=U?.sounds===!0&&U.part!==void 0?U.part:void 0,We=L&&yt(I.place),Ge=(0,K.useMemo)(()=>({parts:V?.parts??[],music:V?.music===!0||He,cues:[...new Set([...V?.cues??[],...Ue===void 0?[]:[Ue]])],listening:We,round:V?.round??0}),[V,He,Ue,We]),Ke=Pe&&M&&W?.part!==void 0&&St(M,Pe.path)===W.part?{cut:Pe.cut,kept:Pe.kept}:void 0,qe=(0,K.useRef)(x.t);(0,K.useEffect)(()=>{qe.current=x.t}),(0,K.useEffect)(()=>{be&&G!==void 0&&!x.playing&&(Math.abs(qe.current-G)<1/240||h.current?.seek(G))},[be,G,x.playing]);let Je=G!==void 0&&!x.playing&&Math.abs(x.t-G)<=1/(M?.fps??30)+1e-6,Ye=W?.part,J=W?.layer,Y=W?.message,Xe=Je&&Ye!==void 0&&(J!==void 0||Y!==void 0),[Ze,Qe]=(0,K.useState)();(0,K.useEffect)(()=>{if(!Xe)return;let e=!0,t=setTimeout(()=>{h.current?.objects(x.t).then(t=>{e&&Qe(t)})},Kr);return()=>{e=!1,clearTimeout(t)}},[Xe,x.t,s]);let $e=Xe&&Ze&&Math.abs(Ze.t-x.t)<1e-6?Ze:void 0,et=(J===void 0?void 0:$e?.layers?.find(e=>e.part===Ye&&e.index===J)?.box)??(Y===void 0?void 0:$e?.texts.find(e=>e.keys.includes(Y))?.box),tt=(e,t)=>`${String(e/t*100)}%`,rt=()=>{x.playing?h.current?.pause():h.current?.play()},it=de.length>0&&k>=Yr,at=(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":fe?``: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`,fe&&`pointer-events-none opacity-0`),"data-testid":`opening`,children:fe?null:(0,q.jsx)(Ee,{label:d.loading})}):null,(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[it?(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}),_e?null:(0,q.jsxs)(q.Fragment,{children:[at(P.undoLabel===void 0?d.undo:d.undoWhat(P.undoLabel),(0,q.jsx)(Ce,{}),P.undo,!P.canUndo,`undo`),at(P.redoLabel===void 0?d.redo:d.redoWhat(P.redoLabel),(0,q.jsx)(Se,{}),P.redo,!P.canRedo,`redo`)]})]}),(0,q.jsx)(Ur,{script:de,t:x.t,playing:x.playing,readOnly:_e,agent:I&&W?.part!==void 0?{part:W.part,label:Ve,words:Ke}:void 0,following:be,onSeek:e=>{h.current?.seek(e)},onToggle:rt,onCut:ye})]})}),(0,q.jsx)(cr,{orientation:`vertical`,value:oe,min:Xr.least,max:ae,label:d.resizeScript,onChange:ne,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)(rr,{ref:h,item:e,version:r.key,revision:i,start:a,width:t.width,height:t.height,timelineOpen:ie,onTimelineOpen:j,overlay:(0,q.jsxs)(q.Fragment,{children:[I&&Je&&M?et?(0,q.jsx)(Me,{"data-testid":`agent-box`,label:Ve,style:{left:tt(et[0],M.width),top:tt(et[1],M.height),width:tt(et[2],M.width),height:tt(et[3],M.height)}}):(0,q.jsx)(je,{"data-testid":`agent-tag`,label:Ve,className:`absolute top-2 left-2`}):null,T!==void 0&&s===void 0?(0,q.jsx)(Ae,{className:`bg-background absolute inset-0 z-20 flex items-center justify-center`}):o||T!==void 0?(0,q.jsx)(Oe,{}):null]}),onState:e=>{S(e),w(!0)},onLoaded:e=>{c(e),v(void 0)},onError:v})})]}),M&&ce&&ie?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(cr,{orientation:`horizontal`,value:vr(se),min:$r,max:Qr,after:!0,label:d.resizeTimeline,onChange:A,testid:`timeline-splitter`}),(0,q.jsx)(`div`,{className:`bg-sheet shrink-0`,children:(0,q.jsx)(Pr,{timeline:M,texts:s?.text??[],tracks:ce,rows:se,state:x,agent:I?{t:G,label:Ve}:void 0,marks:Ge,transport:{onFold:()=>{j(!1)}},onSeek:e=>{h.current?.seek(e)}})})]}):null]})}function ri(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 ii(){let e=X(),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}=ke(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)(Ee,{label:e.loading})});if(!l||!h)return(0,q.jsx)(Ae,{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)(he,{start:l.versions.length>1?(0,q.jsx)(F,{testid:`video-bar`,children:(0,q.jsx)(ye,{id:`language`,children:(0,q.jsxs)(P,{value:h.key,onValueChange:e=>{f(e)},children:[(0,q.jsx)(fe,{"aria-label":e.version,className:`max-w-[16rem]`,"data-testid":`version`,children:(0,q.jsx)(ue,{})}),(0,q.jsx)(N,{position:`popper`,align:`start`,children:l.versions.map(e=>(0,q.jsx)(pe,{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`?ri(m.problems,l,e):0}}}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,q.jsx)(ni,{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 ai=t({Preview:()=>rr,VideoEditor:()=>ii,WORDS:()=>rt,Workbench:()=>ni,aboutVersion:()=>ht,default:()=>ii,languageName:()=>gt,locateInStage:()=>Rn,musicAt:()=>Hn,musicGain:()=>Un,mustFix:()=>ri,pickInStage:()=>zn,placeLabels:()=>lr,postCommand:()=>Ln,speechAt:()=>Vn,stageLayerName:()=>Fn,stageMessage:()=>In,tracksOf:()=>Bn,uncutParts:()=>Wn,useCheck:()=>ct,useRevision:()=>st,useStored:()=>lt,useTool:()=>at,useToolOf:()=>ot,useVideoWords:()=>X,versionNamed:()=>mt});export{He as _,Fn as a,mt as c,lt as d,at as f,Ke as g,Je as h,zn as i,ct as l,nt as m,ri as n,In as o,ot as p,Rn as r,gt as s,ai as t,st as u,Ve as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{b as t,c as n,d as r,f as i,m as a,o,s,u as c}from"./react-Byupo4pA.js";import{Dt as l,Et as u,bt as d,ht as f,n as ee,yt as p}from"./x-BAJilkKD.js";import{C as m,S as h,_ as g,s as _}from"./schemas-DlRAoVtq.js";import{F as v,j as y,o as b,x}from"./snapshots-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{b as t,c as n,d as r,f as i,m as a,o,s,u as c}from"./react-Byupo4pA.js";import{Dt as l,Et as u,bt as d,ht as f,n as ee,yt as p}from"./x-BAJilkKD.js";import{C as m,S as h,_ as g,s as _}from"./schemas-DlRAoVtq.js";import{F as v,j as y,o as b,x}from"./snapshots-8hCkRemI.js";import{t as S}from"./jsx-runtime-DePvh3-m.js";import{a as te,o as ne,s as C}from"./dist-Dw7AH_ip.js";import{i as w,n as T,r as E,t as D}from"./hint-F4fIBnVU.js";import{n as O,r as k,t as A}from"./tablet-C6oePHEW.js";import{J as re}from"./index-BSd85XUU.js";import{t as ie}from"./updating--4wIxO0k.js";var j=e(t(),1),M=S(),N=h({file:y}),P={width:g().int().positive().max(4096),height:g().int().positive().max(4096)},F={scroll:h({x:g().min(0),y:g().min(0)}).optional()},I=h({selector:m(),tag:m(),text:m()}),L={"html/still":v(N.extend({...P,...F,scale:g().positive().max(4).default(1),hold:m().optional()}),h({image:h({mime:m(),data:m()})}),`An HTML file's page drawn at a frame's size, where its frame's page is scrolled, as its frame shows it: what Mark up lays over the frame, which the window cannot read.`),"html/hold":v(N.extend({...P,scale:g().positive().max(4).default(1)}),h({hold:m()}),`An HTML file's page opened at a frame's size and kept as it is while a person marks it: html/still and html/at draw and read it as it was, until html/release.`),"html/release":v(h({hold:m()}),h({}),`Lets a page held for notes go.`),"html/at":v(N.extend({...P,...F,points:_(h({x:g(),y:g()})).min(1).max(24),hold:m().optional()}),h({elements:_(I)}),`What is at places of an HTML file's page drawn at a frame's size, where its frame's page is scrolled (as html/still draws it): what a person's mark on its frame is on.`),"html/pick":v(N.extend({...P,...F,x:g(),y:g(),hold:m().optional()}),h({element:I.extend({box:h({x:g(),y:g(),width:g().positive(),height:g().positive()})}).optional()}),`The one element in front at a place of an HTML file's page drawn at a frame's size, where its frame's page is scrolled (as html/still draws it), with its box: what Mark up's Select picks there.`)},R=x(L),z=p({en:{starting:`Opening the page…`,asleep:`Showing the page needs the agent awake.`,edit:`Edit`,width:`Width`,fit:`Fit the window`,tablet:`Tablet`,phone:`Phone`,wide:(e,t)=>`${e}, ${String(t)} px`},"zh-cn":{starting:`正在打开网页…`,asleep:`显示网页需要 Agent 处于唤醒状态。`,edit:`编辑`,width:`宽度`,fit:`适应窗口`,tablet:`平板`,phone:`手机`,wide:(e,t)=>`${e}, ${String(t)} px`},"zh-tw":{starting:`正在開啟網頁…`,asleep:`顯示網頁需要 Agent 處於喚醒狀態。`,edit:`編輯`,width:`寬度`,fit:`符合視窗`,tablet:`平板`,phone:`手機`,wide:(e,t)=>`${e}, ${String(t)} px`},ja:{starting:`ページを開いています…`,asleep:`ページを表示するにはエージェントの起動が必要です。`,edit:`編集`,width:`幅`,fit:`ウィンドウに合わせる`,tablet:`タブレット`,phone:`スマートフォン`,wide:(e,t)=>`${e}, ${String(t)} px`},ko:{starting:`페이지를 여는 중…`,asleep:`페이지를 표시하려면 에이전트가 깨어 있어야 합니다.`,edit:`편집`,width:`너비`,fit:`창에 맞추기`,tablet:`태블릿`,phone:`휴대폰`,wide:(e,t)=>`${e}, ${String(t)} px`},es:{starting:`Abriendo la página…`,asleep:`Para mostrar la página, el agente debe estar activo.`,edit:`Editar`,width:`Ancho`,fit:`Ajustar a la ventana`,tablet:`Tableta`,phone:`Teléfono`,wide:(e,t)=>`${e}, ${String(t)} px`},fr:{starting:`Ouverture de la page…`,asleep:`Afficher la page nécessite que l’agent soit actif.`,edit:`Modifier`,width:`Largeur`,fit:`Ajuster à la fenêtre`,tablet:`Tablette`,phone:`Téléphone`,wide:(e,t)=>`${e}, ${String(t)} px`},de:{starting:`Seite wird geöffnet…`,asleep:`Um die Seite anzuzeigen, muss der Agent wach sein.`,edit:`Bearbeiten`,width:`Breite`,fit:`An Fenster anpassen`,tablet:`Tablet`,phone:`Smartphone`,wide:(e,t)=>`${e}, ${String(t)} px`},pt:{starting:`Abrindo a página…`,asleep:`Para mostrar a página, o agente precisa estar ativo.`,edit:`Editar`,width:`Largura`,fit:`Ajustar à janela`,tablet:`Tablet`,phone:`Celular`,wide:(e,t)=>`${e}, ${String(t)} px`}}),B={tablet:768,phone:375},V={fit:k,tablet:A,phone:O};function H({className:e}){let t=n();if(t===void 0)return null;let{id:r,entry:i}=t.item;return(0,M.jsx)(W,{id:r,file:i,w:z.of(d(t.locale)),className:e},r)}function U(e){let[t,n]=(0,j.useState)({width:0,height:0});return(0,j.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(([e])=>{e&&n({width:e.contentRect.width,height:e.contentRect.height})});return r.observe(t),()=>{r.disconnect()}},[e]),t}function W({id:e,file:t,w:n,className:d}){let p=s(),m=t.slice(t.lastIndexOf(`/`)+1),[h,g]=(0,j.useState)({at:`starting`}),[_,v]=(0,j.useState)(`fit`),[y,x]=(0,j.useState)(0);c(e,()=>{x(e=>e+1)});let[S,O]=(0,j.useState)(0),k=a(),A=(0,j.useRef)(null),N=U(A),P=(0,j.useRef)(null),F=o(P),I=h.at===`asleep`?k:void 0,L=h.at===`failed`?y:void 0;(0,j.useEffect)(()=>{let t=!0;return re(p,`items/page`,{item:e}).then(({url:e})=>{t&&g({at:`ready`,url:e})},e=>{t&&g(b(e)?{at:`asleep`}:{at:`failed`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[p,e,L,I]);let z=_!==`fit`,H=z?16:0,W=_===`fit`?Math.max(1,Math.round(N.width)):B[_],G=Math.max(1,N.width-2*H),K=N.width>0?Math.min(1,G/W):1,q=Math.max(1,Math.round((N.height-H)/K));i({hold:()=>Promise.resolve({key:`html@${e}@${crypto.randomUUID()}`,what:m,source:{path:t}}),locate:()=>Promise.resolve({elements:[]})});let J=()=>{let e=P.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0},Y=e=>({name:`the element ${e.selector} of the page ${t}`,source:{path:t},...e.text===``?{}:{text:e.text}}),X=()=>{let{y:e}=F.at();return`on the page ${t}, ${String(W)} px wide, ${e>0?`scrolled ${String(Math.round(e))} px down`:`from its top`}`},Z=(0,j.useRef)(void 0),Q=()=>Z.current??Promise.resolve(void 0),$=()=>Math.min(4,Math.max(1,window.devicePixelRatio*K));return r({element:()=>P.current,hold:()=>(Z.current=R(p,`html/hold`,{file:t,width:W,height:q,scale:$()}).then(e=>e.hold,()=>void 0),Z.current.then(()=>void 0)),release:()=>{let e=Z.current;Z.current=void 0,e?.then(e=>e===void 0?void 0:R(p,`html/release`,{hold:e}).catch(()=>void 0))},pictures:async()=>{let e=J();if(!e)return[];let n=await Q(),{image:r}=await R(p,`html/still`,{file:t,width:W,height:q,scale:$(),scroll:F.at(),...n===void 0?{}:{hold:n}});return[{...r,rect:e}]},locate:async e=>{let n=J(),r=n?u(e).map(e=>({x:(e.x-n.x)/K,y:(e.y-n.y)/K})).filter(e=>e.x>=0&&e.y>=0&&e.x<=W&&e.y<=q):[],i=await Q(),a=r.length>0?await R(p,`html/at`,{file:t,width:W,height:q,points:r,scroll:F.at(),...i===void 0?{}:{hold:i}}).catch(()=>void 0):void 0;return{elements:a&&a.elements.length>0?a.elements.map(Y):[{name:`the page ${t}`,source:{path:t}}],where:X()}},pick:async e=>{let n=J();if(!n)return;let r=(e.x-n.x)/K,i=(e.y-n.y)/K;if(r<0||i<0||r>W||i>q)return;let a=await Q(),{element:o}=await R(p,`html/pick`,{file:t,width:W,height:q,x:r,y:i,scroll:F.at(),...a===void 0?{}:{hold:a}});if(!o)return;let s=o.box,c=Math.max(0,s.x),u=Math.max(0,s.y),d=Math.min(W,s.x+s.width),f=Math.min(q,s.y+s.height);if(!(d<=c||f<=u))return{element:Y(o),outline:l({x:n.x+c*K,y:n.y+u*K,width:(d-c)*K,height:(f-u)*K}),where:X()}}}),h.at===`asleep`?(0,M.jsxs)(`div`,{className:f(`absolute inset-0 flex flex-col items-center justify-center gap-3 p-6`,d),children:[(0,M.jsx)(`p`,{className:`text-sm text-lead`,children:n.asleep}),(0,M.jsx)(ee,{size:`xs`,onClick:()=>{p[`edit/request`]({}).catch(()=>void 0)},children:n.edit})]}):(0,M.jsxs)(`div`,{className:f(`absolute inset-0 flex flex-col`,d),"data-testid":`html-viewer`,children:[(0,M.jsx)(te,{start:(0,M.jsx)(D,{children:(0,M.jsx)(ne,{type:`single`,size:`sm`,"aria-label":n.width,value:_,onValueChange:e=>{(e===`fit`||e in B)&&v(e)},children:[`fit`,`tablet`,`phone`].map(e=>{let t=V[e],r=e===`fit`?n.fit:n.wide(n[e],B[e]);return(0,M.jsxs)(E,{children:[(0,M.jsx)(T,{asChild:!0,children:(0,M.jsx)(C,{value:e,"aria-label":r,children:(0,M.jsx)(t,{className:`size-4`})})}),(0,M.jsx)(w,{children:r})]},e)})})})}),(0,M.jsxs)(`div`,{ref:A,className:`relative min-h-0 flex-1 overflow-hidden bg-stone`,children:[h.at===`ready`&&N.width>0&&(S===y?[y]:[S,y]).map(e=>{let t=e===S;return(0,M.jsx)(`iframe`,{ref:t?P:void 0,title:m,src:h.url,"data-testid":t?`html-page`:void 0,"aria-hidden":!t||void 0,tabIndex:t?void 0:-1,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox`,className:f(`absolute border-0 bg-page`,z&&`shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_1px_3px_rgb(0_0_0/0.12)]`),onLoad:t?void 0:t=>{F.to(t.currentTarget,F.at()),setTimeout(()=>{O(t=>e>t?e:t)},250)},style:{width:W,height:q,top:H,left:Math.max(0,(N.width-W*K)/2),transform:`scale(${String(K)})`,transformOrigin:`top left`,zIndex:+!!t}},e)}),h.at===`starting`&&(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-lead`,children:(0,M.jsx)(`span`,{className:`motion-safe:animate-pulse`,children:n.starting})}),h.at===`failed`&&(0,M.jsx)(ie,{className:`absolute inset-0 flex items-center justify-center`})]})]})}export{H as HtmlViewer,H as default,z as WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{b as t,c as n,d as r,f as i,l as a,m as o,s,u as c}from"./react-Byupo4pA.js";import{Et as l,bt as u,ht as d,n as f,vt as p,yt as m}from"./x-BAJilkKD.js";import{C as h,D as g,S as _,T as v,_ as y,a as b,b as x,h as S,l as C,s as w,v as T}from"./schemas-DlRAoVtq.js";import{t as E}from"./iso-UwGLGD3F.js";import{F as D,M as ee,f as O,h as k,j as A,m as j,o as te,p as M,x as ne}from"./snapshots-8hCkRemI.js";import{t as re}from"./jsx-runtime-DePvh3-m.js";import{n as N,t as ie}from"./progress-D1Uv3d1b.js";import{t as ae}from"./switch-b6GCy_ix.js";import{i as oe,n as se,r as ce,t as le}from"./hint-F4fIBnVU.js";import{t as ue}from"./createLucideIcon-euu7Wcd9.js";import{C as P,P as de,S as F,a as fe,b as I,w as L,x as R}from"./index-BSd85XUU.js";import{t as pe}from"./updating--4wIxO0k.js";import{t as me}from"./surface-BUoi7cmR.js";var z={files:2e4,bytes:5368709120,redirects:2e3,headers:100},B={min:3,max:40},he=new Set(`abuse.account.accounts.admin.administrator.allyhub.api.app.assets.auth.autoconfig.autodiscover.billing.blog.cdn.dashboard.dev.dns.docs.download.downloads.ftp.help.hostmaster.imap.login.mail.mta-sts.ns1.ns2.ops.pop.postmaster.preview.root.security.signin.smtp.staging.static.status.studio.support.test.webmaster.wpad.www`.split(`.`));function V(e){if(e.length<B.min||e.length>B.max)return`length`;if(!/^[a-z0-9-]+$/u.test(e))return`characters`;if(e.startsWith(`-`)||e.endsWith(`-`))return`hyphenEnds`;if(e.includes(`--`))return`doubleHyphen`;if(he.has(e))return`reserved`}var ge={length:`An address is ${String(B.min)} to ${String(B.max)} characters.`,characters:`An address is lowercase letters, digits and hyphens.`,hyphenEnds:`An address neither starts nor ends with a hyphen.`,doubleHyphen:`An address does not have two hyphens in a row.`,reserved:`That address is reserved.`};function _e(e){let t=V(e);return t===void 0?void 0:ge[t]}var ve=h().superRefine((e,t)=>{let n=_e(e);n!==void 0&&t.addIssue({code:`custom`,message:n})}),ye=[200,301,302,303,307,308,404,410],H=h().min(1).max(1024).regex(/^\/[^\s]*$/u,`A rule's path starts with /.`),be=_({from:H,to:h().min(1).max(2048).regex(/^(\/[^\s]*|https?:\/\/[^\s]+)$/u,`A rule goes to a path or an http(s) address.`),status:v(ye.map(e=>S(e))),force:C()}),xe=new Set([`accept-ranges`,`connection`,`content-encoding`,`content-length`,`content-range`,`date`,`keep-alive`,`set-cookie`,`strict-transport-security`,`trailer`,`transfer-encoding`,`upgrade`,`x-content-type-options`]),Se=h().regex(/^[A-Za-z0-9-]+$/u).max(128).refine(e=>!xe.has(e.toLowerCase()),`That header is the platform's.`),Ce=_({for:H,set:x(Se,h().max(2048))});_({format:S(1),files:x(j,M),redirects:w(be).max(z.redirects),headers:w(Ce).max(z.headers)});var U=[`upload`,`git`],we=_({kind:b(U),commit:h().min(1).max(64).optional(),digest:O.optional()}),Te=T({id:h(),siteId:h(),source:T({...we.shape,kind:k(U)}),note:h().nullable(),files:y(),bytes:y(),createdBy:h(),createdAt:E(),live:C()}),W=T({id:h(),slug:h(),name:h(),url:g(),liveDeployment:h().nullable(),approved:C(),autoPublish:C(),indexing:C(),createdAt:E()});_({slug:ve,name:h().min(1).max(255)}),T({sites:w(W),domain:h(),hosting:C()});var Ee=T({site:W,deployments:w(Te)});_({manifest:O,source:we,note:h().max(500).optional()}),T({site:W,deployment:Te}),T({site:W,live:C(),confirm:g().optional()}),_({autoPublish:C().optional(),indexing:C().optional()});var De=ue(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Oe=e=>e.state===`running`||e.state===`queued`;function ke(e){if(e.state===`done`)return 1;if(!(e.total===void 0||e.total<=0))return Math.min(1,Math.max(0,e.completed/e.total))}var G=e(t(),1),K=re(),q=_({item:A}),Ae=_({hosting:C(),detail:Ee.optional(),elsewhere:C().optional(),changed:C().optional(),slug:h().optional(),domain:h().optional()}),je={confirm:h().optional()},Me={"website/preview":D(q,_({url:h()}),`A website's address as its own dev server serves it, for a frame: its dependencies installed if it has none, then its website.json's dev command on a free port; it answers once the page does.`),"website/still":D(q.extend({width:y().int().positive().max(4096),height:y().int().positive().max(4096),scale:y().positive().max(4).default(1),hold:h().optional()}),_({image:_({mime:h(),data:h()})}),`A website's page as its own dev server serves it, drawn at a frame's size from its top: what Mark up lays over a website's frame where the window cannot read another origin's pixels.`),"website/hold":D(q.extend({width:y().int().positive().max(4096),height:y().int().positive().max(4096),scale:y().positive().max(4).default(1)}),_({hold:h()}),`A website's page opened at a frame's size and kept as it is while a person marks it: website/still and website/at draw and read it as it was, until website/release.`),"website/release":D(_({hold:h()}),_({}),`Lets a page held for notes go.`),"website/at":D(q.extend({width:y().int().positive().max(4096),height:y().int().positive().max(4096),points:w(_({x:y(),y:y()})).min(1).max(24),hold:h().optional()}),_({page:h(),elements:w(_({selector:h(),tag:h(),text:h()}))}),`What is at places of a website's page as its own dev server serves it, drawn at a frame's size from its top (as website/still draws it): what a person's mark on its frame is on.`),"website/status":D(q,Ae,`A website's hosted site, its versions, and whether what is here differs from what is live; where the server has no person's sign-in, not hosted.`),"website/publish":D(q.extend({slug:h().optional(),note:h().optional(),anew:C().optional()}),_({live:C(),url:h(),...je}),"Builds a website, uploads it as a version and makes it live, for the person who pressed Publish. The first time, it waits for their yes in a browser (`confirm`, a page to open there)."),"website/live":D(q.extend({version:h().min(1)}),_({live:C(),...je}),`Makes a version what the site serves, as the person asked.`),"website/settings":D(q.extend({autoPublish:C().optional(),indexing:C().optional()}),_({}),`Changes what the person controls of a site.`),"website/unpublish":D(q,_({}),`Takes a site offline; it keeps its address and versions.`),"website/remove":D(q,_({}),`Takes a site offline for good. Its address is never given to anyone else.`)},J=ne(Me);function Y({className:e,...t}){return(0,K.jsx)(me,{className:d(`divide-y divide-rule`,e),...t})}function X({icon:e,label:t,detail:n,children:r,className:i}){return(0,K.jsxs)(`div`,{"data-slot":`setting-row`,className:d(`flex items-center gap-4 px-4.5 py-4`,i),children:[e!==void 0&&(0,K.jsx)(`span`,{className:`-mr-1 flex-none`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-sm`,children:t}),n!==void 0&&(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-lead`,children:n})]}),r]})}function Z({label:e,detail:t,children:n}){return(0,K.jsxs)(`label`,{"data-slot":`setting-row`,className:`flex items-center gap-4 px-4.5 py-4 transition-colors has-[[role=checkbox]:not(:disabled),[role=switch]:not(:disabled)]:hover:bg-hover`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block text-sm`,children:e}),t!==void 0&&(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs text-lead`,children:t})]}),n]})}function Ne(e){let[t,n]=(0,G.useState)([]);return a(`jobs/changed`,({job:t,item:r})=>{r===e&&n(e=>[...e.filter(e=>e.id!==t.id),t])}),t}var Pe=(e,t)=>e.findLast(e=>(t===void 0||e.what===t)&&Oe(e)),Fe=[[`year`,31536e6],[`month`,2592e6],[`week`,6048e5],[`day`,864e5],[`hour`,36e5],[`minute`,6e4]];function Ie(e,t,n=Date.now()){let r=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),i=e-n;for(let[e,t]of Fe)if(Math.abs(i)>=t)return r.format(Math.round(i/t),e);return r.format(0,`minute`)}var Q={content:`max-w-[min(28rem,calc(100%-2rem))]`,header:`text-left`,footer:`flex-row justify-end`},Le=e=>e instanceof Error?e.message:String(e),Re=(e,t)=>({message:Le(e),...t!==void 0&&typeof e==`object`&&e&&e.code===ee.conflict?{refused:t}:{}});function ze(e,t,n){let r=s(),[i,a]=(0,G.useState)(),[o,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(),[d,f]=(0,G.useState)(),p=(0,G.useCallback)(()=>J(r,`website/status`,{item:e}).then(e=>{a(e),e.detail?.site.liveDeployment!=null&&f(void 0)}),[r,e]);(0,G.useEffect)(()=>{let e=()=>{p().catch(()=>void 0)};e();let t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[r,p,t]);let m=(0,G.useCallback)((e,t)=>{c(!0),u(void 0),e().then(p).catch(e=>{u(Re(e,t))}).finally(()=>{c(!1)})},[p]),h=(0,G.useCallback)(e=>{r[`items/open`]({target:{type:`browser`,url:e}}).catch(()=>void 0)},[r]),g=(0,G.useCallback)(e=>{e.confirm!==void 0&&(f(e.confirm),h(e.confirm))},[h]),_={item:e};return{status:i,publishing:Pe(n,`publish`),busy:o,failure:l,confirm:d,stopWaiting:()=>{f(void 0)},openAgain:()=>{d!==void 0&&h(d)},publish:(e={})=>{m(()=>J(r,`website/publish`,{..._,...e}).then(g),e.slug)},goLive:e=>{m(()=>J(r,`website/live`,{..._,version:e}).then(g))},settings:e=>{m(()=>J(r,`website/settings`,{..._,...e}))},unpublish:()=>{m(()=>J(r,`website/unpublish`,_))},remove:()=>{m(()=>J(r,`website/remove`,_))}}}function Be({words:e,from:t=`center`,children:n}){return(0,K.jsx)(le,{disableHoverableContent:!0,children:(0,K.jsxs)(ce,{children:[(0,K.jsx)(se,{asChild:!0,children:(0,K.jsx)(`span`,{className:`flex min-w-0`,children:n})}),(0,K.jsx)(oe,{side:`top`,align:t,sideOffset:6,collisionPadding:8,children:e})]})})}var Ve=e=>new URL(e).host;function He({hosting:e,said:t,settings:n,onSettings:r}){let i=t.w.hosting,{status:a,busy:o,failure:s,confirm:c,publishing:l}=e,[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(),h=a?.detail?.site,g=h?.liveDeployment!=null,_=p??a?.slug??``,v=_===``?void 0:V(_),y=!o&&_!==``&&v===void 0,b=v===`length`?i.slug.length(B.min,B.max):v===void 0?s?.refused===_?i.unavailable(`${_}.${a?.domain??``}`):void 0:i.slug[v];return a?.hosting===!0?(0,K.jsxs)(`div`,{className:`flex h-10 flex-none items-center gap-2 border-b border-rule bg-sheet px-3`,children:[g&&(0,K.jsxs)(`a`,{href:h.url,target:`_blank`,rel:`noreferrer`,className:`flex min-w-0 items-center gap-1.5 truncate font-mono text-xs text-lead hover:text-ink`,children:[(0,K.jsx)(de,{"aria-hidden":!0,className:`size-3.5 flex-none`}),Ve(h.url)]}),(0,K.jsx)(`span`,{className:`flex-1`}),s!==void 0&&s.refused===void 0&&!u&&(0,K.jsx)(`span`,{className:`text-xs whitespace-nowrap text-problem-text`,children:i.notPublished}),a.elsewhere===!0&&(0,K.jsx)(`span`,{className:`text-xs whitespace-nowrap text-lead`,children:i.elsewhere}),g&&(0,K.jsx)(`span`,{className:`text-xs whitespace-nowrap text-lead`,children:a.changed===!0?i.unpublished:i.live}),(0,K.jsx)(Be,{words:n?i.preview:i.settings,from:`end`,children:(0,K.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":n?i.preview:i.settings,"aria-pressed":n,disabled:h===void 0,onClick:r,children:(0,K.jsx)(De,{"aria-hidden":!0})})}),(0,K.jsxs)(f,{size:`xs`,disabled:o,onClick:()=>{h===void 0?d(!0):e.publish()},children:[l!==void 0&&(0,K.jsx)(N,{value:ke(l)}),o?i.publishing:g?i.update:i.publish]}),(0,K.jsx)(I,{open:u&&c===void 0&&h===void 0,onOpenChange:d,children:(0,K.jsxs)(R,{className:Q.content,children:[(0,K.jsx)(P,{className:Q.header,children:(0,K.jsx)(L,{className:`font-serif`,children:i.first})}),(0,K.jsxs)(`form`,{className:`contents`,onSubmit:t=>{t.preventDefault(),y&&e.publish({slug:_,...a.elsewhere===!0?{anew:!0}:{}})},children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(fe,{"aria-label":i.address,"aria-invalid":b!==void 0,"aria-describedby":`site-address-why`,value:_,onChange:e=>{m(e.target.value.toLowerCase())},className:`font-mono`}),(0,K.jsxs)(`span`,{className:`font-mono text-sm text-lead`,children:[`.`,a.domain]})]}),(0,K.jsx)(`p`,{id:`site-address-why`,role:`status`,className:`min-h-5 text-sm text-problem-text`,children:b})]}),(0,K.jsx)(`p`,{className:`text-sm text-lead`,children:a.elsewhere===!0?i.elsewhereNote:i.firstNote}),s!==void 0&&s.refused===void 0&&(0,K.jsx)(`p`,{className:`text-sm text-problem-text`,children:i.notPublished}),(0,K.jsx)(F,{className:Q.footer,children:(0,K.jsx)(f,{type:`submit`,disabled:!y,children:o?i.publishing:i.publish})})]})]})}),(0,K.jsx)(I,{open:c!==void 0&&!g,onOpenChange:t=>{t||e.stopWaiting()},children:(0,K.jsxs)(R,{className:Q.content,children:[(0,K.jsx)(P,{className:Q.header,children:(0,K.jsx)(L,{className:`font-serif`,children:i.askTitle})}),(0,K.jsx)(`p`,{className:`text-sm text-lead`,children:i.ask}),(0,K.jsxs)(F,{className:Q.footer,children:[(0,K.jsx)(f,{variant:`outline`,onClick:e.stopWaiting,children:t.w.cancel}),(0,K.jsx)(f,{autoFocus:!0,onClick:e.openAgain,children:i.openAgain})]})]})})]}):null}function Ue({hosting:e,said:t}){let n=t.w.hosting,{tag:r}=t,[i,a]=(0,G.useState)(!1),{status:o,busy:s}=e,c=o?.detail;if(c===void 0)return null;let{site:l,deployments:u}=c,d=Ve(l.url),p=u.find(e=>e.live)?.createdAt,m=e=>p!==void 0&&Date.parse(e)<Date.parse(p);return(0,K.jsxs)(`div`,{className:`absolute inset-0 overflow-y-auto bg-sheet`,children:[(0,K.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 px-6 py-8`,children:[(0,K.jsxs)(Y,{children:[(0,K.jsx)(X,{label:n.address,children:(0,K.jsx)(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`,className:`font-mono text-sm hover:underline`,children:d})}),(0,K.jsx)(Z,{label:n.agent,children:(0,K.jsx)(ae,{checked:l.autoPublish,disabled:s,onCheckedChange:t=>{e.settings({autoPublish:t})}})}),(0,K.jsx)(Z,{label:n.search,children:(0,K.jsx)(ae,{checked:l.indexing,disabled:s,onCheckedChange:t=>{e.settings({indexing:t})}})})]}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h2`,{className:`mb-2 text-sm font-medium`,children:n.versions}),(0,K.jsx)(Y,{children:u.map(t=>(0,K.jsx)(X,{label:t.note??Ie(Date.parse(t.createdAt),r),detail:t.note===null?void 0:Ie(Date.parse(t.createdAt),r),children:t.live?(0,K.jsx)(`span`,{className:`text-xs text-lead`,children:n.live}):(0,K.jsx)(f,{variant:`outline`,size:`xs`,disabled:s,onClick:()=>{e.goLive(t.id)},children:m(t.createdAt)?n.rollBack:n.makeLive})},t.id))})]}),(0,K.jsxs)(Y,{children:[l.liveDeployment!==null&&(0,K.jsx)(X,{label:n.unpublishNote,children:(0,K.jsx)(f,{variant:`outline`,size:`xs`,disabled:s,onClick:e.unpublish,children:n.unpublish})}),(0,K.jsx)(X,{label:n.removeNote(d),children:(0,K.jsx)(f,{variant:`outline`,size:`xs`,disabled:s,onClick:()=>{a(!0)},children:n.remove})})]})]}),(0,K.jsx)(I,{open:i,onOpenChange:a,children:(0,K.jsxs)(R,{className:Q.content,children:[(0,K.jsx)(P,{className:Q.header,children:(0,K.jsx)(L,{className:`font-serif`,children:n.remove})}),(0,K.jsx)(`p`,{className:`text-sm text-lead`,children:n.removeNote(d)}),(0,K.jsxs)(F,{className:Q.footer,children:[(0,K.jsx)(f,{variant:`outline`,onClick:()=>{a(!1)},children:t.w.cancel}),(0,K.jsx)(f,{variant:`destructive`,onClick:()=>{a(!1),e.remove()},children:n.remove})]})]})})]})}var $=m({en:{starting:`Starting the website…`,startingJob:e=>`Starting ${e}`,cancel:`Cancel`,asleep:`A website's preview needs the agent awake.`,edit:`Edit`,hosting:{publish:`Publish`,update:`Update`,settings:`Website settings`,preview:`Preview`,unpublished:`Unpublished changes`,address:`Address`,first:`Publish this website`,firstNote:`Anyone with the address can see it.`,publishing:`Publishing…`,notPublished:`It was not published. Try again.`,askTitle:`Confirm in your browser`,ask:`A site's first publish is confirmed in your browser.`,openAgain:`Open again`,versions:`Versions`,live:`Live`,rollBack:`Roll back`,makeLive:`Make live`,elsewhere:`Published by another team`,elsewhereNote:`This folder names another team’s site. Publishing makes a new one of yours; theirs stays as it is. Anyone with the address can see it.`,slug:{length:(e,t)=>`An address is ${String(e)} to ${String(t)} characters.`,characters:`Use lowercase letters, digits and hyphens.`,hyphenEnds:`An address can’t start or end with a hyphen.`,doubleHyphen:`An address can’t have two hyphens in a row.`,reserved:`That address is reserved.`},unavailable:e=>`${e} is not available.`,agent:`Let the agent update the live site`,search:`Show in search engines`,unpublish:`Unpublish`,unpublishNote:`Takes the site offline within a minute. It keeps its address and versions.`,remove:`Delete site`,removeNote:e=>`${e} goes offline for good, and its address can never be used again.`}},"zh-cn":{starting:`正在启动网站…`,startingJob:e=>`正在启动 ${e}`,cancel:`取消`,asleep:`网站预览需要 Agent 处于唤醒状态。`,edit:`编辑`,hosting:{publish:`发布`,update:`更新`,settings:`网站设置`,preview:`预览`,unpublished:`有未发布的更改`,address:`地址`,first:`发布这个网站`,firstNote:`知道地址的人都能看到。`,publishing:`正在发布…`,notPublished:`没有发布成功,请再试一次。`,askTitle:`请在浏览器中确认`,ask:`网站第一次发布需要在浏览器中确认。`,openAgain:`再次打开`,versions:`版本`,live:`线上`,rollBack:`回滚`,makeLive:`设为上线`,elsewhere:`由其他团队发布`,elsewhereNote:`这个文件夹指向另一个团队的网站。发布会为你新建一个网站,他们的保持不变。知道地址的人都能看到。`,slug:{length:(e,t)=>`地址为 ${String(e)} 到 ${String(t)} 个字符。`,characters:`只能用小写字母、数字和连字符。`,hyphenEnds:`地址不能以连字符开头或结尾。`,doubleHyphen:`地址里不能有两个连续的连字符。`,reserved:`这个地址是保留的。`},unavailable:e=>`${e} 不可用。`,agent:`允许 agent 更新线上网站`,search:`在搜索引擎中显示`,unpublish:`取消发布`,unpublishNote:`一分钟内让网站下线,地址和版本都会保留。`,remove:`删除网站`,removeNote:e=>`${e} 将永久下线,这个地址也不能再使用。`}},"zh-tw":{starting:`正在啟動網站…`,startingJob:e=>`正在啟動 ${e}`,cancel:`取消`,asleep:`網站預覽需要 Agent 處於喚醒狀態。`,edit:`編輯`,hosting:{publish:`發布`,update:`更新`,settings:`網站設定`,preview:`預覽`,unpublished:`有未發布的變更`,address:`網址`,first:`發布這個網站`,firstNote:`知道網址的人都能看到。`,publishing:`正在發布…`,notPublished:`沒有發布成功,請再試一次。`,askTitle:`請在瀏覽器中確認`,ask:`網站第一次發布需要在瀏覽器中確認。`,openAgain:`再次開啟`,versions:`版本`,live:`線上`,rollBack:`復原`,makeLive:`設為上線`,elsewhere:`由其他團隊發布`,elsewhereNote:`這個資料夾指向另一個團隊的網站。發布會為你新建一個網站,他們的保持不變。知道網址的人都能看到。`,slug:{length:(e,t)=>`網址為 ${String(e)} 到 ${String(t)} 個字元。`,characters:`只能用小寫字母、數字和連字號。`,hyphenEnds:`網址不能以連字號開頭或結尾。`,doubleHyphen:`網址裡不能有兩個連續的連字號。`,reserved:`這個網址是保留的。`},unavailable:e=>`${e} 無法使用。`,agent:`允許 agent 更新線上網站`,search:`在搜尋引擎中顯示`,unpublish:`取消發布`,unpublishNote:`一分鐘內讓網站下線,網址和版本都會保留。`,remove:`刪除網站`,removeNote:e=>`${e} 將永久下線,這個網址也不能再使用。`}},ja:{starting:`ウェブサイトを起動しています…`,startingJob:e=>`${e} を起動しています`,cancel:`キャンセル`,asleep:`ウェブサイトのプレビューにはエージェントが起きている必要があります。`,edit:`編集`,hosting:{publish:`公開`,update:`更新`,settings:`ウェブサイトの設定`,preview:`プレビュー`,unpublished:`未公開の変更`,address:`アドレス`,first:`このウェブサイトを公開`,firstNote:`アドレスを知っている人は誰でも見られます。`,publishing:`公開しています…`,notPublished:`公開できませんでした。もう一度お試しください。`,askTitle:`ブラウザで確認してください`,ask:`サイトの最初の公開はブラウザで確認します。`,openAgain:`もう一度開く`,versions:`バージョン`,live:`公開中`,rollBack:`戻す`,makeLive:`公開する`,elsewhere:`別のチームが公開`,elsewhereNote:`このフォルダーは別のチームのサイトを指しています。公開するとあなたの新しいサイトができ、相手のサイトはそのままです。アドレスを知っている人は誰でも見られます。`,slug:{length:(e,t)=>`アドレスは ${String(e)}〜${String(t)} 文字です。`,characters:`小文字、数字、ハイフンだけが使えます。`,hyphenEnds:`アドレスの最初と最後にハイフンは使えません。`,doubleHyphen:`ハイフンを2つ続けては使えません。`,reserved:`このアドレスは予約されています。`},unavailable:e=>`${e} は使えません。`,agent:`公開中のサイトをエージェントに更新させる`,search:`検索エンジンに表示`,unpublish:`非公開にする`,unpublishNote:`1 分以内にサイトを非公開にします。アドレスとバージョンは残ります。`,remove:`サイトを削除`,removeNote:e=>`${e} は完全にオフラインになり、このアドレスは二度と使えません。`}},ko:{starting:`웹사이트를 시작하는 중…`,startingJob:e=>`${e} 시작하는 중`,cancel:`취소`,asleep:`웹사이트 미리보기는 에이전트가 깨어 있어야 합니다.`,edit:`편집`,hosting:{publish:`게시`,update:`업데이트`,settings:`웹사이트 설정`,preview:`미리 보기`,unpublished:`게시되지 않은 변경 사항`,address:`주소`,first:`이 웹사이트 게시`,firstNote:`주소를 아는 사람은 누구나 볼 수 있습니다.`,publishing:`게시 중…`,notPublished:`게시되지 않았습니다. 다시 시도해 주세요.`,askTitle:`브라우저에서 확인하세요`,ask:`사이트의 첫 게시는 브라우저에서 확인합니다.`,openAgain:`다시 열기`,versions:`버전`,live:`게시 중`,rollBack:`되돌리기`,makeLive:`게시하기`,elsewhere:`다른 팀이 게시함`,elsewhereNote:`이 폴더는 다른 팀의 사이트를 가리킵니다. 게시하면 내 사이트가 새로 만들어지고, 그 팀의 사이트는 그대로 남습니다. 주소를 아는 사람은 누구나 볼 수 있습니다.`,slug:{length:(e,t)=>`주소는 ${String(e)}~${String(t)}자입니다.`,characters:`소문자, 숫자, 하이픈만 쓸 수 있습니다.`,hyphenEnds:`주소는 하이픈으로 시작하거나 끝날 수 없습니다.`,doubleHyphen:`하이픈을 두 개 연달아 쓸 수 없습니다.`,reserved:`예약된 주소입니다.`},unavailable:e=>`${e}은(는) 사용할 수 없습니다.`,agent:`에이전트가 게시된 사이트를 업데이트하도록 허용`,search:`검색 엔진에 표시`,unpublish:`게시 취소`,unpublishNote:`1분 안에 사이트를 내립니다. 주소와 버전은 그대로 남습니다.`,remove:`사이트 삭제`,removeNote:e=>`${e} 영구히 오프라인이 되며, 이 주소는 다시 사용할 수 없습니다.`}},es:{starting:`Iniciando el sitio web…`,startingJob:e=>`Iniciando ${e}`,cancel:`Cancelar`,asleep:`La vista previa de un sitio web necesita al agente despierto.`,edit:`Editar`,hosting:{publish:`Publicar`,update:`Actualizar`,settings:`Ajustes del sitio web`,preview:`Vista previa`,unpublished:`Cambios sin publicar`,address:`Dirección`,first:`Publicar este sitio web`,firstNote:`Cualquiera con la dirección puede verlo.`,publishing:`Publicando…`,notPublished:`No se publicó. Inténtalo de nuevo.`,askTitle:`Confirma en tu navegador`,ask:`La primera publicación de un sitio se confirma en tu navegador.`,openAgain:`Abrir de nuevo`,versions:`Versiones`,live:`En línea`,rollBack:`Restaurar`,makeLive:`Poner en línea`,elsewhere:`Publicado por otro equipo`,elsewhereNote:`Esta carpeta es del sitio de otro equipo. Al publicar se crea uno nuevo tuyo; el suyo queda como está. Cualquiera con la dirección puede verlo.`,slug:{length:(e,t)=>`Una dirección tiene de ${String(e)} a ${String(t)} caracteres.`,characters:`Usa minúsculas, números y guiones.`,hyphenEnds:`Una dirección no empieza ni termina con guion.`,doubleHyphen:`Una dirección no lleva dos guiones seguidos.`,reserved:`Esa dirección está reservada.`},unavailable:e=>`${e} no está disponible.`,agent:`Dejar que el agente actualice el sitio publicado`,search:`Mostrar en buscadores`,unpublish:`Retirar`,unpublishNote:`Desconecta el sitio en menos de un minuto. Conserva su dirección y sus versiones.`,remove:`Eliminar sitio`,removeNote:e=>`${e} deja de estar en línea para siempre, y la dirección no podrá volver a usarse.`}},fr:{starting:`Démarrage du site web…`,startingJob:e=>`Démarrage de ${e}`,cancel:`Annuler`,asleep:`L'aperçu d'un site web nécessite que l'agent soit éveillé.`,edit:`Modifier`,hosting:{publish:`Publier`,update:`Mettre à jour`,settings:`Réglages du site web`,preview:`Aperçu`,unpublished:`Modifications non publiées`,address:`Adresse`,first:`Publier ce site web`,firstNote:`Toute personne ayant l'adresse peut le voir.`,publishing:`Publication…`,notPublished:`Ce n’a pas été publié. Réessayez.`,askTitle:`Confirmez dans votre navigateur`,ask:`La première publication d'un site se confirme dans votre navigateur.`,openAgain:`Rouvrir`,versions:`Versions`,live:`En ligne`,rollBack:`Restaurer`,makeLive:`Mettre en ligne`,elsewhere:`Publié par une autre équipe`,elsewhereNote:`Ce dossier désigne le site d’une autre équipe. Publier en crée un nouveau à vous ; le leur reste tel quel. Toute personne ayant l’adresse peut le voir.`,slug:{length:(e,t)=>`Une adresse compte de ${String(e)} à ${String(t)} caractères.`,characters:`Utilisez des minuscules, des chiffres et des tirets.`,hyphenEnds:`Une adresse ne commence ni ne finit par un tiret.`,doubleHyphen:`Une adresse n’a pas deux tirets d’affilée.`,reserved:`Cette adresse est réservée.`},unavailable:e=>`${e} n’est pas disponible.`,agent:`Laisser l'agent mettre à jour le site en ligne`,search:`Afficher dans les moteurs de recherche`,unpublish:`Dépublier`,unpublishNote:`Met le site hors ligne en moins d’une minute. Il garde son adresse et ses versions.`,remove:`Supprimer le site`,removeNote:e=>`${e} est mis hors ligne définitivement, et l'adresse ne pourra plus jamais servir.`}},de:{starting:`Website wird gestartet…`,startingJob:e=>`${e} wird gestartet`,cancel:`Abbrechen`,asleep:`Die Vorschau einer Website braucht einen wachen Agenten.`,edit:`Bearbeiten`,hosting:{publish:`Veröffentlichen`,update:`Aktualisieren`,settings:`Website-Einstellungen`,preview:`Vorschau`,unpublished:`Unveröffentlichte Änderungen`,address:`Adresse`,first:`Diese Website veröffentlichen`,firstNote:`Jeder mit der Adresse kann sie sehen.`,publishing:`Wird veröffentlicht…`,notPublished:`Es wurde nicht veröffentlicht. Versuche es noch einmal.`,askTitle:`Im Browser bestätigen`,ask:`Die erste Veröffentlichung einer Website wird im Browser bestätigt.`,openAgain:`Erneut öffnen`,versions:`Versionen`,live:`Live`,rollBack:`Zurücksetzen`,makeLive:`Live schalten`,elsewhere:`Von einem anderen Team veröffentlicht`,elsewhereNote:`Dieser Ordner gehört zur Website eines anderen Teams. Beim Veröffentlichen entsteht eine neue von dir; ihre bleibt, wie sie ist. Jeder mit der Adresse kann sie sehen.`,slug:{length:(e,t)=>`Eine Adresse hat ${String(e)} bis ${String(t)} Zeichen.`,characters:`Nur Kleinbuchstaben, Ziffern und Bindestriche.`,hyphenEnds:`Eine Adresse beginnt und endet nicht mit einem Bindestrich.`,doubleHyphen:`Eine Adresse hat keine zwei Bindestriche hintereinander.`,reserved:`Diese Adresse ist reserviert.`},unavailable:e=>`${e} ist nicht verfügbar.`,agent:`Den Agenten die Live-Website aktualisieren lassen`,search:`In Suchmaschinen anzeigen`,unpublish:`Offline nehmen`,unpublishNote:`Nimmt die Website innerhalb einer Minute offline. Adresse und Versionen bleiben.`,remove:`Website löschen`,removeNote:e=>`${e} geht endgültig offline, und die Adresse kann nie wieder verwendet werden.`}},pt:{starting:`Iniciando o site…`,startingJob:e=>`Iniciando ${e}`,cancel:`Cancelar`,asleep:`A prévia de um site precisa do agente acordado.`,edit:`Editar`,hosting:{publish:`Publicar`,update:`Atualizar`,settings:`Configurações do site`,preview:`Pré-visualização`,unpublished:`Alterações não publicadas`,address:`Endereço`,first:`Publicar este site`,firstNote:`Qualquer pessoa com o endereço pode vê-lo.`,publishing:`Publicando…`,notPublished:`Não foi publicado. Tente de novo.`,askTitle:`Confirme no navegador`,ask:`A primeira publicação de um site é confirmada no navegador.`,openAgain:`Abrir de novo`,versions:`Versões`,live:`No ar`,rollBack:`Restaurar`,makeLive:`Pôr no ar`,elsewhere:`Publicado por outra equipe`,elsewhereNote:`Esta pasta aponta para o site de outra equipe. Publicar cria um novo seu; o deles continua como está. Qualquer pessoa com o endereço pode vê-lo.`,slug:{length:(e,t)=>`Um endereço tem de ${String(e)} a ${String(t)} caracteres.`,characters:`Use letras minúsculas, números e hifens.`,hyphenEnds:`Um endereço não começa nem termina com hífen.`,doubleHyphen:`Um endereço não tem dois hifens seguidos.`,reserved:`Esse endereço é reservado.`},unavailable:e=>`${e} não está disponível.`,agent:`Deixar o agente atualizar o site no ar`,search:`Mostrar em buscadores`,unpublish:`Tirar do ar`,unpublishNote:`Deixa o site offline em até um minuto. Ele mantém o endereço e as versões.`,remove:`Excluir site`,removeNote:e=>`${e} sai do ar para sempre, e o endereço nunca mais poderá ser usado.`}}});function We({className:e}){let t=n();if(t===void 0)return null;let r=u(t.locale),{id:i,entry:a}=t.item;return(0,K.jsx)(qe,{id:i,entry:a,said:{w:$.of(r),tag:p[r]},className:e},i)}function Ge(e){let[t,n]=(0,G.useState)(0);return c(e,()=>{n(e=>e+1)}),t}function Ke(e){try{let t=JSON.parse(e).dev;return typeof t!=`string`||t.trim()===``}catch{return!1}}function qe({id:e,entry:t,said:n,className:c}){let u=s(),{w:p}=n,m=e.slice(e.lastIndexOf(`/`)+1),[h,g]=(0,G.useState)({at:`starting`}),[_,v]=(0,G.useState)(0),[y,b]=(0,G.useState)(!1),x=Ge(e),S=Ne(t),C=ze(e,x,S),w=h.at===`failed`?x:void 0,T=o(),E=h.at===`asleep`?T:void 0;(0,G.useEffect)(()=>{let t=!0;return J(u,`website/preview`,{item:e}).then(({url:e})=>{t&&g({at:`ready`,url:e})},e=>{t&&g(te(e)?{at:`asleep`}:{at:`failed`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[u,e,_,w,E]);let[D,ee]=(0,G.useState)(!1);(0,G.useEffect)(()=>{let e=!0;return u[`files/read`]({path:t}).then(({text:t})=>{e&&ee(Ke(t))},()=>void 0),()=>{e=!1}},[u,t,x]);let O=h.at===`failed`;a(`jobs/changed`,({job:e,item:n})=>{O&&n===t&&e.what===`start`&&e.state===`running`&&(g({at:`starting`}),v(e=>e+1))});let k=(0,G.useRef)(null);i({hold:()=>Promise.resolve({key:`website@${e}@${crypto.randomUUID()}`,what:m,source:{path:t}}),locate:()=>Promise.resolve({elements:[]})});let A=()=>{let e=k.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0},j=(0,G.useRef)(void 0),M=()=>j.current??Promise.resolve(void 0);return r({element:()=>k.current,hold:()=>{let t=A();return j.current=t?J(u,`website/hold`,{item:e,width:Math.round(t.width),height:Math.round(t.height),scale:Math.min(4,Math.max(1,window.devicePixelRatio))}).then(e=>e.hold,()=>void 0):Promise.resolve(void 0),j.current.then(()=>void 0)},release:()=>{let e=j.current;j.current=void 0,e?.then(e=>e===void 0?void 0:J(u,`website/release`,{hold:e}).catch(()=>void 0))},pictures:async()=>{let t=A();if(!t)return[];let n=await M(),{image:r}=await J(u,`website/still`,{item:e,width:Math.round(t.width),height:Math.round(t.height),scale:Math.min(4,Math.max(1,window.devicePixelRatio)),...n===void 0?{}:{hold:n}});return[{...r,rect:t}]},locate:async n=>{let r=A(),i=r?l(n).map(e=>({x:e.x-r.x,y:e.y-r.y})).filter(e=>e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height):[],a=await M(),o=r&&i.length>0?await J(u,`website/at`,{item:e,width:Math.round(r.width),height:Math.round(r.height),points:i,...a===void 0?{}:{hold:a}}).catch(()=>void 0):void 0,s=o?.page??``;return{elements:o&&o.elements.length>0?o.elements.map(e=>({name:`the element ${e.selector} of the page ${s}`,source:{path:t},...e.text===``?{}:{text:e.text}})):[{name:`the page of the website ${m}`,source:{path:t}}],where:`on the website ${m}${s===``?``:` at ${s}`}, as its dev server serves it`}}}),h.at===`asleep`?(0,K.jsxs)(`div`,{className:d(`absolute inset-0 flex flex-col items-center justify-center gap-3 p-6`,c),children:[(0,K.jsx)(`p`,{className:`text-sm text-lead`,children:p.asleep}),(0,K.jsx)(f,{size:`xs`,onClick:()=>{u[`edit/request`]({}).catch(()=>void 0)},children:p.edit})]}):(0,K.jsxs)(`div`,{className:d(`absolute inset-0 flex flex-col`,c),children:[(0,K.jsx)(He,{hosting:C,said:n,settings:y,onSettings:()=>{b(e=>!e)}}),(0,K.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[h.at===`ready`&&(0,K.jsx)(`iframe`,{ref:k,title:m,src:h.url,"data-testid":`site`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,className:`absolute inset-0 size-full border-0 bg-page`},D?x:void 0),h.at===`starting`&&(0,K.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-lead`,children:(0,K.jsx)(Je,{job:Pe(S,`start`),name:m,w:p})}),h.at===`failed`&&(0,K.jsx)(pe,{className:`absolute inset-0 flex items-center justify-center`}),y&&C.status?.detail!==void 0&&(0,K.jsx)(Ue,{hosting:C,said:n})]})]})}function Je({job:e,name:t,w:n}){if(e===void 0)return(0,K.jsx)(`span`,{className:`animate-pulse`,children:n.starting});let r=ke(e);return(0,K.jsxs)(`span`,{role:`status`,className:`flex flex-col items-center gap-2`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r===void 0&&(0,K.jsx)(N,{className:`text-ink`}),n.startingJob(e.name??t)]}),r!==void 0&&(0,K.jsx)(ie,{value:r*100,className:`h-1 w-48`})]})}export{$ as WORDS,We as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
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 A,ot as j,q as ne,r as re,rt as M,s as N,st as P,t as ie,ut as F,yt as ae,z as oe}from"./x-BAJilkKD.js";import{o as se,w as ce}from"./snapshots-8hCkRemI.js";import{t as le}from"./jsx-runtime-DePvh3-m.js";import{_ as ue,a as de,b as fe,c as pe,d as I,f as me,g as he,i as ge,l as _e,o as ve,p as ye,s as be,t as L,v as xe,y as Se}from"./bar-button-BJ-_6g-F.js";import{n as Ce,t as we}from"./progress-D1Uv3d1b.js";import{t as R}from"./createLucideIcon-euu7Wcd9.js";import{J as z}from"./index-BSd85XUU.js";var B=e(n(),1),V=le(),Te=Object.defineProperty,H=(e,t)=>Te(e,`name`,{value:t,configurable:!0}),Ee=`Checkbox`,[De,Oe]=P(Ee),[ke,Ae]=De(Ee);function je(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:Ee}),[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useRef(!1),[y,b]=B.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:!U(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,V.jsx)(ke,{scope:t,...S,children:ze(d)?d(S):r})}H(je,`CheckboxProvider`);var Me=`CheckboxTrigger`,Ne=B.forwardRef(H(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}=Ae(Me,e),g=O(i,u),_=B.useRef(c);return B.useEffect(()=>{let e=a?.form;if(e){let t=H(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)(F.button,{type:`button`,role:`checkbox`,"aria-checked":U(c)?`mixed`:c,"aria-required":l,"data-state":Be(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:j(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:j(n,e=>{p(),d(e=>U(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),Pe=B.forwardRef(H(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,V.jsx)(je,{__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,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ne,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(Re,{__scopeCheckbox:n})]})})},`Checkbox`)),Fe=`CheckboxIndicator`,Ie=B.forwardRef(H(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ae(Fe,n);return(0,V.jsx)(M,{present:r||U(a.checked)||a.checked===!0,children:(0,V.jsx)(F.span,{"data-state":Be(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),Le=`CheckboxBubbleInput`,Re=B.forwardRef(H(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}=Ae(Le,e),g=O(r,h),_=oe(i),v=B.useRef(!1),y=B.useRef(s),b=B.useRef(o);B.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=U(s),n.call(e,!U(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=B.useRef(!U(s)&&s);return(0,V.jsx)(F.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:j(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function ze(e){return typeof e==`function`}H(ze,`isFunction`);function U(e){return e===`indeterminate`}H(U,`isIndeterminate`);function Be(e){return U(e)?`indeterminate`:e?`checked`:`unchecked`}H(Be,`getState`);var Ve=Object.defineProperty,W=(e,t)=>Ve(e,`name`,{value:t,configurable:!0}),He=`Popover`,[Ue,We]=P(He,[N]),G=N(),[Ge,K]=Ue(He),Ke=W(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=G(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=B.useState(0),[p,m]=B.useState(0),[h,g]=E({prop:r,defaultProp:i??!1,onChange:a,caller:He});return(0,V.jsx)(re,{...s,children:(0,V.jsx)(Ge,{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:B.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>u(!0),[]),onCustomAnchorRemove:B.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),qe=`PopoverAnchor`,Je=B.forwardRef(W(function(e,t){let{__scopePopover:n,...r}=e,i=K(qe,n),a=G(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(ee,{...a,...r,ref:t})},`PopoverAnchor`)),Ye=`PopoverTrigger`,Xe=B.forwardRef(W(function(e,t){let{__scopePopover:n,...r}=e,i=K(Ye,n),a=G(n),o=O(t,i.triggerRef),s=(0,V.jsx)(F.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":st(i.open),...r,ref:o,onClick:j(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(ee,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Ze=`PopoverPortal`,[Qe,$e]=Ue(Ze,{forceMount:void 0}),et=W(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=K(Ze,t);return(0,V.jsx)(Qe,{scope:t,forceMount:n,children:(0,V.jsx)(M,{present:n||a.open,children:(0,V.jsx)(y,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),q=`PopoverContent`,tt=B.forwardRef(W(function(e,t){let n=$e(q,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=K(q,e.__scopePopover);return(0,V.jsx)(M,{present:r||a.open,children:a.modal?(0,V.jsx)(rt,{...i,ref:t}):(0,V.jsx)(it,{...i,ref:t})})},`PopoverContent`)),nt=C(`PopoverContent.RemoveScroll`),rt=B.forwardRef(W(function(e,t){let n=K(q,e.__scopePopover),r=B.useRef(null),i=O(t,r),a=B.useRef(!1),{nodes:o,registry:s}=c();return B.useEffect(()=>{let e=r.current;if(e)return p(e)},[]),(0,V.jsx)(ne,{as:nt,allowPinchZoom:!0,shards:B.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,V.jsx)(at,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:j(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:j(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:j(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),it=B.forwardRef(W(function(e,t){let n=K(q,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(at,{...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`)),at=B.forwardRef(W(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(q,n),y=G(n),[x,C]=B.useState(null),w=O(t,C);return m(x),f(),(0,V.jsx)(b,{registry:h,children:(0,V.jsx)(v,{asChild:!0,loop:!0,trapped:r,branches:p,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(S,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>_.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,V.jsx)(A,{"data-state":st(_.open),role:`dialog`,id:_.contentId,"aria-labelledby":_.titlePresent?_.titleId:void 0,"aria-describedby":_.descriptionPresent?ct(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`)),ot=B.forwardRef(W(function(e,t){let{__scopePopover:n,...r}=e,i=G(n);return(0,V.jsx)(x,{...i,...r,ref:t})},`PopoverArrow`));function st(e){return e?`open`:`closed`}W(st,`getState`);function ct(...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}W(ct,`concatAriaDescribedby`);var lt=Object.defineProperty,ut=(e,t)=>lt(e,`name`,{value:t,configurable:!0}),dt=`Toggle`,ft=B.forwardRef(ut(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=E({prop:n,onChange:i,defaultProp:r??!1,caller:dt});return(0,V.jsx)(F.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:j(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),pt=Object.defineProperty,J=(e,t)=>pt(e,`name`,{value:t,configurable:!0}),Y=`ToggleGroup`,X={Single:`single`,Multiple:`multiple`},[mt,ht]=P(Y,[Se]),gt=Se(),_t=B.forwardRef(J(function(e,t){let{type:n,...r}=e;if(n===X.Single)return(0,V.jsx)(bt,{role:`radiogroup`,...r,ref:t});if(n===X.Multiple)return(0,V.jsx)(xt,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Y}\``)},`ToggleGroup`)),[vt,yt]=mt(Y),bt=B.forwardRef(J(function(e,t){let{value:n,defaultValue:r,onValueChange:i=J(()=>{},`onValueChange`),...a}=e,[o,s]=E({prop:n,defaultProp:r??``,onChange:i,caller:Y});return(0,V.jsx)(vt,{scope:e.__scopeToggleGroup,type:X.Single,value:B.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:B.useCallback(()=>s(``),[s]),children:(0,V.jsx)(wt,{...a,ref:t})})},`ToggleGroupImplSingle`)),xt=B.forwardRef(J(function(e,t){let{value:n,defaultValue:r,onValueChange:i=J(()=>{},`onValueChange`),...a}=e,[o,s]=E({prop:n,defaultProp:r??[],onChange:i,caller:Y}),c=B.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=B.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,V.jsx)(vt,{scope:e.__scopeToggleGroup,type:X.Multiple,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,V.jsx)(wt,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[St,Ct]=mt(Y),wt=B.forwardRef(J(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=gt(n),u=fe(o),d={dir:u,...c};return(0,V.jsx)(St,{scope:n,rovingFocus:i,disabled:r,children:i?(0,V.jsx)(ue,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,V.jsx)(F.div,{...d,ref:t})}):(0,V.jsx)(F.div,{...d,ref:t})})},`ToggleGroupImpl`)),Tt=`ToggleGroupItem`,Et=B.forwardRef(J(function(e,t){let n=yt(Tt,e.__scopeToggleGroup),r=Ct(Tt,e.__scopeToggleGroup),i=gt(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=B.useRef(null);return r.rovingFocus?(0,V.jsx)(xe,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,V.jsx)(Dt,{...s,ref:t})}):(0,V.jsx)(Dt,{...s,ref:t})},`ToggleGroupItem`)),Dt=B.forwardRef(J(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=yt(Tt,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===X.Single?o:void 0;return(0,V.jsx)(ft,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),Ot=R(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),kt=R(`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`}]]),At=R(`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`}]]),jt=R(`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`}]]),Mt=R(`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`}]]),Nt=R(`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`}]]),Pt=R(`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`}]]),Ft=R(`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`}]]),It=R(`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`}]]),Lt=R(`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`}]]),Rt=R(`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`}]]),zt=R(`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`}]]),Bt=R(`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`}]]),Vt=R(`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`}]]),Ht=R(`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`}]]),Ut=R(`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`}]]),Wt=R(`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`}]]),Gt=R(`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`}]]),Kt=R(`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`}]]),Z=ae({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}`,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}`,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}`,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}のフォローをやめる`,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} 따라가기 중지`,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}`,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}`,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`,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}`,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 qt(){let e=r(),t=Z.of(e?.locale);return e=>e.doing===void 0?e.name:t.agentDoing[e.doing](e.name)}function Jt(){let e=r(),n=qt(),{agent:i,following:a,follow:o,unfollow:c}=t();if(i?.doing===void 0)return null;let l=Z.of(e?.locale);return(0,V.jsxs)(L,{[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,V.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 Yt(){let e=o(),{agent:n,following:r,follow:i,unfollow:s}=t(),c=n?.doing,l=n?.name;return(0,B.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 Xt({checked:e,multiple:t=!1,variant:n=`row`,className:r,children:i,...a}){return(0,V.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,V.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,V.jsx)(he,{className:`size-3`})}),i]})}var Q=16,Zt=8;function Qt(){return(0,V.jsx)(ot,{asChild:!0,width:Q,height:Zt,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 ${String(Q)} ${String(Zt)}`,"aria-hidden":!0,className:`-mt-px block overflow-visible`,children:[(0,V.jsx)(`path`,{d:`M0 -1 L${String(Q/2)} 7 L${String(Q)} -1 Z`,className:`fill-popover`}),(0,V.jsx)(`path`,{d:`M0 0 L${String(Q/2)} 7 L${String(Q)} 0`,className:`fill-none stroke-border`})]})})}function $t({className:e,...t}){return(0,V.jsx)(Pe,{"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,V.jsx)(Ie,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:(0,V.jsx)(he,{className:`size-3.5`})})})}function en({...e}){return(0,V.jsx)(Ke,{"data-slot":`popover`,...e})}function tn({...e}){return(0,V.jsx)(Xe,{"data-slot":`popover-trigger`,...e})}function nn({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,V.jsx)(et,{children:(0,V.jsx)(tt,{"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 rn({...e}){return(0,V.jsx)(Je,{"data-slot":`popover-anchor`,...e})}function an({...e}){return(0,V.jsx)(l,{"data-slot":`sheet`,...e})}function on({...e}){return(0,V.jsx)(_,{"data-slot":`sheet-portal`,...e})}function sn({className:e,...t}){return(0,V.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 cn({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,V.jsxs)(on,{children:[(0,V.jsx)(sn,{}),(0,V.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,V.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,V.jsx)(ie,{className:`size-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function ln({className:e,...t}){return(0,V.jsx)(u,{"data-slot":`sheet-title`,className:T(`font-semibold text-foreground`,e),...t})}var un=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`}}),dn=B.createContext({size:`default`,variant:`default`,spacing:0});function fn({className:e,variant:t,size:n,spacing:r=0,children:i,...a}){return(0,V.jsx)(_t,{"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,V.jsx)(dn.Provider,{value:{variant:t,size:n,spacing:r},children:i})})}function pn({className:e,children:t,variant:n,size:r,...i}){let a=B.useContext(dn);return(0,V.jsx)(Et,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:T(un({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 mn(e){if(e?.mode!==`edit`)return{gives:`nothing`};let t=e.commands!==!0,n=ce(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 hn(e,t,n){if(!n&&e.state===`done`&&t.has(e.id))return e.files.length===1?e.files[0]:void 0}var gn=5;function _n(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,gn)}var $=e=>e.state===`queued`||e.state===`running`,vn=e=>e.state===`running`&&e.progress===0,yn=6,bn=.95,xn=e=>bn*(1-Math.exp(-Math.max(0,e)/yn));function Sn(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 Cn(e,t,n,r={}){let i=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e));return $(e)&&i(e.versions,t)&&i(e.types,n)&&wn(e.options??{},r)}var wn=(e,t)=>Object.keys({...e,...t}).every(n=>e[n]===t[n]);function Tn(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 En(e,t){return Math.max(0,e.filter($).map(e=>e.id).indexOf(t))}function Dn(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 On(e,t){let n=e.findLast($);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 kn=e=>e.slice(e.lastIndexOf(`/`)+1);async function An(e,t){let{url:n}=await e[`files/url`]({path:t}),r=document.createElement(`a`);r.href=n,r.download=kn(t),r.click()}var jn={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`},Mn=(e,t)=>jn[t]??(t in e.type?e.type[t]:t);function Nn(){let e=r(),t=Z.of(e?.locale),n=e?.item.kindInfo.exports?.names,i=e?.locale??`en`;return e=>{let r=n?.[e];return r?.[i]??r?.en??Mn(t,e)}}function Pn(){let[e,t]=(0,B.useState)(()=>window.matchMedia(`(max-width: 479px)`).matches);return(0,B.useEffect)(()=>{let e=window.matchMedia(`(max-width: 479px)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function Fn(e,t){let n=o(),[r,i]=(0,B.useState)([]),[s,c]=(0,B.useState)(new Set),[l,u]=(0,B.useState)(!1),d=(0,B.useRef)(new Set),f=(0,B.useRef)(new Map),p=e=>{let r=hn(e,d.current,l);r!==void 0&&(d.current.delete(e.id),An(n,r).catch(e=>{I.error(t.notStarted,{description:e instanceof Error?e.message:String(e)})}))},m=(0,B.useRef)(new Map),[h,g]=(0,B.useState)(new Map),_=e=>{vn(e)?m.current.has(e.id)||m.current.set(e.id,performance.now()):(m.current.delete(e.id),$(e)||g(t=>{if(!t.has(e.id))return t;let n=new Map(t);return n.delete(e.id),n}))},v=r.some(vn);(0,B.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,xn((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,B.useEffect)(()=>{let e=!0;return z(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)}),!$(t)&&!e&&c(e=>new Set(e).add(t.id)),f.current.set(t.id,t),p(t)});let[b,x]=(0,B.useState)(e);return b!==e&&(x(e),e&&c(new Set)),{all:(0,B.useMemo)(()=>Sn(r,h),[r,h]),fresh:s,reveals:l,asked:y}}function In(e,t){let n=o(),r=`item-bar.export.${e}`,[i,a]=(0,B.useState)({type:t.types[0]??``,extras:[],options:{}});return(0,B.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 Ln(e,t,n){n&&await z(e,`export/reveal`,{path:t}).then(()=>!0,()=>!1)||await An(e,t)}function Rn({job:e,versions:t,ahead:n,words:i,reveals:a,onAsked:s}){let c=Nn(),l=o(),u=r()?.agent?.name??`AllyHub`,d=Math.round(e.progress*100),f=a?Wt:kt,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,V.jsxs)(`div`,{className:`border-t py-2 pr-2 pl-4`,"data-testid":`export-job`,"data-state":e.state,children:[$(e)&&(0,V.jsxs)(`div`,{className:`pr-2`,children:[(0,V.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,children:h}),(0,V.jsx)(`span`,{className:`text-lead text-xs tabular-nums`,children:e.state===`running`?`${String(d)}%`:n>0?i.queuedAhead(n):i.queued}),(0,V.jsx)(L,{icon:!0,"aria-label":i.cancel,title:i.cancel,"data-testid":`export-cancel`,onClick:()=>{z(l,`export/cancel`,{job:e.id}).catch(()=>void 0)},children:(0,V.jsx)(ie,{"aria-hidden":!0})})]}),(0,V.jsx)(we,{value:d,className:`mt-1 h-1`})]}),e.state===`failed`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,V.jsx)(me,{className:`text-destructive size-3.5 flex-none`,"aria-hidden":!0}),(0,V.jsxs)(`span`,{className:`text-dense text-destructive min-w-0 flex-1 truncate`,children:[i.failed,` · `,h]}),(0,V.jsx)(L,{icon:!0,"aria-label":i.retry,title:i.retry,"data-testid":`export-retry`,onClick:()=>{z(l,`export/start`,{item:e.item,versions:e.versions,types:e.types,...e.options?{options:e.options}:{}}).then(e=>{s(e.job)},e=>{I.error(i.notStarted,{description:e instanceof Error?e.message:String(e)})})},children:(0,V.jsx)(Gt,{"aria-hidden":!0})})]}),(0,V.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:i.failedHelp(u)})]}),e.files.map(e=>(0,V.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,"data-testid":`export-file`,children:[(0,V.jsx)(he,{className:`text-success size-3.5 flex-none`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,title:e,children:kn(e)}),(0,V.jsx)(L,{icon:!0,"aria-label":p,title:p,"data-testid":`export-give`,onClick:()=>{Ln(l,e,a)},children:(0,V.jsx)(f,{"aria-hidden":!0})})]},e)),e.state===`done`&&e.error!==void 0&&(0,V.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:i.partial})]})}function zn({versions:e,shown:t,picked:n,onPick:r,onBack:i,words:a}){return(0,V.jsxs)(`div`,{"data-testid":`export-choose`,children:[(0,V.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b pr-4 pl-2`,children:[(0,V.jsx)(L,{icon:!0,"aria-label":a.back,title:a.back,onClick:i,children:(0,V.jsx)(Ot,{"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:a.versions}),(0,V.jsxs)(`span`,{className:`text-lead ml-auto text-xs tabular-nums`,children:[n.length,`/`,e.length]})]}),(0,V.jsx)(`ul`,{className:`max-h-64 overflow-y-auto p-2`,children:e.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`label`,{className:`pressable flex h-8 items-center gap-2 rounded-md px-2 text-sm`,children:[(0,V.jsx)($t,{checked:n.includes(e.key),"data-version":e.key,onCheckedChange:t=>{r(t===!0?[...n,e.key]:n.filter(t=>t!==e.key))}}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.key===t&&(0,V.jsx)(`span`,{className:`text-lead text-xs`,children:a.onShow})]})},e.key))})]})}function Bn({kind:e,offer:t,item:n,props:r,jobs:i,all:a,words:s,reveals:c,onAsked:l,startRef:u}){let d=Nn(),f=o(),p=r.versions??[],m=p.map(e=>e.key),h=p.find(e=>e.key===r.shown)?.label,g=r.unavailable??{},[_,v]=In(e,t),[y,b]=(0,B.useState)(`shown`),[x,S]=(0,B.useState)(r.shown===void 0?[]:[r.shown]),[C,w]=(0,B.useState)(!1),[ee,E]=(0,B.useState)(!1),D=Dn(y,r.shown,m,x),O=D?.length??1,k=[_.type,..._.extras.filter(e=>g[e]===void 0)],A=t.options.filter(e=>e.only.includes(_.type)),j=Tn(A,_.type,_.options),ne=A.filter(e=>e.values===void 0),re=(e,t)=>{v({..._,options:{..._.options,[e]:t}})},M=r.check?.waiting===!0,N=M?0:r.check?.problems(D)??0,P=i.some(e=>Cn(e,D??[],k,j)),ie=async()=>{E(!0);try{l((await z(f,`export/start`,{item:n,...D?{versions:D}:{},types:k,...Object.keys(j).length>0?{options:j}:{}})).job)}catch(e){if(se(e))return;I.error(s.notStarted,{description:e instanceof Error?e.message:String(e)})}finally{E(!1)}},F=(0,V.jsx)(Hn,{label:s.format,types:t.types,chosen:_.type,name:d,onChoose:e=>{v({..._,type:e})}}),ae=(0,V.jsx)(te,{ref:u,size:`sm`,disabled:M||N>0||ee||O===0||P,"data-testid":`export-start`,onClick:()=>{ie()},children:M?s.checking:s.download});return(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg text-sm`,"data-testid":`export-panel`,children:[C?(0,V.jsx)(zn,{versions:p,shown:r.shown,picked:x,onPick:S,onBack:()=>{w(!1)},words:s}):(0,V.jsxs)(V.Fragment,{children:[t.types.length>1&&(0,V.jsx)(`div`,{className:`px-4 pt-4`,children:F}),(m.length>1||t.extras.length+A.length>0)&&(0,V.jsxs)(`div`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-3 px-4 pt-4`,children:[A.map(e=>e.values?(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`span`,{className:`text-lead`,children:s.option[e.name]?.label}),(0,V.jsx)(fn,{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!==``&&re(e.name,t)},children:e.values.map(t=>(0,V.jsx)(pn,{value:t,"data-value":t,className:`flex-1`,children:s.option[e.name]?.values?.[t]??t},t))})]},e.name):null),m.length>1&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`text-lead`,children:s.versions}),(0,V.jsxs)(ge,{value:y,onValueChange:e=>{b(e),e===`some`&&w(!0)},children:[(0,V.jsx)(pe,{size:`sm`,"aria-label":s.versions,className:`w-full min-w-0`,"data-testid":`export-scope`,children:(0,V.jsx)(_e,{})}),(0,V.jsxs)(de,{position:`popper`,align:`start`,children:[(0,V.jsx)(ve,{value:`shown`,children:h??s.onShow}),(0,V.jsx)(ve,{value:`all`,children:s.all(m.length)}),(0,V.jsx)(be,{}),(0,V.jsx)(ve,{value:`some`,onPointerUp:()=>{w(!0)},children:y===`some`?s.chosen(x.length):s.choose})]})]})]}),t.extras.length+ne.length>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`text-lead self-start`,children:s.include}),(0,V.jsxs)(`div`,{className:`grid gap-1.5`,"data-testid":`export-include`,children:[ne.map(e=>(0,V.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,V.jsx)($t,{checked:_.options[e.name]===!0,"data-option":e.name,onCheckedChange:t=>{re(e.name,t===!0)}}),(0,V.jsx)(`span`,{className:`truncate`,children:s.option[e.name]?.label})]},e.name)),t.extras.map(e=>{let t=g[e];return(0,V.jsxs)(`label`,{title:t,className:T(`flex items-center gap-2`,t!==void 0&&`text-lead-soft`),children:[(0,V.jsx)($t,{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,V.jsx)(`span`,{className:`truncate`,children:d(e)})]},e)})]})]})]}),N>0&&(0,V.jsxs)(`p`,{className:`text-dense text-destructive flex items-start gap-1.5 px-4 pt-3`,"data-testid":`export-blocked`,children:[(0,V.jsx)(me,{className:`mt-0.5 size-3.5 flex-none`,"aria-hidden":!0}),s.blocked(N)]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,V.jsx)(`span`,{className:`text-lead min-w-0 flex-1 truncate text-xs`,children:r.facts??(t.types.length===1?d(_.type):void 0)}),ae]})]}),i.length>0&&(0,V.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,children:i.map(e=>(0,V.jsx)(Rn,{job:e,versions:p,ahead:En(a,e.id),words:s,reveals:c,onAsked:l},e.id))})]})}var Vn={png:It,jpeg:It,webp:It,avif:It,gif:zt,mp4:Ut,mov:Ut,pdf:ye,docx:Lt,md:Ht,txt:Ht,html:Ft,xlsx:Bt,csv:Bt,json:Nt,pptx:Pt,zip:jt,psd:Vt,glb:Mt};function Hn(e){let t=(0,B.useRef)(null),n=e.types.length,r=n<=4?n:Math.min(4,Math.ceil(n/2));return(0,V.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=Vn[t]??Rt,r=e.chosen===t;return(0,V.jsxs)(Xt,{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,V.jsx)(n,{"aria-hidden":!0,strokeWidth:1.5,className:T(`size-5`,r?`text-pencil`:`text-lead`)}),(0,V.jsx)(`span`,{className:`line-clamp-2 w-full text-center text-xs leading-tight text-balance break-words`,children:e.name(t)})]},t)})})}function Un(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 Wn(e){let t=mn(r());return t.gives===`nothing`?null:t.gives===`file as it is`?(0,V.jsx)(Gn,{path:t.path,hosted:!t.button}):(0,V.jsx)(Kn,{...e})}function Gn({path:e,hosted:t}){let n=o(),i=Z.of(r()?.locale),s=()=>{An(n,e).catch(e=>{I.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,B.useEffectEvent)(e=>{Un(e)&&(e.preventDefault(),s())});return(0,B.useEffect)(()=>(window.addEventListener(`keydown`,c),()=>{window.removeEventListener(`keydown`,c)}),[]),(0,B.useEffect)(()=>{t&&n[`export/state`]({at:`idle`,open:!1}).catch(()=>void 0)},[n,t]),t?null:(0,V.jsxs)(L,{"data-testid":`export`,"data-state":`idle`,"aria-label":i.download,title:i.download,onClick:s,children:[(0,V.jsx)(kt,{"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`@max-lg/item:hidden`,children:i.download})]})}function Kn(e){let t=o(),n=r(),i=n?.commands===!0,s=n?.item.kind,c=n?.item.kindInfo.exports,l=n?.item.id,u=Z.of(n?.locale),d=Pn(),f=(0,B.useRef)(null),[p,m]=(0,B.useState)(!1),{all:h,fresh:g,reveals:_,asked:v}=Fn(p,u);a(`editor/command`,({command:e,open:t})=>{e===`export`&&m(e=>t??!e)}),(0,B.useEffect)(()=>{let e=e=>{Un(e)&&(e.preventDefault(),m(e=>!e))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]),(0,B.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?[]:_n(h,l),x=On(b,g),S=x.at===`running`?x.percent:void 0;if((0,B.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,V.jsxs)(L,{"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,V.jsx)(Ce,{value:x.percent/100}),x.at===`queued`&&(0,V.jsx)(Ce,{value:0}),x.at===`done`&&(0,V.jsx)(he,{className:`text-success`,"aria-hidden":!0}),x.at===`failed`&&(0,V.jsx)(me,{className:`text-destructive`,"aria-hidden":!0}),x.at===`idle`&&(0,V.jsx)(kt,{"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`@max-lg/item:hidden`,children:C})]}),T=(0,V.jsx)(Bn,{kind:s,offer:c,item:l,props:e,jobs:b,all:h,words:u,reveals:_,onAsked:v,startRef:f});return d?(0,V.jsxs)(V.Fragment,{children:[!i&&w,(0,V.jsx)(an,{open:p,onOpenChange:m,children:(0,V.jsxs)(cn,{side:`bottom`,showCloseButton:!1,className:`gap-0 rounded-t-lg`,children:[(0,V.jsx)(ln,{className:`sr-only`,children:u.download}),T]})})]}):(0,V.jsxs)(en,{open:p,onOpenChange:m,children:[i?(0,V.jsx)(rn,{className:`pointer-events-none fixed top-0 right-2 size-0`}):(0,V.jsx)(tn,{asChild:!0,children:w}),(0,V.jsxs)(nn,{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,V.jsx)(Qt,{}),T]})]})}function qn(){let e=r();return e?.share===!0&&e.mode===`edit`&&e.item.kindInfo.share===!0}function Jn(){let e=o(),t=r();if(!qn())return null;let n=Z.of(t?.locale);return(0,V.jsxs)(L,{"data-testid":`share`,"aria-label":n.share,title:n.share,onClick:()=>{e[`share/begin`]({}).catch(()=>void 0)},children:[(0,V.jsx)(Kt,{"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`@max-lg/item:hidden`,children:n.share})]})}var Yn=800;function Xn(e){let t=e?.state===`saving`||e?.state===`unsaved`,[n,r]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{r(!0)},Yn);return()=>{clearTimeout(e),r(!1)}},[t]),e!==void 0&&e.state!==`saved`&&(!t||n)}function Zn({saved:e,words:t}){return(0,V.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 Qn({start:e,saved:t,exports:n}){let a=r(),o=qn(),s=Z.of(a?.locale),c=Xn(t),l=i()?.doing!==void 0;if(a?.mode!==`edit`)return e?(0,V.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,V.jsxs)(V.Fragment,{children:[e?(0,V.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,V.jsx)(Yt,{}),(0,V.jsx)(Wn,{...n})]});let u=mn(a).gives!==`nothing`;return!e&&!c&&!u&&!o&&!l?null:(0,V.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,V.jsxs)(`div`,{className:`ml-auto flex flex-none items-center gap-1`,children:[(0,V.jsx)(Jt,{}),t&&c&&(0,V.jsx)(Zn,{saved:t,words:s}),(0,V.jsx)(Wn,{...n}),(0,V.jsx)(Jn,{})]})]})}function $n(){return r()?.notes===!0}var er=e(D(),1),tr=`group-data-[compact]/bar:hidden`,nr=32,rr={compact:!1,out:[],firsts:[],order:{}},ir=(0,B.createContext)(null),ar=(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 or({children:e,id:t,priority:n=0,keep:r=!1,ruled:i=!0}){let a=(0,B.useContext)(ir),o=(0,B.useId)(),s=t??o,c=a?.fit.firsts.includes(s)??!1,l=a?.touch;(0,B.useLayoutEffect)(()=>(l?.(),l),[l]);let u=(0,V.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,V.jsx)(`span`,{"data-group":s,"data-priority":n,"data-keep":r?``:void 0,className:d?`hidden`:`flex flex-none`,children:d?a.panel?(0,er.createPortal)((0,V.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 sr({testid:e,className:t,children:n,...i}){let a=r(),o=Z.of(a?.locale),s=(0,B.useRef)(null),[c,l]=(0,B.useState)(null),u=(0,B.useRef)(new Map),[d,f]=(0,B.useState)(rr),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(0),_=(0,B.useCallback)(()=>{g(e=>e+1)},[]),v=(0,B.useRef)(null);return(0,B.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,B.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)+nr;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]))};ar(_,d)||f(_),g.length===0&&p&&m(!1)},[d,p,h,c,n]),(0,V.jsx)(ir.Provider,{value:{fit:d,panel:p?c:null,touch:_},children:(0,V.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,V.jsxs)(en,{open:p,onOpenChange:m,children:[(0,V.jsx)(tn,{asChild:!0,children:(0,V.jsx)(L,{icon:!0,className:`ml-auto flex-none`,"aria-label":o.moreTools,title:o.moreTools,"data-testid":`${e}-more`,onMouseDown:e=>{e.preventDefault()},children:(0,V.jsx)(At,{})})}),(0,V.jsx)(nn,{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,V.jsx)(`div`,{ref:l,className:`-ml-2 flex flex-wrap items-center`})})]}):null]})})}export{Qn as a,en as c,tn as d,$t as f,Lt as g,Gt as h,$n as i,rn as l,qt as m,or as n,fn as o,Xt as p,sr as r,pn as s,tr as t,nn as u};
|