@saluzi/saluzi-edu 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +212 -140
- package/dist/rcs-web/assets/Dashboard-YYwDrKTN.js +1 -0
- package/dist/rcs-web/assets/Join-DKCP5X6X.js +1 -0
- package/dist/rcs-web/assets/Login-0VGZs85I.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/SessionDetail-DSoMXZJb.js → dist/rcs-web/assets/SessionDetail-DmK-DfBQ.js} +11 -11
- package/dist/rcs-web/assets/Setup-C0cjxXMt.js +1 -0
- package/dist/rcs-web/assets/{ShareLanding-C06U9Nrr.js → ShareLanding-DUZrreJ7.js} +1 -1
- package/dist/rcs-web/assets/TeamCreate-B8ZV6EdY.js +1 -0
- package/dist/rcs-web/assets/{TeamDetail-d_GwIRHd.js → TeamDetail-DBAsJ__i.js} +2 -2
- package/dist/rcs-web/assets/{TeamList-BlNGdKci.js → TeamList-C-Hte4nV.js} +1 -1
- package/dist/rcs-web/assets/{TeamSettings-CPraC9uS.js → TeamSettings-CNVwYwcp.js} +1 -1
- package/dist/rcs-web/assets/UserSettings-DRdz9kYE.js +1 -0
- package/dist/rcs-web/assets/{arc-BmYza-0n.js → arc-CJxirXEQ.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-CYBtlgdO.js → architectureDiagram-3BPJPVTR-BZvIHrLA.js} +1 -1
- package/dist/rcs-web/assets/{blockDiagram-GPEHLZMM-RJAfHk_a.js → blockDiagram-GPEHLZMM-3p0y3Ija.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-CJ-qJA6w.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-Bmz9A1wn.js} +1 -1
- package/dist/rcs-web/assets/channel-DaI_n8dp.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-n5I6Q1zJ.js → chunk-2J33WTMH-B8gQz22j.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-CSOBh7qY.js → chunk-4BX2VUAB-CgLEZsTU.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-C0euQVm_.js → chunk-55IACEB6-0mdE_-IS.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-Ch7yD8cR.js → dist/rcs-web/assets/chunk-727SXJPM-DdtjnIHR.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-Ms2Q7r6u.js → dist/rcs-web/assets/chunk-AQP2D5EJ-BtwFPk50.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-bszHUkpx.js → chunk-FMBD7UC4-BcO9mQ0P.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-BVQIhq6J.js → chunk-ND2GUHAM-BvRq13S_.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-BVEDe5qc.js → chunk-QZHKN3VN-D7GHkPpq.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-pYllpkOq.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-pYllpkOq.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-B26n-rFC.js → code-block-IT6T5CEO-B1p-vO-3.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-DXc7GE8W.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-L0rUZuH5.js} +1 -1
- package/dist/rcs-web/assets/{dagre-BM42HDAG-DAXofHt_.js → dagre-BM42HDAG-CHGuio22.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-DK0TBUQA.js → diagram-2AECGRRQ-DIDRyQk8.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-DMsq-Grp.js → diagram-5GNKFQAL-CNubKb6P.js} +1 -1
- package/dist/rcs-web/assets/{diagram-KO2AKTUF-B3FMhmUc.js → diagram-KO2AKTUF-CzQh664-.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-BjO3BHFl.js → diagram-LMA3HP47-CWBR7-VG.js} +1 -1
- package/dist/rcs-web/assets/{diagram-OG6HWLK6-CNg4B2L3.js → diagram-OG6HWLK6-BMHdlbcZ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-BDxz8NRK.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-OgT8dC-K.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-VIgM13sK.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-DRrCY2oB.js} +1 -1
- package/dist/rcs-web/assets/{ganttDiagram-6RSMTGT7-Ba2QuJU0.js → ganttDiagram-6RSMTGT7-DctpzEKN.js} +1 -1
- package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-B-gV-lAg.js → gitGraphDiagram-PVQCEYII-5KpLszm9.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-DothwgD4.js → infoDiagram-5YYISTIA-BAKD_Tt7.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-DhpjM1Vc.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-VHOPG4Nc.js} +1 -1
- package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-PbQTouMJ.js → journeyDiagram-JHISSGLW-BtGih-ik.js} +1 -1
- package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-63WdwG-X.js → kanban-definition-UN3LZRKU-BsEGZsD1.js} +1 -1
- package/dist/rcs-web/assets/{linear-CeRljV9s.js → linear-Dj636PNG.js} +1 -1
- package/dist/rcs-web/assets/main-CkqtCllF.js +238 -0
- package/dist/rcs-web/assets/{mermaid-VLURNSYL-CG6yNR7g.js → mermaid-VLURNSYL-DutpHHm9.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-CAuNNATY.js → mermaid.core-XHHf0pen.js} +5 -5
- package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-9hDL1CUV.js → mindmap-definition-RKZ34NQL-BBa8V_3g.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-BS_P2t04.js → pieDiagram-4H26LBE5-BuNEdo9H.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-Cp9QQkHV.js → quadrantDiagram-W4KKPZXB-CsJgyQIN.js} +1 -1
- package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-C_XSzOKE.js → requirementDiagram-4Y6WPE33-DqMJZ914.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-BhuVqzZd.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CVsz09q2.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-C3IPZrcW.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-BRp4Wddn.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-CN4iNPRl.js → stateDiagram-AJRCARHV-S-QqQr-D.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CICBlDSJ.js → stateDiagram-v2-BHNVJYJU-D77KfDr-.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-Be7t_3rC.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-De8bFWnE.js} +1 -1
- package/dist/rcs-web/assets/{useTeams-DPHGnBHL.js → useTeams-CqJOqEy1.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-CSaUc2Xv.js → vennDiagram-CIIHVFJN-Dikwrn1L.js} +1 -1
- package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-DTuJrl9P.js → wardleyDiagram-YWT4CUSO-DUzpiV6H.js} +1 -1
- package/dist/rcs-web/assets/{workerType-CSqeySYe.js → workerType-DOQ0AHrq.js} +1 -1
- package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-BQ0oU3Qi.js → xychartDiagram-2RQKCTM6-OZNbB32D.js} +1 -1
- package/dist/rcs-web/index.html +1 -1
- package/package.json +2 -2
- package/packages/remote-control-server/src/__tests__/cookie.test.ts +0 -71
- package/packages/remote-control-server/src/__tests__/data-layer-round2.test.ts +556 -0
- package/packages/remote-control-server/src/__tests__/route-mounting.test.ts +212 -0
- package/packages/remote-control-server/src/__tests__/routes.test.ts +5 -44
- package/packages/remote-control-server/src/__tests__/security-fixes.test.ts +526 -0
- package/packages/remote-control-server/src/__tests__/security-round3.test.ts +780 -0
- package/packages/remote-control-server/src/__tests__/shares.test.ts +5 -2
- package/packages/remote-control-server/src/auth/constants.ts +0 -6
- package/packages/remote-control-server/src/auth/cookie.ts +0 -43
- package/packages/remote-control-server/src/auth/csrf.ts +58 -0
- package/packages/remote-control-server/src/auth/middleware.ts +7 -4
- package/packages/remote-control-server/src/index.ts +26 -0
- package/packages/remote-control-server/src/registerRoutes.ts +17 -1
- package/packages/remote-control-server/src/routes/web/auth-routes.ts +93 -54
- package/packages/remote-control-server/src/routes/web/auth.ts +16 -23
- package/packages/remote-control-server/src/routes/web/sessions.ts +30 -5
- package/packages/remote-control-server/src/routes/web/shares.ts +38 -1
- package/packages/remote-control-server/src/routes/web/teams.ts +22 -4
- package/packages/remote-control-server/src/services/session.ts +143 -9
- package/packages/remote-control-server/src/store.ts +34 -1
- package/packages/remote-control-server/src/types/api.ts +0 -1
- package/packages/remote-control-server/web/dist/assets/Dashboard-YYwDrKTN.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Join-DKCP5X6X.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Login-0VGZs85I.js +1 -0
- package/{dist/rcs-web/assets/SessionDetail-DSoMXZJb.js → packages/remote-control-server/web/dist/assets/SessionDetail-DmK-DfBQ.js} +11 -11
- package/packages/remote-control-server/web/dist/assets/Setup-C0cjxXMt.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-C06U9Nrr.js → ShareLanding-DUZrreJ7.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/TeamCreate-B8ZV6EdY.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{TeamDetail-d_GwIRHd.js → TeamDetail-DBAsJ__i.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/{TeamList-BlNGdKci.js → TeamList-C-Hte4nV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamSettings-CPraC9uS.js → TeamSettings-CNVwYwcp.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/UserSettings-DRdz9kYE.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{arc-BmYza-0n.js → arc-CJxirXEQ.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-CYBtlgdO.js → architectureDiagram-3BPJPVTR-BZvIHrLA.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{blockDiagram-GPEHLZMM-RJAfHk_a.js → blockDiagram-GPEHLZMM-3p0y3Ija.js} +1 -1
- package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-CJ-qJA6w.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-Bmz9A1wn.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-DaI_n8dp.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-n5I6Q1zJ.js → chunk-2J33WTMH-B8gQz22j.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-CSOBh7qY.js → chunk-4BX2VUAB-CgLEZsTU.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-C0euQVm_.js → chunk-55IACEB6-0mdE_-IS.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-Ch7yD8cR.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-DdtjnIHR.js} +1 -1
- package/{dist/rcs-web/assets/chunk-AQP2D5EJ-Ms2Q7r6u.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BtwFPk50.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-bszHUkpx.js → chunk-FMBD7UC4-BcO9mQ0P.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-BVQIhq6J.js → chunk-ND2GUHAM-BvRq13S_.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-BVEDe5qc.js → chunk-QZHKN3VN-D7GHkPpq.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-pYllpkOq.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-pYllpkOq.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-B26n-rFC.js → code-block-IT6T5CEO-B1p-vO-3.js} +1 -1
- package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-DXc7GE8W.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-L0rUZuH5.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-DAXofHt_.js → dagre-BM42HDAG-CHGuio22.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-DK0TBUQA.js → diagram-2AECGRRQ-DIDRyQk8.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-DMsq-Grp.js → diagram-5GNKFQAL-CNubKb6P.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-B3FMhmUc.js → diagram-KO2AKTUF-CzQh664-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-BjO3BHFl.js → diagram-LMA3HP47-CWBR7-VG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-CNg4B2L3.js → diagram-OG6HWLK6-BMHdlbcZ.js} +1 -1
- package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-BDxz8NRK.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-OgT8dC-K.js} +1 -1
- package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-VIgM13sK.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-DRrCY2oB.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ganttDiagram-6RSMTGT7-Ba2QuJU0.js → ganttDiagram-6RSMTGT7-DctpzEKN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-B-gV-lAg.js → gitGraphDiagram-PVQCEYII-5KpLszm9.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-DothwgD4.js → infoDiagram-5YYISTIA-BAKD_Tt7.js} +1 -1
- package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-DhpjM1Vc.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-VHOPG4Nc.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-PbQTouMJ.js → journeyDiagram-JHISSGLW-BtGih-ik.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-63WdwG-X.js → kanban-definition-UN3LZRKU-BsEGZsD1.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-CeRljV9s.js → linear-Dj636PNG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/main-CkqtCllF.js +238 -0
- package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-CG6yNR7g.js → mermaid-VLURNSYL-DutpHHm9.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-CAuNNATY.js → mermaid.core-XHHf0pen.js} +5 -5
- package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-9hDL1CUV.js → mindmap-definition-RKZ34NQL-BBa8V_3g.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-BS_P2t04.js → pieDiagram-4H26LBE5-BuNEdo9H.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-Cp9QQkHV.js → quadrantDiagram-W4KKPZXB-CsJgyQIN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-C_XSzOKE.js → requirementDiagram-4Y6WPE33-DqMJZ914.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-BhuVqzZd.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CVsz09q2.js} +1 -1
- package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-C3IPZrcW.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-BRp4Wddn.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-CN4iNPRl.js → stateDiagram-AJRCARHV-S-QqQr-D.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CICBlDSJ.js → stateDiagram-v2-BHNVJYJU-D77KfDr-.js} +1 -1
- package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-Be7t_3rC.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-De8bFWnE.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{useTeams-DPHGnBHL.js → useTeams-CqJOqEy1.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-CSaUc2Xv.js → vennDiagram-CIIHVFJN-Dikwrn1L.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-DTuJrl9P.js → wardleyDiagram-YWT4CUSO-DUzpiV6H.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{workerType-CSqeySYe.js → workerType-DOQ0AHrq.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-BQ0oU3Qi.js → xychartDiagram-2RQKCTM6-OZNbB32D.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +1 -1
- package/dist/rcs-web/assets/Dashboard-D_Im4UId.js +0 -1
- package/dist/rcs-web/assets/Join-BTnvMsB9.js +0 -1
- package/dist/rcs-web/assets/Login-ClT7RckC.js +0 -1
- package/dist/rcs-web/assets/Setup-PaDA6Et-.js +0 -1
- package/dist/rcs-web/assets/TeamCreate-249rK3U3.js +0 -1
- package/dist/rcs-web/assets/UserSettings-X627Fdni.js +0 -1
- package/dist/rcs-web/assets/channel-BUwWbT6U.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DYtx22zv.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DYtx22zv.js +0 -1
- package/dist/rcs-web/assets/i18n-Dbt-vEQ3.js +0 -1
- package/dist/rcs-web/assets/main-DvfxciBy.js +0 -238
- package/packages/remote-control-server/web/dist/assets/Dashboard-D_Im4UId.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Join-BTnvMsB9.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Login-ClT7RckC.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Setup-PaDA6Et-.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamCreate-249rK3U3.js +0 -1
- package/packages/remote-control-server/web/dist/assets/UserSettings-X627Fdni.js +0 -1
- package/packages/remote-control-server/web/dist/assets/channel-BUwWbT6U.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DYtx22zv.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DYtx22zv.js +0 -1
- package/packages/remote-control-server/web/dist/assets/i18n-Dbt-vEQ3.js +0 -1
- package/packages/remote-control-server/web/dist/assets/main-DvfxciBy.js +0 -238
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-CG6yNR7g.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-D_Im4UId.js","assets/workerType-CSqeySYe.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-DSoMXZJb.js","assets/ShareLanding-C06U9Nrr.js","assets/Login-ClT7RckC.js","assets/i18n-Dbt-vEQ3.js","assets/Setup-PaDA6Et-.js","assets/Join-BTnvMsB9.js","assets/UserSettings-X627Fdni.js","assets/TeamList-BlNGdKci.js","assets/useTeams-DPHGnBHL.js","assets/TeamCreate-249rK3U3.js","assets/TeamDetail-d_GwIRHd.js","assets/TeamSettings-CPraC9uS.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var _l=Object.defineProperty;var Rl=(e,t,n)=>t in e?_l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>Rl(e,typeof t!="symbol"?t+"":t,n);import{e as m,a as rt,j as f,R as $r,r as ws,b as jl,c as Ur,d as Nl}from"./vendor-DE_-CLIE.js";import{_ as Re}from"./shiki-mEP5vQQu.js";import{m as Tl}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function Cs(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Cs(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Ss(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Cs(e))&&(o&&(o+=" "),o+=t);return o}const Il=(e,t)=>{const n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},Ml=(e,t)=>({classGroupId:e,validator:t}),Es=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Cn="-",Ro=[],Pl="arbitrary..",Ol=e=>{const t=Ll(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Dl(a);const i=a.split(Cn),p=i[0]===""&&i.length>1?1:0;return As(i,p,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const p=o[a],d=n[a];return p?d?Il(d,p):p:d||Ro}return n[a]||Ro}}},As=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],s=n.nextPart.get(r);if(s){const d=As(e,t+1,s);if(d)return d}const a=n.validators;if(a===null)return;const i=t===0?e.join(Cn):e.slice(t).join(Cn),p=a.length;for(let d=0;d<p;d++){const c=a[d];if(c.validator(i))return c.classGroupId}},Dl=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?Pl+o:void 0})(),Ll=e=>{const{theme:t,classGroups:n}=e;return Fl(n,t)},Fl=(e,t)=>{const n=Es();for(const o in e){const r=e[o];zr(r,n,o,t)}return n},zr=(e,t,n,o)=>{const r=e.length;for(let s=0;s<r;s++){const a=e[s];$l(a,t,n,o)}},$l=(e,t,n,o)=>{if(typeof e=="string"){Ul(e,t,n);return}if(typeof e=="function"){zl(e,t,n,o);return}Bl(e,t,n,o)},Ul=(e,t,n)=>{const o=e===""?t:ks(t,e);o.classGroupId=n},zl=(e,t,n,o)=>{if(Hl(e)){zr(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(Ml(n,e))},Bl=(e,t,n,o)=>{const r=Object.entries(e),s=r.length;for(let a=0;a<s;a++){const[i,p]=r[a];zr(p,ks(t,i),n,o)}},ks=(e,t)=>{let n=e;const o=t.split(Cn),r=o.length;for(let s=0;s<r;s++){const a=o[s];let i=n.nextPart.get(a);i||(i=Es(),n.nextPart.set(a,i)),n=i}return n},Hl=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Wl=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const r=(s,a)=>{n[s]=a,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=o[s])!==void 0)return r(s,a),a},set(s,a){s in n?n[s]=a:r(s,a)}}},Er="!",jo=":",Gl=[],No=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),Vl=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let a=0,i=0,p=0,d;const c=r.length;for(let v=0;v<c;v++){const w=r[v];if(a===0&&i===0){if(w===jo){s.push(r.slice(p,v)),p=v+1;continue}if(w==="/"){d=v;continue}}w==="["?a++:w==="]"?a--:w==="("?i++:w===")"&&i--}const l=s.length===0?r:r.slice(p);let u=l,h=!1;l.endsWith(Er)?(u=l.slice(0,-1),h=!0):l.startsWith(Er)&&(u=l.slice(1),h=!0);const g=d&&d>p?d-p:void 0;return No(s,h,u,g)};if(t){const r=t+jo,s=o;o=a=>a.startsWith(r)?s(a.slice(r.length)):No(Gl,!1,a,void 0,!0)}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},Kl=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{const o=[];let r=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",p=t.has(a);i||p?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(a)):r.push(a)}return r.length>0&&(r.sort(),o.push(...r)),o}},ql=e=>({cache:Wl(e.cacheSize),parseClassName:Vl(e),sortModifiers:Kl(e),postfixLookupClassGroupIds:Xl(e),...Ol(e)}),Xl=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},Yl=/\s+/,Ql=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],p=e.trim().split(Yl);let d="";for(let c=p.length-1;c>=0;c-=1){const l=p[c],{isExternal:u,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:w}=n(l);if(u){d=l+(d.length>0?" "+d:d);continue}let y=!!w,_;if(y){const j=v.substring(0,w);_=o(j);const x=_&&a[_]?o(v):void 0;x&&x!==_&&(_=x,y=!1)}else _=o(v);if(!_){if(!y){d=l+(d.length>0?" "+d:d);continue}if(_=o(v),!_){d=l+(d.length>0?" "+d:d);continue}y=!1}const R=h.length===0?"":h.length===1?h[0]:s(h).join(":"),k=g?R+Er:R,F=k+_;if(i.indexOf(F)>-1)continue;i.push(F);const S=r(_,y);for(let j=0;j<S.length;++j){const x=S[j];i.push(k+x)}d=l+(d.length>0?" "+d:d)}return d},Zl=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=_s(n))&&(r&&(r+=" "),r+=o);return r},_s=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=_s(e[o]))&&(n&&(n+=" "),n+=t);return n},Jl=(e,...t)=>{let n,o,r,s;const a=p=>{const d=t.reduce((c,l)=>l(c),e());return n=ql(d),o=n.cache.get,r=n.cache.set,s=i,i(p)},i=p=>{const d=o(p);if(d)return d;const c=Ql(p,n);return r(p,c),c};return s=a,(...p)=>s(Zl(...p))},ec=[],xe=e=>{const t=n=>n[e]||ec;return t.isThemeGetter=!0,t},Rs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,nc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,oc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ac=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nt=e=>tc.test(e),oe=e=>!!e&&!Number.isNaN(Number(e)),$e=e=>!!e&&Number.isInteger(Number(e)),rr=e=>e.endsWith("%")&&oe(e.slice(0,-1)),Ve=e=>nc.test(e),Ns=()=>!0,ic=e=>rc.test(e)&&!oc.test(e),Br=()=>!1,lc=e=>sc.test(e),cc=e=>ac.test(e),uc=e=>!X(e)&&!Q(e),dc=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),fc=e=>ut(e,Ms,Br),X=e=>Rs.test(e),xt=e=>ut(e,Ps,ic),To=e=>ut(e,yc,oe),pc=e=>ut(e,Ds,Ns),mc=e=>ut(e,Os,Br),Io=e=>ut(e,Ts,Br),hc=e=>ut(e,Is,cc),mn=e=>ut(e,Ls,lc),Q=e=>js.test(e),Gt=e=>Et(e,Ps),gc=e=>Et(e,Os),Mo=e=>Et(e,Ts),xc=e=>Et(e,Ms),vc=e=>Et(e,Is),hn=e=>Et(e,Ls,!0),bc=e=>Et(e,Ds,!0),ut=(e,t,n)=>{const o=Rs.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Et=(e,t,n=!1)=>{const o=js.exec(e);return o?o[1]?t(o[1]):n:!1},Ts=e=>e==="position"||e==="percentage",Is=e=>e==="image"||e==="url",Ms=e=>e==="length"||e==="size"||e==="bg-size",Ps=e=>e==="length",yc=e=>e==="number",Os=e=>e==="family-name",Ds=e=>e==="number"||e==="weight",Ls=e=>e==="shadow",wc=()=>{const e=xe("color"),t=xe("font"),n=xe("text"),o=xe("font-weight"),r=xe("tracking"),s=xe("leading"),a=xe("breakpoint"),i=xe("container"),p=xe("spacing"),d=xe("radius"),c=xe("shadow"),l=xe("inset-shadow"),u=xe("text-shadow"),h=xe("drop-shadow"),g=xe("blur"),v=xe("perspective"),w=xe("aspect"),y=xe("ease"),_=xe("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...k(),Q,X],S=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,X,p],b=()=>[nt,"full","auto",...x()],I=()=>[$e,"none","subgrid",Q,X],O=()=>["auto",{span:["full",$e,Q,X]},$e,Q,X],P=()=>[$e,"auto",Q,X],$=()=>["auto","min","max","fr",Q,X],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...x()],C=()=>[nt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],D=()=>[nt,"screen","full","dvw","lvw","svw","min","max","fit",...x()],A=()=>[nt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],T=()=>[e,Q,X],H=()=>[...k(),Mo,Io,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",xc,fc,{size:[Q,X]}],z=()=>[rr,Gt,xt],L=()=>["","none","full",d,Q,X],G=()=>["",oe,Gt,xt],V=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[oe,rr,Mo,Io],ne=()=>["","none",g,Q,X],ae=()=>["none",oe,Q,X],le=()=>["none",oe,Q,X],pe=()=>[oe,Q,X],W=()=>[nt,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ve],breakpoint:[Ve],color:[Ns],container:[Ve],"drop-shadow":[Ve],ease:["in","out","in-out"],font:[uc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ve],shadow:[Ve],spacing:["px",oe],text:[Ve],"text-shadow":[Ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nt,X,Q,w]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[dc],columns:[{columns:[oe,X,Q,i]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:F()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:b()}],"inset-x":[{"inset-x":b()}],"inset-y":[{"inset-y":b()}],start:[{"inset-s":b(),start:b()}],end:[{"inset-e":b(),end:b()}],"inset-bs":[{"inset-bs":b()}],"inset-be":[{"inset-be":b()}],top:[{top:b()}],right:[{right:b()}],bottom:[{bottom:b()}],left:[{left:b()}],visibility:["visible","invisible","collapse"],z:[{z:[$e,"auto",Q,X]}],basis:[{basis:[nt,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[oe,nt,"auto","initial","none",X]}],grow:[{grow:["",oe,Q,X]}],shrink:[{shrink:["",oe,Q,X]}],order:[{order:[$e,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":$()}],"auto-rows":[{"auto-rows":$()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",...A()]}],"min-block-size":[{"min-block":["auto",...A()]}],"max-block-size":[{"max-block":["none",...A()]}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",n,Gt,xt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,bc,pc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rr,X]}],"font-family":[{font:[gc,mc,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Q,X]}],"line-clamp":[{"line-clamp":[oe,"none",Q,To]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[oe,"from-font","auto",Q,xt]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[oe,"auto",Q,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[$e,Q,X]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$e,Q,X],radial:["",Q,X],conic:[$e,Q,X]},vc,hc]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-bs":[{"border-bs":G()}],"border-w-be":[{"border-be":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[oe,Q,X]}],"outline-w":[{outline:["",oe,Gt,xt]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",c,hn,mn]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",l,hn,mn]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[oe,xt]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",u,hn,mn]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[oe,Q,X]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[oe]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[oe]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:ne()}],brightness:[{brightness:[oe,Q,X]}],contrast:[{contrast:[oe,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,hn,mn]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",oe,Q,X]}],"hue-rotate":[{"hue-rotate":[oe,Q,X]}],invert:[{invert:["",oe,Q,X]}],saturate:[{saturate:[oe,Q,X]}],sepia:[{sepia:["",oe,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[oe,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[oe,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",oe,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[oe,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",oe,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[oe,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[oe,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",oe,Q,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[oe,"initial",Q,X]}],ease:[{ease:["linear","initial",y,Q,X]}],delay:[{delay:[oe,Q,X]}],animate:[{animate:["none",_,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],zoom:[{zoom:[$e,Q,X]}],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,X]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[oe,Gt,xt,To]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Cc=Jl(wc);function J(...e){return Cc(Ss(e))}function Sc(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function ov(e){return e?new Date(e*1e3).toLocaleString():""}function sv(e){return e==="archived"||e==="inactive"}function av(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function Ec(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function iv(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),Ec(t)}/**
|
|
3
|
-
* @license lucide-react v0.555.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const Ac=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kc=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),Po=e=>{const t=kc(e);return t.charAt(0).toUpperCase()+t.slice(1)},Fs=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),_c=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
8
|
-
* @license lucide-react v0.555.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var Rc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
13
|
-
* @license lucide-react v0.555.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const jc=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:s,iconNode:a,...i},p)=>m.createElement("svg",{ref:p,...Rc,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Fs("lucide",r),...!s&&!_c(i)&&{"aria-hidden":"true"},...i},[...a.map(([d,c])=>m.createElement(d,c)),...Array.isArray(s)?s:[s]]));/**
|
|
18
|
-
* @license lucide-react v0.555.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const ce=(e,t)=>{const n=m.forwardRef(({className:o,...r},s)=>m.createElement(jc,{ref:s,iconNode:t,className:Fs(`lucide-${Ac(Po(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Po(e),n};/**
|
|
23
|
-
* @license lucide-react v0.555.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const Nc=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Tc=ce("arrow-down",Nc);/**
|
|
28
|
-
* @license lucide-react v0.555.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const Ic=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Mc=ce("brain",Ic);/**
|
|
33
|
-
* @license lucide-react v0.555.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const Pc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tn=ce("check",Pc);/**
|
|
38
|
-
* @license lucide-react v0.555.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const Oc=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],nn=ce("chevron-down",Oc);/**
|
|
43
|
-
* @license lucide-react v0.555.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const Dc=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Lc=ce("chevron-left",Dc);/**
|
|
48
|
-
* @license lucide-react v0.555.0 - ISC
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the ISC license.
|
|
51
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/const Fc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$s=ce("chevron-up",Fc);/**
|
|
53
|
-
* @license lucide-react v0.555.0 - ISC
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the ISC license.
|
|
56
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/const $c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Uc=ce("circle-check",$c);/**
|
|
58
|
-
* @license lucide-react v0.555.0 - ISC
|
|
59
|
-
*
|
|
60
|
-
* This source code is licensed under the ISC license.
|
|
61
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const zc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Bc=ce("circle",zc);/**
|
|
63
|
-
* @license lucide-react v0.555.0 - ISC
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the ISC license.
|
|
66
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const Hc=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Xt=ce("file-text",Hc);/**
|
|
68
|
-
* @license lucide-react v0.555.0 - ISC
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the ISC license.
|
|
71
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const Wc=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Hr=ce("folder-open",Wc);/**
|
|
73
|
-
* @license lucide-react v0.555.0 - ISC
|
|
74
|
-
*
|
|
75
|
-
* This source code is licensed under the ISC license.
|
|
76
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/const Gc=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Vc=ce("image",Gc);/**
|
|
78
|
-
* @license lucide-react v0.555.0 - ISC
|
|
79
|
-
*
|
|
80
|
-
* This source code is licensed under the ISC license.
|
|
81
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const Kc=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],qc=ce("layout-grid",Kc);/**
|
|
83
|
-
* @license lucide-react v0.555.0 - ISC
|
|
84
|
-
*
|
|
85
|
-
* This source code is licensed under the ISC license.
|
|
86
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const Xc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Us=ce("loader-circle",Xc);/**
|
|
88
|
-
* @license lucide-react v0.555.0 - ISC
|
|
89
|
-
*
|
|
90
|
-
* This source code is licensed under the ISC license.
|
|
91
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const Yc=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Qc=ce("message-square",Yc);/**
|
|
93
|
-
* @license lucide-react v0.555.0 - ISC
|
|
94
|
-
*
|
|
95
|
-
* This source code is licensed under the ISC license.
|
|
96
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const Zc=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Jc=ce("monitor",Zc);/**
|
|
98
|
-
* @license lucide-react v0.555.0 - ISC
|
|
99
|
-
*
|
|
100
|
-
* This source code is licensed under the ISC license.
|
|
101
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const eu=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],zs=ce("moon",eu);/**
|
|
103
|
-
* @license lucide-react v0.555.0 - ISC
|
|
104
|
-
*
|
|
105
|
-
* This source code is licensed under the ISC license.
|
|
106
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const tu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],nu=ce("panel-left-close",tu);/**
|
|
108
|
-
* @license lucide-react v0.555.0 - ISC
|
|
109
|
-
*
|
|
110
|
-
* This source code is licensed under the ISC license.
|
|
111
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const ru=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],ou=ce("panel-left",ru);/**
|
|
113
|
-
* @license lucide-react v0.555.0 - ISC
|
|
114
|
-
*
|
|
115
|
-
* This source code is licensed under the ISC license.
|
|
116
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/const su=[["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"}]],au=ce("paperclip",su);/**
|
|
118
|
-
* @license lucide-react v0.555.0 - ISC
|
|
119
|
-
*
|
|
120
|
-
* This source code is licensed under the ISC license.
|
|
121
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const iu=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],lu=ce("pencil",iu);/**
|
|
123
|
-
* @license lucide-react v0.555.0 - ISC
|
|
124
|
-
*
|
|
125
|
-
* This source code is licensed under the ISC license.
|
|
126
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const cu=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Bs=ce("plus",cu);/**
|
|
128
|
-
* @license lucide-react v0.555.0 - ISC
|
|
129
|
-
*
|
|
130
|
-
* This source code is licensed under the ISC license.
|
|
131
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
-
*/const uu=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],du=ce("search",uu);/**
|
|
133
|
-
* @license lucide-react v0.555.0 - ISC
|
|
134
|
-
*
|
|
135
|
-
* This source code is licensed under the ISC license.
|
|
136
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/const fu=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],pu=ce("send",fu);/**
|
|
138
|
-
* @license lucide-react v0.555.0 - ISC
|
|
139
|
-
*
|
|
140
|
-
* This source code is licensed under the ISC license.
|
|
141
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/const mu=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Hs=ce("shield-alert",mu);/**
|
|
143
|
-
* @license lucide-react v0.555.0 - ISC
|
|
144
|
-
*
|
|
145
|
-
* This source code is licensed under the ISC license.
|
|
146
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
-
*/const hu=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],gu=ce("shield",hu);/**
|
|
148
|
-
* @license lucide-react v0.555.0 - ISC
|
|
149
|
-
*
|
|
150
|
-
* This source code is licensed under the ISC license.
|
|
151
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/const xu=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],vu=ce("slash",xu);/**
|
|
153
|
-
* @license lucide-react v0.555.0 - ISC
|
|
154
|
-
*
|
|
155
|
-
* This source code is licensed under the ISC license.
|
|
156
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
-
*/const bu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],yu=ce("square",bu);/**
|
|
158
|
-
* @license lucide-react v0.555.0 - ISC
|
|
159
|
-
*
|
|
160
|
-
* This source code is licensed under the ISC license.
|
|
161
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
-
*/const wu=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ws=ce("sun",wu);/**
|
|
163
|
-
* @license lucide-react v0.555.0 - ISC
|
|
164
|
-
*
|
|
165
|
-
* This source code is licensed under the ISC license.
|
|
166
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
-
*/const Cu=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],Wr=ce("table",Cu);/**
|
|
168
|
-
* @license lucide-react v0.555.0 - ISC
|
|
169
|
-
*
|
|
170
|
-
* This source code is licensed under the ISC license.
|
|
171
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/const Su=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Eu=ce("trash-2",Su);/**
|
|
173
|
-
* @license lucide-react v0.555.0 - ISC
|
|
174
|
-
*
|
|
175
|
-
* This source code is licensed under the ISC license.
|
|
176
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
-
*/const Au=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ku=ce("user",Au);/**
|
|
178
|
-
* @license lucide-react v0.555.0 - ISC
|
|
179
|
-
*
|
|
180
|
-
* This source code is licensed under the ISC license.
|
|
181
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
-
*/const _u=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ln=ce("x",_u),Gs=m.createContext(void 0),Vs="theme";function Oo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Do(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(Vs);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Lo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function Ru(){const e=m.useContext(Gs);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function ju({children:e,defaultTheme:t="system"}){const[n,o]=m.useState(()=>Do()||t),[r,s]=m.useState(()=>{const p=Do()||t;return p==="system"?Oo():p}),a=m.useCallback(p=>{o(p);try{localStorage.setItem(Vs,p)}catch{}},[]);m.useEffect(()=>{const p=n==="system"?Oo():n;s(p),Lo(p)},[n]),m.useEffect(()=>{if(n!=="system")return;const p=window.matchMedia("(prefers-color-scheme: dark)"),d=c=>{const l=c.matches?"dark":"light";s(l),Lo(l)};return p.addEventListener("change",d),()=>p.removeEventListener("change",d)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return rt.createElement(Gs.Provider,{value:i},e)}function Fo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function He(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Fo(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():Fo(e[r],null)}}}}function me(...e){return m.useCallback(He(...e),e)}var Nu=Symbol.for("react.lazy"),Sn=$r[" use ".trim().toString()];function Tu(e){return typeof e=="object"&&e!==null&&"then"in e}function Ks(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Nu&&"_payload"in e&&Tu(e._payload)}function qs(e){const t=Mu(e),n=m.forwardRef((o,r)=>{let{children:s,...a}=o;Ks(s)&&typeof Sn=="function"&&(s=Sn(s._payload));const i=m.Children.toArray(s),p=i.find(Ou);if(p){const d=p.props.children,c=i.map(l=>l===p?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:l);return f.jsx(t,{...a,ref:r,children:m.isValidElement(d)?m.cloneElement(d,void 0,c):null})}return f.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Iu=qs("Slot");function Mu(e){const t=m.forwardRef((n,o)=>{let{children:r,...s}=n;if(Ks(r)&&typeof Sn=="function"&&(r=Sn(r._payload)),m.isValidElement(r)){const a=Lu(r),i=Du(s,r.props);return r.type!==m.Fragment&&(i.ref=o?He(o,a):a),m.cloneElement(r,i)}return m.Children.count(r)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Pu=Symbol("radix.slottable");function Ou(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Pu}function Du(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const p=s(...i);return r(...i),p}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Lu(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const $o=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Uo=Ss,Fu=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return Uo(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=t,a=Object.keys(r).map(d=>{const c=n==null?void 0:n[d],l=s==null?void 0:s[d];if(c===null)return null;const u=$o(c)||$o(l);return r[d][u]}),i=n&&Object.entries(n).reduce((d,c)=>{let[l,u]=c;return u===void 0||(d[l]=u),d},{}),p=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,c)=>{let{class:l,className:u,...h}=c;return Object.entries(h).every(g=>{let[v,w]=g;return Array.isArray(w)?w.includes({...s,...i}[v]):{...s,...i}[v]===w})?[...d,l,u]:d},[]);return Uo(e,a,p,n==null?void 0:n.class,n==null?void 0:n.className)},$u=Fu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function At({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?Iu:"button";return f.jsx(s,{"data-slot":"button",className:J($u({variant:t,size:n,className:e})),...r})}function ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Uu(e,t){const n=m.createContext(t),o=s=>{const{children:a,...i}=s,p=m.useMemo(()=>i,Object.values(i));return f.jsx(n.Provider,{value:p,children:a})};o.displayName=e+"Provider";function r(s){const a=m.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function Qe(e,t=[]){let n=[];function o(s,a){const i=m.createContext(a),p=n.length;n=[...n,a];const d=l=>{var y;const{scope:u,children:h,...g}=l,v=((y=u==null?void 0:u[e])==null?void 0:y[p])||i,w=m.useMemo(()=>g,Object.values(g));return f.jsx(v.Provider,{value:w,children:h})};d.displayName=s+"Provider";function c(l,u){var v;const h=((v=u==null?void 0:u[e])==null?void 0:v[p])||i,g=m.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${l}\` must be used within \`${s}\``)}return[d,c]}const r=()=>{const s=n.map(a=>m.createContext(a));return function(i){const p=(i==null?void 0:i[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...i,[e]:p}}),[i,p])}};return r.scopeName=e,[o,zu(r,...t)]}function zu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((i,{useScope:p,scopeName:d})=>{const l=p(s)[`__scope${d}`];return{...i,...l}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ke=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Bu=$r[" useInsertionEffect ".trim().toString()]||Ke;function at({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Hu({defaultProp:t,onChange:n}),i=e!==void 0,p=i?e:r;{const c=m.useRef(e!==void 0);m.useEffect(()=>{const l=c.current;l!==i&&console.warn(`${o} is changing from ${l?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=i},[i,o])}const d=m.useCallback(c=>{var l;if(i){const u=Wu(c)?c(e):c;u!==e&&((l=a.current)==null||l.call(a,u))}else s(c)},[i,e,s,a]);return[p,d]}function Hu({defaultProp:e,onChange:t}){const[n,o]=m.useState(e),r=m.useRef(n),s=m.useRef(t);return Bu(()=>{s.current=t},[t]),m.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,o,s]}function Wu(e){return typeof e=="function"}function Ot(e){const t=Gu(e),n=m.forwardRef((o,r)=>{const{children:s,...a}=o,i=m.Children.toArray(s),p=i.find(Ku);if(p){const d=p.props.children,c=i.map(l=>l===p?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:l);return f.jsx(t,{...a,ref:r,children:m.isValidElement(d)?m.cloneElement(d,void 0,c):null})}return f.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Gu(e){const t=m.forwardRef((n,o)=>{const{children:r,...s}=n;if(m.isValidElement(r)){const a=Xu(r),i=qu(s,r.props);return r.type!==m.Fragment&&(i.ref=o?He(o,a):a),m.cloneElement(r,i)}return m.Children.count(r)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xs=Symbol("radix.slottable");function Vu(e){const t=({children:n})=>f.jsx(f.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Xs,t}function Ku(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xs}function qu(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const p=s(...i);return r(...i),p}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Xu(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Yu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ue=Yu.reduce((e,t)=>{const n=Ot(`Primitive.${t}`),o=m.forwardRef((r,s)=>{const{asChild:a,...i}=r,p=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(p,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Ys(e,t){e&&ws.flushSync(()=>e.dispatchEvent(t))}function Qs(e){const t=e+"CollectionProvider",[n,o]=Qe(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:w,children:y}=v,_=rt.useRef(null),R=rt.useRef(new Map).current;return f.jsx(r,{scope:w,itemMap:R,collectionRef:_,children:y})};a.displayName=t;const i=e+"CollectionSlot",p=Ot(i),d=rt.forwardRef((v,w)=>{const{scope:y,children:_}=v,R=s(i,y),k=me(w,R.collectionRef);return f.jsx(p,{ref:k,children:_})});d.displayName=i;const c=e+"CollectionItemSlot",l="data-radix-collection-item",u=Ot(c),h=rt.forwardRef((v,w)=>{const{scope:y,children:_,...R}=v,k=rt.useRef(null),F=me(w,k),S=s(c,y);return rt.useEffect(()=>(S.itemMap.set(k,{ref:k,...R}),()=>void S.itemMap.delete(k))),f.jsx(u,{[l]:"",ref:F,children:_})});h.displayName=c;function g(v){const w=s(e+"CollectionConsumer",v);return rt.useCallback(()=>{const _=w.collectionRef.current;if(!_)return[];const R=Array.from(_.querySelectorAll(`[${l}]`));return Array.from(w.itemMap.values()).sort((S,j)=>R.indexOf(S.ref.current)-R.indexOf(j.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:d,ItemSlot:h},g,o]}var Qu=m.createContext(void 0);function Zs(e){const t=m.useContext(Qu);return e||t||"ltr"}function qe(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function Zu(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e);m.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Ju="DismissableLayer",Ar="dismissableLayer.update",ed="dismissableLayer.pointerDownOutside",td="dismissableLayer.focusOutside",zo,Js=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),rn=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...p}=e,d=m.useContext(Js),[c,l]=m.useState(null),u=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=m.useState({}),g=me(t,j=>l(j)),v=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(w),_=c?v.indexOf(c):-1,R=d.layersWithOutsidePointerEventsDisabled.size>0,k=_>=y,F=od(j=>{const x=j.target,b=[...d.branches].some(I=>I.contains(x));!k||b||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},u),S=sd(j=>{const x=j.target;[...d.branches].some(I=>I.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},u);return Zu(j=>{_===d.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},u),m.useEffect(()=>{if(c)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(zo=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(c)),d.layers.add(c),Bo(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=zo)}},[c,u,n,d]),m.useEffect(()=>()=>{c&&(d.layers.delete(c),d.layersWithOutsidePointerEventsDisabled.delete(c),Bo())},[c,d]),m.useEffect(()=>{const j=()=>h({});return document.addEventListener(Ar,j),()=>document.removeEventListener(Ar,j)},[]),f.jsx(ue.div,{...p,ref:g,style:{pointerEvents:R?k?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,F.onPointerDownCapture)})});rn.displayName=Ju;var nd="DismissableLayerBranch",rd=m.forwardRef((e,t)=>{const n=m.useContext(Js),o=m.useRef(null),r=me(t,o);return m.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),f.jsx(ue.div,{...e,ref:r})});rd.displayName=nd;function od(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),o=m.useRef(!1),r=m.useRef(()=>{});return m.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let p=function(){ea(ed,n,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=p,t.addEventListener("click",r.current,{once:!0})):p()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function sd(e,t=globalThis==null?void 0:globalThis.document){const n=qe(e),o=m.useRef(!1);return m.useEffect(()=>{const r=s=>{s.target&&!o.current&&ea(td,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Bo(){const e=new CustomEvent(Ar);document.dispatchEvent(e)}function ea(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?Ys(r,s):r.dispatchEvent(s)}var or=0;function Gr(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ho()),document.body.insertAdjacentElement("beforeend",e[1]??Ho()),or++,()=>{or===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),or--}},[])}function Ho(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var sr="focusScope.autoFocusOnMount",ar="focusScope.autoFocusOnUnmount",Wo={bubbles:!1,cancelable:!0},ad="FocusScope",Fn=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,p]=m.useState(null),d=qe(r),c=qe(s),l=m.useRef(null),u=me(t,v=>p(v)),h=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(o){let v=function(R){if(h.paused||!i)return;const k=R.target;i.contains(k)?l.current=k:ot(l.current,{select:!0})},w=function(R){if(h.paused||!i)return;const k=R.relatedTarget;k!==null&&(i.contains(k)||ot(l.current,{select:!0}))},y=function(R){if(document.activeElement===document.body)for(const F of R)F.removedNodes.length>0&&ot(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const _=new MutationObserver(y);return i&&_.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),_.disconnect()}}},[o,i,h.paused]),m.useEffect(()=>{if(i){Vo.add(h);const v=document.activeElement;if(!i.contains(v)){const y=new CustomEvent(sr,Wo);i.addEventListener(sr,d),i.dispatchEvent(y),y.defaultPrevented||(id(fd(ta(i)),{select:!0}),document.activeElement===v&&ot(i))}return()=>{i.removeEventListener(sr,d),setTimeout(()=>{const y=new CustomEvent(ar,Wo);i.addEventListener(ar,c),i.dispatchEvent(y),y.defaultPrevented||ot(v??document.body,{select:!0}),i.removeEventListener(ar,c),Vo.remove(h)},0)}}},[i,d,c,h]);const g=m.useCallback(v=>{if(!n&&!o||h.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,y=document.activeElement;if(w&&y){const _=v.currentTarget,[R,k]=ld(_);R&&k?!v.shiftKey&&y===k?(v.preventDefault(),n&&ot(R,{select:!0})):v.shiftKey&&y===R&&(v.preventDefault(),n&&ot(k,{select:!0})):y===_&&v.preventDefault()}},[n,o,h.paused]);return f.jsx(ue.div,{tabIndex:-1,...a,ref:u,onKeyDown:g})});Fn.displayName=ad;function id(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(ot(o,{select:t}),document.activeElement!==n)return}function ld(e){const t=ta(e),n=Go(t,e),o=Go(t.reverse(),e);return[n,o]}function ta(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Go(e,t){for(const n of e)if(!cd(n,{upTo:t}))return n}function cd(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ud(e){return e instanceof HTMLInputElement&&"select"in e}function ot(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ud(e)&&t&&e.select()}}var Vo=dd();function dd(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ko(e,t),e.unshift(t)},remove(t){var n;e=Ko(e,t),(n=e[0])==null||n.resume()}}}function Ko(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function fd(e){return e.filter(t=>t.tagName!=="A")}var pd=$r[" useId ".trim().toString()]||(()=>{}),md=0;function we(e){const[t,n]=m.useState(pd());return Ke(()=>{n(o=>o??String(md++))},[e]),e||(t?`radix-${t}`:"")}const hd=["top","right","bottom","left"],it=Math.min,ke=Math.max,En=Math.round,gn=Math.floor,Be=e=>({x:e,y:e}),gd={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e,t,n){return ke(e,it(t,n))}function Xe(e,t){return typeof e=="function"?e(t):e}function Ye(e){return e.split("-")[0]}function $t(e){return e.split("-")[1]}function Vr(e){return e==="x"?"y":"x"}function Kr(e){return e==="y"?"height":"width"}function ze(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qr(e){return Vr(ze(e))}function xd(e,t,n){n===void 0&&(n=!1);const o=$t(e),r=qr(e),s=Kr(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=An(a)),[a,An(a)]}function vd(e){const t=An(e);return[_r(e),t,_r(t)]}function _r(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const qo=["left","right"],Xo=["right","left"],bd=["top","bottom"],yd=["bottom","top"];function wd(e,t,n){switch(e){case"top":case"bottom":return n?t?Xo:qo:t?qo:Xo;case"left":case"right":return t?bd:yd;default:return[]}}function Cd(e,t,n,o){const r=$t(e);let s=wd(Ye(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(_r)))),s}function An(e){const t=Ye(e);return gd[t]+e.slice(t.length)}function Sd(e){return{top:0,right:0,bottom:0,left:0,...e}}function na(e){return typeof e!="number"?Sd(e):{top:e,right:e,bottom:e,left:e}}function kn(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Yo(e,t,n){let{reference:o,floating:r}=e;const s=ze(t),a=qr(t),i=Kr(a),p=Ye(t),d=s==="y",c=o.x+o.width/2-r.width/2,l=o.y+o.height/2-r.height/2,u=o[i]/2-r[i]/2;let h;switch(p){case"top":h={x:c,y:o.y-r.height};break;case"bottom":h={x:c,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:l};break;case"left":h={x:o.x-r.width,y:l};break;default:h={x:o.x,y:o.y}}switch($t(t)){case"start":h[a]-=u*(n&&d?-1:1);break;case"end":h[a]+=u*(n&&d?-1:1);break}return h}async function Ed(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:p}=e,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:l="floating",altBoundary:u=!1,padding:h=0}=Xe(t,e),g=na(h),w=i[u?l==="floating"?"reference":"floating":l],y=kn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:d,rootBoundary:c,strategy:p})),_=l==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),k=await(s.isElement==null?void 0:s.isElement(R))?await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1}:{x:1,y:1},F=kn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:R,strategy:p}):_);return{top:(y.top-F.top+g.top)/k.y,bottom:(F.bottom-y.bottom+g.bottom)/k.y,left:(y.left-F.left+g.left)/k.x,right:(F.right-y.right+g.right)/k.x}}const Ad=50,kd=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:Ed},p=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:l}=Yo(d,o,p),u=o,h=0;const g={};for(let v=0;v<s.length;v++){const w=s[v];if(!w)continue;const{name:y,fn:_}=w,{x:R,y:k,data:F,reset:S}=await _({x:c,y:l,initialPlacement:o,placement:u,strategy:r,middlewareData:g,rects:d,platform:i,elements:{reference:e,floating:t}});c=R??c,l=k??l,g[y]={...g[y],...F},S&&h<Ad&&(h++,typeof S=="object"&&(S.placement&&(u=S.placement),S.rects&&(d=S.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):S.rects),{x:c,y:l}=Yo(d,u,p)),v=-1)}return{x:c,y:l,placement:u,strategy:r,middlewareData:g}},_d=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:p}=t,{element:d,padding:c=0}=Xe(e,t)||{};if(d==null)return{};const l=na(c),u={x:n,y:o},h=qr(r),g=Kr(h),v=await a.getDimensions(d),w=h==="y",y=w?"top":"left",_=w?"bottom":"right",R=w?"clientHeight":"clientWidth",k=s.reference[g]+s.reference[h]-u[h]-s.floating[g],F=u[h]-s.reference[h],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let j=S?S[R]:0;(!j||!await(a.isElement==null?void 0:a.isElement(S)))&&(j=i.floating[R]||s.floating[g]);const x=k/2-F/2,b=j/2-v[g]/2-1,I=it(l[y],b),O=it(l[_],b),P=I,$=j-v[g]-O,M=j/2-v[g]/2+x,U=kr(P,M,$),E=!p.arrow&&$t(r)!=null&&M!==U&&s.reference[g]/2-(M<P?I:O)-v[g]/2<0,C=E?M<P?M-P:M-$:0;return{[h]:u[h]+C,data:{[h]:U,centerOffset:M-U-C,...E&&{alignmentOffset:C}},reset:E}}}),Rd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:p,elements:d}=t,{mainAxis:c=!0,crossAxis:l=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...w}=Xe(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Ye(r),_=ze(i),R=Ye(i)===i,k=await(p.isRTL==null?void 0:p.isRTL(d.floating)),F=u||(R||!v?[An(i)]:vd(i)),S=g!=="none";!u&&S&&F.push(...Cd(i,v,g,k));const j=[i,...F],x=await p.detectOverflow(t,w),b=[];let I=((o=s.flip)==null?void 0:o.overflows)||[];if(c&&b.push(x[y]),l){const M=xd(r,a,k);b.push(x[M[0]],x[M[1]])}if(I=[...I,{placement:r,overflows:b}],!b.every(M=>M<=0)){var O,P;const M=(((O=s.flip)==null?void 0:O.index)||0)+1,U=j[M];if(U&&(!(l==="alignment"?_!==ze(U):!1)||I.every(D=>ze(D.placement)===_?D.overflows[0]>0:!0)))return{data:{index:M,overflows:I},reset:{placement:U}};let E=(P=I.filter(C=>C.overflows[0]<=0).sort((C,D)=>C.overflows[1]-D.overflows[1])[0])==null?void 0:P.placement;if(!E)switch(h){case"bestFit":{var $;const C=($=I.filter(D=>{if(S){const A=ze(D.placement);return A===_||A==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(A=>A>0).reduce((A,T)=>A+T,0)]).sort((D,A)=>D[1]-A[1])[0])==null?void 0:$[0];C&&(E=C);break}case"initialPlacement":E=i;break}if(r!==E)return{reset:{placement:E}}}return{}}}};function Qo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zo(e){return hd.some(t=>e[t]>=0)}const jd=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=Xe(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=Qo(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Zo(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=Qo(a,n.floating);return{data:{escapedOffsets:i,escaped:Zo(i)}}}default:return{}}}}},ra=new Set(["left","top"]);async function Nd(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=Ye(n),i=$t(n),p=ze(n)==="y",d=ra.has(a)?-1:1,c=s&&p?-1:1,l=Xe(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:g}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),p?{x:h*c,y:u*d}:{x:u*d,y:h*c}}const Td=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:i}=t,p=await Nd(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+p.x,y:s+p.y,data:{...p,placement:a}}}}},Id=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:p={fn:y=>{let{x:_,y:R}=y;return{x:_,y:R}}},...d}=Xe(e,t),c={x:n,y:o},l=await s.detectOverflow(t,d),u=ze(Ye(r)),h=Vr(u);let g=c[h],v=c[u];if(a){const y=h==="y"?"top":"left",_=h==="y"?"bottom":"right",R=g+l[y],k=g-l[_];g=kr(R,g,k)}if(i){const y=u==="y"?"top":"left",_=u==="y"?"bottom":"right",R=v+l[y],k=v-l[_];v=kr(R,v,k)}const w=p.fn({...t,[h]:g,[u]:v});return{...w,data:{x:w.x-n,y:w.y-o,enabled:{[h]:a,[u]:i}}}}}},Md=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:p=!0,crossAxis:d=!0}=Xe(e,t),c={x:n,y:o},l=ze(r),u=Vr(l);let h=c[u],g=c[l];const v=Xe(i,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(p){const R=u==="y"?"height":"width",k=s.reference[u]-s.floating[R]+w.mainAxis,F=s.reference[u]+s.reference[R]-w.mainAxis;h<k?h=k:h>F&&(h=F)}if(d){var y,_;const R=u==="y"?"width":"height",k=ra.has(Ye(r)),F=s.reference[l]-s.floating[R]+(k&&((y=a.offset)==null?void 0:y[l])||0)+(k?0:w.crossAxis),S=s.reference[l]+s.reference[R]+(k?0:((_=a.offset)==null?void 0:_[l])||0)-(k?w.crossAxis:0);g<F?g=F:g>S&&(g=S)}return{[u]:h,[l]:g}}}},Pd=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:i}=t,{apply:p=()=>{},...d}=Xe(e,t),c=await a.detectOverflow(t,d),l=Ye(r),u=$t(r),h=ze(r)==="y",{width:g,height:v}=s.floating;let w,y;l==="top"||l==="bottom"?(w=l,y=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(y=l,w=u==="end"?"top":"bottom");const _=v-c.top-c.bottom,R=g-c.left-c.right,k=it(v-c[w],_),F=it(g-c[y],R),S=!t.middlewareData.shift;let j=k,x=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=R),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=_),S&&!u){const I=ke(c.left,0),O=ke(c.right,0),P=ke(c.top,0),$=ke(c.bottom,0);h?x=g-2*(I!==0||O!==0?I+O:ke(c.left,c.right)):j=v-2*(P!==0||$!==0?P+$:ke(c.top,c.bottom))}await p({...t,availableWidth:x,availableHeight:j});const b=await a.getDimensions(i.floating);return g!==b.width||v!==b.height?{reset:{rects:!0}}:{}}}};function $n(){return typeof window<"u"}function Ut(e){return oa(e)?(e.nodeName||"").toLowerCase():"#document"}function _e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function We(e){var t;return(t=(oa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function oa(e){return $n()?e instanceof Node||e instanceof _e(e).Node:!1}function Pe(e){return $n()?e instanceof Element||e instanceof _e(e).Element:!1}function Ze(e){return $n()?e instanceof HTMLElement||e instanceof _e(e).HTMLElement:!1}function Jo(e){return!$n()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _e(e).ShadowRoot}function on(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Od(e){return/^(table|td|th)$/.test(Ut(e))}function Un(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Dd=/transform|translate|scale|rotate|perspective|filter/,Ld=/paint|layout|strict|content/,vt=e=>!!e&&e!=="none";let ir;function Xr(e){const t=Pe(e)?Oe(e):e;return vt(t.transform)||vt(t.translate)||vt(t.scale)||vt(t.rotate)||vt(t.perspective)||!Yr()&&(vt(t.backdropFilter)||vt(t.filter))||Dd.test(t.willChange||"")||Ld.test(t.contain||"")}function Fd(e){let t=lt(e);for(;Ze(t)&&!Dt(t);){if(Xr(t))return t;if(Un(t))return null;t=lt(t)}return null}function Yr(){return ir==null&&(ir=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ir}function Dt(e){return/^(html|body|#document)$/.test(Ut(e))}function Oe(e){return _e(e).getComputedStyle(e)}function zn(e){return Pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lt(e){if(Ut(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Jo(e)&&e.host||We(e);return Jo(t)?t.host:t}function sa(e){const t=lt(e);return Dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ze(t)&&on(t)?t:sa(t)}function Yt(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=sa(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=_e(r);if(s){const i=Rr(a);return t.concat(a,a.visualViewport||[],on(r)?r:[],i&&n?Yt(i):[])}else return t.concat(r,Yt(r,[],n))}function Rr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aa(e){const t=Oe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Ze(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=En(n)!==s||En(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function Qr(e){return Pe(e)?e:e.contextElement}function Mt(e){const t=Qr(e);if(!Ze(t))return Be(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=aa(t);let a=(s?En(n.width):n.width)/o,i=(s?En(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const $d=Be(0);function ia(e){const t=_e(e);return!Yr()||!t.visualViewport?$d:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ud(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_e(e)?!1:t}function wt(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=Qr(e);let a=Be(1);t&&(o?Pe(o)&&(a=Mt(o)):a=Mt(e));const i=Ud(s,n,o)?ia(s):Be(0);let p=(r.left+i.x)/a.x,d=(r.top+i.y)/a.y,c=r.width/a.x,l=r.height/a.y;if(s){const u=_e(s),h=o&&Pe(o)?_e(o):o;let g=u,v=Rr(g);for(;v&&o&&h!==g;){const w=Mt(v),y=v.getBoundingClientRect(),_=Oe(v),R=y.left+(v.clientLeft+parseFloat(_.paddingLeft))*w.x,k=y.top+(v.clientTop+parseFloat(_.paddingTop))*w.y;p*=w.x,d*=w.y,c*=w.x,l*=w.y,p+=R,d+=k,g=_e(v),v=Rr(g)}}return kn({width:c,height:l,x:p,y:d})}function Bn(e,t){const n=zn(e).scrollLeft;return t?t.left+n:wt(We(e)).left+n}function la(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Bn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function zd(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=We(o),i=t?Un(t.floating):!1;if(o===a||i&&s)return n;let p={scrollLeft:0,scrollTop:0},d=Be(1);const c=Be(0),l=Ze(o);if((l||!l&&!s)&&((Ut(o)!=="body"||on(a))&&(p=zn(o)),l)){const h=wt(o);d=Mt(o),c.x=h.x+o.clientLeft,c.y=h.y+o.clientTop}const u=a&&!l&&!s?la(a,p):Be(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-p.scrollLeft*d.x+c.x+u.x,y:n.y*d.y-p.scrollTop*d.y+c.y+u.y}}function Bd(e){return Array.from(e.getClientRects())}function Hd(e){const t=We(e),n=zn(e),o=e.ownerDocument.body,r=ke(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=ke(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Bn(e);const i=-n.scrollTop;return Oe(o).direction==="rtl"&&(a+=ke(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const es=25;function Wd(e,t){const n=_e(e),o=We(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,p=0;if(r){s=r.width,a=r.height;const c=Yr();(!c||c&&t==="fixed")&&(i=r.offsetLeft,p=r.offsetTop)}const d=Bn(o);if(d<=0){const c=o.ownerDocument,l=c.body,u=getComputedStyle(l),h=c.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,g=Math.abs(o.clientWidth-l.clientWidth-h);g<=es&&(s-=g)}else d<=es&&(s+=d);return{width:s,height:a,x:i,y:p}}function Gd(e,t){const n=wt(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=Ze(e)?Mt(e):Be(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,p=r*s.x,d=o*s.y;return{width:a,height:i,x:p,y:d}}function ts(e,t,n){let o;if(t==="viewport")o=Wd(e,n);else if(t==="document")o=Hd(We(e));else if(Pe(t))o=Gd(t,n);else{const r=ia(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return kn(o)}function ca(e,t){const n=lt(e);return n===t||!Pe(n)||Dt(n)?!1:Oe(n).position==="fixed"||ca(n,t)}function Vd(e,t){const n=t.get(e);if(n)return n;let o=Yt(e,[],!1).filter(i=>Pe(i)&&Ut(i)!=="body"),r=null;const s=Oe(e).position==="fixed";let a=s?lt(e):e;for(;Pe(a)&&!Dt(a);){const i=Oe(a),p=Xr(a);!p&&i.position==="fixed"&&(r=null),(s?!p&&!r:!p&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||on(a)&&!p&&ca(e,a))?o=o.filter(c=>c!==a):r=i,a=lt(a)}return t.set(e,o),o}function Kd(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Un(t)?[]:Vd(t,this._c):[].concat(n),o],i=ts(t,a[0],r);let p=i.top,d=i.right,c=i.bottom,l=i.left;for(let u=1;u<a.length;u++){const h=ts(t,a[u],r);p=ke(h.top,p),d=it(h.right,d),c=it(h.bottom,c),l=ke(h.left,l)}return{width:d-l,height:c-p,x:l,y:p}}function qd(e){const{width:t,height:n}=aa(e);return{width:t,height:n}}function Xd(e,t,n){const o=Ze(t),r=We(t),s=n==="fixed",a=wt(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const p=Be(0);function d(){p.x=Bn(r)}if(o||!o&&!s)if((Ut(t)!=="body"||on(r))&&(i=zn(t)),o){const h=wt(t,!0,s,t);p.x=h.x+t.clientLeft,p.y=h.y+t.clientTop}else r&&d();s&&!o&&r&&d();const c=r&&!o&&!s?la(r,i):Be(0),l=a.left+i.scrollLeft-p.x-c.x,u=a.top+i.scrollTop-p.y-c.y;return{x:l,y:u,width:a.width,height:a.height}}function lr(e){return Oe(e).position==="static"}function ns(e,t){if(!Ze(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return We(e)===n&&(n=n.ownerDocument.body),n}function ua(e,t){const n=_e(e);if(Un(e))return n;if(!Ze(e)){let r=lt(e);for(;r&&!Dt(r);){if(Pe(r)&&!lr(r))return r;r=lt(r)}return n}let o=ns(e,t);for(;o&&Od(o)&&lr(o);)o=ns(o,t);return o&&Dt(o)&&lr(o)&&!Xr(o)?n:o||Fd(e)||n}const Yd=async function(e){const t=this.getOffsetParent||ua,n=this.getDimensions,o=await n(e.floating);return{reference:Xd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Qd(e){return Oe(e).direction==="rtl"}const Zd={convertOffsetParentRelativeRectToViewportRelativeRect:zd,getDocumentElement:We,getClippingRect:Kd,getOffsetParent:ua,getElementRects:Yd,getClientRects:Bd,getDimensions:qd,getScale:Mt,isElement:Pe,isRTL:Qd};function da(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Jd(e,t){let n=null,o;const r=We(e);function s(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function a(i,p){i===void 0&&(i=!1),p===void 0&&(p=1),s();const d=e.getBoundingClientRect(),{left:c,top:l,width:u,height:h}=d;if(i||t(),!u||!h)return;const g=gn(l),v=gn(r.clientWidth-(c+u)),w=gn(r.clientHeight-(l+h)),y=gn(c),R={rootMargin:-g+"px "+-v+"px "+-w+"px "+-y+"px",threshold:ke(0,it(1,p))||1};let k=!0;function F(S){const j=S[0].intersectionRatio;if(j!==p){if(!k)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!da(d,e.getBoundingClientRect())&&a(),k=!1}try{n=new IntersectionObserver(F,{...R,root:r.ownerDocument})}catch{n=new IntersectionObserver(F,R)}n.observe(e)}return a(!0),s}function ef(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:p=!1}=o,d=Qr(e),c=r||s?[...d?Yt(d):[],...t?Yt(t):[]]:[];c.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const l=d&&i?Jd(d,n):null;let u=-1,h=null;a&&(h=new ResizeObserver(y=>{let[_]=y;_&&_.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var R;(R=h)==null||R.observe(t)})),n()}),d&&!p&&h.observe(d),t&&h.observe(t));let g,v=p?wt(e):null;p&&w();function w(){const y=wt(e);v&&!da(v,y)&&n(),v=y,g=requestAnimationFrame(w)}return n(),()=>{var y;c.forEach(_=>{r&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),l==null||l(),(y=h)==null||y.disconnect(),h=null,p&&cancelAnimationFrame(g)}}const tf=Td,nf=Id,rf=Rd,of=Pd,sf=jd,rs=_d,af=Md,lf=(e,t,n)=>{const o=new Map,r={platform:Zd,...n},s={...r.platform,_c:o};return kd(e,t,{...r,platform:s})};var cf=typeof document<"u",uf=function(){},yn=cf?m.useLayoutEffect:uf;function _n(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!_n(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!_n(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function fa(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function os(e,t){const n=fa(e);return Math.round(t*n)/n}function cr(e){const t=m.useRef(e);return yn(()=>{t.current=e}),t}function df(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:p,open:d}=e,[c,l]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,h]=m.useState(o);_n(u,o)||h(o);const[g,v]=m.useState(null),[w,y]=m.useState(null),_=m.useCallback(D=>{D!==S.current&&(S.current=D,v(D))},[]),R=m.useCallback(D=>{D!==j.current&&(j.current=D,y(D))},[]),k=s||g,F=a||w,S=m.useRef(null),j=m.useRef(null),x=m.useRef(c),b=p!=null,I=cr(p),O=cr(r),P=cr(d),$=m.useCallback(()=>{if(!S.current||!j.current)return;const D={placement:t,strategy:n,middleware:u};O.current&&(D.platform=O.current),lf(S.current,j.current,D).then(A=>{const T={...A,isPositioned:P.current!==!1};M.current&&!_n(x.current,T)&&(x.current=T,ws.flushSync(()=>{l(T)}))})},[u,t,n,O,P]);yn(()=>{d===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,l(D=>({...D,isPositioned:!1})))},[d]);const M=m.useRef(!1);yn(()=>(M.current=!0,()=>{M.current=!1}),[]),yn(()=>{if(k&&(S.current=k),F&&(j.current=F),k&&F){if(I.current)return I.current(k,F,$);$()}},[k,F,$,I,b]);const U=m.useMemo(()=>({reference:S,floating:j,setReference:_,setFloating:R}),[_,R]),E=m.useMemo(()=>({reference:k,floating:F}),[k,F]),C=m.useMemo(()=>{const D={position:n,left:0,top:0};if(!E.floating)return D;const A=os(E.floating,c.x),T=os(E.floating,c.y);return i?{...D,transform:"translate("+A+"px, "+T+"px)",...fa(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:T}},[n,i,E.floating,c.x,c.y]);return m.useMemo(()=>({...c,update:$,refs:U,elements:E,floatingStyles:C}),[c,$,U,E,C])}const ff=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?rs({element:o.current,padding:r}).fn(n):{}:o?rs({element:o,padding:r}).fn(n):{}}}},pf=(e,t)=>{const n=tf(e);return{name:n.name,fn:n.fn,options:[e,t]}},mf=(e,t)=>{const n=nf(e);return{name:n.name,fn:n.fn,options:[e,t]}},hf=(e,t)=>({fn:af(e).fn,options:[e,t]}),gf=(e,t)=>{const n=rf(e);return{name:n.name,fn:n.fn,options:[e,t]}},xf=(e,t)=>{const n=of(e);return{name:n.name,fn:n.fn,options:[e,t]}},vf=(e,t)=>{const n=sf(e);return{name:n.name,fn:n.fn,options:[e,t]}},bf=(e,t)=>{const n=ff(e);return{name:n.name,fn:n.fn,options:[e,t]}};var yf="Arrow",pa=m.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return f.jsx(ue.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});pa.displayName=yf;var wf=pa;function Cf(e){const[t,n]=m.useState(void 0);return Ke(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,i;if("borderBoxSize"in s){const p=s.borderBoxSize,d=Array.isArray(p)?p[0]:p;a=d.inlineSize,i=d.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Zr="Popper",[ma,zt]=Qe(Zr),[Sf,ha]=ma(Zr),ga=e=>{const{__scopePopper:t,children:n}=e,[o,r]=m.useState(null);return f.jsx(Sf,{scope:t,anchor:o,onAnchorChange:r,children:n})};ga.displayName=Zr;var xa="PopperAnchor",va=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=ha(xa,n),a=m.useRef(null),i=me(t,a),p=m.useRef(null);return m.useEffect(()=>{const d=p.current;p.current=(o==null?void 0:o.current)||a.current,d!==p.current&&s.onAnchorChange(p.current)}),o?null:f.jsx(ue.div,{...r,ref:i})});va.displayName=xa;var Jr="PopperContent",[Ef,Af]=ma(Jr),ba=m.forwardRef((e,t)=>{var V,Y,K,ne,ae,le;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:p=!0,collisionBoundary:d=[],collisionPadding:c=0,sticky:l="partial",hideWhenDetached:u=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,w=ha(Jr,n),[y,_]=m.useState(null),R=me(t,pe=>_(pe)),[k,F]=m.useState(null),S=Cf(k),j=(S==null?void 0:S.width)??0,x=(S==null?void 0:S.height)??0,b=o+(s!=="center"?"-"+s:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},O=Array.isArray(d)?d:[d],P=O.length>0,$={padding:I,boundary:O.filter(_f),altBoundary:P},{refs:M,floatingStyles:U,placement:E,isPositioned:C,middlewareData:D}=df({strategy:"fixed",placement:b,whileElementsMounted:(...pe)=>ef(...pe,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[pf({mainAxis:r+x,alignmentAxis:a}),p&&mf({mainAxis:!0,crossAxis:!1,limiter:l==="partial"?hf():void 0,...$}),p&&gf({...$}),xf({...$,apply:({elements:pe,rects:W,availableWidth:q,availableHeight:Z})=>{const{width:te,height:ie}=W.reference,re=pe.floating.style;re.setProperty("--radix-popper-available-width",`${q}px`),re.setProperty("--radix-popper-available-height",`${Z}px`),re.setProperty("--radix-popper-anchor-width",`${te}px`),re.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),k&&bf({element:k,padding:i}),Rf({arrowWidth:j,arrowHeight:x}),u&&vf({strategy:"referenceHidden",...$})]}),[A,T]=Ca(E),H=qe(g);Ke(()=>{C&&(H==null||H())},[C,H]);const N=(V=D.arrow)==null?void 0:V.x,B=(Y=D.arrow)==null?void 0:Y.y,z=((K=D.arrow)==null?void 0:K.centerOffset)!==0,[L,G]=m.useState();return Ke(()=>{y&&G(window.getComputedStyle(y).zIndex)},[y]),f.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:C?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:L,"--radix-popper-transform-origin":[(ne=D.transformOrigin)==null?void 0:ne.x,(ae=D.transformOrigin)==null?void 0:ae.y].join(" "),...((le=D.hide)==null?void 0:le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(Ef,{scope:n,placedSide:A,onArrowChange:F,arrowX:N,arrowY:B,shouldHideArrow:z,children:f.jsx(ue.div,{"data-side":A,"data-align":T,...v,ref:R,style:{...v.style,animation:C?void 0:"none"}})})})});ba.displayName=Jr;var ya="PopperArrow",kf={top:"bottom",right:"left",bottom:"top",left:"right"},wa=m.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=Af(ya,o),a=kf[s.placedSide];return f.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:f.jsx(wf,{...r,ref:n,style:{...r.style,display:"block"}})})});wa.displayName=ya;function _f(e){return e!==null}var Rf=e=>({name:"transformOrigin",options:e,fn(t){var w,y,_;const{placement:n,rects:o,middlewareData:r}=t,a=((w=r.arrow)==null?void 0:w.centerOffset)!==0,i=a?0:e.arrowWidth,p=a?0:e.arrowHeight,[d,c]=Ca(n),l={start:"0%",center:"50%",end:"100%"}[c],u=(((y=r.arrow)==null?void 0:y.x)??0)+i/2,h=(((_=r.arrow)==null?void 0:_.y)??0)+p/2;let g="",v="";return d==="bottom"?(g=a?l:`${u}px`,v=`${-p}px`):d==="top"?(g=a?l:`${u}px`,v=`${o.floating.height+p}px`):d==="right"?(g=`${-p}px`,v=a?l:`${h}px`):d==="left"&&(g=`${o.floating.width+p}px`,v=a?l:`${h}px`),{data:{x:g,y:v}}}});function Ca(e){const[t,n="center"]=e.split("-");return[t,n]}var eo=ga,Hn=va,to=ba,no=wa,jf="Portal",sn=m.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=m.useState(!1);Ke(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?jl.createPortal(f.jsx(ue.div,{...o,ref:t}),a):null});sn.displayName=jf;function Nf(e,t){return m.useReducer((n,o)=>t[n][o]??n,e)}var je=e=>{const{present:t,children:n}=e,o=Tf(t),r=typeof n=="function"?n({present:o.isPresent}):m.Children.only(n),s=me(o.ref,If(r));return typeof n=="function"||o.isPresent?m.cloneElement(r,{ref:s}):null};je.displayName="Presence";function Tf(e){const[t,n]=m.useState(),o=m.useRef(null),r=m.useRef(e),s=m.useRef("none"),a=e?"mounted":"unmounted",[i,p]=Nf(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const d=xn(o.current);s.current=i==="mounted"?d:"none"},[i]),Ke(()=>{const d=o.current,c=r.current;if(c!==e){const u=s.current,h=xn(d);e?p("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?p("UNMOUNT"):p(c&&u!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,p]),Ke(()=>{if(t){let d;const c=t.ownerDocument.defaultView??window,l=h=>{const v=xn(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(p("ANIMATION_END"),!r.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},u=h=>{h.target===t&&(s.current=xn(o.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{c.clearTimeout(d),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:m.useCallback(d=>{o.current=d?getComputedStyle(d):null,n(d)},[])}}function xn(e){return(e==null?void 0:e.animationName)||"none"}function If(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ur="rovingFocusGroup.onEntryFocus",Mf={bubbles:!1,cancelable:!0},an="RovingFocusGroup",[jr,Sa,Pf]=Qs(an),[Of,Ea]=Qe(an,[Pf]),[Df,Lf]=Of(an),Aa=m.forwardRef((e,t)=>f.jsx(jr.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(jr.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Ff,{...e,ref:t})})}));Aa.displayName=an;var Ff=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:p,onEntryFocus:d,preventScrollOnEntryFocus:c=!1,...l}=e,u=m.useRef(null),h=me(t,u),g=Zs(s),[v,w]=at({prop:a,defaultProp:i??null,onChange:p,caller:an}),[y,_]=m.useState(!1),R=qe(d),k=Sa(n),F=m.useRef(!1),[S,j]=m.useState(0);return m.useEffect(()=>{const x=u.current;if(x)return x.addEventListener(ur,R),()=>x.removeEventListener(ur,R)},[R]),f.jsx(Df,{scope:n,orientation:o,dir:g,loop:r,currentTabStopId:v,onItemFocus:m.useCallback(x=>w(x),[w]),onItemShiftTab:m.useCallback(()=>_(!0),[]),onFocusableItemAdd:m.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:m.useCallback(()=>j(x=>x-1),[]),children:f.jsx(ue.div,{tabIndex:y||S===0?-1:0,"data-orientation":o,...l,ref:h,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{F.current=!0}),onFocus:ee(e.onFocus,x=>{const b=!F.current;if(x.target===x.currentTarget&&b&&!y){const I=new CustomEvent(ur,Mf);if(x.currentTarget.dispatchEvent(I),!I.defaultPrevented){const O=k().filter(E=>E.focusable),P=O.find(E=>E.active),$=O.find(E=>E.id===v),U=[P,$,...O].filter(Boolean).map(E=>E.ref.current);Ra(U,c)}}F.current=!1}),onBlur:ee(e.onBlur,()=>_(!1))})})}),ka="RovingFocusGroupItem",_a=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,p=we(),d=s||p,c=Lf(ka,n),l=c.currentTabStopId===d,u=Sa(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=c;return m.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),f.jsx(jr.ItemSlot,{scope:n,id:d,focusable:o,active:r,children:f.jsx(ue.span,{tabIndex:l?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:ee(e.onMouseDown,w=>{o?c.onItemFocus(d):w.preventDefault()}),onFocus:ee(e.onFocus,()=>c.onItemFocus(d)),onKeyDown:ee(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){c.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const y=zf(w,c.orientation,c.dir);if(y!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let R=u().filter(k=>k.focusable).map(k=>k.ref.current);if(y==="last")R.reverse();else if(y==="prev"||y==="next"){y==="prev"&&R.reverse();const k=R.indexOf(w.currentTarget);R=c.loop?Bf(R,k+1):R.slice(k+1)}setTimeout(()=>Ra(R))}}),children:typeof a=="function"?a({isCurrentTabStop:l,hasTabStop:v!=null}):a})})});_a.displayName=ka;var $f={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Uf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zf(e,t,n){const o=Uf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return $f[o]}function Ra(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Bf(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Hf=Aa,Wf=_a,Gf=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},jt=new WeakMap,vn=new WeakMap,bn={},dr=0,ja=function(e){return e&&(e.host||ja(e.parentNode))},Vf=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=ja(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Kf=function(e,t,n,o){var r=Vf(t,Array.isArray(e)?e:[e]);bn[n]||(bn[n]=new WeakMap);var s=bn[n],a=[],i=new Set,p=new Set(r),d=function(l){!l||i.has(l)||(i.add(l),d(l.parentNode))};r.forEach(d);var c=function(l){!l||p.has(l)||Array.prototype.forEach.call(l.children,function(u){if(i.has(u))c(u);else try{var h=u.getAttribute(o),g=h!==null&&h!=="false",v=(jt.get(u)||0)+1,w=(s.get(u)||0)+1;jt.set(u,v),s.set(u,w),a.push(u),v===1&&g&&vn.set(u,!0),w===1&&u.setAttribute(n,"true"),g||u.setAttribute(o,"true")}catch(y){console.error("aria-hidden: cannot operate on ",u,y)}})};return c(t),i.clear(),dr++,function(){a.forEach(function(l){var u=jt.get(l)-1,h=s.get(l)-1;jt.set(l,u),s.set(l,h),u||(vn.has(l)||l.removeAttribute(o),vn.delete(l)),h||l.removeAttribute(n)}),dr--,dr||(jt=new WeakMap,jt=new WeakMap,vn=new WeakMap,bn={})}},ro=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Gf(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Kf(o,r,n,"aria-hidden")):function(){return null}},Nr=["Enter"," "],qf=["ArrowDown","PageUp","Home"],Na=["ArrowUp","PageDown","End"],Xf=[...qf,...Na],Yf={ltr:[...Nr,"ArrowRight"],rtl:[...Nr,"ArrowLeft"]},Qf={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ln="Menu",[Qt,Zf,Jf]=Qs(ln),[kt,Ta]=Qe(ln,[Jf,zt,Ea]),Wn=zt(),Ia=Ea(),[ep,_t]=kt(ln),[tp,cn]=kt(ln),Ma=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=Wn(t),[p,d]=m.useState(null),c=m.useRef(!1),l=qe(s),u=Zs(r);return m.useEffect(()=>{const h=()=>{c.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>c.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),f.jsx(eo,{...i,children:f.jsx(ep,{scope:t,open:n,onOpenChange:l,content:p,onContentChange:d,children:f.jsx(tp,{scope:t,onClose:m.useCallback(()=>l(!1),[l]),isUsingKeyboardRef:c,dir:u,modal:a,children:o})})})};Ma.displayName=ln;var np="MenuAnchor",oo=m.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Wn(n);return f.jsx(Hn,{...r,...o,ref:t})});oo.displayName=np;var so="MenuPortal",[rp,Pa]=kt(so,{forceMount:void 0}),Oa=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=_t(so,t);return f.jsx(rp,{scope:t,forceMount:n,children:f.jsx(je,{present:n||s.open,children:f.jsx(sn,{asChild:!0,container:r,children:o})})})};Oa.displayName=so;var Te="MenuContent",[op,ao]=kt(Te),Da=m.forwardRef((e,t)=>{const n=Pa(Te,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=_t(Te,e.__scopeMenu),a=cn(Te,e.__scopeMenu);return f.jsx(Qt.Provider,{scope:e.__scopeMenu,children:f.jsx(je,{present:o||s.open,children:f.jsx(Qt.Slot,{scope:e.__scopeMenu,children:a.modal?f.jsx(sp,{...r,ref:t}):f.jsx(ap,{...r,ref:t})})})})}),sp=m.forwardRef((e,t)=>{const n=_t(Te,e.__scopeMenu),o=m.useRef(null),r=me(t,o);return m.useEffect(()=>{const s=o.current;if(s)return ro(s)},[]),f.jsx(io,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ap=m.forwardRef((e,t)=>{const n=_t(Te,e.__scopeMenu);return f.jsx(io,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ip=Ot("MenuContent.ScrollLock"),io=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:p,onEscapeKeyDown:d,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:h,disableOutsideScroll:g,...v}=e,w=_t(Te,n),y=cn(Te,n),_=Wn(n),R=Ia(n),k=Zf(n),[F,S]=m.useState(null),j=m.useRef(null),x=me(t,j,w.onContentChange),b=m.useRef(0),I=m.useRef(""),O=m.useRef(0),P=m.useRef(null),$=m.useRef("right"),M=m.useRef(0),U=g?Ur:m.Fragment,E=g?{as:ip,allowPinchZoom:!0}:void 0,C=A=>{var V,Y;const T=I.current+A,H=k().filter(K=>!K.disabled),N=document.activeElement,B=(V=H.find(K=>K.ref.current===N))==null?void 0:V.textValue,z=H.map(K=>K.textValue),L=bp(z,T,B),G=(Y=H.find(K=>K.textValue===L))==null?void 0:Y.ref.current;(function K(ne){I.current=ne,window.clearTimeout(b.current),ne!==""&&(b.current=window.setTimeout(()=>K(""),1e3))})(T),G&&setTimeout(()=>G.focus())};m.useEffect(()=>()=>window.clearTimeout(b.current),[]),Gr();const D=m.useCallback(A=>{var H,N;return $.current===((H=P.current)==null?void 0:H.side)&&wp(A,(N=P.current)==null?void 0:N.area)},[]);return f.jsx(op,{scope:n,searchRef:I,onItemEnter:m.useCallback(A=>{D(A)&&A.preventDefault()},[D]),onItemLeave:m.useCallback(A=>{var T;D(A)||((T=j.current)==null||T.focus(),S(null))},[D]),onTriggerLeave:m.useCallback(A=>{D(A)&&A.preventDefault()},[D]),pointerGraceTimerRef:O,onPointerGraceIntentChange:m.useCallback(A=>{P.current=A},[]),children:f.jsx(U,{...E,children:f.jsx(Fn,{asChild:!0,trapped:r,onMountAutoFocus:ee(s,A=>{var T;A.preventDefault(),(T=j.current)==null||T.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:f.jsx(rn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:d,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,onDismiss:h,children:f.jsx(Hf,{asChild:!0,...R,dir:y.dir,orientation:"vertical",loop:o,currentTabStopId:F,onCurrentTabStopIdChange:S,onEntryFocus:ee(p,A=>{y.isUsingKeyboardRef.current||A.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(to,{role:"menu","aria-orientation":"vertical","data-state":Za(w.open),"data-radix-menu-content":"",dir:y.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:ee(v.onKeyDown,A=>{const H=A.target.closest("[data-radix-menu-content]")===A.currentTarget,N=A.ctrlKey||A.altKey||A.metaKey,B=A.key.length===1;H&&(A.key==="Tab"&&A.preventDefault(),!N&&B&&C(A.key));const z=j.current;if(A.target!==z||!Xf.includes(A.key))return;A.preventDefault();const G=k().filter(V=>!V.disabled).map(V=>V.ref.current);Na.includes(A.key)&&G.reverse(),xp(G)}),onBlur:ee(e.onBlur,A=>{A.currentTarget.contains(A.target)||(window.clearTimeout(b.current),I.current="")}),onPointerMove:ee(e.onPointerMove,Zt(A=>{const T=A.target,H=M.current!==A.clientX;if(A.currentTarget.contains(T)&&H){const N=A.clientX>M.current?"right":"left";$.current=N,M.current=A.clientX}}))})})})})})})});Da.displayName=Te;var lp="MenuGroup",lo=m.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return f.jsx(ue.div,{role:"group",...o,ref:t})});lo.displayName=lp;var cp="MenuLabel",La=m.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return f.jsx(ue.div,{...o,ref:t})});La.displayName=cp;var Rn="MenuItem",ss="menu.itemSelect",Gn=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=m.useRef(null),a=cn(Rn,e.__scopeMenu),i=ao(Rn,e.__scopeMenu),p=me(t,s),d=m.useRef(!1),c=()=>{const l=s.current;if(!n&&l){const u=new CustomEvent(ss,{bubbles:!0,cancelable:!0});l.addEventListener(ss,h=>o==null?void 0:o(h),{once:!0}),Ys(l,u),u.defaultPrevented?d.current=!1:a.onClose()}};return f.jsx(Fa,{...r,ref:p,disabled:n,onClick:ee(e.onClick,c),onPointerDown:l=>{var u;(u=e.onPointerDown)==null||u.call(e,l),d.current=!0},onPointerUp:ee(e.onPointerUp,l=>{var u;d.current||(u=l.currentTarget)==null||u.click()}),onKeyDown:ee(e.onKeyDown,l=>{const u=i.searchRef.current!=="";n||u&&l.key===" "||Nr.includes(l.key)&&(l.currentTarget.click(),l.preventDefault())})})});Gn.displayName=Rn;var Fa=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=ao(Rn,n),i=Ia(n),p=m.useRef(null),d=me(t,p),[c,l]=m.useState(!1),[u,h]=m.useState("");return m.useEffect(()=>{const g=p.current;g&&h((g.textContent??"").trim())},[s.children]),f.jsx(Qt.ItemSlot,{scope:n,disabled:o,textValue:r??u,children:f.jsx(Wf,{asChild:!0,...i,focusable:!o,children:f.jsx(ue.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:d,onPointerMove:ee(e.onPointerMove,Zt(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ee(e.onPointerLeave,Zt(g=>a.onItemLeave(g))),onFocus:ee(e.onFocus,()=>l(!0)),onBlur:ee(e.onBlur,()=>l(!1))})})})}),up="MenuCheckboxItem",$a=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return f.jsx(Wa,{scope:e.__scopeMenu,checked:n,children:f.jsx(Gn,{role:"menuitemcheckbox","aria-checked":jn(n)?"mixed":n,...r,ref:t,"data-state":uo(n),onSelect:ee(r.onSelect,()=>o==null?void 0:o(jn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});$a.displayName=up;var Ua="MenuRadioGroup",[dp,fp]=kt(Ua,{value:void 0,onValueChange:()=>{}}),za=m.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=qe(o);return f.jsx(dp,{scope:e.__scopeMenu,value:n,onValueChange:s,children:f.jsx(lo,{...r,ref:t})})});za.displayName=Ua;var Ba="MenuRadioItem",Ha=m.forwardRef((e,t)=>{const{value:n,...o}=e,r=fp(Ba,e.__scopeMenu),s=n===r.value;return f.jsx(Wa,{scope:e.__scopeMenu,checked:s,children:f.jsx(Gn,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":uo(s),onSelect:ee(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});Ha.displayName=Ba;var co="MenuItemIndicator",[Wa,pp]=kt(co,{checked:!1}),Ga=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=pp(co,n);return f.jsx(je,{present:o||jn(s.checked)||s.checked===!0,children:f.jsx(ue.span,{...r,ref:t,"data-state":uo(s.checked)})})});Ga.displayName=co;var mp="MenuSeparator",Va=m.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return f.jsx(ue.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});Va.displayName=mp;var hp="MenuArrow",Ka=m.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=Wn(n);return f.jsx(no,{...r,...o,ref:t})});Ka.displayName=hp;var gp="MenuSub",[lv,qa]=kt(gp),qt="MenuSubTrigger",Xa=m.forwardRef((e,t)=>{const n=_t(qt,e.__scopeMenu),o=cn(qt,e.__scopeMenu),r=qa(qt,e.__scopeMenu),s=ao(qt,e.__scopeMenu),a=m.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:p}=s,d={__scopeMenu:e.__scopeMenu},c=m.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return m.useEffect(()=>c,[c]),m.useEffect(()=>{const l=i.current;return()=>{window.clearTimeout(l),p(null)}},[i,p]),f.jsx(oo,{asChild:!0,...d,children:f.jsx(Fa,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Za(n.open),...e,ref:He(t,r.onTriggerChange),onClick:l=>{var u;(u=e.onClick)==null||u.call(e,l),!(e.disabled||l.defaultPrevented)&&(l.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ee(e.onPointerMove,Zt(l=>{s.onItemEnter(l),!l.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),c()},100))})),onPointerLeave:ee(e.onPointerLeave,Zt(l=>{var h,g;c();const u=(h=n.content)==null?void 0:h.getBoundingClientRect();if(u){const v=(g=n.content)==null?void 0:g.dataset.side,w=v==="right",y=w?-5:5,_=u[w?"left":"right"],R=u[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:l.clientX+y,y:l.clientY},{x:_,y:u.top},{x:R,y:u.top},{x:R,y:u.bottom},{x:_,y:u.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(l),l.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ee(e.onKeyDown,l=>{var h;const u=s.searchRef.current!=="";e.disabled||u&&l.key===" "||Yf[o.dir].includes(l.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),l.preventDefault())})})})});Xa.displayName=qt;var Ya="MenuSubContent",Qa=m.forwardRef((e,t)=>{const n=Pa(Te,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=_t(Te,e.__scopeMenu),a=cn(Te,e.__scopeMenu),i=qa(Ya,e.__scopeMenu),p=m.useRef(null),d=me(t,p);return f.jsx(Qt.Provider,{scope:e.__scopeMenu,children:f.jsx(je,{present:o||s.open,children:f.jsx(Qt.Slot,{scope:e.__scopeMenu,children:f.jsx(io,{id:i.contentId,"aria-labelledby":i.triggerId,...r,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:c=>{var l;a.isUsingKeyboardRef.current&&((l=p.current)==null||l.focus()),c.preventDefault()},onCloseAutoFocus:c=>c.preventDefault(),onFocusOutside:ee(e.onFocusOutside,c=>{c.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ee(e.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:ee(e.onKeyDown,c=>{var h;const l=c.currentTarget.contains(c.target),u=Qf[a.dir].includes(c.key);l&&u&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),c.preventDefault())})})})})})});Qa.displayName=Ya;function Za(e){return e?"open":"closed"}function jn(e){return e==="indeterminate"}function uo(e){return jn(e)?"indeterminate":e?"checked":"unchecked"}function xp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function vp(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function bp(e,t,n){const r=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=vp(e,Math.max(s,0));r.length===1&&(a=a.filter(d=>d!==n));const p=a.find(d=>d.toLowerCase().startsWith(r.toLowerCase()));return p!==n?p:void 0}function yp(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],p=t[a],d=i.x,c=i.y,l=p.x,u=p.y;c>o!=u>o&&n<(l-d)*(o-c)/(u-c)+d&&(r=!r)}return r}function wp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return yp(n,t)}function Zt(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Cp=Ma,Sp=oo,Ep=Oa,Ap=Da,kp=lo,_p=La,Rp=Gn,jp=$a,Np=za,Tp=Ha,Ip=Ga,Mp=Va,Pp=Ka,Op=Xa,Dp=Qa,Vn="DropdownMenu",[Lp]=Qe(Vn,[Ta]),Ce=Ta(),[Fp,Ja]=Lp(Vn),ei=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,p=Ce(t),d=m.useRef(null),[c,l]=at({prop:r,defaultProp:s??!1,onChange:a,caller:Vn});return f.jsx(Fp,{scope:t,triggerId:we(),triggerRef:d,contentId:we(),open:c,onOpenChange:l,onOpenToggle:m.useCallback(()=>l(u=>!u),[l]),modal:i,children:f.jsx(Cp,{...p,open:c,onOpenChange:l,dir:o,modal:i,children:n})})};ei.displayName=Vn;var ti="DropdownMenuTrigger",ni=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=Ja(ti,n),a=Ce(n);return f.jsx(Sp,{asChild:!0,...a,children:f.jsx(ue.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:He(t,s.triggerRef),onPointerDown:ee(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:ee(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});ni.displayName=ti;var $p="DropdownMenuPortal",ri=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ce(t);return f.jsx(Ep,{...o,...n})};ri.displayName=$p;var oi="DropdownMenuContent",si=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ja(oi,n),s=Ce(n),a=m.useRef(!1);return f.jsx(Ap,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:ee(e.onCloseAutoFocus,i=>{var p;a.current||(p=r.triggerRef.current)==null||p.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ee(e.onInteractOutside,i=>{const p=i.detail.originalEvent,d=p.button===0&&p.ctrlKey===!0,c=p.button===2||d;(!r.modal||c)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});si.displayName=oi;var Up="DropdownMenuGroup",zp=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(kp,{...r,...o,ref:t})});zp.displayName=Up;var Bp="DropdownMenuLabel",Hp=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(_p,{...r,...o,ref:t})});Hp.displayName=Bp;var Wp="DropdownMenuItem",ai=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Rp,{...r,...o,ref:t})});ai.displayName=Wp;var Gp="DropdownMenuCheckboxItem",Vp=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(jp,{...r,...o,ref:t})});Vp.displayName=Gp;var Kp="DropdownMenuRadioGroup",qp=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Np,{...r,...o,ref:t})});qp.displayName=Kp;var Xp="DropdownMenuRadioItem",Yp=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Tp,{...r,...o,ref:t})});Yp.displayName=Xp;var Qp="DropdownMenuItemIndicator",Zp=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Ip,{...r,...o,ref:t})});Zp.displayName=Qp;var Jp="DropdownMenuSeparator",em=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Mp,{...r,...o,ref:t})});em.displayName=Jp;var tm="DropdownMenuArrow",nm=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Pp,{...r,...o,ref:t})});nm.displayName=tm;var rm="DropdownMenuSubTrigger",om=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Op,{...r,...o,ref:t})});om.displayName=rm;var sm="DropdownMenuSubContent",am=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ce(n);return f.jsx(Dp,{...r,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});am.displayName=sm;var im=ei,lm=ni,cm=ri,um=si,dm=ai;function fm({...e}){return f.jsx(im,{"data-slot":"dropdown-menu",...e})}function pm({...e}){return f.jsx(lm,{"data-slot":"dropdown-menu-trigger",...e})}function mm({className:e,sideOffset:t=4,...n}){return f.jsx(cm,{children:f.jsx(um,{"data-slot":"dropdown-menu-content",sideOffset:t,className:J("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function hm({className:e,inset:t,variant:n="default",...o}){return f.jsx(dm,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:J("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o})}const gm=[{value:"light",label:"Light",icon:f.jsx(Ws,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:f.jsx(zs,{className:"h-4 w-4"})},{value:"system",label:"System",icon:f.jsx(Jc,{className:"h-4 w-4"})}];function xm(){const{theme:e,setTheme:t,resolvedTheme:n}=Ru();return f.jsxs(fm,{children:[f.jsx(pm,{asChild:!0,children:f.jsxs(At,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?f.jsx(zs,{className:"h-4 w-4"}):f.jsx(Ws,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),f.jsx(mm,{align:"end",children:gm.map(o=>f.jsxs(hm,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,f.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}function vm({sessionTitle:e,sessionSource:t,onBack:n}){return f.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:f.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[e?f.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[f.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[f.jsx(Lc,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),f.jsx("span",{className:"text-text-muted/40",children:"/"}),f.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&f.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):f.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[f.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:f.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),f.jsx("span",{className:"hidden sm:inline",children:"Remote Control"})]}),f.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&f.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:"Dashboard",children:[f.jsx(qc,{className:"h-4 w-4"}),f.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),f.jsx(xm,{})]})]})})}function cv({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return f.jsx("span",{className:J("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}const bm="";let Nn=null;function ym(e){Nn=e}function uv(){return Nn}class fr extends Error{constructor(n,o,r){super(n);se(this,"type");se(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function De(e,t,n){const o={"Content-Type":"application/json"};Nn&&(o.Authorization=`Bearer ${Nn}`);const r=`${bm}${t}`,s={method:e,headers:o,credentials:"include"};n!==void 0&&(s.body=JSON.stringify(n));const a=await fetch(r,s);let i;try{i=await a.json()}catch{throw a.ok?new fr("Invalid JSON response","parse_error",a.status):new fr(a.statusText,"http_error",a.status)}if(!a.ok){const d=i.error||{type:"unknown",message:a.statusText};throw new fr(d.message||d.type||"unknown",d.type||"unknown",a.status)}return i}function dv(e){return De("POST","/web/bind",{sessionId:e})}function fv(){return De("GET","/web/sessions/all")}function pv(e){return De("GET",`/web/sessions/${e}`)}function mv(e){return De("GET",`/web/sessions/${e}/history`)}function hv(){return De("GET","/web/environments")}function gv(e,t){return De("POST",`/web/sessions/${e}/events`,t)}function xv(e,t){return De("POST",`/web/sessions/${e}/control`,t)}function vv(e){return De("POST",`/web/sessions/${e}/interrupt`)}function bv(e){return De("DELETE",`/web/sessions/${e}`)}function yv(e){return De("POST","/web/sessions",e)}function wv(e){return De("GET",`/web/sessions/s/${e}`)}function wm(e){const t=new TextEncoder().encode(e);let n="";for(const r of t)n+=String.fromCharCode(r);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class ii extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const st=class st{constructor(t){se(this,"ws",null);se(this,"settings");se(this,"connectionState","disconnected");se(this,"sessionId",null);se(this,"_agentCapabilities",null);se(this,"_promptCapabilities",null);se(this,"_modelState",null);se(this,"_availableCommands",[]);se(this,"onModelChanged",new Set);se(this,"onModelStateChanged",new Set);se(this,"onAvailableCommandsChanged",null);se(this,"onSessionLoaded",null);se(this,"onSessionSwitching",null);se(this,"onConnectionStateChange",new Set);se(this,"onSessionUpdate",null);se(this,"onSessionCreated",null);se(this,"onPromptComplete",null);se(this,"onPermissionRequest",null);se(this,"onBrowserToolCall",null);se(this,"onErrorMessage",null);se(this,"onSessionDeleted",null);se(this,"onSessionRenamed",null);se(this,"pendingSessionList",null);se(this,"pendingSessionLoad",null);se(this,"pendingSessionResume",null);se(this,"pendingSessionTarget",null);se(this,"connectResolve",null);se(this,"connectReject",null);se(this,"heartbeatInterval",null);se(this,"heartbeatTimeout",null);se(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const o of this.onConnectionStateChange)o(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const o=new WebSocket(this.settings.proxyUrl,this.settings.token?[wm(this.settings.token)]:void 0);this.ws=o,o.onopen=()=>{if(this.ws!==o){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),o.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},o.onmessage=r=>{if(this.ws===o)try{const s=JSON.parse(r.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},o.onerror=()=>{var r;this.ws===o&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},o.onclose=r=>{if(this.ws===o){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const s=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(o){this.setState("error",o.message),n(o)}})}handleResponse(t){var n,o,r,s,a,i,p,d,c,l,u,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((o=t.payload)==null?void 0:o.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const y of this.onModelStateChanged)y(this._modelState);break;case"session_deleted":(p=this.onSessionDeleted)==null||p.call(this,t.payload.sessionId);break;case"session_renamed":(d=this.onSessionRenamed)==null||d.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const w=(c=t.payload.update)==null?void 0:c.sessionUpdate;console.log("[ACPClient] session_update type:",w,"payload:",t.payload),w==="available_commands_update"&&(this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(l=this.onAvailableCommandsChanged)==null||l.call(this,this._availableCommands)),(u=this.onSessionUpdate)==null||u.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(g=this.onPermissionRequest)==null||g.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const y of this.onModelChanged)y(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const o=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:o})}catch(o){console.error("[ACPClient] Browser tool error:",o),this.send({type:"browser_tool_result",callId:t,result:{error:o.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=st.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},st.PONG_TIMEOUT_MS)},st.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const o=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:o,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const o=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:o}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,o)=>{const r=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,o(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:o,timer:r};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(r),this.pendingSessionList=null,o(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:o,timer:r};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,o(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:o,timer:r};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionResume=null,o(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new ii),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const o of this.onModelStateChanged)o(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]);const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};se(st,"HEARTBEAT_INTERVAL_MS",3e4),se(st,"PONG_TIMEOUT_MS",1e4),se(st,"MAX_MISSED_PONGS",2);let Tr=st;function Cm(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(o){if(o!=="default"&&!(o in e)){var r=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return n[o]}})}}))})),Object.freeze(e)}function li(e,t){return new Promise((function(n,o){let r;return Sm(e).then((function(s){try{return r=s,n(new Blob([t.slice(0,2),r,t.slice(2)],{type:"image/jpeg"}))}catch(a){return o(a)}}),o)}))}const Sm=e=>new Promise(((t,n)=>{const o=new FileReader;o.addEventListener("load",(({target:{result:r}})=>{const s=new DataView(r);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const p=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const d=a+10;let c;switch(s.getUint16(d)){case 18761:c=!0;break;case 19789:c=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(d+2,c)!==42)return n("TIFF header contains invalid version");const l=s.getUint32(d+4,c),u=d+l+2+12*s.getUint16(d+l,c);for(let h=d+l+2;h<u;h+=12)if(s.getUint16(h,c)==274){if(s.getUint16(h+2,c)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,c)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,c);break}return t(r.slice(a,a+2+p))}a+=2+p}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Tn={},Em={get exports(){return Tn},set exports(e){Tn=e}};(function(e){var t,n,o={};Em.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,p=0,d={},c=new Uint8Array(r),l=c.length-4;i(c,l)!=101010256;)l--;p=l,p+=4;var u=a(c,p+=4);a(c,p+=2);var h=i(c,p+=2),g=i(c,p+=4);p+=4,p=g;for(var v=0;v<u;v++){i(c,p),p+=4,p+=4,p+=4,i(c,p+=4),h=i(c,p+=4);var w=i(c,p+=4),y=a(c,p+=4),_=a(c,p+2),R=a(c,p+4);p+=6;var k=i(c,p+=8);p+=4,p+=y+_+R,o._readLocal(c,k,d,h,w,s)}return d},o._readLocal=function(r,s,a,i,p,d){var c=o.bin.readUshort,l=o.bin.readUint;l(r,s),c(r,s+=4),c(r,s+=2);var u=c(r,s+=2);l(r,s+=2),l(r,s+=4),s+=4;var h=c(r,s+=8),g=c(r,s+=2);s+=2;var v=o.bin.readUTF8(r,s,h);if(s+=h,s+=g,d)a[v]={size:p,csize:i};else{var w=new Uint8Array(r.buffer,s);if(u==0)a[v]=new Uint8Array(w.buffer.slice(s,s+i));else{if(u!=8)throw"unknown compression method: "+u;var y=new Uint8Array(p);o.inflateRaw(w,y),a[v]=y}}},o.inflateRaw=function(r,s){return o.F.inflate(r,s)},o.inflate=function(r,s){return r[0],r[1],o.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),s)},o.deflate=function(r,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=o.F.deflateRaw(r,i,a,s.level);var p=o.adler(r,0,r.length);return i[a+0]=p>>>24&255,i[a+1]=p>>>16&255,i[a+2]=p>>>8&255,i[a+3]=p>>>0&255,new Uint8Array(i.buffer,0,a+4)},o.deflateRaw=function(r,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=o.F.deflateRaw(r,a,i,s.level);return new Uint8Array(a.buffer,0,i)},o.encode=function(r,s){s==null&&(s=!1);var a=0,i=o.bin.writeUint,p=o.bin.writeUshort,d={};for(var c in r){var l=!o._noNeed(c)&&!s,u=r[c],h=o.crc.crc(u,0,u.length);d[c]={cpr:l,usize:u.length,crc:h,file:l?o.deflateRaw(u):u}}for(var c in d)a+=d[c].file.length+30+46+2*o.bin.sizeUTF8(c);a+=22;var g=new Uint8Array(a),v=0,w=[];for(var c in d){var y=d[c];w.push(v),v=o._writeHeader(g,v,c,y,0)}var _=0,R=v;for(var c in d)y=d[c],w.push(v),v=o._writeHeader(g,v,c,y,1,w[_++]);var k=v-R;return i(g,v,101010256),v+=4,p(g,v+=4,_),p(g,v+=2,_),i(g,v+=2,k),i(g,v+=4,R),v+=4,v+=2,g.buffer},o._noNeed=function(r){var s=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},o._writeHeader=function(r,s,a,i,p,d){var c=o.bin.writeUint,l=o.bin.writeUshort,u=i.file;return c(r,s,p==0?67324752:33639248),s+=4,p==1&&(s+=2),l(r,s,20),l(r,s+=2,0),l(r,s+=2,i.cpr?8:0),c(r,s+=2,0),c(r,s+=4,i.crc),c(r,s+=4,u.length),c(r,s+=4,i.usize),l(r,s+=4,o.bin.sizeUTF8(a)),l(r,s+=2,0),s+=2,p==1&&(s+=2,s+=2,c(r,s+=6,d),s+=4),s+=o.bin.writeUTF8(r,s,a),p==0&&(r.set(u,s),s+=u.length),s},o.crc={table:(function(){for(var r=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[s]=a}return r})(),update:function(r,s,a,i){for(var p=0;p<i;p++)r=o.crc.table[255&(r^s[a+p])]^r>>>8;return r},crc:function(r,s,a){return 4294967295^o.crc.update(4294967295,r,s,a)}},o.adler=function(r,s,a){for(var i=1,p=0,d=s,c=s+a;d<c;){for(var l=Math.min(d+5552,c);d<l;)p+=i+=r[d++];i%=65521,p%=65521}return p<<16|i},o.bin={readUshort:function(r,s){return r[s]|r[s+1]<<8},writeUshort:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255},readUint:function(r,s){return 16777216*r[s+3]+(r[s+2]<<16|r[s+1]<<8|r[s])},writeUint:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255,r[s+2]=a>>16&255,r[s+3]=a>>24&255},readASCII:function(r,s,a){for(var i="",p=0;p<a;p++)i+=String.fromCharCode(r[s+p]);return i},writeASCII:function(r,s,a){for(var i=0;i<a.length;i++)r[s+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,s,a){for(var i,p="",d=0;d<a;d++)p+="%"+o.bin.pad(r[s+d].toString(16));try{i=decodeURIComponent(p)}catch{return o.bin.readASCII(r,s,a)}return i},writeUTF8:function(r,s,a){for(var i=a.length,p=0,d=0;d<i;d++){var c=a.charCodeAt(d);if((4294967168&c)==0)r[s+p]=c,p++;else if((4294965248&c)==0)r[s+p]=192|c>>6,r[s+p+1]=128|c>>0&63,p+=2;else if((4294901760&c)==0)r[s+p]=224|c>>12,r[s+p+1]=128|c>>6&63,r[s+p+2]=128|c>>0&63,p+=3;else{if((4292870144&c)!=0)throw"e";r[s+p]=240|c>>18,r[s+p+1]=128|c>>12&63,r[s+p+2]=128|c>>6&63,r[s+p+3]=128|c>>0&63,p+=4}}return p},sizeUTF8:function(r){for(var s=r.length,a=0,i=0;i<s;i++){var p=r.charCodeAt(i);if((4294967168&p)==0)a++;else if((4294965248&p)==0)a+=2;else if((4294901760&p)==0)a+=3;else{if((4292870144&p)!=0)throw"e";a+=4}}return a}},o.F={},o.F.deflateRaw=function(r,s,a,i){var p=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],d=o.F.U,c=o.F._goodIndex;o.F._hash;var l=o.F._putsE,u=0,h=a<<3,g=0,v=r.length;if(i==0){for(;u<v;)l(s,h,u+(O=Math.min(65535,v-u))==v?1:0),h=o.F._copyExact(r,u,O,s,h+8),u+=O;return h>>>3}var w=d.lits,y=d.strt,_=d.prev,R=0,k=0,F=0,S=0,j=0,x=0;for(v>2&&(y[x=o.F._hash(r,0)]=0),u=0;u<v;u++){if(j=x,u+1<v-2){x=o.F._hash(r,u+1);var b=u+1&32767;_[b]=y[x],y[x]=b}if(g<=u){(R>14e3||k>26697)&&v-u>100&&(g<u&&(w[R]=u-g,R+=2,g=u),h=o.F._writeBlock(u==v-1||g==v?1:0,w,R,S,r,F,u-F,s,h),R=k=S=0,F=u);var I=0;u<v-2&&(I=o.F._bestMatch(r,u,_,j,Math.min(p[2],v-u),p[3]));var O=I>>>16,P=65535&I;if(I!=0){P=65535&I;var $=c(O=I>>>16,d.of0);d.lhst[257+$]++;var M=c(P,d.df0);d.dhst[M]++,S+=d.exb[$]+d.dxb[M],w[R]=O<<23|u-g,w[R+1]=P<<16|$<<8|M,R+=2,g=u+O}else d.lhst[r[u]]++;k++}}for(F==u&&r.length!=0||(g<u&&(w[R]=u-g,R+=2,g=u),h=o.F._writeBlock(1,w,R,S,r,F,u-F,s,h),R=0,k=0,R=k=S=0,F=u);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,p,d){var c=32767&s,l=a[c],u=c-l+32768&32767;if(l==c||i!=o.F._hash(r,s-u))return 0;for(var h=0,g=0,v=Math.min(32767,s);u<=v&&--d!=0&&l!=c;){if(h==0||r[s+h]==r[s+h-u]){var w=o.F._howLong(r,s,u);if(w>h){if(g=u,(h=w)>=p)break;u+2<w&&(w=u+2);for(var y=0,_=0;_<w-2;_++){var R=s-u+_+32768&32767,k=R-a[R]+32768&32767;k>y&&(y=k,l=R)}}}u+=(c=l)-(l=a[c])+32768&32767}return h<<16|g},o.F._howLong=function(r,s,a){if(r[s]!=r[s-a]||r[s+1]!=r[s+1-a]||r[s+2]!=r[s+2-a])return 0;var i=s,p=Math.min(r.length,s+258);for(s+=3;s<p&&r[s]==r[s-a];)s++;return s-i},o.F._hash=function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<4)&65535},o.saved=0,o.F._writeBlock=function(r,s,a,i,p,d,c,l,u){var h,g,v,w,y,_,R,k,F,S=o.F.U,j=o.F._putsF,x=o.F._putsE;S.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],w=h[2],y=h[3],_=h[4],R=h[5],k=h[6],F=h[7];var b=32+((u+3&7)==0?0:8-(u+3&7))+(c<<3),I=i+o.F.contSize(S.fltree,S.lhst)+o.F.contSize(S.fdtree,S.dhst),O=i+o.F.contSize(S.ltree,S.lhst)+o.F.contSize(S.dtree,S.dhst);O+=14+3*R+o.F.contSize(S.itree,S.ihst)+(2*S.ihst[16]+3*S.ihst[17]+7*S.ihst[18]);for(var P=0;P<286;P++)S.lhst[P]=0;for(P=0;P<30;P++)S.dhst[P]=0;for(P=0;P<19;P++)S.ihst[P]=0;var $=b<I&&b<O?0:I<O?1:2;if(j(l,u,r),j(l,u+1,$),u+=3,$==0){for(;(7&u)!=0;)u++;u=o.F._copyExact(p,d,c,l,u)}else{var M,U;if($==1&&(M=S.fltree,U=S.fdtree),$==2){o.F.makeCodes(S.ltree,g),o.F.revCodes(S.ltree,g),o.F.makeCodes(S.dtree,v),o.F.revCodes(S.dtree,v),o.F.makeCodes(S.itree,w),o.F.revCodes(S.itree,w),M=S.ltree,U=S.dtree,x(l,u,y-257),x(l,u+=5,_-1),x(l,u+=5,R-4),u+=4;for(var E=0;E<R;E++)x(l,u+3*E,S.itree[1+(S.ordr[E]<<1)]);u+=3*R,u=o.F._codeTiny(k,S.itree,l,u),u=o.F._codeTiny(F,S.itree,l,u)}for(var C=d,D=0;D<a;D+=2){for(var A=s[D],T=A>>>23,H=C+(8388607&A);C<H;)u=o.F._writeLit(p[C++],M,l,u);if(T!=0){var N=s[D+1],B=N>>16,z=N>>8&255,L=255&N;x(l,u=o.F._writeLit(257+z,M,l,u),T-S.of0[z]),u+=S.exb[z],j(l,u=o.F._writeLit(L,U,l,u),B-S.df0[L]),u+=S.dxb[L],C+=T}}u=o.F._writeLit(256,M,l,u)}return u},o.F._copyExact=function(r,s,a,i,p){var d=p>>>3;return i[d]=a,i[d+1]=a>>>8,i[d+2]=255-i[d],i[d+3]=255-i[d+1],d+=4,i.set(new Uint8Array(r.buffer,s,a),d),p+(a+4<<3)},o.F.getTrees=function(){for(var r=o.F.U,s=o.F._hufTree(r.lhst,r.ltree,15),a=o.F._hufTree(r.dhst,r.dtree,15),i=[],p=o.F._lenCodes(r.ltree,i),d=[],c=o.F._lenCodes(r.dtree,d),l=0;l<i.length;l+=2)r.ihst[i[l]]++;for(l=0;l<d.length;l+=2)r.ihst[d[l]]++;for(var u=o.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[s,a,u,p,c,h,i,d]},o.F.getSecond=function(r){for(var s=[],a=0;a<r.length;a+=2)s.push(r[a+1]);return s},o.F.nonZero=function(r){for(var s="",a=0;a<r.length;a+=2)r[a+1]!=0&&(s+=(a>>1)+",");return s},o.F.contSize=function(r,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*r[1+(i<<1)];return a},o.F._codeTiny=function(r,s,a,i){for(var p=0;p<r.length;p+=2){var d=r[p],c=r[p+1];i=o.F._writeLit(d,s,a,i);var l=d==16?2:d==17?3:7;d>15&&(o.F._putsE(a,i,c,l),i+=l)}return i},o.F._lenCodes=function(r,s){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var p=r[i+1],d=i+3<a?r[i+3]:-1,c=i+5<a?r[i+5]:-1,l=i==0?-1:r[i-1];if(p==0&&d==p&&c==p){for(var u=i+5;u+2<a&&r[u+2]==p;)u+=2;(h=Math.min(u+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(p==l&&d==p&&c==p){for(u=i+5;u+2<a&&r[u+2]==p;)u+=2;var h=Math.min(u+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(p,0)}return a>>>1},o.F._hufTree=function(r,s,a){var i=[],p=r.length,d=s.length,c=0;for(c=0;c<d;c+=2)s[c]=0,s[c+1]=0;for(c=0;c<p;c++)r[c]!=0&&i.push({lit:c,f:r[c]});var l=i.length,u=i.slice(0);if(l==0)return 0;if(l==1){var h=i[0].lit;return u=h==0?1:0,s[1+(h<<1)]=1,s[1+(u<<1)]=1,1}i.sort((function(k,F){return k.f-F.f}));var g=i[0],v=i[1],w=0,y=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};y!=l-1;)g=w!=y&&(_==l||i[w].f<i[_].f)?i[w++]:i[_++],v=w!=y&&(_==l||i[w].f<i[_].f)?i[w++]:i[_++],i[y++]={lit:-1,f:g.f+v.f,l:g,r:v};var R=o.F.setDepth(i[y-1],0);for(R>a&&(o.F.restrictDepth(u,a,R),R=a),c=0;c<l;c++)s[1+(u[c].lit<<1)]=u[c].d;return R},o.F.setDepth=function(r,s){return r.lit!=-1?(r.d=s,s):Math.max(o.F.setDepth(r.l,s+1),o.F.setDepth(r.r,s+1))},o.F.restrictDepth=function(r,s,a){var i=0,p=1<<a-s,d=0;for(r.sort((function(l,u){return u.d==l.d?l.f-u.f:u.d-l.d})),i=0;i<r.length&&r[i].d>s;i++){var c=r[i].d;r[i].d=s,d+=p-(1<<a-c)}for(d>>>=a-s;d>0;)(c=r[i].d)<s?(r[i].d++,d-=1<<s-c-1):i++;for(;i>=0;i--)r[i].d==s&&d<0&&(r[i].d--,d++);d!=0&&console.log("debt left")},o.F._goodIndex=function(r,s){var a=0;return s[16|a]<=r&&(a|=16),s[8|a]<=r&&(a|=8),s[4|a]<=r&&(a|=4),s[2|a]<=r&&(a|=2),s[1|a]<=r&&(a|=1),a},o.F._writeLit=function(r,s,a,i){return o.F._putsF(a,i,s[r<<1]),i+s[1+(r<<1)]},o.F.inflate=function(r,s){var a=Uint8Array;if(r[0]==3&&r[1]==0)return s||new a(0);var i=o.F,p=i._bitsF,d=i._bitsE,c=i._decodeTiny,l=i.makeCodes,u=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var w,y,_=0,R=0,k=0,F=0,S=0,j=0,x=0,b=0,I=0;_==0;)if(_=p(r,I,1),R=p(r,I+1,2),I+=3,R!=0){if(v&&(s=o.F._check(s,b+(1<<17))),R==1&&(w=g.flmap,y=g.fdmap,j=511,x=31),R==2){k=d(r,I,5)+257,F=d(r,I+5,5)+1,S=d(r,I+10,4)+4,I+=14;for(var O=0;O<38;O+=2)g.itree[O]=0,g.itree[O+1]=0;var P=1;for(O=0;O<S;O++){var $=d(r,I+3*O,3);g.itree[1+(g.ordr[O]<<1)]=$,$>P&&(P=$)}I+=3*S,l(g.itree,P),u(g.itree,P,g.imap),w=g.lmap,y=g.dmap,I=c(g.imap,(1<<P)-1,k+F,r,I,g.ttree);var M=i._copyOut(g.ttree,0,k,g.ltree);j=(1<<M)-1;var U=i._copyOut(g.ttree,k,F,g.dtree);x=(1<<U)-1,l(g.ltree,M),u(g.ltree,M,w),l(g.dtree,U),u(g.dtree,U,y)}for(;;){var E=w[h(r,I)&j];I+=15&E;var C=E>>>4;if(!(C>>>8))s[b++]=C;else{if(C==256)break;var D=b+C-254;if(C>264){var A=g.ldef[C-257];D=b+(A>>>3)+d(r,I,7&A),I+=7&A}var T=y[h(r,I)&x];I+=15&T;var H=T>>>4,N=g.ddef[H],B=(N>>>4)+p(r,I,15&N);for(I+=15&N,v&&(s=o.F._check(s,b+(1<<17)));b<D;)s[b]=s[b++-B],s[b]=s[b++-B],s[b]=s[b++-B],s[b]=s[b++-B];b=D}}}else{(7&I)!=0&&(I+=8-(7&I));var z=4+(I>>>3),L=r[z-4]|r[z-3]<<8;v&&(s=o.F._check(s,b+L)),s.set(new a(r.buffer,r.byteOffset+z,L),b),I=z+L<<3,b+=L}return s.length==b?s:s.slice(0,b)},o.F._check=function(r,s){var a=r.length;if(s<=a)return r;var i=new Uint8Array(Math.max(a<<1,s));return i.set(r,0),i},o.F._decodeTiny=function(r,s,a,i,p,d){for(var c=o.F._bitsE,l=o.F._get17,u=0;u<a;){var h=r[l(i,p)&s];p+=15&h;var g=h>>>4;if(g<=15)d[u]=g,u++;else{var v=0,w=0;g==16?(w=3+c(i,p,2),p+=2,v=d[u-1]):g==17?(w=3+c(i,p,3),p+=3):g==18&&(w=11+c(i,p,7),p+=7);for(var y=u+w;u<y;)d[u]=v,u++}}return p},o.F._copyOut=function(r,s,a,i){for(var p=0,d=0,c=i.length>>>1;d<a;){var l=r[d+s];i[d<<1]=0,i[1+(d<<1)]=l,l>p&&(p=l),d++}for(;d<c;)i[d<<1]=0,i[1+(d<<1)]=0,d++;return p},o.F.makeCodes=function(r,s){for(var a,i,p,d,c=o.F.U,l=r.length,u=c.bl_count,h=0;h<=s;h++)u[h]=0;for(h=1;h<l;h+=2)u[r[h]]++;var g=c.next_code;for(a=0,u[0]=0,i=1;i<=s;i++)a=a+u[i-1]<<1,g[i]=a;for(p=0;p<l;p+=2)(d=r[p+1])!=0&&(r[p]=g[d],g[d]++)},o.F.codes2map=function(r,s,a){for(var i=r.length,p=o.F.U.rev15,d=0;d<i;d+=2)if(r[d+1]!=0)for(var c=d>>1,l=r[d+1],u=c<<4|l,h=s-l,g=r[d]<<h,v=g+(1<<h);g!=v;)a[p[g]>>>15-s]=u,g++},o.F.revCodes=function(r,s){for(var a=o.F.U.rev15,i=15-s,p=0;p<r.length;p+=2){var d=r[p]<<s-r[p+1];r[p]=a[d]>>>i}},o.F._putsE=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8},o.F._putsF=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},o.F._bitsE=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},o.F._bitsF=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},o.F._get17=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)},o.F._get25=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16|r[3+(s>>>3)]<<24)>>>(7&s)},o.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var r=o.F.U,s=0;s<32768;s++){var a=s;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,r.rev15[s]=(a>>>16|a<<16)>>>17}function i(p,d,c){for(;d--!=0;)p.push(0,c)}for(s=0;s<32;s++)r.ldef[s]=r.of0[s]<<3|r.exb[s],r.ddef[s]=r.df0[s]<<4|r.dxb[s];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),o.F.makeCodes(r.fltree,9),o.F.codes2map(r.fltree,9,r.flmap),o.F.revCodes(r.fltree,9),i(r.fdtree,32,5),o.F.makeCodes(r.fdtree,5),o.F.codes2map(r.fdtree,5,r.fdmap),o.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var Am=Cm({__proto__:null,default:Tn},[Tn]);const Me=(function(){var e={nextZero(c,l){for(;c[l]!=0;)l++;return l},readUshort:(c,l)=>c[l]<<8|c[l+1],writeUshort(c,l,u){c[l]=u>>8&255,c[l+1]=255&u},readUint:(c,l)=>16777216*c[l]+(c[l+1]<<16|c[l+2]<<8|c[l+3]),writeUint(c,l,u){c[l]=u>>24&255,c[l+1]=u>>16&255,c[l+2]=u>>8&255,c[l+3]=255&u},readASCII(c,l,u){let h="";for(let g=0;g<u;g++)h+=String.fromCharCode(c[l+g]);return h},writeASCII(c,l,u){for(let h=0;h<u.length;h++)c[l+h]=u.charCodeAt(h)},readBytes(c,l,u){const h=[];for(let g=0;g<u;g++)h.push(c[l+g]);return h},pad:c=>c.length<2?`0${c}`:c,readUTF8(c,l,u){let h,g="";for(let v=0;v<u;v++)g+=`%${e.pad(c[l+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(c,l,u)}return h}};function t(c,l,u,h){const g=l*u,v=s(h),w=Math.ceil(l*v/8),y=new Uint8Array(4*g),_=new Uint32Array(y.buffer),{ctype:R}=h,{depth:k}=h,F=e.readUshort;if(R==6){const A=g<<2;if(k==8)for(var S=0;S<A;S+=4)y[S]=c[S],y[S+1]=c[S+1],y[S+2]=c[S+2],y[S+3]=c[S+3];if(k==16)for(S=0;S<A;S++)y[S]=c[S<<1]}else if(R==2){const A=h.tabs.tRNS;if(A==null){if(k==8)for(S=0;S<g;S++){var j=3*S;_[S]=255<<24|c[j+2]<<16|c[j+1]<<8|c[j]}if(k==16)for(S=0;S<g;S++)j=6*S,_[S]=255<<24|c[j+4]<<16|c[j+2]<<8|c[j]}else{var x=A[0];const T=A[1],H=A[2];if(k==8)for(S=0;S<g;S++){var b=S<<2;j=3*S,_[S]=255<<24|c[j+2]<<16|c[j+1]<<8|c[j],c[j]==x&&c[j+1]==T&&c[j+2]==H&&(y[b+3]=0)}if(k==16)for(S=0;S<g;S++)b=S<<2,j=6*S,_[S]=255<<24|c[j+4]<<16|c[j+2]<<8|c[j],F(c,j)==x&&F(c,j+2)==T&&F(c,j+4)==H&&(y[b+3]=0)}}else if(R==3){const A=h.tabs.PLTE,T=h.tabs.tRNS,H=T?T.length:0;if(k==1)for(var I=0;I<u;I++){var O=I*w,P=I*l;for(S=0;S<l;S++){b=P+S<<2;var $=3*(M=c[O+(S>>3)]>>7-((7&S)<<0)&1);y[b]=A[$],y[b+1]=A[$+1],y[b+2]=A[$+2],y[b+3]=M<H?T[M]:255}}if(k==2)for(I=0;I<u;I++)for(O=I*w,P=I*l,S=0;S<l;S++)b=P+S<<2,$=3*(M=c[O+(S>>2)]>>6-((3&S)<<1)&3),y[b]=A[$],y[b+1]=A[$+1],y[b+2]=A[$+2],y[b+3]=M<H?T[M]:255;if(k==4)for(I=0;I<u;I++)for(O=I*w,P=I*l,S=0;S<l;S++)b=P+S<<2,$=3*(M=c[O+(S>>1)]>>4-((1&S)<<2)&15),y[b]=A[$],y[b+1]=A[$+1],y[b+2]=A[$+2],y[b+3]=M<H?T[M]:255;if(k==8)for(S=0;S<g;S++){var M;b=S<<2,$=3*(M=c[S]),y[b]=A[$],y[b+1]=A[$+1],y[b+2]=A[$+2],y[b+3]=M<H?T[M]:255}}else if(R==4){if(k==8)for(S=0;S<g;S++){b=S<<2;var U=c[E=S<<1];y[b]=U,y[b+1]=U,y[b+2]=U,y[b+3]=c[E+1]}if(k==16)for(S=0;S<g;S++){var E;b=S<<2,U=c[E=S<<2],y[b]=U,y[b+1]=U,y[b+2]=U,y[b+3]=c[E+2]}}else if(R==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,I=0;I<u;I++){const A=I*w,T=I*l;if(k==1)for(var C=0;C<l;C++){var D=(U=255*(c[A+(C>>>3)]>>>7-(7&C)&1))==255*x?0:255;_[T+C]=D<<24|U<<16|U<<8|U}else if(k==2)for(C=0;C<l;C++)D=(U=85*(c[A+(C>>>2)]>>>6-((3&C)<<1)&3))==85*x?0:255,_[T+C]=D<<24|U<<16|U<<8|U;else if(k==4)for(C=0;C<l;C++)D=(U=17*(c[A+(C>>>1)]>>>4-((1&C)<<2)&15))==17*x?0:255,_[T+C]=D<<24|U<<16|U<<8|U;else if(k==8)for(C=0;C<l;C++)D=(U=c[A+C])==x?0:255,_[T+C]=D<<24|U<<16|U<<8|U;else if(k==16)for(C=0;C<l;C++)U=c[A+(C<<1)],D=F(c,A+(C<<1))==x?0:255,_[T+C]=D<<24|U<<16|U<<8|U}return y}function n(c,l,u,h){const g=s(c),v=Math.ceil(u*g/8),w=new Uint8Array((v+1+c.interlace)*h);return l=c.tabs.CgBI?r(l,w):o(l,w),c.interlace==0?l=a(l,c,0,u,h):c.interlace==1&&(l=(function(_,R){const k=R.width,F=R.height,S=s(R),j=S>>3,x=Math.ceil(k*S/8),b=new Uint8Array(F*x);let I=0;const O=[0,0,4,0,2,0,1],P=[0,4,0,2,0,1,0],$=[8,8,8,4,4,2,2],M=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const C=$[U],D=M[U];let A=0,T=0,H=O[U];for(;H<F;)H+=C,T++;let N=P[U];for(;N<k;)N+=D,A++;const B=Math.ceil(A*S/8);a(_,R,I,A,T);let z=0,L=O[U];for(;L<F;){let G=P[U],V=I+z*B<<3;for(;G<k;){var E;if(S==1&&(E=(E=_[V>>3])>>7-(7&V)&1,b[L*x+(G>>3)]|=E<<7-((7&G)<<0)),S==2&&(E=(E=_[V>>3])>>6-(7&V)&3,b[L*x+(G>>2)]|=E<<6-((3&G)<<1)),S==4&&(E=(E=_[V>>3])>>4-(7&V)&15,b[L*x+(G>>1)]|=E<<4-((1&G)<<2)),S>=8){const Y=L*x+G*j;for(let K=0;K<j;K++)b[Y+K]=_[(V>>3)+K]}V+=S,G+=D}z++,L+=C}A*T!=0&&(I+=T*(1+B)),U+=1}return b})(l,c)),l}function o(c,l){return r(new Uint8Array(c.buffer,2,c.length-6),l)}var r=(function(){const c={H:{}};return c.H.N=function(l,u){const h=Uint8Array;let g,v,w=0,y=0,_=0,R=0,k=0,F=0,S=0,j=0,x=0;if(l[0]==3&&l[1]==0)return u||new h(0);const b=c.H,I=b.b,O=b.e,P=b.R,$=b.n,M=b.A,U=b.Z,E=b.m,C=u==null;for(C&&(u=new h(l.length>>>2<<5));w==0;)if(w=I(l,x,1),y=I(l,x+1,2),x+=3,y!=0){if(C&&(u=c.H.W(u,j+(1<<17))),y==1&&(g=E.J,v=E.h,F=511,S=31),y==2){_=O(l,x,5)+257,R=O(l,x+5,5)+1,k=O(l,x+10,4)+4,x+=14;let A=1;for(var D=0;D<38;D+=2)E.Q[D]=0,E.Q[D+1]=0;for(D=0;D<k;D++){const N=O(l,x+3*D,3);E.Q[1+(E.X[D]<<1)]=N,N>A&&(A=N)}x+=3*k,$(E.Q,A),M(E.Q,A,E.u),g=E.w,v=E.d,x=P(E.u,(1<<A)-1,_+R,l,x,E.v);const T=b.V(E.v,0,_,E.C);F=(1<<T)-1;const H=b.V(E.v,_,R,E.D);S=(1<<H)-1,$(E.C,T),M(E.C,T,g),$(E.D,H),M(E.D,H,v)}for(;;){const A=g[U(l,x)&F];x+=15&A;const T=A>>>4;if(!(T>>>8))u[j++]=T;else{if(T==256)break;{let H=j+T-254;if(T>264){const G=E.q[T-257];H=j+(G>>>3)+O(l,x,7&G),x+=7&G}const N=v[U(l,x)&S];x+=15&N;const B=N>>>4,z=E.c[B],L=(z>>>4)+I(l,x,15&z);for(x+=15&z;j<H;)u[j]=u[j++-L],u[j]=u[j++-L],u[j]=u[j++-L],u[j]=u[j++-L];j=H}}}}else{(7&x)!=0&&(x+=8-(7&x));const A=4+(x>>>3),T=l[A-4]|l[A-3]<<8;C&&(u=c.H.W(u,j+T)),u.set(new h(l.buffer,l.byteOffset+A,T),j),x=A+T<<3,j+=T}return u.length==j?u:u.slice(0,j)},c.H.W=function(l,u){const h=l.length;if(u<=h)return l;const g=new Uint8Array(h<<1);return g.set(l,0),g},c.H.R=function(l,u,h,g,v,w){const y=c.H.e,_=c.H.Z;let R=0;for(;R<h;){const k=l[_(g,v)&u];v+=15&k;const F=k>>>4;if(F<=15)w[R]=F,R++;else{let S=0,j=0;F==16?(j=3+y(g,v,2),v+=2,S=w[R-1]):F==17?(j=3+y(g,v,3),v+=3):F==18&&(j=11+y(g,v,7),v+=7);const x=R+j;for(;R<x;)w[R]=S,R++}}return v},c.H.V=function(l,u,h,g){let v=0,w=0;const y=g.length>>>1;for(;w<h;){const _=l[w+u];g[w<<1]=0,g[1+(w<<1)]=_,_>v&&(v=_),w++}for(;w<y;)g[w<<1]=0,g[1+(w<<1)]=0,w++;return v},c.H.n=function(l,u){const h=c.H.m,g=l.length;let v,w,y,_;const R=h.j;for(var k=0;k<=u;k++)R[k]=0;for(k=1;k<g;k+=2)R[l[k]]++;const F=h.K;for(v=0,R[0]=0,w=1;w<=u;w++)v=v+R[w-1]<<1,F[w]=v;for(y=0;y<g;y+=2)_=l[y+1],_!=0&&(l[y]=F[_],F[_]++)},c.H.A=function(l,u,h){const g=l.length,v=c.H.m.r;for(let w=0;w<g;w+=2)if(l[w+1]!=0){const y=w>>1,_=l[w+1],R=y<<4|_,k=u-_;let F=l[w]<<k;const S=F+(1<<k);for(;F!=S;)h[v[F]>>>15-u]=R,F++}},c.H.l=function(l,u){const h=c.H.m.r,g=15-u;for(let v=0;v<l.length;v+=2){const w=l[v]<<u-l[v+1];l[v]=h[w]>>>g}},c.H.M=function(l,u,h){h<<=7&u;const g=u>>>3;l[g]|=h,l[g+1]|=h>>>8},c.H.I=function(l,u,h){h<<=7&u;const g=u>>>3;l[g]|=h,l[g+1]|=h>>>8,l[g+2]|=h>>>16},c.H.e=function(l,u,h){return(l[u>>>3]|l[1+(u>>>3)]<<8)>>>(7&u)&(1<<h)-1},c.H.b=function(l,u,h){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)&(1<<h)-1},c.H.Z=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16)>>>(7&u)},c.H.i=function(l,u){return(l[u>>>3]|l[1+(u>>>3)]<<8|l[2+(u>>>3)]<<16|l[3+(u>>>3)]<<24)>>>(7&u)},c.H.m=(function(){const l=Uint16Array,u=Uint32Array;return{K:new l(16),j:new l(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new l(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new l(512),_:[],h:new l(32),$:[],w:new l(32768),C:[],v:[],d:new l(32768),D:[],u:new l(512),Q:[],r:new l(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new l(65536),g:new l(32768)}})(),(function(){const l=c.H.m;for(var u=0;u<32768;u++){let g=u;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,l.r[u]=(g>>>16|g<<16)>>>17}function h(g,v,w){for(;v--!=0;)g.push(0,w)}for(u=0;u<32;u++)l.q[u]=l.S[u]<<3|l.T[u],l.c[u]=l.p[u]<<4|l.z[u];h(l._,144,8),h(l._,112,9),h(l._,24,7),h(l._,8,8),c.H.n(l._,9),c.H.A(l._,9,l.J),c.H.l(l._,9),h(l.$,32,5),c.H.n(l.$,5),c.H.A(l.$,5,l.h),c.H.l(l.$,5),h(l.Q,19,0),h(l.C,286,0),h(l.D,30,0),h(l.v,320,0)})(),c.H.N})();function s(c){return[1,null,3,1,2,null,4][c.ctype]*c.depth}function a(c,l,u,h,g){let v=s(l);const w=Math.ceil(h*v/8);let y,_;v=Math.ceil(v/8);let R=c[u],k=0;if(R>1&&(c[u]=[0,0,1][R-2]),R==3)for(k=v;k<w;k++)c[k+1]=c[k+1]+(c[k+1-v]>>>1)&255;for(let F=0;F<g;F++)if(y=u+F*w,_=y+F+1,R=c[_-1],k=0,R==0)for(;k<w;k++)c[y+k]=c[_+k];else if(R==1){for(;k<v;k++)c[y+k]=c[_+k];for(;k<w;k++)c[y+k]=c[_+k]+c[y+k-v]}else if(R==2)for(;k<w;k++)c[y+k]=c[_+k]+c[y+k-w];else if(R==3){for(;k<v;k++)c[y+k]=c[_+k]+(c[y+k-w]>>>1);for(;k<w;k++)c[y+k]=c[_+k]+(c[y+k-w]+c[y+k-v]>>>1)}else{for(;k<v;k++)c[y+k]=c[_+k]+i(0,c[y+k-w],0);for(;k<w;k++)c[y+k]=c[_+k]+i(c[y+k-v],c[y+k-w],c[y+k-v-w])}return c}function i(c,l,u){const h=c+l-u,g=h-c,v=h-l,w=h-u;return g*g<=v*v&&g*g<=w*w?c:v*v<=w*w?l:u}function p(c,l,u){u.width=e.readUint(c,l),l+=4,u.height=e.readUint(c,l),l+=4,u.depth=c[l],l++,u.ctype=c[l],l++,u.compress=c[l],l++,u.filter=c[l],l++,u.interlace=c[l],l++}function d(c,l,u,h,g,v,w,y,_){const R=Math.min(l,g),k=Math.min(u,v);let F=0,S=0;for(let U=0;U<k;U++)for(let E=0;E<R;E++)if(w>=0&&y>=0?(F=U*l+E<<2,S=(y+U)*g+w+E<<2):(F=(-y+U)*l-w+E<<2,S=U*g+E<<2),_==0)h[S]=c[F],h[S+1]=c[F+1],h[S+2]=c[F+2],h[S+3]=c[F+3];else if(_==1){var j=c[F+3]*.00392156862745098,x=c[F]*j,b=c[F+1]*j,I=c[F+2]*j,O=h[S+3]*(1/255),P=h[S]*O,$=h[S+1]*O,M=h[S+2]*O;const C=1-j,D=j+O*C,A=D==0?0:1/D;h[S+3]=255*D,h[S+0]=(x+P*C)*A,h[S+1]=(b+$*C)*A,h[S+2]=(I+M*C)*A}else if(_==2)j=c[F+3],x=c[F],b=c[F+1],I=c[F+2],O=h[S+3],P=h[S],$=h[S+1],M=h[S+2],j==O&&x==P&&b==$&&I==M?(h[S]=0,h[S+1]=0,h[S+2]=0,h[S+3]=0):(h[S]=x,h[S+1]=b,h[S+2]=I,h[S+3]=j);else if(_==3){if(j=c[F+3],x=c[F],b=c[F+1],I=c[F+2],O=h[S+3],P=h[S],$=h[S+1],M=h[S+2],j==O&&x==P&&b==$&&I==M)continue;if(j<220&&O>20)return!1}return!0}return{decode:function(l){const u=new Uint8Array(l);let h=8;const g=e,v=g.readUshort,w=g.readUint,y={tabs:{},frames:[]},_=new Uint8Array(u.length);let R,k=0,F=0;const S=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(u[j]!=S[j])throw"The input is not a PNG file!";for(;h<u.length;){const U=g.readUint(u,h);h+=4;const E=g.readASCII(u,h,4);if(h+=4,E=="IHDR")p(u,h,y);else if(E=="iCCP"){for(var x=h;u[x]!=0;)x++;g.readASCII(u,h,x-h),u[x+1];const C=u.slice(x+2,h+U);let D=null;try{D=o(C)}catch{D=r(C)}y.tabs[E]=D}else if(E=="CgBI")y.tabs[E]=u.slice(h,h+4);else if(E=="IDAT"){for(j=0;j<U;j++)_[k+j]=u[h+j];k+=U}else if(E=="acTL")y.tabs[E]={num_frames:w(u,h),num_plays:w(u,h+4)},R=new Uint8Array(u.length);else if(E=="fcTL"){F!=0&&((M=y.frames[y.frames.length-1]).data=n(y,R.slice(0,F),M.rect.width,M.rect.height),F=0);const C={x:w(u,h+12),y:w(u,h+16),width:w(u,h+4),height:w(u,h+8)};let D=v(u,h+22);D=v(u,h+20)/(D==0?100:D);const A={rect:C,delay:Math.round(1e3*D),dispose:u[h+24],blend:u[h+25]};y.frames.push(A)}else if(E=="fdAT"){for(j=0;j<U-4;j++)R[F+j]=u[h+j+4];F+=U-4}else if(E=="pHYs")y.tabs[E]=[g.readUint(u,h),g.readUint(u,h+4),u[h+8]];else if(E=="cHRM")for(y.tabs[E]=[],j=0;j<8;j++)y.tabs[E].push(g.readUint(u,h+4*j));else if(E=="tEXt"||E=="zTXt"){y.tabs[E]==null&&(y.tabs[E]={});var b=g.nextZero(u,h),I=g.readASCII(u,h,b-h),O=h+U-b-1;if(E=="tEXt")$=g.readASCII(u,b+1,O);else{var P=o(u.slice(b+2,b+2+O));$=g.readUTF8(P,0,P.length)}y.tabs[E][I]=$}else if(E=="iTXt"){y.tabs[E]==null&&(y.tabs[E]={}),b=0,x=h,b=g.nextZero(u,x),I=g.readASCII(u,x,b-x);const C=u[x=b+1];var $;u[x+1],x+=2,b=g.nextZero(u,x),g.readASCII(u,x,b-x),x=b+1,b=g.nextZero(u,x),g.readUTF8(u,x,b-x),O=U-((x=b+1)-h),C==0?$=g.readUTF8(u,x,O):(P=o(u.slice(x,x+O)),$=g.readUTF8(P,0,P.length)),y.tabs[E][I]=$}else if(E=="PLTE")y.tabs[E]=g.readBytes(u,h,U);else if(E=="hIST"){const C=y.tabs.PLTE.length/3;for(y.tabs[E]=[],j=0;j<C;j++)y.tabs[E].push(v(u,h+2*j))}else if(E=="tRNS")y.ctype==3?y.tabs[E]=g.readBytes(u,h,U):y.ctype==0?y.tabs[E]=v(u,h):y.ctype==2&&(y.tabs[E]=[v(u,h),v(u,h+2),v(u,h+4)]);else if(E=="gAMA")y.tabs[E]=g.readUint(u,h)/1e5;else if(E=="sRGB")y.tabs[E]=u[h];else if(E=="bKGD")y.ctype==0||y.ctype==4?y.tabs[E]=[v(u,h)]:y.ctype==2||y.ctype==6?y.tabs[E]=[v(u,h),v(u,h+2),v(u,h+4)]:y.ctype==3&&(y.tabs[E]=u[h]);else if(E=="IEND")break;h+=U,g.readUint(u,h),h+=4}var M;return F!=0&&((M=y.frames[y.frames.length-1]).data=n(y,R.slice(0,F),M.rect.width,M.rect.height)),y.data=n(y,_,y.width,y.height),delete y.compress,delete y.interlace,delete y.filter,y},toRGBA8:function(l){const u=l.width,h=l.height;if(l.tabs.acTL==null)return[t(l.data,u,h,l).buffer];const g=[];l.frames[0].data==null&&(l.frames[0].data=l.data);const v=u*h*4,w=new Uint8Array(v),y=new Uint8Array(v),_=new Uint8Array(v);for(let k=0;k<l.frames.length;k++){const F=l.frames[k],S=F.rect.x,j=F.rect.y,x=F.rect.width,b=F.rect.height,I=t(F.data,x,b,l);if(k!=0)for(var R=0;R<v;R++)_[R]=w[R];if(F.blend==0?d(I,x,b,w,u,h,S,j,0):F.blend==1&&d(I,x,b,w,u,h,S,j,1),g.push(w.buffer.slice(0)),F.dispose!=0){if(F.dispose==1)d(y,x,b,w,u,h,S,j,0);else if(F.dispose==2)for(R=0;R<v;R++)w[R]=_[R]}}return g},_paeth:i,_copyTile:d,_bin:e}})();(function(){const{_copyTile:e}=Me,{_bin:t}=Me,n=Me._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let b=0;b<256;b++){let I=b;for(let O=0;O<8;O++)1&I?I=3988292384^I>>>1:I>>>=1;x[b]=I}return x})(),update(x,b,I,O){for(let P=0;P<O;P++)x=o.table[255&(x^b[I+P])]^x>>>8;return x},crc:(x,b,I)=>4294967295^o.update(4294967295,x,b,I)};function r(x,b,I,O){b[I]+=x[0]*O>>4,b[I+1]+=x[1]*O>>4,b[I+2]+=x[2]*O>>4,b[I+3]+=x[3]*O>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,b){const I=x[0]-b[0],O=x[1]-b[1],P=x[2]-b[2],$=x[3]-b[3];return I*I+O*O+P*P+$*$}function i(x,b,I,O,P,$,M){M==null&&(M=1);const U=O.length,E=[];for(var C=0;C<U;C++){const L=O[C];E.push([L>>>0&255,L>>>8&255,L>>>16&255,L>>>24&255])}for(C=0;C<U;C++){let L=4294967295;for(var D=0,A=0;A<U;A++){var T=a(E[C],E[A]);A!=C&&T<L&&(L=T,D=A)}}const H=new Uint32Array(P.buffer),N=new Int16Array(b*I*4),B=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<B.length;C++)B[C]=255*((B[C]+.5)/16-.5);for(let L=0;L<I;L++)for(let G=0;G<b;G++){var z;C=4*(L*b+G),M!=2?z=[s(x[C]+N[C]),s(x[C+1]+N[C+1]),s(x[C+2]+N[C+2]),s(x[C+3]+N[C+3])]:(T=B[4*(3&L)+(3&G)],z=[s(x[C]+T),s(x[C+1]+T),s(x[C+2]+T),s(x[C+3]+T)]),D=0;let V=16777215;for(A=0;A<U;A++){const ne=a(z,E[A]);ne<V&&(V=ne,D=A)}const Y=E[D],K=[z[0]-Y[0],z[1]-Y[1],z[2]-Y[2],z[3]-Y[3]];M==1&&(G!=b-1&&r(K,N,C+4,7),L!=I-1&&(G!=0&&r(K,N,C+4*b-4,3),r(K,N,C+4*b,5),G!=b-1&&r(K,N,C+4*b+4,1))),$[C>>2]=D,H[C>>2]=O[D]}}function p(x,b,I,O,P){P==null&&(P={});const{crc:$}=o,M=t.writeUint,U=t.writeUshort,E=t.writeASCII;let C=8;const D=x.frames.length>1;let A,T=!1,H=33+(D?20:0);if(P.sRGB!=null&&(H+=13),P.pHYs!=null&&(H+=21),P.iCCP!=null&&(A=pako.deflate(P.iCCP),H+=21+A.length+4),x.ctype==3){for(var N=x.plte.length,B=0;B<N;B++)x.plte[B]>>>24!=255&&(T=!0);H+=8+3*N+4+(T?8+1*N+4:0)}for(var z=0;z<x.frames.length;z++)D&&(H+=38),H+=(Y=x.frames[z]).cimg.length+12,z!=0&&(H+=4);H+=12;const L=new Uint8Array(H),G=[137,80,78,71,13,10,26,10];for(B=0;B<8;B++)L[B]=G[B];if(M(L,C,13),C+=4,E(L,C,"IHDR"),C+=4,M(L,C,b),C+=4,M(L,C,I),C+=4,L[C]=x.depth,C++,L[C]=x.ctype,C++,L[C]=0,C++,L[C]=0,C++,L[C]=0,C++,M(L,C,$(L,C-17,17)),C+=4,P.sRGB!=null&&(M(L,C,1),C+=4,E(L,C,"sRGB"),C+=4,L[C]=P.sRGB,C++,M(L,C,$(L,C-5,5)),C+=4),P.iCCP!=null){const K=13+A.length;M(L,C,K),C+=4,E(L,C,"iCCP"),C+=4,E(L,C,"ICC profile"),C+=11,C+=2,L.set(A,C),C+=A.length,M(L,C,$(L,C-(K+4),K+4)),C+=4}if(P.pHYs!=null&&(M(L,C,9),C+=4,E(L,C,"pHYs"),C+=4,M(L,C,P.pHYs[0]),C+=4,M(L,C,P.pHYs[1]),C+=4,L[C]=P.pHYs[2],C++,M(L,C,$(L,C-13,13)),C+=4),D&&(M(L,C,8),C+=4,E(L,C,"acTL"),C+=4,M(L,C,x.frames.length),C+=4,M(L,C,P.loop!=null?P.loop:0),C+=4,M(L,C,$(L,C-12,12)),C+=4),x.ctype==3){for(M(L,C,3*(N=x.plte.length)),C+=4,E(L,C,"PLTE"),C+=4,B=0;B<N;B++){const K=3*B,ne=x.plte[B],ae=255&ne,le=ne>>>8&255,pe=ne>>>16&255;L[C+K+0]=ae,L[C+K+1]=le,L[C+K+2]=pe}if(C+=3*N,M(L,C,$(L,C-3*N-4,3*N+4)),C+=4,T){for(M(L,C,N),C+=4,E(L,C,"tRNS"),C+=4,B=0;B<N;B++)L[C+B]=x.plte[B]>>>24&255;C+=N,M(L,C,$(L,C-N-4,N+4)),C+=4}}let V=0;for(z=0;z<x.frames.length;z++){var Y=x.frames[z];D&&(M(L,C,26),C+=4,E(L,C,"fcTL"),C+=4,M(L,C,V++),C+=4,M(L,C,Y.rect.width),C+=4,M(L,C,Y.rect.height),C+=4,M(L,C,Y.rect.x),C+=4,M(L,C,Y.rect.y),C+=4,U(L,C,O[z]),C+=2,U(L,C,1e3),C+=2,L[C]=Y.dispose,C++,L[C]=Y.blend,C++,M(L,C,$(L,C-30,30)),C+=4);const K=Y.cimg;M(L,C,(N=K.length)+(z==0?0:4)),C+=4;const ne=C;E(L,C,z==0?"IDAT":"fdAT"),C+=4,z!=0&&(M(L,C,V++),C+=4),L.set(K,C),C+=N,M(L,C,$(L,ne,C-ne)),C+=4}return M(L,C,0),C+=4,E(L,C,"IEND"),C+=4,M(L,C,$(L,C-4,4)),C+=4,L.buffer}function d(x,b,I){for(let O=0;O<x.frames.length;O++){const P=x.frames[O];P.rect.width;const $=P.rect.height,M=new Uint8Array($*P.bpl+$);P.cimg=h(P.img,$,P.bpp,P.bpl,M,b,I)}}function c(x,b,I,O,P){const $=P[0],M=P[1],U=P[2],E=P[3],C=P[4],D=P[5];let A=6,T=8,H=255;for(var N=0;N<x.length;N++){const Z=new Uint8Array(x[N]);for(var B=Z.length,z=0;z<B;z+=4)H&=Z[z+3]}const L=H!=255,G=(function(te,ie,re,fe,he,Ee){const ge=[];for(var de=0;de<te.length;de++){const ye=new Uint8Array(te[de]),Ie=new Uint32Array(ye.buffer);var Ae;let Ne=0,Ge=0,Fe=ie,mt=re,tr=fe?1:0;if(de!=0){const Al=Ee||fe||de==1||ge[de-2].dispose!=0?1:2;let nr=0,ko=1e9;for(let Ht=0;Ht<Al;Ht++){var Je=new Uint8Array(te[de-1-Ht]);const kl=new Uint32Array(te[de-1-Ht]);let et=ie,tt=re,Rt=-1,Wt=-1;for(let ht=0;ht<re;ht++)for(let gt=0;gt<ie;gt++)Ie[be=ht*ie+gt]!=kl[be]&&(gt<et&&(et=gt),gt>Rt&&(Rt=gt),ht<tt&&(tt=ht),ht>Wt&&(Wt=ht));Rt==-1&&(et=tt=Rt=Wt=0),he&&((1&et)==1&&et--,(1&tt)==1&&tt--);const _o=(Rt-et+1)*(Wt-tt+1);_o<ko&&(ko=_o,nr=Ht,Ne=et,Ge=tt,Fe=Rt-et+1,mt=Wt-tt+1)}Je=new Uint8Array(te[de-1-nr]),nr==1&&(ge[de-1].dispose=2),Ae=new Uint8Array(Fe*mt*4),e(Je,ie,re,Ae,Fe,mt,-Ne,-Ge,0),tr=e(ye,ie,re,Ae,Fe,mt,-Ne,-Ge,3)?1:0,tr==1?u(ye,ie,re,Ae,{x:Ne,y:Ge,width:Fe,height:mt}):e(ye,ie,re,Ae,Fe,mt,-Ne,-Ge,0)}else Ae=ye.slice(0);ge.push({rect:{x:Ne,y:Ge,width:Fe,height:mt},img:Ae,blend:tr,dispose:0})}if(fe)for(de=0;de<ge.length;de++){if((pt=ge[de]).blend==1)continue;const ye=pt.rect,Ie=ge[de-1].rect,Ne=Math.min(ye.x,Ie.x),Ge=Math.min(ye.y,Ie.y),Fe={x:Ne,y:Ge,width:Math.max(ye.x+ye.width,Ie.x+Ie.width)-Ne,height:Math.max(ye.y+ye.height,Ie.y+Ie.height)-Ge};ge[de-1].dispose=1,de-1!=0&&l(te,ie,re,ge,de-1,Fe,he),l(te,ie,re,ge,de,Fe,he)}let pn=0;if(te.length!=1)for(var be=0;be<ge.length;be++){var pt;pn+=(pt=ge[be]).rect.width*pt.rect.height}return ge})(x,b,I,$,M,U),V={},Y=[],K=[];if(O!=0){const Z=[];for(z=0;z<G.length;z++)Z.push(G[z].img.buffer);const te=(function(he){let Ee=0;for(var ge=0;ge<he.length;ge++)Ee+=he[ge].byteLength;const de=new Uint8Array(Ee);let Ae=0;for(ge=0;ge<he.length;ge++){const Je=new Uint8Array(he[ge]),pn=Je.length;for(let be=0;be<pn;be+=4){let pt=Je[be],ye=Je[be+1],Ie=Je[be+2];const Ne=Je[be+3];Ne==0&&(pt=ye=Ie=0),de[Ae+be]=pt,de[Ae+be+1]=ye,de[Ae+be+2]=Ie,de[Ae+be+3]=Ne}Ae+=pn}return de.buffer})(Z),ie=v(te,O);for(z=0;z<ie.plte.length;z++)Y.push(ie.plte[z].est.rgba);let re=0;for(z=0;z<G.length;z++){const fe=(ae=G[z]).img.length;var ne=new Uint8Array(ie.inds.buffer,re>>2,fe>>2);K.push(ne);const he=new Uint8Array(ie.abuf,re,fe);D&&i(ae.img,ae.rect.width,ae.rect.height,Y,he,ne),ae.img.set(he),re+=fe}}else for(N=0;N<G.length;N++){var ae=G[N];const Z=new Uint32Array(ae.img.buffer);var le=ae.rect.width;for(B=Z.length,ne=new Uint8Array(B),K.push(ne),z=0;z<B;z++){const te=Z[z];if(z!=0&&te==Z[z-1])ne[z]=ne[z-1];else if(z>le&&te==Z[z-le])ne[z]=ne[z-le];else{let ie=V[te];if(ie==null&&(V[te]=ie=Y.length,Y.push(te),Y.length>=300))break;ne[z]=ie}}}const pe=Y.length;for(pe<=256&&C==0&&(T=pe<=2?1:pe<=4?2:pe<=16?4:8,T=Math.max(T,E)),N=0;N<G.length;N++){(ae=G[N]).rect.x,ae.rect.y,le=ae.rect.width;const Z=ae.rect.height;let te=ae.img;new Uint32Array(te.buffer);let ie=4*le,re=4;if(pe<=256&&C==0){ie=Math.ceil(T*le/8);var W=new Uint8Array(ie*Z);const fe=K[N];for(let he=0;he<Z;he++){z=he*ie;const Ee=he*le;if(T==8)for(var q=0;q<le;q++)W[z+q]=fe[Ee+q];else if(T==4)for(q=0;q<le;q++)W[z+(q>>1)]|=fe[Ee+q]<<4-4*(1&q);else if(T==2)for(q=0;q<le;q++)W[z+(q>>2)]|=fe[Ee+q]<<6-2*(3&q);else if(T==1)for(q=0;q<le;q++)W[z+(q>>3)]|=fe[Ee+q]<<7-1*(7&q)}te=W,A=3,re=1}else if(L==0&&G.length==1){W=new Uint8Array(le*Z*3);const fe=le*Z;for(z=0;z<fe;z++){const he=3*z,Ee=4*z;W[he]=te[Ee],W[he+1]=te[Ee+1],W[he+2]=te[Ee+2]}te=W,A=2,re=3,ie=3*le}ae.img=te,ae.bpl=ie,ae.bpp=re}return{ctype:A,depth:T,plte:Y,frames:G}}function l(x,b,I,O,P,$,M){const U=Uint8Array,E=Uint32Array,C=new U(x[P-1]),D=new E(x[P-1]),A=P+1<x.length?new U(x[P+1]):null,T=new U(x[P]),H=new E(T.buffer);let N=b,B=I,z=-1,L=-1;for(let V=0;V<$.height;V++)for(let Y=0;Y<$.width;Y++){const K=$.x+Y,ne=$.y+V,ae=ne*b+K,le=H[ae];le==0||O[P-1].dispose==0&&D[ae]==le&&(A==null||A[4*ae+3]!=0)||(K<N&&(N=K),K>z&&(z=K),ne<B&&(B=ne),ne>L&&(L=ne))}z==-1&&(N=B=z=L=0),M&&((1&N)==1&&N--,(1&B)==1&&B--),$={x:N,y:B,width:z-N+1,height:L-B+1};const G=O[P];G.rect=$,G.blend=1,G.img=new Uint8Array($.width*$.height*4),O[P-1].dispose==0?(e(C,b,I,G.img,$.width,$.height,-$.x,-$.y,0),u(T,b,I,G.img,$)):e(T,b,I,G.img,$.width,$.height,-$.x,-$.y,0)}function u(x,b,I,O,P){e(x,b,I,O,P.width,P.height,-P.x,-P.y,2)}function h(x,b,I,O,P,$,M){const U=[];let E,C=[0,1,2,3,4];$!=-1?C=[$]:(b*O>5e5||I==1)&&(C=[0]),M&&(E={level:0});const D=Am;for(var A=0;A<C.length;A++){for(let N=0;N<b;N++)g(P,x,N,O,I,C[A]);U.push(D.deflate(P,E))}let T,H=1e9;for(A=0;A<U.length;A++)U[A].length<H&&(T=A,H=U[A].length);return U[T]}function g(x,b,I,O,P,$){const M=I*O;let U=M+I;if(x[U]=$,U++,$==0)if(O<500)for(var E=0;E<O;E++)x[U+E]=b[M+E];else x.set(new Uint8Array(b.buffer,M,O),U);else if($==1){for(E=0;E<P;E++)x[U+E]=b[M+E];for(E=P;E<O;E++)x[U+E]=b[M+E]-b[M+E-P]+256&255}else if(I==0){for(E=0;E<P;E++)x[U+E]=b[M+E];if($==2)for(E=P;E<O;E++)x[U+E]=b[M+E];if($==3)for(E=P;E<O;E++)x[U+E]=b[M+E]-(b[M+E-P]>>1)+256&255;if($==4)for(E=P;E<O;E++)x[U+E]=b[M+E]-n(b[M+E-P],0,0)+256&255}else{if($==2)for(E=0;E<O;E++)x[U+E]=b[M+E]+256-b[M+E-O]&255;if($==3){for(E=0;E<P;E++)x[U+E]=b[M+E]+256-(b[M+E-O]>>1)&255;for(E=P;E<O;E++)x[U+E]=b[M+E]+256-(b[M+E-O]+b[M+E-P]>>1)&255}if($==4){for(E=0;E<P;E++)x[U+E]=b[M+E]+256-n(0,b[M+E-O],0)&255;for(E=P;E<O;E++)x[U+E]=b[M+E]+256-n(b[M+E-P],b[M+E-O],b[M+E-P-O])&255}}}function v(x,b){const I=new Uint8Array(x),O=I.slice(0),P=new Uint32Array(O.buffer),$=w(O,b),M=$[0],U=$[1],E=I.length,C=new Uint8Array(E>>2);let D;if(I.length<2e7)for(var A=0;A<E;A+=4)D=y(M,T=I[A]*(1/255),H=I[A+1]*(1/255),N=I[A+2]*(1/255),B=I[A+3]*(1/255)),C[A>>2]=D.ind,P[A>>2]=D.est.rgba;else for(A=0;A<E;A+=4){var T=I[A]*.00392156862745098,H=I[A+1]*(1/255),N=I[A+2]*(1/255),B=I[A+3]*(1/255);for(D=M;D.left;)D=_(D.est,T,H,N,B)<=0?D.left:D.right;C[A>>2]=D.ind,P[A>>2]=D.est.rgba}return{abuf:O.buffer,inds:C,plte:U}}function w(x,b,I){I==null&&(I=1e-4);const O=new Uint32Array(x.buffer),P={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};P.bst=F(x,P.i0,P.i1),P.est=S(P.bst);const $=[P];for(;$.length<b;){let U=0,E=0;for(var M=0;M<$.length;M++)$[M].est.L>U&&(U=$[M].est.L,E=M);if(U<I)break;const C=$[E],D=R(x,O,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=D||C.i1<=D){C.est.L=0;continue}const A={i0:C.i0,i1:D,bst:null,est:null,tdst:0,left:null,right:null};A.bst=F(x,A.i0,A.i1),A.est=S(A.bst);const T={i0:D,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(T.bst={R:[],m:[],N:C.bst.N-A.bst.N},M=0;M<16;M++)T.bst.R[M]=C.bst.R[M]-A.bst.R[M];for(M=0;M<4;M++)T.bst.m[M]=C.bst.m[M]-A.bst.m[M];T.est=S(T.bst),C.left=A,C.right=T,$[E]=A,$.push(T)}for($.sort(((U,E)=>E.bst.N-U.bst.N)),M=0;M<$.length;M++)$[M].ind=M;return[P,$]}function y(x,b,I,O,P){if(x.left==null)return x.tdst=(function(A,T,H,N,B){const z=T-A[0],L=H-A[1],G=N-A[2],V=B-A[3];return z*z+L*L+G*G+V*V})(x.est.q,b,I,O,P),x;const $=_(x.est,b,I,O,P);let M=x.left,U=x.right;$>0&&(M=x.right,U=x.left);const E=y(M,b,I,O,P);if(E.tdst<=$*$)return E;const C=y(U,b,I,O,P);return C.tdst<E.tdst?C:E}function _(x,b,I,O,P){const{e:$}=x;return $[0]*b+$[1]*I+$[2]*O+$[3]*P-x.eMq}function R(x,b,I,O,P,$){for(O-=4;I<O;){for(;k(x,I,P)<=$;)I+=4;for(;k(x,O,P)>$;)O-=4;if(I>=O)break;const M=b[I>>2];b[I>>2]=b[O>>2],b[O>>2]=M,I+=4,O-=4}for(;k(x,I,P)>$;)I-=4;return I+4}function k(x,b,I){return x[b]*I[0]+x[b+1]*I[1]+x[b+2]*I[2]+x[b+3]*I[3]}function F(x,b,I){const O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],P=[0,0,0,0],$=I-b>>2;for(let M=b;M<I;M+=4){const U=x[M]*.00392156862745098,E=x[M+1]*(1/255),C=x[M+2]*(1/255),D=x[M+3]*(1/255);P[0]+=U,P[1]+=E,P[2]+=C,P[3]+=D,O[0]+=U*U,O[1]+=U*E,O[2]+=U*C,O[3]+=U*D,O[5]+=E*E,O[6]+=E*C,O[7]+=E*D,O[10]+=C*C,O[11]+=C*D,O[15]+=D*D}return O[4]=O[1],O[8]=O[2],O[9]=O[6],O[12]=O[3],O[13]=O[7],O[14]=O[11],{R:O,m:P,N:$}}function S(x){const{R:b}=x,{m:I}=x,{N:O}=x,P=I[0],$=I[1],M=I[2],U=I[3],E=O==0?0:1/O,C=[b[0]-P*P*E,b[1]-P*$*E,b[2]-P*M*E,b[3]-P*U*E,b[4]-$*P*E,b[5]-$*$*E,b[6]-$*M*E,b[7]-$*U*E,b[8]-M*P*E,b[9]-M*$*E,b[10]-M*M*E,b[11]-M*U*E,b[12]-U*P*E,b[13]-U*$*E,b[14]-U*M*E,b[15]-U*U*E],D=C,A=j;let T=[Math.random(),Math.random(),Math.random(),Math.random()],H=0,N=0;if(O!=0)for(let z=0;z<16&&(T=A.multVec(D,T),N=Math.sqrt(A.dot(T,T)),T=A.sml(1/N,T),!(z!=0&&Math.abs(N-H)<1e-9));z++)H=N;const B=[P*E,$*E,M*E,U*E];return{Cov:C,q:B,e:T,L:H,eMq255:A.dot(A.sml(255,B),T),eMq:A.dot(T,B),rgba:(Math.round(255*B[3])<<24|Math.round(255*B[2])<<16|Math.round(255*B[1])<<8|Math.round(255*B[0])<<0)>>>0}}var j={multVec:(x,b)=>[x[0]*b[0]+x[1]*b[1]+x[2]*b[2]+x[3]*b[3],x[4]*b[0]+x[5]*b[1]+x[6]*b[2]+x[7]*b[3],x[8]*b[0]+x[9]*b[1]+x[10]*b[2]+x[11]*b[3],x[12]*b[0]+x[13]*b[1]+x[14]*b[2]+x[15]*b[3]],dot:(x,b)=>x[0]*b[0]+x[1]*b[1]+x[2]*b[2]+x[3]*b[3],sml:(x,b)=>[x*b[0],x*b[1],x*b[2],x*b[3]]};Me.encode=function(b,I,O,P,$,M,U){P==null&&(P=0),U==null&&(U=!1);const E=c(b,I,O,P,[!1,!1,!1,0,U,!1]);return d(E,-1),p(E,I,O,$,M)},Me.encodeLL=function(b,I,O,P,$,M,U,E){const C={ctype:0+(P==1?0:2)+($==0?0:4),depth:M,frames:[]},D=(P+$)*M,A=D*I;for(let T=0;T<b.length;T++)C.frames.push({rect:{x:0,y:0,width:I,height:O},img:new Uint8Array(b[T]),blend:0,dispose:1,bpp:Math.ceil(D/8),bpl:Math.ceil(A/8)});return d(C,0,!0),p(C,I,O,U,E)},Me.encode.compress=c,Me.encode.dither=i,Me.quantize=v,Me.quantize.getKDtree=w,Me.quantize.getNearest=y})();const ci={toArrayBuffer(e,t){const n=e.width,o=e.height,r=n<<2,s=e.getContext("2d").getImageData(0,0,n,o),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,p=i*o,d=122+p,c=new ArrayBuffer(d),l=new DataView(c),u=1<<20;let h,g,v,w,y=u,_=0,R=0,k=0;function F(x){l.setUint16(R,x,!0),R+=2}function S(x){l.setUint32(R,x,!0),R+=4}function j(x){R+=x}F(19778),S(d),j(4),S(122),S(108),S(n),S(-o>>>0),F(1),F(32),S(3),S(p),S(2835),S(2835),j(8),S(16711680),S(65280),S(255),S(4278190080),S(1466527264),(function x(){for(;_<o&&y>0;){for(w=122+_*i,h=0;h<r;)y--,g=a[k++],v=g>>>24,l.setUint32(w+h,g<<8|v),h+=4;_++}k<a.length?(y=u,setTimeout(x,ci._dly)):t(c)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Se={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},km={[Se.CHROME]:16384,[Se.FIREFOX]:11180,[Se.DESKTOP_SAFARI]:16384,[Se.IE]:8192,[Se.IOS]:4096,[Se.ETC]:8192};const fo=typeof window<"u",ui=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,In=fo&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),_m=(fo||ui)&&(In&&In.getOriginalSymbol(window,"File")||typeof File<"u"&&File),di=(fo||ui)&&(In&&In.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function po(e,t,n=Date.now()){return new Promise((o=>{const r=e.split(","),s=r[0].match(/:(.*?);/)[1],a=globalThis.atob(r[1]);let i=a.length;const p=new Uint8Array(i);for(;i--;)p[i]=a.charCodeAt(i);const d=new Blob([p],{type:s});d.name=t,d.lastModified=n,o(d)}))}function fi(e){return new Promise(((t,n)=>{const o=new di;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function pi(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function bt(){if(bt.cachedResult!==void 0)return bt.cachedResult;let e=Se.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Se.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Se.IOS:/Safari/i.test(t)?e=Se.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Se.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Se.IE),bt.cachedResult=e,bt.cachedResult}function mi(e,t){const n=bt(),o=km[n];let r=e,s=t,a=r*s;const i=r>s?s/r:r/s;for(;a>o*o;){const p=(o+r)/2,d=(o+s)/2;p<d?(s=d,r=d*i):(s=p*i,r=p),a=r*s}return{width:r,height:s}}function Kn(e,t){let n,o;try{if(n=new OffscreenCanvas(e,t),o=n.getContext("2d"),o===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),o=n.getContext("2d")}return n.width=e,n.height=t,[n,o]}function hi(e,t){const{width:n,height:o}=mi(e.width,e.height),[r,s]=Kn(n,o);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,r.width,r.height)),s.drawImage(e,0,0,r.width,r.height),r}function wn(){return wn.cachedResult!==void 0||(wn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),wn.cachedResult}function Mn(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=hi(r,t.fileType||e.type),n([r,s])}catch(p){return o(p)}},i=function(p){try{var d=function(c){try{throw c}catch(l){return o(l)}};try{let c;return fi(e).then((function(l){try{return c=l,pi(c).then((function(u){try{return r=u,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return d(h)}}),d)}catch(u){return d(u)}}),d)}catch(c){d(c)}}catch(c){return o(c)}};try{if(wn()||[Se.DESKTOP_SAFARI,Se.MOBILE_SAFARI].includes(bt()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(p){try{return r=p,a()}catch{return i()}}),i)}catch{i()}}))}function Pn(e,t,n,o,r=1){return new Promise((function(s,a){let i;if(t==="image/png"){let d,c,l;return d=e.getContext("2d"),{data:c}=d.getImageData(0,0,e.width,e.height),l=Me.encode([c.buffer],e.width,e.height,4096*r),i=new Blob([l],{type:t}),i.name=n,i.lastModified=o,p.call(this)}{let d=function(){return p.call(this)};if(t==="image/bmp")return new Promise((c=>ci.toBlob(e,c))).then((function(c){try{return i=c,i.name=n,i.lastModified=o,d.call(this)}catch(l){return a(l)}}).bind(this),a);{let c=function(){return d.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:r}).then((function(l){try{return i=l,i.name=n,i.lastModified=o,c.call(this)}catch(u){return a(u)}}).bind(this),a);{let l;return l=e.toDataURL(t,r),po(l,n,o).then((function(u){try{return i=u,c.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function p(){return s(i)}}))}function Ue(e){e.width=0,e.height=0}function It(){return new Promise((function(e,t){let n,o,r,s;return It.cachedResult!==void 0?e(It.cachedResult):po("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Mn(n).then((function(i){try{return o=i[1],Pn(o,n.type,n.name,n.lastModified).then((function(p){try{return r=p,Ue(o),Mn(r).then((function(d){try{return s=d[0],It.cachedResult=s.width===1&&s.height===2,e(It.cachedResult)}catch(c){return t(c)}}),t)}catch(d){return t(d)}}),t)}catch(p){return t(p)}}),t)}catch(i){return t(i)}}),t)}))}function gi(e){return new Promise(((t,n)=>{const o=new di;o.onload=r=>{const s=new DataView(r.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const p=s.getUint16(i,!1);if(i+=2,p==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const d=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,d);const c=s.getUint16(i,d);i+=2;for(let l=0;l<c;l++)if(s.getUint16(i+12*l,d)==274)return t(s.getUint16(i+12*l+8,d))}else{if((65280&p)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},o.onerror=r=>n(r),o.readAsArrayBuffer(e)}))}function xi(e,t){const{width:n}=e,{height:o}=e,{maxWidthOrHeight:r}=t;let s,a=e;return isFinite(r)&&(n>r||o>r)&&([a,s]=Kn(n,o),n>o?(a.width=r,a.height=o/n*r):(a.width=n/o*r,a.height=r),s.drawImage(e,0,0,a.width,a.height),Ue(e)),a}function vi(e,t){const{width:n}=e,{height:o}=e,[r,s]=Kn(n,o);switch(t>4&&t<9?(r.width=o,r.height=n):(r.width=n,r.height=o),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,o);break;case 4:s.transform(1,0,0,-1,0,o);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,o,0);break;case 7:s.transform(0,-1,-1,0,o,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,o),Ue(e),r}function as(e,t,n=0){return new Promise((function(o,r){let s,a,i,p,d,c,l,u,h,g,v,w,y,_,R,k,F,S,j,x;function b(O=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=O,t.onProgress(Math.min(s,100))}function I(O){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(O,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,b(),Mn(e,t).then((function(O){try{return[,p]=O,b(),d=xi(p,t),b(),new Promise((function(P,$){var M;if(!(M=t.exifOrientation))return gi(e).then((function(E){try{return M=E,U.call(this)}catch(C){return $(C)}}).bind(this),$);function U(){return P(M)}return U.call(this)})).then((function(P){try{return c=P,b(),It().then((function($){try{return l=$?d:vi(d,c),b(),u=t.initialQuality||1,h=t.fileType||e.type,Pn(l,h,e.name,e.lastModified,u).then((function(M){try{{let E=function(){if(a--&&(R>i||R>y)){let D,A;return D=x?.95*j.width:j.width,A=x?.95*j.height:j.height,[F,S]=Kn(D,A),S.drawImage(j,0,0,D,A),u*=h==="image/png"?.85:.95,Pn(F,h,e.name,e.lastModified,u).then((function(T){try{return k=T,Ue(j),j=F,R=k.size,I(Math.min(99,Math.floor((_-R)/(_-i)*100))),E}catch(H){return r(H)}}),r)}return[1]},C=function(){return Ue(j),Ue(F),Ue(d),Ue(l),Ue(p),I(100),o(k)};if(g=M,b(),v=g.size>i,w=g.size>e.size,!v&&!w)return I(100),o(g);var U;return y=e.size,_=g.size,R=_,j=l,x=!t.alwaysKeepResolution&&v,(U=(function(D){for(;D;){if(D.then)return void D.then(U,r);try{if(D.pop){if(D.length)return D.pop()?C.call(this):D;D=E}else D=D.call(this)}catch(A){return r(A)}}}).bind(this))(E)}}catch(E){return r(E)}}).bind(this),r)}catch(M){return r(M)}}).bind(this),r)}catch($){return r($)}}).bind(this),r)}catch(P){return r(P)}}).bind(this),r)}))}const Rm=`
|
|
183
|
-
let scriptImported = false
|
|
184
|
-
self.addEventListener('message', async (e) => {
|
|
185
|
-
const { file, id, imageCompressionLibUrl, options } = e.data
|
|
186
|
-
options.onProgress = (progress) => self.postMessage({ progress, id })
|
|
187
|
-
try {
|
|
188
|
-
if (!scriptImported) {
|
|
189
|
-
// console.log('[worker] importScripts', imageCompressionLibUrl)
|
|
190
|
-
self.importScripts(imageCompressionLibUrl)
|
|
191
|
-
scriptImported = true
|
|
192
|
-
}
|
|
193
|
-
// console.log('[worker] self', self)
|
|
194
|
-
const compressedFile = await imageCompression(file, options)
|
|
195
|
-
self.postMessage({ file: compressedFile, id })
|
|
196
|
-
} catch (e) {
|
|
197
|
-
// console.error('[worker] error', e)
|
|
198
|
-
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
|
199
|
-
}
|
|
200
|
-
})
|
|
201
|
-
`;let pr;function jm(e,t){return new Promise(((n,o)=>{pr||(pr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Rm));const r=new Worker(pr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return o(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",o),t.signal&&t.signal.addEventListener("abort",(()=>{o(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function ve(e,t){return new Promise((function(n,o){let r,s,a,i,p,d;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,p=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof _m))return o(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return o(new Error("The file given is not an image"));if(d=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!p||typeof Worker!="function"||d)return as(e,r).then((function(h){try{return s=h,u.call(this)}catch(g){return o(g)}}).bind(this),o);var c=(function(){try{return u.call(this)}catch(h){return o(h)}}).bind(this),l=function(h){try{return as(e,r).then((function(g){try{return s=g,c()}catch(v){return o(v)}}),o)}catch(g){return o(g)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",jm(e,r).then((function(h){try{return s=h,c()}catch{return l()}}),l)}catch{l()}function u(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(s=li(e,s))}catch{}return n(s)}}))}ve.getDataUrlFromFile=fi,ve.getFilefromDataUrl=po,ve.loadImage=pi,ve.drawImageInCanvas=hi,ve.drawFileInCanvas=Mn,ve.canvasToFile=Pn,ve.getExifOrientation=gi,ve.handleMaxWidthOrHeight=xi,ve.followExifOrientation=vi,ve.cleanupCanvasMemory=Ue,ve.isAutoOrientationInBrowser=It,ve.approximateBelowMaximumCanvasSizeOfBrowser=mi,ve.copyExifWithoutOrientation=li,ve.getBrowserName=bt,ve.version="2.0.2";var Nm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dt=Nm.reduce((e,t)=>{const n=qs(`Primitive.${t}`),o=m.forwardRef((r,s)=>{const{asChild:a,...i}=r,p=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(p,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Tm=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Im="VisuallyHidden",bi=m.forwardRef((e,t)=>f.jsx(ue.span,{...e,ref:t,style:{...Tm,...e.style}}));bi.displayName=Im;var Mm=bi,[qn]=Qe("Tooltip",[zt]),Xn=zt(),yi="TooltipProvider",Pm=700,Ir="tooltip.open",[Om,mo]=qn(yi),wi=e=>{const{__scopeTooltip:t,delayDuration:n=Pm,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=m.useRef(!0),i=m.useRef(!1),p=m.useRef(0);return m.useEffect(()=>{const d=p.current;return()=>window.clearTimeout(d)},[]),f.jsx(Om,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(p.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:m.useCallback(d=>{i.current=d},[]),disableHoverableContent:r,children:s})};wi.displayName=yi;var Jt="Tooltip",[Dm,un]=qn(Jt),Ci=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,p=mo(Jt,e.__scopeTooltip),d=Xn(t),[c,l]=m.useState(null),u=we(),h=m.useRef(0),g=a??p.disableHoverableContent,v=i??p.delayDuration,w=m.useRef(!1),[y,_]=at({prop:o,defaultProp:r??!1,onChange:j=>{j?(p.onOpen(),document.dispatchEvent(new CustomEvent(Ir))):p.onClose(),s==null||s(j)},caller:Jt}),R=m.useMemo(()=>y?w.current?"delayed-open":"instant-open":"closed",[y]),k=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w.current=!1,_(!0)},[_]),F=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),S=m.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{w.current=!0,_(!0),h.current=0},v)},[v,_]);return m.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),f.jsx(eo,{...d,children:f.jsx(Dm,{scope:t,contentId:u,open:y,stateAttribute:R,trigger:c,onTriggerChange:l,onTriggerEnter:m.useCallback(()=>{p.isOpenDelayedRef.current?S():k()},[p.isOpenDelayedRef,S,k]),onTriggerLeave:m.useCallback(()=>{g?F():(window.clearTimeout(h.current),h.current=0)},[F,g]),onOpen:k,onClose:F,disableHoverableContent:g,children:n})})};Ci.displayName=Jt;var Mr="TooltipTrigger",Si=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=un(Mr,n),s=mo(Mr,n),a=Xn(n),i=m.useRef(null),p=me(t,i,r.onTriggerChange),d=m.useRef(!1),c=m.useRef(!1),l=m.useCallback(()=>d.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",l),[l]),f.jsx(Hn,{asChild:!0,...a,children:f.jsx(ue.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:p,onPointerMove:ee(e.onPointerMove,u=>{u.pointerType!=="touch"&&!c.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),c.current=!0)}),onPointerLeave:ee(e.onPointerLeave,()=>{r.onTriggerLeave(),c.current=!1}),onPointerDown:ee(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",l,{once:!0})}),onFocus:ee(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:ee(e.onBlur,r.onClose),onClick:ee(e.onClick,r.onClose)})})});Si.displayName=Mr;var ho="TooltipPortal",[Lm,Fm]=qn(ho,{forceMount:void 0}),Ei=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=un(ho,t);return f.jsx(Lm,{scope:t,forceMount:n,children:f.jsx(je,{present:n||s.open,children:f.jsx(sn,{asChild:!0,container:r,children:o})})})};Ei.displayName=ho;var Lt="TooltipContent",Ai=m.forwardRef((e,t)=>{const n=Fm(Lt,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=un(Lt,e.__scopeTooltip);return f.jsx(je,{present:o||a.open,children:a.disableHoverableContent?f.jsx(ki,{side:r,...s,ref:t}):f.jsx($m,{side:r,...s,ref:t})})}),$m=m.forwardRef((e,t)=>{const n=un(Lt,e.__scopeTooltip),o=mo(Lt,e.__scopeTooltip),r=m.useRef(null),s=me(t,r),[a,i]=m.useState(null),{trigger:p,onClose:d}=n,c=r.current,{onPointerInTransitChange:l}=o,u=m.useCallback(()=>{i(null),l(!1)},[l]),h=m.useCallback((g,v)=>{const w=g.currentTarget,y={x:g.clientX,y:g.clientY},_=Hm(y,w.getBoundingClientRect()),R=Wm(y,_),k=Gm(v.getBoundingClientRect()),F=Km([...R,...k]);i(F),l(!0)},[l]);return m.useEffect(()=>()=>u(),[u]),m.useEffect(()=>{if(p&&c){const g=w=>h(w,c),v=w=>h(w,p);return p.addEventListener("pointerleave",g),c.addEventListener("pointerleave",v),()=>{p.removeEventListener("pointerleave",g),c.removeEventListener("pointerleave",v)}}},[p,c,h,u]),m.useEffect(()=>{if(a){const g=v=>{const w=v.target,y={x:v.clientX,y:v.clientY},_=(p==null?void 0:p.contains(w))||(c==null?void 0:c.contains(w)),R=!Vm(y,a);_?u():R&&(u(),d())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[p,c,a,d,u]),f.jsx(ki,{...e,ref:s})}),[Um,zm]=qn(Jt,{isInside:!1}),Bm=Vu("TooltipContent"),ki=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,p=un(Lt,n),d=Xn(n),{onClose:c}=p;return m.useEffect(()=>(document.addEventListener(Ir,c),()=>document.removeEventListener(Ir,c)),[c]),m.useEffect(()=>{if(p.trigger){const l=u=>{const h=u.target;h!=null&&h.contains(p.trigger)&&c()};return window.addEventListener("scroll",l,{capture:!0}),()=>window.removeEventListener("scroll",l,{capture:!0})}},[p.trigger,c]),f.jsx(rn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l=>l.preventDefault(),onDismiss:c,children:f.jsxs(to,{"data-state":p.stateAttribute,...d,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(Bm,{children:o}),f.jsx(Um,{scope:n,isInside:!0,children:f.jsx(Mm,{id:p.contentId,role:"tooltip",children:r||o})})]})})});Ai.displayName=Lt;var _i="TooltipArrow",Ri=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=Xn(n);return zm(_i,n).isInside?null:f.jsx(no,{...r,...o,ref:t})});Ri.displayName=_i;function Hm(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Wm(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function Gm(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function Vm(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],p=t[a],d=i.x,c=i.y,l=p.x,u=p.y;c>o!=u>o&&n<(l-d)*(o-c)/(u-c)+d&&(r=!r)}return r}function Km(e){const t=e.slice();return t.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),qm(t)}function qm(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const r=e[o];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Xm=wi,Ym=Ci,Qm=Si,Zm=Ei,Jm=Ai,eh=Ri;function th({delayDuration:e=0,...t}){return f.jsx(Xm,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function nh({...e}){return f.jsx(th,{children:f.jsx(Ym,{"data-slot":"tooltip",...e})})}function rh({...e}){return f.jsx(Qm,{"data-slot":"tooltip-trigger",...e})}function oh({className:e,sideOffset:t=0,children:n,...o}){return f.jsx(Zm,{children:f.jsxs(Jm,{"data-slot":"tooltip-content",sideOffset:t,className:J("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...o,children:[n,f.jsx(eh,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const sh=m.lazy(()=>Re(()=>import("./mermaid-VLURNSYL-CG6yNR7g.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));m.createContext(null);const go=m.memo(({className:e,children:t,...n})=>f.jsx(m.Suspense,{fallback:f.jsx("div",{className:J("whitespace-pre-wrap break-words",e),children:t}),children:f.jsx(sh,{className:J("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);go.displayName="MessageResponse";var Yn="Collapsible",[ah]=Qe(Yn),[ih,xo]=ah(Yn),ji=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[p,d]=at({prop:o,defaultProp:r??!1,onChange:a,caller:Yn});return f.jsx(ih,{scope:n,disabled:s,contentId:we(),open:p,onOpenToggle:m.useCallback(()=>d(c=>!c),[d]),children:f.jsx(ue.div,{"data-state":bo(p),"data-disabled":s?"":void 0,...i,ref:t})})});ji.displayName=Yn;var Ni="CollapsibleTrigger",Ti=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=xo(Ni,n);return f.jsx(ue.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":bo(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:ee(e.onClick,r.onOpenToggle)})});Ti.displayName=Ni;var vo="CollapsibleContent",Ii=m.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=xo(vo,e.__scopeCollapsible);return f.jsx(je,{present:n||r.open,children:({present:s})=>f.jsx(lh,{...o,ref:t,present:s})})});Ii.displayName=vo;var lh=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=xo(vo,n),[i,p]=m.useState(o),d=m.useRef(null),c=me(t,d),l=m.useRef(0),u=l.current,h=m.useRef(0),g=h.current,v=a.open||i,w=m.useRef(v),y=m.useRef(void 0);return m.useEffect(()=>{const _=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(_)},[]),Ke(()=>{const _=d.current;if(_){y.current=y.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const R=_.getBoundingClientRect();l.current=R.height,h.current=R.width,w.current||(_.style.transitionDuration=y.current.transitionDuration,_.style.animationName=y.current.animationName),p(o)}},[a.open,o]),f.jsx(ue.div,{"data-state":bo(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:c,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function bo(e){return e?"open":"closed"}var ch=ji;function uh({...e}){return f.jsx(ch,{"data-slot":"collapsible",...e})}function dh({...e}){return f.jsx(Ti,{"data-slot":"collapsible-trigger",...e})}function fh({...e}){return f.jsx(Ii,{"data-slot":"collapsible-content",...e})}const ph=({children:e,as:t="p",className:n,duration:o=2})=>{const r=Tl.create(t);return f.jsx(r,{animate:{opacity:[.5,1,.5]},className:J("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},mh=m.memo(ph),Mi=m.createContext(null),hh=()=>{const e=m.useContext(Mi);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},gh=1e3,xh=1e3,Pi=m.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[p,d]=at({prop:n,defaultProp:o,onChange:r}),[c,l]=at({prop:s,defaultProp:void 0}),[u,h]=m.useState(!1),[g,v]=m.useState(null);m.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(l(Math.ceil((Date.now()-g)/xh)),v(null))},[t,g,l]);const w=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;m.useEffect(()=>{if(!w&&o&&!t&&p&&!u){const _=setTimeout(()=>{d(!1),h(!0)},gh);return()=>clearTimeout(_)}},[t,p,o,d,u,w]);const y=_=>{d(_)};return f.jsx(Mi.Provider,{value:{isStreaming:t,isOpen:p??!1,setIsOpen:d,duration:c},children:f.jsx(uh,{className:J("not-prose mb-4",e),onOpenChange:y,open:p,...i,children:a})})}),vh=(e,t)=>e||t===0?f.jsx(mh,{duration:1,children:"Thinking..."}):t===void 0?f.jsx("p",{children:"Thought for a few seconds"}):f.jsxs("p",{children:["Thought for ",t," seconds"]}),Oi=m.memo(({className:e,children:t,getThinkingMessage:n=vh,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=hh();return f.jsx(dh,{className:J("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??f.jsxs(f.Fragment,{children:[f.jsx(Mc,{className:"size-4"}),n(r,a),f.jsx(nn,{className:J("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),Di=m.memo(({className:e,children:t,...n})=>f.jsx(fh,{className:J("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));Pi.displayName="Reasoning";Oi.displayName="ReasoningTrigger";Di.displayName="ReasoningContent";const mr=200;function bh({entry:e}){const[t,n]=m.useState(!1),[o,r]=m.useState(!1),s=m.useRef(null),a=m.useCallback(()=>{const i=s.current;i&&r(i.scrollHeight>mr+4)},[]);return m.useEffect(()=>{a()},[a,e.content]),f.jsx("div",{className:"flex justify-end",children:f.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&f.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,p)=>f.jsx(wh,{image:i},p))}),e.attachments&&e.attachments.length>0&&f.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,p)=>f.jsx(Ch,{attachment:i},p))}),e.content&&f.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[f.jsx("div",{ref:s,className:J("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${mr}px]`),style:!t&&o?{maxHeight:`${mr}px`}:void 0,children:Sc(e.content)}),!t&&o&&f.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:f.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[f.jsx("span",{children:"展开"}),f.jsx(nn,{className:"h-3 w-3"})]})})]})]})})}function yh({entry:e,isStreaming:t}){return f.jsxs("div",{className:"flex gap-4 items-start",children:[f.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:f.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),f.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[f.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,o)=>{if(n.type==="thought"){const r=o===e.chunks.length-1,s=t&&r;return f.jsxs(Pi,{isStreaming:s,children:[f.jsx(Oi,{}),f.jsx(Di,{children:f.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return f.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:f.jsx(go,{children:n.text})},o)})]})]})}function wh({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return f.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:f.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function Ch({attachment:e}){const[t,n]=m.useState(!1),o=(()=>{switch(e.kind){case"text":return f.jsx(Xt,{className:"h-4 w-4"});case"table":return f.jsx(Wr,{className:"h-4 w-4"});case"directory":return f.jsx(Hr,{className:"h-4 w-4"});default:return f.jsx(Xt,{className:"h-4 w-4"})}})(),r=e.size!=null?Sh(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return f.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[f.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:J("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[o,f.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[f.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),f.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&f.jsx("span",{children:r}),r&&s!=null&&f.jsx("span",{children:" · "}),s!=null&&f.jsxs("span",{children:[s," 个文件"]})]})]}),a&&f.jsx(nn,{className:J("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&f.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:f.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Sh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Eh(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Ah(e){switch(e){case"allow_once":case"allow_always":return f.jsx(tn,{className:"size-4"});case"reject_once":case"reject_always":return f.jsx(Ln,{className:"size-4"});default:return null}}function kh({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return f.jsxs("div",{className:J("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[f.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[f.jsx(Hs,{className:"size-4 text-warning-text"}),f.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),f.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>f.jsxs(At,{variant:Eh(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[Ah(s.kind),s.name]},s.optionId))})]})}function Li({entries:e,onPermissionRespond:t}){const[n,o]=m.useState(!1);if(e.length===0)return null;if(e.length===1)return f.jsx("div",{className:"pl-10",children:f.jsx(is,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=_h(e);return f.jsx("div",{className:"pl-10",children:f.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[f.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>o(!n),children:[f.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:J("transition-transform text-text-muted",n&&"rotate-90"),children:f.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),f.jsx("span",{className:"text-xs text-brand font-bold font-display",children:r})]}),n&&f.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>f.jsx(is,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function is({tool:e,compact:t,onPermissionRespond:n}){const[o,r]=m.useState(!t),s=(()=>{switch(e.status){case"running":return f.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return f.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return f.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return f.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return f.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return f.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=e.status!=="running"&&e.status!=="waiting_for_confirmation"&&(e.rawOutput||e.content);return f.jsxs("div",{className:J("px-3 py-2",t&&"py-1.5"),children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!o),children:[s,f.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&f.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&f.jsx("div",{className:"mt-1.5 ml-4",children:f.jsx(kh,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),o&&f.jsxs("div",{className:"mt-1.5 ml-4 space-y-1.5",children:[e.rawInput&&Object.keys(e.rawInput).length>0&&f.jsx("div",{children:f.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Pr(JSON.stringify(e.rawInput,null,2),2e3)})}),a&&f.jsx("div",{children:f.jsx("pre",{className:J("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:jh(e)})})]})]})}function _h(e){const t=new Map;for(const o of e){const r=Rh(o.toolCall.title);t.set(r,(t.get(r)||0)+1)}const n=[];for(const[o,r]of t)n.push(r===1?o:`${r} 次${o}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function Rh(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function jh(e){if(e.content&&e.content.length>0){const t=e.content.filter(n=>n.type==="content").filter(n=>n.content.type==="text"&&"text"in n.content).map(n=>n.content.text);if(t.length>0)return Pr(t.join(`
|
|
202
|
-
`),2e3)}return e.rawOutput&&Object.keys(e.rawOutput).length>0?Pr(JSON.stringify(e.rawOutput,null,2),2e3):""}function Pr(e,t){return e.length>t?e.slice(0,t)+"...":e}function Nh({entry:e}){const[t,n]=m.useState(!1),{entries:o}=e;if(o.length===0)return null;const r=o.filter(i=>i.status==="completed").length,s=o.length,a=s>0?Math.round(r/s*100):0;return f.jsx("div",{className:"pl-10",children:f.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[f.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[f.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:J("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:f.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),f.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),f.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",s]}),f.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:f.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),f.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&f.jsx("div",{className:J("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:o.map((i,p)=>f.jsx(Th,{entry:i},p))})]})})}function Th({entry:e}){return f.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[f.jsx("span",{className:"flex-shrink-0 mt-0.5",children:f.jsx(Ih,{status:e.status})}),f.jsx("span",{className:J("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),f.jsx(Mh,{priority:e.priority})]})}function Ih({status:e}){switch(e){case"completed":return f.jsx(Uc,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return f.jsx(Us,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return f.jsx(Bc,{className:"h-3.5 w-3.5 text-text-muted"})}}function Mh({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return f.jsx("span",{className:J("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Ph({entry:e}){const t=e.variant==="error";return f.jsxs("div",{className:"w-full",children:[f.jsx("div",{className:J("border-t-2",t?"border-status-error":"border-border")}),f.jsxs("div",{className:"pt-3",children:[f.jsx("h3",{className:J("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&f.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),f.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:f.jsx(go,{children:e.outputText})}),f.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
|
|
203
|
-
* Copyright (c) StackBlitz. All rights reserved.
|
|
204
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
205
|
-
*--------------------------------------------------------------------------------------------*/const Oh={damping:.7,stiffness:.05,mass:1.25},Dh=70,Lh=1e3/60,Fh=350;let Qn=!1;var vs;(vs=globalThis.document)==null||vs.addEventListener("mousedown",()=>{Qn=!0});var bs;(bs=globalThis.document)==null||bs.addEventListener("mouseup",()=>{Qn=!1});var ys;(ys=globalThis.document)==null||ys.addEventListener("click",()=>{Qn=!1});const $h=(e={})=>{const[t,n]=m.useState(!1),[o,r]=m.useState(e.initial!==!1),[s,a]=m.useState(!1),i=m.useRef(null);i.current=e;const p=m.useCallback(()=>{var k;if(!Qn)return!1;const _=window.getSelection();if(!_||!_.rangeCount)return!1;const R=_.getRangeAt(0);return R.commonAncestorContainer.contains(w.current)||((k=w.current)==null?void 0:k.contains(R.commonAncestorContainer))},[]),d=m.useCallback(_=>{l.isAtBottom=_,r(_)},[]),c=m.useCallback(_=>{l.escapedFromLock=_,n(_)},[]),l=m.useMemo(()=>{let _;return{escapedFromLock:t,isAtBottom:o,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var R;return((R=w.current)==null?void 0:R.scrollTop)??0},set scrollTop(R){if(w.current){const{scrollBehavior:k}=getComputedStyle(w.current);k!=="auto"&&(w.current.style.scrollBehavior="auto"),w.current.scrollTop=R,l.ignoreScrollToTop=w.current.scrollTop,k!=="auto"&&(w.current.style.scrollBehavior=k)}},get targetScrollTop(){return!w.current||!y.current?0:w.current.scrollHeight-1-w.current.clientHeight},get calculatedTargetScrollTop(){if(!w.current||!y.current)return 0;const{targetScrollTop:R}=this;if(!e.targetScrollTop)return R;if((_==null?void 0:_.targetScrollTop)===R)return _.calculatedScrollTop;const k=Math.max(Math.min(e.targetScrollTop(R,{scrollElement:w.current,contentElement:y.current}),R),0);return _={targetScrollTop:R,calculatedScrollTop:k},requestAnimationFrame(()=>{_=void 0}),k},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Dh}}},[]),u=m.useCallback((_={})=>{var b;typeof _=="string"&&(_={animation:_}),_.preserveScrollPosition||d(!0);const R=Date.now()+(Number(_.wait)||0),k=gr(i.current,_.animation),{ignoreEscapes:F=!1}=_;let S,j=l.calculatedTargetScrollTop;_.duration instanceof Promise?_.duration.finally(()=>{S=Date.now()}):S=R+(_.duration??0);const x=async()=>{const I=new Promise(requestAnimationFrame).then(()=>{var M;if(!l.isAtBottom)return l.animation=void 0,!1;const{scrollTop:O}=l,P=performance.now(),$=(P-(l.lastTick??P))/Lh;if(l.animation||(l.animation={behavior:k,promise:I,ignoreEscapes:F}),l.animation.behavior===k&&(l.lastTick=P),p()||R>Date.now())return x();if(O<Math.min(j,l.calculatedTargetScrollTop)){if(((M=l.animation)==null?void 0:M.behavior)===k){if(k==="instant")return l.scrollTop=l.calculatedTargetScrollTop,x();l.velocity=(k.damping*l.velocity+k.stiffness*l.scrollDifference)/k.mass,l.accumulated+=l.velocity*$,l.scrollTop+=l.accumulated,l.scrollTop!==O&&(l.accumulated=0)}return x()}return S>Date.now()?(j=l.calculatedTargetScrollTop,x()):(l.animation=void 0,l.scrollTop<l.calculatedTargetScrollTop?u({animation:gr(i.current,i.current.resize),ignoreEscapes:F,duration:Math.max(0,S-Date.now())||void 0}):l.isAtBottom)});return I.then(O=>(requestAnimationFrame(()=>{l.animation||(l.lastTick=void 0,l.velocity=0)}),O))};return _.wait!==!0&&(l.animation=void 0),((b=l.animation)==null?void 0:b.behavior)===k?l.animation.promise:x()},[d,p,l]),h=m.useCallback(()=>{c(!0),d(!1)},[c,d]),g=m.useCallback(({target:_})=>{if(_!==w.current)return;const{scrollTop:R,ignoreScrollToTop:k}=l;let{lastScrollTop:F=R}=l;l.lastScrollTop=R,l.ignoreScrollToTop=void 0,k&&k>R&&(F=k),a(l.isNearBottom),setTimeout(()=>{var x;if(l.resizeDifference||R===k)return;if(p()){c(!0),d(!1);return}const S=R>F,j=R<F;if((x=l.animation)!=null&&x.ignoreEscapes){l.scrollTop=F;return}j&&(c(!0),d(!1)),S&&c(!1),!l.escapedFromLock&&l.isNearBottom&&d(!0)},1)},[c,d,p,l]),v=m.useCallback(({target:_,deltaY:R})=>{var F;let k=_;for(;!["scroll","auto"].includes(getComputedStyle(k).overflow);){if(!k.parentElement)return;k=k.parentElement}k===w.current&&R<0&&w.current.scrollHeight>w.current.clientHeight&&!((F=l.animation)!=null&&F.ignoreEscapes)&&(c(!0),d(!1))},[c,d,l]),w=ls(_=>{var R,k;(R=w.current)==null||R.removeEventListener("scroll",g),(k=w.current)==null||k.removeEventListener("wheel",v),_==null||_.addEventListener("scroll",g,{passive:!0}),_==null||_.addEventListener("wheel",v,{passive:!0})},[]),y=ls(_=>{var k,F;if((k=l.resizeObserver)==null||k.disconnect(),!_)return;let R;l.resizeObserver=new ResizeObserver(([S])=>{const{height:j}=S.contentRect,x=j-(R??j);if(l.resizeDifference=x,l.scrollTop>l.targetScrollTop&&(l.scrollTop=l.targetScrollTop),a(l.isNearBottom),x>=0){const b=gr(i.current,R?i.current.resize:i.current.initial);u({animation:b,wait:!0,preserveScrollPosition:!0,duration:b==="instant"?void 0:Fh})}else l.isNearBottom&&(c(!1),d(!0));R=j,requestAnimationFrame(()=>{setTimeout(()=>{l.resizeDifference===x&&(l.resizeDifference=0)},1)})}),(F=l.resizeObserver)==null||F.observe(_)},[]);return{contentRef:y,scrollRef:w,scrollToBottom:u,stopScroll:h,isAtBottom:o||s,isNearBottom:s,escapedFromLock:t,state:l}};function ls(e,t){const n=m.useCallback(o=>(n.current=o,e(o)),t);return n}const hr=new Map;function gr(...e){const t={...Oh};let n=!1;for(const r of e){if(r==="instant"){n=!0;continue}typeof r=="object"&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}const o=JSON.stringify(t);return hr.has(o)||hr.set(o,Object.freeze(t)),n?"instant":hr.get(o)}/*!---------------------------------------------------------------------------------------------
|
|
206
|
-
* Copyright (c) StackBlitz. All rights reserved.
|
|
207
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
208
|
-
*--------------------------------------------------------------------------------------------*/const Fi=m.createContext(null),Uh=typeof window<"u"?m.useLayoutEffect:m.useEffect;function On({instance:e,children:t,resize:n,initial:o,mass:r,damping:s,stiffness:a,targetScrollTop:i,contextRef:p,...d}){const c=m.useRef(null),l=m.useCallback((F,S)=>{const j=(k==null?void 0:k.targetScrollTop)??i;return(j==null?void 0:j(F,S))??F},[i]),u=$h({mass:r,damping:s,stiffness:a,resize:n,initial:o,targetScrollTop:l}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:w,isAtBottom:y,escapedFromLock:_,state:R}=e??u,k=m.useMemo(()=>({scrollToBottom:v,stopScroll:w,scrollRef:h,isAtBottom:y,escapedFromLock:_,contentRef:g,state:R,get targetScrollTop(){return c.current},set targetScrollTop(F){c.current=F}}),[v,y,g,h,w,_,R]);return m.useImperativeHandle(p,()=>k,[k]),Uh(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),m.createElement(Fi.Provider,{value:k},m.createElement("div",{...d},typeof t=="function"?t(k):t))}(function(e){function t({children:n,scrollClassName:o,...r}){const s=yo();return m.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:o},m.createElement("div",{...r,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(On||(On={}));function yo(){const e=m.useContext(Fi);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const zh=({className:e,...t})=>f.jsx(On,{className:J("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Bh=({className:e,...t})=>f.jsx(On.Content,{className:J("mx-auto flex max-w-3xl flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),Hh=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:o,children:r,...s})=>f.jsx("div",{className:J("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:r??f.jsxs(f.Fragment,{children:[o&&f.jsx("div",{className:"text-text-muted",children:o}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&f.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),Wh=({className:e,...t})=>{const{scrollToBottom:n}=yo(),o=m.useCallback(()=>{n()},[n]);return f.jsx(At,{className:J("rounded-full",e),onClick:o,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:f.jsx(Tc,{className:"size-4"})})},Gh="data-last-user-message",Vh=({className:e,...t})=>{const n=m.useCallback(()=>{const o=document.querySelector(`[${Gh}="true"]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})},[]);return f.jsx(At,{className:J("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:f.jsx(ku,{className:"size-4"})})},Kh=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:o}=yo();return o?null:f.jsxs("div",{className:J("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&f.jsx(Vh,{}),f.jsx(Wh,{})]})};function qh({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:o="开始对话",emptyDescription:r="输入消息开始聊天"}){var p;const s=Qh(e),a=e.length>0,i=t&&e.length>0&&((p=e[e.length-1])==null?void 0:p.type)==="user_message";return f.jsx(zh,{className:"flex-1",children:f.jsxs(Bh,{children:[a?f.jsxs(f.Fragment,{children:[s.map((d,c)=>d.type==="single"?f.jsx("div",{className:J(Xh(e,c)),children:f.jsx(Yh,{entry:d.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`):f.jsx("div",{className:"-mt-2",children:f.jsx(Li,{entries:d.entries,onPermissionRespond:n})},`group-${c}`)),i&&f.jsxs("div",{className:"flex gap-4 items-start",children:[f.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:f.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),f.jsx("div",{className:"flex items-center gap-1 pt-2",children:f.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[f.jsx("span",{}),f.jsx("span",{}),f.jsx("span",{})]})})]})]}):f.jsx(Hh,{title:o,description:r}),f.jsx(Kh,{hasUserMessages:e.some(d=>d.type==="user_message")})]})})}function Xh(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const o=e[t+1];return(o==null?void 0:o.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function Yh({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return f.jsx(bh,{entry:e});case"assistant_message":return f.jsx(yh,{entry:e,isStreaming:t});case"tool_call":return f.jsx(Li,{entries:[e],onPermissionRespond:n});case"plan":return f.jsx(Nh,{entry:e});case"command_output":return f.jsx(Ph,{entry:e});default:return null}}function Qh(e){const t=[];let n=[];const o=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const r of e)r.type==="tool_call"?n.push(r):(o(),t.push({type:"single",entry:r}));return o(),t}function Zh(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function Jh({commands:e,filter:t,onSelect:n,onClose:o,className:r}){const s=m.useRef(null),[a,i]=m.useState(0),p=m.useMemo(()=>t?e.filter(d=>Zh(t,d.name)):e,[e,t]);return m.useEffect(()=>{i(0)},[t]),m.useEffect(()=>{const d=c=>{s.current&&!s.current.contains(c.target)&&o()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),m.useEffect(()=>{const d=c=>{if(p.length!==0){if(c.key==="ArrowDown")c.preventDefault(),i(l=>(l+1)%p.length);else if(c.key==="ArrowUp")c.preventDefault(),i(l=>(l-1+p.length)%p.length);else if(c.key==="Enter"&&!c.shiftKey){c.preventDefault();const l=p[a];l&&n(l)}}};return document.addEventListener("keydown",d,!0),()=>document.removeEventListener("keydown",d,!0)},[p,a,n]),m.useEffect(()=>{const d=s.current;if(!d)return;const c=d.querySelector("[data-active='true']");c==null||c.scrollIntoView({block:"nearest"})},[a]),f.jsx("div",{ref:s,className:J("rounded-xl border border-border bg-surface-2 shadow-lg",r),children:f.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:p.length===0?f.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):p.map((d,c)=>{var l;return f.jsxs("button",{type:"button","data-active":c===a,onClick:()=>n(d),onMouseEnter:()=>i(c),className:J("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",c===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[f.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",d.name]}),f.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:d.description}),((l=d.input)==null?void 0:l.hint)&&f.jsx("span",{className:"text-[10px] text-text-muted italic",children:d.input.hint})]},d.name)})})})}function yt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const eg={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},tg=500*1024,$i=2*1024*1024,xr=200,cs=5*1024*1024,ng=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),rg=new Set([".csv",".tsv",".xlsx",".xls"]);function en(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Ui(e){if(e.type.startsWith("text/"))return!0;const t=en(e.name);return ng.has(t)}function Or(e){const t=en(e.name);return rg.has(t)}function og({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:o=!1,placeholder:r="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,className:p}){const d=s??a??!1,[c,l]=m.useState(""),[u,h]=m.useState([]),[g,v]=m.useState([]),[w,y]=m.useState(!1),[_,R]=m.useState(""),[k,F]=m.useState(!1),[S,j]=m.useState(!1),[x,b]=m.useState(!1),I=m.useRef(null),O=m.useRef(null),P=m.useRef(null),$=m.useRef(null),M=m.useRef(null),U=m.useRef(null),E=m.useRef(null);m.useEffect(()=>{yt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:d,commandsCount:(i==null?void 0:i.length)??0})},[d,i]),m.useEffect(()=>{if(!S)return;const W=q=>{var re,fe;const Z=q.target,te=(re=U.current)==null?void 0:re.contains(Z),ie=(fe=E.current)==null?void 0:fe.contains(Z);!te&&!ie&&j(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[S]);const C=m.useCallback(W=>{const q=(W??c).trim(),Z=u.length>0||g.length>0;!q&&!Z||o||x||(e({text:q,images:u.length>0?u:void 0,attachments:g.length>0?g:void 0}),l(""),h([]),v([]),y(!1),R(""),I.current&&(I.current.style.height="auto"))},[c,u,g,o,x,e]),D=m.useCallback(W=>{if(w){if(W.key==="Escape"){W.preventDefault(),y(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),y(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t?n==null||n():C())},[C,t,n,w]),A=m.useCallback(W=>{const q=W.target.value;l(q),q.startsWith("/")&&i&&i.length>0?(y(!0),R(q.slice(1).split(/\s/)[0]||"")):w&&(y(!1),R(""));const Z=W.target;Z.style.height="auto",Z.style.height=Math.min(Z.scrollHeight,200)+"px"},[i,w]),T=m.useCallback(async W=>{if(yt("[ChatInput] paste event",{canAttach:d,files:W.clipboardData.files.length,types:W.clipboardData.types}),!d)return;const q=Array.from(W.clipboardData.files).filter(Z=>Z.type.startsWith("image/"));if(yt("[ChatInput] paste image files",{count:q.length,types:q.map(Z=>Z.type)}),q.length!==0){W.preventDefault(),b(!0);try{const Z=await vr(q);h(te=>[...te,...Z])}finally{b(!1)}}},[d]),H=m.useCallback(async()=>{if(!O.current)return;const W=O.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await vr(Array.from(W));h(Z=>[...Z,...q])}finally{O.current.value="",b(!1)}}},[]),N=m.useCallback(async()=>{if(!P.current)return;const W=P.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await us(Array.from(W));v(Z=>[...Z,...q])}finally{P.current.value="",b(!1)}}},[]),B=m.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await ds(Array.from(W));v(Z=>[...Z,...q])}finally{$.current.value="",b(!1)}}},[]),z=m.useCallback(async()=>{if(!M.current)return;const W=M.current.files;if(!(!W||W.length===0)){b(!0);try{const q=await ag(Array.from(W));q&&v(Z=>[...Z,q])}finally{M.current.value="",b(!1)}}},[]),L=m.useCallback(W=>{h(q=>q.filter((Z,te)=>te!==W))},[]),G=m.useCallback(W=>{v(q=>q.filter((Z,te)=>te!==W))},[]),V=m.useCallback(W=>{var Z,te;y(!1),R("");const q=`/${W.name}`;(Z=W.input)!=null&&Z.hint?(l(`${q} `),(te=I.current)==null||te.focus()):C(q)},[C]),Y=m.useCallback(W=>{d&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",k||F(!0))},[d,k]),K=m.useCallback(W=>{const q=W.relatedTarget;(!q||!W.currentTarget.contains(q))&&F(!1)},[]),ne=m.useCallback(async W=>{if(!d)return;const q=Array.from(W.dataTransfer.files);if(q.length!==0){W.preventDefault(),F(!1),b(!0);try{const Z=q.filter(re=>re.type.startsWith("image/")),te=q.filter(re=>!re.type.startsWith("image/")&&Or(re)),ie=q.filter(re=>!re.type.startsWith("image/")&&!Or(re)&&Ui(re));if(Z.length>0){const re=await vr(Z);h(fe=>[...fe,...re])}if(te.length>0){const re=await ds(te);v(fe=>[...fe,...re])}if(ie.length>0){const re=await us(ie);v(fe=>[...fe,...re])}}finally{b(!1)}}},[d]),ae=m.useCallback(()=>{var W;w?(y(!1),R("")):(c.startsWith("/")||l("/"+c),y(!0),R(c.startsWith("/")&&c.slice(1).split(/\s/)[0]||""),(W=I.current)==null||W.focus())},[w,c]),le=u.length+g.length,pe=(c.trim()||le>0)&&!o&&!x;return f.jsxs("div",{className:J("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",p),children:[f.jsxs("div",{className:"relative",children:[w&&i&&i.length>0&&f.jsx(Jh,{commands:i,filter:_,onSelect:V,onClose:()=>{y(!1),R("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),S&&d&&f.jsxs("div",{ref:U,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[f.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=O.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[f.jsx(Vc,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),f.jsx("span",{children:"图片"})]}),f.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=P.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[f.jsx(Xt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),f.jsx("span",{children:"文本文件"})]}),f.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=$.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[f.jsx(Wr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),f.jsx("span",{children:"表格文件"})]}),f.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=M.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[f.jsx(Hr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),f.jsx("span",{children:"目录"})]})]}),f.jsxs("div",{onDragOver:Y,onDragLeave:K,onDrop:ne,className:J("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",k&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[u.length>0&&f.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:u.map((W,q)=>f.jsxs("div",{className:"relative group",children:[f.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${q+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),f.jsx("button",{type:"button",onClick:()=>L(q),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${q+1}`,children:"×"})]},q))}),g.length>0&&f.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:g.map((W,q)=>f.jsx(sg,{attachment:W,onRemove:()=>G(q)},q))}),f.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[d&&f.jsxs("div",{className:"relative flex-shrink-0",children:[f.jsxs("button",{ref:E,type:"button",onClick:()=>j(W=>!W),disabled:o||x,className:J("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",S?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[f.jsx(au,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Attach"})]}),f.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:H}),f.jsx("input",{ref:P,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:N}),f.jsx("input",{ref:$,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:B}),f.jsx("input",{ref:M,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:z})]}),i&&i.length>0&&f.jsx("button",{type:"button",onClick:ae,className:J("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",w?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:o,title:"命令列表",children:f.jsx(vu,{className:"h-4 w-4"})}),f.jsx("textarea",{ref:I,value:c,onChange:A,onKeyDown:D,onPaste:T,placeholder:x?"处理文件中…":r,disabled:o,rows:1,className:J("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),f.jsx("button",{type:"button",onClick:t?n:()=>C(),disabled:!t&&!pe,className:J("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":pe?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?f.jsx(yu,{className:"h-3.5 w-3.5",fill:"currentColor"}):x?f.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):f.jsx(pu,{className:"h-4 w-4"})})]})]})]}),f.jsx("div",{className:"text-center mt-1.5",children:f.jsx("span",{className:"text-[11px] text-text-muted font-display",children:"Enter 发送,Shift+Enter 换行"})})]})}function sg({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return f.jsx(Xt,{className:"h-3.5 w-3.5"});case"table":return f.jsx(Wr,{className:"h-3.5 w-3.5"});case"directory":return f.jsx(Hr,{className:"h-3.5 w-3.5"});default:return f.jsx(Xt,{className:"h-3.5 w-3.5"})}})(),o=e.size!=null?Pt(e.size):null,r=e.kind==="directory"&&e.files?e.files.length:null;return f.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,f.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),o&&f.jsx("span",{className:"text-text-muted text-[10px]",children:o}),r!=null&&f.jsxs("span",{className:"text-text-muted text-[10px]",children:[r," 文件"]}),f.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:f.jsx(Ln,{className:"h-3 w-3"})})]})}function Pt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function vr(e){const t=[];for(const n of e)try{let o=n,r=n.type;n.size>2*1024*1024&&(o=await ve(n,eg),r="image/jpeg");const s=await ig(o);t.push({mimeType:r,data:s})}catch(o){console.error("Failed to process image:",o)}return t}async function us(e){const t=[];for(const n of e)try{if(n.size>$i){console.warn(`Skipping ${n.name}: too large (${Pt(n.size)})`);continue}n.size>tg&&console.warn(`File ${n.name} is large (${Pt(n.size)}), may slow down`);const o=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/plain"})}catch(o){console.error(`Failed to read text file ${n.name}:`,o)}return t}async function ds(e){const t=[];for(const n of e)try{const o=en(n.name);if(o===".csv"||o===".tsv"){const r=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/csv"})}else if(o===".xlsx"||o===".xls"){const r=await n.arrayBuffer(),s=await zi(r);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(o){console.error(`Failed to process table file ${n.name}:`,o)}return t}async function zi(e){const t=await Re(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),o=[];for(const r of n.SheetNames){const s=n.Sheets[r];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?o.push(`## Sheet: ${r}
|
|
209
|
-
|
|
210
|
-
${a}`):o.push(a)}return o.join(`
|
|
211
|
-
|
|
212
|
-
`)}async function ag(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>$i));t.length>xr&&console.warn(`Directory has ${t.length} files, truncating to ${xr}`);const n=t.slice(0,xr);let o=0;for(const u of n)o+=u.size;o>cs&&console.warn(`Directory total size ${Pt(o)} exceeds limit, some files may be truncated`);const r=n[0].webkitRelativePath,s=r&&r.split("/")[0]||"目录",a=[],i=[];let p=0;const d=[...n].sort((u,h)=>{const g=u.webkitRelativePath||u.name,v=h.webkitRelativePath||h.name;return g.localeCompare(v)});for(const u of d){const h=u.webkitRelativePath||u.name;if(a.push(h),Ui(u)||Or(u))if(p+u.size<=cs)try{let g;if(en(u.name)===".xlsx"||en(u.name)===".xls"){const v=await u.arrayBuffer();g=await zi(v)}else g=await u.text();i.push(`
|
|
213
|
-
### ${h}
|
|
214
|
-
\`\`\`
|
|
215
|
-
${g}
|
|
216
|
-
\`\`\``),p+=u.size}catch{i.push(`
|
|
217
|
-
### ${h}
|
|
218
|
-
(读取失败)`)}else i.push(`
|
|
219
|
-
### ${h}
|
|
220
|
-
(文件过大,已跳过)`);else u.type.startsWith("image/")?i.push(`
|
|
221
|
-
### ${h}
|
|
222
|
-
(图片文件,${Pt(u.size)})`):i.push(`
|
|
223
|
-
### ${h}
|
|
224
|
-
(二进制文件,${Pt(u.size)})`)}const c=a.join(`
|
|
225
|
-
`),l=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",c,"```","","## 文件内容",...i].join(`
|
|
226
|
-
`);return{kind:"directory",name:s,size:o,textContent:l,files:a}}async function ig(e){return new Promise((t,n)=>{const o=new FileReader;o.onloadend=()=>{const r=o.result,s=r.indexOf(",");t(s>=0?r.slice(s+1):r)},o.onerror=()=>n(new Error("FileReader error")),o.readAsDataURL(e)})}function lg({requests:e,onRespond:t,className:n}){return e.length===0?null:f.jsx("div",{className:J("w-full max-w-3xl mx-auto px-4",n),children:f.jsx("div",{className:"space-y-2",children:e.map(o=>f.jsx(cg,{request:o,onRespond:t},o.requestId))})})}function cg({request:e,onRespond:t}){return f.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[f.jsx(Hs,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&f.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),f.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[f.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[f.jsx(tn,{className:"h-3.5 w-3.5"}),"允许"]}),f.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[f.jsx(Ln,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}var Zn="Popover",[Bi]=Qe(Zn,[zt]),dn=zt(),[ug,ft]=Bi(Zn),Hi=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,i=dn(t),p=m.useRef(null),[d,c]=m.useState(!1),[l,u]=at({prop:o,defaultProp:r??!1,onChange:s,caller:Zn});return f.jsx(eo,{...i,children:f.jsx(ug,{scope:t,contentId:we(),triggerRef:p,open:l,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(h=>!h),[u]),hasCustomAnchor:d,onCustomAnchorAdd:m.useCallback(()=>c(!0),[]),onCustomAnchorRemove:m.useCallback(()=>c(!1),[]),modal:a,children:n})})};Hi.displayName=Zn;var Wi="PopoverAnchor",dg=m.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=ft(Wi,n),s=dn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=r;return m.useEffect(()=>(a(),()=>i()),[a,i]),f.jsx(Hn,{...s,...o,ref:t})});dg.displayName=Wi;var Gi="PopoverTrigger",Vi=m.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=ft(Gi,n),s=dn(n),a=me(t,r.triggerRef),i=f.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Qi(r.open),...o,ref:a,onClick:ee(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:f.jsx(Hn,{asChild:!0,...s,children:i})});Vi.displayName=Gi;var wo="PopoverPortal",[fg,pg]=Bi(wo,{forceMount:void 0}),Ki=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=ft(wo,t);return f.jsx(fg,{scope:t,forceMount:n,children:f.jsx(je,{present:n||s.open,children:f.jsx(sn,{asChild:!0,container:r,children:o})})})};Ki.displayName=wo;var Ft="PopoverContent",qi=m.forwardRef((e,t)=>{const n=pg(Ft,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=ft(Ft,e.__scopePopover);return f.jsx(je,{present:o||s.open,children:s.modal?f.jsx(hg,{...r,ref:t}):f.jsx(gg,{...r,ref:t})})});qi.displayName=Ft;var mg=Ot("PopoverContent.RemoveScroll"),hg=m.forwardRef((e,t)=>{const n=ft(Ft,e.__scopePopover),o=m.useRef(null),r=me(t,o),s=m.useRef(!1);return m.useEffect(()=>{const a=o.current;if(a)return ro(a)},[]),f.jsx(Ur,{as:mg,allowPinchZoom:!0,children:f.jsx(Xi,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,p=i.button===0&&i.ctrlKey===!0,d=i.button===2||p;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ee(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),gg=m.forwardRef((e,t)=>{const n=ft(Ft,e.__scopePopover),o=m.useRef(!1),r=m.useRef(!1);return f.jsx(Xi,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{var p,d;(p=e.onInteractOutside)==null||p.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Xi=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:d,onInteractOutside:c,...l}=e,u=ft(Ft,n),h=dn(n);return Gr(),f.jsx(Fn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:f.jsx(rn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:i,onPointerDownOutside:p,onFocusOutside:d,onDismiss:()=>u.onOpenChange(!1),children:f.jsx(to,{"data-state":Qi(u.open),role:"dialog",id:u.contentId,...h,...l,ref:t,style:{...l.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Yi="PopoverClose",xg=m.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=ft(Yi,n);return f.jsx(ue.button,{type:"button",...o,ref:t,onClick:ee(e.onClick,()=>r.onOpenChange(!1))})});xg.displayName=Yi;var vg="PopoverArrow",bg=m.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=dn(n);return f.jsx(no,{...r,...o,ref:t})});bg.displayName=vg;function Qi(e){return e?"open":"closed"}var yg=Hi,wg=Vi,Cg=Ki,Sg=qi;function Zi({...e}){return f.jsx(yg,{"data-slot":"popover",...e})}function Ji({...e}){return f.jsx(wg,{"data-slot":"popover-trigger",...e})}function el({className:e,align:t="center",sideOffset:n=4,...o}){return f.jsx(Cg,{children:f.jsx(Sg,{"data-slot":"popover-content",align:t,sideOffset:n,className:J("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...o})})}var fs=1,Eg=.9,Ag=.8,kg=.17,br=.1,yr=.999,_g=.9999,Rg=.99,jg=/[\\\/_+.#"@\[\(\{&]/,Ng=/[\\\/_+.#"@\[\(\{&]/g,Tg=/[\s-]/,tl=/[\s-]/g;function Dr(e,t,n,o,r,s,a){if(s===t.length)return r===e.length?fs:Rg;var i=`${r},${s}`;if(a[i]!==void 0)return a[i];for(var p=o.charAt(s),d=n.indexOf(p,r),c=0,l,u,h,g;d>=0;)l=Dr(e,t,n,o,d+1,s+1,a),l>c&&(d===r?l*=fs:jg.test(e.charAt(d-1))?(l*=Ag,h=e.slice(r,d-1).match(Ng),h&&r>0&&(l*=Math.pow(yr,h.length))):Tg.test(e.charAt(d-1))?(l*=Eg,g=e.slice(r,d-1).match(tl),g&&r>0&&(l*=Math.pow(yr,g.length))):(l*=kg,r>0&&(l*=Math.pow(yr,d-r))),e.charAt(d)!==t.charAt(s)&&(l*=_g)),(l<br&&n.charAt(d-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&n.charAt(d-1)!==o.charAt(s))&&(u=Dr(e,t,n,o,d+1,s+2,a),u*br>l&&(l=u*br)),l>c&&(c=l),d=n.indexOf(p,d+1);return a[i]=c,c}function ps(e){return e.toLowerCase().replace(tl," ")}function Ig(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Dr(e,t,ps(e),ps(t),0,0,{})}var Jn="Dialog",[nl]=Qe(Jn),[Mg,Le]=nl(Jn),rl=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!0}=e,i=m.useRef(null),p=m.useRef(null),[d,c]=at({prop:o,defaultProp:r??!1,onChange:s,caller:Jn});return f.jsx(Mg,{scope:t,triggerRef:i,contentRef:p,contentId:we(),titleId:we(),descriptionId:we(),open:d,onOpenChange:c,onOpenToggle:m.useCallback(()=>c(l=>!l),[c]),modal:a,children:n})};rl.displayName=Jn;var ol="DialogTrigger",Pg=m.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(ol,n),s=me(t,r.triggerRef);return f.jsx(ue.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Eo(r.open),...o,ref:s,onClick:ee(e.onClick,r.onOpenToggle)})});Pg.displayName=ol;var Co="DialogPortal",[Og,sl]=nl(Co,{forceMount:void 0}),al=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=Le(Co,t);return f.jsx(Og,{scope:t,forceMount:n,children:m.Children.map(o,a=>f.jsx(je,{present:n||s.open,children:f.jsx(sn,{asChild:!0,container:r,children:a})}))})};al.displayName=Co;var Dn="DialogOverlay",il=m.forwardRef((e,t)=>{const n=sl(Dn,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Le(Dn,e.__scopeDialog);return s.modal?f.jsx(je,{present:o||s.open,children:f.jsx(Lg,{...r,ref:t})}):null});il.displayName=Dn;var Dg=Ot("DialogOverlay.RemoveScroll"),Lg=m.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(Dn,n);return f.jsx(Ur,{as:Dg,allowPinchZoom:!0,shards:[r.contentRef],children:f.jsx(ue.div,{"data-state":Eo(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Ct="DialogContent",ll=m.forwardRef((e,t)=>{const n=sl(Ct,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Le(Ct,e.__scopeDialog);return f.jsx(je,{present:o||s.open,children:s.modal?f.jsx(Fg,{...r,ref:t}):f.jsx($g,{...r,ref:t})})});ll.displayName=Ct;var Fg=m.forwardRef((e,t)=>{const n=Le(Ct,e.__scopeDialog),o=m.useRef(null),r=me(t,n.contentRef,o);return m.useEffect(()=>{const s=o.current;if(s)return ro(s)},[]),f.jsx(cl,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault())})}),$g=m.forwardRef((e,t)=>{const n=Le(Ct,e.__scopeDialog),o=m.useRef(!1),r=m.useRef(!1);return f.jsx(cl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{var p,d;(p=e.onInteractOutside)==null||p.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),cl=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,i=Le(Ct,n),p=m.useRef(null),d=me(t,p);return Gr(),f.jsxs(f.Fragment,{children:[f.jsx(Fn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:f.jsx(rn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Eo(i.open),...a,ref:d,onDismiss:()=>i.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(zg,{titleId:i.titleId}),f.jsx(Hg,{contentRef:p,descriptionId:i.descriptionId})]})]})}),So="DialogTitle",ul=m.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(So,n);return f.jsx(ue.h2,{id:r.titleId,...o,ref:t})});ul.displayName=So;var dl="DialogDescription",Ug=m.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(dl,n);return f.jsx(ue.p,{id:r.descriptionId,...o,ref:t})});Ug.displayName=dl;var fl="DialogClose",pl=m.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Le(fl,n);return f.jsx(ue.button,{type:"button",...o,ref:t,onClick:ee(e.onClick,()=>r.onOpenChange(!1))})});pl.displayName=fl;function Eo(e){return e?"open":"closed"}var ml="DialogTitleWarning",[Cv,hl]=Uu(ml,{contentName:Ct,titleName:So,docsSlug:"dialog"}),zg=({titleId:e})=>{const t=hl(ml),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
227
|
-
|
|
228
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
229
|
-
|
|
230
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Bg="DialogDescriptionWarning",Hg=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hl(Bg).contentName}}.`;return m.useEffect(()=>{var s;const r=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Wg=rl,Gg=al,Vg=il,Kg=ll,Sv=ul,Ev=pl,Vt='[cmdk-group=""]',wr='[cmdk-group-items=""]',qg='[cmdk-group-heading=""]',gl='[cmdk-item=""]',ms=`${gl}:not([aria-disabled="true"])`,Lr="cmdk-item-select",Nt="data-value",Xg=(e,t,n)=>Ig(e,t,n),xl=m.createContext(void 0),fn=()=>m.useContext(xl),vl=m.createContext(void 0),Ao=()=>m.useContext(vl),bl=m.createContext(void 0),yl=m.forwardRef((e,t)=>{let n=Tt(()=>{var N,B;return{search:"",value:(B=(N=e.value)!=null?N:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Tt(()=>new Set),r=Tt(()=>new Map),s=Tt(()=>new Map),a=Tt(()=>new Set),i=wl(e),{label:p,children:d,value:c,onValueChange:l,filter:u,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:w=!0,...y}=e,_=we(),R=we(),k=we(),F=m.useRef(null),S=ax();St(()=>{if(c!==void 0){let N=c.trim();n.current.value=N,j.emit()}},[c]),St(()=>{S(6,$)},[]);let j=m.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,B,z)=>{var L,G,V,Y;if(!Object.is(n.current[N],B)){if(n.current[N]=B,N==="search")P(),I(),S(1,O);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(k);K?K.focus():(L=document.getElementById(_))==null||L.focus()}if(S(7,()=>{var K;n.current.selectedItemId=(K=M())==null?void 0:K.id,j.emit()}),z||S(5,$),((G=i.current)==null?void 0:G.value)!==void 0){let K=B??"";(Y=(V=i.current).onValueChange)==null||Y.call(V,K);return}}j.emit()}},emit:()=>{a.current.forEach(N=>N())}}),[]),x=m.useMemo(()=>({value:(N,B,z)=>{var L;B!==((L=s.current.get(N))==null?void 0:L.value)&&(s.current.set(N,{value:B,keywords:z}),n.current.filtered.items.set(N,b(B,z)),S(2,()=>{I(),j.emit()}))},item:(N,B)=>(o.current.add(N),B&&(r.current.has(B)?r.current.get(B).add(N):r.current.set(B,new Set([N]))),S(3,()=>{P(),I(),n.current.value||O(),j.emit()}),()=>{s.current.delete(N),o.current.delete(N),n.current.filtered.items.delete(N);let z=M();S(4,()=>{P(),(z==null?void 0:z.getAttribute("id"))===N&&O(),j.emit()})}),group:N=>(r.current.has(N)||r.current.set(N,new Set),()=>{s.current.delete(N),r.current.delete(N)}),filter:()=>i.current.shouldFilter,label:p||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:_,inputId:k,labelId:R,listInnerRef:F}),[]);function b(N,B){var z,L;let G=(L=(z=i.current)==null?void 0:z.filter)!=null?L:Xg;return N?G(N,n.current.search,B):0}function I(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,B=[];n.current.filtered.groups.forEach(L=>{let G=r.current.get(L),V=0;G.forEach(Y=>{let K=N.get(Y);V=Math.max(K,V)}),B.push([L,V])});let z=F.current;U().sort((L,G)=>{var V,Y;let K=L.getAttribute("id"),ne=G.getAttribute("id");return((V=N.get(ne))!=null?V:0)-((Y=N.get(K))!=null?Y:0)}).forEach(L=>{let G=L.closest(wr);G?G.appendChild(L.parentElement===G?L:L.closest(`${wr} > *`)):z.appendChild(L.parentElement===z?L:L.closest(`${wr} > *`))}),B.sort((L,G)=>G[1]-L[1]).forEach(L=>{var G;let V=(G=F.current)==null?void 0:G.querySelector(`${Vt}[${Nt}="${encodeURIComponent(L[0])}"]`);V==null||V.parentElement.appendChild(V)})}function O(){let N=U().find(z=>z.getAttribute("aria-disabled")!=="true"),B=N==null?void 0:N.getAttribute(Nt);j.setState("value",B||void 0)}function P(){var N,B,z,L;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let G=0;for(let V of o.current){let Y=(B=(N=s.current.get(V))==null?void 0:N.value)!=null?B:"",K=(L=(z=s.current.get(V))==null?void 0:z.keywords)!=null?L:[],ne=b(Y,K);n.current.filtered.items.set(V,ne),ne>0&&G++}for(let[V,Y]of r.current)for(let K of Y)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(V);break}n.current.filtered.count=G}function $(){var N,B,z;let L=M();L&&(((N=L.parentElement)==null?void 0:N.firstChild)===L&&((z=(B=L.closest(Vt))==null?void 0:B.querySelector(qg))==null||z.scrollIntoView({block:"nearest"})),L.scrollIntoView({block:"nearest"}))}function M(){var N;return(N=F.current)==null?void 0:N.querySelector(`${gl}[aria-selected="true"]`)}function U(){var N;return Array.from(((N=F.current)==null?void 0:N.querySelectorAll(ms))||[])}function E(N){let B=U()[N];B&&j.setState("value",B.getAttribute(Nt))}function C(N){var B;let z=M(),L=U(),G=L.findIndex(Y=>Y===z),V=L[G+N];(B=i.current)!=null&&B.loop&&(V=G+N<0?L[L.length-1]:G+N===L.length?L[0]:L[G+N]),V&&j.setState("value",V.getAttribute(Nt))}function D(N){let B=M(),z=B==null?void 0:B.closest(Vt),L;for(;z&&!L;)z=N>0?ox(z,Vt):sx(z,Vt),L=z==null?void 0:z.querySelector(ms);L?j.setState("value",L.getAttribute(Nt)):C(N)}let A=()=>E(U().length-1),T=N=>{N.preventDefault(),N.metaKey?A():N.altKey?D(1):C(1)},H=N=>{N.preventDefault(),N.metaKey?E(0):N.altKey?D(-1):C(-1)};return m.createElement(dt.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:N=>{var B;(B=y.onKeyDown)==null||B.call(y,N);let z=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||z))switch(N.key){case"n":case"j":{w&&N.ctrlKey&&T(N);break}case"ArrowDown":{T(N);break}case"p":case"k":{w&&N.ctrlKey&&H(N);break}case"ArrowUp":{H(N);break}case"Home":{N.preventDefault(),E(0);break}case"End":{N.preventDefault(),A();break}case"Enter":{N.preventDefault();let L=M();if(L){let G=new Event(Lr);L.dispatchEvent(G)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:lx},p),er(e,N=>m.createElement(vl.Provider,{value:j},m.createElement(xl.Provider,{value:x},N))))}),Yg=m.forwardRef((e,t)=>{var n,o;let r=we(),s=m.useRef(null),a=m.useContext(bl),i=fn(),p=wl(e),d=(o=(n=p.current)==null?void 0:n.forceMount)!=null?o:a==null?void 0:a.forceMount;St(()=>{if(!d)return i.item(r,a==null?void 0:a.id)},[d]);let c=Cl(r,s,[e.value,e.children,s],e.keywords),l=Ao(),u=ct(S=>S.value&&S.value===c.current),h=ct(S=>d||i.filter()===!1?!0:S.search?S.filtered.items.get(r)>0:!0);m.useEffect(()=>{let S=s.current;if(!(!S||e.disabled))return S.addEventListener(Lr,g),()=>S.removeEventListener(Lr,g)},[h,e.onSelect,e.disabled]);function g(){var S,j;v(),(j=(S=p.current).onSelect)==null||j.call(S,c.current)}function v(){l.setState("value",c.current,!0)}if(!h)return null;let{disabled:w,value:y,onSelect:_,forceMount:R,keywords:k,...F}=e;return m.createElement(dt.div,{ref:He(s,t),...F,id:r,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!u,"data-disabled":!!w,"data-selected":!!u,onPointerMove:w||i.getDisablePointerSelection()?void 0:v,onClick:w?void 0:g},e.children)}),Qg=m.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...s}=e,a=we(),i=m.useRef(null),p=m.useRef(null),d=we(),c=fn(),l=ct(h=>r||c.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);St(()=>c.group(a),[]),Cl(a,i,[e.value,e.heading,p]);let u=m.useMemo(()=>({id:a,forceMount:r}),[r]);return m.createElement(dt.div,{ref:He(i,t),...s,"cmdk-group":"",role:"presentation",hidden:l?void 0:!0},n&&m.createElement("div",{ref:p,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),er(e,h=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},m.createElement(bl.Provider,{value:u},h))))}),Zg=m.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=m.useRef(null),s=ct(a=>!a.search);return!n&&!s?null:m.createElement(dt.div,{ref:He(r,t),...o,"cmdk-separator":"",role:"separator"})}),Jg=m.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=e.value!=null,s=Ao(),a=ct(d=>d.search),i=ct(d=>d.selectedItemId),p=fn();return m.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),m.createElement(dt.input,{ref:t,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":p.listId,"aria-labelledby":p.labelId,"aria-activedescendant":i,id:p.inputId,type:"text",value:r?e.value:a,onChange:d=>{r||s.setState("search",d.target.value),n==null||n(d.target.value)}})}),ex=m.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=e,s=m.useRef(null),a=m.useRef(null),i=ct(d=>d.selectedItemId),p=fn();return m.useEffect(()=>{if(a.current&&s.current){let d=a.current,c=s.current,l,u=new ResizeObserver(()=>{l=requestAnimationFrame(()=>{let h=d.offsetHeight;c.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return u.observe(d),()=>{cancelAnimationFrame(l),u.unobserve(d)}}},[]),m.createElement(dt.div,{ref:He(s,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:p.listId},er(e,d=>m.createElement("div",{ref:He(a,p.listInnerRef),"cmdk-list-sizer":""},d)))}),tx=m.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:s,container:a,...i}=e;return m.createElement(Wg,{open:n,onOpenChange:o},m.createElement(Gg,{container:a},m.createElement(Vg,{"cmdk-overlay":"",className:r}),m.createElement(Kg,{"aria-label":e.label,"cmdk-dialog":"",className:s},m.createElement(yl,{ref:t,...i}))))}),nx=m.forwardRef((e,t)=>ct(n=>n.filtered.count===0)?m.createElement(dt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),rx=m.forwardRef((e,t)=>{let{progress:n,children:o,label:r="Loading...",...s}=e;return m.createElement(dt.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},er(e,a=>m.createElement("div",{"aria-hidden":!0},a)))}),Bt=Object.assign(yl,{List:ex,Item:Yg,Input:Jg,Group:Qg,Separator:Zg,Dialog:tx,Empty:nx,Loading:rx});function ox(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function sx(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function wl(e){let t=m.useRef(e);return St(()=>{t.current=e}),t}var St=typeof window>"u"?m.useEffect:m.useLayoutEffect;function Tt(e){let t=m.useRef();return t.current===void 0&&(t.current=e()),t}function ct(e){let t=Ao(),n=()=>e(t.snapshot());return m.useSyncExternalStore(t.subscribe,n,n)}function Cl(e,t,n,o=[]){let r=m.useRef(),s=fn();return St(()=>{var a;let i=(()=>{var d;for(let c of n){if(typeof c=="string")return c.trim();if(typeof c=="object"&&"current"in c)return c.current?(d=c.current.textContent)==null?void 0:d.trim():r.current}})(),p=o.map(d=>d.trim());s.value(e,i,p),(a=t.current)==null||a.setAttribute(Nt,i),r.current=i}),r}var ax=()=>{let[e,t]=m.useState(),n=Tt(()=>new Map);return St(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function ix(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function er({asChild:e,children:t},n){return e&&m.isValidElement(t)?m.cloneElement(ix(t),{ref:t.ref},n(t.props.children)):n(t)}var lx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function cx({className:e,...t}){return f.jsx(Bt,{"data-slot":"command",className:J("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function ux({className:e,...t}){return f.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[f.jsx(du,{className:"size-4 shrink-0 opacity-50"}),f.jsx(Bt.Input,{"data-slot":"command-input",className:J("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function dx({className:e,...t}){return f.jsx(Bt.List,{"data-slot":"command-list",className:J("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function fx({...e}){return f.jsx(Bt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function px({className:e,...t}){return f.jsx(Bt.Group,{"data-slot":"command-group",className:J("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function mx({className:e,...t}){return f.jsx(Bt.Item,{"data-slot":"command-item",className:J("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function hs(e,t){if(!e)return!0;const n=e.toLowerCase(),o=t.toLowerCase();let r=0;for(let s=0;s<o.length&&r<n.length;s++)o[s]===n[r]&&r++;return r===n.length}function hx({models:e,currentModelId:t,onSelect:n,showSearch:o=!0,isMobile:r=!1}){const[s,a]=m.useState(""),[i,p]=m.useState(r?"__none__":void 0),d=m.useMemo(()=>s?e.filter(c=>hs(s,c.name)||hs(s,c.modelId)):e,[e,s]);return f.jsxs(cx,{shouldFilter:!1,value:i,onValueChange:p,children:[o&&f.jsx(ux,{placeholder:"Select a model…",value:s,onValueChange:a}),f.jsxs(dx,{children:[f.jsx(fx,{children:"No models found."}),f.jsx(px,{children:d.map(c=>f.jsxs(mx,{value:c.modelId,onSelect:()=>n(c),className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[f.jsx("span",{className:"truncate font-medium",children:c.name}),c.description&&f.jsx("span",{className:"text-xs text-muted-foreground truncate",children:c.description})]}),f.jsx(tn,{className:J("h-4 w-4 shrink-0",t===c.modelId?"opacity-100":"opacity-0")})]},c.modelId))})]})]})}function Sl(e){const[t,n]=m.useState(e.modelState),[o,r]=m.useState(!1);m.useEffect(()=>{const d=l=>{if(n(l),l&&l.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==l.currentModelId&&l.availableModels.some(h=>h.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},c=l=>{n(u=>u?{...u,currentModelId:l}:null),r(!1)};return e.setModelStateChangedHandler(d),e.setModelChangedHandler(c),()=>{e.removeModelStateChangedHandler(d),e.removeModelChangedHandler(c)}},[e]);const s=m.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=m.useMemo(()=>s.find(d=>d.modelId===a)??null,[s,a]),p=m.useCallback(async d=>{if(!t)throw new Error("Model selection not supported");r(!0);try{await e.setSessionModel(d),localStorage.setItem("acp_model_id",d)}catch(c){throw r(!1),c}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:p,isLoading:o}}function gx({client:e,onModelSelect:t}){const[n,o]=m.useState(!1),{supportsModelSelection:r,availableModels:s,currentModel:a,setModel:i,isLoading:p}=Sl(e),d=r&&s.length>0,c=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,l=async u=>{try{await i(u.modelId),t==null||t(u.modelId),o(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return f.jsxs(Zi,{open:n,onOpenChange:d?o:void 0,children:[f.jsx(Ji,{asChild:!0,children:f.jsxs(At,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!d||p,children:[p?f.jsx(Us,{className:"h-3 w-3 animate-spin"}):null,f.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?f.jsx($s,{className:"h-3 w-3"}):f.jsx(nn,{className:"h-3 w-3"})]})}),f.jsx(el,{className:"w-72 p-0",align:"end",children:f.jsx(hx,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:l,showSearch:!c,isMobile:c})})]})}function xx(e){const[t,n]=m.useState(e.availableCommands);m.useEffect(()=>{const r=s=>{n(s)};return e.setAvailableCommandsChangedHandler(r),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const o=m.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:o}}const vx=new Set(["clear","new","help","status","model","copy"]),bx=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"},{name:"files",desc:"列出上下文中的文件"}];function yx(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function wx(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Cx(e){var o;const t=[];t.push("**本地命令**(Web UI 直接执行)"),t.push("");const n=[{name:"clear",desc:"清空当前对话"},{name:"new",desc:"新建会话"},{name:"help",desc:"显示此帮助信息"},{name:"status",desc:"显示会话状态"},{name:"model [id]",desc:"查看或切换模型"},{name:"copy",desc:"复制最后一条助手消息"}];for(const r of n)t.push(`- \`/${r.name}\` — ${r.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const r of bx)t.push(`- \`/${r.name}\` — ${r.desc}`);if(e.length>0)for(const r of e){const s=(o=r.input)!=null&&o.hint?` ${r.input.hint}`:"";t.push(`- \`/${r.name}${s}\` — ${r.description}`)}return t.join(`
|
|
231
|
-
`)}function Sx(e){var n,o,r;const t=["**会话状态**",""];return t.push(`- 会话 ID: \`${e.sessionId??"无"}\``),t.push(`- 当前模型: ${((n=e.currentModel)==null?void 0:n.name)??((o=e.currentModel)==null?void 0:o.modelId)??"未设置"}`),(r=e.currentModel)!=null&&r.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- 可用模型数: ${e.modelCount}`),t.push(`- 图片支持: ${e.supportsImages?"是":"否"}`),t.push(`- 消息条数: ${e.entryCount}`),t.join(`
|
|
232
|
-
`)}function Ex(e,t){if(e.length===0)return"当前 agent 未提供模型选择能力。";const n=["**可用模型**",""];for(const o of e){const r=o.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${o.modelId}\` — ${o.name}${r}`)}return n.push(""),n.push("使用 `/model <id>` 切换模型。"),n.join(`
|
|
233
|
-
`)}async function Ax(e,t){var l;if(!e.startsWith("/"))return{handled:!1};const[n,...o]=e.slice(1).split(/\s+/),r=o.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!vx.has(s))return{handled:!1};if(s==="clear")return{handled:!0,clearEntries:!0};if(s==="new")return{handled:!0,newSession:!0};let a="",i=!1;if(s==="help")a=Cx(t.availableCommands);else if(s==="status")a=Sx({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(r)try{await t.setModel(r),a=`已请求切换到模型: \`${r}\``}catch(u){a=`切换模型失败: ${u instanceof Error?u.message:String(u)}`,i=!0}else a=Ex(t.availableModels,t.currentModel);else if(s==="copy"){const u=[...t.entries].reverse().find(g=>g.type==="assistant_message"),h=((l=u==null?void 0:u.chunks)==null?void 0:l.map(g=>g.text).join(`
|
|
234
|
-
`))??"";try{await navigator.clipboard.writeText(h),a=h?`已复制 ${h.length} 字符到剪贴板`:"没有可复制的助手消息"}catch{a="复制失败:剪贴板不可用",i=!0}}const p=Date.now(),d={type:"user_message",id:`user-${p}`,content:e},c={type:"command_output",id:`cmd-${p}`,commandName:s,inputText:e,title:yx(s),subtitle:wx(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:d,cmdEntry:c}}const kx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function _x(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),o=e.slice(t+1),r=n.match(/^data:([^;,]+)/),s=r?r[1]:"application/octet-stream",a=atob(o),i=new Uint8Array(a.length);for(let p=0;p<a.length;p++)i[p]=a.charCodeAt(p);return new Blob([i],{type:s})}const Cr=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"dontAsk",label:"不询问",description:"不弹出询问,自动拒绝"},{value:"auto",label:"自动判断",description:"AI 自动判断是否批准"}];function Rx({mode:e,onModeChange:t}){const[n,o]=m.useState(!1),r=Cr.find(s=>s.value===e)??Cr[0];return f.jsxs(Zi,{open:n,onOpenChange:o,children:[f.jsx(Ji,{asChild:!0,children:f.jsxs(At,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[f.jsx(gu,{className:"h-3 w-3"}),f.jsx("span",{className:"max-w-24 truncate",children:r.label}),n?f.jsx($s,{className:"h-3 w-3"}):f.jsx(nn,{className:"h-3 w-3"})]})}),f.jsx(el,{className:"w-64 p-1",align:"start",children:Cr.map(s=>f.jsxs("button",{type:"button",onClick:()=>{t(s.value),o(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[f.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&f.jsx(tn,{className:"h-3.5 w-3.5 text-brand"})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),f.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function gs(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Sr(e,t){for(let n=e.length-1;n>=0;n--){const o=e[n];if(o&&o.type==="tool_call"&&o.toolCall.id===t)return n}return-1}function jx({client:e,agentId:t}){const[n,o]=m.useState([]),[r,s]=m.useState(!1),[a,i]=m.useState(!1),[p,d]=m.useState(null),c=m.useRef(null),l=m.useRef(n);l.current=n;const[u,h]=m.useState(null),g=m.useRef(null),[v,w]=m.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[y,_]=m.useState(!1),{commands:R}=xx(e),{availableModels:k,currentModel:F,setModel:S}=Sl(e);m.useEffect(()=>{c.current=p},[p]);const j=m.useCallback(()=>{o([]),s(!1),i(!1)},[]),x=t?`acp_last_session_${t}`:null,b=m.useCallback((D,A)=>{if(((A==null?void 0:A.resetEntries)??!0)&&(o([]),s(!1)),d(D),i(!0),_(e.supportsImages),x)try{localStorage.setItem(x,D)}catch{}console.log("[ChatInterface] Active session:",D,"supportsImages:",e.supportsImages)},[e,x]),I=m.useCallback(D=>{c.current&&D.sessionId!==c.current||(console.log("[ChatInterface] Permission request:",D),o(A=>{const T=Sr(A,D.toolCall.toolCallId);if(T>=0)return A.map((H,N)=>N!==T||H.type!=="tool_call"||H.toolCall.status!=="running"?H:{type:"tool_call",toolCall:{...H.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const H={type:"tool_call",toolCall:{id:D.toolCall.toolCallId,title:D.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:D.requestId,options:D.options},isStandalonePermission:!0}};return[...A,H]}}))},[]),O=m.useCallback((D,A)=>{if(!(c.current&&D!==c.current))if(A.sessionUpdate==="agent_message_chunk"){const T=A.content.type==="text"&&A.content.text?A.content.text:"";if(!T)return;o(H=>{const N=H[H.length-1];if((N==null?void 0:N.type)==="assistant_message"){const z=N.chunks[N.chunks.length-1];return(z==null?void 0:z.type)==="message"?[...H.slice(0,-1),{...N,chunks:[...N.chunks.slice(0,-1),{type:"message",text:z.text+T}]}]:[...H.slice(0,-1),{...N,chunks:[...N.chunks,{type:"message",text:T}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:T}]};return[...H,B]})}else if(A.sessionUpdate==="agent_thought_chunk"){const T=A.content.type==="text"&&A.content.text?A.content.text:"";if(!T)return;o(H=>{const N=H[H.length-1];if((N==null?void 0:N.type)==="assistant_message"){const z=N.chunks[N.chunks.length-1];return(z==null?void 0:z.type)==="thought"?[...H.slice(0,-1),{...N,chunks:[...N.chunks.slice(0,-1),{type:"thought",text:z.text+T}]}]:[...H.slice(0,-1),{...N,chunks:[...N.chunks,{type:"thought",text:T}]}]}const B={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:T}]};return[...H,B]})}else if(A.sessionUpdate==="user_message_chunk"){const T=A.content.type==="text"&&A.content.text?A.content.text:"";if(!T)return;o(H=>{const N=H[H.length-1];if((N==null?void 0:N.type)==="user_message")return[...H.slice(0,-1),{...N,content:N.content+T}];const B={type:"user_message",id:`user-${Date.now()}`,content:T};return[...H,B]})}else if(A.sessionUpdate==="tool_call"){const T={id:A.toolCallId,title:A.title,status:gs(A.status),content:A.content,rawInput:A.rawInput,rawOutput:A.rawOutput};o(H=>{const N=Sr(H,A.toolCallId);if(N>=0)return H.map((z,L)=>L!==N||z.type!=="tool_call"?z:{type:"tool_call",toolCall:{...z.toolCall,...T}});const B={type:"tool_call",toolCall:T};return[...H,B]})}else A.sessionUpdate==="tool_call_update"?o(T=>{const H=Sr(T,A.toolCallId);if(H<0){console.warn(`[ChatInterface] Tool call not found for update: ${A.toolCallId}`);const N={type:"tool_call",toolCall:{id:A.toolCallId,title:A.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...T,N]}return T.map((N,B)=>{if(B!==H||N.type!=="tool_call")return N;const z=A.status?gs(A.status):N.toolCall.status,L=A.content?[...N.toolCall.content||[],...A.content]:N.toolCall.content;return{type:"tool_call",toolCall:{...N.toolCall,status:z,...A.title&&{title:A.title},content:L,...A.rawInput&&{rawInput:A.rawInput},...A.rawOutput&&{rawOutput:A.rawOutput}}}})}):A.sessionUpdate==="plan"&&o(T=>{if(A.entries.length===0)return T.filter(B=>B.type!=="plan");const H=T.reduce((B,z,L)=>z.type==="plan"?L:B,-1);if(H>=0)return T.map((B,z)=>z===H?{...B,entries:A.entries}:B);const N={type:"plan",id:`plan-${Date.now()}`,entries:A.entries};return[...T,N]})},[]);m.useEffect(()=>{e.setSessionCreatedHandler(A=>{console.log("[ChatInterface] Session created:",A),b(A)}),e.setSessionLoadedHandler(A=>{console.log("[ChatInterface] Session loaded/resumed:",A),b(A,{resetEntries:!1})}),e.setSessionSwitchingHandler(A=>{console.log("[ChatInterface] Switching to session:",A),d(A),j()}),e.setSessionUpdateHandler((A,T)=>{O(A,T)}),e.setPromptCompleteHandler(A=>{console.log("[ChatInterface] Prompt complete:",A),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(A=>{console.error("[ChatInterface] Agent error:",A),h(A),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const D=x?localStorage.getItem(x):null;return D&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",D),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:D}):await e.resumeSession({sessionId:D})}catch(T){console.warn("[ChatInterface] Failed to restore session, creating new one:",T),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[b,e,I,O,j]);const P=m.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),r&&e.cancel(),j(),d(null),e.createSession(void 0,v)},[e,r,j,v]),$=()=>{console.log("[ChatInterface] Cancel requested"),o(D=>D.map(A=>A.type!=="tool_call"||!(A.toolCall.status==="running"||A.toolCall.status==="waiting_for_confirmation")?A:(console.log("[ChatInterface] Marking tool call as canceled:",A.toolCall.id),{type:"tool_call",toolCall:{...A.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},M=m.useCallback((D,A,T)=>{console.log("[ChatInterface] Permission response:",{requestId:D,optionId:A,optionKind:T}),e.respondToPermission(D,A);const H=T==="reject_once"||T==="reject_always"||A===null;o(N=>N.map(B=>{var L;if(B.type!=="tool_call"||((L=B.toolCall.permissionRequest)==null?void 0:L.requestId)!==D)return B;let z;return H?z="rejected":B.toolCall.isStandalonePermission?z="complete":z="running",{type:"tool_call",toolCall:{...B.toolCall,status:z,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),U=n.filter(D=>D.type==="tool_call"&&D.toolCall.status==="waiting_for_confirmation"&&!!D.toolCall.permissionRequest).map(D=>({requestId:D.toolCall.permissionRequest.requestId,toolName:D.toolCall.title,toolInput:D.toolCall.rawInput||{},description:D.toolCall.title,options:D.toolCall.permissionRequest.options})),E=m.useCallback((D,A)=>{const T=U.find(B=>B.requestId===D);let H=null,N=null;if(T!=null&&T.options&&T.options.length>0)if(A){const B=T.options.find(z=>z.kind==="allow_once")??T.options.find(z=>z.kind==="allow_always");B&&(H=B.optionId,N=B.kind)}else{const B=T.options.find(z=>z.kind==="reject_once")??T.options.find(z=>z.kind==="reject_always");B&&(H=B.optionId,N=B.kind)}H||(N=A?"allow_once":"reject_once"),M(D,H,N)},[M,U]),C=m.useCallback(async D=>{var G;const A=D.text.trim(),T=D.images||[],H=D.attachments||[];if(!A&&T.length===0&&H.length===0||r||!a)return;if(A.startsWith("/")&&T.length===0){yt("[ChatInterface] slash command input",{text:A});const V=await Ax(A,{sessionId:p,availableCommands:R,availableModels:k,currentModel:F,supportsImages:y,entries:l.current,setModel:S,onNewSession:P}).catch(()=>null);if(V){if(yt("[ChatInterface] local command handled",V),"clearEntries"in V&&V.clearEntries){o([]);return}if("newSession"in V&&V.newSession){P();return}if("userEntry"in V){o(Y=>[...Y,V.userEntry,V.cmdEntry]);return}}yt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:A})}yt("[ChatInterface] forwarding to agent",{text:A,hasImages:T.length>0,sessionReady:a,isLoading:r});const N=[];A&&N.push({type:"text",text:A});const B=[];for(const V of T)try{const Y=`data:${V.mimeType};base64,${V.data}`;let K;Y.startsWith("data:")?K=_x(Y):K=await(await fetch(Y)).blob();let ne=K,ae=V.mimeType;if(K.size>2*1024*1024){const W=new File([K],"image.jpg",{type:K.type});ne=await ve(W,kx),ae="image/jpeg"}const le=await new Promise((W,q)=>{const Z=new FileReader;Z.onloadend=()=>{const te=Z.result,ie=te.indexOf(",");W(ie>=0?te.slice(ie+1):te)},Z.onerror=()=>{var te;return q(new Error("FileReader error: "+((te=Z.error)==null?void 0:te.message)))},Z.readAsDataURL(ne)}),pe={type:"image",mimeType:ae,data:le};N.push(pe),B.push({mimeType:ae,data:le})}catch(Y){console.error("[ChatInterface] Failed to process image:",Y)}const z=[];for(const V of H)try{if(V.textContent){let Y;if(V.kind==="directory"){const K=((G=V.files)==null?void 0:G.length)??0;Y=`📁 目录: ${V.name} (${K} 个文件)
|
|
235
|
-
${V.textContent}`}else{const K=V.size!=null?` (${Nx(V.size)})`:"";Y=`📎 ${V.name}${K}
|
|
236
|
-
\`\`\`
|
|
237
|
-
${V.textContent}
|
|
238
|
-
\`\`\``}N.push({type:"text",text:Y}),z.push(V)}}catch(Y){console.error("[ChatInterface] Failed to process attachment:",Y)}if(N.length===0)return;const L={type:"user_message",id:`user-${Date.now()}`,content:A,images:B.length>0?B:void 0,attachments:z.length>0?z:void 0};o(V=>[...V,L]),s(!0);try{await e.sendPrompt(N)}catch(V){console.error("[ChatInterface] Failed to send prompt:",V),s(!1)}},[r,a,e,R,k,F,y,p,S,P]);return f.jsxs("div",{className:"flex flex-col h-full",children:[f.jsx(qh,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(D,A,T)=>{M(D,A,T)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),f.jsx(lg,{requests:U,onRespond:E}),u&&f.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:f.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[f.jsx("span",{children:u}),f.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),f.jsxs("div",{className:"flex-shrink-0",children:[f.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx(Rx,{mode:v,onModeChange:D=>{w(D),localStorage.setItem("acp_permission_mode",D)}}),f.jsx(gx,{client:e})]}),n.length>0&&f.jsxs(nh,{children:[f.jsx(rh,{asChild:!0,children:f.jsxs(At,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:P,children:[f.jsx(Bs,{className:"h-3 w-3"}),"新会话"]})}),f.jsx(oh,{children:"New Thread"})]})]}),f.jsx(og,{onSubmit:C,isLoading:r,onInterrupt:$,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:y,commands:R.length>0?R:void 0})]})]})}function Nx(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Tx({client:e,agentId:t}){const[n,o]=m.useState(!1),r=m.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return f.jsxs("div",{className:"flex h-full w-full",children:[f.jsxs("div",{className:J("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[f.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&f.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),f.jsxs("div",{className:J("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&f.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:f.jsx(Bs,{className:"h-4 w-4"})}),f.jsx("button",{type:"button",onClick:()=>o(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?f.jsx(ou,{className:"h-4 w-4"}):f.jsx(nu,{className:"h-4 w-4"})})]})]}),!n&&f.jsx("div",{className:"flex-1 overflow-y-auto",children:f.jsx(Ix,{client:e,onSelectSession:r})})]}),f.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:f.jsx(jx,{client:e,agentId:t})})]})}function Ix({client:e,onSelectSession:t}){const[n,o]=m.useState([]),[r,s]=m.useState(!0),[a,i]=m.useState(null),[p,d]=m.useState(null),[c,l]=m.useState(""),[u,h]=m.useState(!0),g=m.useRef(null),v=m.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();o(j.sessions)}catch(j){console.warn("[SidebarSessionList] Failed to load:",j)}finally{s(!1)}},[e]);m.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),m.useEffect(()=>{const j=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(j),()=>e.removeConnectionStateHandler(j)},[e,v]),m.useEffect(()=>{const j=setInterval(v,1e4);return()=>clearInterval(j)},[v]),m.useEffect(()=>{e.setSessionDeletedHandler(j=>{v()}),e.setSessionRenamedHandler((j,x)=>{v()})},[e,v]),m.useEffect(()=>{e.setErrorMessageHandler(j=>{/Method not found/i.test(j)&&/session\/(rename|delete)/i.test(j)&&(h(!1),d(null))})},[e]),m.useEffect(()=>{p&&g.current&&(g.current.focus(),g.current.select())},[p]);const w=m.useCallback(j=>{const x=j.title&&j.title.trim()?j.title:j.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(j.sessionId),o(b=>b.filter(I=>I.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(b){console.error("[SidebarSessionList] delete failed:",b)}},[e,a]),y=m.useCallback(j=>{d(j.sessionId),l(j.title&&j.title.trim()?j.title:"")},[]),_=m.useCallback(()=>{if(!p)return;const j=c.trim();if(!j){d(null);return}try{e.renameSession(p,j),o(x=>x.map(b=>b.sessionId===p?{...b,title:j}:b))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}d(null)},[e,p,c]),R=m.useCallback(()=>{d(null)},[]),k=m.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),R())},[_,R]),F=m.useMemo(()=>[...n].sort((j,x)=>{const b=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-b}),[n]);if(r&&n.length===0)return f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return f.jsx("div",{className:"flex items-center justify-center py-8",children:f.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const S=Mx(F);return f.jsx("nav",{className:"py-1","aria-label":"历史会话",children:S.map((j,x)=>f.jsxs("div",{children:[x>0&&f.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),f.jsx("div",{className:"px-4 py-2",children:f.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(b=>{const I=p===b.sessionId;return f.jsxs("div",{className:J("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",b.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[f.jsx(Qc,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),I?f.jsx("input",{ref:g,type:"text",value:c,onChange:O=>l(O.target.value),onKeyDown:k,onBlur:_,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:O=>O.stopPropagation()}):f.jsx("button",{type:"button",onClick:()=>{i(b.sessionId),t(b)},className:"flex-1 min-w-0 text-left",title:b.title||b.sessionId,children:f.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:b.title&&b.title.trim()?b.title:"新会话"})}),I?f.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[f.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:f.jsx(tn,{className:"h-3.5 w-3.5"})}),f.jsx("button",{type:"button",onClick:R,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:"取消",children:f.jsx(Ln,{className:"h-3.5 w-3.5"})})]}):f.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:u?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[f.jsx("button",{type:"button",disabled:!u,onClick:O=>{O.stopPropagation(),u&&y(b)},className:J("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:u?"重命名":"该 agent 不支持会话重命名",children:f.jsx(lu,{className:"h-3 w-3"})}),f.jsx("button",{type:"button",disabled:!u,onClick:O=>{O.stopPropagation(),u&&w(b)},className:J("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:u?"删除":"该 agent 不支持会话删除",children:f.jsx(Eu,{className:"h-3 w-3"})})]})]},b.sessionId)})]},j.label))})}function Mx(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(n.getTime()-864e5),r=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?r[0].sessions.push(s):a>=o?r[1].sessions.push(s):r[2].sessions.push(s)}return r.filter(s=>s.sessions.length>0)}function Px({url:e,token:t,onBack:n}){const[o,r]=m.useState(null),[s,a]=m.useState("disconnected"),[i,p]=m.useState(null),d=m.useRef(null);return m.useEffect(()=>{const c=new Tr({proxyUrl:e,token:t});return c.setConnectionStateHandler((l,u)=>{a(l),p(u||null)}),d.current=c,r(c),c.connect().catch(l=>{l instanceof ii||(p(l.message),a("error"))}),()=>{c.disconnect(),d.current=null,r(null),a("disconnected")}},[e,t]),f.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&f.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,f.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&f.jsx("div",{className:"flex-1 flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),f.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&f.jsx("div",{className:"flex-1 flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),f.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),f.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),o&&s==="connected"&&f.jsx(Tx,{client:o})]})}const Fr="rcs_admin_key";function Ox(){try{return localStorage.getItem(Fr)}catch{return null}}function Dx(){const[e,t]=m.useState(Ox),n=m.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Fr,r):localStorage.removeItem(Fr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const El=m.createContext(null);function Lx(){const e=m.useContext(El);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Kt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function Fx(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}function $x({children:e}){const[t,n]=m.useState(null),[o,r]=m.useState(!0);m.useEffect(()=>{let l=!1;return Kt().then(u=>{l||(n(u),r(!1))}),()=>{l=!0}},[]);const s=m.useCallback(async(l,u)=>{const h=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:l,password:u})});if(!h.ok){const v=await h.json();throw new Error(v.error||"Login failed")}const g=await Kt();n(g)},[]),a=m.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null)},[]),i=m.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const u=await Kt();return n(u),!0}catch{return!1}},[]),p=m.useCallback(async(l,u,h)=>{const g=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,username:u,password:h})});if(!g.ok){const w=await g.json();throw new Error(w.error||"Setup failed")}const v=await Kt();n(v)},[]),d=m.useCallback(async(l,u,h)=>{const g=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:l,username:u,password:h})});if(!g.ok){const w=await g.json();throw new Error(w.error||"Join failed")}const v=await Kt();n(v)},[]),c=m.useCallback(async()=>Fx(),[]);return f.jsx(El.Provider,{value:{user:t,isLoading:o,login:s,logout:a,refresh:i,setup:p,join:d,checkSetupStatus:c},children:e})}const xs=m.lazy(()=>Re(()=>import("./Dashboard-D_Im4UId.js"),__vite__mapDeps([3,2,4,1,5])).then(e=>({default:e.Dashboard}))),Ux=m.lazy(()=>Re(()=>import("./SessionDetail-DSoMXZJb.js"),__vite__mapDeps([6,2,4,1,5])).then(e=>({default:e.SessionDetail}))),zx=m.lazy(()=>Re(()=>import("./ShareLanding-C06U9Nrr.js"),__vite__mapDeps([7,2,1,5])).then(e=>({default:e.ShareLanding}))),Bx=m.lazy(()=>Re(()=>import("./Login-ClT7RckC.js"),__vite__mapDeps([8,2,9,1,5])).then(e=>({default:e.Login}))),Hx=m.lazy(()=>Re(()=>import("./Setup-PaDA6Et-.js"),__vite__mapDeps([10,2,9,1,5])).then(e=>({default:e.Setup}))),Wx=m.lazy(()=>Re(()=>import("./Join-BTnvMsB9.js"),__vite__mapDeps([11,2,9,1,5])).then(e=>({default:e.Join}))),Gx=m.lazy(()=>Re(()=>import("./UserSettings-X627Fdni.js"),__vite__mapDeps([12,2,9,1,5])).then(e=>({default:e.UserSettings}))),Vx=m.lazy(()=>Re(()=>import("./TeamList-BlNGdKci.js"),__vite__mapDeps([13,2,14,1,5])).then(e=>({default:e.TeamList}))),Kx=m.lazy(()=>Re(()=>import("./TeamCreate-249rK3U3.js"),__vite__mapDeps([15,2,14,9,1,5])).then(e=>({default:e.TeamCreate}))),qx=m.lazy(()=>Re(()=>import("./TeamDetail-d_GwIRHd.js"),__vite__mapDeps([16,2,9,1,5])).then(e=>({default:e.TeamDetail}))),Xx=m.lazy(()=>Re(()=>import("./TeamSettings-CPraC9uS.js"),__vite__mapDeps([17,2,1,5])).then(e=>({default:e.TeamSettings}))),Yx=new Set(["login","setup","join","share"]),Qx=new Set(["login","setup","join"]);function Zx(){return f.jsx(ju,{defaultTheme:"system",children:f.jsx($x,{children:f.jsx(Jx,{})})})}function Jx(){const[e,t]=m.useState("dashboard"),[n,o]=m.useState(null),[r,s]=m.useState(void 0),[a,i]=m.useState(null),[p,d]=m.useState(null),{adminKey:c}=Dx(),{user:l,isLoading:u,checkSetupStatus:h}=Lx();m.useEffect(()=>{ym(c)},[c]);const[g,v]=m.useState(!1);m.useEffect(()=>{!u&&!l&&h().then(v)},[u,l,h]);const w=m.useCallback(()=>{const S=window.location.pathname,j=new URLSearchParams(window.location.search);if(j.get("acp")==="1"){const M=sessionStorage.getItem("acp_connection");if(M)try{const U=JSON.parse(M);if(U.url&&U.token){d({url:U.url,token:U.token}),sessionStorage.removeItem("acp_connection");const E=new URL(window.location.href);E.searchParams.delete("acp"),window.history.replaceState(null,"",E),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const b=j.get("sid");if(b){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${b}`),o(b),i(null),t("session");return}if(S==="/login"){t("login");return}if(S==="/setup"){t("setup");return}if(S==="/join"){t("join");return}if(S==="/settings"){t("settings");return}if(S==="/teams/new"){t("team-create");return}if(S.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(S.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(S==="/teams"){t("teams");return}const P=S.match(/^\/code\/s\/([^/]+)/);if(P&&P[1]){i(P[1]),o(null),s(void 0),t("share");return}const $=S.match(/^\/code\/([^/]+)/);$&&$[1]?(o($[1]),s(void 0),i(null),t("session")):(o(null),s(void 0),i(null),t("dashboard"))},[]);m.useEffect(()=>(w(),window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)),[w]);const y=m.useCallback(S=>{window.history.pushState(null,"",`/code/${S}`),o(S),s(void 0),i(null),t("session")},[]),_=m.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),i(null),d(null),t("dashboard")},[]);if(u)return f.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});let R=e;g&&R!=="setup"&&(R="setup",window.location.pathname!=="/setup"&&window.history.replaceState(null,"","/setup")),!l&&!Yx.has(R)&&(R="login",window.location.pathname!=="/login"&&window.history.replaceState(null,"","/login")),l&&(R==="login"||R==="setup")&&(R="dashboard",window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"));const k=()=>{if(p&&R==="acp")return f.jsx(Px,{url:p.url,token:p.token,onBack:_});switch(R){case"login":return f.jsx(Bx,{onSuccess:_});case"setup":return f.jsx(Hx,{onSuccess:_,onAlreadyDone:_});case"join":return f.jsx(Wx,{onSuccess:_,onInvalidInvite:_});case"settings":return f.jsx(Gx,{onBack:_});case"teams":return f.jsx(Vx,{});case"team-create":return f.jsx(Kx,{});case"team-detail":return f.jsx(qx,{});case"team-settings":return f.jsx(Xx,{});case"share":return f.jsx(zx,{});case"session":return n?f.jsx(Ux,{sessionId:n,onSessionLoaded:S=>s(S.source)},n):f.jsx("div",{className:"flex-1 overflow-y-auto",children:f.jsx(xs,{onNavigateSession:y})});default:return f.jsx("div",{className:"flex-1 overflow-y-auto",children:f.jsx(xs,{onNavigateSession:y})})}},F=!Qx.has(R);return f.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[F&&f.jsx(vm,{sessionTitle:n||(p?"ACP":void 0),sessionSource:p?"acp":r,onBack:n||p||a?_:void 0}),f.jsx(m.Suspense,{fallback:f.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:k()})]})}Nl.createRoot(document.getElementById("root")).render(f.jsx(m.StrictMode,{children:f.jsx(Zx,{})}));export{Tr as A,Sc as B,og as C,ii as D,ov as E,iv as F,uv as G,sv as H,av as I,Ax as J,Cc as K,Us as L,Lx as M,Vg as O,Bs as P,Wg as R,yu as S,Sv as T,Ln as X,Tx as a,fr as b,qh as c,tn as d,Ev as e,Kg as f,Gg as g,cv as h,th as i,Eu as j,De as k,dv as l,yv as m,bv as n,fv as o,hv as p,pv as q,mv as r,vv as s,wv as t,xv as u,gv as v,Ss as w,J as x,ce as y,yt as z};
|