allyhub 0.17.1 → 0.18.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/CHANGELOG.md +9 -0
- package/dist/commands/render.js +1 -1
- 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/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/project-tool.d.ts +7 -4
- 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/blobs.d.ts +21 -2
- package/dist/node_modules/@allyhub/cloud/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/config.d.ts +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.js +1 -1
- 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/offline-page.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/pages.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/tools.js +1 -1
- 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/dist/host.js +1 -1
- package/dist/node_modules/@allyhub/extension-host/dist/points.js +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/files.d.ts +4 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/html-extension/LICENSE +241 -0
- package/dist/node_modules/@allyhub/html-extension/dist/page.js +6 -0
- package/dist/node_modules/@allyhub/html-extension/dist/project-tools.js +21 -0
- package/dist/node_modules/@allyhub/html-extension/dist/tools.js +2 -0
- package/dist/node_modules/@allyhub/html-extension/markup/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/html-extension/markup/markup.json +15 -0
- package/dist/node_modules/@allyhub/html-extension/markup/pages/budget.html +36 -0
- package/dist/node_modules/@allyhub/html-extension/package.json +92 -0
- 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/dist/show.d.ts +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 +2 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/package.json +4 -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/kinds.d.ts +3 -2
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/paywall.d.ts +2 -2
- package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +11 -4
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +0 -7
- package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/turns.d.ts +2 -2
- package/dist/node_modules/@allyhub/protocol/package.json +1 -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/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/manifest.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- 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/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- 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 +2 -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 +14 -13
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-CHNpVSPv.js → abnfDiagram-WEYOIA3C-Hy4-O0wN.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-gPsJqQwV.js → architecture-WOLXFQ4H-43JEVxqz.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-CEIDcC6r.js → architectureDiagram-ZHVYKT53-7bFTl41n.js} +1 -1
- package/editor-web/assets/article-CS48wwvk.js +3 -0
- package/editor-web/assets/{article-DfELjJ2o.js → article-Cyle57uq.js} +2 -2
- package/editor-web/assets/{blockDiagram-RJAE7QA3-CUzEGVet.js → blockDiagram-RJAE7QA3-DcoNo1WH.js} +1 -1
- package/editor-web/assets/{c4Diagram-XDPPPE54-CB94NR9s.js → c4Diagram-XDPPPE54-CsMt61gx.js} +1 -1
- package/editor-web/assets/channel-HUlo15J7.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-DFYo_Boi.js → chunk-2E7WHVMD-fj-TJIRG.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-CLLjmweX.js → chunk-4EMNKR2T-Du5cRy-Y.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-CkwQ_3m1.js → chunk-55XCU76K-BHXxBBtm.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-V-AvHpAB.js → chunk-7S6XSTFO-R5HW6X5I.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-PjHyYpb8.js → chunk-AQDTSKZB-C98F2BUb.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-QaczBS3J.js → chunk-DSNLSHJZ-NIGsJ2cK.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-aLaQB5Xu.js → chunk-HAGFOTED-BtHxtfW5.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-De3ftDQR.js → chunk-HNE4Q36P-BI8i7Vkk.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-CrhVQyvP.js → chunk-NQOKRVIF-DP_Z_zEA.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-BFmZ5ZLn.js → chunk-UHW7PFBP-C_8bui28.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-CzppUHLA.js → chunk-VQ5W62QI-CKZgzWB2.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-BrAU7V6v.js → chunk-WQQL4CDK-Ff4DgCht.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-BSiF71qj.js → chunk-YZO67HFG-Csbx1-pi.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-BJc4r5b1.js → chunk-ZAUX2LTX-BO1kcV3w.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-CkGTuehB.js → chunk-ZCHMQSOR-CxeNZYZG.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-Byxc7J88.js → classDiagram-v2-4MYWR3UA-D8eHQa5i.js} +1 -1
- package/editor-web/assets/{cynefin-EF2NZ3EQ-BSxkVbdf.js → cynefin-EF2NZ3EQ-lIUY3WQQ.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-IkCgARNs.js → cynefinDiagram-WF24UDRP-CFOOhEEs.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-9PgeH6nY.js → dagre-NK4GIZVX-DdHVup2I.js} +1 -1
- package/editor-web/assets/deck-CtEtDHo2.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-DRzeg3Ds.js → diagram-CBK3MWTC-CFAD9Y2B.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-B_zeKMN6.js → diagram-I5XIIV2D-DZJAn95A.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-FFm0O8SN.js → diagram-ODIL2UCW-BcIeYTaY.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-DrtCT8OA.js → diagram-PFBEJUXE-CnZmh_fl.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-DtxJ3V0q.js → diagram-RJA3I4VV-DpDd9rGx.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-DmxF_8H_.js → diagram-TYUNFSNR-ouGiUQcR.js} +1 -1
- package/editor-web/assets/{dist-C56mWAec.js → dist-BBshIz1Q.js} +2 -2
- package/editor-web/assets/dist-BI8QjOsV.js +1 -0
- package/editor-web/assets/{dist-CEknsRDd.js → dist-BajH5QfK.js} +3 -3
- package/editor-web/assets/{dist-CbZAznNW.js → dist-Bl74xqMW.js} +6 -6
- package/editor-web/assets/{dist-BUD4ywMB.js → dist-BrUtQth3.js} +7 -7
- package/editor-web/assets/{dist-JLyDtl9X.js → dist-CN5A7Au2.js} +1 -1
- package/editor-web/assets/{dist-ZZlQa66J.js → dist-CcL6r6l3.js} +1 -1
- package/editor-web/assets/{dist-DDzjbKIg.js → dist-D2E3cgRP.js} +1 -1
- package/editor-web/assets/{dist-bQKpw3Zz.js → dist-DGKjn59H.js} +3 -3
- package/editor-web/assets/{dist-PBbWAsrV.js → dist-NQNQ5HqZ.js} +3 -3
- package/editor-web/assets/{dist-CAb3W9_P.js → dist-SV0sOVIC.js} +1 -1
- package/editor-web/assets/{dist-C21CkR7Z.js → dist-Y_XZZa8q.js} +7 -7
- package/editor-web/assets/dist-ZrBAbqyJ.js +3 -0
- package/editor-web/assets/dist-elglzHMT.js +6 -0
- package/editor-web/assets/{dist-Dr3o4vee.js → dist-hHcrvNn9.js} +1 -1
- package/editor-web/assets/{docx-draw-9Q_fArBC.js → docx-draw-C4aiB8HI.js} +1 -1
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-DSX1Aoty.js → ebnfDiagram-V4P3TTPT-HRjVlbUf.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-C7gy9q56.js → elk-QONTBCTQ-BFmtKyOf.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-CKx_HoY4.js → erDiagram-KYQIGQAA-C9gcGEgK.js} +1 -1
- package/editor-web/assets/{esm-BZb5QMQf.js → esm-DzxAod8Q.js} +1 -1
- package/editor-web/assets/{eventmodeling-K75KTNOO-DL4HvSrd.js → eventmodeling-K75KTNOO-Bpma5Bdb.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-tz5ewhC5.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-N-AP4slN.js → ganttDiagram-R7GPNTJY-CE5ut4C3.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-BKRGJKWm.js → gitGraph-VSP46ZUC-Dva3iGx2.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-ClwL7w2_.js → gitGraphDiagram-PDYL7XHY-CJXFsAWp.js} +1 -1
- package/editor-web/assets/index-Dvh1t1om.css +2 -0
- package/editor-web/assets/{index-DG2nHq4D.js → index-q7X6hdHp.js} +3 -3
- package/editor-web/assets/{info-OHQRW6UA-DpcY8t23.js → info-OHQRW6UA-BY0AOfex.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-ChtmtWni.js → infoDiagram-MVDRKAX5-4Up1gMvC.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-BZNTuG_F.js → ishikawaDiagram-HPEHV2GE-BkvB9Qbn.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-C3uVmZbL.js → journeyDiagram-BOSHW7O7-BxV09WdR.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-puEhftGG.js → kanban-definition-FNSA4HC5-zTJtIDPG.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-Bw8re-WE.js → mermaid-parser.core-BWT9UQh_.js} +3 -3
- package/editor-web/assets/{mermaid.core-Cc2GIqBr.js → mermaid.core-DFf_Vg5X.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-C6MUl_S_.js → mindmap-definition-6OY57UG3-BYexiugS.js} +1 -1
- package/editor-web/assets/{packet-JDAUHWVQ-C75RnvC5.js → packet-JDAUHWVQ-DX_kSrI6.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-ChjmsdV4.js → pegDiagram-ECIUJNBX-I3SrcMLp.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-BaKxJQpj.js → pie-XZMESJXO-BmAFSw3E.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-CT2ez8pr.js → pieDiagram-GNMPY74T-DIZKcme5.js} +1 -1
- package/editor-web/assets/{props-form-D5oKHfpk.js → props-form-DUFxM5eb.js} +1 -1
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-BJItlTfk.js → quadrantDiagram-D57K4MC3-CO3oSqpQ.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-DnLzBlTo.js → radar-ABXABTNO-D5CkFrrb.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-D5hj6Yv3.js → railroad-I3PHUGI6-BeKY1p0K.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-DUZlZoPu.js → railroad-abnf-LNEFI6M7-CIYV9_3-.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-CDyyDC6d.js → railroad-ebnf-DWYD2UWJ-DN0zDl6d.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-CC3ImNnT.js → railroad-peg-JR7BVNR7-Bd_GcO24.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-Bjw-8Se5.js → railroadDiagram-Y72NRBL7-DlFoiMhb.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-CDFnuEIO.js → requirementDiagram-EQYSW5RA-LWAEz8Gy.js} +1 -1
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-CQPVLY1w.js → sankeyDiagram-SY24JHO5-B_pZGwUK.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-BQzuLmBX.js → sequenceDiagram-BLEHNHQU-bNhyCq0C.js} +1 -1
- package/editor-web/assets/{session-s1I85rox.js → session-Beijw9EK.js} +1 -1
- package/editor-web/assets/snapshots-Dd0Wd_qM.js +1 -0
- package/editor-web/assets/{split-7CVjIkSU.js → split-zARio3J8.js} +1 -1
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-DOuageUf.js → stateDiagram-v2-A6IESKWZ-DI-oM3qz.js} +1 -1
- package/editor-web/assets/{swimlanes-B3ENRKFQ-CXKkok7X.js → swimlanes-B3ENRKFQ-awDmoLdW.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-X35m3xN6.js +8 -0
- package/editor-web/assets/tabs-BHBvbekZ.js +1 -0
- package/editor-web/assets/{timeline-definition-JXYKGLGB-DgAjAeZp.js → timeline-definition-JXYKGLGB-CayduPvL.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-C0Xvnhck.js → treeView-D4JQ5SDB-BVEuNzCO.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-aXfKAeSX.js → treemap-SAJKECNS-BOB14HP3.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-CvUlBa-L.js → usecaseDiagram-WPOLBNNX-DxT99uaq.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-qMJ1iCxs.js → vennDiagram-Q3Y3IDCW-CWUKom-r.js} +1 -1
- package/editor-web/assets/{video-DQrjo1TI.js → video-oJ3qa1Qv.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-DEdnH0by.js → wardley-7MLQ67FV-BAQyTneD.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-Bt-B2hQ5.js → wardleyDiagram-IVAIDKWA-CiIYz4lZ.js} +1 -1
- package/editor-web/assets/{workbook-FSSUiIp9.js → workbook-DznVDqoE.js} +1 -1
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DV4bSzTb.js → xychartDiagram-4URNHDU4-D_D5IGmd.js} +1 -1
- package/editor-web/index.html +3 -3
- package/package.json +2 -2
- package/editor-web/assets/article-BHTjq0_Y.js +0 -3
- package/editor-web/assets/channel-DCDCx5Es.js +0 -1
- package/editor-web/assets/deck-tTzKONci.js +0 -1
- package/editor-web/assets/dist-BEpzsYn_.js +0 -6
- package/editor-web/assets/dist-DaEbElXI.js +0 -3
- package/editor-web/assets/flowDiagram-IUGLLWBU-BUnRtJ8q.js +0 -1
- package/editor-web/assets/index-BedbINE5.css +0 -2
- package/editor-web/assets/snapshots-BPJKywuN.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-C3Car2M0.js +0 -8
- package/editor-web/assets/tabs-CiF1N-pL.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";import{a as r,d as i,f as a,o,s,y as c}from"./react-Edyoga_4.js";import{Dt as l,Et as u,ht as d,kt as f,yt as p}from"./x-DlhyIKuu.js";import{E as m}from"./snapshots-
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";import{a as r,d as i,f as a,o,s,y as c}from"./react-Edyoga_4.js";import{Dt as l,Et as u,ht as d,kt as f,yt as p}from"./x-DlhyIKuu.js";import{E as m}from"./snapshots-Dd0Wd_qM.js";import{t as h}from"./session-Beijw9EK.js";import{t as g}from"./jsx-runtime-DePvh3-m.js";import{t as _}from"./bar-button-J9vbfzTx.js";import{C as v,D as ee,_ as te,c as ne,d as re,f as ie,i as ae,k as oe,l as se,o as ce,p as le,u as ue,w as de,x as y}from"./dist-elglzHMT.js";import{t as b}from"./createLucideIcon-lm_6n8YT.js";import{t as fe}from"./audio-lines-PZj77e7t.js";import{t as x}from"./file-exclamation-point-_L3ElCJ5.js";import{t as pe}from"./group-BdrTp7gi.js";import{c as me,i as he,l as ge,n as _e,o as ve,r as ye,t as be}from"./syntax-CU_WPKxt.js";import{t as xe}from"./minus-CbPnUIOy.js";import{n as Se,t as Ce}from"./undo-2-C47jrRp5.js";import{t as we}from"./square-arrow-out-up-right-DF5dvsSp.js";import{t as S}from"./sticky-note-BdkIu5_D.js";import{n as Te,t as Ee}from"./swatch-DhztHwPU.js";import{A as C,b as De,f as Oe,g as ke,o as w,x as T,y as E}from"./index-q7X6hdHp.js";import{c as Ae,l as je,n as Me,o as Ne,r as Pe,t as Fe}from"./dist-D2a_y4AE.js";import{t as Ie}from"./collaborator-BU4qU7O3.js";import{t as D}from"./row-C_svyL8o.js";import{A as Le,F as O,L as k,M as Re,R as ze,S as A,_ as Be,a as j,b as Ve,g as He,h as Ue,i as We,j as Ge,m as Ke,n as qe,p as Je,r as Ye,t as Xe,v as M,x as Ze,y as Qe,z as $e}from"./syntax-C0iPON60.js";var et={".html":`text/html; charset=utf-8`,".js":`text/javascript; charset=utf-8`,".mjs":`text/javascript; charset=utf-8`,".css":`text/css; charset=utf-8`,".json":`application/json; charset=utf-8`,".txt":`text/plain; charset=utf-8`,".md":`text/plain; charset=utf-8`,".mdx":`text/plain; charset=utf-8`,".csv":`text/plain; charset=utf-8`,".yaml":`text/plain; charset=utf-8`,".svg":`image/svg+xml`,".png":`image/png`,".jpg":`image/jpeg`,".jpeg":`image/jpeg`,".webp":`image/webp`,".gif":`image/gif`,".avif":`image/avif`,".woff2":`font/woff2`,".woff":`font/woff`,".ttf":`font/ttf`,".otf":`font/otf`,".mp3":`audio/mpeg`,".wav":`audio/wav`,".m4a":`audio/mp4`,".ogg":`audio/ogg`,".aac":`audio/aac`,".flac":`audio/flac`,".mp4":`video/mp4`,".webm":`video/webm`,".mov":`video/quicktime`,".pdf":`application/pdf`,".wasm":`application/wasm`,".glb":`model/gltf-binary`,".gltf":`model/gltf+json`,".bin":`application/octet-stream`,".ktx2":`image/ktx2`,".hdr":`image/vnd.radiance`,".exr":`image/x-exr`,".htm":`text/html; charset=utf-8`,".map":`application/json; charset=utf-8`,".webmanifest":`application/manifest+json`,".xml":`application/xml`,".rss":`application/rss+xml`,".atom":`application/atom+xml`,".ico":`image/x-icon`,".vtt":`text/vtt; charset=utf-8`,".zip":`application/zip`},tt=e=>et[/\.[^./]+$/u.exec(e)?.[0].toLowerCase()??``]??`application/octet-stream`,nt=b(`focus`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]),rt=b(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),it=b(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),at=[`1`,`2`,`3`,`4`,`5`,`6`],ot=[`top`,`right`,`bottom`,`left`],N=[`none`,`arrow`],P={nodes:[],edges:[],top:{}},F=e=>typeof e==`object`&&!!e&&!Array.isArray(e),I=e=>typeof e==`string`?e:void 0,st=e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,ct=(e,t)=>typeof t==`string`&&e.includes(t)?t:void 0;function lt(e){let t=I(e.id),n=I(e.type),r=st(e.x),i=st(e.y),a=st(e.width),o=st(e.height);if(t!==void 0&&t!==``&&n!==void 0&&r!==void 0&&i!==void 0&&a!==void 0&&o!==void 0)return{id:t,type:n,x:r,y:i,width:a,height:o,color:I(e.color),text:I(e.text),file:I(e.file),subpath:I(e.subpath),url:I(e.url),label:I(e.label),background:I(e.background),backgroundStyle:I(e.backgroundStyle),raw:e}}function ut(e){let t=I(e.id),n=I(e.fromNode),r=I(e.toNode);if(t&&n&&r)return{id:t,fromNode:n,fromSide:ct(ot,e.fromSide),fromEnd:ct(N,e.fromEnd)??`none`,toNode:r,toSide:ct(ot,e.toSide),toEnd:ct(N,e.toEnd)??`arrow`,color:I(e.color),label:I(e.label),raw:e}}var L=e=>{let t=e.id;return typeof t==`string`&&t!==``?t:void 0};function dt(e){if(e.trim()===``)return{canvas:P,problems:[],readable:!0};let t;try{t=JSON.parse(e)}catch(e){return{canvas:P,readable:!1,problems:[{at:`file`,message:`It is not JSON: ${e instanceof Error?e.message:String(e)}`}]}}if(!F(t))return{canvas:P,readable:!1,problems:[{at:`file`,message:`It is not a JSON object.`}]};let n=[],r=e=>{let r=t[e];return r===void 0?[]:Array.isArray(r)?r.flatMap((t,r)=>F(t)?[t]:(n.push({at:e===`nodes`?`node`:`edge`,index:r,message:`Its ${e} entry ${String(r)} is not an object.`}),[])):(n.push({at:e,message:`Its "${e}" is not a list.`}),[])},i=r(`nodes`),a=r(`edges`);return i.forEach((e,t)=>{if(lt(e))return;let r=L(e);n.push({at:`node`,index:t,...r===void 0?{}:{id:r},message:`Its node ${r??String(t)} is not drawn: a node has an id, a type, and x, y, width and height as numbers.`})}),a.forEach((e,t)=>{if(ut(e))return;let r=L(e);n.push({at:`edge`,index:t,...r===void 0?{}:{id:r},message:`Its edge ${r??String(t)} is not drawn: an edge has an id, a fromNode and a toNode.`})}),{canvas:{nodes:i,edges:a,top:t},problems:n,readable:!0}}var ft=e=>e.nodes.flatMap(e=>{let t=lt(e);return t?[t]:[]}),pt=e=>e.edges.flatMap(e=>{let t=ut(e);return t?[t]:[]});function mt(e){let t=e=>e.length===0?`[]`:`[\n${e.map(e=>`\t\t${JSON.stringify(e)}`).join(`,
|
|
2
2
|
`)}\n\t]`;return`{\n${[`\t"nodes":${t(e.nodes)}`,`\t"edges":${t(e.edges)}`,...Object.entries(e.top).filter(([e])=>e!==`nodes`&&e!==`edges`).map(([e,t])=>`\t${JSON.stringify(e)}:${JSON.stringify(t)}`)].join(`,
|
|
3
3
|
`)}\n}`}function ht(e,t=Math.random){let n=new Set([...e.nodes,...e.edges].flatMap(e=>L(e)??[]));for(;;){let e=``;for(let n=0;n<16;n++)e+=Math.floor(t()*16).toString(16);if(!n.has(e))return e}}var R=e=>Math.round(e);function z(e,t){let n=new Set(Object.entries(t).filter(([,e])=>e===void 0).map(([e])=>e)),r=Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)));for(let[e,n]of Object.entries(t))n!==void 0&&(r[e]=n);return r}var gt=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function _t(e,t,n){if(gt(t,e))return n;if(gt(n,e))return t;if(t===void 0||n===void 0)return t??n;if(e===void 0)return t;let r=[...new Set([...Object.keys(t),...Object.keys(e)])].filter(n=>!gt(t[n],e[n]));return z(n,Object.fromEntries(r.map(e=>[e,t[e]])))}function vt(e,t,n){let r=e=>{let t=new Map;for(let n of e){let e=L(n);e!==void 0&&!t.has(e)&&t.set(e,n)}return t},i=r(e),a=r(t),o=r(n),s=[],c=new Set;for(let e of n){let t=L(e);if(t===void 0){s.push(e);continue}if(c.has(t))continue;c.add(t);let n=_t(i.get(t),a.get(t),e);n&&s.push(n)}let l;for(let e of t){let t=L(e);if(t!==void 0){if(!c.has(t)){c.add(t);let n=_t(i.get(t),e,o.get(t));if(n){let e=l===void 0?-1:s.findIndex(e=>L(e)===l);s.splice(e+1,0,n)}}s.some(e=>L(e)===t)&&(l=t)}}return s}function yt(e,t,n){let r=_t(e.top,t.top,n.top)??{};return{nodes:vt(e.nodes,t.nodes,n.nodes),edges:vt(e.edges,t.edges,n.edges),top:r}}function B(e,t,n){let r=[...e];for(let e of n===`after`?t:[...t].reverse()){let t=n===`after`?e.after:e.before,i=r.findIndex(t=>L(t)===e.id);t===void 0?i>=0&&r.splice(i,1):i>=0?r[i]=t:r.splice(Math.min(e.index,r.length),0,t)}return r}function bt(e,t,n){return{...e,nodes:B(e.nodes,t.nodes,n),edges:B(e.edges,t.edges,n)}}function xt(e,t){let n=(e,t)=>{let n=[],r=new Map;e.forEach((e,t)=>{let n=L(e);n!==void 0&&r.set(n,{raw:e,index:t})});let i=new Set;t.forEach((e,t)=>{let a=L(e);if(a===void 0)return;i.add(a);let o=r.get(a);o?JSON.stringify(o.raw)!==JSON.stringify(e)&&n.push({id:a,before:o.raw,after:e,index:t}):n.push({id:a,after:e,index:t})});for(let[e,t]of r)i.has(e)||n.push({id:e,before:t.raw,index:t.index});return n};return{nodes:n(e.nodes,t.nodes),edges:n(e.edges,t.edges)}}var St=e=>e.nodes.length===0&&e.edges.length===0;function Ct(e,t){let n=`"id":${JSON.stringify(t)}`,r=`"id": ${JSON.stringify(t)}`,i=e.split(`
|
|
4
4
|
`).findIndex(e=>e.includes(n)||e.includes(r));return i<0?void 0:i+1}function wt(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Tt=/[ \t\n\f\r]/g;function Et(e){return typeof e==`object`?e.type===`text`&&Dt(e.value):Dt(e)}function Dt(e){return e.replace(Tt,``)===``}var Ot=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Ot.prototype.normal={},Ot.prototype.property={},Ot.prototype.space=void 0;function kt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Ot(n,r,t)}function At(e){return e.toLowerCase()}var V=class{constructor(e,t){this.attribute=t,this.property=e}};V.prototype.attribute=``,V.prototype.booleanish=!1,V.prototype.boolean=!1,V.prototype.commaOrSpaceSeparated=!1,V.prototype.commaSeparated=!1,V.prototype.defined=!1,V.prototype.mustUseProperty=!1,V.prototype.number=!1,V.prototype.overloadedBoolean=!1,V.prototype.property=``,V.prototype.spaceSeparated=!1,V.prototype.space=void 0;var jt=t({boolean:()=>H,booleanish:()=>U,commaOrSpaceSeparated:()=>K,commaSeparated:()=>Pt,number:()=>W,overloadedBoolean:()=>Nt,spaceSeparated:()=>G}),Mt=0,H=Ft(),U=Ft(),Nt=Ft(),W=Ft(),G=Ft(),Pt=Ft(),K=Ft();function Ft(){return 2**++Mt}var It=Object.keys(jt),Lt=class extends V{constructor(e,t,n,r){let i=-1;if(super(e,t),Rt(this,`space`,r),typeof n==`number`)for(;++i<It.length;){let e=It[i];Rt(this,It[i],(n&jt[e])===jt[e])}}};Lt.prototype.defined=!0;function Rt(e,t,n){n&&(e[t]=n)}function zt(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Lt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[At(r)]=r,n[At(a.attribute)]=r}return new Ot(t,n,e.space)}var Bt=zt({properties:{ariaActiveDescendant:null,ariaAtomic:U,ariaAutoComplete:null,ariaBusy:U,ariaChecked:U,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:G,ariaCurrent:null,ariaDescribedBy:G,ariaDetails:null,ariaDisabled:U,ariaDropEffect:G,ariaErrorMessage:null,ariaExpanded:U,ariaFlowTo:G,ariaGrabbed:U,ariaHasPopup:null,ariaHidden:U,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:G,ariaLevel:W,ariaLive:null,ariaModal:U,ariaMultiLine:U,ariaMultiSelectable:U,ariaOrientation:null,ariaOwns:G,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:U,ariaReadOnly:U,ariaRelevant:null,ariaRequired:U,ariaRoleDescription:G,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:U,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Vt(e,t){return t in e?e[t]:t}function Ht(e,t){return Vt(e,t.toLowerCase())}var Ut=zt({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Pt,acceptCharset:G,accessKey:G,action:null,allow:null,allowFullScreen:H,allowPaymentRequest:H,allowUserMedia:H,alpha:H,alt:null,as:null,async:H,autoCapitalize:null,autoComplete:G,autoFocus:H,autoPlay:H,blocking:G,capture:null,charSet:null,checked:H,cite:null,className:G,closedBy:null,colorSpace:null,cols:W,colSpan:W,command:null,commandFor:null,content:null,contentEditable:U,controls:H,controlsList:G,coords:W|Pt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:H,defer:H,dir:null,dirName:null,disabled:H,download:Nt,draggable:U,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:H,formTarget:null,headers:G,height:W,hidden:Nt,high:W,href:null,hrefLang:null,htmlFor:G,httpEquiv:G,id:null,imageSizes:null,imageSrcSet:null,inert:H,inputMode:null,integrity:null,is:null,isMap:H,itemId:null,itemProp:G,itemRef:G,itemScope:H,itemType:G,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:H,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:H,muted:H,name:null,nonce:null,noModule:H,noValidate:H,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:H,optimum:W,pattern:null,ping:G,placeholder:null,playsInline:H,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:H,referrerPolicy:null,rel:G,required:H,reversed:H,rows:W,rowSpan:W,sandbox:G,scope:null,scoped:H,seamless:H,selected:H,shadowRootClonable:H,shadowRootCustomElementRegistry:H,shadowRootDelegatesFocus:H,shadowRootMode:null,shadowRootSerializable:H,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:U,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:H,useMap:null,value:U,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:G,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:H,declare:H,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:H,noHref:H,noShade:H,noWrap:H,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:U,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:H,disablePictureInPicture:H,disableRemotePlayback:H,exportParts:Pt,part:G,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:Ht}),Wt=zt({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:K,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:G,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:H,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pt,g2:Pt,glyphName:Pt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:K,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:G,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:K,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:K,rev:K,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:K,requiredFeatures:K,requiredFonts:K,requiredFormats:K,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:K,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:K,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:K,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Vt}),Gt=zt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Kt=zt({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Ht}),qt=zt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Jt={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Yt=/[A-Z]/g,Xt=/-[a-z]/g,Zt=/^data[-\w.:]+$/i;function Qt(e,t){let n=At(t),r=t,i=V;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Zt.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Xt,en);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Xt.test(e)){let n=e.replace(Yt,$t);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Lt}return new i(r,t)}function $t(e){return`-`+e.toLowerCase()}function en(e){return e.charAt(1).toUpperCase()}var tn=kt([Bt,Ut,Gt,Kt,qt],`html`),nn=kt([Bt,Wt,Gt,Kt,qt],`svg`);function rn(e){return e.join(` `).trim()}var an=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
@@ -12,5 +12,5 @@ import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";import{a as r,d
|
|
|
12
12
|
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
13
13
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
14
14
|
`}),n}function qr(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Jr(e,t){let n=Hr(e,t),r=n.one(e,void 0),i=zr(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
15
|
-
`},i)),a}function Yr(e,t){return e&&`run`in e?async function(n,r){let i=Jr(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Jr(n,{file:r,...e||t})}}function Xr(e){if(e)throw e}var Zr=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Qr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function $r(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?ei(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function ei(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var q={basename:ti,dirname:ni,extname:ri,join:ii,sep:`/`};function ti(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);si(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function ni(e){if(si(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ri(e){si(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function ii(...e){let t=-1,n;for(;++t<e.length;)si(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ai(n)}function ai(e){si(e);let t=e.codePointAt(0)===47,n=oi(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function oi(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function si(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var ci={cwd:li};function li(){return`/`}function ui(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function di(e){if(typeof e==`string`)e=new URL(e);else if(!ui(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return fi(e)}function fi(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var pi=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],mi=class{constructor(e){let t;t=e?ui(e)?{path:e}:typeof e==`string`||vi(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:ci.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<pi.length;){let e=pi[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)pi.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?q.basename(this.path):void 0}set basename(e){gi(e,`basename`),hi(e,`basename`),this.path=q.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?q.dirname(this.path):void 0}set dirname(e){_i(this.basename,`dirname`),this.path=q.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?q.extname(this.path):void 0}set extname(e){if(hi(e,`extname`),_i(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=q.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){ui(e)&&(e=di(e)),gi(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?q.basename(this.path,this.extname):void 0}set stem(e){gi(e,`stem`),hi(e,`stem`),this.path=q.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new he(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function hi(e,t){if(e&&e.includes(q.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+q.sep+"`")}function gi(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function _i(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function vi(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var yi=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),bi=e(Zr(),1),xi={}.hasOwnProperty,Si=new class e extends yi{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=$r()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,bi.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Ti(`data`,this.frozen),this.namespace[e]=t,this):xi.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ti(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Oi(e),n=this.parser||this.Parser;return Ci(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Ci(`process`,this.parser||this.Parser),wi(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Oi(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Ai(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Ci(`processSync`,this.parser||this.Parser),wi(`processSync`,this.compiler||this.Compiler),this.process(e,r),Di(`processSync`,`process`,t),n;function r(e,r){t=!0,Xr(e),n=r}}run(e,t,n){Ei(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Oi(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Di(`runSync`,`run`,n),r;function i(e,t){Xr(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Oi(t),r=this.compiler||this.Compiler;return wi(`stringify`,r),Ei(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Ti(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,bi.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Qr(o)&&Qr(r)&&(r=(0,bi.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Ci(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function wi(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Ti(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ei(e){if(!Qr(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Di(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Oi(e){return ki(e)?e:new mi(e)}function ki(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Ai(e){return typeof e==`string`||ji(e)}function ji(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var J=g(),Y=e(c(),1),Mi=[],Ni={allowDangerousHtml:!0},Pi=/^(https?|ircs?|mailto|xmpp)$/i,Fi=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Ii(e){let t=Li(e),n=Ri(e);return zi(t.runSync(t.parse(n),n),e)}function Li(e){let t=e.rehypePlugins||Mi,n=e.remarkPlugins||Mi,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ni}:Ni;return Si().use(Wn).use(n).use(Yr,r).use(t)}function Ri(e){let t=e.children||``,n=new mi;return typeof t==`string`?n.value=t:``+t,n}function zi(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Bi;for(let e of Fi)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return M(e,l),bn(e,{Fragment:J.Fragment,components:i,ignoreInvalidStyle:!0,jsx:J.jsx,jsxs:J.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Hn)if(Object.hasOwn(Hn,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Hn[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Bi(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Pi.test(e.slice(0,t))?e:``}function Vi(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Hi(e,t,n){let r=Ze((n||{}).ignore||[]),i=Ui(t),a=-1;for(;++a<i.length;)Ve(e,o);function o(e,t,n){if(e.type===`text`&&typeof n==`number`)return s(e,t,n);if(r(e,n,t[t.length-1]))return Qe}function s(e,t,n){let r=t[t.length-1],o=i[a][0],s=i[a][1],c=0,l=!1,u=[];o.lastIndex=0;let d=o.exec(e.value);for(;d;){let n=d.index,r={index:d.index,input:d.input,stack:[...t,e]},i=s(...d,r);if(typeof i==`string`&&(i=i.length>0?{type:`text`,value:i}:void 0),i===!1)o.lastIndex=n+1;else{if(c!==n&&f({type:`text`,value:e.value.slice(c,n)}),Array.isArray(i))for(let e of i)f(e);else i&&f(i);c=n+d[0].length,l=!0}if(!o.global)break;d=o.exec(e.value)}return l?(c<e.value.length&&f({type:`text`,value:e.value.slice(c)}),r.children.splice(n,1,...u)):u=[e],n+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function Ui(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Wi(e[0]),Gi(e[1])])}return t}function Wi(e){return typeof e==`string`?new RegExp(Be(e),`g`):e}function Gi(e){return typeof e==`function`?e:function(){return e}}var Ki=`phrasing`,qi=[`autolink`,`link`,`image`,`label`];function Ji(){return{transforms:[na],enter:{literalAutolink:Xi,literalAutolinkEmail:Zi,literalAutolinkHttp:Zi,literalAutolinkWww:Zi},exit:{literalAutolink:ta,literalAutolinkEmail:ea,literalAutolinkHttp:Qi,literalAutolinkWww:$i}}}function Yi(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Ki,notInConstruct:qi},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Ki,notInConstruct:qi},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Ki,notInConstruct:qi}]}}function Xi(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Zi(e){this.config.enter.autolinkProtocol.call(this,e)}function Qi(e){this.config.exit.autolinkProtocol.call(this,e)}function $i(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function ea(e){this.config.exit.autolinkEmail.call(this,e)}function ta(e){this.exit(e)}function na(e){Hi(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ra],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ia]],{ignore:[`link`,`linkReference`]})}function ra(e,t,n,r,i){let a=``;if(!sa(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!aa(n)))return!1;let o=oa(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function ia(e,t,n,r){return!sa(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function aa(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function oa(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Vi(e,`(`),a=Vi(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function sa(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ze(n)||k(n))&&(!t||n!==47)}function ca(){return[Ji(),Ue(),Je(),We(),_e()]}function la(e){return{extensions:[Yi(),He(e),Ke(),j(e),ye()]}}var ua={tokenize:Sa,partial:!0},da={tokenize:Ca,partial:!0},fa={tokenize:wa,partial:!0},pa={tokenize:Ta,partial:!0},ma={tokenize:Ea,partial:!0},ha={name:`wwwAutolink`,tokenize:ba,previous:Da},ga={name:`protocolAutolink`,tokenize:xa,previous:Oa},X={name:`emailAutolink`,tokenize:ya,previous:ka},Z={};function _a(){return{text:Z}}for(var va=48;va<123;)Z[va]=X,va++,va===58?va=65:va===91&&(va=97);Z[43]=X,Z[45]=X,Z[46]=X,Z[95]=X,Z[72]=[X,ga],Z[104]=[X,ga],Z[87]=[X,ha],Z[119]=[X,ha];function ya(e,t,n){let r=this,i,a;return o;function o(t){return!Aa(t)||!ka.call(r,r.previous)||ja(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Aa(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(ma,u,l)(t):t===45||t===95||Ge(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Le(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function ba(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Da.call(r,r.previous)||ja(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(ua,e.attempt(da,e.attempt(fa,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function xa(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Oa.call(r,r.previous)&&!ja(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Le(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Re(t)||O(t)||ze(t)||k(t)?n(t):e.attempt(da,e.attempt(fa,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Sa(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Ca(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(pa,c,s)(t):t===null||O(t)||ze(t)||t!==45&&k(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function wa(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(pa,t,a)(o):o===null||O(o)||ze(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Ta(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||O(o)||ze(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||O(e)||ze(e)?t(e):r(e)}function a(e){return Le(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Le(t)?(e.consume(t),o):n(t)}}function Ea(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Ge(e)?n(e):t(e)}}function Da(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||O(e)}function Oa(e){return!Le(e)}function ka(e){return!(e===47||Aa(e))}function Aa(e){return e===43||e===45||e===46||e===95||Ge(e)}function ja(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Ma(e){return $e([_a(),Ye(),qe(e),Xe(),be()])}var Na={};function Pa(e){let t=this,n=e||Na,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Ma(n)),a.push(ca()),o.push(la(n))}function Fa(){let e=o(),[t,n]=(0,Y.useState)();return(0,Y.useEffect)(()=>{let t=!0,r,i=()=>{C(e,`project/items`,{}).then(e=>{t&&n({items:e.items,revision:e.revision})},()=>void 0)};i();let a=e.on(`project/changed`,()=>{clearTimeout(r),r=setTimeout(i,300)});return()=>{t=!1,clearTimeout(r),a()}},[e]),t}function Ia(e,t){let n=t.replace(/^\.\//u,``).replace(/\/+$/u,``),r=e?.items.find(e=>e.kind!==void 0&&e.entry===n);if(r)return{type:`item`,item:r};let i=tt(n);return/^(image|video|audio)\//u.test(i)?{type:`media`,path:n,mime:i}:{type:`file`,path:n}}var La=new Map;function Ra(e,t,n){let[r,i]=(0,Y.useState)(),a=`${t??``}@${String(n??-1)}`;if((0,Y.useEffect)(()=>{if(t===void 0||n===void 0)return;let r=!0,o=La.get(a);return o||(o=C(e,`items/preview`,{item:t}).then(e=>e.preview,()=>void 0),La.set(a,o)),o.then(e=>{r&&i({key:a,preview:e})}),()=>{r=!1}},[e,t,n,a]),r!==void 0)return r.preview??`none`}var za=new Map;function Ba(e,t){let[n,r]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(t===void 0)return;let n=!0,i=za.get(t);return i||(i=e[`files/url`]({path:t}).then(e=>e.url,()=>void 0),za.set(t,i)),i.then(e=>{n&&r(e)}),()=>{n=!1}},[e,t]),n}var Va=new Map;function Ha(e,t){let[n,r]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(t===void 0||t===``)return;let n=!0,i=t.lastIndexOf(`/`),a=i<0?``:t.slice(0,i),o=Va.get(a);return o||(o=e[`files/list`]({dir:a}).then(e=>new Set([...e.files.map(e=>e.path),...e.dirs]),()=>void 0),Va.set(a,o),setTimeout(()=>Va.delete(a),2e3)),o.then(e=>{n&&r(e===void 0?void 0:e.has(t))}),()=>{n=!1}},[e,t]),n}var Ua=p({en:{loading:`Opening the canvas…`,couldNotOpen:e=>`The canvas could not be opened: ${e}`,unreadable:e=>`This file is not JSON Canvas, so it is shown and not changed: ${e}`,empty:`Double-click to add a note, or drop a file here.`,undo:`Undo`,redo:`Redo`,zoom:`Zoom`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,zoomFit:`Zoom to fit`,zoomActual:`Zoom to 100%`,zoomSelection:`Zoom to selection`,history:`History`,adding:`Add to the canvas`,selected:`Selection`,note:`Note`,noteHint:`Add a note in Markdown`,file:`File`,fileHint:`Add an item or a file of the project`,link:`Link`,linkHint:`Add a link to a page`,linkPlaceholder:`https://`,linkAdd:`Add`,group:`Group`,groupHint:`Put the selection in a group`,color:`Colour`,noColor:`No colour`,colors:{1:`Red`,2:`Orange`,3:`Yellow`,4:`Green`,5:`Cyan`,6:`Purple`},find:`Find an item or a file`,items:`Items`,media:`Media`,nothingFound:`Nothing matches`,open:`Open`,openHint:`Open it in its own editor`,openLinkHint:`Open the page in the browser`,delete:`Delete`,label:`Label`,missing:e=>`${e} is not in the project`,unknownType:e=>`A “${e}” node, kept as it is`,uploadFailed:e=>`The file could not be added: ${e}`,edits:{add:`Add`,move:`Move`,resize:`Resize`,type:`Typing`,delete:`Delete`,color:`Colour`,group:`Group`,connect:`Connect`,label:`Label`}},"zh-cn":{loading:`正在打开画布…`,couldNotOpen:e=>`画布无法打开:${e}`,unreadable:e=>`此文件不是 JSON Canvas,因此只显示、不修改:${e}`,empty:`双击添加便签,或把文件拖到这里。`,undo:`撤销`,redo:`重做`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,zoomFit:`缩放到合适大小`,zoomActual:`缩放到 100%`,zoomSelection:`缩放到所选内容`,history:`历史记录`,adding:`添加到画布`,selected:`所选内容`,note:`便签`,noteHint:`添加 Markdown 便签`,file:`文件`,fileHint:`添加项目中的作品或文件`,link:`链接`,linkHint:`添加网页链接`,linkPlaceholder:`https://`,linkAdd:`添加`,group:`分组`,groupHint:`把所选内容放进一个分组`,color:`颜色`,noColor:`无颜色`,colors:{1:`红色`,2:`橙色`,3:`黄色`,4:`绿色`,5:`青色`,6:`紫色`},find:`查找作品或文件`,items:`作品`,media:`媒体`,nothingFound:`没有匹配的内容`,open:`打开`,openHint:`在它自己的编辑器中打开`,openLinkHint:`在浏览器中打开网页`,delete:`删除`,label:`标签`,missing:e=>`${e} 不在项目中`,unknownType:e=>`“${e}”节点,按原样保留`,uploadFailed:e=>`无法添加文件:${e}`,edits:{add:`添加`,move:`移动`,resize:`调整大小`,type:`输入`,delete:`删除`,color:`颜色`,group:`分组`,connect:`连接`,label:`标签`}},"zh-tw":{loading:`正在開啟畫布…`,couldNotOpen:e=>`畫布無法開啟:${e}`,unreadable:e=>`此檔案不是 JSON Canvas,因此只顯示、不修改:${e}`,empty:`按兩下新增便條,或把檔案拖到這裡。`,undo:`復原`,redo:`重做`,zoom:`縮放`,zoomIn:`放大`,zoomOut:`縮小`,zoomFit:`縮放至適當大小`,zoomActual:`縮放至 100%`,zoomSelection:`縮放至所選內容`,history:`記錄`,adding:`加入畫布`,selected:`所選內容`,note:`便條`,noteHint:`新增 Markdown 便條`,file:`檔案`,fileHint:`新增專案中的作品或檔案`,link:`連結`,linkHint:`新增網頁連結`,linkPlaceholder:`https://`,linkAdd:`新增`,group:`群組`,groupHint:`把所選內容放進一個群組`,color:`顏色`,noColor:`無顏色`,colors:{1:`紅色`,2:`橙色`,3:`黃色`,4:`綠色`,5:`青色`,6:`紫色`},find:`尋找作品或檔案`,items:`作品`,media:`媒體`,nothingFound:`沒有相符的內容`,open:`開啟`,openHint:`在它自己的編輯器中開啟`,openLinkHint:`在瀏覽器中開啟網頁`,delete:`刪除`,label:`標籤`,missing:e=>`${e} 不在專案中`,unknownType:e=>`「${e}」節點,依原樣保留`,uploadFailed:e=>`無法新增檔案:${e}`,edits:{add:`新增`,move:`移動`,resize:`調整大小`,type:`輸入`,delete:`刪除`,color:`顏色`,group:`群組`,connect:`連接`,label:`標籤`}},ja:{loading:`キャンバスを開いています…`,couldNotOpen:e=>`キャンバスを開けませんでした:${e}`,unreadable:e=>`このファイルは JSON Canvas ではないため、表示のみで変更しません:${e}`,empty:`ダブルクリックでメモを追加するか、ここにファイルをドロップします。`,undo:`取り消す`,redo:`やり直す`,zoom:`ズーム`,zoomIn:`拡大`,zoomOut:`縮小`,zoomFit:`全体を表示`,zoomActual:`100% で表示`,zoomSelection:`選択範囲にズーム`,history:`履歴`,adding:`キャンバスに追加`,selected:`選択範囲`,note:`メモ`,noteHint:`Markdown のメモを追加`,file:`ファイル`,fileHint:`プロジェクトの作品やファイルを追加`,link:`リンク`,linkHint:`ページへのリンクを追加`,linkPlaceholder:`https://`,linkAdd:`追加`,group:`グループ`,groupHint:`選択したものをグループにまとめる`,color:`色`,noColor:`色なし`,colors:{1:`赤`,2:`オレンジ`,3:`黄`,4:`緑`,5:`シアン`,6:`紫`},find:`作品やファイルを検索`,items:`作品`,media:`メディア`,nothingFound:`一致するものはありません`,open:`開く`,openHint:`専用のエディタで開く`,openLinkHint:`ページをブラウザで開く`,delete:`削除`,label:`ラベル`,missing:e=>`${e} はプロジェクトにありません`,unknownType:e=>`「${e}」ノード(そのまま保持)`,uploadFailed:e=>`ファイルを追加できませんでした:${e}`,edits:{add:`追加`,move:`移動`,resize:`サイズ変更`,type:`入力`,delete:`削除`,color:`色`,group:`グループ`,connect:`接続`,label:`ラベル`}},ko:{loading:`캔버스를 여는 중…`,couldNotOpen:e=>`캔버스를 열 수 없습니다: ${e}`,unreadable:e=>`이 파일은 JSON Canvas가 아니므로 표시만 하고 변경하지 않습니다: ${e}`,empty:`두 번 클릭해 메모를 추가하거나 여기에 파일을 놓으세요.`,undo:`실행 취소`,redo:`다시 실행`,zoom:`확대/축소`,zoomIn:`확대`,zoomOut:`축소`,zoomFit:`화면에 맞추기`,zoomActual:`100%로 확대/축소`,zoomSelection:`선택 항목으로 확대/축소`,history:`기록`,adding:`캔버스에 추가`,selected:`선택 항목`,note:`메모`,noteHint:`Markdown 메모 추가`,file:`파일`,fileHint:`프로젝트의 작업물이나 파일 추가`,link:`링크`,linkHint:`페이지 링크 추가`,linkPlaceholder:`https://`,linkAdd:`추가`,group:`그룹`,groupHint:`선택한 항목을 그룹으로 묶기`,color:`색상`,noColor:`색상 없음`,colors:{1:`빨강`,2:`주황`,3:`노랑`,4:`초록`,5:`청록`,6:`보라`},find:`작업물이나 파일 찾기`,items:`작업물`,media:`미디어`,nothingFound:`일치하는 항목이 없습니다`,open:`열기`,openHint:`전용 편집기에서 열기`,openLinkHint:`브라우저에서 페이지 열기`,delete:`삭제`,label:`레이블`,missing:e=>`${e}이(가) 프로젝트에 없습니다`,unknownType:e=>`“${e}” 노드, 그대로 유지됨`,uploadFailed:e=>`파일을 추가할 수 없습니다: ${e}`,edits:{add:`추가`,move:`이동`,resize:`크기 조정`,type:`입력`,delete:`삭제`,color:`색상`,group:`그룹`,connect:`연결`,label:`레이블`}},es:{loading:`Abriendo el lienzo…`,couldNotOpen:e=>`No se pudo abrir el lienzo: ${e}`,unreadable:e=>`Este archivo no es JSON Canvas, así que se muestra y no se cambia: ${e}`,empty:`Haz doble clic para añadir una nota, o suelta aquí un archivo.`,undo:`Deshacer`,redo:`Rehacer`,zoom:`Zoom`,zoomIn:`Acercar`,zoomOut:`Alejar`,zoomFit:`Ajustar a la vista`,zoomActual:`Zoom al 100 %`,zoomSelection:`Zoom a la selección`,history:`Historial`,adding:`Añadir al lienzo`,selected:`Selección`,note:`Nota`,noteHint:`Añadir una nota en Markdown`,file:`Archivo`,fileHint:`Añadir un elemento o un archivo del proyecto`,link:`Enlace`,linkHint:`Añadir un enlace a una página`,linkPlaceholder:`https://`,linkAdd:`Añadir`,group:`Agrupar`,groupHint:`Poner la selección en un grupo`,color:`Color`,noColor:`Sin color`,colors:{1:`Rojo`,2:`Naranja`,3:`Amarillo`,4:`Verde`,5:`Cian`,6:`Morado`},find:`Buscar un elemento o un archivo`,items:`Elementos`,media:`Multimedia`,nothingFound:`No hay coincidencias`,open:`Abrir`,openHint:`Abrirlo en su propio editor`,openLinkHint:`Abrir la página en el navegador`,delete:`Eliminar`,label:`Etiqueta`,missing:e=>`${e} no está en el proyecto`,unknownType:e=>`Un nodo «${e}», conservado tal cual`,uploadFailed:e=>`No se pudo añadir el archivo: ${e}`,edits:{add:`Añadir`,move:`Mover`,resize:`Cambiar tamaño`,type:`Escritura`,delete:`Eliminar`,color:`Color`,group:`Agrupar`,connect:`Conectar`,label:`Etiqueta`}},fr:{loading:`Ouverture du canevas…`,couldNotOpen:e=>`Le canevas n’a pas pu être ouvert : ${e}`,unreadable:e=>`Ce fichier n’est pas au format JSON Canvas : il est affiché sans être modifié. ${e}`,empty:`Double-cliquez pour ajouter une note, ou déposez un fichier ici.`,undo:`Annuler`,redo:`Rétablir`,zoom:`Zoom`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,zoomFit:`Ajuster à la fenêtre`,zoomActual:`Zoom à 100 %`,zoomSelection:`Zoom sur la sélection`,history:`Historique`,adding:`Ajouter au canevas`,selected:`Sélection`,note:`Note`,noteHint:`Ajouter une note en Markdown`,file:`Fichier`,fileHint:`Ajouter un élément ou un fichier du projet`,link:`Lien`,linkHint:`Ajouter un lien vers une page`,linkPlaceholder:`https://`,linkAdd:`Ajouter`,group:`Grouper`,groupHint:`Mettre la sélection dans un groupe`,color:`Couleur`,noColor:`Sans couleur`,colors:{1:`Rouge`,2:`Orange`,3:`Jaune`,4:`Vert`,5:`Cyan`,6:`Violet`},find:`Chercher un élément ou un fichier`,items:`Éléments`,media:`Médias`,nothingFound:`Aucun résultat`,open:`Ouvrir`,openHint:`L’ouvrir dans son propre éditeur`,openLinkHint:`Ouvrir la page dans le navigateur`,delete:`Supprimer`,label:`Libellé`,missing:e=>`${e} n’est pas dans le projet`,unknownType:e=>`Un nœud « ${e} », conservé tel quel`,uploadFailed:e=>`Le fichier n’a pas pu être ajouté : ${e}`,edits:{add:`Ajout`,move:`Déplacement`,resize:`Redimensionnement`,type:`Saisie`,delete:`Suppression`,color:`Couleur`,group:`Groupe`,connect:`Liaison`,label:`Libellé`}},de:{loading:`Canvas wird geöffnet …`,couldNotOpen:e=>`Das Canvas konnte nicht geöffnet werden: ${e}`,unreadable:e=>`Diese Datei ist kein JSON Canvas und wird daher nur angezeigt, nicht geändert: ${e}`,empty:`Doppelklicken, um eine Notiz hinzuzufügen, oder eine Datei hier ablegen.`,undo:`Widerrufen`,redo:`Wiederholen`,zoom:`Zoom`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,zoomFit:`Alles zeigen`,zoomActual:`Auf 100 % zoomen`,zoomSelection:`Auf Auswahl zoomen`,history:`Verlauf`,adding:`Zum Canvas hinzufügen`,selected:`Auswahl`,note:`Notiz`,noteHint:`Eine Notiz in Markdown hinzufügen`,file:`Datei`,fileHint:`Ein Werk oder eine Datei des Projekts hinzufügen`,link:`Link`,linkHint:`Einen Link zu einer Seite hinzufügen`,linkPlaceholder:`https://`,linkAdd:`Hinzufügen`,group:`Gruppieren`,groupHint:`Die Auswahl in eine Gruppe legen`,color:`Farbe`,noColor:`Keine Farbe`,colors:{1:`Rot`,2:`Orange`,3:`Gelb`,4:`Grün`,5:`Cyan`,6:`Lila`},find:`Ein Werk oder eine Datei suchen`,items:`Werke`,media:`Medien`,nothingFound:`Keine Treffer`,open:`Öffnen`,openHint:`Im eigenen Editor öffnen`,openLinkHint:`Seite im Browser öffnen`,delete:`Löschen`,label:`Beschriftung`,missing:e=>`${e} ist nicht im Projekt`,unknownType:e=>`Ein „${e}“-Knoten, unverändert behalten`,uploadFailed:e=>`Die Datei konnte nicht hinzugefügt werden: ${e}`,edits:{add:`Hinzufügen`,move:`Verschieben`,resize:`Größe ändern`,type:`Eingabe`,delete:`Löschen`,color:`Farbe`,group:`Gruppieren`,connect:`Verbinden`,label:`Beschriftung`}},pt:{loading:`Abrindo a tela…`,couldNotOpen:e=>`Não foi possível abrir a tela: ${e}`,unreadable:e=>`Este arquivo não é JSON Canvas, por isso é mostrado e não alterado: ${e}`,empty:`Clique duas vezes para adicionar uma nota, ou solte um arquivo aqui.`,undo:`Desfazer`,redo:`Refazer`,zoom:`Zoom`,zoomIn:`Ampliar`,zoomOut:`Reduzir`,zoomFit:`Ajustar à tela`,zoomActual:`Zoom em 100%`,zoomSelection:`Zoom na seleção`,history:`Histórico`,adding:`Adicionar à tela`,selected:`Seleção`,note:`Nota`,noteHint:`Adicionar uma nota em Markdown`,file:`Arquivo`,fileHint:`Adicionar um item ou um arquivo do projeto`,link:`Link`,linkHint:`Adicionar um link para uma página`,linkPlaceholder:`https://`,linkAdd:`Adicionar`,group:`Agrupar`,groupHint:`Colocar a seleção em um grupo`,color:`Cor`,noColor:`Sem cor`,colors:{1:`Vermelho`,2:`Laranja`,3:`Amarelo`,4:`Verde`,5:`Ciano`,6:`Roxo`},find:`Procurar um item ou um arquivo`,items:`Itens`,media:`Mídia`,nothingFound:`Nada corresponde`,open:`Abrir`,openHint:`Abrir no seu próprio editor`,openLinkHint:`Abrir a página no navegador`,delete:`Excluir`,label:`Rótulo`,missing:e=>`${e} não está no projeto`,unknownType:e=>`Um nó “${e}”, mantido como está`,uploadFailed:e=>`Não foi possível adicionar o arquivo: ${e}`,edits:{add:`Adicionar`,move:`Mover`,resize:`Redimensionar`,type:`Digitação`,delete:`Excluir`,color:`Cor`,group:`Agrupar`,connect:`Conectar`,label:`Rótulo`}}});function Wa(){return Ua.of(s()?.locale)}var Ga={1:`#cf5f5a`,2:`#d98a45`,3:`#c9a63a`,4:`#579f67`,5:`#459fb2`,6:`#8f78bd`},Ka=e=>e===void 0?void 0:Ga[e]??(/^#[0-9a-f]{3,8}$/iu.test(e)?e:void 0);function qa({target:e,className:t}){return e.type===`item`?(0,J.jsx)(Oe,{name:e.item.kindInfo?.icon,className:t}):e.type===`media`?e.mime.startsWith(`audio/`)?(0,J.jsx)(fe,{className:t,"aria-hidden":!0}):(0,J.jsx)(E,{className:t,"aria-hidden":!0}):(0,J.jsx)(T,{className:t,"aria-hidden":!0})}var Ja=e=>e.slice(e.lastIndexOf(`/`)+1);function Ya(e){return e.type===`item`?e.item.title??Ja(e.item.id):Ja(e.path)}function Xa({text:e}){return(0,J.jsx)(`div`,{className:`text-ink size-full overflow-hidden px-4 py-3 text-base leading-relaxed [&_a]:text-pencil-text [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_code]:font-mono [&_code]:text-sm [&_h1]:mb-2 [&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:mb-2 [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:mb-1 [&_h3]:font-semibold [&_li]:mb-0.5 [&_ol]:mb-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:mb-2 [&_strong]:font-semibold [&_ul]:mb-2 [&_ul]:list-disc [&_ul]:pl-5`,"data-testid":`canvas-text`,children:(0,J.jsx)(Ii,{remarkPlugins:[Pa],children:e})})}function Za({preview:e}){switch(e.type){case`picture`:return(0,J.jsx)(`img`,{src:`data:${e.image.mime};base64,${e.image.data}`,alt:``,draggable:!1,className:`pointer-events-none size-full object-contain select-none`,"data-testid":`canvas-preview-picture`});case`text`:return(0,J.jsx)(`div`,{className:`text-ink size-full overflow-hidden px-5 py-4 text-base leading-relaxed`,"data-testid":`canvas-preview-text`,children:e.lines.map((e,t)=>(0,J.jsx)(`p`,{className:t===0?`mb-2 font-semibold`:`mb-1`,children:e},t))});case`table`:return(0,J.jsx)(`div`,{className:`size-full overflow-hidden p-2 text-xs`,"data-testid":`canvas-preview-table`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:e.columns.map((e,t)=>(0,J.jsx)(`th`,{className:`border-rule truncate border px-1 text-left font-semibold`,children:e},t))})}),(0,J.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,J.jsx)(`tr`,{children:e.map((e,t)=>(0,J.jsx)(`td`,{className:`border-rule truncate border px-1`,children:e},t))},t))})]})})}}function Qa({icon:e,words:t,className:n}){return(0,J.jsxs)(`div`,{className:d(`text-lead flex size-full flex-col items-center justify-center gap-2 p-3 text-center text-xs [&_svg]:size-6`,n),children:[e,(0,J.jsx)(`span`,{className:`max-w-full truncate`,children:t})]})}function $a({target:e,project:t}){let n=Ra(o(),e.item.id,t?.revision);return n===void 0||n===`none`?(0,J.jsx)(Qa,{icon:(0,J.jsx)(qa,{target:e}),words:e.item.id}):(0,J.jsxs)(`div`,{className:`relative size-full`,children:[(0,J.jsx)(Za,{preview:n}),n.type===`picture`&&n.duration!==void 0?(0,J.jsx)(`span`,{className:`bg-ink/70 text-paper absolute right-2 bottom-2 rounded-xs px-1 text-xs tabular-nums`,children:`${String(Math.floor(n.duration/60))}:${String(Math.round(n.duration%60)).padStart(2,`0`)}`}):null]})}function eo({target:e,active:t}){let n=Ba(o(),e.path),r=a(e.mime),i=(0,J.jsx)(Qa,{icon:(0,J.jsx)(qa,{target:e}),words:e.path});return!r||n===void 0?i:(0,J.jsx)(Y.Suspense,{fallback:i,children:(0,J.jsx)(r,{url:n,path:e.path,type:e.mime,active:t})})}function to({node:e,project:t,active:n}){let r=Wa(),i=o(),a=e.file??``,s=Ia(t,a),c=Ha(i,s.type===`item`?void 0:s.path);return s.type===`item`?(0,J.jsx)($a,{target:s,project:t}):c===!1||a===``?(0,J.jsx)(Qa,{icon:(0,J.jsx)(x,{"aria-hidden":!0}),words:r.missing(a),className:`text-problem-text`}):s.type===`media`?(0,J.jsx)(eo,{target:s,active:n}):(0,J.jsx)(Qa,{icon:(0,J.jsx)(T,{"aria-hidden":!0}),words:a})}function no({node:e,project:t}){let n=s()?.locale??`en`,r=Ia(t,e.file??``),i=r.type===`item`&&r.item.kindInfo?m(r.item.kindInfo,n):void 0;return(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,title:e.file,children:[(0,J.jsx)(qa,{target:r,className:`size-3.5 flex-none`}),(0,J.jsx)(`span`,{className:`truncate`,children:Ya(r)}),i===void 0?null:(0,J.jsx)(`span`,{className:`text-lead-soft flex-none`,children:i})]})}function ro({url:e}){let t=e,n=``;try{let r=new URL(e);t=r.host,n=`${r.pathname===`/`?``:r.pathname}${r.search}`}catch{}return(0,J.jsxs)(`div`,{className:`flex size-full flex-col justify-center gap-1 overflow-hidden px-4 py-3`,"data-testid":`canvas-link`,children:[(0,J.jsxs)(`span`,{className:`text-ink flex min-w-0 items-center gap-2 font-semibold`,children:[(0,J.jsx)(De,{className:`text-lead size-4 flex-none`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:t})]}),n===``?null:(0,J.jsx)(`span`,{className:`text-lead truncate text-xs`,children:n})]})}function io({type:e}){let t=Wa();return(0,J.jsx)(Qa,{icon:(0,J.jsx)(T,{"aria-hidden":!0}),words:t.unknownType(e)})}var ao=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`)?`⌘`:`Ctrl+`,Q=(e,t)=>t===void 0?e:`${e} (${t})`,oo=`application/x-allyhub-canvas-note`,so=`bg-sheet border-rule shadow-overlay pointer-events-auto flex items-center gap-0.5 rounded-lg border p-1`,co=/\.(?:png|jpe?g|webp|avif|gif|svg|mp4|webm|mov|mp3|wav|m4a|ogg|aac|flac)$/iu;async function lo(e,t,n=3){let r=await e(t).catch(()=>({files:[],dirs:[]})),i=r.files.map(e=>e.path).filter(e=>co.test(e));if(n===0)return i;let a=await Promise.all(r.dirs.filter(e=>!e.split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`)).map(t=>lo(e,t,n-1)));return[...i,...a.flat()]}function uo(e){let t=Wa(),n=o(),r=s()?.locale??`en`,[i,a]=(0,Y.useState)(``),[c,l]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{let e=!0;return lo(e=>n[`files/list`]({dir:e}),``).then(t=>{e&&l([...new Set(t)].sort())}),()=>{e=!1}},[n]);let u=i.trim().toLowerCase(),d=(0,Y.useMemo)(()=>(e.project?.items??[]).filter(t=>t.entry!==e.self&&(u===``||t.id.toLowerCase().includes(u)||(t.title??``).toLowerCase().includes(u))),[e.project,e.self,u]),f=c.filter(e=>u===``||e.toLowerCase().includes(u));return(0,J.jsxs)(`div`,{className:`flex w-80 flex-col gap-2`,"data-testid":`canvas-picker`,children:[(0,J.jsx)(w,{autoFocus:!0,value:i,placeholder:t.find,"aria-label":t.find,onChange:e=>{a(e.target.value)}}),(0,J.jsxs)(`div`,{className:`flex h-80 flex-col overflow-y-auto`,children:[d.length>0&&(0,J.jsx)(`p`,{className:`text-lead px-2 pt-1 text-xs font-semibold`,children:t.items}),d.map(t=>(0,J.jsx)(D,{size:`dense`,"data-testid":`canvas-pick`,"data-path":t.entry,onClick:()=>{e.onPick(t.entry)},meta:t.kindInfo?(0,J.jsx)(`span`,{className:`text-lead-soft text-xs`,children:m(t.kindInfo,r)}):void 0,children:t.title??t.id},t.id)),f.length>0&&(0,J.jsx)(`p`,{className:`text-lead px-2 pt-2 text-xs font-semibold`,children:t.media}),f.map(t=>(0,J.jsx)(D,{size:`dense`,"data-testid":`canvas-pick`,"data-path":t,onClick:()=>{e.onPick(t)},children:t},t)),d.length===0&&f.length===0&&(0,J.jsx)(`p`,{className:`text-lead px-2 py-1 text-xs`,children:t.nothingFound})]})]})}function fo(e){let t=Wa(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),c=()=>{let t=o.trim();t!==``&&(a(!1),s(``),e.onLink(/^[a-z][a-z0-9+.-]*:/iu.test(t)?t:`https://${t}`))};return(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":t.adding,"data-testid":`canvas-add-bar`,className:d(so,`absolute bottom-3 left-1/2 -translate-x-1/2`),children:[(0,J.jsx)(_,{icon:!0,draggable:!0,"aria-label":t.note,title:t.noteHint,"data-testid":`canvas-add-note`,onClick:e.onNote,onDragStart:e=>{e.dataTransfer.setData(oo,`text`),e.dataTransfer.effectAllowed=`copy`},children:(0,J.jsx)(S,{})}),(0,J.jsxs)(y,{open:n,onOpenChange:r,children:[(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(_,{icon:!0,"aria-label":t.file,title:t.fileHint,"data-testid":`canvas-add-file`,children:(0,J.jsx)(it,{})})}),(0,J.jsx)(de,{side:`top`,align:`center`,className:`w-auto p-2`,children:(0,J.jsx)(uo,{project:e.project,self:e.self,onPick:t=>{r(!1),e.onFile(t)}})})]}),(0,J.jsxs)(y,{open:i,onOpenChange:a,children:[(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(_,{icon:!0,"aria-label":t.link,title:t.linkHint,"data-testid":`canvas-add-link`,children:(0,J.jsx)(ge,{})})}),(0,J.jsxs)(de,{side:`top`,align:`center`,className:`flex w-80 gap-2 p-2`,children:[(0,J.jsx)(w,{autoFocus:!0,value:o,placeholder:t.linkPlaceholder,"aria-label":t.link,"data-testid":`canvas-link-url`,onChange:e=>{s(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&c()}}),(0,J.jsx)(_,{"data-testid":`canvas-link-add`,disabled:o.trim()===``,onClick:c,children:t.linkAdd})]})]}),(0,J.jsx)(_,{icon:!0,"aria-label":t.group,title:Q(t.groupHint,`${ao}G`),disabled:!e.groupable,"data-testid":`canvas-group`,onClick:e.onGroup,children:(0,J.jsx)(pe,{})})]})}function po(e){let t=Wa();return(0,J.jsxs)(`div`,{className:d(so,`absolute top-3 right-3 flex-col`),"data-testid":`canvas-view-controls`,children:[(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":t.zoom,"aria-orientation":`vertical`,className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomIn,title:Q(t.zoomIn,`${ao}+`),"data-testid":`canvas-zoom-in`,onClick:()=>{e.onZoom(`in`)},children:(0,J.jsx)(ke,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomOut,title:Q(t.zoomOut,`${ao}−`),"data-testid":`canvas-zoom-out`,onClick:()=>{e.onZoom(`out`)},children:(0,J.jsx)(xe,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomFit,title:Q(t.zoomFit,`⇧1`),"data-testid":`canvas-zoom-fit`,onClick:()=>{e.onZoom(`fit`)},children:(0,J.jsx)(rt,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomActual,title:Q(t.zoomActual,`⇧0`),"data-testid":`canvas-zoom-actual`,className:`text-[11px] tabular-nums`,onClick:()=>{e.onZoom(`actual`)},children:`1:1`})]}),e.history?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`bg-rule my-0.5 h-px w-5`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":t.history,"aria-orientation":`vertical`,className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(_,{icon:!0,"aria-label":t.undo,title:Q(t.undo,`${ao}Z`),"data-testid":`canvas-undo`,disabled:!e.history.canUndo,onClick:e.history.onUndo,children:(0,J.jsx)(Ce,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.redo,title:Q(t.redo,`⇧${ao}Z`),"data-testid":`canvas-redo`,disabled:!e.history.canRedo,onClick:e.history.onRedo,children:(0,J.jsx)(Se,{})})]})]}):null]})}var mo=8,ho=20,go=8;function _o(e){let t=Wa(),n=e.markUp,r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)({width:0,height:0});(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{a({width:e.offsetWidth,height:e.offsetHeight})};t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[]);let o=e.box.left+e.box.width/2,s=Math.min(Math.max(go,o-i.width/2),Math.max(go,e.view.width-go-i.width)),c=e.box.top-Math.max(e.above,ho)-mo-i.height,l=e.box.top+e.box.height+mo,u=c>=go?c:l+i.height<=e.view.height-go?l:go,f=e.color===void 0?void 0:Ga[e.color];return(0,J.jsxs)(`div`,{ref:r,role:`toolbar`,"aria-label":t.selected,"data-testid":`canvas-selection-bar`,"data-note-chrome":``,className:d(so,`absolute`),style:{left:s,top:u,...i.width===0?{opacity:0,pointerEvents:`none`}:{}},children:[e.onColor?(0,J.jsxs)(y,{children:[(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(_,{icon:!0,"aria-label":t.color,title:t.color,"data-testid":`canvas-color`,children:(0,J.jsx)(me,{style:f?{color:f}:void 0})})}),(0,J.jsxs)(de,{side:`top`,align:`center`,className:`flex w-auto items-center gap-2 p-2`,role:`radiogroup`,"aria-label":t.color,children:[(0,J.jsx)(Ee,{color:`linear-gradient(135deg, transparent 45%, var(--color-lead) 45%, var(--color-lead) 55%, transparent 55%)`,label:t.noColor,checked:e.color===void 0,"data-testid":`canvas-color-none`,onClick:()=>{e.onColor?.(void 0)}}),at.map(n=>(0,J.jsx)(Ee,{color:Ga[n]??``,label:t.colors[n],checked:e.color===n,"data-testid":`canvas-color-${n}`,onClick:()=>{e.onColor?.(n)}},n))]})]}):null,e.onDelete?(0,J.jsx)(_,{icon:!0,"aria-label":t.delete,title:Q(t.delete,`⌫`),"data-testid":`canvas-delete`,onClick:e.onDelete,children:(0,J.jsx)(Te,{})}):null,e.open?(0,J.jsx)(_,{icon:!0,"aria-label":t.open,title:e.open.link?t.openLinkHint:t.openHint,"data-testid":`canvas-open`,onClick:e.open.run,children:(0,J.jsx)(we,{})}):null,(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomSelection,title:Q(t.zoomSelection,`⇧2`),"data-testid":`canvas-zoom-selection`,onClick:e.onZoomTo,children:(0,J.jsx)(nt,{})}),n?(0,J.jsxs)(_,{title:n.hint,"data-testid":`mark-up-selected`,className:`text-ink`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();n.begin({x:t.x,y:t.y,width:t.width,height:t.height},!0)},children:[(0,J.jsx)(v,{"aria-hidden":!0}),n.label]}):null]})}function vo(e,t){let n=e.split(`
|
|
16
|
-
`)[t-1]?.trim().replace(/,$/u,``);if(n?.startsWith(`{`)===!0)try{let e=JSON.parse(n);return typeof e.fromNode==`string`?e.fromNode:typeof e.id==`string`?e.id:void 0}catch{return}}function yo(e){let t=e.nodes.find(e=>e.after!==void 0)??e.nodes[0];if(t)return t.id;let n=e.edges[0],r=n?.after??n?.before;return typeof r?.fromNode==`string`?r.fromNode:void 0}var bo=class e{path;session;canvas;unreadable;revision=0;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e,t){this.path=e,this.session=t;let n=dt(t.text);this.canvas=n.readable?n.canvas:P,this.unreadable=n.readable?void 0:n.problems.map(e=>e.message).join(` `),this.snapshot=this.make(),t.attach({save:e=>{if(this.unreadable!==void 0)return;let t=mt(this.canvas);return t===e?void 0:t},take:(e,t,n)=>{let r=dt(e);if(!r.readable)this.canvas=P,this.unreadable=r.problems.map(e=>e.message).join(` `);else{let e=dt(t),i=n?.kind===`agent`&&e.readable?yo(xt(e.canvas,r.canvas)):void 0;i!==void 0&&(this.landed={id:i,at:Date.now()}),this.canvas=this.unreadable!==void 0||!e.readable?r.canvas:yt(e.canvas,this.canvas,r.canvas),this.unreadable=void 0}this.emit()}}),this.stops.push(t.onState(()=>{this.emit()}),t.onUndo(()=>{this.emit()}))}static async open(t,n){return new e(n,await h.open(t,n))}make(){return{canvas:this.canvas,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,revision:this.revision,landed:this.landed}}emit(){this.revision+=1,this.snapshot=this.make();for(let e of this.listeners)e()}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get text(){return this.session.text}edit(e,t,n){if(this.unreadable!==void 0)return;let r=this.canvas,i=t(r);if(i===r)return;if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){this.session.undo(),this.canvas=i,this.push(this.amending.label,xt(this.amending.from,i));return}let a=xt(r,i);St(a)||(this.canvas=i,this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,a))}settle(){this.amending=void 0}push(e,t){this.session.pushEdit({label:e,undo:()=>{this.canvas=bt(this.canvas,t,`before`),this.emit()},redo:()=>{this.canvas=bt(this.canvas,t,`after`),this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}flush(){return this.session.flush()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},xo=.1,So=e=>Math.min(4,Math.max(xo,e)),Co=(e,t)=>({x:(t.x-e.x)*e.zoom,y:(t.y-e.y)*e.zoom}),wo=(e,t)=>({x:t.x/e.zoom+e.x,y:t.y/e.zoom+e.y});function To(e,t,n){let r=So(n),i=wo(e,t);return{x:i.x-t.x/r,y:i.y-t.y/r,zoom:r}}var $=e=>({left:e.x,top:e.y,width:e.width,height:e.height});function Eo(e,t,n=48){if(e.length===0||t.width<=0||t.height<=0)return{x:-t.width/2,y:-t.height/2,zoom:1};let r=Math.min(...e.map(e=>e.left)),i=Math.min(...e.map(e=>e.top)),a=Math.max(...e.map(e=>e.left+e.width)),o=Math.max(...e.map(e=>e.top+e.height)),s=So(Math.min((t.width-2*n)/Math.max(1,a-r),(t.height-2*n)/Math.max(1,o-i),1));return{x:(r+a)/2-t.width/2/s,y:(i+o)/2-t.height/2/s,zoom:s}}function Do(e,t){switch(t){case`top`:return{x:e.left+e.width/2,y:e.top};case`bottom`:return{x:e.left+e.width/2,y:e.top+e.height};case`left`:return{x:e.left,y:e.top+e.height/2};case`right`:return{x:e.left+e.width,y:e.top+e.height/2}}}function Oo(e,t){let n=[[`top`,Math.abs(t.y-e.top)],[`bottom`,Math.abs(t.y-(e.top+e.height))],[`left`,Math.abs(t.x-e.left)],[`right`,Math.abs(t.x-(e.left+e.width))]];return n.sort((e,t)=>e[1]-t[1]),n[0]?.[0]??`right`}function ko(e,t){let n=t.left+t.width/2-(e.left+e.width/2),r=t.top+t.height/2-(e.top+e.height/2);return Math.abs(n)*e.height>=Math.abs(r)*e.width?n>=0?`right`:`left`:r>=0?`bottom`:`top`}var Ao={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}};function jo(e,t,n,r){let i=Math.max(40,Math.hypot(n.x-e.x,n.y-e.y)/3),a=Ao[t],o={x:e.x+a.x*i,y:e.y+a.y*i},s=r?Ao[r]:{x:0,y:0},c={x:n.x+s.x*i,y:n.y+s.y*i},l=t=>{let r=1-t;return{x:r*r*r*e.x+3*r*r*t*o.x+3*r*t*t*c.x+t*t*t*n.x,y:r*r*r*e.y+3*r*r*t*o.y+3*r*t*t*c.y+t*t*t*n.y}},u=e=>String(Math.round(e*10)/10),d=r?{x:-s.x,y:-s.y}:(()=>{let e=l(.95),t=Math.hypot(n.x-e.x,n.y-e.y)||1;return{x:(n.x-e.x)/t,y:(n.y-e.y)/t}})();return{d:`M ${u(e.x)} ${u(e.y)} C ${u(o.x)} ${u(o.y)} ${u(c.x)} ${u(c.y)} ${u(n.x)} ${u(n.y)}`,mid:l(.5),end:n,endDir:d}}function Mo(e,t,n){let r={x:e.x-t.x*n,y:e.y-t.y*n},i={x:-t.y*n*.5,y:t.x*n*.5};return[e,{x:r.x+i.x,y:r.y+i.y},{x:r.x-i.x,y:r.y-i.y}].map(e=>`${String(e.x)},${String(e.y)}`).join(` `)}function No(e,t){let n=e.filter(e=>t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height);return[...n].reverse().find(e=>e.type!==`group`)??n.at(-1)}function Po(e,t,n,r=48){let i=r/t.zoom,a=(e,n,r,a)=>{let o=a/t.zoom;return n+2*i>o||e-i<r?e-i:e+n+i>r+o?e+n+i-o:r},o=a(e.left,e.width,t.x,n.width),s=a(e.top,e.height,t.y,n.height);return o===t.x&&s===t.y?void 0:{...t,x:o,y:s}}function Fo(e,t,n,r,i){let a=e=>({x:n.x+(e.x-t.x)*t.zoom,y:n.y+(e.y-t.y)*t.zoom,width:e.width*t.zoom,height:e.height*t.zoom});return[...e].reverse().filter(e=>f(r,a(e))).map(e=>Io(e,i))}function Io(e,t){let n=Ct(t.text,e.id),r={path:t.file,...n===void 0?{}:{line:n}};switch(e.type){case`text`:return{name:`the note ${e.id} on the canvas`,source:r,...e.text===void 0?{}:{text:e.text}};case`file`:{let n=Ia(t.project,e.file??``),i=n.type===`item`?`the ${n.item.kindInfo?.noun??n.item.kind??`item`} ${n.item.id} (${n.item.entry})`:`the file ${n.path}`;return{name:`node ${e.id}, showing ${i}`,source:r}}case`link`:return{name:`node ${e.id}, a link to ${e.url??``}`,source:r};case`group`:return{name:`the group ${e.label===void 0?e.id:`"${e.label}"`}`,source:r};default:return{name:`node ${e.id}, of type ${e.type}`,source:r}}}function Lo(e,t,n,r){return{element:Io(e,r),outline:l({x:n.x+(e.x-t.x)*t.zoom,y:n.y+(e.y-t.y)*t.zoom,width:e.width*t.zoom,height:e.height*t.zoom})}}function Ro(e,t,n,r){let i=wo(t,{x:r.x-n.x,y:r.y-n.y}),a=[...e].reverse().find(e=>i.x>=e.x&&i.x<=e.x+e.width&&i.y>=e.y&&i.y<=e.y+e.height);return a?`on the canvas, over node ${a.id}`:`on the canvas at ${String(Math.round(i.x))}, ${String(Math.round(i.y))}`}var zo=3e4,Bo=3,Vo=6,Ho=40,Uo=24,Wo=6,Go=14,Ko=10;function qo(e,t){let n=1/Math.max(t,.5);if(e.type===`file`)return Math.max(16*n,14);if(e.type===`group`)return 20*n+4}var Jo={text:{width:260,height:140},file:{width:480,height:300},link:{width:320,height:96}},Yo=24,Xo=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`),Zo=Xo?`⌘G`:`Ctrl+G`,Qo=e=>typeof e==`object`&&!!e&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.zoom==`number`&&e.zoom>0,$o={nodes:new Set,edges:new Set},es=(e,t,n)=>({...e,nodes:e.nodes.map(e=>typeof e.id==`string`&&t.has(e.id)?n(e):e)}),ts=(e,t,n)=>({...e,edges:e.edges.map(e=>typeof e.id==`string`&&t.has(e.id)?n(e):e)}),ns=e=>{let t=``,n=new Uint8Array(e);for(let e=0;e<n.length;e+=32768)t+=String.fromCharCode(...n.subarray(e,e+32768));return btoa(t)};function rs({doc:e,path:t}){let n=Wa(),a=o(),c=s(),l=Fa(),f=(0,Y.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),p=c?.mode!==`edit`||f.unreadable!==void 0,m=(0,Y.useMemo)(()=>ft(f.canvas),[f.canvas]),h=(0,Y.useMemo)(()=>pt(f.canvas),[f.canvas]),g=(0,Y.useMemo)(()=>new Map(m.map(e=>[e.id,e])),[m]),_=(0,Y.useRef)(null),[v,ee]=(0,Y.useState)({width:0,height:0}),de=Qo(c?.place)?c.place:void 0,[y,b]=(0,Y.useState)(de),fe=(0,Y.useMemo)(()=>v.width===0?{x:0,y:0,zoom:1}:Eo(m.map($),v),[m,v]),x=y??fe,pe=(0,Y.useRef)(x);(0,Y.useEffect)(()=>{pe.current=x});let{agent:me,following:he}=r(),ge=te(),_e=(()=>{if(me?.doing===void 0)return;let n=f.landed,r=n&&n.at>=me.at-zo,i=me.source?.path===t;if(r&&i)return n.id;let a=i?me.source?.from:void 0,o=a===void 0?void 0:vo(e.text,a);return o!==void 0&&g.has(o)?o:r?n.id:void 0})(),ve=_e===void 0?void 0:g.get(_e),ye=he?ve:void 0,[be,xe]=(0,Y.useState)();if(ye?.id!==be&&(xe(ye?.id),ye&&v.width>0)){let e=Po($(ye),x,v);e&&b(e)}let Se=()=>{y===void 0&&b(x)},[Ce,we]=(0,Y.useState)($o),S=(0,Y.useMemo)(()=>{let e=[...Ce.nodes].filter(e=>g.has(e)),t=[...Ce.edges].filter(e=>h.some(t=>t.id===e));return e.length===Ce.nodes.size&&t.length===Ce.edges.size?Ce:{nodes:new Set(e),edges:new Set(t)}},[Ce,g,h]),[Te,Ee]=(0,Y.useState)(),[C,De]=(0,Y.useState)({}),Oe=(0,Y.useRef)({}),ke=e=>{Oe.current=e,De(e)},[w,T]=(0,Y.useState)(),E=(0,Y.useRef)(void 0),[D,Le]=(0,Y.useState)(),O=(0,Y.useRef)(!1);(0,Y.useLayoutEffect)(()=>{let e=_.current;if(!e)return;let t=new ResizeObserver(()=>{ee({width:e.clientWidth,height:e.clientHeight})});return t.observe(e),()=>{t.disconnect()}},[]),(0,Y.useEffect)(()=>{if(y===void 0)return;let e=setTimeout(()=>{a[`editor/place`]({place:{x:Math.round(y.x),y:Math.round(y.y),zoom:Math.round(y.zoom*1e3)/1e3}}).catch(()=>void 0)},400);return()=>{clearTimeout(e)}},[a,y]);let k=()=>{let e=_.current?.getBoundingClientRect();return{x:e?.left??0,y:e?.top??0}},Re=e=>{let t=k();return wo(x,{x:e.clientX-t.x,y:e.clientY-t.y})},ze=()=>wo(x,{x:v.width/2,y:v.height/2});(0,Y.useEffect)(()=>{let e=_.current;if(!e)return;let t=t=>{if(t.target?.closest(`[data-canvas-scrolls]`))return;t.preventDefault();let n=e.getBoundingClientRect(),r={x:t.clientX-n.left,y:t.clientY-n.top};b(e=>{let n=e??pe.current;if(t.ctrlKey||t.metaKey)return To(n,r,n.zoom*Math.exp(-t.deltaY*.01));let i=t.shiftKey&&t.deltaX===0?t.deltaY:t.deltaX,a=t.shiftKey&&t.deltaX===0?0:t.deltaY;return{...n,x:n.x+i/n.zoom,y:n.y+a/n.zoom}})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[]);let A=(0,Y.useCallback)(e=>{if(e===`fit`||typeof e!=`string`){let t=e===`fit`?m.map($):e;t.length>0&&b(Eo(t,v))}else b(t=>{let n=t??pe.current,r=e===`actual`?1:e===`in`?n.zoom*1.25:n.zoom/1.25;return To(n,{x:v.width/2,y:v.height/2},So(r))})},[m,v]),Be=e=>{let t=new Map;for(let n of e){let e=g.get(n);if(e&&(t.set(n,$(e)),e.type===`group`))for(let n of m)n.id!==e.id&&n.x>=e.x&&n.y>=e.y&&n.x+n.width<=e.x+e.width&&n.y+n.height<=e.y+e.height&&t.set(n.id,$(n))}return t},j=e=>{we(e)},Ve=(e,t,n,r)=>{let i={left:e.x-t/2,top:e.y-n/2,width:t,height:n};if(!r)return i;let a=e=>m.filter(t=>t.type!==`group`&&t.x<e.left+e.width&&t.x+t.width>e.left&&t.y<e.top+e.height&&t.y+t.height>e.top);for(let e=0;e<50;e++){let e=a(i);if(e.length===0)break;i={...i,left:Math.max(...e.map(e=>e.x+e.width))+Uo}}let o=(i.left+i.width-x.x)*x.zoom,s=(i.top+i.height-x.y)*x.zoom;return(o>v.width||s>v.height||i.left<x.x||i.top<x.y)&&b({...x,x:i.left+i.width/2-v.width/2/x.zoom,y:i.top+i.height/2-v.height/2/x.zoom}),i},He=(t,r,i=!1)=>{Se();let a=ht(f.canvas),o=typeof t.width==`number`?t.width:260,s=typeof t.height==`number`?t.height:140,c=Ve(r??ze(),o,s,r===void 0),l={id:a,...t,x:R(c.left),y:R(c.top),width:R(o),height:R(s)},u={id:a,type:l.type,...Object.fromEntries(Object.entries(l).filter(([e])=>![`id`,`type`,`x`,`y`,`width`,`height`].includes(e))),x:l.x,y:l.y,width:l.width,height:l.height};return e.edit(n.edits.add,e=>({...e,nodes:[...e.nodes,u]})),j({nodes:new Set([a]),edges:new Set}),i&&t.type===`text`&&T({type:`text`,id:a,text:``}),a},Ue=e=>He({type:`text`,text:``,...Jo.text},e,!0),We=(e,t)=>He({type:`file`,file:e,...Jo.file},t),Ge=(e,t)=>He({type:`link`,url:e,...Jo.link},t),Ke=()=>{if(S.nodes.size===0&&S.edges.size===0)return;let t=S.nodes;e.edit(n.edits.delete,e=>({...e,nodes:e.nodes.filter(e=>!(typeof e.id==`string`&&t.has(e.id))),edges:e.edges.filter(e=>!(typeof e.id==`string`&&S.edges.has(e.id))&&!t.has(String(e.fromNode))&&!t.has(String(e.toNode)))})),j($o)},qe=()=>{let t=m.filter(e=>S.nodes.has(e.id));if(t.length===0)return;let r=je(t.map($)),i=ht(f.canvas),a=t.some(e=>e.type===`file`)?48:Uo,o={id:i,type:`group`,x:R(r.left-Uo),y:R(r.top-a),width:R(r.width+48),height:R(r.height+Uo+a)};e.edit(n.edits.group,e=>{let t=e.nodes.findIndex(e=>typeof e.id==`string`&&S.nodes.has(e.id)),n=[...e.nodes];return n.splice(t<0?0:t,0,o),{...e,nodes:n}}),j({nodes:new Set([i]),edges:new Set}),T({type:`group`,id:i,text:``})},Je=t=>{e.edit(n.edits.color,e=>ts(es(e,S.nodes,e=>z(e,{color:t})),S.edges,e=>z(e,{color:t})))},Ye=()=>{let e=[...m.filter(e=>S.nodes.has(e.id)).map(e=>e.color),...h.filter(e=>S.edges.has(e.id)).map(e=>e.color)],t=e[0];return e.length>0&&e.every(e=>e===t)?t:void 0},Xe=()=>[...m.filter(e=>S.nodes.has(e.id)).map(N),...h.filter(e=>S.edges.has(e.id)).flatMap(e=>{let t=ct(e);return t?[Pe(t.start,t.end)]:[]})],M=(t=w)=>{if(!t)return;T(void 0);let r=t.text;t.type===`edge`?e.edit(n.edits.label,e=>ts(e,new Set([t.id]),e=>z(e,{label:r.trim()===``?void 0:r}))):t.type===`group`?e.edit(n.edits.label,e=>es(e,new Set([t.id]),e=>z(e,{label:r.trim()===``?void 0:r}))):e.edit(n.edits.type,e=>es(e,new Set([t.id]),e=>z(e,{text:r}))),_.current?.focus()},Ze=e=>{e.type===`file`&&e.file?a[`items/open`]({target:{type:`file`,path:e.file}}).catch(()=>void 0):e.type===`link`&&e.url&&/^https?:\/\//u.test(e.url)&&a[`items/open`]({target:{type:`browser`,url:e.url}}).catch(()=>void 0)},Qe=e=>{Se(),w&&M();let t=e.target;if(t.closest(`[data-canvas-own]`))return;_.current?.focus();let n=Re(e);if(e.button===1||e.button===0&&O.current){E.current={type:`pan`,start:{x:e.clientX,y:e.clientY},camera:x},Le(`pan`),e.currentTarget.setPointerCapture(e.pointerId);return}if(e.button!==0)return;let r=t.closest(`[data-handle]`)?.dataset.handle,i=t.closest(`[data-connector]`),a=t.closest(`[data-edge]`),o=t.closest(`[data-node]`);if(!(p&&(r||i))){if(r){let e=[...S.nodes][0],t=e===void 0?void 0:g.get(e);if(!t)return;E.current={type:`resize`,id:t.id,handle:r,start:n,frame:$(t)}}else if(i){let e=i.dataset.connector??``,t=i.dataset.side??`right`;E.current={type:`connect`,from:e,side:t,start:n},ke({connect:{from:e,side:t,to:n}})}else if(a){let t=a.dataset.edge??``,n=e.shiftKey||e.metaKey;j(n?{nodes:S.nodes,edges:new Set(S.edges.has(t)?[...S.edges].filter(e=>e!==t):[...S.edges,t])}:{nodes:new Set,edges:new Set([t])});return}else if(o){let t=o.dataset.node??``,r=e.shiftKey||e.metaKey,i=S;if(r?i={nodes:new Set(S.nodes.has(t)?[...S.nodes].filter(e=>e!==t):[...S.nodes,t]),edges:S.edges}:S.nodes.has(t)||(i={nodes:new Set([t]),edges:new Set}),j(i),p)return;E.current={type:`move`,start:n,frames:Be(i.nodes),dragged:!1}}else E.current={type:`marquee`,start:n,add:e.shiftKey},e.shiftKey||j($o);Le(E.current.type),e.currentTarget.setPointerCapture(e.pointerId)}},$e=e=>{let t=E.current;if(!t){let t=e.target,n=Re(e),r=24/x.zoom,i=t.closest(`[data-connector]`)?.dataset.connector??[...m].reverse().find(e=>e.type!==`group`&&n.x>=e.x-r&&n.x<=e.x+e.width+r&&n.y>=e.y-r&&n.y<=e.y+e.height+r)?.id??t.closest(`[data-node]`)?.dataset.node;i!==Te&&Ee(i);return}let n=Re(e);if(t.type===`pan`){b({...t.camera,x:t.camera.x-(e.clientX-t.start.x)/t.camera.zoom,y:t.camera.y-(e.clientY-t.start.y)/t.camera.zoom});return}let r=Vo/x.zoom;if(t.type===`move`){let i=n.x-t.start.x,a=n.y-t.start.y;if(!t.dragged&&Math.hypot(i,a)*x.zoom<Bo)return;t.dragged=!0;let o=[...t.frames.values()],s=je(o),c=m.filter(e=>!t.frames.has(e.id)).map($),l=e.metaKey||e.ctrlKey?{frame:{...s,left:s.left+i,top:s.top+a},guides:[]}:Ae({...s,left:s.left+i,top:s.top+a},c,void 0,r),u=l.frame.left-s.left,d=l.frame.top-s.top,f=new Map;for(let[e,n]of t.frames)f.set(e,{...n,left:n.left+u,top:n.top+d});ke({frames:f,guides:l.guides})}else if(t.type===`resize`){let i=m.filter(e=>e.id!==t.id).map($),a=Ne(t.frame,t.handle,n.x-t.start.x,n.y-t.start.y,{keep:e.shiftKey,min:Ho,...e.metaKey||e.ctrlKey?{}:{snap:{others:i,surface:void 0,tol:r}}});ke({frames:new Map([[t.id,a.frame]]),guides:a.guides})}else if(t.type===`connect`){let e=No(m.filter(e=>e.id!==t.from),n);ke({connect:{from:t.from,side:t.side,to:n,...e?{over:{id:e.id,side:Oo($(e),n)}}:{}}})}else{let e=Pe(t.start,n),r=m.filter(t=>t.x<e.left+e.width&&t.x+t.width>e.left&&t.y<e.top+e.height&&t.y+t.height>e.top&&(t.type!==`group`||t.x>=e.left&&t.y>=e.top&&t.x+t.width<=e.left+e.width&&t.y+t.height<=e.top+e.height));j({nodes:new Set([...t.add?S.nodes:[],...r.map(e=>e.id)]),edges:t.add?S.edges:new Set}),ke({marquee:e})}},et=()=>{let t=E.current;E.current=void 0,Le(void 0);let r=Oe.current;if(ke({}),t){if(t.type===`move`&&t.dragged&&r.frames){let t=r.frames;e.edit(n.edits.move,e=>es(e,new Set(t.keys()),e=>{let n=t.get(String(e.id));return n?z(e,{x:R(n.left),y:R(n.top)}):e}))}else if(t.type===`resize`&&r.frames){let i=r.frames.get(t.id);i&&e.edit(n.edits.resize,e=>es(e,new Set([t.id]),e=>z(e,{x:R(i.left),y:R(i.top),width:R(i.width),height:R(i.height)})))}else if(t.type===`connect`&&r.connect?.over){let i=r.connect.over,a=ht(f.canvas);e.edit(n.edits.connect,e=>({...e,edges:[...e.edges,{id:a,fromNode:t.from,fromSide:t.side,toNode:i.id,toSide:i.side}]})),j({nodes:new Set,edges:new Set([a])})}}},tt=e=>{let t=document.elementFromPoint(e.clientX,e.clientY)??e.target;if(p){let e=t.closest(`[data-node]`)?.dataset.node,n=e===void 0?void 0:g.get(e);n&&Ze(n);return}if(t.closest(`[data-canvas-own]`))return;let n=t.closest(`[data-edge]`)?.dataset.edge;if(n!==void 0){let e=h.find(e=>e.id===n);T({type:`edge`,id:n,text:e?.label??``});return}if(t.closest(`[data-group-label]`)){let e=t.closest(`[data-node]`)?.dataset.node??``;T({type:`group`,id:e,text:g.get(e)?.label??``});return}let r=t.closest(`[data-node]`)?.dataset.node,i=r===void 0?void 0:g.get(r);i?i.type===`text`?T({type:`text`,id:i.id,text:i.text??``}):i.type===`group`?T({type:`group`,id:i.id,text:i.label??``}):Ze(i):Ue(Re(e))},nt=t=>{if(t.target.closest(`textarea, input, [contenteditable]`))return;Se();let r=Xo?t.metaKey:t.ctrlKey;if(t.key===` `)O.current=!0,t.preventDefault();else if(r&&t.key.toLowerCase()===`z`)t.preventDefault(),t.shiftKey?e.redo():e.undo();else if(r&&t.key.toLowerCase()===`y`)t.preventDefault(),e.redo();else if(r&&t.key.toLowerCase()===`a`)t.preventDefault(),j({nodes:new Set(m.map(e=>e.id)),edges:new Set(h.map(e=>e.id))});else if(r&&t.key.toLowerCase()===`g`&&!p)t.preventDefault(),qe();else if((t.key===`Delete`||t.key===`Backspace`)&&!p)t.preventDefault(),Ke();else if(t.key===`Escape`)j($o);else if(t.shiftKey&&(t.key===`!`||t.code===`Digit1`))A(`fit`);else if(t.shiftKey&&(t.key===`@`||t.code===`Digit2`))A(Xe());else if(t.shiftKey&&(t.key===`)`||t.code===`Digit0`))A(`actual`);else if(r&&(t.key===`=`||t.key===`+`))t.preventDefault(),A(`in`);else if(r&&t.key===`-`)t.preventDefault(),A(`out`);else if(t.key===`Enter`&&S.nodes.size===1&&!p){let e=g.get([...S.nodes][0]??``);e?.type===`text`&&(t.preventDefault(),T({type:`text`,id:e.id,text:e.text??``}))}else if(t.key.startsWith(`Arrow`)&&S.nodes.size>0&&!p){t.preventDefault();let r=t.shiftKey?10:1,i=t.key===`ArrowLeft`?-r:t.key===`ArrowRight`?r:0,a=t.key===`ArrowUp`?-r:t.key===`ArrowDown`?r:0,o=Be(S.nodes);e.edit(n.edits.move,e=>es(e,new Set(o.keys()),e=>z(e,{x:R(Number(e.x)+i),y:R(Number(e.y)+a)})),`nudge`)}},rt=t=>{t.key===` `&&(O.current=!1),t.key.startsWith(`Arrow`)&&e.settle()},it=e=>{if(p)return;e.preventDefault();let n=Re(e);if(e.dataTransfer.types.includes(`application/x-allyhub-canvas-note`)){Ue(n);return}let r=[...e.dataTransfer.files];if(r.length>0){(async()=>{let e=0;for(let i of r)try{let{path:r}=await a[`files/upload`]({dir:t.includes(`/`)?t.slice(0,t.lastIndexOf(`/`)):``,name:i.name,data:ns(await i.arrayBuffer())});We(r,{x:n.x+e*40,y:n.y+e*40}),e+=1}catch{}})();return}let i=(e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`)).trim();i!==``&&(/^https?:\/\//u.test(i)?Ge(i,n):We(i.replace(/^\.\//u,``),n))},at=re();i({hold:()=>Promise.resolve({key:`${t}@${String(f.revision)}`,what:`The canvas ${t}, its nodes laid out with notes and edges`,source:{path:t}}),locate:n=>{let r=u(n)[0];return Promise.resolve({elements:Fo(m,x,k(),n,{file:t,text:e.text,project:l}),...r?{where:Ro(m,x,k(),r)}:{}})},pick:n=>{let r=k(),i=No(m,wo(x,{x:n.x-r.x,y:n.y-r.y}));return Promise.resolve(i?Lo(i,x,k(),{file:t,text:e.text,project:l}):void 0)},selected:()=>Promise.resolve(m.filter(e=>S.nodes.has(e.id)).map(n=>Lo(n,x,k(),{file:t,text:e.text,project:l})))});let N=e=>C.frames?.get(e.id)??$(e),P=S.nodes.size===1&&S.edges.size===0?g.get([...S.nodes][0]??``):void 0,F=x.zoom,I=m.filter(e=>e.type===`group`),st=m.filter(e=>e.type!==`group`),ct=e=>{let t=g.get(e.fromNode),n=g.get(e.toNode);if(!t||!n)return;let r=N(t),i=N(n),a=e.fromSide??ko(r,i),o=e.toSide??ko(i,r),s=Do(r,a),c=Do(i,o);return{...jo(s,a,c,o),start:s,startDir:jo(c,o,s,a).endDir}},lt=e=>{let t=N(e),r=S.nodes.has(e.id),i=Ka(e.color),a=e.type===`group`,o=a?(0,J.jsx)(`div`,{"data-group-label":``,className:`text-ink absolute bottom-full left-0 max-w-full truncate rounded-sm px-1.5 py-0.5 text-sm font-semibold`,style:{marginBottom:Wo/F,fontSize:14/Math.max(F,.5),background:i?`color-mix(in oklab, ${i} 22%, transparent)`:void 0},children:w?.type===`group`&&w.id===e.id?null:e.label??`\xA0`}):e.type===`file`?(0,J.jsx)(`div`,{className:`text-lead absolute bottom-full left-0 flex max-w-full text-xs`,style:{marginBottom:Wo/F,fontSize:12/Math.max(F,.5)},children:(0,J.jsx)(no,{node:e,project:l})}):null;return(0,J.jsxs)(`div`,{"data-node":e.id,"data-testid":`canvas-node`,"data-type":e.type,"data-selected":r?``:void 0,className:`group/node absolute`,style:{left:t.left,top:t.top,width:t.width,height:t.height},children:[o,(0,J.jsx)(`div`,{className:d(`size-full overflow-hidden rounded-md border`,a?`border-rule-strong`:`bg-sheet border-rule motion-safe:transition-shadow`,!a&&Te===e.id&&`border-rule-strong shadow-overlay`,r&&`outline-pencil outline-2 outline-offset-2`),style:{...i?{borderColor:i}:{},...a?{background:i?`color-mix(in oklab, ${i} 8%, transparent)`:`color-mix(in oklab, var(--color-lead) 5%, transparent)`}:e.type===`text`&&i?{background:`color-mix(in oklab, ${i} 10%, var(--color-sheet))`}:{},borderWidth:Math.max(1,1/F)},children:e.type===`text`?w?.type===`text`&&w.id===e.id?(0,J.jsx)(`textarea`,{"data-canvas-own":``,"data-testid":`canvas-typing`,autoFocus:!0,value:w.text,"aria-label":n.note,className:`text-ink size-full resize-none bg-transparent px-4 py-3 text-base leading-relaxed outline-none`,onChange:e=>{T({...w,text:e.target.value})},onBlur:()=>{M()},onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&M()}}):(0,J.jsx)(Xa,{text:e.text??``}):e.type===`file`?(0,J.jsx)(to,{node:e,project:l,active:Te===e.id}):e.type===`link`?(0,J.jsx)(ro,{url:e.url??``}):a?null:(0,J.jsx)(io,{type:e.type})}),a&&w?.type===`group`&&w.id===e.id?(0,J.jsx)(`input`,{"data-canvas-own":``,"data-testid":`canvas-typing`,autoFocus:!0,value:w.text,"aria-label":n.label,className:`bg-sheet text-ink border-pencil absolute bottom-full left-0 rounded-sm border px-1.5 py-0.5 text-sm font-semibold outline-none`,style:{marginBottom:Wo/F,fontSize:14/Math.max(F,.5)},onChange:e=>{T({...w,text:e.target.value})},onBlur:()=>{M()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Escape`||e.key===`Enter`)&&M()}}):null]},e.id)},ut=p||D!==void 0?null:m.filter(e=>e.id===Te||S.nodes.has(e.id)).flatMap(e=>{let t=N(e),n=Go/F,r=qo(e,F);return ot.map(i=>{let a=Do({left:t.left-n,top:t.top-n,width:t.width+2*n,height:t.height+2*n},i),o=i===`top`&&r!==void 0?{x:a.x,y:t.top-15/F-r}:a;return(0,J.jsx)(`span`,{"data-connector":e.id,"data-side":i,"data-testid":`canvas-connector`,className:`bg-sheet border-pencil absolute rounded-full border`,style:{left:o.x,top:o.y,width:Ko/F,height:Ko/F,marginLeft:-5/F,marginTop:-5/F,borderWidth:1.5/F,cursor:`crosshair`}},`${e.id} ${i}`)})}),L=(()=>{let e=C.connect;if(!e)return;let t=g.get(e.from);if(!t)return;let n=N(t),r=e.over?g.get(e.over.id):void 0;return jo(Do(n,e.side),e.side,r&&e.over?Do($(r),e.over.side):e.to,e.over?.side)})(),dt=h.map(e=>{let t=ct(e);if(!t)return null;let n=S.edges.has(e.id),r=Ka(e.color)??`var(--color-lead)`,i=(n?2.5:1.75)/F;return(0,J.jsxs)(`g`,{"data-edge":e.id,"data-testid":`canvas-edge`,children:[(0,J.jsx)(`path`,{d:t.d,stroke:`transparent`,strokeWidth:14/F,fill:`none`,pointerEvents:`stroke`}),(0,J.jsx)(`path`,{d:t.d,stroke:n?`var(--color-pencil)`:r,strokeWidth:i,fill:`none`,pointerEvents:`none`}),e.fromEnd===`arrow`?(0,J.jsx)(`polygon`,{points:Mo(t.start,t.startDir,10/Math.max(F,.4)),fill:n?`var(--color-pencil)`:r,pointerEvents:`none`}):null,e.toEnd===`arrow`?(0,J.jsx)(`polygon`,{points:Mo(t.end,t.endDir,10/Math.max(F,.4)),fill:n?`var(--color-pencil)`:r,pointerEvents:`none`}):null]},e.id)}),mt=h.map(e=>{let t=ct(e);if(!t)return null;let r=w?.type===`edge`&&w.id===e.id;return!r&&(e.label===void 0||e.label===``)?null:(0,J.jsx)(`div`,{"data-edge":e.id,className:`absolute -translate-x-1/2 -translate-y-1/2`,style:{left:t.mid.x,top:t.mid.y,fontSize:13/Math.max(F,.5)},children:r?(0,J.jsx)(`input`,{"data-canvas-own":``,"data-testid":`canvas-typing`,autoFocus:!0,value:w.text,"aria-label":n.label,className:`bg-sheet text-ink border-pencil w-40 rounded-sm border px-1.5 py-0.5 text-center outline-none`,onChange:e=>{T({...w,text:e.target.value})},onBlur:()=>{M()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Escape`||e.key===`Enter`)&&M()}}):(0,J.jsx)(`span`,{"data-testid":`canvas-edge-label`,className:`bg-paper text-ink rounded-sm px-1.5 py-0.5 whitespace-nowrap`,children:e.label})},e.id)}),gt=P&&!p&&P.id!==w?.id?Fe.map(e=>{let t=N(P),[n,r]=Me[e],i=9/F;return(0,J.jsx)(`span`,{"data-handle":e,"data-testid":`canvas-handle`,className:`bg-sheet border-pencil absolute border`,style:{left:t.left+n*t.width-i/2,top:t.top+r*t.height-i/2,width:i,height:i,borderWidth:1.5/F,cursor:`${e===`n`||e===`s`?`ns`:e===`e`||e===`w`?`ew`:e===`ne`||e===`sw`?`nesw`:`nwse`}-resize`}},e)}):null,_t=Yo*F,vt=P,yt=!p,B=()=>{_.current?.focus()},bt=(()=>{if(D!==void 0||w!==void 0)return;let e=Xe();if(e.length===0)return;let t=je(e),n=Co(x,{x:t.left,y:t.top}),r={left:n.x,top:n.y,width:t.width*F,height:t.height*F};if(r.left>v.width||r.top>v.height||r.left+r.width<0||r.top+r.height<0)return;let i=Math.max(0,...m.filter(e=>S.nodes.has(e.id)&&e.y<=t.top).map(e=>qo(e,F)??0));return{box:r,above:i>0?i*F+Wo+Ko+4:0}})(),xt=P&&(P.type===`file`||P.type===`link`)?P:void 0;return(0,J.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,"data-testid":`canvas-editor`,"data-state":`ready`,children:[(0,J.jsx)(oe,{saved:{state:f.state}}),f.unreadable===void 0?null:(0,J.jsx)(`div`,{className:`bg-problem/10 text-problem-text shrink-0 px-3 py-1 text-xs`,"data-testid":`canvas-unreadable`,children:n.unreadable(f.unreadable)}),(0,J.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,J.jsxs)(se,{children:[(0,J.jsx)(ne,{asChild:!0,children:(0,J.jsxs)(`div`,{ref:_,tabIndex:0,role:`application`,"aria-label":t,"data-testid":`canvas-surface`,"data-zoom":F,className:`bg-paper absolute inset-0 touch-none overflow-hidden outline-none select-none`,style:{backgroundImage:`radial-gradient(circle, var(--color-rule-strong) ${String(Math.max(.6,F))}px, transparent ${String(Math.max(.6,F)+.4)}px)`,backgroundSize:`${String(_t)}px ${String(_t)}px`,backgroundPosition:`${String(-x.x*F)}px ${String(-x.y*F)}px`,cursor:D===`pan`?`grabbing`:D===`move`?`move`:D===`connect`?`crosshair`:void 0},onPointerDown:Qe,onPointerMove:$e,onPointerUp:et,onPointerCancel:et,onPointerLeave:()=>{D===void 0&&Ee(void 0)},onDoubleClick:tt,onKeyDown:nt,onKeyUp:rt,onDragOver:e=>{p||e.preventDefault()},onDrop:it,onContextMenu:e=>{let t=e.target.closest(`[data-node]`)?.dataset.node;t!==void 0&&!S.nodes.has(t)&&j({nodes:new Set([t]),edges:new Set})},children:[(0,J.jsxs)(`div`,{className:`absolute top-0 left-0`,"data-testid":`canvas-world`,style:{transform:`translate(${String(-x.x*F)}px, ${String(-x.y*F)}px) scale(${String(F)})`,transformOrigin:`0 0`},children:[I.map(lt),(0,J.jsx)(`svg`,{className:`pointer-events-none absolute top-0 left-0 overflow-visible`,width:1,height:1,children:(0,J.jsx)(`g`,{className:`pointer-events-auto`,children:dt})}),st.map(lt),L?(0,J.jsx)(`svg`,{className:`pointer-events-none absolute top-0 left-0 overflow-visible`,width:1,height:1,children:(0,J.jsx)(`path`,{d:L.d,stroke:`var(--color-pencil)`,strokeWidth:2/F,strokeDasharray:`${String(6/F)} ${String(4/F)}`,fill:`none`})}):null,mt,gt,ut,(C.guides??[]).map((e,t)=>(0,J.jsx)(`span`,{className:`bg-pencil pointer-events-none absolute`,style:e.axis===`x`?{left:e.at,top:x.y-1e4,width:1/F,height:2e4+v.height/F}:{top:e.at,left:x.x-1e4,height:1/F,width:2e4+v.width/F}},t)),C.marquee?(0,J.jsx)(`span`,{className:`border-pencil bg-pencil-wash pointer-events-none absolute border`,style:{left:C.marquee.left,top:C.marquee.top,width:C.marquee.width,height:C.marquee.height,borderWidth:1/F}}):null]}),me&&ve?(()=>{let e=$(ve);return(0,J.jsx)(Ie,{"data-testid":`canvas-agent`,label:ge(me),style:{left:(e.left-x.x)*F,top:(e.top-x.y)*F,width:e.width*F,height:e.height*F}})})():null,m.length===0&&!p?(0,J.jsx)(`p`,{className:`text-lead pointer-events-none absolute inset-x-0 top-1/2 text-center text-sm`,"data-testid":`canvas-empty`,children:n.empty}):null]})}),(0,J.jsxs)(ue,{className:`w-52`,"data-testid":`canvas-menu`,children:[vt&&(vt.type===`file`||vt.type===`link`)?(0,J.jsx)(ie,{onSelect:()=>{Ze(vt)},children:n.open}):null,!p&&S.nodes.size>0?(0,J.jsxs)(ie,{onSelect:qe,children:[n.group,(0,J.jsx)(le,{children:Zo})]}):null,!p&&S.nodes.size+S.edges.size>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ae,{}),(0,J.jsxs)(ie,{variant:`destructive`,onSelect:Ke,children:[n.delete,(0,J.jsx)(le,{children:`⌫`})]})]}):null,!p&&S.nodes.size===0&&S.edges.size===0?(0,J.jsx)(ie,{onSelect:()=>{Ue()},children:n.note}):null,(0,J.jsx)(ce,{})]})]}),yt?(0,J.jsx)(fo,{onNote:()=>{Ue()},onFile:e=>{We(e),B()},onLink:e=>{Ge(e),B()},groupable:S.nodes.size>0,onGroup:qe,project:l,self:t}):null,(0,J.jsx)(po,{onZoom:e=>{Se(),A(e),B()},history:yt?{canUndo:f.canUndo,canRedo:f.canRedo,onUndo:()=>{e.undo(),B()},onRedo:()=>{e.redo(),B()}}:void 0}),bt?(0,J.jsx)(_o,{markUp:at,box:bt.box,above:bt.above,view:v,color:Ye(),onColor:yt?Je:void 0,onDelete:yt?()=>{Ke(),B()}:void 0,open:xt?{link:xt.type===`link`,run:()=>{Ze(xt)}}:void 0,onZoomTo:()=>{Se(),A(Xe()),B()}}):null]})]})}function is(){let e=Wa(),t=o(),n=s()?.item.entry,[r,i]=(0,Y.useState)(),[a,c]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(n===void 0)return;let e,r=!0;return bo.open(t,n).then(t=>{r?(e=t,i(t)):t.close()},e=>{r&&c(e instanceof Error?e.message:String(e))}),()=>{r=!1,e?.close()}},[t,n]),!r||n===void 0?(0,J.jsx)(`div`,{className:`text-lead flex size-full items-center justify-center text-sm`,"data-testid":`canvas-editor`,"data-state":a===void 0?`loading`:`error`,children:a===void 0?e.loading:e.couldNotOpen(a)}):(0,J.jsx)(rs,{doc:r,path:n})}export{bo as CanvasDocument,is as CanvasEditor,is as default,Ua as WORDS};
|
|
15
|
+
`},i)),a}function Yr(e,t){return e&&`run`in e?async function(n,r){let i=Jr(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Jr(n,{file:r,...e||t})}}function Xr(e){if(e)throw e}var Zr=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Qr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function $r(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?ei(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function ei(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var q={basename:ti,dirname:ni,extname:ri,join:ii,sep:`/`};function ti(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);si(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function ni(e){if(si(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function ri(e){si(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function ii(...e){let t=-1,n;for(;++t<e.length;)si(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ai(n)}function ai(e){si(e);let t=e.codePointAt(0)===47,n=oi(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function oi(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function si(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var ci={cwd:li};function li(){return`/`}function ui(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function di(e){if(typeof e==`string`)e=new URL(e);else if(!ui(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return fi(e)}function fi(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var pi=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],mi=class{constructor(e){let t;t=e?ui(e)?{path:e}:typeof e==`string`||vi(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:ci.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<pi.length;){let e=pi[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)pi.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?q.basename(this.path):void 0}set basename(e){gi(e,`basename`),hi(e,`basename`),this.path=q.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?q.dirname(this.path):void 0}set dirname(e){_i(this.basename,`dirname`),this.path=q.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?q.extname(this.path):void 0}set extname(e){if(hi(e,`extname`),_i(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=q.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){ui(e)&&(e=di(e)),gi(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?q.basename(this.path,this.extname):void 0}set stem(e){gi(e,`stem`),hi(e,`stem`),this.path=q.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new he(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function hi(e,t){if(e&&e.includes(q.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+q.sep+"`")}function gi(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function _i(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function vi(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var yi=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),bi=e(Zr(),1),xi={}.hasOwnProperty,Si=new class e extends yi{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=$r()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,bi.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Ti(`data`,this.frozen),this.namespace[e]=t,this):xi.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Ti(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Oi(e),n=this.parser||this.Parser;return Ci(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Ci(`process`,this.parser||this.Parser),wi(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Oi(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Ai(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Ci(`processSync`,this.parser||this.Parser),wi(`processSync`,this.compiler||this.Compiler),this.process(e,r),Di(`processSync`,`process`,t),n;function r(e,r){t=!0,Xr(e),n=r}}run(e,t,n){Ei(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Oi(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Di(`runSync`,`run`,n),r;function i(e,t){Xr(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Oi(t),r=this.compiler||this.Compiler;return wi(`stringify`,r),Ei(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Ti(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,bi.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Qr(o)&&Qr(r)&&(r=(0,bi.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Ci(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function wi(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Ti(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ei(e){if(!Qr(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Di(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Oi(e){return ki(e)?e:new mi(e)}function ki(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Ai(e){return typeof e==`string`||ji(e)}function ji(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var J=g(),Y=e(c(),1),Mi=[],Ni={allowDangerousHtml:!0},Pi=/^(https?|ircs?|mailto|xmpp)$/i,Fi=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Ii(e){let t=Li(e),n=Ri(e);return zi(t.runSync(t.parse(n),n),e)}function Li(e){let t=e.rehypePlugins||Mi,n=e.remarkPlugins||Mi,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ni}:Ni;return Si().use(Wn).use(n).use(Yr,r).use(t)}function Ri(e){let t=e.children||``,n=new mi;return typeof t==`string`?n.value=t:``+t,n}function zi(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Bi;for(let e of Fi)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return M(e,l),bn(e,{Fragment:J.Fragment,components:i,ignoreInvalidStyle:!0,jsx:J.jsx,jsxs:J.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Hn)if(Object.hasOwn(Hn,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Hn[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Bi(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Pi.test(e.slice(0,t))?e:``}function Vi(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Hi(e,t,n){let r=Ze((n||{}).ignore||[]),i=Ui(t),a=-1;for(;++a<i.length;)Ve(e,o);function o(e,t,n){if(e.type===`text`&&typeof n==`number`)return s(e,t,n);if(r(e,n,t[t.length-1]))return Qe}function s(e,t,n){let r=t[t.length-1],o=i[a][0],s=i[a][1],c=0,l=!1,u=[];o.lastIndex=0;let d=o.exec(e.value);for(;d;){let n=d.index,r={index:d.index,input:d.input,stack:[...t,e]},i=s(...d,r);if(typeof i==`string`&&(i=i.length>0?{type:`text`,value:i}:void 0),i===!1)o.lastIndex=n+1;else{if(c!==n&&f({type:`text`,value:e.value.slice(c,n)}),Array.isArray(i))for(let e of i)f(e);else i&&f(i);c=n+d[0].length,l=!0}if(!o.global)break;d=o.exec(e.value)}return l?(c<e.value.length&&f({type:`text`,value:e.value.slice(c)}),r.children.splice(n,1,...u)):u=[e],n+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function Ui(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Wi(e[0]),Gi(e[1])])}return t}function Wi(e){return typeof e==`string`?new RegExp(Be(e),`g`):e}function Gi(e){return typeof e==`function`?e:function(){return e}}var Ki=`phrasing`,qi=[`autolink`,`link`,`image`,`label`];function Ji(){return{transforms:[na],enter:{literalAutolink:Xi,literalAutolinkEmail:Zi,literalAutolinkHttp:Zi,literalAutolinkWww:Zi},exit:{literalAutolink:ta,literalAutolinkEmail:ea,literalAutolinkHttp:Qi,literalAutolinkWww:$i}}}function Yi(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Ki,notInConstruct:qi},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Ki,notInConstruct:qi},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Ki,notInConstruct:qi}]}}function Xi(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Zi(e){this.config.enter.autolinkProtocol.call(this,e)}function Qi(e){this.config.exit.autolinkProtocol.call(this,e)}function $i(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function ea(e){this.config.exit.autolinkEmail.call(this,e)}function ta(e){this.exit(e)}function na(e){Hi(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ra],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ia]],{ignore:[`link`,`linkReference`]})}function ra(e,t,n,r,i){let a=``;if(!sa(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!aa(n)))return!1;let o=oa(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function ia(e,t,n,r){return!sa(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function aa(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function oa(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Vi(e,`(`),a=Vi(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function sa(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ze(n)||k(n))&&(!t||n!==47)}function ca(){return[Ji(),Ue(),Je(),We(),_e()]}function la(e){return{extensions:[Yi(),He(e),Ke(),j(e),ye()]}}var ua={tokenize:Sa,partial:!0},da={tokenize:Ca,partial:!0},fa={tokenize:wa,partial:!0},pa={tokenize:Ta,partial:!0},ma={tokenize:Ea,partial:!0},ha={name:`wwwAutolink`,tokenize:ba,previous:Da},ga={name:`protocolAutolink`,tokenize:xa,previous:Oa},X={name:`emailAutolink`,tokenize:ya,previous:ka},Z={};function _a(){return{text:Z}}for(var va=48;va<123;)Z[va]=X,va++,va===58?va=65:va===91&&(va=97);Z[43]=X,Z[45]=X,Z[46]=X,Z[95]=X,Z[72]=[X,ga],Z[104]=[X,ga],Z[87]=[X,ha],Z[119]=[X,ha];function ya(e,t,n){let r=this,i,a;return o;function o(t){return!Aa(t)||!ka.call(r,r.previous)||ja(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Aa(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(ma,u,l)(t):t===45||t===95||Ge(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Le(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function ba(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Da.call(r,r.previous)||ja(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(ua,e.attempt(da,e.attempt(fa,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function xa(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Oa.call(r,r.previous)&&!ja(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Le(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Re(t)||O(t)||ze(t)||k(t)?n(t):e.attempt(da,e.attempt(fa,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Sa(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Ca(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(pa,c,s)(t):t===null||O(t)||ze(t)||t!==45&&k(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function wa(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(pa,t,a)(o):o===null||O(o)||ze(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Ta(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||O(o)||ze(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||O(e)||ze(e)?t(e):r(e)}function a(e){return Le(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Le(t)?(e.consume(t),o):n(t)}}function Ea(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Ge(e)?n(e):t(e)}}function Da(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||O(e)}function Oa(e){return!Le(e)}function ka(e){return!(e===47||Aa(e))}function Aa(e){return e===43||e===45||e===46||e===95||Ge(e)}function ja(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Ma(e){return $e([_a(),Ye(),qe(e),Xe(),be()])}var Na={};function Pa(e){let t=this,n=e||Na,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Ma(n)),a.push(ca()),o.push(la(n))}function Fa(){let e=o(),[t,n]=(0,Y.useState)();return(0,Y.useEffect)(()=>{let t=!0,r,i=()=>{C(e,`project/items`,{}).then(e=>{t&&n({items:e.items,revision:e.revision})},()=>void 0)};i();let a=e.on(`project/changed`,()=>{clearTimeout(r),r=setTimeout(i,300)});return()=>{t=!1,clearTimeout(r),a()}},[e]),t}function Ia(e,t){let n=t.replace(/^\.\//u,``).replace(/\/+$/u,``),r=e?.items.find(e=>e.kind!==void 0&&e.entry===n);if(r)return{type:`item`,item:r};let i=tt(n);return/^(image|video|audio)\//u.test(i)?{type:`media`,path:n,mime:i}:{type:`file`,path:n}}var La=new Map;function Ra(e,t,n){let[r,i]=(0,Y.useState)(),a=`${t??``}@${String(n??-1)}`;if((0,Y.useEffect)(()=>{if(t===void 0||n===void 0)return;let r=!0,o=La.get(a);return o||(o=C(e,`items/preview`,{item:t}).then(e=>e.preview,()=>void 0),La.set(a,o)),o.then(e=>{r&&i({key:a,preview:e})}),()=>{r=!1}},[e,t,n,a]),r!==void 0)return r.preview??`none`}var za=new Map;function Ba(e,t){let[n,r]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(t===void 0)return;let n=!0,i=za.get(t);return i||(i=e[`files/url`]({path:t}).then(e=>e.url,()=>void 0),za.set(t,i)),i.then(e=>{n&&r(e)}),()=>{n=!1}},[e,t]),n}var Va=new Map;function Ha(e,t){let[n,r]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(t===void 0||t===``)return;let n=!0,i=t.lastIndexOf(`/`),a=i<0?``:t.slice(0,i),o=Va.get(a);return o||(o=e[`files/list`]({dir:a}).then(e=>new Set([...e.files.map(e=>e.path),...e.dirs]),()=>void 0),Va.set(a,o),setTimeout(()=>Va.delete(a),2e3)),o.then(e=>{n&&r(e===void 0?void 0:e.has(t))}),()=>{n=!1}},[e,t]),n}var Ua=p({en:{loading:`Opening the canvas…`,couldNotOpen:e=>`The canvas could not be opened: ${e}`,unreadable:e=>`This file is not JSON Canvas, so it is shown and not changed: ${e}`,empty:`Double-click to add a note, or drop a file here.`,undo:`Undo`,redo:`Redo`,zoom:`Zoom`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,zoomFit:`Zoom to fit`,zoomActual:`Zoom to 100%`,zoomSelection:`Zoom to selection`,history:`History`,adding:`Add to the canvas`,selected:`Selection`,note:`Note`,noteHint:`Add a note in Markdown`,file:`File`,fileHint:`Add an item or a file of the project`,link:`Link`,linkHint:`Add a link to a page`,linkPlaceholder:`https://`,linkAdd:`Add`,group:`Group`,groupHint:`Put the selection in a group`,color:`Colour`,noColor:`No colour`,colors:{1:`Red`,2:`Orange`,3:`Yellow`,4:`Green`,5:`Cyan`,6:`Purple`},find:`Find an item or a file`,items:`Items`,media:`Media`,nothingFound:`Nothing matches`,open:`Open`,openHint:`Open it in its own editor`,openLinkHint:`Open the page in the browser`,delete:`Delete`,label:`Label`,missing:e=>`${e} is not in the project`,unknownType:e=>`A “${e}” node, kept as it is`,uploadFailed:e=>`The file could not be added: ${e}`,edits:{add:`Add`,move:`Move`,resize:`Resize`,type:`Typing`,delete:`Delete`,color:`Colour`,group:`Group`,connect:`Connect`,label:`Label`}},"zh-cn":{loading:`正在打开画布…`,couldNotOpen:e=>`画布无法打开:${e}`,unreadable:e=>`此文件不是 JSON Canvas,因此只显示、不修改:${e}`,empty:`双击添加便签,或把文件拖到这里。`,undo:`撤销`,redo:`重做`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,zoomFit:`缩放到合适大小`,zoomActual:`缩放到 100%`,zoomSelection:`缩放到所选内容`,history:`历史记录`,adding:`添加到画布`,selected:`所选内容`,note:`便签`,noteHint:`添加 Markdown 便签`,file:`文件`,fileHint:`添加项目中的作品或文件`,link:`链接`,linkHint:`添加网页链接`,linkPlaceholder:`https://`,linkAdd:`添加`,group:`分组`,groupHint:`把所选内容放进一个分组`,color:`颜色`,noColor:`无颜色`,colors:{1:`红色`,2:`橙色`,3:`黄色`,4:`绿色`,5:`青色`,6:`紫色`},find:`查找作品或文件`,items:`作品`,media:`媒体`,nothingFound:`没有匹配的内容`,open:`打开`,openHint:`在它自己的编辑器中打开`,openLinkHint:`在浏览器中打开网页`,delete:`删除`,label:`标签`,missing:e=>`${e} 不在项目中`,unknownType:e=>`“${e}”节点,按原样保留`,uploadFailed:e=>`无法添加文件:${e}`,edits:{add:`添加`,move:`移动`,resize:`调整大小`,type:`输入`,delete:`删除`,color:`颜色`,group:`分组`,connect:`连接`,label:`标签`}},"zh-tw":{loading:`正在開啟畫布…`,couldNotOpen:e=>`畫布無法開啟:${e}`,unreadable:e=>`此檔案不是 JSON Canvas,因此只顯示、不修改:${e}`,empty:`按兩下新增便條,或把檔案拖到這裡。`,undo:`復原`,redo:`重做`,zoom:`縮放`,zoomIn:`放大`,zoomOut:`縮小`,zoomFit:`縮放至適當大小`,zoomActual:`縮放至 100%`,zoomSelection:`縮放至所選內容`,history:`記錄`,adding:`加入畫布`,selected:`所選內容`,note:`便條`,noteHint:`新增 Markdown 便條`,file:`檔案`,fileHint:`新增專案中的作品或檔案`,link:`連結`,linkHint:`新增網頁連結`,linkPlaceholder:`https://`,linkAdd:`新增`,group:`群組`,groupHint:`把所選內容放進一個群組`,color:`顏色`,noColor:`無顏色`,colors:{1:`紅色`,2:`橙色`,3:`黃色`,4:`綠色`,5:`青色`,6:`紫色`},find:`尋找作品或檔案`,items:`作品`,media:`媒體`,nothingFound:`沒有相符的內容`,open:`開啟`,openHint:`在它自己的編輯器中開啟`,openLinkHint:`在瀏覽器中開啟網頁`,delete:`刪除`,label:`標籤`,missing:e=>`${e} 不在專案中`,unknownType:e=>`「${e}」節點,依原樣保留`,uploadFailed:e=>`無法新增檔案:${e}`,edits:{add:`新增`,move:`移動`,resize:`調整大小`,type:`輸入`,delete:`刪除`,color:`顏色`,group:`群組`,connect:`連接`,label:`標籤`}},ja:{loading:`キャンバスを開いています…`,couldNotOpen:e=>`キャンバスを開けませんでした:${e}`,unreadable:e=>`このファイルは JSON Canvas ではないため、表示のみで変更しません:${e}`,empty:`ダブルクリックでメモを追加するか、ここにファイルをドロップします。`,undo:`取り消す`,redo:`やり直す`,zoom:`ズーム`,zoomIn:`拡大`,zoomOut:`縮小`,zoomFit:`全体を表示`,zoomActual:`100% で表示`,zoomSelection:`選択範囲にズーム`,history:`履歴`,adding:`キャンバスに追加`,selected:`選択範囲`,note:`メモ`,noteHint:`Markdown のメモを追加`,file:`ファイル`,fileHint:`プロジェクトの作品やファイルを追加`,link:`リンク`,linkHint:`ページへのリンクを追加`,linkPlaceholder:`https://`,linkAdd:`追加`,group:`グループ`,groupHint:`選択したものをグループにまとめる`,color:`色`,noColor:`色なし`,colors:{1:`赤`,2:`オレンジ`,3:`黄`,4:`緑`,5:`シアン`,6:`紫`},find:`作品やファイルを検索`,items:`作品`,media:`メディア`,nothingFound:`一致するものはありません`,open:`開く`,openHint:`専用のエディタで開く`,openLinkHint:`ページをブラウザで開く`,delete:`削除`,label:`ラベル`,missing:e=>`${e} はプロジェクトにありません`,unknownType:e=>`「${e}」ノード(そのまま保持)`,uploadFailed:e=>`ファイルを追加できませんでした:${e}`,edits:{add:`追加`,move:`移動`,resize:`サイズ変更`,type:`入力`,delete:`削除`,color:`色`,group:`グループ`,connect:`接続`,label:`ラベル`}},ko:{loading:`캔버스를 여는 중…`,couldNotOpen:e=>`캔버스를 열 수 없습니다: ${e}`,unreadable:e=>`이 파일은 JSON Canvas가 아니므로 표시만 하고 변경하지 않습니다: ${e}`,empty:`두 번 클릭해 메모를 추가하거나 여기에 파일을 놓으세요.`,undo:`실행 취소`,redo:`다시 실행`,zoom:`확대/축소`,zoomIn:`확대`,zoomOut:`축소`,zoomFit:`화면에 맞추기`,zoomActual:`100%로 확대/축소`,zoomSelection:`선택 항목으로 확대/축소`,history:`기록`,adding:`캔버스에 추가`,selected:`선택 항목`,note:`메모`,noteHint:`Markdown 메모 추가`,file:`파일`,fileHint:`프로젝트의 작업물이나 파일 추가`,link:`링크`,linkHint:`페이지 링크 추가`,linkPlaceholder:`https://`,linkAdd:`추가`,group:`그룹`,groupHint:`선택한 항목을 그룹으로 묶기`,color:`색상`,noColor:`색상 없음`,colors:{1:`빨강`,2:`주황`,3:`노랑`,4:`초록`,5:`청록`,6:`보라`},find:`작업물이나 파일 찾기`,items:`작업물`,media:`미디어`,nothingFound:`일치하는 항목이 없습니다`,open:`열기`,openHint:`전용 편집기에서 열기`,openLinkHint:`브라우저에서 페이지 열기`,delete:`삭제`,label:`레이블`,missing:e=>`${e}이(가) 프로젝트에 없습니다`,unknownType:e=>`“${e}” 노드, 그대로 유지됨`,uploadFailed:e=>`파일을 추가할 수 없습니다: ${e}`,edits:{add:`추가`,move:`이동`,resize:`크기 조정`,type:`입력`,delete:`삭제`,color:`색상`,group:`그룹`,connect:`연결`,label:`레이블`}},es:{loading:`Abriendo el lienzo…`,couldNotOpen:e=>`No se pudo abrir el lienzo: ${e}`,unreadable:e=>`Este archivo no es JSON Canvas, así que se muestra y no se cambia: ${e}`,empty:`Haz doble clic para añadir una nota, o suelta aquí un archivo.`,undo:`Deshacer`,redo:`Rehacer`,zoom:`Zoom`,zoomIn:`Acercar`,zoomOut:`Alejar`,zoomFit:`Ajustar a la vista`,zoomActual:`Zoom al 100 %`,zoomSelection:`Zoom a la selección`,history:`Historial`,adding:`Añadir al lienzo`,selected:`Selección`,note:`Nota`,noteHint:`Añadir una nota en Markdown`,file:`Archivo`,fileHint:`Añadir un elemento o un archivo del proyecto`,link:`Enlace`,linkHint:`Añadir un enlace a una página`,linkPlaceholder:`https://`,linkAdd:`Añadir`,group:`Agrupar`,groupHint:`Poner la selección en un grupo`,color:`Color`,noColor:`Sin color`,colors:{1:`Rojo`,2:`Naranja`,3:`Amarillo`,4:`Verde`,5:`Cian`,6:`Morado`},find:`Buscar un elemento o un archivo`,items:`Elementos`,media:`Multimedia`,nothingFound:`No hay coincidencias`,open:`Abrir`,openHint:`Abrirlo en su propio editor`,openLinkHint:`Abrir la página en el navegador`,delete:`Eliminar`,label:`Etiqueta`,missing:e=>`${e} no está en el proyecto`,unknownType:e=>`Un nodo «${e}», conservado tal cual`,uploadFailed:e=>`No se pudo añadir el archivo: ${e}`,edits:{add:`Añadir`,move:`Mover`,resize:`Cambiar tamaño`,type:`Escritura`,delete:`Eliminar`,color:`Color`,group:`Agrupar`,connect:`Conectar`,label:`Etiqueta`}},fr:{loading:`Ouverture du canevas…`,couldNotOpen:e=>`Le canevas n’a pas pu être ouvert : ${e}`,unreadable:e=>`Ce fichier n’est pas au format JSON Canvas : il est affiché sans être modifié. ${e}`,empty:`Double-cliquez pour ajouter une note, ou déposez un fichier ici.`,undo:`Annuler`,redo:`Rétablir`,zoom:`Zoom`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,zoomFit:`Ajuster à la fenêtre`,zoomActual:`Zoom à 100 %`,zoomSelection:`Zoom sur la sélection`,history:`Historique`,adding:`Ajouter au canevas`,selected:`Sélection`,note:`Note`,noteHint:`Ajouter une note en Markdown`,file:`Fichier`,fileHint:`Ajouter un élément ou un fichier du projet`,link:`Lien`,linkHint:`Ajouter un lien vers une page`,linkPlaceholder:`https://`,linkAdd:`Ajouter`,group:`Grouper`,groupHint:`Mettre la sélection dans un groupe`,color:`Couleur`,noColor:`Sans couleur`,colors:{1:`Rouge`,2:`Orange`,3:`Jaune`,4:`Vert`,5:`Cyan`,6:`Violet`},find:`Chercher un élément ou un fichier`,items:`Éléments`,media:`Médias`,nothingFound:`Aucun résultat`,open:`Ouvrir`,openHint:`L’ouvrir dans son propre éditeur`,openLinkHint:`Ouvrir la page dans le navigateur`,delete:`Supprimer`,label:`Libellé`,missing:e=>`${e} n’est pas dans le projet`,unknownType:e=>`Un nœud « ${e} », conservé tel quel`,uploadFailed:e=>`Le fichier n’a pas pu être ajouté : ${e}`,edits:{add:`Ajout`,move:`Déplacement`,resize:`Redimensionnement`,type:`Saisie`,delete:`Suppression`,color:`Couleur`,group:`Groupe`,connect:`Liaison`,label:`Libellé`}},de:{loading:`Canvas wird geöffnet …`,couldNotOpen:e=>`Das Canvas konnte nicht geöffnet werden: ${e}`,unreadable:e=>`Diese Datei ist kein JSON Canvas und wird daher nur angezeigt, nicht geändert: ${e}`,empty:`Doppelklicken, um eine Notiz hinzuzufügen, oder eine Datei hier ablegen.`,undo:`Widerrufen`,redo:`Wiederholen`,zoom:`Zoom`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,zoomFit:`Alles zeigen`,zoomActual:`Auf 100 % zoomen`,zoomSelection:`Auf Auswahl zoomen`,history:`Verlauf`,adding:`Zum Canvas hinzufügen`,selected:`Auswahl`,note:`Notiz`,noteHint:`Eine Notiz in Markdown hinzufügen`,file:`Datei`,fileHint:`Ein Werk oder eine Datei des Projekts hinzufügen`,link:`Link`,linkHint:`Einen Link zu einer Seite hinzufügen`,linkPlaceholder:`https://`,linkAdd:`Hinzufügen`,group:`Gruppieren`,groupHint:`Die Auswahl in eine Gruppe legen`,color:`Farbe`,noColor:`Keine Farbe`,colors:{1:`Rot`,2:`Orange`,3:`Gelb`,4:`Grün`,5:`Cyan`,6:`Lila`},find:`Ein Werk oder eine Datei suchen`,items:`Werke`,media:`Medien`,nothingFound:`Keine Treffer`,open:`Öffnen`,openHint:`Im eigenen Editor öffnen`,openLinkHint:`Seite im Browser öffnen`,delete:`Löschen`,label:`Beschriftung`,missing:e=>`${e} ist nicht im Projekt`,unknownType:e=>`Ein „${e}“-Knoten, unverändert behalten`,uploadFailed:e=>`Die Datei konnte nicht hinzugefügt werden: ${e}`,edits:{add:`Hinzufügen`,move:`Verschieben`,resize:`Größe ändern`,type:`Eingabe`,delete:`Löschen`,color:`Farbe`,group:`Gruppieren`,connect:`Verbinden`,label:`Beschriftung`}},pt:{loading:`Abrindo a tela…`,couldNotOpen:e=>`Não foi possível abrir a tela: ${e}`,unreadable:e=>`Este arquivo não é JSON Canvas, por isso é mostrado e não alterado: ${e}`,empty:`Clique duas vezes para adicionar uma nota, ou solte um arquivo aqui.`,undo:`Desfazer`,redo:`Refazer`,zoom:`Zoom`,zoomIn:`Ampliar`,zoomOut:`Reduzir`,zoomFit:`Ajustar à tela`,zoomActual:`Zoom em 100%`,zoomSelection:`Zoom na seleção`,history:`Histórico`,adding:`Adicionar à tela`,selected:`Seleção`,note:`Nota`,noteHint:`Adicionar uma nota em Markdown`,file:`Arquivo`,fileHint:`Adicionar um item ou um arquivo do projeto`,link:`Link`,linkHint:`Adicionar um link para uma página`,linkPlaceholder:`https://`,linkAdd:`Adicionar`,group:`Agrupar`,groupHint:`Colocar a seleção em um grupo`,color:`Cor`,noColor:`Sem cor`,colors:{1:`Vermelho`,2:`Laranja`,3:`Amarelo`,4:`Verde`,5:`Ciano`,6:`Roxo`},find:`Procurar um item ou um arquivo`,items:`Itens`,media:`Mídia`,nothingFound:`Nada corresponde`,open:`Abrir`,openHint:`Abrir no seu próprio editor`,openLinkHint:`Abrir a página no navegador`,delete:`Excluir`,label:`Rótulo`,missing:e=>`${e} não está no projeto`,unknownType:e=>`Um nó “${e}”, mantido como está`,uploadFailed:e=>`Não foi possível adicionar o arquivo: ${e}`,edits:{add:`Adicionar`,move:`Mover`,resize:`Redimensionar`,type:`Digitação`,delete:`Excluir`,color:`Cor`,group:`Agrupar`,connect:`Conectar`,label:`Rótulo`}}});function Wa(){return Ua.of(s()?.locale)}var Ga={1:`#cf5f5a`,2:`#d98a45`,3:`#c9a63a`,4:`#579f67`,5:`#459fb2`,6:`#8f78bd`},Ka=e=>e===void 0?void 0:Ga[e]??(/^#[0-9a-f]{3,8}$/iu.test(e)?e:void 0);function qa({target:e,className:t}){return e.type===`item`?(0,J.jsx)(Oe,{name:e.item.kindInfo?.icon,className:t}):e.type===`media`?e.mime.startsWith(`audio/`)?(0,J.jsx)(fe,{className:t,"aria-hidden":!0}):(0,J.jsx)(E,{className:t,"aria-hidden":!0}):(0,J.jsx)(T,{className:t,"aria-hidden":!0})}var Ja=e=>e.slice(e.lastIndexOf(`/`)+1);function Ya(e){return e.type===`item`?e.item.title??Ja(e.item.id):Ja(e.path)}function Xa({text:e}){return(0,J.jsx)(`div`,{className:`text-ink size-full overflow-hidden px-4 py-3 text-base leading-relaxed [&_a]:text-pencil-text [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_code]:font-mono [&_code]:text-sm [&_h1]:mb-2 [&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:mb-2 [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:mb-1 [&_h3]:font-semibold [&_li]:mb-0.5 [&_ol]:mb-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:mb-2 [&_strong]:font-semibold [&_ul]:mb-2 [&_ul]:list-disc [&_ul]:pl-5`,"data-testid":`canvas-text`,children:(0,J.jsx)(Ii,{remarkPlugins:[Pa],children:e})})}function Za({preview:e}){switch(e.type){case`picture`:return(0,J.jsx)(`img`,{src:`data:${e.image.mime};base64,${e.image.data}`,alt:``,draggable:!1,className:`pointer-events-none size-full object-contain select-none`,"data-testid":`canvas-preview-picture`});case`text`:return(0,J.jsx)(`div`,{className:`text-ink size-full overflow-hidden px-5 py-4 text-base leading-relaxed`,"data-testid":`canvas-preview-text`,children:e.lines.map((e,t)=>(0,J.jsx)(`p`,{className:t===0?`mb-2 font-semibold`:`mb-1`,children:e},t))});case`table`:return(0,J.jsx)(`div`,{className:`size-full overflow-hidden p-2 text-xs`,"data-testid":`canvas-preview-table`,children:(0,J.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsx)(`tr`,{children:e.columns.map((e,t)=>(0,J.jsx)(`th`,{className:`border-rule truncate border px-1 text-left font-semibold`,children:e},t))})}),(0,J.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,J.jsx)(`tr`,{children:e.map((e,t)=>(0,J.jsx)(`td`,{className:`border-rule truncate border px-1`,children:e},t))},t))})]})})}}function Qa({icon:e,words:t,className:n}){return(0,J.jsxs)(`div`,{className:d(`text-lead flex size-full flex-col items-center justify-center gap-2 p-3 text-center text-xs [&_svg]:size-6`,n),children:[e,(0,J.jsx)(`span`,{className:`max-w-full truncate`,children:t})]})}function $a({target:e,project:t}){let n=Ra(o(),e.item.id,t?.revision);return n===void 0||n===`none`?(0,J.jsx)(Qa,{icon:(0,J.jsx)(qa,{target:e}),words:e.item.id}):(0,J.jsxs)(`div`,{className:`relative size-full`,children:[(0,J.jsx)(Za,{preview:n}),n.type===`picture`&&n.duration!==void 0?(0,J.jsx)(`span`,{className:`bg-ink/70 text-paper absolute right-2 bottom-2 rounded-xs px-1 text-xs tabular-nums`,children:`${String(Math.floor(n.duration/60))}:${String(Math.round(n.duration%60)).padStart(2,`0`)}`}):null]})}function eo({target:e,active:t}){let n=Ba(o(),e.path),r=a(e.mime),i=(0,J.jsx)(Qa,{icon:(0,J.jsx)(qa,{target:e}),words:e.path});return!r||n===void 0?i:(0,J.jsx)(Y.Suspense,{fallback:i,children:(0,J.jsx)(r,{url:n,path:e.path,type:e.mime,active:t})})}function to({node:e,project:t,active:n}){let r=Wa(),i=o(),a=e.file??``,s=Ia(t,a),c=Ha(i,s.type===`item`?void 0:s.path);return s.type===`item`?(0,J.jsx)($a,{target:s,project:t}):c===!1||a===``?(0,J.jsx)(Qa,{icon:(0,J.jsx)(x,{"aria-hidden":!0}),words:r.missing(a),className:`text-problem-text`}):s.type===`media`?(0,J.jsx)(eo,{target:s,active:n}):(0,J.jsx)(Qa,{icon:(0,J.jsx)(T,{"aria-hidden":!0}),words:a})}function no({node:e,project:t}){let n=s()?.locale??`en`,r=Ia(t,e.file??``),i=r.type===`item`&&r.item.kindInfo?m(r.item.kindInfo,n):void 0;return(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,title:e.file,children:[(0,J.jsx)(qa,{target:r,className:`size-3.5 flex-none`}),(0,J.jsx)(`span`,{className:`truncate`,children:Ya(r)}),i===void 0?null:(0,J.jsx)(`span`,{className:`text-lead-soft flex-none`,children:i})]})}function ro({url:e}){let t=e,n=``;try{let r=new URL(e);t=r.host,n=`${r.pathname===`/`?``:r.pathname}${r.search}`}catch{}return(0,J.jsxs)(`div`,{className:`flex size-full flex-col justify-center gap-1 overflow-hidden px-4 py-3`,"data-testid":`canvas-link`,children:[(0,J.jsxs)(`span`,{className:`text-ink flex min-w-0 items-center gap-2 font-semibold`,children:[(0,J.jsx)(De,{className:`text-lead size-4 flex-none`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:t})]}),n===``?null:(0,J.jsx)(`span`,{className:`text-lead truncate text-xs`,children:n})]})}function io({type:e}){let t=Wa();return(0,J.jsx)(Qa,{icon:(0,J.jsx)(T,{"aria-hidden":!0}),words:t.unknownType(e)})}var ao=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`)?`⌘`:`Ctrl+`,Q=(e,t)=>t===void 0?e:`${e} (${t})`,oo=`application/x-allyhub-canvas-note`,so=`bg-sheet border-rule shadow-overlay pointer-events-auto flex items-center gap-0.5 rounded-lg border p-1`,co=/\.(?:png|jpe?g|webp|avif|gif|svg|mp4|webm|mov|mp3|wav|m4a|ogg|aac|flac)$/iu;async function lo(e,t,n=3){let r=await e(t).catch(()=>({files:[],dirs:[]})),i=r.files.map(e=>e.path).filter(e=>co.test(e));if(n===0)return i;let a=await Promise.all(r.dirs.filter(e=>!e.split(`/`).some(e=>e.startsWith(`.`)||e===`node_modules`)).map(t=>lo(e,t,n-1)));return[...i,...a.flat()]}function uo(e){let t=Wa(),n=o(),r=s()?.locale??`en`,[i,a]=(0,Y.useState)(``),[c,l]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{let e=!0;return lo(e=>n[`files/list`]({dir:e}),``).then(t=>{e&&l([...new Set(t)].sort())}),()=>{e=!1}},[n]);let u=i.trim().toLowerCase(),d=(0,Y.useMemo)(()=>(e.project?.items??[]).filter(t=>t.entry!==e.self&&(u===``||t.id.toLowerCase().includes(u)||(t.title??``).toLowerCase().includes(u))),[e.project,e.self,u]),f=c.filter(e=>u===``||e.toLowerCase().includes(u));return(0,J.jsxs)(`div`,{className:`flex w-80 flex-col gap-2`,"data-testid":`canvas-picker`,children:[(0,J.jsx)(w,{autoFocus:!0,value:i,placeholder:t.find,"aria-label":t.find,onChange:e=>{a(e.target.value)}}),(0,J.jsxs)(`div`,{className:`flex h-80 flex-col overflow-y-auto`,children:[d.length>0&&(0,J.jsx)(`p`,{className:`text-lead px-2 pt-1 text-xs font-semibold`,children:t.items}),d.map(t=>(0,J.jsx)(D,{size:`dense`,"data-testid":`canvas-pick`,"data-path":t.entry,onClick:()=>{e.onPick(t.entry)},meta:t.kindInfo?(0,J.jsx)(`span`,{className:`text-lead-soft text-xs`,children:m(t.kindInfo,r)}):void 0,children:t.title??t.id},t.id)),f.length>0&&(0,J.jsx)(`p`,{className:`text-lead px-2 pt-2 text-xs font-semibold`,children:t.media}),f.map(t=>(0,J.jsx)(D,{size:`dense`,"data-testid":`canvas-pick`,"data-path":t,onClick:()=>{e.onPick(t)},children:t},t)),d.length===0&&f.length===0&&(0,J.jsx)(`p`,{className:`text-lead px-2 py-1 text-xs`,children:t.nothingFound})]})]})}function fo(e){let t=Wa(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),c=()=>{let t=o.trim();t!==``&&(a(!1),s(``),e.onLink(/^[a-z][a-z0-9+.-]*:/iu.test(t)?t:`https://${t}`))};return(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":t.adding,"data-testid":`canvas-add-bar`,className:d(so,`absolute bottom-3 left-1/2 -translate-x-1/2`),children:[(0,J.jsx)(_,{icon:!0,draggable:!0,"aria-label":t.note,title:t.noteHint,"data-testid":`canvas-add-note`,onClick:e.onNote,onDragStart:e=>{e.dataTransfer.setData(oo,`text`),e.dataTransfer.effectAllowed=`copy`},children:(0,J.jsx)(S,{})}),(0,J.jsxs)(y,{open:n,onOpenChange:r,children:[(0,J.jsx)(de,{asChild:!0,children:(0,J.jsx)(_,{icon:!0,"aria-label":t.file,title:t.fileHint,"data-testid":`canvas-add-file`,children:(0,J.jsx)(it,{})})}),(0,J.jsx)(v,{side:`top`,align:`center`,className:`w-auto p-2`,children:(0,J.jsx)(uo,{project:e.project,self:e.self,onPick:t=>{r(!1),e.onFile(t)}})})]}),(0,J.jsxs)(y,{open:i,onOpenChange:a,children:[(0,J.jsx)(de,{asChild:!0,children:(0,J.jsx)(_,{icon:!0,"aria-label":t.link,title:t.linkHint,"data-testid":`canvas-add-link`,children:(0,J.jsx)(ge,{})})}),(0,J.jsxs)(v,{side:`top`,align:`center`,className:`flex w-80 gap-2 p-2`,children:[(0,J.jsx)(w,{autoFocus:!0,value:o,placeholder:t.linkPlaceholder,"aria-label":t.link,"data-testid":`canvas-link-url`,onChange:e=>{s(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&c()}}),(0,J.jsx)(_,{"data-testid":`canvas-link-add`,disabled:o.trim()===``,onClick:c,children:t.linkAdd})]})]}),(0,J.jsx)(_,{icon:!0,"aria-label":t.group,title:Q(t.groupHint,`${ao}G`),disabled:!e.groupable,"data-testid":`canvas-group`,onClick:e.onGroup,children:(0,J.jsx)(pe,{})})]})}function po(e){let t=Wa();return(0,J.jsxs)(`div`,{className:d(so,`absolute top-3 right-3 flex-col`),"data-testid":`canvas-view-controls`,children:[(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":t.zoom,"aria-orientation":`vertical`,className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomIn,title:Q(t.zoomIn,`${ao}+`),"data-testid":`canvas-zoom-in`,onClick:()=>{e.onZoom(`in`)},children:(0,J.jsx)(ke,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomOut,title:Q(t.zoomOut,`${ao}−`),"data-testid":`canvas-zoom-out`,onClick:()=>{e.onZoom(`out`)},children:(0,J.jsx)(xe,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomFit,title:Q(t.zoomFit,`⇧1`),"data-testid":`canvas-zoom-fit`,onClick:()=>{e.onZoom(`fit`)},children:(0,J.jsx)(rt,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomActual,title:Q(t.zoomActual,`⇧0`),"data-testid":`canvas-zoom-actual`,className:`text-[11px] tabular-nums`,onClick:()=>{e.onZoom(`actual`)},children:`1:1`})]}),e.history?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`bg-rule my-0.5 h-px w-5`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{role:`toolbar`,"aria-label":t.history,"aria-orientation":`vertical`,className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(_,{icon:!0,"aria-label":t.undo,title:Q(t.undo,`${ao}Z`),"data-testid":`canvas-undo`,disabled:!e.history.canUndo,onClick:e.history.onUndo,children:(0,J.jsx)(Ce,{})}),(0,J.jsx)(_,{icon:!0,"aria-label":t.redo,title:Q(t.redo,`⇧${ao}Z`),"data-testid":`canvas-redo`,disabled:!e.history.canRedo,onClick:e.history.onRedo,children:(0,J.jsx)(Se,{})})]})]}):null]})}var mo=8,ho=20,go=8;function _o(e){let t=Wa(),n=e.markUp,r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)({width:0,height:0});(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{a({width:e.offsetWidth,height:e.offsetHeight})};t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[]);let o=e.box.left+e.box.width/2,s=Math.min(Math.max(go,o-i.width/2),Math.max(go,e.view.width-go-i.width)),c=e.box.top-Math.max(e.above,ho)-mo-i.height,l=e.box.top+e.box.height+mo,u=c>=go?c:l+i.height<=e.view.height-go?l:go,f=e.color===void 0?void 0:Ga[e.color];return(0,J.jsxs)(`div`,{ref:r,role:`toolbar`,"aria-label":t.selected,"data-testid":`canvas-selection-bar`,"data-note-chrome":``,className:d(so,`absolute`),style:{left:s,top:u,...i.width===0?{opacity:0,pointerEvents:`none`}:{}},children:[e.onColor?(0,J.jsxs)(y,{children:[(0,J.jsx)(de,{asChild:!0,children:(0,J.jsx)(_,{icon:!0,"aria-label":t.color,title:t.color,"data-testid":`canvas-color`,children:(0,J.jsx)(me,{style:f?{color:f}:void 0})})}),(0,J.jsxs)(v,{side:`top`,align:`center`,className:`flex w-auto items-center gap-2 p-2`,role:`radiogroup`,"aria-label":t.color,children:[(0,J.jsx)(Ee,{color:`linear-gradient(135deg, transparent 45%, var(--color-lead) 45%, var(--color-lead) 55%, transparent 55%)`,label:t.noColor,checked:e.color===void 0,"data-testid":`canvas-color-none`,onClick:()=>{e.onColor?.(void 0)}}),at.map(n=>(0,J.jsx)(Ee,{color:Ga[n]??``,label:t.colors[n],checked:e.color===n,"data-testid":`canvas-color-${n}`,onClick:()=>{e.onColor?.(n)}},n))]})]}):null,e.onDelete?(0,J.jsx)(_,{icon:!0,"aria-label":t.delete,title:Q(t.delete,`⌫`),"data-testid":`canvas-delete`,onClick:e.onDelete,children:(0,J.jsx)(Te,{})}):null,e.open?(0,J.jsx)(_,{icon:!0,"aria-label":t.open,title:e.open.link?t.openLinkHint:t.openHint,"data-testid":`canvas-open`,onClick:e.open.run,children:(0,J.jsx)(we,{})}):null,(0,J.jsx)(_,{icon:!0,"aria-label":t.zoomSelection,title:Q(t.zoomSelection,`⇧2`),"data-testid":`canvas-zoom-selection`,onClick:e.onZoomTo,children:(0,J.jsx)(nt,{})}),n?(0,J.jsxs)(_,{title:n.hint,"data-testid":`mark-up-selected`,className:`text-ink`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();n.begin({x:t.x,y:t.y,width:t.width,height:t.height},!0)},children:[(0,J.jsx)(oe,{"aria-hidden":!0}),n.label]}):null]})}function vo(e,t){let n=e.split(`
|
|
16
|
+
`)[t-1]?.trim().replace(/,$/u,``);if(n?.startsWith(`{`)===!0)try{let e=JSON.parse(n);return typeof e.fromNode==`string`?e.fromNode:typeof e.id==`string`?e.id:void 0}catch{return}}function yo(e){let t=e.nodes.find(e=>e.after!==void 0)??e.nodes[0];if(t)return t.id;let n=e.edges[0],r=n?.after??n?.before;return typeof r?.fromNode==`string`?r.fromNode:void 0}var bo=class e{path;session;canvas;unreadable;revision=0;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e,t){this.path=e,this.session=t;let n=dt(t.text);this.canvas=n.readable?n.canvas:P,this.unreadable=n.readable?void 0:n.problems.map(e=>e.message).join(` `),this.snapshot=this.make(),t.attach({save:e=>{if(this.unreadable!==void 0)return;let t=mt(this.canvas);return t===e?void 0:t},take:(e,t,n)=>{let r=dt(e);if(!r.readable)this.canvas=P,this.unreadable=r.problems.map(e=>e.message).join(` `);else{let e=dt(t),i=n?.kind===`agent`&&e.readable?yo(xt(e.canvas,r.canvas)):void 0;i!==void 0&&(this.landed={id:i,at:Date.now()}),this.canvas=this.unreadable!==void 0||!e.readable?r.canvas:yt(e.canvas,this.canvas,r.canvas),this.unreadable=void 0}this.emit()}}),this.stops.push(t.onState(()=>{this.emit()}),t.onUndo(()=>{this.emit()}))}static async open(t,n){return new e(n,await h.open(t,n))}make(){return{canvas:this.canvas,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,revision:this.revision,landed:this.landed}}emit(){this.revision+=1,this.snapshot=this.make();for(let e of this.listeners)e()}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get text(){return this.session.text}edit(e,t,n){if(this.unreadable!==void 0)return;let r=this.canvas,i=t(r);if(i===r)return;if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){this.session.undo(),this.canvas=i,this.push(this.amending.label,xt(this.amending.from,i));return}let a=xt(r,i);St(a)||(this.canvas=i,this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,a))}settle(){this.amending=void 0}push(e,t){this.session.pushEdit({label:e,undo:()=>{this.canvas=bt(this.canvas,t,`before`),this.emit()},redo:()=>{this.canvas=bt(this.canvas,t,`after`),this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}flush(){return this.session.flush()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},xo=.1,So=e=>Math.min(4,Math.max(xo,e)),Co=(e,t)=>({x:(t.x-e.x)*e.zoom,y:(t.y-e.y)*e.zoom}),wo=(e,t)=>({x:t.x/e.zoom+e.x,y:t.y/e.zoom+e.y});function To(e,t,n){let r=So(n),i=wo(e,t);return{x:i.x-t.x/r,y:i.y-t.y/r,zoom:r}}var $=e=>({left:e.x,top:e.y,width:e.width,height:e.height});function Eo(e,t,n=48){if(e.length===0||t.width<=0||t.height<=0)return{x:-t.width/2,y:-t.height/2,zoom:1};let r=Math.min(...e.map(e=>e.left)),i=Math.min(...e.map(e=>e.top)),a=Math.max(...e.map(e=>e.left+e.width)),o=Math.max(...e.map(e=>e.top+e.height)),s=So(Math.min((t.width-2*n)/Math.max(1,a-r),(t.height-2*n)/Math.max(1,o-i),1));return{x:(r+a)/2-t.width/2/s,y:(i+o)/2-t.height/2/s,zoom:s}}function Do(e,t){switch(t){case`top`:return{x:e.left+e.width/2,y:e.top};case`bottom`:return{x:e.left+e.width/2,y:e.top+e.height};case`left`:return{x:e.left,y:e.top+e.height/2};case`right`:return{x:e.left+e.width,y:e.top+e.height/2}}}function Oo(e,t){let n=[[`top`,Math.abs(t.y-e.top)],[`bottom`,Math.abs(t.y-(e.top+e.height))],[`left`,Math.abs(t.x-e.left)],[`right`,Math.abs(t.x-(e.left+e.width))]];return n.sort((e,t)=>e[1]-t[1]),n[0]?.[0]??`right`}function ko(e,t){let n=t.left+t.width/2-(e.left+e.width/2),r=t.top+t.height/2-(e.top+e.height/2);return Math.abs(n)*e.height>=Math.abs(r)*e.width?n>=0?`right`:`left`:r>=0?`bottom`:`top`}var Ao={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}};function jo(e,t,n,r){let i=Math.max(40,Math.hypot(n.x-e.x,n.y-e.y)/3),a=Ao[t],o={x:e.x+a.x*i,y:e.y+a.y*i},s=r?Ao[r]:{x:0,y:0},c={x:n.x+s.x*i,y:n.y+s.y*i},l=t=>{let r=1-t;return{x:r*r*r*e.x+3*r*r*t*o.x+3*r*t*t*c.x+t*t*t*n.x,y:r*r*r*e.y+3*r*r*t*o.y+3*r*t*t*c.y+t*t*t*n.y}},u=e=>String(Math.round(e*10)/10),d=r?{x:-s.x,y:-s.y}:(()=>{let e=l(.95),t=Math.hypot(n.x-e.x,n.y-e.y)||1;return{x:(n.x-e.x)/t,y:(n.y-e.y)/t}})();return{d:`M ${u(e.x)} ${u(e.y)} C ${u(o.x)} ${u(o.y)} ${u(c.x)} ${u(c.y)} ${u(n.x)} ${u(n.y)}`,mid:l(.5),end:n,endDir:d}}function Mo(e,t,n){let r={x:e.x-t.x*n,y:e.y-t.y*n},i={x:-t.y*n*.5,y:t.x*n*.5};return[e,{x:r.x+i.x,y:r.y+i.y},{x:r.x-i.x,y:r.y-i.y}].map(e=>`${String(e.x)},${String(e.y)}`).join(` `)}function No(e,t){let n=e.filter(e=>t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height);return[...n].reverse().find(e=>e.type!==`group`)??n.at(-1)}function Po(e,t,n,r=48){let i=r/t.zoom,a=(e,n,r,a)=>{let o=a/t.zoom;return n+2*i>o||e-i<r?e-i:e+n+i>r+o?e+n+i-o:r},o=a(e.left,e.width,t.x,n.width),s=a(e.top,e.height,t.y,n.height);return o===t.x&&s===t.y?void 0:{...t,x:o,y:s}}function Fo(e,t,n,r,i){let a=e=>({x:n.x+(e.x-t.x)*t.zoom,y:n.y+(e.y-t.y)*t.zoom,width:e.width*t.zoom,height:e.height*t.zoom});return[...e].reverse().filter(e=>f(r,a(e))).map(e=>Io(e,i))}function Io(e,t){let n=Ct(t.text,e.id),r={path:t.file,...n===void 0?{}:{line:n}};switch(e.type){case`text`:return{name:`the note ${e.id} on the canvas`,source:r,...e.text===void 0?{}:{text:e.text}};case`file`:{let n=Ia(t.project,e.file??``),i=n.type===`item`?`the ${n.item.kindInfo?.noun??n.item.kind??`item`} ${n.item.id} (${n.item.entry})`:`the file ${n.path}`;return{name:`node ${e.id}, showing ${i}`,source:r}}case`link`:return{name:`node ${e.id}, a link to ${e.url??``}`,source:r};case`group`:return{name:`the group ${e.label===void 0?e.id:`"${e.label}"`}`,source:r};default:return{name:`node ${e.id}, of type ${e.type}`,source:r}}}function Lo(e,t,n,r){return{element:Io(e,r),outline:l({x:n.x+(e.x-t.x)*t.zoom,y:n.y+(e.y-t.y)*t.zoom,width:e.width*t.zoom,height:e.height*t.zoom})}}function Ro(e,t,n,r){let i=wo(t,{x:r.x-n.x,y:r.y-n.y}),a=[...e].reverse().find(e=>i.x>=e.x&&i.x<=e.x+e.width&&i.y>=e.y&&i.y<=e.y+e.height);return a?`on the canvas, over node ${a.id}`:`on the canvas at ${String(Math.round(i.x))}, ${String(Math.round(i.y))}`}var zo=3e4,Bo=3,Vo=6,Ho=40,Uo=24,Wo=6,Go=14,Ko=10;function qo(e,t){let n=1/Math.max(t,.5);if(e.type===`file`)return Math.max(16*n,14);if(e.type===`group`)return 20*n+4}var Jo={text:{width:260,height:140},file:{width:480,height:300},link:{width:320,height:96}},Yo=24,Xo=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`),Zo=Xo?`⌘G`:`Ctrl+G`,Qo=e=>typeof e==`object`&&!!e&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.zoom==`number`&&e.zoom>0,$o={nodes:new Set,edges:new Set},es=(e,t,n)=>({...e,nodes:e.nodes.map(e=>typeof e.id==`string`&&t.has(e.id)?n(e):e)}),ts=(e,t,n)=>({...e,edges:e.edges.map(e=>typeof e.id==`string`&&t.has(e.id)?n(e):e)}),ns=e=>{let t=``,n=new Uint8Array(e);for(let e=0;e<n.length;e+=32768)t+=String.fromCharCode(...n.subarray(e,e+32768));return btoa(t)};function rs({doc:e,path:t}){let n=Wa(),a=o(),c=s(),l=Fa(),f=(0,Y.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),p=c?.mode!==`edit`||f.unreadable!==void 0,m=(0,Y.useMemo)(()=>ft(f.canvas),[f.canvas]),h=(0,Y.useMemo)(()=>pt(f.canvas),[f.canvas]),g=(0,Y.useMemo)(()=>new Map(m.map(e=>[e.id,e])),[m]),_=(0,Y.useRef)(null),[v,oe]=(0,Y.useState)({width:0,height:0}),de=Qo(c?.place)?c.place:void 0,[y,b]=(0,Y.useState)(de),fe=(0,Y.useMemo)(()=>v.width===0?{x:0,y:0,zoom:1}:Eo(m.map($),v),[m,v]),x=y??fe,pe=(0,Y.useRef)(x);(0,Y.useEffect)(()=>{pe.current=x});let{agent:me,following:he}=r(),ge=ee(),_e=(()=>{if(me?.doing===void 0)return;let n=f.landed,r=n&&n.at>=me.at-zo,i=me.source?.path===t;if(r&&i)return n.id;let a=i?me.source?.from:void 0,o=a===void 0?void 0:vo(e.text,a);return o!==void 0&&g.has(o)?o:r?n.id:void 0})(),ve=_e===void 0?void 0:g.get(_e),ye=he?ve:void 0,[be,xe]=(0,Y.useState)();if(ye?.id!==be&&(xe(ye?.id),ye&&v.width>0)){let e=Po($(ye),x,v);e&&b(e)}let Se=()=>{y===void 0&&b(x)},[Ce,we]=(0,Y.useState)($o),S=(0,Y.useMemo)(()=>{let e=[...Ce.nodes].filter(e=>g.has(e)),t=[...Ce.edges].filter(e=>h.some(t=>t.id===e));return e.length===Ce.nodes.size&&t.length===Ce.edges.size?Ce:{nodes:new Set(e),edges:new Set(t)}},[Ce,g,h]),[Te,Ee]=(0,Y.useState)(),[C,De]=(0,Y.useState)({}),Oe=(0,Y.useRef)({}),ke=e=>{Oe.current=e,De(e)},[w,T]=(0,Y.useState)(),E=(0,Y.useRef)(void 0),[D,Le]=(0,Y.useState)(),O=(0,Y.useRef)(!1);(0,Y.useLayoutEffect)(()=>{let e=_.current;if(!e)return;let t=new ResizeObserver(()=>{oe({width:e.clientWidth,height:e.clientHeight})});return t.observe(e),()=>{t.disconnect()}},[]),(0,Y.useEffect)(()=>{if(y===void 0)return;let e=setTimeout(()=>{a[`editor/place`]({place:{x:Math.round(y.x),y:Math.round(y.y),zoom:Math.round(y.zoom*1e3)/1e3}}).catch(()=>void 0)},400);return()=>{clearTimeout(e)}},[a,y]);let k=()=>{let e=_.current?.getBoundingClientRect();return{x:e?.left??0,y:e?.top??0}},Re=e=>{let t=k();return wo(x,{x:e.clientX-t.x,y:e.clientY-t.y})},ze=()=>wo(x,{x:v.width/2,y:v.height/2});(0,Y.useEffect)(()=>{let e=_.current;if(!e)return;let t=t=>{if(t.target?.closest(`[data-canvas-scrolls]`))return;t.preventDefault();let n=e.getBoundingClientRect(),r={x:t.clientX-n.left,y:t.clientY-n.top};b(e=>{let n=e??pe.current;if(t.ctrlKey||t.metaKey)return To(n,r,n.zoom*Math.exp(-t.deltaY*.01));let i=t.shiftKey&&t.deltaX===0?t.deltaY:t.deltaX,a=t.shiftKey&&t.deltaX===0?0:t.deltaY;return{...n,x:n.x+i/n.zoom,y:n.y+a/n.zoom}})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[]);let A=(0,Y.useCallback)(e=>{if(e===`fit`||typeof e!=`string`){let t=e===`fit`?m.map($):e;t.length>0&&b(Eo(t,v))}else b(t=>{let n=t??pe.current,r=e===`actual`?1:e===`in`?n.zoom*1.25:n.zoom/1.25;return To(n,{x:v.width/2,y:v.height/2},So(r))})},[m,v]),Be=e=>{let t=new Map;for(let n of e){let e=g.get(n);if(e&&(t.set(n,$(e)),e.type===`group`))for(let n of m)n.id!==e.id&&n.x>=e.x&&n.y>=e.y&&n.x+n.width<=e.x+e.width&&n.y+n.height<=e.y+e.height&&t.set(n.id,$(n))}return t},j=e=>{we(e)},Ve=(e,t,n,r)=>{let i={left:e.x-t/2,top:e.y-n/2,width:t,height:n};if(!r)return i;let a=e=>m.filter(t=>t.type!==`group`&&t.x<e.left+e.width&&t.x+t.width>e.left&&t.y<e.top+e.height&&t.y+t.height>e.top);for(let e=0;e<50;e++){let e=a(i);if(e.length===0)break;i={...i,left:Math.max(...e.map(e=>e.x+e.width))+Uo}}let o=(i.left+i.width-x.x)*x.zoom,s=(i.top+i.height-x.y)*x.zoom;return(o>v.width||s>v.height||i.left<x.x||i.top<x.y)&&b({...x,x:i.left+i.width/2-v.width/2/x.zoom,y:i.top+i.height/2-v.height/2/x.zoom}),i},He=(t,r,i=!1)=>{Se();let a=ht(f.canvas),o=typeof t.width==`number`?t.width:260,s=typeof t.height==`number`?t.height:140,c=Ve(r??ze(),o,s,r===void 0),l={id:a,...t,x:R(c.left),y:R(c.top),width:R(o),height:R(s)},u={id:a,type:l.type,...Object.fromEntries(Object.entries(l).filter(([e])=>![`id`,`type`,`x`,`y`,`width`,`height`].includes(e))),x:l.x,y:l.y,width:l.width,height:l.height};return e.edit(n.edits.add,e=>({...e,nodes:[...e.nodes,u]})),j({nodes:new Set([a]),edges:new Set}),i&&t.type===`text`&&T({type:`text`,id:a,text:``}),a},Ue=e=>He({type:`text`,text:``,...Jo.text},e,!0),We=(e,t)=>He({type:`file`,file:e,...Jo.file},t),Ge=(e,t)=>He({type:`link`,url:e,...Jo.link},t),Ke=()=>{if(S.nodes.size===0&&S.edges.size===0)return;let t=S.nodes;e.edit(n.edits.delete,e=>({...e,nodes:e.nodes.filter(e=>!(typeof e.id==`string`&&t.has(e.id))),edges:e.edges.filter(e=>!(typeof e.id==`string`&&S.edges.has(e.id))&&!t.has(String(e.fromNode))&&!t.has(String(e.toNode)))})),j($o)},qe=()=>{let t=m.filter(e=>S.nodes.has(e.id));if(t.length===0)return;let r=je(t.map($)),i=ht(f.canvas),a=t.some(e=>e.type===`file`)?48:Uo,o={id:i,type:`group`,x:R(r.left-Uo),y:R(r.top-a),width:R(r.width+48),height:R(r.height+Uo+a)};e.edit(n.edits.group,e=>{let t=e.nodes.findIndex(e=>typeof e.id==`string`&&S.nodes.has(e.id)),n=[...e.nodes];return n.splice(t<0?0:t,0,o),{...e,nodes:n}}),j({nodes:new Set([i]),edges:new Set}),T({type:`group`,id:i,text:``})},Je=t=>{e.edit(n.edits.color,e=>ts(es(e,S.nodes,e=>z(e,{color:t})),S.edges,e=>z(e,{color:t})))},Ye=()=>{let e=[...m.filter(e=>S.nodes.has(e.id)).map(e=>e.color),...h.filter(e=>S.edges.has(e.id)).map(e=>e.color)],t=e[0];return e.length>0&&e.every(e=>e===t)?t:void 0},Xe=()=>[...m.filter(e=>S.nodes.has(e.id)).map(N),...h.filter(e=>S.edges.has(e.id)).flatMap(e=>{let t=ct(e);return t?[Pe(t.start,t.end)]:[]})],M=(t=w)=>{if(!t)return;T(void 0);let r=t.text;t.type===`edge`?e.edit(n.edits.label,e=>ts(e,new Set([t.id]),e=>z(e,{label:r.trim()===``?void 0:r}))):t.type===`group`?e.edit(n.edits.label,e=>es(e,new Set([t.id]),e=>z(e,{label:r.trim()===``?void 0:r}))):e.edit(n.edits.type,e=>es(e,new Set([t.id]),e=>z(e,{text:r}))),_.current?.focus()},Ze=e=>{e.type===`file`&&e.file?a[`items/open`]({target:{type:`file`,path:e.file}}).catch(()=>void 0):e.type===`link`&&e.url&&/^https?:\/\//u.test(e.url)&&a[`items/open`]({target:{type:`browser`,url:e.url}}).catch(()=>void 0)},Qe=e=>{Se(),w&&M();let t=e.target;if(t.closest(`[data-canvas-own]`))return;_.current?.focus();let n=Re(e);if(e.button===1||e.button===0&&O.current){E.current={type:`pan`,start:{x:e.clientX,y:e.clientY},camera:x},Le(`pan`),e.currentTarget.setPointerCapture(e.pointerId);return}if(e.button!==0)return;let r=t.closest(`[data-handle]`)?.dataset.handle,i=t.closest(`[data-connector]`),a=t.closest(`[data-edge]`),o=t.closest(`[data-node]`);if(!(p&&(r||i))){if(r){let e=[...S.nodes][0],t=e===void 0?void 0:g.get(e);if(!t)return;E.current={type:`resize`,id:t.id,handle:r,start:n,frame:$(t)}}else if(i){let e=i.dataset.connector??``,t=i.dataset.side??`right`;E.current={type:`connect`,from:e,side:t,start:n},ke({connect:{from:e,side:t,to:n}})}else if(a){let t=a.dataset.edge??``,n=e.shiftKey||e.metaKey;j(n?{nodes:S.nodes,edges:new Set(S.edges.has(t)?[...S.edges].filter(e=>e!==t):[...S.edges,t])}:{nodes:new Set,edges:new Set([t])});return}else if(o){let t=o.dataset.node??``,r=e.shiftKey||e.metaKey,i=S;if(r?i={nodes:new Set(S.nodes.has(t)?[...S.nodes].filter(e=>e!==t):[...S.nodes,t]),edges:S.edges}:S.nodes.has(t)||(i={nodes:new Set([t]),edges:new Set}),j(i),p)return;E.current={type:`move`,start:n,frames:Be(i.nodes),dragged:!1}}else E.current={type:`marquee`,start:n,add:e.shiftKey},e.shiftKey||j($o);Le(E.current.type),e.currentTarget.setPointerCapture(e.pointerId)}},$e=e=>{let t=E.current;if(!t){let t=e.target,n=Re(e),r=24/x.zoom,i=t.closest(`[data-connector]`)?.dataset.connector??[...m].reverse().find(e=>e.type!==`group`&&n.x>=e.x-r&&n.x<=e.x+e.width+r&&n.y>=e.y-r&&n.y<=e.y+e.height+r)?.id??t.closest(`[data-node]`)?.dataset.node;i!==Te&&Ee(i);return}let n=Re(e);if(t.type===`pan`){b({...t.camera,x:t.camera.x-(e.clientX-t.start.x)/t.camera.zoom,y:t.camera.y-(e.clientY-t.start.y)/t.camera.zoom});return}let r=Vo/x.zoom;if(t.type===`move`){let i=n.x-t.start.x,a=n.y-t.start.y;if(!t.dragged&&Math.hypot(i,a)*x.zoom<Bo)return;t.dragged=!0;let o=[...t.frames.values()],s=je(o),c=m.filter(e=>!t.frames.has(e.id)).map($),l=e.metaKey||e.ctrlKey?{frame:{...s,left:s.left+i,top:s.top+a},guides:[]}:Ae({...s,left:s.left+i,top:s.top+a},c,void 0,r),u=l.frame.left-s.left,d=l.frame.top-s.top,f=new Map;for(let[e,n]of t.frames)f.set(e,{...n,left:n.left+u,top:n.top+d});ke({frames:f,guides:l.guides})}else if(t.type===`resize`){let i=m.filter(e=>e.id!==t.id).map($),a=Ne(t.frame,t.handle,n.x-t.start.x,n.y-t.start.y,{keep:e.shiftKey,min:Ho,...e.metaKey||e.ctrlKey?{}:{snap:{others:i,surface:void 0,tol:r}}});ke({frames:new Map([[t.id,a.frame]]),guides:a.guides})}else if(t.type===`connect`){let e=No(m.filter(e=>e.id!==t.from),n);ke({connect:{from:t.from,side:t.side,to:n,...e?{over:{id:e.id,side:Oo($(e),n)}}:{}}})}else{let e=Pe(t.start,n),r=m.filter(t=>t.x<e.left+e.width&&t.x+t.width>e.left&&t.y<e.top+e.height&&t.y+t.height>e.top&&(t.type!==`group`||t.x>=e.left&&t.y>=e.top&&t.x+t.width<=e.left+e.width&&t.y+t.height<=e.top+e.height));j({nodes:new Set([...t.add?S.nodes:[],...r.map(e=>e.id)]),edges:t.add?S.edges:new Set}),ke({marquee:e})}},et=()=>{let t=E.current;E.current=void 0,Le(void 0);let r=Oe.current;if(ke({}),t){if(t.type===`move`&&t.dragged&&r.frames){let t=r.frames;e.edit(n.edits.move,e=>es(e,new Set(t.keys()),e=>{let n=t.get(String(e.id));return n?z(e,{x:R(n.left),y:R(n.top)}):e}))}else if(t.type===`resize`&&r.frames){let i=r.frames.get(t.id);i&&e.edit(n.edits.resize,e=>es(e,new Set([t.id]),e=>z(e,{x:R(i.left),y:R(i.top),width:R(i.width),height:R(i.height)})))}else if(t.type===`connect`&&r.connect?.over){let i=r.connect.over,a=ht(f.canvas);e.edit(n.edits.connect,e=>({...e,edges:[...e.edges,{id:a,fromNode:t.from,fromSide:t.side,toNode:i.id,toSide:i.side}]})),j({nodes:new Set,edges:new Set([a])})}}},tt=e=>{let t=document.elementFromPoint(e.clientX,e.clientY)??e.target;if(p){let e=t.closest(`[data-node]`)?.dataset.node,n=e===void 0?void 0:g.get(e);n&&Ze(n);return}if(t.closest(`[data-canvas-own]`))return;let n=t.closest(`[data-edge]`)?.dataset.edge;if(n!==void 0){let e=h.find(e=>e.id===n);T({type:`edge`,id:n,text:e?.label??``});return}if(t.closest(`[data-group-label]`)){let e=t.closest(`[data-node]`)?.dataset.node??``;T({type:`group`,id:e,text:g.get(e)?.label??``});return}let r=t.closest(`[data-node]`)?.dataset.node,i=r===void 0?void 0:g.get(r);i?i.type===`text`?T({type:`text`,id:i.id,text:i.text??``}):i.type===`group`?T({type:`group`,id:i.id,text:i.label??``}):Ze(i):Ue(Re(e))},nt=t=>{if(t.target.closest(`textarea, input, [contenteditable]`))return;Se();let r=Xo?t.metaKey:t.ctrlKey;if(t.key===` `)O.current=!0,t.preventDefault();else if(r&&t.key.toLowerCase()===`z`)t.preventDefault(),t.shiftKey?e.redo():e.undo();else if(r&&t.key.toLowerCase()===`y`)t.preventDefault(),e.redo();else if(r&&t.key.toLowerCase()===`a`)t.preventDefault(),j({nodes:new Set(m.map(e=>e.id)),edges:new Set(h.map(e=>e.id))});else if(r&&t.key.toLowerCase()===`g`&&!p)t.preventDefault(),qe();else if((t.key===`Delete`||t.key===`Backspace`)&&!p)t.preventDefault(),Ke();else if(t.key===`Escape`)j($o);else if(t.shiftKey&&(t.key===`!`||t.code===`Digit1`))A(`fit`);else if(t.shiftKey&&(t.key===`@`||t.code===`Digit2`))A(Xe());else if(t.shiftKey&&(t.key===`)`||t.code===`Digit0`))A(`actual`);else if(r&&(t.key===`=`||t.key===`+`))t.preventDefault(),A(`in`);else if(r&&t.key===`-`)t.preventDefault(),A(`out`);else if(t.key===`Enter`&&S.nodes.size===1&&!p){let e=g.get([...S.nodes][0]??``);e?.type===`text`&&(t.preventDefault(),T({type:`text`,id:e.id,text:e.text??``}))}else if(t.key.startsWith(`Arrow`)&&S.nodes.size>0&&!p){t.preventDefault();let r=t.shiftKey?10:1,i=t.key===`ArrowLeft`?-r:t.key===`ArrowRight`?r:0,a=t.key===`ArrowUp`?-r:t.key===`ArrowDown`?r:0,o=Be(S.nodes);e.edit(n.edits.move,e=>es(e,new Set(o.keys()),e=>z(e,{x:R(Number(e.x)+i),y:R(Number(e.y)+a)})),`nudge`)}},rt=t=>{t.key===` `&&(O.current=!1),t.key.startsWith(`Arrow`)&&e.settle()},it=e=>{if(p)return;e.preventDefault();let n=Re(e);if(e.dataTransfer.types.includes(`application/x-allyhub-canvas-note`)){Ue(n);return}let r=[...e.dataTransfer.files];if(r.length>0){(async()=>{let e=0;for(let i of r)try{let{path:r}=await a[`files/upload`]({dir:t.includes(`/`)?t.slice(0,t.lastIndexOf(`/`)):``,name:i.name,data:ns(await i.arrayBuffer())});We(r,{x:n.x+e*40,y:n.y+e*40}),e+=1}catch{}})();return}let i=(e.dataTransfer.getData(`text/uri-list`)||e.dataTransfer.getData(`text/plain`)).trim();i!==``&&(/^https?:\/\//u.test(i)?Ge(i,n):We(i.replace(/^\.\//u,``),n))},at=ne();i({hold:()=>Promise.resolve({key:`${t}@${String(f.revision)}`,what:`The canvas ${t}, its nodes laid out with notes and edges`,source:{path:t}}),locate:n=>{let r=u(n)[0];return Promise.resolve({elements:Fo(m,x,k(),n,{file:t,text:e.text,project:l}),...r?{where:Ro(m,x,k(),r)}:{}})},pick:n=>{let r=k(),i=No(m,wo(x,{x:n.x-r.x,y:n.y-r.y}));return Promise.resolve(i?Lo(i,x,k(),{file:t,text:e.text,project:l}):void 0)},selected:()=>Promise.resolve(m.filter(e=>S.nodes.has(e.id)).map(n=>Lo(n,x,k(),{file:t,text:e.text,project:l})))});let N=e=>C.frames?.get(e.id)??$(e),P=S.nodes.size===1&&S.edges.size===0?g.get([...S.nodes][0]??``):void 0,F=x.zoom,I=m.filter(e=>e.type===`group`),st=m.filter(e=>e.type!==`group`),ct=e=>{let t=g.get(e.fromNode),n=g.get(e.toNode);if(!t||!n)return;let r=N(t),i=N(n),a=e.fromSide??ko(r,i),o=e.toSide??ko(i,r),s=Do(r,a),c=Do(i,o);return{...jo(s,a,c,o),start:s,startDir:jo(c,o,s,a).endDir}},lt=e=>{let t=N(e),r=S.nodes.has(e.id),i=Ka(e.color),a=e.type===`group`,o=a?(0,J.jsx)(`div`,{"data-group-label":``,className:`text-ink absolute bottom-full left-0 max-w-full truncate rounded-sm px-1.5 py-0.5 text-sm font-semibold`,style:{marginBottom:Wo/F,fontSize:14/Math.max(F,.5),background:i?`color-mix(in oklab, ${i} 22%, transparent)`:void 0},children:w?.type===`group`&&w.id===e.id?null:e.label??`\xA0`}):e.type===`file`?(0,J.jsx)(`div`,{className:`text-lead absolute bottom-full left-0 flex max-w-full text-xs`,style:{marginBottom:Wo/F,fontSize:12/Math.max(F,.5)},children:(0,J.jsx)(no,{node:e,project:l})}):null;return(0,J.jsxs)(`div`,{"data-node":e.id,"data-testid":`canvas-node`,"data-type":e.type,"data-selected":r?``:void 0,className:`group/node absolute`,style:{left:t.left,top:t.top,width:t.width,height:t.height},children:[o,(0,J.jsx)(`div`,{className:d(`size-full overflow-hidden rounded-md border`,a?`border-rule-strong`:`bg-sheet border-rule motion-safe:transition-shadow`,!a&&Te===e.id&&`border-rule-strong shadow-overlay`,r&&`outline-pencil outline-2 outline-offset-2`),style:{...i?{borderColor:i}:{},...a?{background:i?`color-mix(in oklab, ${i} 8%, transparent)`:`color-mix(in oklab, var(--color-lead) 5%, transparent)`}:e.type===`text`&&i?{background:`color-mix(in oklab, ${i} 10%, var(--color-sheet))`}:{},borderWidth:Math.max(1,1/F)},children:e.type===`text`?w?.type===`text`&&w.id===e.id?(0,J.jsx)(`textarea`,{"data-canvas-own":``,"data-testid":`canvas-typing`,autoFocus:!0,value:w.text,"aria-label":n.note,className:`text-ink size-full resize-none bg-transparent px-4 py-3 text-base leading-relaxed outline-none`,onChange:e=>{T({...w,text:e.target.value})},onBlur:()=>{M()},onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&M()}}):(0,J.jsx)(Xa,{text:e.text??``}):e.type===`file`?(0,J.jsx)(to,{node:e,project:l,active:Te===e.id}):e.type===`link`?(0,J.jsx)(ro,{url:e.url??``}):a?null:(0,J.jsx)(io,{type:e.type})}),a&&w?.type===`group`&&w.id===e.id?(0,J.jsx)(`input`,{"data-canvas-own":``,"data-testid":`canvas-typing`,autoFocus:!0,value:w.text,"aria-label":n.label,className:`bg-sheet text-ink border-pencil absolute bottom-full left-0 rounded-sm border px-1.5 py-0.5 text-sm font-semibold outline-none`,style:{marginBottom:Wo/F,fontSize:14/Math.max(F,.5)},onChange:e=>{T({...w,text:e.target.value})},onBlur:()=>{M()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Escape`||e.key===`Enter`)&&M()}}):null]},e.id)},ut=p||D!==void 0?null:m.filter(e=>e.id===Te||S.nodes.has(e.id)).flatMap(e=>{let t=N(e),n=Go/F,r=qo(e,F);return ot.map(i=>{let a=Do({left:t.left-n,top:t.top-n,width:t.width+2*n,height:t.height+2*n},i),o=i===`top`&&r!==void 0?{x:a.x,y:t.top-15/F-r}:a;return(0,J.jsx)(`span`,{"data-connector":e.id,"data-side":i,"data-testid":`canvas-connector`,className:`bg-sheet border-pencil absolute rounded-full border`,style:{left:o.x,top:o.y,width:Ko/F,height:Ko/F,marginLeft:-5/F,marginTop:-5/F,borderWidth:1.5/F,cursor:`crosshair`}},`${e.id} ${i}`)})}),L=(()=>{let e=C.connect;if(!e)return;let t=g.get(e.from);if(!t)return;let n=N(t),r=e.over?g.get(e.over.id):void 0;return jo(Do(n,e.side),e.side,r&&e.over?Do($(r),e.over.side):e.to,e.over?.side)})(),dt=h.map(e=>{let t=ct(e);if(!t)return null;let n=S.edges.has(e.id),r=Ka(e.color)??`var(--color-lead)`,i=(n?2.5:1.75)/F;return(0,J.jsxs)(`g`,{"data-edge":e.id,"data-testid":`canvas-edge`,children:[(0,J.jsx)(`path`,{d:t.d,stroke:`transparent`,strokeWidth:14/F,fill:`none`,pointerEvents:`stroke`}),(0,J.jsx)(`path`,{d:t.d,stroke:n?`var(--color-pencil)`:r,strokeWidth:i,fill:`none`,pointerEvents:`none`}),e.fromEnd===`arrow`?(0,J.jsx)(`polygon`,{points:Mo(t.start,t.startDir,10/Math.max(F,.4)),fill:n?`var(--color-pencil)`:r,pointerEvents:`none`}):null,e.toEnd===`arrow`?(0,J.jsx)(`polygon`,{points:Mo(t.end,t.endDir,10/Math.max(F,.4)),fill:n?`var(--color-pencil)`:r,pointerEvents:`none`}):null]},e.id)}),mt=h.map(e=>{let t=ct(e);if(!t)return null;let r=w?.type===`edge`&&w.id===e.id;return!r&&(e.label===void 0||e.label===``)?null:(0,J.jsx)(`div`,{"data-edge":e.id,className:`absolute -translate-x-1/2 -translate-y-1/2`,style:{left:t.mid.x,top:t.mid.y,fontSize:13/Math.max(F,.5)},children:r?(0,J.jsx)(`input`,{"data-canvas-own":``,"data-testid":`canvas-typing`,autoFocus:!0,value:w.text,"aria-label":n.label,className:`bg-sheet text-ink border-pencil w-40 rounded-sm border px-1.5 py-0.5 text-center outline-none`,onChange:e=>{T({...w,text:e.target.value})},onBlur:()=>{M()},onKeyDown:e=>{e.stopPropagation(),(e.key===`Escape`||e.key===`Enter`)&&M()}}):(0,J.jsx)(`span`,{"data-testid":`canvas-edge-label`,className:`bg-paper text-ink rounded-sm px-1.5 py-0.5 whitespace-nowrap`,children:e.label})},e.id)}),gt=P&&!p&&P.id!==w?.id?Fe.map(e=>{let t=N(P),[n,r]=Me[e],i=9/F;return(0,J.jsx)(`span`,{"data-handle":e,"data-testid":`canvas-handle`,className:`bg-sheet border-pencil absolute border`,style:{left:t.left+n*t.width-i/2,top:t.top+r*t.height-i/2,width:i,height:i,borderWidth:1.5/F,cursor:`${e===`n`||e===`s`?`ns`:e===`e`||e===`w`?`ew`:e===`ne`||e===`sw`?`nesw`:`nwse`}-resize`}},e)}):null,_t=Yo*F,vt=P,yt=!p,B=()=>{_.current?.focus()},bt=(()=>{if(D!==void 0||w!==void 0)return;let e=Xe();if(e.length===0)return;let t=je(e),n=Co(x,{x:t.left,y:t.top}),r={left:n.x,top:n.y,width:t.width*F,height:t.height*F};if(r.left>v.width||r.top>v.height||r.left+r.width<0||r.top+r.height<0)return;let i=Math.max(0,...m.filter(e=>S.nodes.has(e.id)&&e.y<=t.top).map(e=>qo(e,F)??0));return{box:r,above:i>0?i*F+Wo+Ko+4:0}})(),xt=P&&(P.type===`file`||P.type===`link`)?P:void 0;return(0,J.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,"data-testid":`canvas-editor`,"data-state":`ready`,children:[(0,J.jsx)(ae,{saved:{state:f.state}}),f.unreadable===void 0?null:(0,J.jsx)(`div`,{className:`bg-problem/10 text-problem-text shrink-0 px-3 py-1 text-xs`,"data-testid":`canvas-unreadable`,children:n.unreadable(f.unreadable)}),(0,J.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,J.jsxs)(se,{children:[(0,J.jsx)(te,{asChild:!0,children:(0,J.jsxs)(`div`,{ref:_,tabIndex:0,role:`application`,"aria-label":t,"data-testid":`canvas-surface`,"data-zoom":F,className:`bg-paper absolute inset-0 touch-none overflow-hidden outline-none select-none`,style:{backgroundImage:`radial-gradient(circle, var(--color-rule-strong) ${String(Math.max(.6,F))}px, transparent ${String(Math.max(.6,F)+.4)}px)`,backgroundSize:`${String(_t)}px ${String(_t)}px`,backgroundPosition:`${String(-x.x*F)}px ${String(-x.y*F)}px`,cursor:D===`pan`?`grabbing`:D===`move`?`move`:D===`connect`?`crosshair`:void 0},onPointerDown:Qe,onPointerMove:$e,onPointerUp:et,onPointerCancel:et,onPointerLeave:()=>{D===void 0&&Ee(void 0)},onDoubleClick:tt,onKeyDown:nt,onKeyUp:rt,onDragOver:e=>{p||e.preventDefault()},onDrop:it,onContextMenu:e=>{let t=e.target.closest(`[data-node]`)?.dataset.node;t!==void 0&&!S.nodes.has(t)&&j({nodes:new Set([t]),edges:new Set})},children:[(0,J.jsxs)(`div`,{className:`absolute top-0 left-0`,"data-testid":`canvas-world`,style:{transform:`translate(${String(-x.x*F)}px, ${String(-x.y*F)}px) scale(${String(F)})`,transformOrigin:`0 0`},children:[I.map(lt),(0,J.jsx)(`svg`,{className:`pointer-events-none absolute top-0 left-0 overflow-visible`,width:1,height:1,children:(0,J.jsx)(`g`,{className:`pointer-events-auto`,children:dt})}),st.map(lt),L?(0,J.jsx)(`svg`,{className:`pointer-events-none absolute top-0 left-0 overflow-visible`,width:1,height:1,children:(0,J.jsx)(`path`,{d:L.d,stroke:`var(--color-pencil)`,strokeWidth:2/F,strokeDasharray:`${String(6/F)} ${String(4/F)}`,fill:`none`})}):null,mt,gt,ut,(C.guides??[]).map((e,t)=>(0,J.jsx)(`span`,{className:`bg-pencil pointer-events-none absolute`,style:e.axis===`x`?{left:e.at,top:x.y-1e4,width:1/F,height:2e4+v.height/F}:{top:e.at,left:x.x-1e4,height:1/F,width:2e4+v.width/F}},t)),C.marquee?(0,J.jsx)(`span`,{className:`border-pencil bg-pencil-wash pointer-events-none absolute border`,style:{left:C.marquee.left,top:C.marquee.top,width:C.marquee.width,height:C.marquee.height,borderWidth:1/F}}):null]}),me&&ve?(()=>{let e=$(ve);return(0,J.jsx)(Ie,{"data-testid":`canvas-agent`,label:ge(me),style:{left:(e.left-x.x)*F,top:(e.top-x.y)*F,width:e.width*F,height:e.height*F}})})():null,m.length===0&&!p?(0,J.jsx)(`p`,{className:`text-lead pointer-events-none absolute inset-x-0 top-1/2 text-center text-sm`,"data-testid":`canvas-empty`,children:n.empty}):null]})}),(0,J.jsxs)(ue,{className:`w-52`,"data-testid":`canvas-menu`,children:[vt&&(vt.type===`file`||vt.type===`link`)?(0,J.jsx)(re,{onSelect:()=>{Ze(vt)},children:n.open}):null,!p&&S.nodes.size>0?(0,J.jsxs)(re,{onSelect:qe,children:[n.group,(0,J.jsx)(le,{children:Zo})]}):null,!p&&S.nodes.size+S.edges.size>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ie,{}),(0,J.jsxs)(re,{variant:`destructive`,onSelect:Ke,children:[n.delete,(0,J.jsx)(le,{children:`⌫`})]})]}):null,!p&&S.nodes.size===0&&S.edges.size===0?(0,J.jsx)(re,{onSelect:()=>{Ue()},children:n.note}):null,(0,J.jsx)(ce,{})]})]}),yt?(0,J.jsx)(fo,{onNote:()=>{Ue()},onFile:e=>{We(e),B()},onLink:e=>{Ge(e),B()},groupable:S.nodes.size>0,onGroup:qe,project:l,self:t}):null,(0,J.jsx)(po,{onZoom:e=>{Se(),A(e),B()},history:yt?{canUndo:f.canUndo,canRedo:f.canRedo,onUndo:()=>{e.undo(),B()},onRedo:()=>{e.redo(),B()}}:void 0}),bt?(0,J.jsx)(_o,{markUp:at,box:bt.box,above:bt.above,view:v,color:Ye(),onColor:yt?Je:void 0,onDelete:yt?()=>{Ke(),B()}:void 0,open:xt?{link:xt.type===`link`,run:()=>{Ze(xt)}}:void 0,onZoomTo:()=>{Se(),A(Xe()),B()}}):null]})]})}function is(){let e=Wa(),t=o(),n=s()?.item.entry,[r,i]=(0,Y.useState)(),[a,c]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(n===void 0)return;let e,r=!0;return bo.open(t,n).then(t=>{r?(e=t,i(t)):t.close()},e=>{r&&c(e instanceof Error?e.message:String(e))}),()=>{r=!1,e?.close()}},[t,n]),!r||n===void 0?(0,J.jsx)(`div`,{className:`text-lead flex size-full items-center justify-center text-sm`,"data-testid":`canvas-editor`,"data-state":a===void 0?`loading`:`error`,children:a===void 0?e.loading:e.couldNotOpen(a)}):(0,J.jsx)(rs,{doc:r,path:n})}export{bo as CanvasDocument,is as CanvasEditor,is as default,Ua as WORDS};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./workbook-
|
|
2
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";import{d as r,o as i,s as a,u as o,v as s,y as c}from"./react-Edyoga_4.js";import{Ct as l,Dt as u,ht as d,kt as f,yt as p}from"./x-DlhyIKuu.js";import{C as m,S as h,a as g,d as _,g as v,h as y,o as b}from"./slides-oQ_C0SVJ.js";import{A as x,B as S,G as C,H as w,I as T,K as E,L as D,M as O,P as k,Q as A,W as j,Z as M,_ as N,a as P,b as F,ct as ee,dt as I,j as L,l as R,lt as te,q as ne,rt as z,st as B,t as re,u as ie,v as ae,x as oe}from"./esm-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./workbook-DznVDqoE.js","./schemas-moE_A7Nj.js","./iso-ahTwmFwH.js","./rolldown-runtime-COiEfhsA.js","./slides-oQ_C0SVJ.js","./browser-C1XuTMlp.js","./chart-amT4lgX3.js","./dist-d4dayaWE.js","./csv-Bwre9FdI.js","./svg-CWIBMIQ9.js","./browser-C9NP0ZYz.js","./docx-draw-C4aiB8HI.js","./index-q7X6hdHp.js","./react-Edyoga_4.js","./jsx-runtime-DePvh3-m.js","./x-DlhyIKuu.js","./createLucideIcon-lm_6n8YT.js","./snapshots-Dd0Wd_qM.js","./layout-SWqqA0yV.js","./bar-button-J9vbfzTx.js","./index-Dvh1t1om.css","./purify.es-B9ve_eFf.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-COiEfhsA.js";import{d as r,o as i,s as a,u as o,v as s,y as c}from"./react-Edyoga_4.js";import{Ct as l,Dt as u,ht as d,kt as f,yt as p}from"./x-DlhyIKuu.js";import{C as m,S as h,a as g,d as _,g as v,h as y,o as b}from"./slides-oQ_C0SVJ.js";import{A as x,B as S,G as C,H as w,I as T,K as E,L as D,M as O,P as k,Q as A,W as j,Z as M,_ as N,a as P,b as F,ct as ee,dt as I,j as L,l as R,lt as te,q as ne,rt as z,st as B,t as re,u as ie,v as ae,x as oe}from"./esm-DzxAod8Q.js";import{a as se,n as ce,r as le}from"./browser-C1XuTMlp.js";import{r as ue}from"./csv-Bwre9FdI.js";import{t as de}from"./jsx-runtime-DePvh3-m.js";import{t as V}from"./bar-button-J9vbfzTx.js";import{i as fe,v as pe}from"./dist-elglzHMT.js";import{t as H}from"./file-exclamation-point-_L3ElCJ5.js";import{t as me}from"./file-question-mark-DlIjUK37.js";import{p as he,x as ge}from"./index-q7X6hdHp.js";import{C as _e,S as ve,T as ye,a as be,b as xe,n as Se,o as U,t as Ce,w as we,x as Te}from"./chart-amT4lgX3.js";var W={a:`http://schemas.openxmlformats.org/drawingml/2006/main`,p:`http://schemas.openxmlformats.org/presentationml/2006/main`,r:`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,c:`http://schemas.openxmlformats.org/drawingml/2006/chart`,cdr:`http://schemas.openxmlformats.org/drawingml/2006/chartDrawing`,pic:`http://schemas.openxmlformats.org/drawingml/2006/picture`,dgm:`http://schemas.openxmlformats.org/drawingml/2006/diagram`,lc:`http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas`,s:`http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes`,m:`http://schemas.openxmlformats.org/officeDocument/2006/math`,mc:`http://schemas.openxmlformats.org/markup-compatibility/2006`,rel:`http://schemas.openxmlformats.org/package/2006/relationships`,ct:`http://schemas.openxmlformats.org/package/2006/content-types`,cp:`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,dc:`http://purl.org/dc/elements/1.1/`,dcterms:`http://purl.org/dc/terms/`,xsi:`http://www.w3.org/2001/XMLSchema-instance`,ep:`http://schemas.openxmlformats.org/officeDocument/2006/extended-properties`,vt:`http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes`,xml:`http://www.w3.org/XML/1998/namespace`,p14:`http://schemas.microsoft.com/office/powerpoint/2010/main`,p15:`http://schemas.microsoft.com/office/powerpoint/2012/main`,p159:`http://schemas.microsoft.com/office/powerpoint/2015/09/main`,a14:`http://schemas.microsoft.com/office/drawing/2010/main`,a16:`http://schemas.microsoft.com/office/drawing/2014/main`,asvg:`http://schemas.microsoft.com/office/drawing/2016/SVG/main`,dsp:`http://schemas.microsoft.com/office/drawing/2008/diagram`,c14:`http://schemas.microsoft.com/office/drawing/2007/8/2/chart`,c16:`http://schemas.microsoft.com/office/drawing/2014/chart`,c16r2:`http://schemas.microsoft.com/office/drawing/2015/06/chart`,v:`urn:schemas-microsoft-com:vml`,o:`urn:schemas-microsoft-com:office:office`},Ee=new Map(Object.entries(W).map(([e,t])=>[t,e])),De={"http://purl.oclc.org/ooxml/officeDocument/extendedProperties":W.ep,"http://purl.oclc.org/ooxml/officeDocument/customProperties":`http://schemas.openxmlformats.org/officeDocument/2006/custom-properties`,"http://purl.oclc.org/ooxml/officeDocument/relationships/extendedProperties":`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`,"http://purl.oclc.org/ooxml/officeDocument/relationships/customProperties":`http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties`,"http://purl.oclc.org/ooxml/officeDocument/relationships/metadata/core-properties":`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`},Oe=`http://purl.oclc.org/ooxml/`;function ke(e){if(!e.startsWith(Oe))return e;let t=De[e];if(t!==void 0)return t;let[n,...r]=e.slice(27).split(`/`);return`http://schemas.openxmlformats.org/${n??``}/2006/${r.join(`/`)}`}function Ae(e,t){if(e===``)return t;let n=Ee.get(e);return n===void 0?`{${e}}${t}`:`${n}:${t}`}var je=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CHAR=`
|
|
3
3
|
\r --�𐀀-`,e.S=` \r
|
|
4
4
|
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),Me=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CHAR=`--�𐀀-`,e.RESTRICTED_CHAR=`-\b\v\f---`,e.S=` \r
|
|
5
5
|
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),Ne=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),G=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SaxesParser=e.EVENTS=void 0;var t=je(),n=Me(),r=Ne(),i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE,m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=-1,y=-2,b=0,x=1,S=2,C=3,w=4,T=5,E=6,D=7,O=8,k=9,A=10,j=11,M=12,N=13,P=14,F=15,ee=16,I=17,L=18,R=19,te=20,ne=21,z=22,B=23,re=24,ie=25,ae=26,oe=27,se=28,ce=29,le=30,ue=31,de=32,V=33,fe=34,pe=35,H=36,me=37,he=38,ge=39,_e=40,ve=41,ye=42,be=43,xe=44,Se=9,U=10,Ce=13,we=32,Te=33,W=34,Ee=38,De=39,Oe=45,ke=47,Ae=59,G=60,Pe=61,K=62,q=63,Fe=91,Ie=93,Le=133,Re=8232,J=e=>e===W||e===De,Y=[W,De],ze=[...Y,Fe,K],Be=[...Y,G,Ie],Ve=[Pe,q,...c],He=[...c,K,Ee,G];function Ue(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`)}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
|
|
@@ -14,4 +14,4 @@ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namesp
|
|
|
14
14
|
`,ii=e=>{let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}},ai=1e3;function oi({path:e,drawn:t,version:n}){let i=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let e=i.current;if(!e)return;let n=e.shadowRoot??e.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=ri;let a=document.createElement(`style`);a.textContent=t.css,n.replaceChildren(a,r,t.body)},[t]);let a=()=>[...i.current?.shadowRoot?.querySelectorAll(`section.docx`)??[]],o=e=>a().indexOf(e)+1,s=e=>`page ${String(o(e))}`,c=(t,n)=>{let r=[...t.querySelectorAll(`p, td, th`)].filter(e=>e.closest(`td, th`)===e||e.closest(`td, th`)===null).filter(e=>n(ii(e))).map(e=>e.textContent.trim()).filter(e=>e!==``).join(`
|
|
15
15
|
`).slice(0,ai);return{name:`${s(t)} of the document ${e}`,source:{path:e},...r===``?{}:{text:r}}};return r({hold:()=>Promise.resolve({key:`${e}@${String(n)}`,what:`The Word document ${e}`,source:{path:e}}),locate:e=>{let t=a().filter(t=>f(e,ii(t)));return Promise.resolve({elements:t.map(t=>c(t,t=>f(e,t))),...t.length===0?{}:{where:`on ${t.map(s).join(`, `)}`}})},pick:e=>{let t=a().find(t=>{let n=ii(t);return e.x>=n.x&&e.x<=n.x+n.width&&e.y>=n.y&&e.y<=n.y+n.height});return Promise.resolve(t&&{element:c(t,()=>!0),outline:u(ii(t)),where:`on ${s(t)}`})}}),(0,Y.jsx)(`div`,{className:`size-full overflow-auto`,"data-testid":`office-document`,"data-version":n,children:(0,Y.jsx)(`div`,{ref:i,"data-testid":`office-document-pages`})})}var si={csv:`delimited`,tsv:`delimited`,xlsx:`workbook`,xls:null,docx:`document`,doc:null,pptx:`deck`,ppt:null},ci=Object.keys(si);function li(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?void 0:t.slice(n+1).toLowerCase()}function ui(e){let t=li(e);return t===void 0?void 0:si[t]??void 0}var di=e=>e.slice(e.lastIndexOf(`/`)+1),fi={delimited:10485760,workbook:26214400,deck:104857600,document:26214400},pi=e=>li(e)===`tsv`?` `:`,`,mi=p({en:{loading:`Opening the file…`,couldNotOpen:e=>`The file could not be opened: ${e}`,noPreview:`This file cannot be previewed.`,tooLarge:e=>`This file is ${e}, too large to show here.`,sheets:`Sheets`},"zh-cn":{loading:`正在打开文件…`,couldNotOpen:e=>`无法打开文件:${e}`,noPreview:`这个文件无法预览。`,tooLarge:e=>`这个文件有 ${e},太大了,无法在这里显示。`,sheets:`工作表`},"zh-tw":{loading:`正在開啟檔案…`,couldNotOpen:e=>`無法開啟檔案:${e}`,noPreview:`這個檔案無法預覽。`,tooLarge:e=>`這個檔案有 ${e},太大了,無法在這裡顯示。`,sheets:`工作表`},ja:{loading:`ファイルを開いています…`,couldNotOpen:e=>`ファイルを開けませんでした:${e}`,noPreview:`このファイルはプレビューできません。`,tooLarge:e=>`このファイルは ${e} あり、大きすぎるためここには表示できません。`,sheets:`シート`},ko:{loading:`파일을 여는 중…`,couldNotOpen:e=>`파일을 열 수 없습니다: ${e}`,noPreview:`이 파일은 미리 볼 수 없습니다.`,tooLarge:e=>`이 파일은 ${e}로, 너무 커서 여기에 표시할 수 없습니다.`,sheets:`시트`},es:{loading:`Abriendo el archivo…`,couldNotOpen:e=>`No se pudo abrir el archivo: ${e}`,noPreview:`Este archivo no se puede previsualizar.`,tooLarge:e=>`Este archivo ocupa ${e}, demasiado para mostrarlo aquí.`,sheets:`Hojas`},fr:{loading:`Ouverture du fichier…`,couldNotOpen:e=>`Impossible d’ouvrir le fichier : ${e}`,noPreview:`Ce fichier ne peut pas être prévisualisé.`,tooLarge:e=>`Ce fichier fait ${e}, trop pour être affiché ici.`,sheets:`Feuilles`},de:{loading:`Datei wird geöffnet …`,couldNotOpen:e=>`Die Datei konnte nicht geöffnet werden: ${e}`,noPreview:`Für diese Datei gibt es keine Vorschau.`,tooLarge:e=>`Diese Datei ist ${e} groß, zu groß, um sie hier anzuzeigen.`,sheets:`Blätter`},pt:{loading:`Abrindo o arquivo…`,couldNotOpen:e=>`Não foi possível abrir o arquivo: ${e}`,noPreview:`Não é possível pré-visualizar este arquivo.`,tooLarge:e=>`Este arquivo tem ${e}, grande demais para ser mostrado aqui.`,sheets:`Planilhas`}});function hi({icon:e,path:t,message:n,state:i,download:a}){let o=(0,J.useRef)(null),s=()=>{let e=o.current?.getBoundingClientRect();return e&&{x:e.x,y:e.y,width:e.width,height:e.height}},c=()=>({name:`the file ${t}`,source:{path:t}});return r({hold:()=>Promise.resolve({key:`${t}@${i}`,what:`The file ${t}, which is not shown`,source:{path:t}}),locate:e=>{let t=s();return Promise.resolve({elements:t&&f(e,t)?[c()]:[]})},pick:e=>{let t=s();return Promise.resolve(t&&e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height?{element:c(),outline:u(t)}:void 0)}}),(0,Y.jsx)(`div`,{className:`flex size-full items-center justify-center p-6`,"data-testid":`office-viewer-notice`,"data-state":i,children:(0,Y.jsxs)(`div`,{ref:o,className:`flex flex-col items-center gap-2 text-center`,"data-testid":`office-viewer-notice-file`,children:[(0,Y.jsx)(e,{className:`text-lead-soft size-5`,strokeWidth:1.5,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`text-ink font-serif text-sm font-semibold`,children:di(t)}),(0,Y.jsx)(`p`,{className:`text-lead max-w-[var(--allyhub-measure)] text-xs`,children:n}),a?(0,Y.jsx)(pe,{path:t,className:`mt-1`}):null]})})}var gi=class extends Error{status;constructor(e,t){super(t===``?String(e):`${String(e)} ${t}`),this.name=`FileNotFetchedError`,this.status=e}};async function _i(e,t){let n=t.includes(`/`)?t.slice(0,t.lastIndexOf(`/`)):``;return(await e[`files/list`]({dir:n})).files.find(e=>e.path===t)?.size}async function vi(e,t,n,r={}){let i=await _i(e,t);if(i!==void 0&&i>n)return{at:`too-large`,bytes:i};let{url:a}=await e[`files/url`]({path:t}),o=new URL(a,r.base??globalThis.location.href);r.again!==void 0&&r.again>0&&o.searchParams.set(`v`,String(r.again));let s=await(r.get??fetch)(o.href);if(!s.ok)throw new gi(s.status,s.statusText);let c=Number(s.headers.get(`content-length`)??``);if(Number.isFinite(c)&&c>n)return await s.body?.cancel(),{at:`too-large`,bytes:c};let l=new Uint8Array(await s.arrayBuffer());return l.byteLength>n?{at:`too-large`,bytes:l.byteLength}:{at:`read`,bytes:l}}function yi(e){let t=e[0]===255&&e[1]===254?`utf-16le`:e[0]===254&&e[1]===255?`utf-16be`:void 0;return new TextDecoder(t??`utf-8`).decode(e)}function bi(e,t){let n=i(),[r,a]=(0,J.useState)(0),[o,s]=(0,J.useState)({at:`loading`});return(0,J.useEffect)(()=>{let t=!0,r,i=t=>{n[`files/unwatch`]({watch:t}).catch(t=>{console.warn(`The watch of ${e} could not be stopped:`,t)})},o=n.on(`files/changed`,t=>{t.watch===r&&t.changes.some(t=>t.path===e)&&a(e=>e+1)});return n[`files/watch`]({paths:[e]}).then(e=>{t?r=e.watch:i(e.watch)},t=>{console.warn(`${e} could not be watched for changes:`,t)}),()=>{t=!1,o(),r!==void 0&&i(r)}},[n,e]),(0,J.useEffect)(()=>{let i=!0;return vi(n,e,t,{again:r}).then(e=>{i&&s({...e,version:r})},e=>{i&&s({at:`failed`,why:e instanceof Error?e.message:String(e)})}),()=>{i=!1}},[n,e,t,r]),o}var xi=16384,Si=(e,t)=>e*xi+t;function Ci(e){let t=``;for(let n=e+1;n>0;n=Math.floor((n-1)/26))t=String.fromCharCode(65+(n-1)%26)+t;return t}var wi=(e,t)=>`${Ci(t)}${String(e+1)}`,Ti=7,Ei=18;function Di(e){let t=0;for(let n of e){let e=n.codePointAt(0)??0;t+=e>=4352&&!(e>=8192&&e<11904)?2:1}return t}function Oi(e){return Math.min(320,Math.max(48,e*Ti+Ei))}var ki=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?%?$/u;function Ai(e,t,n){let{records:r}=ue(e,t),i=new Map,a=[],o=0;r.forEach((e,t)=>{o=Math.max(o,e.fields.length),e.fields.forEach((e,n)=>{e!==``&&(i.set(Si(t,n),{text:e,...ki.test(e)?{align:`right`}:{}}),t<200&&(a[n]=Math.max(a[n]??0,Di(e))))})});let s=i.size===0?0:r.length;return{sheets:[{name:n,rows:s,columns:s===0?0:o,widths:Array.from({length:s===0?0:o},(e,t)=>Oi(a[t]??0)),cells:i,merges:[],lines:s===0?[]:r.map(e=>e.line)}]}}var ji=40;function Mi(e){let t=wi(e.top,e.left),n=wi(e.bottom,e.right);return t===n?t:`${t}:${n}`}var Ni=(e,t)=>({top:Math.min(e.top,t.top),left:Math.min(e.left,t.left),bottom:Math.max(e.bottom,t.bottom),right:Math.max(e.right,t.right)}),Pi=(e,t,n)=>t>=e.top&&t<=e.bottom&&n>=e.left&&n<=e.right,Fi=(e,t,n)=>e.find(e=>Pi(e,t,n));function Ii(e,t){let n=[],r=0;for(let i=t.top;i<=t.bottom&&r<ji;i++){let a=[];for(let n=t.left;n<=t.right&&r<ji;n++)a.push(e.cells.get(Si(i,n))?.text??``),r+=1;n.push(a.join(` `))}return n.join(`
|
|
16
16
|
`)}function Li(e,t,n,r){let i=t.top===t.bottom&&t.left===t.right,a=r?`the sheet ${e.name} of ${n}`:n,o=Ii(e,t),s=e.lines?.[t.top],c=e.lines?.[t.bottom];return{name:`${i?`cell`:`cells`} ${Mi(t)} of ${a}`,source:{path:n,...s===void 0?{}:{line:s},...s===void 0||c===void 0||c===s?{}:{endLine:c}},...o.trim()===``?{}:{text:o}}}var Ri=24,zi=24,Bi=e=>Math.max(40,String(e).length*8+16);function Vi(e){if(!e)return{};let t=[...e.underline?[`underline`]:[],...e.strike?[`line-through`]:[]];return{...e.align===void 0?{}:{textAlign:e.align},...e.bold?{fontWeight:600}:{},...e.italic?{fontStyle:`italic`}:{},...t.length>0?{textDecorationLine:t.join(` `)}:{},...e.fill===void 0?e.color===void 0?{}:{color:e.color}:{background:e.fill,color:e.color??`#000000`}}}var Hi=`border-rule absolute overflow-hidden border-r border-b px-1.5 text-xs text-ellipsis whitespace-nowrap`,Ui=`bg-stone text-lead border-rule border-r border-b text-center text-xs tabular-nums select-none`,Wi=e=>{let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}};function Gi(e){let t=(e.dataset.area??``).split(`,`).map(Number),[n,r,i,a]=t;return t.length===4&&n!==void 0&&r!==void 0&&i!==void 0&&a!==void 0&&t.every(Number.isInteger)?{top:n,left:r,bottom:i,right:a}:void 0}var Ki=e=>[e.top,e.left,e.bottom,e.right].join(`,`);function qi({sheet:e,path:t,version:n,several:i}){let a=(0,J.useRef)(null),o=Bi(e.rows),s=re({count:e.rows,getScrollElement:()=>a.current,estimateSize:()=>Ri,overscan:12,paddingStart:zi}),c=re({horizontal:!0,count:e.columns,getScrollElement:()=>a.current,estimateSize:t=>e.widths[t]??64,overscan:4,paddingStart:o});(0,J.useLayoutEffect)(()=>{c.measure()},[c,e.widths]);let l=(0,J.useMemo)(()=>{let t=[0];for(let n of e.widths)t.push((t[t.length-1]??0)+n);return t},[e.widths]),p=s.getVirtualItems(),m=c.getVirtualItems(),h=p.length===0||m.length===0?void 0:{top:p[0]?.index??0,bottom:p[p.length-1]?.index??0,left:m[0]?.index??0,right:m[m.length-1]?.index??0},g=h?e.merges.filter(e=>e.top<=h.bottom&&e.bottom>=h.top&&e.left<=h.right&&e.right>=h.left):[],_=c.getTotalSize(),v=s.getTotalSize(),y=()=>[...a.current?.querySelectorAll(`[data-area]`)??[]],b=()=>{let e=a.current?.getBoundingClientRect();return e&&{x:e.x+o,y:e.y+zi,width:Math.max(0,e.width-o),height:Math.max(0,e.height-zi)}},x=e=>{let t=b();if(!t)return;let n=Wi(e),r=Math.max(n.x,t.x),i=Math.max(n.y,t.y),a=Math.min(n.x+n.width,t.x+t.width),o=Math.min(n.y+n.height,t.y+t.height);return a>r&&o>i?{x:r,y:i,width:a-r,height:o-i}:void 0},S=i?{where:`on its sheet ${e.name}`}:{};r({hold:()=>Promise.resolve({key:`${t}@${String(n)}@${e.name}`,what:`The spreadsheet ${t}`,source:{path:t}}),locate:n=>{let r;for(let e of y()){let t=x(e),i=Gi(e);t&&i&&f(n,t)&&(r=r?Ni(r,i):i)}return Promise.resolve({elements:r?[Li(e,r,t,i)]:[],...S})},pick:n=>{let r=y().reverse().flatMap(e=>{let t=x(e),r=Gi(e);return t&&r&&n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height?[{box:t,area:r}]:[]})[0];return Promise.resolve(r&&{element:Li(e,r.area,t,i),outline:u(r.box),...S})}});let C=(e,t)=>e!==void 0&&(e.text.includes(`
|
|
17
|
-
`)||e.text.length*6>t)?{title:e.text}:{};return(0,Y.jsx)(`div`,{ref:a,className:`bg-sheet text-ink size-full overflow-auto`,"data-testid":`office-table`,"data-sheet":e.name,"data-rows":e.rows,"data-columns":e.columns,children:(0,Y.jsxs)(`div`,{className:`relative`,style:{width:_,height:v},children:[(0,Y.jsxs)(`div`,{className:`sticky top-0 z-20`,style:{width:_,height:zi},children:[(0,Y.jsx)(`div`,{className:d(Ui,`sticky left-0 z-10`),style:{width:o,height:zi}}),m.map(e=>(0,Y.jsx)(`div`,{className:d(Ui,`absolute top-0`),style:{left:e.start,width:e.size,height:zi,lineHeight:`23px`},children:Ci(e.index)},e.key))]}),p.map(t=>(0,Y.jsxs)(`div`,{className:`absolute left-0`,style:{top:t.start,width:_,height:t.size},children:[(0,Y.jsx)(`div`,{className:d(Ui,`sticky left-0 z-10`),style:{width:o,height:t.size,lineHeight:`${String(t.size-1)}px`},children:t.index+1}),m.map(n=>{if(Fi(g,t.index,n.index))return null;let r=e.cells.get(Si(t.index,n.index));return(0,Y.jsx)(`div`,{className:d(Hi,`top-0`),"data-cell":wi(t.index,n.index),"data-area":Ki({top:t.index,left:n.index,bottom:t.index,right:n.index}),style:{left:n.start,width:n.size,height:t.size,lineHeight:`${String(t.size-1)}px`,...Vi(r)},...C(r,n.size),children:r?.text},n.key)})]},t.key)),g.map(t=>{let n=e.cells.get(Si(t.top,t.left)),r=o+(l[t.left]??0),i=(l[t.right+1]??0)-(l[t.left]??0);return(0,Y.jsx)(`div`,{className:d(Hi,`bg-sheet flex items-center`),"data-cell":wi(t.top,t.left),"data-area":Ki(t),style:{left:r,top:zi+t.top*Ri,width:i,height:(t.bottom-t.top+1)*Ri,...Vi(n)},...C(n,i),children:(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis`,children:n?.text})},Ki(t))})]})})}function Ji({path:e,table:t,version:n}){let r=mi.of(a()?.locale),[i,o]=(0,J.useState)(0),s=Math.min(i,Math.max(0,t.sheets.length-1)),c=t.sheets[s],l=t.sheets.length>1;return(0,Y.jsxs)(`div`,{className:`flex size-full flex-col`,"data-testid":`office-table-view`,children:[(0,Y.jsx)(`div`,{className:`min-h-0 flex-1`,children:c?(0,Y.jsx)(qi,{sheet:c,path:e,version:n,several:l},s):null}),l?(0,Y.jsx)(`div`,{role:`tablist`,"aria-label":r.sheets,className:`border-rule bg-stone flex flex-none items-center gap-1 overflow-x-auto border-t px-2 py-1`,"data-testid":`office-table-sheets`,children:t.sheets.map((e,t)=>(0,Y.jsx)(V,{role:`tab`,"aria-selected":t===s,className:`flex-none`,onClick:()=>{o(t)},children:e.name},`${String(t)}:${e.name}`))}):null]})}var Yi=()=>mi.of(a()?.locale);async function Xi(e,t,n){switch(e){case`delimited`:return{is:`table`,table:Ai(yi(n),pi(t),di(t))};case`workbook`:return{is:`table`,table:(await he(async()=>{let{tableOfWorkbook:e}=await import(`./workbook-
|
|
17
|
+
`)||e.text.length*6>t)?{title:e.text}:{};return(0,Y.jsx)(`div`,{ref:a,className:`bg-sheet text-ink size-full overflow-auto`,"data-testid":`office-table`,"data-sheet":e.name,"data-rows":e.rows,"data-columns":e.columns,children:(0,Y.jsxs)(`div`,{className:`relative`,style:{width:_,height:v},children:[(0,Y.jsxs)(`div`,{className:`sticky top-0 z-20`,style:{width:_,height:zi},children:[(0,Y.jsx)(`div`,{className:d(Ui,`sticky left-0 z-10`),style:{width:o,height:zi}}),m.map(e=>(0,Y.jsx)(`div`,{className:d(Ui,`absolute top-0`),style:{left:e.start,width:e.size,height:zi,lineHeight:`23px`},children:Ci(e.index)},e.key))]}),p.map(t=>(0,Y.jsxs)(`div`,{className:`absolute left-0`,style:{top:t.start,width:_,height:t.size},children:[(0,Y.jsx)(`div`,{className:d(Ui,`sticky left-0 z-10`),style:{width:o,height:t.size,lineHeight:`${String(t.size-1)}px`},children:t.index+1}),m.map(n=>{if(Fi(g,t.index,n.index))return null;let r=e.cells.get(Si(t.index,n.index));return(0,Y.jsx)(`div`,{className:d(Hi,`top-0`),"data-cell":wi(t.index,n.index),"data-area":Ki({top:t.index,left:n.index,bottom:t.index,right:n.index}),style:{left:n.start,width:n.size,height:t.size,lineHeight:`${String(t.size-1)}px`,...Vi(r)},...C(r,n.size),children:r?.text},n.key)})]},t.key)),g.map(t=>{let n=e.cells.get(Si(t.top,t.left)),r=o+(l[t.left]??0),i=(l[t.right+1]??0)-(l[t.left]??0);return(0,Y.jsx)(`div`,{className:d(Hi,`bg-sheet flex items-center`),"data-cell":wi(t.top,t.left),"data-area":Ki(t),style:{left:r,top:zi+t.top*Ri,width:i,height:(t.bottom-t.top+1)*Ri,...Vi(n)},...C(n,i),children:(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden text-ellipsis`,children:n?.text})},Ki(t))})]})})}function Ji({path:e,table:t,version:n}){let r=mi.of(a()?.locale),[i,o]=(0,J.useState)(0),s=Math.min(i,Math.max(0,t.sheets.length-1)),c=t.sheets[s],l=t.sheets.length>1;return(0,Y.jsxs)(`div`,{className:`flex size-full flex-col`,"data-testid":`office-table-view`,children:[(0,Y.jsx)(`div`,{className:`min-h-0 flex-1`,children:c?(0,Y.jsx)(qi,{sheet:c,path:e,version:n,several:l},s):null}),l?(0,Y.jsx)(`div`,{role:`tablist`,"aria-label":r.sheets,className:`border-rule bg-stone flex flex-none items-center gap-1 overflow-x-auto border-t px-2 py-1`,"data-testid":`office-table-sheets`,children:t.sheets.map((e,t)=>(0,Y.jsx)(V,{role:`tab`,"aria-selected":t===s,className:`flex-none`,onClick:()=>{o(t)},children:e.name},`${String(t)}:${e.name}`))}):null]})}var Yi=()=>mi.of(a()?.locale);async function Xi(e,t,n){switch(e){case`delimited`:return{is:`table`,table:Ai(yi(n),pi(t),di(t))};case`workbook`:return{is:`table`,table:(await he(async()=>{let{tableOfWorkbook:e}=await import(`./workbook-DznVDqoE.js`);return{tableOfWorkbook:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)).tableOfWorkbook(n)};case`deck`:return{is:`deck`,deck:(await he(async()=>{let{deckOfPresentation:e}=await import(`./deck-CtEtDHo2.js`);return{deckOfPresentation:e}},[],import.meta.url)).deckOfPresentation(n)};case`document`:return{is:`document`,drawn:await(await he(async()=>{let{drawWordDocumentHeld:e}=await import(`./docx-draw-C4aiB8HI.js`);return{drawWordDocumentHeld:e}},__vite__mapDeps([11,5,12,3,13,14,15,16,2,17,18,19,20,21]),import.meta.url)).drawWordDocumentHeld(n)}}}function Zi({path:e,view:t}){let n=Yi(),r=a()?.locale,i=bi(e,fi[t]),[o,s]=(0,J.useState)();if((0,J.useEffect)(()=>{if(i.at!==`read`)return;let n=!0,{version:r}=i;return Xi(t,e,i.bytes).then(e=>{n&&s({version:r,shown:e})},e=>{n&&s({version:r,failed:e instanceof Error?e.message:String(e)})}),()=>{n=!1}},[i,t,e]),i.at===`failed`)return(0,Y.jsx)(hi,{icon:H,path:e,message:n.couldNotOpen(i.why),state:`error`,download:!1});if(i.at===`too-large`)return(0,Y.jsx)(hi,{icon:ge,path:e,message:n.tooLarge(l(i.bytes,r)),state:`too-large`,download:!0});if(o===void 0)return(0,Y.jsx)(`div`,{className:`size-full`,"data-testid":`office-viewer-opening`,"aria-label":n.loading});if(`failed`in o)return(0,Y.jsx)(hi,{icon:H,path:e,message:n.couldNotOpen(o.failed),state:`error`,download:!0});let{shown:c}=o;switch(c.is){case`table`:return(0,Y.jsx)(Ji,{path:e,table:c.table,version:o.version});case`deck`:return(0,Y.jsx)(ni,{path:e,deck:c.deck,version:o.version});case`document`:return(0,Y.jsx)(oi,{path:e,drawn:c.drawn,version:o.version})}}function Qi(){let e=Yi(),t=a()?.item.entry,n=t===void 0?void 0:ui(t);return(0,Y.jsxs)(`div`,{className:`flex size-full flex-col`,"data-testid":`office-viewer`,children:[(0,Y.jsx)(fe,{}),(0,Y.jsx)(`div`,{className:`bg-stone relative min-h-0 flex-1`,children:t===void 0?null:n===void 0?(0,Y.jsx)(hi,{icon:me,path:t,message:e.noPreview,state:`no-view`,download:!0}):(0,Y.jsx)(Zi,{path:t,view:n},t)})]})}var $i=t({MOST_BYTES:()=>fi,OFFICE_EXTENSIONS:()=>ci,OfficeViewer:()=>Qi,WORDS:()=>mi,default:()=>Qi,extensionOf:()=>li,viewOf:()=>ui});export{fi as MOST_BYTES,ci as OFFICE_EXTENSIONS,Qi as OfficeViewer,Qi as default,mi as WORDS,Kr as a,li as extensionOf,Oi as i,Si as n,Gr as o,Di as r,Jr as s,$i as t,ui as viewOf};
|