collabmd 0.1.25 → 0.1.26
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/client/assets/{CodeMirrorEditor-UCMRAMCV-BHWNpLuY.js → CodeMirrorEditor-UCMRAMCV-C5yVpm45.js} +1 -1
- package/dist/client/assets/{_basePickBy-CJWegqog.js → _basePickBy-Dr0N-hVE.js} +1 -1
- package/dist/client/assets/{_baseUniq-CFKN1k1n.js → _baseUniq-BddJc3B1.js} +1 -1
- package/dist/client/assets/{ar-SA-NXDWD63E-DND5MLpM.js → ar-SA-NXDWD63E-C3GLfrYV.js} +1 -1
- package/dist/client/assets/{arc-D1SV2GW0.js → arc-fx_D7wYg.js} +1 -1
- package/dist/client/assets/architecture-PBZL5I3N-C1Yv7agI.js +1 -0
- package/dist/client/assets/{architectureDiagram-2XIMDMQ5-DXpDe6lq.js → architectureDiagram-2XIMDMQ5-T__yxKk2.js} +1 -1
- package/dist/client/assets/{az-AZ-MXSORGZV-ILYw2sYr.js → az-AZ-MXSORGZV-BJ2t-y-C.js} +1 -1
- package/dist/client/assets/{bg-BG-O6MV2KSF-DmfoZHM8.js → bg-BG-O6MV2KSF-Cd3kEZI-.js} +1 -1
- package/dist/client/assets/{blockDiagram-WCTKOSBZ-DlJn0Rs1.js → blockDiagram-WCTKOSBZ-BivLpsk_.js} +1 -1
- package/dist/client/assets/{bn-IN-MMW2ORAC-CmlBLY7g.js → bn-BD-T2VJNT7N-BFCx9nbZ.js} +1 -1
- package/dist/client/assets/{bn-BD-T2VJNT7N-uYQx1Wph.js → bn-IN-MMW2ORAC-Dn9W9dUT.js} +1 -1
- package/dist/client/assets/{c4Diagram-IC4MRINW-C6S9MOEW.js → c4Diagram-IC4MRINW-nVzPTZmV.js} +1 -1
- package/dist/client/assets/{ca-ES-MKBCGNOG-DWiYvMvF.js → ca-ES-MKBCGNOG-D_BNlrmg.js} +1 -1
- package/dist/client/assets/channel-DBZin7O0.js +1 -0
- package/dist/client/assets/{chunk-27N2SPOM-RxZ2_zJJ.js → chunk-27N2SPOM-CyIruM79.js} +4 -4
- package/dist/client/assets/{chunk-4BX2VUAB-LBTVcC6-.js → chunk-4BX2VUAB-n_yl-toC.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-T5nuDI6U.js → chunk-55IACEB6-CJ9i_5Da.js} +1 -1
- package/dist/client/assets/{chunk-7E7YKBS2-CBNUsbS7.js → chunk-7E7YKBS2-CebEBDsj.js} +1 -1
- package/dist/client/assets/{chunk-7R4GIKGN-Dh9p1sbP.js → chunk-7R4GIKGN-BXNhzFkP.js} +2 -2
- package/dist/client/assets/{chunk-C72U2L5F-DLNOvzEI.js → chunk-C72U2L5F-Cck8MvGP.js} +1 -1
- package/dist/client/assets/{chunk-EGIJ26TM-BkBsHEWn.js → chunk-EGIJ26TM-BDQ7tRV-.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-BoiIqhkb.js → chunk-FMBD7UC4-DAcjCJR-.js} +1 -1
- package/dist/client/assets/{chunk-GEFDOKGD-CIg-LRSp.js → chunk-GEFDOKGD-CYSNVsp-.js} +1 -1
- package/dist/client/assets/chunk-GLR3WWYH-FplqAopN.js +2 -0
- package/dist/client/assets/chunk-HHEYEP7N-Bv_FKHmu.js +1 -0
- package/dist/client/assets/{chunk-JSJVCQXG-C6-G93S3.js → chunk-JSJVCQXG-CLgStmEI.js} +1 -1
- package/dist/client/assets/{chunk-KX2RTZJC-CJlt0Rne.js → chunk-KX2RTZJC-B__vUl1o.js} +1 -1
- package/dist/client/assets/{chunk-KYZI473N-C-ObF5L3.js → chunk-KYZI473N-BpfobHkp.js} +1 -1
- package/dist/client/assets/{chunk-L3YUKLVL-BzkNNFii.js → chunk-L3YUKLVL-B7jdwbRL.js} +1 -1
- package/dist/client/assets/{chunk-MX3YWQON-bjcMtEei.js → chunk-MX3YWQON-DNcuP5dS.js} +1 -1
- package/dist/client/assets/{chunk-NQ4KR5QH-DY9oh8PD.js → chunk-NQ4KR5QH-oaq5iS2W.js} +1 -1
- package/dist/client/assets/{chunk-O4XLMI2P-CVfnFXq8.js → chunk-O4XLMI2P-NI4OcSZ6.js} +1 -1
- package/dist/client/assets/{chunk-OZEHJAEY-DyD-ywvu.js → chunk-OZEHJAEY-BevHLeQ0.js} +1 -1
- package/dist/client/assets/{chunk-PQ6SQG4A-BOJs3QbF.js → chunk-PQ6SQG4A-fQ_Oml5n.js} +1 -1
- package/dist/client/assets/{chunk-PU5JKC2W-1nkyDxBh.js → chunk-PU5JKC2W-Bp4H-mwZ.js} +1 -1
- package/dist/client/assets/chunk-QZHKN3VN-Blawx8vd.js +1 -0
- package/dist/client/assets/{chunk-R5LLSJPH-D9t4mFiL.js → chunk-R5LLSJPH-CZzZlfdI.js} +1 -1
- package/dist/client/assets/{chunk-SRAX5OIU-B-Zdxy2r.js → chunk-SRAX5OIU-CtUYAya6.js} +1 -1
- package/dist/client/assets/{chunk-WL4C6EOR-Bs95uEnp.js → chunk-WL4C6EOR-DnV9nMco.js} +1 -1
- package/dist/client/assets/{chunk-XIRO2GV7-CtwY16Jh.js → chunk-XIRO2GV7-BnkmoLpc.js} +1 -1
- package/dist/client/assets/{chunk-XPW4576I-CvxG514V.js → chunk-XPW4576I-DOk6pMat.js} +1 -1
- package/dist/client/assets/{chunk-XZSTWKYB-BNB3Mgw3.js → chunk-XZSTWKYB-DZzfqgVn.js} +1 -1
- package/dist/client/assets/{chunk-YBOYWFTD-MIDp82ug.js → chunk-YBOYWFTD-CrI5WFnC.js} +1 -1
- package/dist/client/assets/{chunk-Z5NKEFVG-CIMf1Se5.js → chunk-Z5NKEFVG-EGvolisB.js} +1 -1
- package/dist/client/assets/classDiagram-VBA2DB6C-CreQafQu.js +1 -0
- package/dist/client/assets/classDiagram-v2-RAHNMMFH-BIYHzbiv.js +1 -0
- package/dist/client/assets/clone-C3ajWNce.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-BKEY00wk.js → cose-bilkent-S5V4N54A-PcMOD_rX.js} +1 -1
- package/dist/client/assets/{cs-CZ-V77HGUP7-sLBAF2Iw.js → cs-CZ-V77HGUP7-gpioT6mv.js} +1 -1
- package/dist/client/assets/{da-DK-I5RFNTM4-B__PLwca.js → da-DK-I5RFNTM4-CVv-_qu9.js} +1 -1
- package/dist/client/assets/{dagre-Cm2w_QpZ.js → dagre-BD9xHP_z.js} +1 -1
- package/dist/client/assets/{dagre-KLK3FWXG-BddfhbwG.js → dagre-KLK3FWXG-Ct1xwvCC.js} +1 -1
- package/dist/client/assets/{de-DE-DTI4WUSC-Ba3fBYEU.js → de-CH-WLRDEVBV-CL0gsFEp.js} +1 -1
- package/dist/client/assets/{de-CH-WLRDEVBV-D61DKw_9.js → de-DE-DTI4WUSC-BQO1SHIK.js} +1 -1
- package/dist/client/assets/{diagram-E7M64L7V-BoyJ8kpo.js → diagram-E7M64L7V-DkHzt94k.js} +1 -1
- package/dist/client/assets/{diagram-IFDJBPK2-DLWembLL.js → diagram-IFDJBPK2-D4g8afpU.js} +1 -1
- package/dist/client/assets/{diagram-P4PSJMXO-CPmPa0OC.js → diagram-P4PSJMXO-DVwwx6ED.js} +1 -1
- package/dist/client/assets/{dist-gCWIHDgw.js → dist-2HWwyMLA.js} +1 -1
- package/dist/client/assets/{dist-Dy9oGocr.js → dist-60g3bzYH.js} +1 -1
- package/dist/client/assets/{dist-Czv7DXcw.js → dist-B2pRSR5A.js} +1 -1
- package/dist/client/assets/{dist-BpEcA20b.js → dist-BQhICHxD.js} +1 -1
- package/dist/client/assets/dist-BS6yAJ9F.js +1 -0
- package/dist/client/assets/dist-BUnp4fHW.js +1 -0
- package/dist/client/assets/dist-BWEDjv8G.js +1 -0
- package/dist/client/assets/{dist-DnpxzfoU.js → dist-BZc5d15t.js} +1 -1
- package/dist/client/assets/{dist-D7S1mzwR.js → dist-BdtPRC1F.js} +1 -1
- package/dist/client/assets/{dist-CKdaLumK.js → dist-BiFbHWxc.js} +1 -1
- package/dist/client/assets/{dist-DFIisyRk.js → dist-BlhsMbAl.js} +1 -1
- package/dist/client/assets/{dist-DGbPPlZ8.js → dist-CLsz2DCg.js} +1 -1
- package/dist/client/assets/{dist-tyxqXzyB.js → dist-Ciw3BJA2.js} +1 -1
- package/dist/client/assets/{dist-BtROnx4-.js → dist-CvMToPSN.js} +1 -1
- package/dist/client/assets/{dist-D4ebIlQB.js → dist-D2m8lD1h.js} +1 -1
- package/dist/client/assets/{dist-BATDm5JF.js → dist-DAwSRqIJ.js} +1 -1
- package/dist/client/assets/{dist-StJm6K24.js → dist-DZD5y4h6.js} +1 -1
- package/dist/client/assets/{dist-Cje3pdZH.js → dist-DhzldYic.js} +1 -1
- package/dist/client/assets/{dist-BiNL3fhN.js → dist-DrNF924C.js} +1 -1
- package/dist/client/assets/{dist-CPzoLjNz.js → dist-DzArd_Bk.js} +1 -1
- package/dist/client/assets/{dist-Le-AVwIk.js → dist-EPRNBXHp.js} +1 -1
- package/dist/client/assets/{dist-BDDCA7hC.js → dist-Q6uG0wie.js} +1 -1
- package/dist/client/assets/{dist-CQzPpOiH.js → dist-U9MIFRLF.js} +1 -1
- package/dist/client/assets/{dist-CxPc5kI6.js → dist-WrbPKwPQ.js} +1 -1
- package/dist/client/assets/{dist-BEs40fGb.js → dist-_L_gn5XE.js} +1 -1
- package/dist/client/assets/{dist-DhkKj77m.js → dist-a6bFAbQd.js} +1 -1
- package/dist/client/assets/{dist-vL71uaef.js → dist-fkQ6urpt.js} +1 -1
- package/dist/client/assets/{dist-BPyPcaZr.js → dist-lbtQBzLu.js} +1 -1
- package/dist/client/assets/dist-naAaVPPS.js +1 -0
- package/dist/client/assets/{dockerfile-BmylqEVx.js → dockerfile-Ci0-ApQC.js} +1 -1
- package/dist/client/assets/drawio-editor-BW2z4NH2.js +9 -0
- package/dist/client/assets/drawio-room-D6352KkV.js +1 -0
- package/dist/client/assets/drawioEditor-DgoA4Zqi.js +2 -0
- package/dist/client/assets/{editor-session-DsM3VgQv.js → editor-session-xPvmulmt.js} +2 -2
- package/dist/client/assets/{el-GR-ZXDJ2OS4-CpEbk42T.js → el-GR-ZXDJ2OS4-DGa9DqWI.js} +1 -1
- package/dist/client/assets/{en-CTDJDZ6K-C36Iqh9O.js → en-CTDJDZ6K-DC-4I8h8.js} +1 -1
- package/dist/client/assets/{erDiagram-INFDFZHY-Dwg_AhU2.js → erDiagram-INFDFZHY-Dnub3poK.js} +1 -1
- package/dist/client/assets/{es-ES-DYQHAD43-Ba-6t0Wr.js → es-ES-DYQHAD43-Cox3GUnj.js} +1 -1
- package/dist/client/assets/{eu-ES-QDSYU5Y3-CYzUKQ2_.js → eu-ES-QDSYU5Y3-DrPM2uSX.js} +1 -1
- package/dist/client/assets/{excalidraw-editor-Cs5p0lBn.js → excalidraw-editor-BAYca95w.js} +9 -9
- package/dist/client/assets/{excalidraw-mermaid-stub-C1ZaaI05.js → excalidraw-mermaid-stub-LpuTrLnr.js} +1 -1
- package/dist/client/assets/excalidrawEditor-BY5rq_Bn.js +2 -0
- package/dist/client/assets/{fa-IR-26LZG4PM-CxLc7ohL.js → fa-IR-26LZG4PM-ViTdxAWX.js} +1 -1
- package/dist/client/assets/{factor-Cc9mS1OI.js → factor-DMvifS-k.js} +1 -1
- package/dist/client/assets/{fi-FI-6YS4KDE4-DtYLOEJY.js → fi-FI-6YS4KDE4-BTBRGd69.js} +1 -1
- package/dist/client/assets/{flowDiagram-PKNHOUZH-BIJd4wAz.js → flowDiagram-PKNHOUZH-DF4dDV_8.js} +1 -1
- package/dist/client/assets/{fr-FR-BRLLPTZC-9O_U5gdi.js → fr-FR-BRLLPTZC-z-POHcHJ.js} +1 -1
- package/dist/client/assets/{ganttDiagram-A5KZAMGK-BiMwicnp.js → ganttDiagram-A5KZAMGK-CwrN53Gu.js} +1 -1
- package/dist/client/assets/gitGraph-HDMCJU4V-DbS2XnWK.js +1 -0
- package/dist/client/assets/{gitGraphDiagram-K3NZZRJ6-lk_paRel.js → gitGraphDiagram-K3NZZRJ6-BV9w0K-N.js} +1 -1
- package/dist/client/assets/{gl-ES-OKUZTLYG-Bb7TO64O.js → gl-ES-OKUZTLYG-BQtfDFNk.js} +1 -1
- package/dist/client/assets/{graphlib-B2nPo9Z4.js → graphlib-B7v-yqry.js} +1 -1
- package/dist/client/assets/{he-IL-26MGYIU7-CQW1igm9.js → he-IL-26MGYIU7-Dyw-xS4W.js} +1 -1
- package/dist/client/assets/{hi-IN-Q4ZOGTP2-BM91ENLs.js → hi-IN-Q4ZOGTP2-BqENUkZA.js} +1 -1
- package/dist/client/assets/{hu-HU-P2OXPSN5-HiGbsUwM.js → hu-HU-P2OXPSN5-D1HGK0_M.js} +1 -1
- package/dist/client/assets/{id-ID-2EIKXYN6-DEG8vRZ2.js → id-ID-2EIKXYN6-BEjyfllL.js} +1 -1
- package/dist/client/assets/image-32MOCVDX-BBXPyAeU.js +1 -0
- package/dist/client/assets/index-C95nV7Tl.css +1 -0
- package/dist/client/assets/index-GE56R5t4.js +2 -0
- package/dist/client/assets/info-3K5VOQVL-Bre4VStM.js +1 -0
- package/dist/client/assets/infoDiagram-LFFYTUFH-CuUbZqrG.js +2 -0
- package/dist/client/assets/{isEmpty-DGNCKhlT.js → isEmpty-CLDc0Kt_.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-PHBUUO56-CE3HierS.js → ishikawaDiagram-PHBUUO56-CmO_FyHY.js} +1 -1
- package/dist/client/assets/{it-IT-4CFKVXI2-DSrGqCKD.js → it-IT-4CFKVXI2-C24G-VcQ.js} +1 -1
- package/dist/client/assets/{ja-JP-MAND2Z4V-OFpEymIv.js → ja-JP-MAND2Z4V-DLhvsdYk.js} +1 -1
- package/dist/client/assets/javascript-DdEc60Aj.js +1 -0
- package/dist/client/assets/{journeyDiagram-4ABVD52K-CzoczPjW.js → journeyDiagram-4ABVD52K-DF4HAYLk.js} +1 -1
- package/dist/client/assets/{jsx-runtime-DRYOYO9I.js → jsx-runtime-DJkgQklN.js} +1 -1
- package/dist/client/assets/{kaa-HQRTCXTJ-CpOJ_vn4.js → kaa-HQRTCXTJ-DC8l3BuJ.js} +1 -1
- package/dist/client/assets/{kab-KAB-JKIKKTGH-CNPzzJH6.js → kab-KAB-JKIKKTGH-DVFog4hd.js} +1 -1
- package/dist/client/assets/{kanban-definition-K7BYSVSG-Cr6iNYl4.js → kanban-definition-K7BYSVSG-nQoJJABn.js} +1 -1
- package/dist/client/assets/{kk-KZ-HXQ63ZFC-CgtjU5JI.js → kk-KZ-HXQ63ZFC-CULUfwMg.js} +1 -1
- package/dist/client/assets/{km-KH-PKL3LSGX-BAJh8UnF.js → km-KH-PKL3LSGX-CnLlEv7i.js} +1 -1
- package/dist/client/assets/{ko-KR-KXLREZX3-BshOksBX.js → ko-KR-KXLREZX3-DNKXAYCx.js} +1 -1
- package/dist/client/assets/{ku-TR-MJ4IER3X-Bi3YtiD-.js → ku-TR-MJ4IER3X-DLUiMa4h.js} +1 -1
- package/dist/client/assets/{line-D2NTyhqv.js → line-DvLjT0Gv.js} +1 -1
- package/dist/client/assets/{linear-DntNI0Uj.js → linear-CEb8O7zv.js} +1 -1
- package/dist/client/assets/{lt-LT-H6WFQ6FJ-DQ2W0g7h.js → lt-LT-H6WFQ6FJ-CoFiurzb.js} +1 -1
- package/dist/client/assets/{lv-LV-GOCK6SJW-DeqTo8T7.js → lv-LV-GOCK6SJW-DzeEvHxX.js} +1 -1
- package/dist/client/assets/main-AejRWvom.js +600 -0
- package/dist/client/assets/{mermaid-parser.core-Bh2Ta9ou.js → mermaid-parser.core-DllATXd7.js} +2 -2
- package/dist/client/assets/{mermaid-runtime-CLtta79D.js → mermaid-runtime-DbCLD8Ih.js} +3 -3
- package/dist/client/assets/{mindmap-definition-YRQLILUH-DufPyQO8.js → mindmap-definition-YRQLILUH-DaMULsE9.js} +1 -1
- package/dist/client/assets/{mr-IN-IXVLDMEQ-CnH5Wjc7.js → mr-IN-IXVLDMEQ-C5i5R9H5.js} +1 -1
- package/dist/client/assets/{my-MM-YG6MYTTD-BefEpouO.js → my-MM-YG6MYTTD-DvwceqO-.js} +1 -1
- package/dist/client/assets/{nb-NO-XGWJISD2-CNRrlrPY.js → nb-NO-XGWJISD2-BUhX8hX0.js} +1 -1
- package/dist/client/assets/{nl-NL-XVDVCPNC-CuLTw3kL.js → nl-NL-XVDVCPNC-BV6Y0-Q0.js} +1 -1
- package/dist/client/assets/{nn-NO-EMX5MJX5-NHFRnQkl.js → nn-NO-EMX5MJX5-CF_bB9Jq.js} +1 -1
- package/dist/client/assets/{nsis-YyYYKQIB.js → nsis-42hkxqLx.js} +1 -1
- package/dist/client/assets/{oc-FR-ROEINTVO-8kCbAtcr.js → oc-FR-ROEINTVO-CiNI8fg8.js} +1 -1
- package/dist/client/assets/{ordinal-BuNU9EgZ.js → ordinal-fW5lWpNM.js} +1 -1
- package/dist/client/assets/{pa-IN-ZYN6SUDY-Dh8USSIe.js → pa-IN-ZYN6SUDY-CsbIU150.js} +1 -1
- package/dist/client/assets/packet-RMMSAZCW-B7lnOkip.js +1 -0
- package/dist/client/assets/percentages-5DKR754L-Dp1vwDEq.js +1 -0
- package/dist/client/assets/{pica-BG8AR4mo.js → pica-BbcTjVoI.js} +1 -1
- package/dist/client/assets/{clone-CMmi3x0H.js → pie-UPGHQEXC-D0gHdMgb.js} +1 -1
- package/dist/client/assets/{pieDiagram-SKSYHLDU--YidSJxi.js → pieDiagram-SKSYHLDU-BPFp1WBd.js} +1 -1
- package/dist/client/assets/{pl-PL-6VTG7PHC-BMbgP62B.js → pl-PL-6VTG7PHC-D1Nnx7R3.js} +1 -1
- package/dist/client/assets/preview-render-compiler-BYiRMsPq.js +1 -0
- package/dist/client/assets/{preview-render-profile-BjrQVCWD.js → preview-render-profile-DQsam_Ol.js} +2 -2
- package/dist/client/assets/{preview-render-worker-DbMTa0Y6.js → preview-render-worker-CcASh3y3.js} +1 -1
- package/dist/client/assets/{pt-BR-5YFKRR5G-CyrwFw_N.js → pt-BR-5YFKRR5G-DEDTeWEP.js} +1 -1
- package/dist/client/assets/{pt-PT-GEIXXZ67-SpK5vaGR.js → pt-PT-GEIXXZ67-BpqPVZom.js} +1 -1
- package/dist/client/assets/{pug-CM36H1hd.js → pug-BANqyQJ9.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-337W2JSQ-n7EIFT_f.js → quadrantDiagram-337W2JSQ-DjPGrcJM.js} +1 -1
- package/dist/client/assets/{quick-switcher-controller-CKrGBgcl.js → quick-switcher-controller-n6Jhu3Z9.js} +1 -1
- package/dist/client/assets/radar-KQ55EAFF-D48du2CB.js +1 -0
- package/dist/client/assets/{requirementDiagram-Z7DCOOCP-BrquJATD.js → requirementDiagram-Z7DCOOCP-BmiYAMKV.js} +1 -1
- package/dist/client/assets/{ro-RO-E2P6TFZI-90dn2iUp.js → ro-RO-E2P6TFZI-4vRM1jVT.js} +1 -1
- package/dist/client/assets/{room-zaSnuMv5.js → room-DyhEnogt.js} +1 -1
- package/dist/client/assets/{ru-RU-YBIIY43T-Cl52NZnQ.js → ru-RU-YBIIY43T-Cfbhz4Ew.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-WA2Y5GQK-IpD6lgfO.js → sankeyDiagram-WA2Y5GQK-BEoPAlcC.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-2WXFIKYE-DxZ6glIZ.js → sequenceDiagram-2WXFIKYE-BXqojuDS.js} +1 -1
- package/dist/client/assets/{si-LK-673C2CI2-DMSUxT-y.js → si-LK-673C2CI2-0muNkOEn.js} +1 -1
- package/dist/client/assets/{sk-SK-CKZHQ4AP-DUDai5Oe.js → sk-SK-CKZHQ4AP-EnLgxyJL.js} +1 -1
- package/dist/client/assets/{sl-SI-557H2GWM-BbLeATfl.js → sl-SI-557H2GWM-BN6npqVj.js} +1 -1
- package/dist/client/assets/{src-H0-aBY9y.js → src-DUDi_GeV.js} +1 -1
- package/dist/client/assets/{stateDiagram-RAJIS63D-A-rbDcdL.js → stateDiagram-RAJIS63D-DTR2sQs8.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-FVOUBMTO-BwVII-kJ.js +1 -0
- package/dist/client/assets/subset-shared.chunk-C6pUl_Oh.js +1 -0
- package/dist/client/assets/{subset-worker.chunk-B7pmUG1o.js → subset-worker.chunk-1FoL7eL0.js} +1 -1
- package/dist/client/assets/{sv-SE-XOPKKDWS-BBa-AcMf.js → sv-SE-XOPKKDWS-D3VSs2SQ.js} +1 -1
- package/dist/client/assets/{ta-IN-XBH7DQI3-9uR7ADzx.js → ta-IN-XBH7DQI3-BKR1mqfo.js} +1 -1
- package/dist/client/assets/{th-TH-TOCWH3R4-Box9U3ny.js → th-TH-TOCWH3R4-Bek1dQcW.js} +1 -1
- package/dist/client/assets/{timeline-definition-YZTLITO2-DuTppHot.js → timeline-definition-YZTLITO2-BP09qqIh.js} +1 -1
- package/dist/client/assets/{tr-TR-GXW6CYY5-BA8pS3C5.js → tr-TR-GXW6CYY5-xdLb7Dgi.js} +1 -1
- package/dist/client/assets/treemap-KZPCXAKY-BBRObSiT.js +1 -0
- package/dist/client/assets/{uk-UA-IJKTNUDG-B6hoHqzM.js → uk-UA-IJKTNUDG-Cd0AhTti.js} +1 -1
- package/dist/client/assets/{uz-UZ-TBZZEA4V-CPuftH33.js → uz-UZ-TBZZEA4V-DQH4e-QC.js} +1 -1
- package/dist/client/assets/{vault-api-client-D7C_m9eq.js → vault-api-client-fFJfUVXM.js} +2 -2
- package/dist/client/assets/vault-utils-BM4i-Ofm.js +1 -0
- package/dist/client/assets/{vennDiagram-LZ73GAT5-J0SBkXj8.js → vennDiagram-LZ73GAT5-BvSlhnT0.js} +1 -1
- package/dist/client/assets/{vi-VN-MULSGNVB-yRFd9OXl.js → vi-VN-MULSGNVB-BYDcPrAo.js} +1 -1
- package/dist/client/assets/{xychartDiagram-JWTSCODW-Dn9dSYxn.js → xychartDiagram-JWTSCODW-BvZ78F0j.js} +1 -1
- package/dist/client/assets/{yjs-provider-reset-guard-BcnBGrS9.js → yjs-provider-reset-guard-Cj00kgyM.js} +1 -1
- package/dist/client/assets/{zh-CN-MVX3E32U-VzUIXB4K.js → zh-CN-MVX3E32U-BqZQ-18-.js} +1 -1
- package/dist/client/assets/{zh-HK-JNU5RLIE-i0G2jHO_.js → zh-HK-JNU5RLIE-CbF8Agwa.js} +1 -1
- package/dist/client/assets/{zh-TW-LENVCA6T-BkHZg3jv.js → zh-TW-LENVCA6T-CepoVycx.js} +1 -1
- package/dist/client/drawio-editor.html +38 -0
- package/dist/client/excalidraw-editor.html +3 -3
- package/dist/client/index.html +16 -22
- package/package.json +1 -1
- package/src/client/app/drawio-editor-entry.js +4 -0
- package/src/client/app/drawio-editor.html +36 -0
- package/src/client/app/index.html +12 -18
- package/src/client/application/app-shell/ui-feature-identity.js +5 -2
- package/src/client/application/app-shell/ui-feature-shell.js +28 -2
- package/src/client/application/app-shell/workspace-feature.js +9 -0
- package/src/client/application/preview-render-compiler.js +18 -1
- package/src/client/application/preview-render-profile.js +5 -1
- package/src/client/application/workspace-chrome-controller.js +6 -0
- package/src/client/application/workspace-coordinator.js +12 -4
- package/src/client/application/workspace-preview-controller.js +65 -3
- package/src/client/application/workspace-route-controller.js +6 -3
- package/src/client/bootstrap/collabmd-app-shell.js +20 -0
- package/src/client/domain/runtime-paths.js +1 -0
- package/src/client/domain/vault-paths.js +24 -0
- package/src/client/drawio-editor.js +479 -0
- package/src/client/infrastructure/browser-navigation-port.js +2 -2
- package/src/client/infrastructure/drawio-lease-client.js +345 -0
- package/src/client/infrastructure/runtime-config.js +5 -1
- package/src/client/infrastructure/vault-api-client.js +9 -0
- package/src/client/presentation/comments-panel.js +2 -2
- package/src/client/presentation/create-menu-presenter.js +274 -0
- package/src/client/presentation/drawio-embed-controller.js +500 -0
- package/src/client/presentation/file-action-controller.js +126 -16
- package/src/client/presentation/file-explorer-controller.js +1 -0
- package/src/client/presentation/file-explorer-view.js +10 -2
- package/src/client/presentation/file-tree-state.js +1 -0
- package/src/client/presentation/theme-controller.js +21 -4
- package/src/client/styles/components/navigation.css +24 -0
- package/src/client/styles/features/diagram-preview.css +119 -1
- package/src/client/styles/layout/responsive.css +76 -7
- package/src/client/styles/layout/shell.css +41 -0
- package/src/client/styles/layout/sidebar.css +194 -3
- package/src/client/styles/layout/view-modes.css +1 -0
- package/src/domain/drawio-room.js +47 -0
- package/src/domain/file-kind.js +13 -2
- package/src/server/config/env.js +5 -0
- package/src/server/create-app-server.js +4 -2
- package/src/server/domain/collaboration/collaboration-document-store.js +11 -0
- package/src/server/domain/collaboration/collaboration-room.js +5 -0
- package/src/server/infrastructure/http/create-static-handler.js +2 -0
- package/src/server/infrastructure/http/create-vault-api-command-handler.js +5 -0
- package/src/server/infrastructure/http/create-vault-api-query-handler.js +5 -0
- package/src/server/infrastructure/persistence/path-utils.js +1 -1
- package/src/server/infrastructure/persistence/vault-content-adapter.js +6 -0
- package/src/server/infrastructure/persistence/vault-file-store.js +8 -0
- package/dist/client/assets/architecture-PBZL5I3N-0dui3p7-.js +0 -1
- package/dist/client/assets/channel-CVwYcdlk.js +0 -1
- package/dist/client/assets/chunk-GLR3WWYH-CqGMuOti.js +0 -2
- package/dist/client/assets/chunk-HHEYEP7N-Czb3OX2v.js +0 -1
- package/dist/client/assets/chunk-QZHKN3VN-DU7fMcaP.js +0 -1
- package/dist/client/assets/classDiagram-VBA2DB6C-CBSmkOe7.js +0 -1
- package/dist/client/assets/classDiagram-v2-RAHNMMFH-CJarRy94.js +0 -1
- package/dist/client/assets/dist-CNcGnl0T.js +0 -1
- package/dist/client/assets/dist-CnKD4Y92.js +0 -1
- package/dist/client/assets/dist-DL-EaOiC.js +0 -1
- package/dist/client/assets/dist-mDBaykBY.js +0 -1
- package/dist/client/assets/excalidrawEditor-wgJb2hmP.js +0 -2
- package/dist/client/assets/gitGraph-HDMCJU4V-iPo6Lz4k.js +0 -1
- package/dist/client/assets/image-32MOCVDX-viHDtJGM.js +0 -1
- package/dist/client/assets/index-B6m_KATZ.css +0 -1
- package/dist/client/assets/index-D20GlrKF.js +0 -2
- package/dist/client/assets/info-3K5VOQVL-DePZHLA4.js +0 -1
- package/dist/client/assets/infoDiagram-LFFYTUFH-CiAT_kJZ.js +0 -2
- package/dist/client/assets/javascript-DcX_cm1u.js +0 -1
- package/dist/client/assets/main-DONXLDrC.js +0 -599
- package/dist/client/assets/packet-RMMSAZCW-BVw0pEk-.js +0 -1
- package/dist/client/assets/percentages-5DKR754L-RQFE76Sg.js +0 -1
- package/dist/client/assets/pie-UPGHQEXC-ChUWa5qF.js +0 -1
- package/dist/client/assets/preview-render-compiler-CWBdv5tw.js +0 -1
- package/dist/client/assets/radar-KQ55EAFF-B4gMcoDX.js +0 -1
- package/dist/client/assets/stateDiagram-v2-FVOUBMTO-CKhOHHLe.js +0 -1
- package/dist/client/assets/subset-shared.chunk-93a-Md8B.js +0 -1
- package/dist/client/assets/treemap-KZPCXAKY-on28XbV_.js +0 -1
- package/dist/client/assets/vault-utils-Js2T-e-h.js +0 -1
- /package/dist/client/assets/{apl-khHl8vBy.js → apl-CJPt5sW7.js} +0 -0
- /package/dist/client/assets/{array-BTHl6o_K.js → array-e43ctQmx.js} +0 -0
- /package/dist/client/assets/{asciiarmor-7xnRhA8w.js → asciiarmor-D0oCypDs.js} +0 -0
- /package/dist/client/assets/{asn1-_x-T1mFB.js → asn1-8xgVfRoq.js} +0 -0
- /package/dist/client/assets/{asterisk-Ct2NwVUw.js → asterisk-B5kv5AQp.js} +0 -0
- /package/dist/client/assets/{brainfuck-CAmdgqDN.js → brainfuck-Dh7M1Ucz.js} +0 -0
- /package/dist/client/assets/{chunk-3PELD44J-BvOh9EJp.js → chunk-3PELD44J-D4qJ8fq7.js} +0 -0
- /package/dist/client/assets/{chunk-A66AFZZU-D0IDIehU.js → chunk-A66AFZZU-CJuwmF1m.js} +0 -0
- /package/dist/client/assets/{chunk-Cq_f4orQ.js → chunk-D-fkvfCP.js} +0 -0
- /package/dist/client/assets/{chunk-ETSVUAFD-BnK5BhxL.js → chunk-ETSVUAFD-C8C1JDu2.js} +0 -0
- /package/dist/client/assets/{clike-BJcwKCE7.js → clike-zYz_LEkw.js} +0 -0
- /package/dist/client/assets/{clojure-uSRILJfc.js → clojure-CdWlIeQh.js} +0 -0
- /package/dist/client/assets/{cmake-j5-7WxMz.js → cmake-wWuF5ifR.js} +0 -0
- /package/dist/client/assets/{cobol-cnURuZ43.js → cobol-D3WLbLVy.js} +0 -0
- /package/dist/client/assets/{coffeescript-iQD116iO.js → coffeescript-DRtt-5a2.js} +0 -0
- /package/dist/client/assets/{commonlisp-DGzExN9H.js → commonlisp-DJV75lsU.js} +0 -0
- /package/dist/client/assets/{crystal-CnjkM1-q.js → crystal-C7mEw92C.js} +0 -0
- /package/dist/client/assets/{css-C-Nv0c9S.js → css-_6KgQwpu.js} +0 -0
- /package/dist/client/assets/{cypher-hxitpny2.js → cypher-B3uWx7jm.js} +0 -0
- /package/dist/client/assets/{cytoscape.esm-0xzpJ66h.js → cytoscape.esm-BbbuX1pV.js} +0 -0
- /package/dist/client/assets/{d-BtdAWoTB.js → d-D3kOh3JF.js} +0 -0
- /package/dist/client/assets/{defaultLocale-PG3Gbk8q.js → defaultLocale-DTn6RiRA.js} +0 -0
- /package/dist/client/assets/{diff-f_ZkWiYS.js → diff-CoamybWh.js} +0 -0
- /package/dist/client/assets/{dist-CCxn5Mk-.js → dist-yRVuIDKu.js} +0 -0
- /package/dist/client/assets/{dtd-B6xdyNDx.js → dtd-BjGQwMWL.js} +0 -0
- /package/dist/client/assets/{dylan-BzUoKQTn.js → dylan-B9W3X2GI.js} +0 -0
- /package/dist/client/assets/{ebnf-BlTaNq16.js → ebnf-d5D0otVn.js} +0 -0
- /package/dist/client/assets/{ecl-CffPaRqR.js → ecl-C5Q_IBPt.js} +0 -0
- /package/dist/client/assets/{eiffel-B66P6crR.js → eiffel-BQA_6I3b.js} +0 -0
- /package/dist/client/assets/{elm-DIwllOLv.js → elm-unPS17vB.js} +0 -0
- /package/dist/client/assets/{erlang-DwYA67QU.js → erlang-R8nOsUTx.js} +0 -0
- /package/dist/client/assets/{excalidraw-mermaid-stub-BtCKxPxK.js → excalidraw-mermaid-stub-BJq3n7pR.js} +0 -0
- /package/dist/client/assets/{fcl-DD6dBrvI.js → fcl-CVAfW9wK.js} +0 -0
- /package/dist/client/assets/{forth-DFLLMv-i.js → forth-DHbsK8X8.js} +0 -0
- /package/dist/client/assets/{fortran-CNZVMQdQ.js → fortran-4jMwxW9-.js} +0 -0
- /package/dist/client/assets/{gas-DyiCLKEJ.js → gas-zC_XGrQT.js} +0 -0
- /package/dist/client/assets/{gherkin-CHgE7bAJ.js → gherkin-CPBQou3u.js} +0 -0
- /package/dist/client/assets/{groovy-BZc3It91.js → groovy-Cqopym0q.js} +0 -0
- /package/dist/client/assets/{haskell-DJ4hTi3A.js → haskell-imzbNPgF.js} +0 -0
- /package/dist/client/assets/{haxe-sJjg_lHN.js → haxe-Doh225Ku.js} +0 -0
- /package/dist/client/assets/{http-DwAi3Ho1.js → http-j4R5uEso.js} +0 -0
- /package/dist/client/assets/{idl-CCIDRFwr.js → idl-l9d1__Hj.js} +0 -0
- /package/dist/client/assets/{image-blob-reduce.esm-D4wBfumB.js → image-blob-reduce.esm-CQfEe3_g.js} +0 -0
- /package/dist/client/assets/{init-Bb7Vx0CW.js → init-207s1ipc.js} +0 -0
- /package/dist/client/assets/{isArrayLikeObject-DxEG9mY7.js → isArrayLikeObject-ZCMZRndo.js} +0 -0
- /package/dist/client/assets/{javascript-BlUxwA0O.js → javascript-9dQYqEHJ.js} +0 -0
- /package/dist/client/assets/{julia-BU0qBb1w.js → julia-ByGjwiLn.js} +0 -0
- /package/dist/client/assets/{katex-DoaSnJ5T.js → katex-XOVNa2d9.js} +0 -0
- /package/dist/client/assets/{livescript-uk34VDGK.js → livescript-B8l2m7xO.js} +0 -0
- /package/dist/client/assets/{lua-ClQGOv84.js → lua-DrfAKnQQ.js} +0 -0
- /package/dist/client/assets/{math-DQo53qzt.js → math-BlD6rf4Z.js} +0 -0
- /package/dist/client/assets/{mathematica-BDmKpvRN.js → mathematica-DYk_2Ik_.js} +0 -0
- /package/dist/client/assets/{mbox-T5kA6jAQ.js → mbox-BOzVHzVt.js} +0 -0
- /package/dist/client/assets/{mirc-DRRKKkcJ.js → mirc-DStbUCmv.js} +0 -0
- /package/dist/client/assets/{mllike-iZXopbca.js → mllike-BmhQglqS.js} +0 -0
- /package/dist/client/assets/{modelica-DP8T2DKM.js → modelica-ZElxtbqD.js} +0 -0
- /package/dist/client/assets/{mscgen-DXIRw2qg.js → mscgen-f-YxHPr0.js} +0 -0
- /package/dist/client/assets/{mumps-BKUS05-y.js → mumps-B79RJJhR.js} +0 -0
- /package/dist/client/assets/{nginx-CzYOtr2G.js → nginx-c--axfuP.js} +0 -0
- /package/dist/client/assets/{ntriples-ZgZuaYbW.js → ntriples-CgD4YZZC.js} +0 -0
- /package/dist/client/assets/{octave-CnOndUN3.js → octave-BQk-bCrp.js} +0 -0
- /package/dist/client/assets/{oz-DjW322Rn.js → oz-DPCSPrx5.js} +0 -0
- /package/dist/client/assets/{pascal-BdeW5uRX.js → pascal-C1iGzZ53.js} +0 -0
- /package/dist/client/assets/{path-BxyPWlyM.js → path-CDSE7Nw0.js} +0 -0
- /package/dist/client/assets/{perl-_CDvIe1D.js → perl-DQ3L8ffg.js} +0 -0
- /package/dist/client/assets/{pig-inWo_B4W.js → pig-B4S8acys.js} +0 -0
- /package/dist/client/assets/{powershell-CO5KWJsy.js → powershell-BhSVdaeY.js} +0 -0
- /package/dist/client/assets/{preload-helper-Chd9yIcd.js → preload-helper-I1wKxk_B.js} +0 -0
- /package/dist/client/assets/{properties-CjVp4a6M.js → properties-B2nfdtxE.js} +0 -0
- /package/dist/client/assets/{protobuf-DybFT2KT.js → protobuf-BFW_iwVN.js} +0 -0
- /package/dist/client/assets/{puppet-Dw_NDgko.js → puppet-C1-CkyhQ.js} +0 -0
- /package/dist/client/assets/{python-2pwcWoy7.js → python-CYXPDD4I.js} +0 -0
- /package/dist/client/assets/{q-C47l8kdS.js → q-Bub5Xmxm.js} +0 -0
- /package/dist/client/assets/{r-BmcXGVZ5.js → r-C59ONZO2.js} +0 -0
- /package/dist/client/assets/{rough.esm-C7Rbwqik.js → rough.esm-xhKrnp4d.js} +0 -0
- /package/dist/client/assets/{roundRect-CDlbNkEg.js → roundRect-CTz-kxJH.js} +0 -0
- /package/dist/client/assets/{rpm-Cm0x5xT_.js → rpm-DiM-R-wd.js} +0 -0
- /package/dist/client/assets/{ruby-Dl-I4pxG.js → ruby-DTqG95KX.js} +0 -0
- /package/dist/client/assets/{runtime-config-loader--hxFvh23.js → runtime-config-loader-DwWsKc1-.js} +0 -0
- /package/dist/client/assets/{sas-Bxkg4GVX.js → sas-BjdhmGHX.js} +0 -0
- /package/dist/client/assets/{scheme-CO3zogua.js → scheme-CWNdoI17.js} +0 -0
- /package/dist/client/assets/{shell-gYrTvBTP.js → shell-iaorleRB.js} +0 -0
- /package/dist/client/assets/{sieve-COX4Kn1X.js → sieve-D8m9Etmd.js} +0 -0
- /package/dist/client/assets/{simple-mode-BY9UFVy7.js → simple-mode-kdHrpFjq.js} +0 -0
- /package/dist/client/assets/{smalltalk-Dma1z5eE.js → smalltalk-28WS1mUj.js} +0 -0
- /package/dist/client/assets/{solr-BvhcdkNH.js → solr-x8qQ6eAP.js} +0 -0
- /package/dist/client/assets/{sparql-gX7W9xeh.js → sparql-BvLmi7B6.js} +0 -0
- /package/dist/client/assets/{spreadsheet-BnlQRxWz.js → spreadsheet-BuqSwScP.js} +0 -0
- /package/dist/client/assets/{sql-CwA10oIk.js → sql-B8tBavZM.js} +0 -0
- /package/dist/client/assets/{stex-DhLUylSV.js → stex-Bx4bLPxI.js} +0 -0
- /package/dist/client/assets/{stylus-9ZGSp3KB.js → stylus-CMEhEjuV.js} +0 -0
- /package/dist/client/assets/{swift-CurfpLXH.js → swift-wY9II8hY.js} +0 -0
- /package/dist/client/assets/{tcl-BPvzXR-t.js → tcl-BGywDEsi.js} +0 -0
- /package/dist/client/assets/{textile-BUq3vgBH.js → textile-K_mvsehZ.js} +0 -0
- /package/dist/client/assets/{tiddlywiki-DRR6E4hS.js → tiddlywiki-BrpeQ34q.js} +0 -0
- /package/dist/client/assets/{tiki-C1XMixgx.js → tiki-z2eQQPgI.js} +0 -0
- /package/dist/client/assets/{toml-BQjoWSzq.js → toml-Dcu7S7XA.js} +0 -0
- /package/dist/client/assets/{troff-DbgTp3Cj.js → troff-Djlumm7T.js} +0 -0
- /package/dist/client/assets/{ttcn-1OxchGWH.js → ttcn-XqU6tthJ.js} +0 -0
- /package/dist/client/assets/{ttcn-cfg-CC8OhyHu.js → ttcn-cfg-BzD0wr3i.js} +0 -0
- /package/dist/client/assets/{turtle-D1WjVU4-.js → turtle-DcjXkx6M.js} +0 -0
- /package/dist/client/assets/{vb-Bf-XXYNJ.js → vb-DV4y2QrD.js} +0 -0
- /package/dist/client/assets/{vbscript-HeSyWuOi.js → vbscript-BS8DsYJ_.js} +0 -0
- /package/dist/client/assets/{velocity-CUkiDsJQ.js → velocity-CS6Ly2yV.js} +0 -0
- /package/dist/client/assets/{verilog-BFxB5RAN.js → verilog-DbEC7ose.js} +0 -0
- /package/dist/client/assets/{vhdl-BJUXQE-6.js → vhdl-DBLrW9bF.js} +0 -0
- /package/dist/client/assets/{webidl-advQMGTP.js → webidl-CnE8KY-y.js} +0 -0
- /package/dist/client/assets/{xquery-CNzoFgd7.js → xquery--K5Za5EW.js} +0 -0
- /package/dist/client/assets/{yacas-BsmlDKac.js → yacas-ClQfYBmX.js} +0 -0
- /package/dist/client/assets/{z80-Bnez4vZ_.js → z80-Dr2oR3X2.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ar-SA-NXDWD63E-
|
|
2
|
-
import{s as e,t}from"./chunk-Cq_f4orQ.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./chunk-A66AFZZU-D0IDIehU.js";import{i,n as a,r as o}from"./chunk-SRAX5OIU-B-Zdxy2r.js";import{n as s,t as c}from"./jsx-runtime-DRYOYO9I.js";import{$ as l,$a as u,$i as d,$n as f,$o as p,$r as m,$s as h,$t as g,A as _,Aa as v,Ac as y,Ai as b,An as x,Ao as S,Ar as C,As as w,At as T,B as E,Ba as D,Bc as O,Bi as k,Bn as A,Br as ee,Bs as te,Bt as ne,C as j,Ca as re,Cc as ie,Ci as ae,Cn as oe,Co as se,Cr as ce,Cs as le,Ct as ue,D as de,Da as fe,Dc as pe,Di as me,Dn as he,Do as ge,Dr as _e,Ds as ve,Dt as ye,E as be,Ea as xe,Ec as Se,Ei as Ce,En as M,Eo as N,Er as we,Es as Te,Et as Ee,F as De,Fa as Oe,Fc as ke,Fi as Ae,Fn as je,Fo as Me,Fr as Ne,Fs as Pe,Ft as Fe,G as Ie,Ga as Le,Gi as Re,Gn as ze,Go as Be,Gr as Ve,Gs as He,Gt as Ue,H as We,Ha as Ge,Hc as Ke,Hi as qe,Hn as Je,Ho as Ye,Hr as Xe,Hs as Ze,Ht as Qe,I as $e,Ia as et,Ic as tt,Ii as nt,In as rt,Io as it,Ir as at,Is as ot,It as st,J as ct,Ja as lt,Ji as P,Jn as ut,Jo as dt,Jr as ft,Js as pt,Jt as mt,K as ht,Ka as gt,Ki as _t,Kn as vt,Ko as yt,Kr as bt,Ks as xt,Kt as St,L as Ct,La as wt,Lc as Tt,Li as Et,Ln as Dt,Lo as Ot,Lr as kt,Ls as At,Lt as jt,M as Mt,Ma as Nt,Mc as Pt,Mn as Ft,Mo as It,Mr as Lt,Ms as Rt,Mt as zt,N as Bt,Na as Vt,Nc as Ht,Ni as Ut,Nn as Wt,No as Gt,Nr as Kt,Ns as qt,Nt as Jt,O as Yt,Oa as Xt,Oc as Zt,Oi as Qt,On as $t,Or as en,Os as tn,Ot as nn,P as rn,Pa as an,Pc as on,Pi as sn,Pn as cn,Po as ln,Pr as un,Ps as dn,Pt as fn,Q as pn,Qa as mn,Qi as hn,Qn as gn,Qo as _n,Qr as vn,Qs as yn,Qt as bn,R as xn,Ra as Sn,Rc as Cn,Ri as wn,Rn as Tn,Ro as En,Rr as Dn,Rs as On,Rt as kn,S as An,Sa as jn,Sc as Mn,Si as Nn,Sn as Pn,So as Fn,Sr as In,Ss as Ln,St as Rn,T as zn,Ta as Bn,Tc as Vn,Ti as Hn,Tn as Un,To as Wn,Tr as Gn,Ts as Kn,Tt as qn,U as Jn,Ua as F,Ui as Yn,Un as Xn,Ur as Zn,Us as Qn,Ut as $n,V as er,Va as tr,Vc as nr,Vi as rr,Vn as ir,Vo as ar,Vr as or,Vs as sr,Vt as cr,Wa as lr,Wi as ur,Wn as dr,Wo as fr,Wr as pr,Ws as mr,Wt as hr,X as gr,Xa as _r,Xi as vr,Xn as yr,Xo as br,Xr as xr,Xs as Sr,Xt as Cr,Y as wr,Ya as Tr,Yi as Er,Yn as Dr,Yo as Or,Yr as kr,Ys as Ar,Yt as jr,Za as Mr,Zi as Nr,Zn as Pr,Zo as Fr,Zr as Ir,Zs as Lr,Zt as Rr,_ as zr,_a as Br,_c as Vr,_i as Hr,_n as Ur,_o as Wr,_r as Gr,_s as Kr,_t as I,aa as qr,ac as Jr,ai as Yr,an as Xr,ao as Zr,ar as Qr,as as $r,at as ei,b as ti,ba as ni,bc as ri,bi as ii,bn as ai,bo as oi,br as si,bt as ci,c as li,ca as ui,cc as di,ci as fi,cn as pi,co as mi,cr as L,cs as hi,ct as gi,d as _i,da as vi,dc as yi,di as bi,dn as xi,dr as Si,ds as Ci,dt as wi,ea as Ti,ec as Ei,ei as Di,en as Oi,eo as ki,er as Ai,es as ji,et as Mi,f as Ni,fa as Pi,fc as Fi,fi as Ii,fn as Li,fo as Ri,fr as zi,fs as Bi,ft as Vi,g as Hi,ga as Ui,gc as Wi,gi as Gi,gn as Ki,go as qi,gr as Ji,gs as R,gt as Yi,h as Xi,ha as Zi,hc as Qi,hi as $i,hn as ea,ho as ta,hr as na,ht as ra,i as ia,ia as aa,ic as oa,ii as sa,in as ca,io as la,ir as ua,is as da,it as fa,j as pa,ja as ma,jc as ha,ji as ga,jn as _a,jo as va,jr as ya,js as ba,jt as xa,k as Sa,ka as Ca,kc as wa,ki as Ta,kn as Ea,ko as Da,kr as Oa,ks as ka,kt as Aa,l as ja,la as Ma,lc as Na,li as Pa,ln as Fa,lo as Ia,lr as La,ls as Ra,lt as za,m as Ba,ma as Va,mi as Ha,mn as Ua,mo as Wa,mr as Ga,ms as Ka,mt as qa,n as Ja,na as Ya,nc as Xa,ni as Za,nn as Qa,no as $a,nr as eo,ns as to,nt as no,o as ro,oa as io,oc as ao,oi as oo,on as so,oo as co,or as lo,os as uo,ot as fo,p as z,pa as po,pc as mo,pi as ho,pn as go,po as _o,pr as vo,ps as yo,pt as bo,q as xo,qa as So,qi as Co,qn as wo,qr as To,qs as Eo,qt as Do,r as Oo,ra as ko,rc as Ao,ri as jo,rn as B,ro as Mo,rr as No,rs as Po,rt as Fo,s as Io,sa as Lo,sc as Ro,si as zo,sn as Bo,so as Vo,sr as V,ss as Ho,st as Uo,t as Wo,ta as Go,tc as Ko,ti as qo,tn as Jo,to as Yo,tr as Xo,ts as Zo,tt as Qo,u as $o,ua as es,uc as ts,ui as ns,un as rs,uo as is,ur as as,us as os,ut as ss,v as cs,va as ls,vc as us,vi as ds,vn as fs,vo as ps,vr as ms,vs as hs,vt as gs,w as _s,wa as vs,wc as ys,wi as bs,wn as xs,wo as Ss,wr as Cs,ws,wt as Ts,x as Es,xa as Ds,xc as Os,xi as ks,xn as As,xo as js,xr as Ms,xs as Ns,xt as Ps,y as Fs,ya as Is,yc as Ls,yi as Rs,yn as zs,yo as Bs,yr as Vs,ys as Hs,yt as Us,z as Ws,za as Gs,zc as Ks,zi as qs,zn as Js,zo as Ys,zr as Xs,zs as Zs,zt as Qs}from"./chunk-27N2SPOM-RxZ2_zJJ.js";import{_ as $s}from"./chunk-ETSVUAFD-BnK5BhxL.js";import{r as ec}from"./chunk-3PELD44J-BvOh9EJp.js";import{n as tc}from"./excalidraw-mermaid-stub-BtCKxPxK.js";import{O as nc,n as rc,o as ic,r as ac,t as oc}from"./yjs-provider-reset-guard-BcnBGrS9.js";import{n as sc,t as cc}from"./vault-api-client-D7C_m9eq.js";var lc=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),uc=t(((e,t)=>{t.exports=lc()})),dc=t((e=>{var t=s();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.0`})),fc=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=dc()})),pc=t((e=>{var t=uc(),n=s(),r=fc();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ne=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function le(e,t){oe++,ae[oe]=e.current,e.current=t}var ue=se(null),de=se(null),fe=se(null),pe=se(null);function me(e,t){switch(le(fe,t),le(de,e),le(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(ue),le(ue,e)}function he(){ce(ue),ce(de),ce(fe)}function ge(e){e.memoizedState!==null&&le(pe,e);var t=ue.current,n=Xd(t,e.type);t!==n&&(le(de,e),le(ue,n))}function _e(e){de.current===e&&(ce(ue),ce(de)),pe.current===e&&(ce(pe),op._currentValue=ie)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ar-SA-NXDWD63E-C3GLfrYV.js","./chunk-SRAX5OIU-CtUYAya6.js","./chunk-D-fkvfCP.js","./az-AZ-MXSORGZV-BJ2t-y-C.js","./bg-BG-O6MV2KSF-Cd3kEZI-.js","./bn-BD-T2VJNT7N-BFCx9nbZ.js","./bn-IN-MMW2ORAC-Dn9W9dUT.js","./ca-ES-MKBCGNOG-D_BNlrmg.js","./cs-CZ-V77HGUP7-gpioT6mv.js","./da-DK-I5RFNTM4-CVv-_qu9.js","./de-CH-WLRDEVBV-CL0gsFEp.js","./de-DE-DTI4WUSC-BQO1SHIK.js","./el-GR-ZXDJ2OS4-DGa9DqWI.js","./en-CTDJDZ6K-DC-4I8h8.js","./chunk-ETSVUAFD-C8C1JDu2.js","./es-ES-DYQHAD43-Cox3GUnj.js","./eu-ES-QDSYU5Y3-DrPM2uSX.js","./fa-IR-26LZG4PM-ViTdxAWX.js","./fi-FI-6YS4KDE4-BTBRGd69.js","./fr-FR-BRLLPTZC-z-POHcHJ.js","./gl-ES-OKUZTLYG-BQtfDFNk.js","./he-IL-26MGYIU7-Dyw-xS4W.js","./hi-IN-Q4ZOGTP2-BqENUkZA.js","./hu-HU-P2OXPSN5-D1HGK0_M.js","./id-ID-2EIKXYN6-BEjyfllL.js","./it-IT-4CFKVXI2-C24G-VcQ.js","./ja-JP-MAND2Z4V-DLhvsdYk.js","./kaa-HQRTCXTJ-DC8l3BuJ.js","./kab-KAB-JKIKKTGH-DVFog4hd.js","./kk-KZ-HXQ63ZFC-CULUfwMg.js","./km-KH-PKL3LSGX-CnLlEv7i.js","./ko-KR-KXLREZX3-DNKXAYCx.js","./ku-TR-MJ4IER3X-DLUiMa4h.js","./lt-LT-H6WFQ6FJ-CoFiurzb.js","./lv-LV-GOCK6SJW-DzeEvHxX.js","./mr-IN-IXVLDMEQ-C5i5R9H5.js","./my-MM-YG6MYTTD-DvwceqO-.js","./nb-NO-XGWJISD2-BUhX8hX0.js","./nl-NL-XVDVCPNC-BV6Y0-Q0.js","./nn-NO-EMX5MJX5-CF_bB9Jq.js","./oc-FR-ROEINTVO-CiNI8fg8.js","./pa-IN-ZYN6SUDY-CsbIU150.js","./percentages-5DKR754L-Dp1vwDEq.js","./chunk-3PELD44J-D4qJ8fq7.js","./pl-PL-6VTG7PHC-D1Nnx7R3.js","./pt-BR-5YFKRR5G-DEDTeWEP.js","./pt-PT-GEIXXZ67-BpqPVZom.js","./ro-RO-E2P6TFZI-4vRM1jVT.js","./ru-RU-YBIIY43T-Cfbhz4Ew.js","./si-LK-673C2CI2-0muNkOEn.js","./sk-SK-CKZHQ4AP-EnLgxyJL.js","./sl-SI-557H2GWM-BN6npqVj.js","./sv-SE-XOPKKDWS-D3VSs2SQ.js","./ta-IN-XBH7DQI3-BKR1mqfo.js","./th-TH-TOCWH3R4-Bek1dQcW.js","./tr-TR-GXW6CYY5-xdLb7Dgi.js","./uk-UA-IJKTNUDG-Cd0AhTti.js","./uz-UZ-TBZZEA4V-DQH4e-QC.js","./vi-VN-MULSGNVB-BYDcPrAo.js","./zh-CN-MVX3E32U-BqZQ-18-.js","./zh-HK-JNU5RLIE-CbF8Agwa.js","./zh-TW-LENVCA6T-CepoVycx.js","./image-32MOCVDX-BBXPyAeU.js","./chunk-27N2SPOM-CyIruM79.js","./preload-helper-I1wKxk_B.js","./chunk-A66AFZZU-CJuwmF1m.js","./CodeMirrorEditor-UCMRAMCV-C5yVpm45.js","./dist-a6bFAbQd.js","./dist-yRVuIDKu.js","./jsx-runtime-DJkgQklN.js","./excalidraw-mermaid-stub-LpuTrLnr.js","./excalidraw-mermaid-stub-BJq3n7pR.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e,t}from"./chunk-D-fkvfCP.js";import{t as n}from"./preload-helper-I1wKxk_B.js";import{t as r}from"./chunk-A66AFZZU-CJuwmF1m.js";import{i,n as a,r as o}from"./chunk-SRAX5OIU-CtUYAya6.js";import{n as s,t as c}from"./jsx-runtime-DJkgQklN.js";import{$ as l,$a as u,$i as d,$n as f,$o as p,$r as m,$s as h,$t as g,A as _,Aa as v,Ac as y,Ai as b,An as x,Ao as S,Ar as C,As as w,At as T,B as E,Ba as D,Bc as O,Bi as k,Bn as A,Br as ee,Bs as te,Bt as ne,C as j,Ca as re,Cc as ie,Ci as ae,Cn as oe,Co as se,Cr as ce,Cs as le,Ct as ue,D as de,Da as fe,Dc as pe,Di as me,Dn as he,Do as ge,Dr as _e,Ds as ve,Dt as ye,E as be,Ea as xe,Ec as Se,Ei as Ce,En as M,Eo as N,Er as we,Es as Te,Et as Ee,F as De,Fa as Oe,Fc as ke,Fi as Ae,Fn as je,Fo as Me,Fr as Ne,Fs as Pe,Ft as Fe,G as Ie,Ga as Le,Gi as Re,Gn as ze,Go as Be,Gr as Ve,Gs as He,Gt as Ue,H as We,Ha as Ge,Hc as Ke,Hi as qe,Hn as Je,Ho as Ye,Hr as Xe,Hs as Ze,Ht as Qe,I as $e,Ia as et,Ic as tt,Ii as nt,In as rt,Io as it,Ir as at,Is as ot,It as st,J as ct,Ja as lt,Ji as P,Jn as ut,Jo as dt,Jr as ft,Js as pt,Jt as mt,K as ht,Ka as gt,Ki as _t,Kn as vt,Ko as yt,Kr as bt,Ks as xt,Kt as St,L as Ct,La as wt,Lc as Tt,Li as Et,Ln as Dt,Lo as Ot,Lr as kt,Ls as At,Lt as jt,M as Mt,Ma as Nt,Mc as Pt,Mn as Ft,Mo as It,Mr as Lt,Ms as Rt,Mt as zt,N as Bt,Na as Vt,Nc as Ht,Ni as Ut,Nn as Wt,No as Gt,Nr as Kt,Ns as qt,Nt as Jt,O as Yt,Oa as Xt,Oc as Zt,Oi as Qt,On as $t,Or as en,Os as tn,Ot as nn,P as rn,Pa as an,Pc as on,Pi as sn,Pn as cn,Po as ln,Pr as un,Ps as dn,Pt as fn,Q as pn,Qa as mn,Qi as hn,Qn as gn,Qo as _n,Qr as vn,Qs as yn,Qt as bn,R as xn,Ra as Sn,Rc as Cn,Ri as wn,Rn as Tn,Ro as En,Rr as Dn,Rs as On,Rt as kn,S as An,Sa as jn,Sc as Mn,Si as Nn,Sn as Pn,So as Fn,Sr as In,Ss as Ln,St as Rn,T as zn,Ta as Bn,Tc as Vn,Ti as Hn,Tn as Un,To as Wn,Tr as Gn,Ts as Kn,Tt as qn,U as Jn,Ua as F,Ui as Yn,Un as Xn,Ur as Zn,Us as Qn,Ut as $n,V as er,Va as tr,Vc as nr,Vi as rr,Vn as ir,Vo as ar,Vr as or,Vs as sr,Vt as cr,Wa as lr,Wi as ur,Wn as dr,Wo as fr,Wr as pr,Ws as mr,Wt as hr,X as gr,Xa as _r,Xi as vr,Xn as yr,Xo as br,Xr as xr,Xs as Sr,Xt as Cr,Y as wr,Ya as Tr,Yi as Er,Yn as Dr,Yo as Or,Yr as kr,Ys as Ar,Yt as jr,Za as Mr,Zi as Nr,Zn as Pr,Zo as Fr,Zr as Ir,Zs as Lr,Zt as Rr,_ as zr,_a as Br,_c as Vr,_i as Hr,_n as Ur,_o as Wr,_r as Gr,_s as Kr,_t as I,aa as qr,ac as Jr,ai as Yr,an as Xr,ao as Zr,ar as Qr,as as $r,at as ei,b as ti,ba as ni,bc as ri,bi as ii,bn as ai,bo as oi,br as si,bt as ci,c as li,ca as ui,cc as di,ci as fi,cn as pi,co as mi,cr as L,cs as hi,ct as gi,d as _i,da as vi,dc as yi,di as bi,dn as xi,dr as Si,ds as Ci,dt as wi,ea as Ti,ec as Ei,ei as Di,en as Oi,eo as ki,er as Ai,es as ji,et as Mi,f as Ni,fa as Pi,fc as Fi,fi as Ii,fn as Li,fo as Ri,fr as zi,fs as Bi,ft as Vi,g as Hi,ga as Ui,gc as Wi,gi as Gi,gn as Ki,go as qi,gr as Ji,gs as R,gt as Yi,h as Xi,ha as Zi,hc as Qi,hi as $i,hn as ea,ho as ta,hr as na,ht as ra,i as ia,ia as aa,ic as oa,ii as sa,in as ca,io as la,ir as ua,is as da,it as fa,j as pa,ja as ma,jc as ha,ji as ga,jn as _a,jo as va,jr as ya,js as ba,jt as xa,k as Sa,ka as Ca,kc as wa,ki as Ta,kn as Ea,ko as Da,kr as Oa,ks as ka,kt as Aa,l as ja,la as Ma,lc as Na,li as Pa,ln as Fa,lo as Ia,lr as La,ls as Ra,lt as za,m as Ba,ma as Va,mi as Ha,mn as Ua,mo as Wa,mr as Ga,ms as Ka,mt as qa,n as Ja,na as Ya,nc as Xa,ni as Za,nn as Qa,no as $a,nr as eo,ns as to,nt as no,o as ro,oa as io,oc as ao,oi as oo,on as so,oo as co,or as lo,os as uo,ot as fo,p as z,pa as po,pc as mo,pi as ho,pn as go,po as _o,pr as vo,ps as yo,pt as bo,q as xo,qa as So,qi as Co,qn as wo,qr as To,qs as Eo,qt as Do,r as Oo,ra as ko,rc as Ao,ri as jo,rn as B,ro as Mo,rr as No,rs as Po,rt as Fo,s as Io,sa as Lo,sc as Ro,si as zo,sn as Bo,so as Vo,sr as V,ss as Ho,st as Uo,t as Wo,ta as Go,tc as Ko,ti as qo,tn as Jo,to as Yo,tr as Xo,ts as Zo,tt as Qo,u as $o,ua as es,uc as ts,ui as ns,un as rs,uo as is,ur as as,us as os,ut as ss,v as cs,va as ls,vc as us,vi as ds,vn as fs,vo as ps,vr as ms,vs as hs,vt as gs,w as _s,wa as vs,wc as ys,wi as bs,wn as xs,wo as Ss,wr as Cs,ws,wt as Ts,x as Es,xa as Ds,xc as Os,xi as ks,xn as As,xo as js,xr as Ms,xs as Ns,xt as Ps,y as Fs,ya as Is,yc as Ls,yi as Rs,yn as zs,yo as Bs,yr as Vs,ys as Hs,yt as Us,z as Ws,za as Gs,zc as Ks,zi as qs,zn as Js,zo as Ys,zr as Xs,zs as Zs,zt as Qs}from"./chunk-27N2SPOM-CyIruM79.js";import{_ as $s}from"./chunk-ETSVUAFD-C8C1JDu2.js";import{r as ec}from"./chunk-3PELD44J-D4qJ8fq7.js";import{O as tc,n as nc,o as rc,r as ic,t as ac}from"./yjs-provider-reset-guard-Cj00kgyM.js";import{n as oc,t as sc}from"./vault-api-client-fFJfUVXM.js";import{n as cc}from"./excalidraw-mermaid-stub-BJq3n7pR.js";var lc=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),uc=t(((e,t)=>{t.exports=lc()})),dc=t((e=>{var t=s();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.0`})),fc=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=dc()})),pc=t((e=>{var t=uc(),n=s(),r=fc();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ne=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function le(e,t){oe++,ae[oe]=e.current,e.current=t}var ue=se(null),de=se(null),fe=se(null),pe=se(null);function me(e,t){switch(le(fe,t),le(de,e),le(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(ue),le(ue,e)}function he(){ce(ue),ce(de),ce(fe)}function ge(e){e.memoizedState!==null&&le(pe,e);var t=ue.current,n=Xd(t,e.type);t!==n&&(le(de,e),le(ue,n))}function _e(e){de.current===e&&(ce(ue),ce(de)),pe.current===e&&(ce(pe),op._currentValue=ie)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ve+e+ye}var xe=!1;function Se(e,t){if(!e||xe)return``;xe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -47,8 +47,8 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},$u=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ed=function(){H.useEffect(function(){return document.body.setAttribute(Zu,($u()+1).toString()),function(){var e=$u()-1;e<=0?document.body.removeAttribute(Zu):document.body.setAttribute(Zu,e.toString())}},[])},td=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ed();var a=H.useMemo(function(){return Yu(i)},[i]);return H.createElement(Xu,{styles:Qu(a,!t,i,n?``:`!important`)})},nd=!1;if(typeof window<`u`)try{var rd=Object.defineProperty({},`passive`,{get:function(){return nd=!0,!0}});window.addEventListener(`test`,rd,rd),window.removeEventListener(`test`,rd,rd)}catch{nd=!1}var id=nd?{passive:!1}:!1,ad=function(e){return e.tagName===`TEXTAREA`},od=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ad(e)&&n[t]===`visible`)},sd=function(e){return od(e,`overflowY`)},cd=function(e){return od(e,`overflowX`)},ld=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),fd(e,r)){var i=pd(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ud=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},dd=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},fd=function(e,t){return e===`v`?sd(t):cd(t)},pd=function(e,t){return e===`v`?ud(t):dd(t)},md=function(e,t){return e===`h`&&t===`rtl`?-1:1},hd=function(e,t,n,r,i){var a=md(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=pd(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&fd(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},gd=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},_d=function(e){return[e.deltaX,e.deltaY]},vd=function(e){return e&&`current`in e?e.current:e},yd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bd=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},xd=0,Sd=[];function Cd(e){var t=H.useRef([]),n=H.useRef([0,0]),r=H.useRef(),i=H.useState(xd++)[0],a=H.useState(Gu)[0],o=H.useRef(e);H.useEffect(function(){o.current=e},[e]),H.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=bu([e.lockRef.current],(e.shards||[]).map(vd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=H.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=gd(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ld(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ld(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return hd(h,t,e,h===`h`?s:c,!0)},[]),c=H.useCallback(function(e){var n=e;if(!(!Sd.length||Sd[Sd.length-1]!==a)){var r=`deltaY`in n?_d(n):gd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&yd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(vd).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=H.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:wd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=H.useCallback(function(e){n.current=gd(e),r.current=void 0},[]),d=H.useCallback(function(t){l(t.type,_d(t),t.target,s(t,e.lockRef.current))},[]),f=H.useCallback(function(t){l(t.type,gd(t),t.target,s(t,e.lockRef.current))},[]);H.useEffect(function(){return Sd.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,id),document.addEventListener(`touchmove`,c,id),document.addEventListener(`touchstart`,u,id),function(){Sd=Sd.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,id),document.removeEventListener(`touchmove`,c,id),document.removeEventListener(`touchstart`,u,id)}},[]);var p=e.removeScrollBar,m=e.inert;return H.createElement(H.Fragment,null,m?H.createElement(a,{styles:bd(i)}):null,p?H.createElement(td,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Td=Pu(Fu,Cd),Ed=H.forwardRef(function(e,t){return H.createElement(Lu,vu({},e,{ref:t,sideCar:Td}))});Ed.classNames=Lu.classNames;var Dd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Od=new WeakMap,kd=new WeakMap,Ad={},jd=0,Md=function(e){return e&&(e.host||Md(e.parentNode))},Nd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Md(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pd=function(e,t,n,r){var i=Nd(t,Array.isArray(e)?e:[e]);Ad[n]||(Ad[n]=new WeakMap);var a=Ad[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Od.get(e)||0)+1,l=(a.get(e)||0)+1;Od.set(e,c),a.set(e,l),o.push(e),c===1&&i&&kd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),jd++,function(){o.forEach(function(e){var t=Od.get(e)-1,i=a.get(e)-1;Od.set(e,t),a.set(e,i),t||(kd.has(e)||e.removeAttribute(r),kd.delete(e)),i||e.removeAttribute(n)}),jd--,jd||(Od=new WeakMap,Od=new WeakMap,kd=new WeakMap,Ad={})}},Fd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Dd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pd(r,i,n,`aria-hidden`)):function(){return null}},Id=t((e=>{var t=s();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),s=r[0].inst,l=r[1];return o(function(){s.value=n,s.getSnapshot=t,u(s)&&l({inst:s})},[e,n,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ld=t(((e,t)=>{t.exports=Id()}));function Rd(e){let[t,n]=H.useState(void 0);return xl(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var zd=[`top`,`right`,`bottom`,`left`],Bd=Math.min,Vd=Math.max,Hd=Math.round,Ud=Math.floor,Wd=e=>({x:e,y:e}),Gd={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Kd(e,t,n){return Vd(e,Bd(t,n))}function qd(e,t){return typeof e==`function`?e(t):e}function Jd(e){return e.split(`-`)[0]}function Yd(e){return e.split(`-`)[1]}function Xd(e){return e===`x`?`y`:`x`}function Zd(e){return e===`y`?`height`:`width`}function Qd(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $d(e){return Xd(Qd(e))}function ef(e,t,n){n===void 0&&(n=!1);let r=Yd(e),i=$d(e),a=Zd(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=uf(o)),[o,uf(o)]}function tf(e){let t=uf(e);return[nf(e),t,nf(t)]}function nf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rf=[`left`,`right`],af=[`right`,`left`],of=[`top`,`bottom`],sf=[`bottom`,`top`];function cf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?af:rf:t?rf:af;case`left`:case`right`:return t?of:sf;default:return[]}}function lf(e,t,n,r){let i=Yd(e),a=cf(Jd(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nf)))),a}function uf(e){let t=Jd(e);return Gd[t]+e.slice(t.length)}function df(e){return{top:0,right:0,bottom:0,left:0,...e}}function ff(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:df(e)}function pf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function mf(e,t,n){let{reference:r,floating:i}=e,a=Qd(t),o=$d(t),s=Zd(o),c=Jd(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Yd(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function hf(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=qd(t,e),p=ff(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=pf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=pf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var gf=50,_f=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:hf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=mf(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<gf&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=mf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},vf=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=qd(e,t)||{};if(l==null)return{};let d=ff(u),f={x:n,y:r},p=$d(i),m=Zd(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Bd(d[_],T),D=Bd(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,ee=Kd(O,A,k),te=!c.arrow&&Yd(i)!=null&&A!==ee&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,ne=te?A<O?A-O:A-k:0;return{[p]:f[p]+ne,data:{[p]:ee,centerOffset:A-ee-ne,...te&&{alignmentOffset:ne}},reset:te}}}),yf=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=qd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Jd(r),_=Qd(o),v=Jd(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[uf(o)]:tf(o)),x=p!==`none`;!d&&x&&b.push(...lf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ef(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Qd(t))||T.every(e=>Qd(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Qd(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function bf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xf(e){return zd.some(t=>e[t]>=0)}var Sf=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=qd(e,t);switch(i){case`referenceHidden`:{let e=bf(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xf(e)}}}case`escaped`:{let e=bf(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:xf(e)}}}default:return{}}}}},Cf=new Set([`left`,`top`]);async function wf(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Jd(n),s=Yd(n),c=Qd(n)===`y`,l=Cf.has(o)?-1:1,u=a&&c?-1:1,d=qd(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Tf=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await wf(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ef=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=qd(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qd(Jd(i)),p=Xd(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Kd(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Kd(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Df=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=qd(e,t),u={x:n,y:r},d=Qd(i),f=Xd(d),p=u[f],m=u[d],h=qd(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Cf.has(Jd(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Of=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=qd(e,t),u=await o.detectOverflow(t,l),d=Jd(i),f=Yd(i),p=Qd(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Bd(h-u[g],v),x=Bd(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Vd(u.left,0),t=Vd(u.right,0),n=Vd(u.top,0),r=Vd(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Vd(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Vd(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function kf(){return typeof window<`u`}function Af(e){return Nf(e)?(e.nodeName||``).toLowerCase():`#document`}function jf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mf(e){return((Nf(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Nf(e){return kf()?e instanceof Node||e instanceof jf(e).Node:!1}function Pf(e){return kf()?e instanceof Element||e instanceof jf(e).Element:!1}function Ff(e){return kf()?e instanceof HTMLElement||e instanceof jf(e).HTMLElement:!1}function If(e){return!kf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof jf(e).ShadowRoot}function Lf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Jf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Rf(e){return/^(table|td|th)$/.test(Af(e))}function zf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Bf=/transform|translate|scale|rotate|perspective|filter/,Vf=/paint|layout|strict|content/,Hf=e=>!!e&&e!==`none`,Uf;function Wf(e){let t=Pf(e)?Jf(e):e;return Hf(t.transform)||Hf(t.translate)||Hf(t.scale)||Hf(t.rotate)||Hf(t.perspective)||!Kf()&&(Hf(t.backdropFilter)||Hf(t.filter))||Bf.test(t.willChange||``)||Vf.test(t.contain||``)}function Gf(e){let t=Xf(e);for(;Ff(t)&&!qf(t);){if(Wf(t))return t;if(zf(t))return null;t=Xf(t)}return null}function Kf(){return Uf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Uf}function qf(e){return/^(html|body|#document)$/.test(Af(e))}function Jf(e){return jf(e).getComputedStyle(e)}function Yf(e){return Pf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xf(e){if(Af(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||If(e)&&e.host||Mf(e);return If(t)?t.host:t}function Zf(e){let t=Xf(e);return qf(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ff(t)&&Lf(t)?t:Zf(t)}function Qf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Zf(e),i=r===e.ownerDocument?.body,a=jf(r);if(i){let e=$f(a);return t.concat(a,a.visualViewport||[],Lf(r)?r:[],e&&n?Qf(e):[])}else return t.concat(r,Qf(r,[],n))}function $f(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ep(e){let t=Jf(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ff(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Hd(n)!==a||Hd(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tp(e){return Pf(e)?e:e.contextElement}function np(e){let t=tp(e);if(!Ff(t))return Wd(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ep(t),o=(a?Hd(n.width):n.width)/r,s=(a?Hd(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rp=Wd(0);function ip(e){let t=jf(e);return!Kf()||!t.visualViewport?rp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ap(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jf(e)?!1:t}function op(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tp(e),o=Wd(1);t&&(r?Pf(r)&&(o=np(r)):o=np(e));let s=ap(a,n,r)?ip(a):Wd(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=jf(a),t=r&&Pf(r)?jf(r):r,n=e,i=$f(n);for(;i&&r&&t!==n;){let e=np(i),t=i.getBoundingClientRect(),r=Jf(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=jf(i),i=$f(n)}}return pf({width:u,height:d,x:c,y:l})}function sp(e,t){let n=Yf(e).scrollLeft;return t?t.left+n:op(Mf(e)).left+n}function cp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-sp(e,n),y:n.top+t.scrollTop}}function lp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Mf(r),s=t?zf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Wd(1),u=Wd(0),d=Ff(r);if((d||!d&&!a)&&((Af(r)!==`body`||Lf(o))&&(c=Yf(r)),d)){let e=op(r);l=np(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?cp(o,c):Wd(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function up(e){return Array.from(e.getClientRects())}function dp(e){let t=Mf(e),n=Yf(e),r=e.ownerDocument.body,i=Vd(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Vd(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+sp(e),s=-n.scrollTop;return Jf(r).direction===`rtl`&&(o+=Vd(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var fp=25;function pp(e,t){let n=jf(e),r=Mf(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Kf();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=sp(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=fp&&(a-=o)}else l<=fp&&(a+=l);return{width:a,height:o,x:s,y:c}}function mp(e,t){let n=op(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ff(e)?np(e):Wd(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function hp(e,t,n){let r;if(t===`viewport`)r=pp(e,n);else if(t===`document`)r=dp(Mf(e));else if(Pf(t))r=mp(t,n);else{let n=ip(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pf(r)}function gp(e,t){let n=Xf(e);return n===t||!Pf(n)||qf(n)?!1:Jf(n).position===`fixed`||gp(n,t)}function _p(e,t){let n=t.get(e);if(n)return n;let r=Qf(e,[],!1).filter(e=>Pf(e)&&Af(e)!==`body`),i=null,a=Jf(e).position===`fixed`,o=a?Xf(e):e;for(;Pf(o)&&!qf(o);){let t=Jf(o),n=Wf(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Lf(o)&&!n&&gp(e,o))?r=r.filter(e=>e!==o):i=t,o=Xf(o)}return t.set(e,r),r}function vp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?zf(t)?[]:_p(t,this._c):[].concat(n),r],o=hp(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=hp(t,a[e],i);s=Vd(n.top,s),c=Bd(n.right,c),l=Bd(n.bottom,l),u=Vd(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function yp(e){let{width:t,height:n}=ep(e);return{width:t,height:n}}function bp(e,t,n){let r=Ff(t),i=Mf(t),a=n===`fixed`,o=op(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Wd(0);function l(){c.x=sp(i)}if(r||!r&&!a)if((Af(t)!==`body`||Lf(i))&&(s=Yf(t)),r){let e=op(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?cp(i,s):Wd(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function xp(e){return Jf(e).position===`static`}function Sp(e,t){if(!Ff(e)||Jf(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Mf(e)===n&&(n=n.ownerDocument.body),n}function Cp(e,t){let n=jf(e);if(zf(e))return n;if(!Ff(e)){let t=Xf(e);for(;t&&!qf(t);){if(Pf(t)&&!xp(t))return t;t=Xf(t)}return n}let r=Sp(e,t);for(;r&&Rf(r)&&xp(r);)r=Sp(r,t);return r&&qf(r)&&xp(r)&&!Wf(r)?n:r||Gf(e)||n}var wp=async function(e){let t=this.getOffsetParent||Cp,n=this.getDimensions,r=await n(e.floating);return{reference:bp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tp(e){return Jf(e).direction===`rtl`}var Ep={convertOffsetParentRelativeRectToViewportRelativeRect:lp,getDocumentElement:Mf,getClippingRect:vp,getOffsetParent:Cp,getElementRects:wp,getClientRects:up,getDimensions:yp,getScale:np,isElement:Pf,isRTL:Tp};function Dp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Op(e,t){let n=null,r,i=Mf(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ud(d),h=Ud(i.clientWidth-(u+f)),g=Ud(i.clientHeight-(d+p)),_=Ud(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Vd(0,Bd(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Dp(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function kp(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tp(e),u=i||a?[...l?Qf(l):[],...t?Qf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Op(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?op(e):null;c&&g();function g(){let t=op(e);h&&!Dp(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ap=Tf,jp=Ef,Mp=yf,Np=Of,Pp=Sf,Fp=vf,Ip=Df,Lp=(e,t,n)=>{let r=new Map,i={platform:Ep,...n},a={...i.platform,_c:r};return _f(e,t,{...i,platform:a})},Rp=typeof document<`u`?H.useLayoutEffect:function(){};function zp(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,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!zp(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Bp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vp(e,t){let n=Bp(e);return Math.round(t*n)/n}function Hp(e){let t=H.useRef(e);return Rp(()=>{t.current=e}),t}function Up(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=H.useState(r);zp(f,r)||p(r);let[m,h]=H.useState(null),[g,_]=H.useState(null),v=H.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=H.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=H.useRef(null),C=H.useRef(null),w=H.useRef(u),T=c!=null,E=Hp(c),D=Hp(i),O=Hp(l),k=H.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Lp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!zp(w.current,t)&&(w.current=t,_c.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Rp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=H.useRef(!1);Rp(()=>(A.current=!0,()=>{A.current=!1}),[]),Rp(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let ee=H.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),te=H.useMemo(()=>({reference:b,floating:x}),[b,x]),ne=H.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Vp(te.floating,u.x),r=Vp(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Bp(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:k,refs:ee,elements:te,floatingStyles:ne}),[u,k,ee,te,ne])}var Wp=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fp({element:r.current,padding:i}).fn(n):r?Fp({element:r,padding:i}).fn(n):{}}}},Gp=(e,t)=>{let n=Ap(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kp=(e,t)=>{let n=jp(e);return{name:n.name,fn:n.fn,options:[e,t]}},qp=(e,t)=>({fn:Ip(e).fn,options:[e,t]}),Jp=(e,t)=>{let n=Mp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yp=(e,t)=>{let n=Np(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xp=(e,t)=>{let n=Pp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zp=(e,t)=>{let n=Wp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qp=`Arrow`,$p=H.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,W.jsx)(gl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,W.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});$p.displayName=Qp;var em=$p,tm=`Popper`,[nm,rm]=vl(tm),[im,am]=nm(tm),om=e=>{let{__scopePopper:t,children:n}=e,[r,i]=H.useState(null);return(0,W.jsx)(im,{scope:t,anchor:r,onAnchorChange:i,children:n})};om.displayName=tm;var sm=`PopperAnchor`,cm=H.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=am(sm,n),o=H.useRef(null),s=ll(t,o),c=H.useRef(null);return H.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,W.jsx)(gl.div,{...i,ref:s})});cm.displayName=sm;var lm=`PopperContent`,[um,dm]=nm(lm),fm=H.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=am(lm,n),[_,v]=H.useState(null),y=ll(t,e=>v(e)),[b,x]=H.useState(null),S=Rd(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(gm),altBoundary:O},{refs:A,floatingStyles:ee,placement:te,isPositioned:ne,middlewareData:j}=Up({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>kp(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Gp({mainAxis:i+w,alignmentAxis:o}),c&&Kp({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?qp():void 0,...k}),c&&Jp({...k}),Yp({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Zp({element:b,padding:s}),_m({arrowWidth:C,arrowHeight:w}),f&&Xp({strategy:`referenceHidden`,...k})]}),[re,ie]=vm(te),ae=Il(m);xl(()=>{ne&&ae?.()},[ne,ae]);let oe=j.arrow?.x,se=j.arrow?.y,ce=j.arrow?.centerOffset!==0,[le,ue]=H.useState();return xl(()=>{_&&ue(window.getComputedStyle(_).zIndex)},[_]),(0,W.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:ne?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[j.transformOrigin?.x,j.transformOrigin?.y].join(` `),...j.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,W.jsx)(um,{scope:n,placedSide:re,onArrowChange:x,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,W.jsx)(gl.div,{"data-side":re,"data-align":ie,...h,ref:y,style:{...h.style,animation:ne?void 0:`none`}})})})});fm.displayName=lm;var pm=`PopperArrow`,mm={top:`bottom`,right:`left`,bottom:`top`,left:`right`},hm=H.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=dm(pm,n),a=mm[i.placedSide];return(0,W.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,W.jsx)(em,{...r,ref:t,style:{...r.style,display:`block`}})})});hm.displayName=pm;function gm(e){return e!==null}var _m=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=vm(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function vm(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ym=om,bm=cm,xm=fm,Sm=hm,Cm=`rovingFocusGroup.onEntryFocus`,wm={bubbles:!1,cancelable:!0},Tm=`RovingFocusGroup`,[Em,Dm,Om]=bl(Tm),[km,Am]=vl(Tm,[Om]),[jm,Mm]=km(Tm),Nm=H.forwardRef((e,t)=>(0,W.jsx)(Em.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(Em.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(Pm,{...e,ref:t})})}));Nm.displayName=Tm;var Pm=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=H.useRef(null),p=ll(t,f),m=Fl(a),[h,g]=Cl({prop:o,defaultProp:s??null,onChange:c,caller:Tm}),[_,v]=H.useState(!1),y=Il(l),b=Dm(n),x=H.useRef(!1),[S,C]=H.useState(0);return H.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Cm,y),()=>e.removeEventListener(Cm,y)},[y]),(0,W.jsx)(jm,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:H.useCallback(e=>g(e),[g]),onItemShiftTab:H.useCallback(()=>v(!0),[]),onFocusableItemAdd:H.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:H.useCallback(()=>C(e=>e-1),[]),children:(0,W.jsx)(gl.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:G(e.onMouseDown,()=>{x.current=!0}),onFocus:G(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Cm,wm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Bm([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:G(e.onBlur,()=>v(!1))})})}),Fm=`RovingFocusGroupItem`,Im=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Nl(),l=a||c,u=Mm(Fm,n),d=u.currentTabStopId===l,f=Dm(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return H.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,W.jsx)(Em.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,W.jsx)(gl.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:G(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:G(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:G(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=zm(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Vm(n,r+1):n.slice(r+1)}setTimeout(()=>Bm(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Im.displayName=Fm;var Lm={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Rm(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function zm(e,t,n){let r=Rm(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Lm[r]}function Bm(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Vm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hm=Nm,Um=Im,Wm=[`Enter`,` `],Gm=[`ArrowDown`,`PageUp`,`Home`],Km=[`ArrowUp`,`PageDown`,`End`],qm=[...Gm,...Km],Jm={ltr:[...Wm,`ArrowRight`],rtl:[...Wm,`ArrowLeft`]},Ym={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xm=`Menu`,[Zm,Qm,$m]=bl(Xm),[eh,th]=vl(Xm,[$m,rm,Am]),nh=rm(),rh=Am(),[ih,ah]=eh(Xm),[oh,sh]=eh(Xm),ch=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=nh(t),[c,l]=H.useState(null),u=H.useRef(!1),d=Il(a),f=Fl(i);return H.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,W.jsx)(ym,{...s,children:(0,W.jsx)(ih,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,W.jsx)(oh,{scope:t,onClose:H.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};ch.displayName=Xm;var lh=`MenuAnchor`,uh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nh(n);return(0,W.jsx)(bm,{...i,...r,ref:t})});uh.displayName=lh;var dh=`MenuPortal`,[fh,ph]=eh(dh,{forceMount:void 0}),mh=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ah(dh,t);return(0,W.jsx)(fh,{scope:t,forceMount:n,children:(0,W.jsx)(Dl,{present:n||a.open,children:(0,W.jsx)(mu,{asChild:!0,container:i,children:r})})})};mh.displayName=dh;var hh=`MenuContent`,[gh,_h]=eh(hh),vh=H.forwardRef((e,t)=>{let n=ph(hh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ah(hh,e.__scopeMenu),o=sh(hh,e.__scopeMenu);return(0,W.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Dl,{present:r||a.open,children:(0,W.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:o.modal?(0,W.jsx)(yh,{...i,ref:t}):(0,W.jsx)(bh,{...i,ref:t})})})})}),yh=H.forwardRef((e,t)=>{let n=ah(hh,e.__scopeMenu),r=H.useRef(null),i=ll(t,r);return H.useEffect(()=>{let e=r.current;if(e)return Fd(e)},[]),(0,W.jsx)(Sh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bh=H.forwardRef((e,t)=>{let n=ah(hh,e.__scopeMenu);return(0,W.jsx)(Sh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xh=ul(`MenuContent.ScrollLock`),Sh=H.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=ah(hh,n),_=sh(hh,n),v=nh(n),y=rh(n),b=Qm(n),[x,S]=H.useState(null),C=H.useRef(null),w=ll(t,C,g.onContentChange),T=H.useRef(0),E=H.useRef(``),D=H.useRef(0),O=H.useRef(null),k=H.useRef(`right`),A=H.useRef(0),ee=m?Ed:H.Fragment,te=m?{as:xh,allowPinchZoom:!0}:void 0,ne=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=og(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};H.useEffect(()=>()=>window.clearTimeout(T.current),[]),gu();let j=H.useCallback(e=>k.current===O.current?.side&&cg(e,O.current?.area),[]);return(0,W.jsx)(gh,{scope:n,searchRef:E,onItemEnter:H.useCallback(e=>{j(e)&&e.preventDefault()},[j]),onItemLeave:H.useCallback(e=>{j(e)||(C.current?.focus(),S(null))},[j]),onTriggerLeave:H.useCallback(e=>{j(e)&&e.preventDefault()},[j]),pointerGraceTimerRef:D,onPointerGraceIntentChange:H.useCallback(e=>{O.current=e},[]),children:(0,W.jsx)(ee,{...te,children:(0,W.jsx)(tu,{asChild:!0,trapped:i,onMountAutoFocus:G(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,W.jsx)(Wl,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,W.jsx)(Hm,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:G(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,W.jsx)(xm,{role:`menu`,"aria-orientation":`vertical`,"data-state":tg(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:G(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=C.current;if(e.target!==i||!qm.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Km.includes(e.key)&&a.reverse(),ig(a)}),onBlur:G(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:G(e.onPointerMove,lg(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});vh.displayName=hh;var Ch=`MenuGroup`,wh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{role:`group`,...r,ref:t})});wh.displayName=Ch;var Th=`MenuLabel`,Eh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{...r,ref:t})});Eh.displayName=Th;var Dh=`MenuItem`,Oh=`menu.itemSelect`,kh=H.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=H.useRef(null),o=sh(Dh,e.__scopeMenu),s=_h(Dh,e.__scopeMenu),c=ll(t,a),l=H.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Oh,{bubbles:!0,cancelable:!0});e.addEventListener(Oh,e=>r?.(e),{once:!0}),_l(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,W.jsx)(Ah,{...i,ref:c,disabled:n,onClick:G(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:G(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:G(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Wm.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kh.displayName=Dh;var Ah=H.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=_h(Dh,n),s=rh(n),c=H.useRef(null),l=ll(t,c),[u,d]=H.useState(!1),[f,p]=H.useState(``);return H.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,W.jsx)(Zm.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,W.jsx)(Um,{asChild:!0,...s,focusable:!r,children:(0,W.jsx)(gl.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:G(e.onPointerMove,lg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,lg(e=>o.onItemLeave(e))),onFocus:G(e.onFocus,()=>d(!0)),onBlur:G(e.onBlur,()=>d(!1))})})})}),jh=`MenuCheckboxItem`,Mh=H.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,W.jsx)(Bh,{scope:e.__scopeMenu,checked:n,children:(0,W.jsx)(kh,{role:`menuitemcheckbox`,"aria-checked":ng(n)?`mixed`:n,...i,ref:t,"data-state":rg(n),onSelect:G(i.onSelect,()=>r?.(ng(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mh.displayName=jh;var Nh=`MenuRadioGroup`,[Ph,Fh]=eh(Nh,{value:void 0,onValueChange:()=>{}}),Ih=H.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Il(r);return(0,W.jsx)(Ph,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,W.jsx)(wh,{...i,ref:t})})});Ih.displayName=Nh;var Lh=`MenuRadioItem`,Rh=H.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fh(Lh,e.__scopeMenu),a=n===i.value;return(0,W.jsx)(Bh,{scope:e.__scopeMenu,checked:a,children:(0,W.jsx)(kh,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":rg(a),onSelect:G(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rh.displayName=Lh;var zh=`MenuItemIndicator`,[Bh,Vh]=eh(zh,{checked:!1}),Hh=H.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vh(zh,n);return(0,W.jsx)(Dl,{present:r||ng(a.checked)||a.checked===!0,children:(0,W.jsx)(gl.span,{...i,ref:t,"data-state":rg(a.checked)})})});Hh.displayName=zh;var Uh=`MenuSeparator`,Wh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wh.displayName=Uh;var Gh=`MenuArrow`,Kh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nh(n);return(0,W.jsx)(Sm,{...i,...r,ref:t})});Kh.displayName=Gh;var qh=`MenuSub`,[Jh,Yh]=eh(qh),Xh=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ah(qh,t),o=nh(t),[s,c]=H.useState(null),[l,u]=H.useState(null),d=Il(i);return H.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,W.jsx)(ym,{...o,children:(0,W.jsx)(ih,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,W.jsx)(Jh,{scope:t,contentId:Nl(),triggerId:Nl(),trigger:s,onTriggerChange:c,children:n})})})};Xh.displayName=qh;var Zh=`MenuSubTrigger`,Qh=H.forwardRef((e,t)=>{let n=ah(Zh,e.__scopeMenu),r=sh(Zh,e.__scopeMenu),i=Yh(Zh,e.__scopeMenu),a=_h(Zh,e.__scopeMenu),o=H.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=H.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return H.useEffect(()=>u,[u]),H.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,W.jsx)(uh,{asChild:!0,...l,children:(0,W.jsx)(Ah,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tg(n.open),...e,ref:cl(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(e.onPointerMove,lg(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:G(e.onPointerLeave,lg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:G(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Jm[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qh.displayName=Zh;var $h=`MenuSubContent`,eg=H.forwardRef((e,t)=>{let n=ph(hh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ah(hh,e.__scopeMenu),o=sh(hh,e.__scopeMenu),s=Yh($h,e.__scopeMenu),c=H.useRef(null),l=ll(t,c);return(0,W.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Dl,{present:r||a.open,children:(0,W.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:(0,W.jsx)(Sh,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:G(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:G(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ym[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});eg.displayName=$h;function tg(e){return e?`open`:`closed`}function ng(e){return e===`indeterminate`}function rg(e){return ng(e)?`indeterminate`:e?`checked`:`unchecked`}function ig(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ag(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function og(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ag(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sg(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cg(e,t){return t?sg({x:e.clientX,y:e.clientY},t):!1}function lg(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ug=ch,dg=uh,fg=mh,pg=vh,mg=wh,hg=Eh,gg=kh,_g=Mh,vg=Ih,yg=Rh,bg=Hh,xg=Wh,Sg=Kh,Cg=Xh,wg=Qh,Tg=eg,Eg=`DropdownMenu`,[Dg,Og]=vl(Eg,[th]),kg=th(),[Ag,jg]=Dg(Eg),Mg=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=kg(t),l=H.useRef(null),[u,d]=Cl({prop:i,defaultProp:a??!1,onChange:o,caller:Eg});return(0,W.jsx)(Ag,{scope:t,triggerId:Nl(),triggerRef:l,contentId:Nl(),open:u,onOpenChange:d,onOpenToggle:H.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,W.jsx)(ug,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Mg.displayName=Eg;var Ng=`DropdownMenuTrigger`,Pg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=jg(Ng,n),o=kg(n);return(0,W.jsx)(dg,{asChild:!0,...o,children:(0,W.jsx)(gl.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:cl(t,a.triggerRef),onPointerDown:G(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:G(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Pg.displayName=Ng;var Fg=`DropdownMenuPortal`,Ig=e=>{let{__scopeDropdownMenu:t,...n}=e,r=kg(t);return(0,W.jsx)(fg,{...r,...n})};Ig.displayName=Fg;var Lg=`DropdownMenuContent`,Rg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jg(Lg,n),a=kg(n),o=H.useRef(!1);return(0,W.jsx)(pg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:G(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.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)`}})});Rg.displayName=Lg;var zg=`DropdownMenuGroup`,Bg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(mg,{...i,...r,ref:t})});Bg.displayName=zg;var Vg=`DropdownMenuLabel`,Hg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(hg,{...i,...r,ref:t})});Hg.displayName=Vg;var Ug=`DropdownMenuItem`,Wg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(gg,{...i,...r,ref:t})});Wg.displayName=Ug;var Gg=`DropdownMenuCheckboxItem`,Kg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(_g,{...i,...r,ref:t})});Kg.displayName=Gg;var qg=`DropdownMenuRadioGroup`,Jg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(vg,{...i,...r,ref:t})});Jg.displayName=qg;var Yg=`DropdownMenuRadioItem`,Xg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(yg,{...i,...r,ref:t})});Xg.displayName=Yg;var Zg=`DropdownMenuItemIndicator`,Qg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(bg,{...i,...r,ref:t})});Qg.displayName=Zg;var $g=`DropdownMenuSeparator`,e_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(xg,{...i,...r,ref:t})});e_.displayName=$g;var t_=`DropdownMenuArrow`,n_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(Sg,{...i,...r,ref:t})});n_.displayName=t_;var r_=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=kg(t),[s,c]=Cl({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,W.jsx)(Cg,{...o,open:s,onOpenChange:c,children:n})},i_=`DropdownMenuSubTrigger`,a_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(wg,{...i,...r,ref:t})});a_.displayName=i_;var o_=`DropdownMenuSubContent`,s_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(Tg,{...i,...r,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)`}})});s_.displayName=o_;var c_=Mg,l_=Pg,u_=Rg,d_=Wg,f_=r_,p_=a_,m_=s_,h_=`Popover`,[g_,__]=vl(h_,[rm]),v_=rm(),[y_,b_]=g_(h_),x_=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=v_(t),c=H.useRef(null),[l,u]=H.useState(!1),[d,f]=Cl({prop:r,defaultProp:i??!1,onChange:a,caller:h_});return(0,W.jsx)(ym,{...s,children:(0,W.jsx)(y_,{scope:t,contentId:Nl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:H.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:n})})};x_.displayName=h_;var S_=`PopoverAnchor`,C_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(S_,n),a=v_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return H.useEffect(()=>(o(),()=>s()),[o,s]),(0,W.jsx)(bm,{...a,...r,ref:t})});C_.displayName=S_;var w_=`PopoverTrigger`,T_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(w_,n),a=v_(n),o=ll(t,i.triggerRef),s=(0,W.jsx)(gl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":B_(i.open),...r,ref:o,onClick:G(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,W.jsx)(bm,{asChild:!0,...a,children:s})});T_.displayName=w_;var E_=`PopoverPortal`,[D_,O_]=g_(E_,{forceMount:void 0}),k_=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=b_(E_,t);return(0,W.jsx)(D_,{scope:t,forceMount:n,children:(0,W.jsx)(Dl,{present:n||a.open,children:(0,W.jsx)(mu,{asChild:!0,container:i,children:r})})})};k_.displayName=E_;var A_=`PopoverContent`,j_=H.forwardRef((e,t)=>{let n=O_(A_,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=b_(A_,e.__scopePopover);return(0,W.jsx)(Dl,{present:r||a.open,children:a.modal?(0,W.jsx)(N_,{...i,ref:t}):(0,W.jsx)(P_,{...i,ref:t})})});j_.displayName=A_;var M_=ul(`PopoverContent.RemoveScroll`),N_=H.forwardRef((e,t)=>{let n=b_(A_,e.__scopePopover),r=H.useRef(null),i=ll(t,r),a=H.useRef(!1);return H.useEffect(()=>{let e=r.current;if(e)return Fd(e)},[]),(0,W.jsx)(Ed,{as:M_,allowPinchZoom:!0,children:(0,W.jsx)(F_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),P_=H.forwardRef((e,t)=>{let n=b_(A_,e.__scopePopover),r=H.useRef(!1),i=H.useRef(!1);return(0,W.jsx)(F_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),F_=H.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=b_(A_,n),p=v_(n);return gu(),(0,W.jsx)(tu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,W.jsx)(Wl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,W.jsx)(xm,{"data-state":B_(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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)`}})})})}),I_=`PopoverClose`,L_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(I_,n);return(0,W.jsx)(gl.button,{type:`button`,...r,ref:t,onClick:G(e.onClick,()=>i.onOpenChange(!1))})});L_.displayName=I_;var R_=`PopoverArrow`,z_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=v_(n);return(0,W.jsx)(Sm,{...i,...r,ref:t})});z_.displayName=R_;function B_(e){return e?`open`:`closed`}var V_=x_,H_=T_,U_=k_,W_=j_,G_=z_,K_=`Tabs`,[q_,J_]=vl(K_,[Am]),Y_=Am(),[X_,Z_]=q_(K_),Q_=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Fl(s),[d,f]=Cl({prop:r,onChange:i,defaultProp:a??``,caller:K_});return(0,W.jsx)(X_,{scope:n,baseId:Nl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,W.jsx)(gl.div,{dir:u,"data-orientation":o,...l,ref:t})})});Q_.displayName=K_;var $_=`TabsList`,ev=H.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Z_($_,n),o=Y_(n);return(0,W.jsx)(Hm,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,W.jsx)(gl.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ev.displayName=$_;var tv=`TabsTrigger`,nv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Z_(tv,n),s=Y_(n),c=av(o.baseId,r),l=ov(o.baseId,r),u=r===o.value;return(0,W.jsx)(Um,{asChild:!0,...s,focusable:!i,active:u,children:(0,W.jsx)(gl.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:G(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:G(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});nv.displayName=tv;var rv=`TabsContent`,iv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Z_(rv,n),c=av(s.baseId,r),l=ov(s.baseId,r),u=r===s.value,d=H.useRef(u);return H.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,W.jsx)(Dl,{present:i||u,children:({present:n})=>(0,W.jsx)(gl.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});iv.displayName=rv;function av(e,t){return`${e}-trigger-${t}`}function ov(e,t){return`${e}-content-${t}`}var sv=Q_,cv=ev,lv=nv,uv=iv,dv=e(t(((e,t)=>{(function(){var n=this,r={};e===void 0?n.fuzzy=r:t.exports=r,r.simpleFilter=function(e,t){return t.filter(function(t){return r.test(e,t)})},r.test=function(e,t){return r.match(e,t)!==null},r.match=function(e,t,n){n||={};var r=0,i=[],a=t.length,o=0,s=0,c=n.pre||``,l=n.post||``,u=n.caseSensitive&&t||t.toLowerCase(),d;e=n.caseSensitive&&e||e.toLowerCase();for(var f=0;f<a;f++)d=t[f],u[f]===e[r]?(d=c+d+l,r+=1,s+=1+s):s=0,o+=s,i[i.length]=d;return r===e.length?(o=u===e?1/0:o,{rendered:i.join(``),score:o}):null},r.filter=function(e,t,n){return!t||t.length===0?[]:typeof e==`string`?(n||={},t.reduce(function(t,i,a,o){var s=i;n.extract&&(s=n.extract(i));var c=r.match(e,s,n);return c!=null&&(t[t.length]={string:c.rendered,score:c.score,index:a,original:i}),t},[]).sort(function(e,t){return t.score-e.score||e.index-t.index})):t}})()}))(),1),fv=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},pv=e=>e?fv(e):fv,mv=t((e=>{var t=s(),n=Ld();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),s!==void 0&&f.hasValue){var t=f.value;if(s(t,e))return c=t}return c=e}if(t=c,i(o,e))return t;var n=r(e);return s!==void 0&&s(t,n)?(o=e,t):(o=e,c=n)}var a=!1,o,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,s]);var p=a(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),hv=e(t(((e,t)=>{t.exports=mv()}))(),1),{useDebugValue:gv}=H.default,{useSyncExternalStoreWithSelector:_v}=hv.default,vv=e=>e;function yv(e,t=vv,n){let r=_v(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return gv(r),r}var bv=e=>{let t=typeof e==`function`?pv(e):e,n=(e,n)=>yv(t,e,n);return Object.assign(n,t),n},xv=e=>e?bv(e):bv,Sv,Cv=typeof window<`u`&&((Sv=window.document)!=null&&Sv.createElement||window.navigator?.product===`ReactNative`)?H.useLayoutEffect:H.useEffect;function wv(){let e=xv(e=>({current:[],version:0,set:e}));return{In:({children:t})=>{let n=e(e=>e.set),r=e(e=>e.version);return Cv(()=>{n(e=>({version:e.version+1}))},[]),Cv(()=>(n(({current:e})=>({current:[...e,t]})),()=>n(({current:e})=>({current:e.filter(e=>e!==t)}))),[t,r]),null},Out:()=>{let t=e(e=>e.current);return H.createElement(H.Fragment,null,t)}}}function Tv(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function Ev(e,t,n){let r=Tv(t,n);if(r===0)return Tv(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),Tv(e,Dv(t,n,i))}function Dv(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Ov(e,t){return kv(e,0,e.length,t)}function kv(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=Ev(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(kv(e,t,l+1,r,a),kv(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function Av(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}function jv(e){return[-e[0],-e[1]]}function Mv(e,t){return[e[0]+t[0],e[1]+t[1]]}function Nv(e,t){return[e[0]-t[0],e[1]-t[1]]}function Pv(e,t){return[e[0]*t,e[1]*t]}function Fv(e,t){return[e[0]/t,e[1]/t]}function Iv(e){return[e[1],-e[0]]}function Lv(e,t){return e[0]*t[0]+e[1]*t[1]}function Rv(e,t){return e[0]===t[0]&&e[1]===t[1]}function zv(e){return Math.hypot(e[0],e[1])}function Bv(e){return e[0]*e[0]+e[1]*e[1]}function Vv(e,t){return Bv(Nv(e,t))}function Hv(e){return Fv(e,zv(e))}function Uv(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Wv(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function Gv(e,t,n){return Mv(e,Pv(Nv(t,e),n))}function Kv(e,t,n){return Mv(e,Pv(t,n))}var{min:qv,PI:Jv}=Math,Yv=.275,Xv=Jv+1e-4;function Zv(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=s.taper===!1?0:s.taper===!0?Math.max(n,m):s.taper,g=c.taper===!1?0:c.taper===!0?Math.max(n,m):c.taper,_=(n*r)**2,v=[],y=[],b=e.slice(0,10).reduce((e,t)=>{let r=t.pressure;if(a){let i=qv(1,t.distance/n);r=qv(1,e+(qv(1,1-i)-e)*(i*Yv))}return(e+r)/2},e[0].pressure),x=Av(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,w=e[0].point,T=w,E=w,D=T,O=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t];if(t<e.length-1&&m-u<3)continue;if(i){if(a){let e=qv(1,l/n),t=qv(1,1-e);r=qv(1,b+(t-b)*(e*Yv))}x=Av(n,i,r,o)}else x=n/2;S===void 0&&(S=x);let f=u<h?d(u/h):1,k=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(f,k));let A=(t<e.length-1?e[t+1]:e[t]).vector,ee=t<e.length-1?Lv(c,A):1,te=Lv(c,C)<0&&!O,ne=ee!==null&&ee<0;if(te||ne){let e=Pv(Iv(C),x);for(let t=0;t<=1;t+=.07692307692307693)E=Wv(Nv(s,e),s,Xv*t),v.push(E),D=Wv(Mv(s,e),s,Xv*-t),y.push(D);w=E,T=D,ne&&(O=!0);continue}if(O=!1,t===e.length-1){let e=Pv(Iv(c),x);v.push(Nv(s,e)),y.push(Mv(s,e));continue}let j=Pv(Iv(Gv(A,c,ee)),x);E=Nv(s,j),(t<=1||Vv(w,E)>_)&&(v.push(E),w=E),D=Mv(s,j),(t<=1||Vv(T,D)>_)&&(y.push(D),T=D),b=r,C=c}let k=e[0].point.slice(0,2),A=e.length>1?e[e.length-1].point.slice(0,2):Mv(e[0].point,[1,1]),ee=[],te=[];if(e.length===1){if(!(h||g)||l){let e=Kv(k,Hv(Iv(Nv(k,A))),-(S||x)),t=[];for(let n=1/13,r=n;r<=1;r+=n)t.push(Wv(e,k,Xv*2*r));return t}}else{if(!(h||g&&e.length===1))if(u)for(let e=1/13,t=e;t<=1;t+=e){let e=Wv(y[0],k,Xv*t);ee.push(e)}else{let e=Nv(v[0],y[0]),t=Pv(e,.5),n=Pv(e,.51);ee.push(Nv(k,t),Nv(k,n),Mv(k,n),Mv(k,t))}let t=Iv(jv(e[e.length-1].vector));if(g||h&&e.length===1)te.push(A);else if(f){let e=Kv(A,t,x);for(let t=1/29,n=t;n<1;n+=t)te.push(Wv(e,A,Xv*3*n))}else te.push(Mv(A,Pv(t,x)),Mv(A,Pv(t,x*.99)),Nv(A,Pv(t,x*.99)),Nv(A,Pv(t,x)))}return v.concat(te,y.reverse(),ee)}function Qv(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=.5})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(Gv(o[0],e,t/4))}o.length===1&&(o=[...o,[...Mv(o[0],[1,1]),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:o[0][2]>=0?o[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?o[e].slice(0,2):Gv(u.point,o[e],a);if(Rv(u.point,t))continue;let n=Uv(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}u={point:t,pressure:o[e][2]>=0?o[e][2]:.5,vector:Hv(Nv(u.point,t)),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function $v(e,t={}){return Zv(Qv(e,t),t)}function ey(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}ey({},`LaserPointer`,()=>hy);function ty([e,t,n],[r,i,a]){return[e+r,t+i,n+a]}function ny([e,t,n],[r,i,a]){return[e-r,t-i,n-a]}function ry([e,t,n],r){return[e*r,t*r,n*r]}function iy([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function ay([e,t,n],r){return[Math.cos(r)*e-Math.sin(r)*t,Math.sin(r)*e+Math.cos(r)*t,n]}function oy(e,t,n){return ty(e,ry(ny(t,e),n))}function sy(e,t,n){return Math.atan2(n[1]-e[1],n[0]-e[0])-Math.atan2(t[1]-e[1],t[0]-e[0])}function cy(e){return Math.atan2(Math.sin(e),Math.cos(e))}function ly([e,t]){return Math.sqrt(e**2+t**2)}function uy([e,t],[n,r]){return Math.sqrt((n-e)**2+(r-t)**2)}function dy(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=uy(e[n-1],e[n]);return t+=uy(e[e.length-2],e[e.length-1]),t}var fy=(e,t,n)=>Math.max(t,Math.min(n,e));function py(e,t,n){let r=uy(t,n);if(r===0)return uy(e,t);let i=fy(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r**2,0,1);return uy([t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]],e)}function my(e,t){if(t===0||e.length<=2)return e;let n=e[0],r=e[e.length-1],[i,a]=e.reduce(([e,t],i,a)=>{let o=py(i,n,r);return o>e?[o,a]:[e,t]},[0,-1]);if(i>=t){let i=e[a];return[...my([n,...e.slice(1,a),i],t).slice(0,-1),i,...my([i,...e.slice(a,-1),r],t).slice(1)]}else return[n,r]}var hy=class e{static{this.defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:`output`,keepHead:!1,sizeMapping:()=>1}}static{this.constants={cornerDetectionMaxAngle:75,cornerDetectionVariance:e=>e>35?.5:1,maxTailLength:50}}constructor(t){this.originalPoints=[],this.stablePoints=[],this.tailPoints=[],this.isFresh=!0,this.options=Object.assign({},e.defaults,t)}get lastPoint(){return this.tailPoints[this.tailPoints.length-1]??this.stablePoints[this.stablePoints.length-1]}addPoint(t){let n=this.originalPoints[this.originalPoints.length-1];if(!(n&&n[0]===t[0]&&n[1]===t[1])){if(this.originalPoints.push(t),this.isFresh){this.isFresh=!1,this.stablePoints.push(t);return}this.options.streamline>0&&(t=oy(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),dy(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase==`tail`)throw Error(`Not implemented yet`);this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(e,t,n,r,i){return(e??this.options.size)*this.options.sizeMapping({pressure:t,runningLength:i,currentIndex:n,totalLength:r})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase===`input`&&(n=my(n,this.options.simplify));let r=n.length;if(r===0)return[];if(r===1){let e=n[0],i=this.getSize(t,e[2],0,r,0);if(i<.5)return[];let a=[];for(let t=0;t<=Math.PI*2;t+=Math.PI/16)a.push(ty(e,ry(ay([1,0,0],t),i)));return a.push(ty(e,ry([1,0,0],this.getSize(t,e[2],0,r,0)))),a}if(r===2){let e=n[0],i=n[1],a=this.getSize(t,e[2],0,r,0),o=this.getSize(t,i[2],0,r,0);if(a<.5||o<.5)return[];let s=[],c=sy(e,[e[0],e[1]-100,e[2]],i);for(let t=c;t<=Math.PI+c;t+=Math.PI/16)s.push(ty(e,ry(ay([1,0,0],t),a)));for(let e=Math.PI+c;e<=Math.PI*2+c;e+=Math.PI/16)s.push(ty(i,ry(ay([1,0,0],e),o)));return s.push(s[0]),s}let i=[],a=[],o=0,s=0,c=0,l=0;for(let u=1;u<r-1;u++){let d=n[u-1],f=n[u],p=n[u+1],m=f[2],h=uy(d,f);l+=h,o=s+(h-s)*.2;let g=this.getSize(t,m,u,r,l);if(g===0){c=u+1;continue}let _=iy(ny(d,f)),v=iy(ny(p,f)),y=ay(_,Math.PI/2),b=ay(_,-Math.PI/2),x=ay(v,Math.PI/2),S=ay(v,-Math.PI/2),C=ty(f,ry(y,g)),w=ty(f,ry(b,g)),T=ty(f,ry(x,g)),E=ty(f,ry(S,g)),D=ty(y,S),O=ty(b,x),k=ty(f,ry(ly(D)===0?_:iy(D),g)),A=ty(f,ry(ly(O)===0?v:iy(O),g)),ee=cy(sy(f,d,p)),te=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(o);if(Math.abs(ee)<te){let e=Math.abs(cy(Math.PI-ee));if(e===0)continue;if(ee<0){a.push(w,A);for(let t=0;t<=e;t+=e/4)i.push(ty(f,ay(ry(y,g),t)));for(let t=e;t>=0;t-=e/4)a.push(ty(f,ay(ry(y,g),t)));a.push(A,T)}else{i.push(C,k);for(let t=0;t<=e;t+=e/4)a.push(ty(f,ay(ry(y,-g),-t)));for(let t=e;t>=0;t-=e/4)i.push(ty(f,ay(ry(y,-g),-t)));i.push(k,E)}}else i.push(k),a.push(A);s=o}if(c>=r-2)if(this.options.keepHead){let e=n[r-1],t=[];for(let n=0;n<=Math.PI*2;n+=Math.PI/16)t.push(ty(e,ry(ay([1,0,0],n),this.options.size)));return t.push(ty(e,ry([1,0,0],this.options.size))),t}else return[];let u=n[c],d=n[c+1],f=n[r-2],p=n[r-1],m=iy(ny(d,u)),h=iy(ny(f,p)),g=ay(m,-Math.PI/2),_=ay(h,Math.PI/2),v=this.getSize(t,u[2],0,r,0),y=[],b=this.options.keepHead?this.options.size:this.getSize(t,f[2],r-2,r,l),x=[];if(v>1){for(let e=0;e<=Math.PI;e+=Math.PI/16)y.unshift(ty(u,ay(ry(g,v),-e)));y.unshift(ty(u,ry(g,-v)))}else y.push(u);for(let e=0;e<=Math.PI*3;e+=Math.PI/16)x.push(ty(p,ay(ry(_,-b),-e)));let S=[...y,...i,...x.reverse(),...a.reverse()];return y.length>0&&S.push(y[0]),this.options.simplify>0&&this.options.simplifyPhase===`output`?my(S,this.options.simplify):S}},gy=e(t(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,h=Math.min,g=function(){return f.Date.now()};function _(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=x(t)||0,v(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(x(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?h(i,o-r):i}function S(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=g();if(S(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,p&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(g())}function D(){var e=g(),n=S(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return y(l);if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return D.cancel=T,D.flush=E,D}function v(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function y(e){return!!e&&typeof e==`object`}function b(e){return typeof e==`symbol`||y(e)&&p.call(e)==i}function x(e){if(typeof e==`number`)return e;if(b(e))return r;if(v(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=v(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=_}))(),1),_y=il(),{useAtom:vy,useSetAtom:yy,useAtomValue:by,useStore:xy}=_y,Sy=_y.Provider,Cy=Vc(),wy=a({"./locales/ar-SA.json":()=>n(()=>import(`./ar-SA-NXDWD63E-DND5MLpM.js`),__vite__mapDeps([0,1,2]),import.meta.url),"./locales/az-AZ.json":()=>n(()=>import(`./az-AZ-MXSORGZV-ILYw2sYr.js`),__vite__mapDeps([3,1,2]),import.meta.url),"./locales/bg-BG.json":()=>n(()=>import(`./bg-BG-O6MV2KSF-DmfoZHM8.js`),__vite__mapDeps([4,1,2]),import.meta.url),"./locales/bn-BD.json":()=>n(()=>import(`./bn-BD-T2VJNT7N-uYQx1Wph.js`),__vite__mapDeps([5,1,2]),import.meta.url),"./locales/bn-IN.json":()=>n(()=>import(`./bn-IN-MMW2ORAC-CmlBLY7g.js`),__vite__mapDeps([6,1,2]),import.meta.url),"./locales/ca-ES.json":()=>n(()=>import(`./ca-ES-MKBCGNOG-DWiYvMvF.js`),__vite__mapDeps([7,1,2]),import.meta.url),"./locales/cs-CZ.json":()=>n(()=>import(`./cs-CZ-V77HGUP7-sLBAF2Iw.js`),__vite__mapDeps([8,1,2]),import.meta.url),"./locales/da-DK.json":()=>n(()=>import(`./da-DK-I5RFNTM4-B__PLwca.js`),__vite__mapDeps([9,1,2]),import.meta.url),"./locales/de-CH.json":()=>n(()=>import(`./de-CH-WLRDEVBV-D61DKw_9.js`),__vite__mapDeps([10,1,2]),import.meta.url),"./locales/de-DE.json":()=>n(()=>import(`./de-DE-DTI4WUSC-Ba3fBYEU.js`),__vite__mapDeps([11,1,2]),import.meta.url),"./locales/el-GR.json":()=>n(()=>import(`./el-GR-ZXDJ2OS4-CpEbk42T.js`),__vite__mapDeps([12,1,2]),import.meta.url),"./locales/en.json":()=>n(()=>import(`./en-CTDJDZ6K-C36Iqh9O.js`),__vite__mapDeps([13,14,1,2]),import.meta.url),"./locales/es-ES.json":()=>n(()=>import(`./es-ES-DYQHAD43-Ba-6t0Wr.js`),__vite__mapDeps([15,1,2]),import.meta.url),"./locales/eu-ES.json":()=>n(()=>import(`./eu-ES-QDSYU5Y3-CYzUKQ2_.js`),__vite__mapDeps([16,1,2]),import.meta.url),"./locales/fa-IR.json":()=>n(()=>import(`./fa-IR-26LZG4PM-CxLc7ohL.js`),__vite__mapDeps([17,1,2]),import.meta.url),"./locales/fi-FI.json":()=>n(()=>import(`./fi-FI-6YS4KDE4-DtYLOEJY.js`),__vite__mapDeps([18,1,2]),import.meta.url),"./locales/fr-FR.json":()=>n(()=>import(`./fr-FR-BRLLPTZC-9O_U5gdi.js`),__vite__mapDeps([19,1,2]),import.meta.url),"./locales/gl-ES.json":()=>n(()=>import(`./gl-ES-OKUZTLYG-Bb7TO64O.js`),__vite__mapDeps([20,1,2]),import.meta.url),"./locales/he-IL.json":()=>n(()=>import(`./he-IL-26MGYIU7-CQW1igm9.js`),__vite__mapDeps([21,1,2]),import.meta.url),"./locales/hi-IN.json":()=>n(()=>import(`./hi-IN-Q4ZOGTP2-BM91ENLs.js`),__vite__mapDeps([22,1,2]),import.meta.url),"./locales/hu-HU.json":()=>n(()=>import(`./hu-HU-P2OXPSN5-HiGbsUwM.js`),__vite__mapDeps([23,1,2]),import.meta.url),"./locales/id-ID.json":()=>n(()=>import(`./id-ID-2EIKXYN6-DEG8vRZ2.js`),__vite__mapDeps([24,1,2]),import.meta.url),"./locales/it-IT.json":()=>n(()=>import(`./it-IT-4CFKVXI2-DSrGqCKD.js`),__vite__mapDeps([25,1,2]),import.meta.url),"./locales/ja-JP.json":()=>n(()=>import(`./ja-JP-MAND2Z4V-OFpEymIv.js`),__vite__mapDeps([26,1,2]),import.meta.url),"./locales/kaa.json":()=>n(()=>import(`./kaa-HQRTCXTJ-CpOJ_vn4.js`),__vite__mapDeps([27,1,2]),import.meta.url),"./locales/kab-KAB.json":()=>n(()=>import(`./kab-KAB-JKIKKTGH-CNPzzJH6.js`),__vite__mapDeps([28,1,2]),import.meta.url),"./locales/kk-KZ.json":()=>n(()=>import(`./kk-KZ-HXQ63ZFC-CgtjU5JI.js`),__vite__mapDeps([29,1,2]),import.meta.url),"./locales/km-KH.json":()=>n(()=>import(`./km-KH-PKL3LSGX-BAJh8UnF.js`),__vite__mapDeps([30,1,2]),import.meta.url),"./locales/ko-KR.json":()=>n(()=>import(`./ko-KR-KXLREZX3-BshOksBX.js`),__vite__mapDeps([31,1,2]),import.meta.url),"./locales/ku-TR.json":()=>n(()=>import(`./ku-TR-MJ4IER3X-Bi3YtiD-.js`),__vite__mapDeps([32,1,2]),import.meta.url),"./locales/lt-LT.json":()=>n(()=>import(`./lt-LT-H6WFQ6FJ-DQ2W0g7h.js`),__vite__mapDeps([33,1,2]),import.meta.url),"./locales/lv-LV.json":()=>n(()=>import(`./lv-LV-GOCK6SJW-DeqTo8T7.js`),__vite__mapDeps([34,1,2]),import.meta.url),"./locales/mr-IN.json":()=>n(()=>import(`./mr-IN-IXVLDMEQ-CnH5Wjc7.js`),__vite__mapDeps([35,1,2]),import.meta.url),"./locales/my-MM.json":()=>n(()=>import(`./my-MM-YG6MYTTD-BefEpouO.js`),__vite__mapDeps([36,1,2]),import.meta.url),"./locales/nb-NO.json":()=>n(()=>import(`./nb-NO-XGWJISD2-CNRrlrPY.js`),__vite__mapDeps([37,1,2]),import.meta.url),"./locales/nl-NL.json":()=>n(()=>import(`./nl-NL-XVDVCPNC-CuLTw3kL.js`),__vite__mapDeps([38,1,2]),import.meta.url),"./locales/nn-NO.json":()=>n(()=>import(`./nn-NO-EMX5MJX5-NHFRnQkl.js`),__vite__mapDeps([39,1,2]),import.meta.url),"./locales/oc-FR.json":()=>n(()=>import(`./oc-FR-ROEINTVO-8kCbAtcr.js`),__vite__mapDeps([40,1,2]),import.meta.url),"./locales/pa-IN.json":()=>n(()=>import(`./pa-IN-ZYN6SUDY-Dh8USSIe.js`),__vite__mapDeps([41,1,2]),import.meta.url),"./locales/percentages.json":()=>n(()=>import(`./percentages-5DKR754L-RQFE76Sg.js`),__vite__mapDeps([42,43,1,2]),import.meta.url),"./locales/pl-PL.json":()=>n(()=>import(`./pl-PL-6VTG7PHC-BMbgP62B.js`),__vite__mapDeps([44,1,2]),import.meta.url),"./locales/pt-BR.json":()=>n(()=>import(`./pt-BR-5YFKRR5G-CyrwFw_N.js`),__vite__mapDeps([45,1,2]),import.meta.url),"./locales/pt-PT.json":()=>n(()=>import(`./pt-PT-GEIXXZ67-SpK5vaGR.js`),__vite__mapDeps([46,1,2]),import.meta.url),"./locales/ro-RO.json":()=>n(()=>import(`./ro-RO-E2P6TFZI-90dn2iUp.js`),__vite__mapDeps([47,1,2]),import.meta.url),"./locales/ru-RU.json":()=>n(()=>import(`./ru-RU-YBIIY43T-Cl52NZnQ.js`),__vite__mapDeps([48,1,2]),import.meta.url),"./locales/si-LK.json":()=>n(()=>import(`./si-LK-673C2CI2-DMSUxT-y.js`),__vite__mapDeps([49,1,2]),import.meta.url),"./locales/sk-SK.json":()=>n(()=>import(`./sk-SK-CKZHQ4AP-DUDai5Oe.js`),__vite__mapDeps([50,1,2]),import.meta.url),"./locales/sl-SI.json":()=>n(()=>import(`./sl-SI-557H2GWM-BbLeATfl.js`),__vite__mapDeps([51,1,2]),import.meta.url),"./locales/sv-SE.json":()=>n(()=>import(`./sv-SE-XOPKKDWS-BBa-AcMf.js`),__vite__mapDeps([52,1,2]),import.meta.url),"./locales/ta-IN.json":()=>n(()=>import(`./ta-IN-XBH7DQI3-9uR7ADzx.js`),__vite__mapDeps([53,1,2]),import.meta.url),"./locales/th-TH.json":()=>n(()=>import(`./th-TH-TOCWH3R4-Box9U3ny.js`),__vite__mapDeps([54,1,2]),import.meta.url),"./locales/tr-TR.json":()=>n(()=>import(`./tr-TR-GXW6CYY5-BA8pS3C5.js`),__vite__mapDeps([55,1,2]),import.meta.url),"./locales/uk-UA.json":()=>n(()=>import(`./uk-UA-IJKTNUDG-B6hoHqzM.js`),__vite__mapDeps([56,1,2]),import.meta.url),"./locales/uz-UZ.json":()=>n(()=>import(`./uz-UZ-TBZZEA4V-CPuftH33.js`),__vite__mapDeps([57,1,2]),import.meta.url),"./locales/vi-VN.json":()=>n(()=>import(`./vi-VN-MULSGNVB-yRFd9OXl.js`),__vite__mapDeps([58,1,2]),import.meta.url),"./locales/zh-CN.json":()=>n(()=>import(`./zh-CN-MVX3E32U-VzUIXB4K.js`),__vite__mapDeps([59,1,2]),import.meta.url),"./locales/zh-HK.json":()=>n(()=>import(`./zh-HK-JNU5RLIE-i0G2jHO_.js`),__vite__mapDeps([60,1,2]),import.meta.url),"./locales/zh-TW.json":()=>n(()=>import(`./zh-TW-LENVCA6T-BkHZg3jv.js`),__vite__mapDeps([61,1,2]),import.meta.url)}),Ty=85,Ey={code:`en`,label:`English`},Dy=[Ey,...[{code:`ar-SA`,label:`العربية`,rtl:!0},{code:`bg-BG`,label:`Български`},{code:`ca-ES`,label:`Català`},{code:`cs-CZ`,label:`Česky`},{code:`de-DE`,label:`Deutsch`},{code:`el-GR`,label:`Ελληνικά`},{code:`es-ES`,label:`Español`},{code:`eu-ES`,label:`Euskara`},{code:`fa-IR`,label:`فارسی`,rtl:!0},{code:`fi-FI`,label:`Suomi`},{code:`fr-FR`,label:`Français`},{code:`gl-ES`,label:`Galego`},{code:`he-IL`,label:`עברית`,rtl:!0},{code:`hi-IN`,label:`हिन्दी`},{code:`hu-HU`,label:`Magyar`},{code:`id-ID`,label:`Bahasa Indonesia`},{code:`it-IT`,label:`Italiano`},{code:`ja-JP`,label:`日本語`},{code:`kab-KAB`,label:`Taqbaylit`},{code:`kk-KZ`,label:`Қазақ тілі`},{code:`ko-KR`,label:`한국어`},{code:`ku-TR`,label:`Kurdî`},{code:`lt-LT`,label:`Lietuvių`},{code:`lv-LV`,label:`Latviešu`},{code:`my-MM`,label:`Burmese`},{code:`nb-NO`,label:`Norsk bokmål`},{code:`nl-NL`,label:`Nederlands`},{code:`nn-NO`,label:`Norsk nynorsk`},{code:`oc-FR`,label:`Occitan`},{code:`pa-IN`,label:`ਪੰਜਾਬੀ`},{code:`pl-PL`,label:`Polski`},{code:`pt-BR`,label:`Português Brasileiro`},{code:`pt-PT`,label:`Português`},{code:`ro-RO`,label:`Română`},{code:`ru-RU`,label:`Русский`},{code:`sk-SK`,label:`Slovenčina`},{code:`sv-SE`,label:`Svenska`},{code:`sl-SI`,label:`Slovenščina`},{code:`tr-TR`,label:`Türkçe`},{code:`uk-UA`,label:`Українська`},{code:`zh-CN`,label:`简体中文`},{code:`zh-TW`,label:`繁體中文`},{code:`vi-VN`,label:`Tiếng Việt`},{code:`mr-IN`,label:`मराठी`}].filter(e=>ec[e.code]>=Ty).sort((e,t)=>e.label>t.label?1:-1)],Oy=`__test__`;Vt()&&Dy.unshift({code:Oy,label:`test language`},{code:`${Oy}.rtl`,label:`test language (rtl)`,rtl:!0});var ky=Ey,Ay={},jy=async e=>{if(ky=e,document.documentElement.dir=ky.rtl?`rtl`:`ltr`,document.documentElement.lang=ky.code,e.code.startsWith(Oy))Ay={};else try{Ay=await wy(`./locales/${ky.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),Ay=$s}Cy.set(Py,e.code)},My=()=>ky,Ny=(e,t)=>{for(let n=0;n<t.length;++n){let r=t[n];if(e[r]===void 0)return;e=e[r]}if(typeof e==`string`)return e},K=(e,t,n)=>{if(ky.code.startsWith(Oy))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let i=e.split(`.`),a=Ny(Ay,i)||Ny($s,i)||n;if(a===void 0){let t=`Can't find translation for ${e}`;if(r.PROD)return console.warn(t),``;throw Error(t)}if(t)for(let e in t)a=a.replace(`{{${e}}}`,String(t[e]));return a},Py=yc(Ey.code),Fy=()=>({t:K,langCode:by(Py)}),Iy=e=>`var(--icon-fill-color)`,Ly=e=>e===R.LIGHT?`#fff`:`#1e1e1e`,q=(e,t=512)=>{let{width:n=512,height:r=n,mirror:i,style:a,...o}=typeof t==`number`?{width:t}:t;return(0,W.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,role:`img`,viewBox:`0 0 ${n} ${r}`,className:U({"rtl-mirror":i}),style:a,...o,children:typeof e==`string`?(0,W.jsx)(`path`,{fill:`currentColor`,d:e}):e})},J={width:24,height:24,fill:`none`,strokeWidth:2,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},Y={width:20,height:20,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},Ry={width:40,height:20};q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`rect`,{x:3,y:8,width:18,height:4,rx:1}),(0,W.jsx)(`line`,{x1:12,y1:8,x2:12,y2:21}),(0,W.jsx)(`path`,{d:`M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7`}),(0,W.jsx)(`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5`})]}),J);var zy=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,W.jsx)(`path`,{d:`M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,W.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3`,y2:`19`}),(0,W.jsx)(`line`,{x1:`12`,y1:`6`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`21`,y1:`6`,x2:`21`,y2:`19`})]}),J),By=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),J),Vy=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1`})]}),J),Hy=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,W.jsx)(`path`,{d:`M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,W.jsx)(`path`,{d:`M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]}),J),Uy=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M9 4v6l-2 4v2h10v-2l-2 -4v-6`}),(0,W.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`21`}),(0,W.jsx)(`line`,{x1:`8`,y1:`4`,x2:`16`,y2:`4`})]}),J),Wy=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M6.5 9.5l3.5 -3`}),(0,W.jsx)(`path`,{d:`M14 5.5l3 1.5`}),(0,W.jsx)(`path`,{d:`M18.5 10l-2.5 7`}),(0,W.jsx)(`path`,{d:`M13.5 17.5l-7 -5`})]}),J),Gy=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{d:`M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`path`,{d:`M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`UnlockedIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:6,y:1,width:9,height:9,children:(0,W.jsx)(`path`,{stroke:`none`,d:`M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481`,fill:`#fff`})}),(0,W.jsx)(`g`,{mask:`url(#UnlockedIcon)`,children:(0,W.jsx)(`path`,{stroke:`none`,d:`M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z`,fill:`currentColor`})})]}),Y),Ky=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z`}),(0,W.jsx)(`path`,{d:`M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z`}),(0,W.jsx)(`path`,{d:`M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916`})]}),Y),qy=q((0,W.jsx)(`g`,{fill:`currentColor`,children:(0,W.jsx)(`path`,{d:`M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3`})}),{width:24,height:24}),Jy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:41,height:94,fill:`none`}),Yy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:85,height:71,fill:`none`}),Xy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:38,height:78,fill:`none`});q((0,W.jsx)(`g`,{fill:`currentColor`,children:(0,W.jsx)(`path`,{d:`M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z`,fill:`currentColor`})}),{width:40,height:40,fill:`none`});var Zy=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z`}),(0,W.jsx)(`path`,{d:`M13.5 13.5l4.5 4.5`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),Qy=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,children:[(0,W.jsx)(`path`,{d:`M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255`}),(0,W.jsx)(`path`,{d:`M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 17c0 1.42 .316 2.805 1 4`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),$y=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})]}),J),eb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z`})]}),J),tb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),J),nb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`16`,x2:`19`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`8`,x2:`19`,y2:`12`})]}),J),rb=q((0,W.jsx)(`path`,{d:`M4.167 10h11.666`,strokeWidth:`1.5`}),Y),ib=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z`}),(0,W.jsx)(`path`,{d:`M16 7h4`}),(0,W.jsx)(`path`,{d:`M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3`})]}),J),ab=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z`}),(0,W.jsx)(`path`,{d:`m11.25 5.417 3.333 3.333`})]}),Y),ob=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`7`,y2:`20`}),(0,W.jsx)(`line`,{x1:`14`,y1:`20`,x2:`21`,y2:`20`}),(0,W.jsx)(`line`,{x1:`6.9`,y1:`15`,x2:`13.8`,y2:`15`}),(0,W.jsx)(`line`,{x1:`10.2`,y1:`6.3`,x2:`16`,y2:`20`}),(0,W.jsx)(`polyline`,{points:`5 20 11 4 13 4 20 20`})]}),J),sb=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,W.jsx)(`path`,{d:`M10 5v14`}),(0,W.jsx)(`path`,{d:`M12 19h-4`}),(0,W.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,W.jsx)(`path`,{d:`M18 12v7`}),(0,W.jsx)(`path`,{d:`M17 19h2`})]}),J),cb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M12.5 6.667h.01`}),(0,W.jsx)(`path`,{d:`M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z`}),(0,W.jsx)(`path`,{d:`m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166`}),(0,W.jsx)(`path`,{d:`m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667`})]}),Y),lb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3`}),(0,W.jsx)(`path`,{d:`M18 13.3l-6.3 -6.3`})]}),J),ub=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M10 4.167v11.666M4.167 10h11.666`}),Y),db=q((0,W.jsx)(`path`,{d:`M5 10h10`,strokeWidth:`1.25`}),Y),fb=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M21 21l-6 -6`}),(0,W.jsx)(`path`,{d:`M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403`}),(0,W.jsx)(`path`,{d:`M3 4v4h4`})]}),J),pb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5`}),Y),mb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`polyline`,{points:`12 16 18 10 12 4`}),(0,W.jsx)(`polyline`,{points:`8 4 2 10 8 16`})]}),Y),hb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z`}),(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z`})]}),Y),gb=q((0,W.jsx)(`path`,{clipRule:`evenodd`,d:`M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z`,stroke:`currentColor`}),Y),_b=q((0,W.jsx)(`g`,{stroke:`currentColor`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667`})}),{...Y,strokeWidth:1.5}),vb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`6`,x2:`20`,y2:`6`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`line`,{x1:`4`,y1:`18`,x2:`20`,y2:`18`})]}),J),yb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10`}),Y),bb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J),xb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J),Sb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5`}),Y),Cb=q((0,W.jsx)(`path`,{d:`M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5`,strokeWidth:`1.25`}),Y),wb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0`}),(0,W.jsx)(`path`,{d:`M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084`})]}),Y),Tb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 4l11.733 16h4.267l-11.733 -16z`}),(0,W.jsx)(`path`,{d:`M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772`})]}),J),Eb=q((0,W.jsx)(`polyline`,{fill:`none`,stroke:`currentColor`,points:`20 6 9 17 4 12`}),{width:24,height:24}),Db=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416`}),(0,W.jsx)(`path`,{d:`M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416`})]}),Y),Ob=q(`M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z`,{width:448,height:512}),kb=q(`M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z`,{width:448,height:512}),Ab=q((0,W.jsx)(`path`,{d:`m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z`,strokeWidth:`1.25`}),Y);q(`M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z`,{width:384,height:512}),q(`M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z`);var jb=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z`}),(0,W.jsx)(`path`,{d:`M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z`}),(0,W.jsx)(`path`,{d:`M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208`})]}),J),Mb=q((0,W.jsx)(`g`,{strokeWidth:1.5,children:(0,W.jsx)(`path`,{d:`M6 18l12 -12`})}),J),Nb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 8h.01`}),(0,W.jsx)(`path`,{d:`M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5`}),(0,W.jsx)(`path`,{d:`M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4`}),(0,W.jsx)(`path`,{d:`M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598`}),(0,W.jsx)(`path`,{d:`M19 16v6`}),(0,W.jsx)(`path`,{d:`M22 19l-3 3l-3 -3`})]}),J),Pb=q(`M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z`,{width:512,height:512});q(`M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z`,{width:448,height:512}),q(`M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z`,{width:448,height:512});var Fb=q(`M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z`);q(`M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z`);var Ib=q((0,W.jsx)(`path`,{d:`M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5`,strokeWidth:`1.25`}),Y),Lb=q((0,W.jsx)(`path`,{d:`M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5`,strokeWidth:`1.25`}),Y),Rb=q(`M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z`,{mirror:!0}),zb=q((0,W.jsx)(`path`,{d:`M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834`,strokeWidth:`1.5`}),Y);q(`M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z`),q(`M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z`,{width:24,height:24}),q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1`}),(0,W.jsx)(`path`,{d:`M12 14v-11`}),(0,W.jsx)(`path`,{d:`M9 6l3 -3l3 3`})]}),J),q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{fill:`currentColor`,d:`M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z`}),(0,W.jsx)(`path`,{stroke:`currentColor`,fill:`currentColor`,d:`M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z`})]}),{width:64,height:64}),q((0,W.jsx)(`path`,{stroke:`currentColor`,strokeWidth:`40`,fill:`currentColor`,d:`M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z`}),{width:1024});var Bb=(0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 10l0 10`}),(0,W.jsx)(`path`,{d:`M12 10l4 4`}),(0,W.jsx)(`path`,{d:`M12 10l-4 4`}),(0,W.jsx)(`path`,{d:`M4 4l16 0`})]}),Vb=(0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 5l0 14`}),(0,W.jsx)(`path`,{d:`M16 9l-4 -4`}),(0,W.jsx)(`path`,{d:`M8 9l4 -4`})]}),Hb=q(Vb,J),Ub=q(Vb,{...J,style:{transform:`rotate(180deg)`}}),Wb=q(Bb,J),Gb=q(Bb,{...J,style:{transform:`rotate(180deg)`}}),Kb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),qb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Jb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Yb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M16.667 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Xb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M16.667 3.333v13.334M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Zb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333h13.334M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Qb=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M1.667 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M8.333 10h3.334`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M15.417 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z`})]}),Y),$b=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M10 18.333v-2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10 11.667V8.333`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10 4.583V1.667`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z`})]}),Y),ex=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,W.jsx)(`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`}),(0,W.jsx)(`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`}),(0,W.jsx)(`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`})]}),J);q(`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z`);var tx=q(`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z`),nx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M15 5 5 15M5 5l10 10`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y);q(`M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z`,{mirror:!0}),q(`M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z`,{width:24}),q(`M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z`,{width:384,height:512});var rx=H.memo(({theme:e})=>q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsxs)(`g`,{fill:Ly(e),stroke:Iy(e),strokeWidth:`6`,children:[(0,W.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`2.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`2.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),ix=H.memo(({theme:e})=>q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsxs)(`g`,{fill:Ly(e),stroke:Iy(e),strokeWidth:`6`,children:[(0,W.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`78.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`78.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`105.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`2.5`,y:`102.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),ax=q((0,W.jsx)(`g`,{strokeWidth:1.25,children:(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793`})}),Y),ox=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`FillHachureIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:2,y:2,width:16,height:16,children:(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`1.25`})}),(0,W.jsx)(`g`,{mask:`url(#FillHachureIcon)`,children:(0,W.jsx)(`path`,{d:`M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),Y),sx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,children:[(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`FillCrossHatchIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:-1,y:-1,width:22,height:22,children:(0,W.jsx)(`path`,{d:`M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`g`,{mask:`url(#FillCrossHatchIcon)`,children:(0,W.jsx)(`path`,{d:`M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z`,fill:`currentColor`})})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),cx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z`,stroke:`currentColor`,strokeWidth:`1.25`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),{...Y,fill:`currentColor`}),lx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`path`,{d:`M4.167 10h11.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),Y),ux=q((0,W.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),Y),dx=q((0,W.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`3.75`,strokeLinecap:`round`,strokeLinejoin:`round`}),Y);H.memo(({theme:e})=>q((0,W.jsx)(`path`,{d:`M6 10H34`,stroke:Iy(e),strokeWidth:2,fill:`none`,strokeLinecap:`round`}),{width:40,height:20}));var fx=q((0,W.jsxs)(`g`,{strokeWidth:`2`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12h2`}),(0,W.jsx)(`path`,{d:`M17 12h2`}),(0,W.jsx)(`path`,{d:`M11 12h2`})]}),J),px=q((0,W.jsxs)(`g`,{strokeWidth:`2`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 12v.01`}),(0,W.jsx)(`path`,{d:`M8 12v.01`}),(0,W.jsx)(`path`,{d:`M12 12v.01`}),(0,W.jsx)(`path`,{d:`M16 12v.01`}),(0,W.jsx)(`path`,{d:`M20 12v.01`})]}),J),mx=q((0,W.jsx)(`path`,{d:`M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814`,strokeWidth:`1.25`}),Y),hx=q((0,W.jsx)(`path`,{d:`M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43`,strokeWidth:`1.25`}),Y),gx=q((0,W.jsx)(`path`,{d:`M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42`,strokeWidth:`1.25`}),Y),_x=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{d:`M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10`}),(0,W.jsx)(`path`,{d:`M13.3333 3.33331V3.34331`}),(0,W.jsx)(`path`,{d:`M16.6667 3.33331V3.34331`}),(0,W.jsx)(`path`,{d:`M16.6667 6.66669V6.67669`}),(0,W.jsx)(`path`,{d:`M16.6667 10V10.01`}),(0,W.jsx)(`path`,{d:`M3.33334 13.3333V13.3433`}),(0,W.jsx)(`path`,{d:`M16.6667 13.3333V13.3433`}),(0,W.jsx)(`path`,{d:`M3.33334 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M6.66666 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M10 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M13.3333 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M16.6667 16.6667V16.6767`})]}),Y),vx=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 12v-4a4 4 0 0 1 4 -4h4`}),(0,W.jsx)(`line`,{x1:`16`,y1:`4`,x2:`16`,y2:`4.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`4`,x2:`20`,y2:`4.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`8`,x2:`20`,y2:`8.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`12`,x2:`20`,y2:`12.01`}),(0,W.jsx)(`line`,{x1:`4`,y1:`16`,x2:`4`,y2:`16.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`16`,x2:`20`,y2:`16.01`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`4`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`8`,y1:`20`,x2:`8`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`12`,y1:`20`,x2:`12`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`16`,y1:`20`,x2:`16`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`20`,x2:`20`,y2:`20.01`})]}),J),yx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,opacity:.3,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H19`}),(0,W.jsx)(`path`,{d:`M25,6 L33,16 M33,6 L25,16`})]}),Ry)),bx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M7,11 H33 M23,5 L33,11 L23,17`})}),Ry)),xx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H23`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Ry)),Sx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H23`}),(0,W.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Ry)),Cx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,children:[(0,W.jsx)(`path`,{d:`M7,11 H25`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Ry)),wx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M7,11 H25`,strokeLinecap:`round`}),(0,W.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Ry)),Tx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H21`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Ry)),Ex=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,strokeWidth:2,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H21`}),(0,W.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Ry)),Dx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:(0,W.jsx)(`path`,{d:`M11,11 H31 M31,5 V17`})}),Ry)),Ox=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,5 V17`})}),Ry)),kx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,11 L7,5 M15,11 L7,17`})}),Ry)),Ax=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17`})}),Ry)),jx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,5 V17 M7,5 V17`})}),Ry)),Mx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M35,11 H19 M11,11 H7 M7,5 V17`}),(0,W.jsx)(`circle`,{cx:`15`,cy:`11`,r:`4`})]}),Ry)),Nx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17`}),(0,W.jsx)(`circle`,{cx:`23`,cy:`11`,r:`4`})]}),Ry)),Px=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Fx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M5 16.667V3.333L10 15l5-11.667v13.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Ix=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M5.833 3.333v13.334h8.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Lx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`path`,{d:`m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),Y),Rx=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,W.jsx)(`path`,{d:`M10 5v14`}),(0,W.jsx)(`path`,{d:`M12 19h-4`}),(0,W.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,W.jsx)(`path`,{d:`M18 12v7`}),(0,W.jsx)(`path`,{d:`M17 19h2`})]}),J),zx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 12h10`}),(0,W.jsx)(`path`,{d:`M7 5v14`}),(0,W.jsx)(`path`,{d:`M17 5v14`}),(0,W.jsx)(`path`,{d:`M15 19h4`}),(0,W.jsx)(`path`,{d:`M15 5h4`}),(0,W.jsx)(`path`,{d:`M5 19h4`}),(0,W.jsx)(`path`,{d:`M5 5h4`})]})}),J),Bx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334`})})}),Y),Vx=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,W.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,W.jsx)(`path`,{d:`M14 4l-4 16`})]}),J),Hx=Vx,Ux=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`12`,y2:`12`}),(0,W.jsx)(`line`,{x1:`4`,y1:`16`,x2:`16`,y2:`16`})]}),J),Wx=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`}),(0,W.jsx)(`line`,{x1:`6`,y1:`16`,x2:`18`,y2:`16`})]}),J),Gx=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`10`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`line`,{x1:`8`,y1:`16`,x2:`20`,y2:`16`})]}),J),Kx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`4`}),(0,W.jsx)(`rect`,{x:`9`,y:`8`,width:`6`,height:`12`,rx:`2`})]}),J)),qx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`2`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`20`,y2:`20`}),(0,W.jsx)(`rect`,{x:`9`,y:`4`,width:`6`,height:`12`,rx:`2`})]}),J)),Jx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`9`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`rect`,{x:`9`,y:`6`,width:`6`,height:`12`,rx:`2`})]}),J)),Yx=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M21 19h-18l9 -15`}),(0,W.jsx)(`path`,{d:`M20.615 15.171h.015`}),(0,W.jsx)(`path`,{d:`M19.515 11.771h.015`}),(0,W.jsx)(`path`,{d:`M17.715 8.671h.015`}),(0,W.jsx)(`path`,{d:`M15.415 5.971h.015`})]}),J),Xx=q((0,W.jsx)(`path`,{d:`M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z`,fill:`currentColor`}),{width:640,height:512});q((0,W.jsx)(`path`,{d:`M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z`}));var Zx=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,W.jsx)(`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`}),(0,W.jsx)(`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,W.jsx)(`path`,{d:`M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47`})]}),J),Qx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`}),(0,W.jsx)(`path`,{d:`M7 11l5 5l5 -5`}),(0,W.jsx)(`path`,{d:`M12 4l0 12`})]}),J),$x=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2`})]}),J),eS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M9.15 14.85l8.85 -10.85`}),(0,W.jsx)(`path`,{d:`M6 4l8.85 10.85`})]}),J),tS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 .01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J);q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 4v16l13 -8z`})]}),J),q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z`,strokeWidth:`0`,fill:`currentColor`})]}),J);var nS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]}),J),rS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z`}),(0,W.jsx)(`path`,{d:`M12 9v4`}),(0,W.jsx)(`path`,{d:`M12 17h.01`})]}),J),iS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11 7l6 6`}),(0,W.jsx)(`path`,{d:`M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z`})]}),J),aS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 3l-4 7h8z`}),(0,W.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z`})]}),J),oS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 7l16 0`}),(0,W.jsx)(`path`,{d:`M4 17l16 0`}),(0,W.jsx)(`path`,{d:`M7 4l0 16`}),(0,W.jsx)(`path`,{d:`M17 4l0 16`})]}),J),sS=q((0,W.jsx)(`path`,{fill:`currentColor`,d:`M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z`})),cS=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`}),(0,W.jsx)(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})]}),J),lS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 10l-2 1l8 4l8 -4l-2 -1`}),(0,W.jsx)(`path`,{d:`M4 15l8 4l8 -4`}),(0,W.jsx)(`path`,{d:`M12 4v7`}),(0,W.jsx)(`path`,{d:`M15 8l-3 3l-3 -3`})]}),J),uS=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M4.16602 10H15.8327`}),(0,W.jsx)(`path`,{d:`M12.5 13.3333L15.8333 10`}),(0,W.jsx)(`path`,{d:`M12.5 6.66666L15.8333 9.99999`})]}),Y),dS=q((0,W.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`rotate(90 10 10)`,children:[(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z`}),(0,W.jsx)(`path`,{d:`m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13`})]}),20),fS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,W.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,W.jsx)(`path`,{d:`M15 6l3 3`}),(0,W.jsx)(`path`,{d:`M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`}),(0,W.jsx)(`path`,{d:`M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,W.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,W.jsx)(`path`,{d:`M15 6l3 3`}),(0,W.jsx)(`path`,{d:`M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`}),(0,W.jsx)(`path`,{d:`M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`})]}),J),q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35`}),(0,W.jsx)(`path`,{d:`M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946`}),(0,W.jsx)(`path`,{d:`M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348`}),(0,W.jsx)(`path`,{d:`M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45`}),(0,W.jsx)(`path`,{d:`M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946`}),(0,W.jsx)(`path`,{d:`M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42`})]}),J);var pS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`}),(0,W.jsx)(`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`}),(0,W.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`}),(0,W.jsx)(`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`})]}),J),mS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0`}),(0,W.jsx)(`path`,{d:`M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6`})]}),J),hS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.585 10.587a2 2 0 0 0 2.829 2.828`}),(0,W.jsx)(`path`,{d:`M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87`}),(0,W.jsx)(`path`,{d:`M3 3l18 18`})]}),J),gS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,W.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,W.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,W.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),J),_S=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,W.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,W.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,W.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),J),vS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`}),(0,W.jsx)(`path`,{d:`M21 21l-6 -6`})]}),J),yS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20.984 12.53a9 9 0 1 0 -7.552 8.355`}),(0,W.jsx)(`path`,{d:`M12 7v5l3 3`}),(0,W.jsx)(`path`,{d:`M19 16l-2 3h4l-2 3`})]}),J),bS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 8l0 4l2 2`}),(0,W.jsx)(`path`,{d:`M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5`})]}),J),xS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z`}),(0,W.jsx)(`path`,{d:`M5 10a7 7 0 0 0 14 0`}),(0,W.jsx)(`path`,{d:`M8 21l8 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 4`})]}),J),SS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 3l18 18`}),(0,W.jsx)(`path`,{d:`M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1`}),(0,W.jsx)(`path`,{d:`M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85`}),(0,W.jsx)(`path`,{d:`M8 21l8 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 4`})]}),J),CS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`})]}),J),wS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M12 20v.01`}),(0,W.jsx)(`path`,{d:`M16 20v.01`}),(0,W.jsx)(`path`,{d:`M8 20v.01`}),(0,W.jsx)(`path`,{d:`M4 20v.01`}),(0,W.jsx)(`path`,{d:`M4 16v.01`}),(0,W.jsx)(`path`,{d:`M4 12v.01`}),(0,W.jsx)(`path`,{d:`M4 8v.01`}),(0,W.jsx)(`path`,{d:`M4 4v.01`}),(0,W.jsx)(`path`,{d:`M8 4v.01`}),(0,W.jsx)(`path`,{d:`M12 4v.01`}),(0,W.jsx)(`path`,{d:`M16 4v.01`}),(0,W.jsx)(`path`,{d:`M20 4v.01`}),(0,W.jsx)(`path`,{d:`M20 8v.01`}),(0,W.jsx)(`path`,{d:`M20 12v.01`}),(0,W.jsx)(`path`,{d:`M20 16v.01`}),(0,W.jsx)(`path`,{d:`M20 20v.01`})]}),J),TS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 3v18`}),(0,W.jsx)(`path`,{d:`M19 21v-18`}),(0,W.jsx)(`path`,{d:`M5 7h14`}),(0,W.jsx)(`path`,{d:`M5 15h14`}),(0,W.jsx)(`path`,{d:`M8 13v4`}),(0,W.jsx)(`path`,{d:`M11 13v4`}),(0,W.jsx)(`path`,{d:`M16 13v4`}),(0,W.jsx)(`path`,{d:`M14 5v4`}),(0,W.jsx)(`path`,{d:`M11 5v4`}),(0,W.jsx)(`path`,{d:`M8 5v4`}),(0,W.jsx)(`path`,{d:`M3 21h18`})]}),J),ES=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 12l18 0`}),(0,W.jsx)(`path`,{d:`M7 16l10 0l-10 5l0 -5`}),(0,W.jsx)(`path`,{d:`M7 8l10 0l-10 -5l0 5`})]}),J),DS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 3l0 18`}),(0,W.jsx)(`path`,{d:`M16 7l0 10l5 0l-5 -10`}),(0,W.jsx)(`path`,{d:`M8 7l0 10l-5 0l5 -10`})]}),J),OS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2`}),(0,W.jsx)(`path`,{d:`M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`})]}),J),kS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0`}),(0,W.jsx)(`path`,{d:`M22 22l-3 -3`}),(0,W.jsx)(`path`,{d:`M6 18h-1a2 2 0 0 1 -2 -2v-1`}),(0,W.jsx)(`path`,{d:`M3 11v-1`}),(0,W.jsx)(`path`,{d:`M3 6v-1a2 2 0 0 1 2 -2h1`}),(0,W.jsx)(`path`,{d:`M10 3h1`}),(0,W.jsx)(`path`,{d:`M15 3h1a2 2 0 0 1 2 2v1`})]}),J),AS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,W.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,W.jsx)(`path`,{d:`M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75`}),(0,W.jsx)(`path`,{d:`M10 15l2 6l2 -6`}),(0,W.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`})]}),J),jS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,W.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,W.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`}),(0,W.jsx)(`path`,{d:`M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6`}),(0,W.jsx)(`path`,{d:`M11 21v-6l3 6v-6`})]}),J),MS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0`}),(0,W.jsx)(`path`,{d:`M4 8l5 0`}),(0,W.jsx)(`path`,{d:`M15 8l4 0`})]}),J),NS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1`}),(0,W.jsx)(`path`,{d:`M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,W.jsx)(`path`,{d:`M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,W.jsx)(`path`,{d:`M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z`}),(0,W.jsx)(`path`,{d:`M16.746 16.726a3 3 0 1 0 .252 -5.555`})]}),J),PS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4`})]}),{...J,strokeWidth:1.5});q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`}),(0,W.jsx)(`path`,{d:`M21 12h-13l3 -3`}),(0,W.jsx)(`path`,{d:`M11 15l-3 -3`})]}),J);var FS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z`}),(0,W.jsx)(`path`,{d:`M10 9l5 3l-5 3z`})]}),J),IS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 6h18`}),(0,W.jsx)(`path`,{d:`M3 12h18`}),(0,W.jsx)(`path`,{d:`M3 18h18`}),(0,W.jsx)(`path`,{d:`M6 3v18`}),(0,W.jsx)(`path`,{d:`M12 3v18`}),(0,W.jsx)(`path`,{d:`M18 3v18`})]}),J),LS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M17 5c-6.627 0 -12 5.373 -12 12`})]}),J),RS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 18l12 -12`}),(0,W.jsx)(`path`,{d:`M18 10v-4h-4`})]}),J),zS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7`}),(0,W.jsx)(`path`,{d:`M18 4l3 3l-3 3`})]}),J),BS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{d:`M16,12L20,9L16,6`}),(0,W.jsx)(`path`,{d:`M6 20c0 -6.075 4.925 -11 11 -11h3`})]}),J),VS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 9l6 6l6 -6`})]}),J),HS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),J),US=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),J),WS=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 5v10a1 1 0 0 0 1 1h10`}),(0,W.jsx)(`path`,{d:`M5 8h10a1 1 0 0 1 1 1v10`})]}),J),GS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 7l0 10`}),(0,W.jsx)(`path`,{d:`M7 5l10 0`}),(0,W.jsx)(`path`,{d:`M7 19l10 0`}),(0,W.jsx)(`path`,{d:`M19 7l0 10`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1`}),(0,W.jsx)(`path`,{d:`M4 12h7a1 1 0 0 1 1 1v7`})]}),J);var KS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 6l8 0`}),(0,W.jsx)(`path`,{d:`M16 6l4 0`}),(0,W.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 12l2 0`}),(0,W.jsx)(`path`,{d:`M10 12l10 0`}),(0,W.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 18l11 0`}),(0,W.jsx)(`path`,{d:`M19 18l1 0`})]}),J),qS=q((0,W.jsxs)(`g`,{strokeWidth:1,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4`})]}),J),JS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,W.jsx)(`path`,{d:`M13.5 6.5l4 4`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11 7l-5 5l5 5`}),(0,W.jsx)(`path`,{d:`M17 7l-5 5l5 5`})]}),J);var YS=q((0,W.jsxs)(`g`,{strokeWidth:`1.75`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M15 4l0 16`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1`})]}),J),q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 4l18 0`}),(0,W.jsx)(`path`,{d:`M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10`}),(0,W.jsx)(`path`,{d:`M12 16l0 4`}),(0,W.jsx)(`path`,{d:`M9 20l6 0`}),(0,W.jsx)(`path`,{d:`M8 12l3 -3l2 2l3 -3`})]}),J);var XS=(0,W.jsx)(`div`,{style:{width:`1rem`,height:`1rem`}}),ZS=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`polyline`,{points:`9 6 15 12 9 18`})]}),J),QS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 6l8 0`}),(0,W.jsx)(`path`,{d:`M16 6l4 0`}),(0,W.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 12l2 0`}),(0,W.jsx)(`path`,{d:`M10 12l10 0`}),(0,W.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 18l11 0`}),(0,W.jsx)(`path`,{d:`M19 18l1 0`})]}),J),$S=({size:e=`1em`,circleWidth:t=8,synchronized:n=!1,className:r=``})=>{let i=-(H.useRef(Date.now()).current%1600);return(0,W.jsx)(`div`,{className:`Spinner ${r}`,children:(0,W.jsx)(`svg`,{viewBox:`0 0 100 100`,style:{width:e,height:e,"--spinner-delay":n?`${i}ms`:0},children:(0,W.jsx)(`circle`,{cx:`50`,cy:`50`,r:50-t/2,strokeWidth:t,fill:`none`,strokeMiterlimit:`10`})})})},X=H.forwardRef(({size:e=`medium`,visible:t=!0,className:n=``,...r},i)=>{let{id:a}=oz(),o=H.useRef(null);H.useImperativeHandle(i,()=>o.current);let s=`ToolIcon_size_${e}`,[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(!0),d=async e=>{let t=`onClick`in r&&r.onClick?.(e);if(ge(t))try{l(!0),await t}catch(e){if(e instanceof E)console.warn(e);else throw e}finally{u.current&&l(!1)}};(0,H.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let f=(0,H.useRef)(null);if(r.type===`button`||r.type===`icon`||r.type===`submit`){let e=r.type===`icon`?`button`:r.type;return(0,W.jsxs)(`button`,{className:U(`ToolIcon_type_button`,s,n,t&&!r.hidden?`ToolIcon_type_button--show`:`ToolIcon_type_button--hide`,{ToolIcon:!r.hidden,"ToolIcon--selected":r.selected,"ToolIcon--plain":r.type===`icon`}),style:r.style,"data-testid":r[`data-testid`],hidden:r.hidden,title:r.title,"aria-label":r[`aria-label`],type:e,onClick:d,ref:o,disabled:c||r.isLoading||!!r.disabled,children:[(r.icon||r.label)&&(0,W.jsxs)(`div`,{className:`ToolIcon__icon`,"aria-hidden":`true`,"aria-disabled":!!r.disabled,children:[r.icon||r.label,r.keyBindingLabel&&(0,W.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel}),r.isLoading&&(0,W.jsx)($S,{})]}),r.showAriaLabel&&(0,W.jsxs)(`div`,{className:`ToolIcon__label`,children:[r[`aria-label`],` `,c&&(0,W.jsx)($S,{})]}),r.children]})}return(0,W.jsxs)(`label`,{className:U(`ToolIcon`,n),title:r.title,onPointerDown:e=>{f.current=e.pointerType||null,r.onPointerDown?.({pointerType:e.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{f.current=null})},children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_radio ${s}`,type:`radio`,name:r.name,"aria-label":r[`aria-label`],"aria-keyshortcuts":r[`aria-keyshortcuts`],"data-testid":r[`data-testid`],id:`${a}-${r.id}`,onChange:()=>{r.onChange?.({pointerType:f.current})},checked:r.checked,ref:o}),(0,W.jsxs)(`div`,{className:`ToolIcon__icon`,children:[r.icon,r.keyBindingLabel&&(0,W.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel})]})]})});X.displayName=`ToolButton`;var eC=[],Z=e=>(eC=eC.concat(e),e),tC=(e,t,n)=>{let r=new Set(ir(e.filter(e=>L(e)),t).map(e=>e.id)),i={},a=n.scene.getNonDeletedElementsMap(),o=new Set;for(let t of r){let n=Di(e,t);for(let e of n)if(!o.has(e.id)){if(ya(e)){let t=so(e,a);t&&(i[t.id]=!0)}else i[e.id]=!0;o.add(e.id)}}let s=!0,c=e.map(e=>{if(t.selectedElementIds[e.id]){let t=ya(e)?so(e,a):null;return e.frameId&&r.has(e.frameId)?(s=!1,i[e.id]=!0,e):t?.frameId&&r.has(t?.frameId)?e:(e.boundElements&&e.boundElements.forEach(t=>{let r=n.scene.getNonDeletedElementsMap().get(t.id);r&&dr(r)&&n.scene.mutateElement(r,{startBinding:e.id===r.startBinding?.elementId?null:r.startBinding,endBinding:e.id===r.endBinding?.elementId?null:r.endBinding})}),B(e,{isDeleted:!0}))}return e.frameId&&r.has(e.frameId)?(s=!1,ya(e)||(i[e.id]=!0),B(e,{frameId:null})):ya(e)&&t.selectedElementIds[e.containerId]?B(e,{isDeleted:!0}):e}),l=t.editingGroupId;if(s&&t.editingGroupId){let e=Ki(c,t.editingGroupId).filter(e=>!e.isDeleted);if(e.length>1)e[0]&&(i[e[0].id]=!0);else{l=null,e[0]&&(i[e[0].id]=!0);let n=e[0];if(n){let e=n.groupIds.findIndex(e=>e===t.editingGroupId),r=n.groupIds[e+1];if(r){let e=Ki(c,r).filter(e=>!e.isDeleted);e.length>1&&(l=r,e.forEach(e=>{i[e.id]=!0}))}}}}return{elements:c,appState:{...t,...Hr({selectedElementIds:i,editingGroupId:l},c,t,null)}}},nC=(e,t)=>{if(e.editingGroupId){let n=Ki(Cs(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},rC=Z({name:`deleteSelectedElements`,label:`labels.delete`,icon:pb,trackEvent:{category:`element`,action:`delete`},perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing){let{elementId:n,selectedPointsIndices:i}=t.selectedLinearElement,a=r.scene.getNonDeletedElementsMap(),o=I.getElement(n,a);if(!o||i==null)return!1;if(i.length>=o.points.length){let n=e.map(e=>e.id===o.id?B(e,{isDeleted:!0}):e);return{elements:n,appState:{...nC(t,n),selectedLinearElement:null},captureUpdate:V.IMMEDIATELY}}return I.deletePoints(o,r,i),{elements:e,appState:{...t,selectedLinearElement:{...t.selectedLinearElement,selectedPointsIndices:i?.[0]>0?[i[0]-1]:[0]}},captureUpdate:V.IMMEDIATELY}}let{elements:i,appState:a}=tC(e,t,r);return Go(i,i.filter(e=>e.isDeleted)),a=nC(a,i),{elements:i,appState:{...a,activeTool:ka(t,{type:r.state.preferredSelectionTool.type}),multiElement:null,newElement:null,activeEmbeddable:null,selectedLinearElement:null},captureUpdate:Ya(Cs(e),t)?V.IMMEDIATELY:V.EVENTUALLY}},keyTest:(e,t,n)=>(e.key===N.BACKSPACE||e.key===N.DELETE)&&!e[N.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:pb,title:K(`labels.delete`),"aria-label":K(`labels.delete`),onClick:()=>n(null),disabled:!Ya(Cs(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?Bs:{}}})}}),Q=e=>e.replace(/\b(Opt(?:ion)?|Alt)\b/i,K(di?`keys.option`:`keys.alt`)).replace(/\bShift\b/i,K(`keys.shift`)).replace(/\b(Enter|Return)\b/i,K(`keys.enter`)).replace(/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,K(di?`keys.cmd`:`keys.ctrl`)).replace(/\b(Esc(?:ape)?)\b/i,K(`keys.escape`)).replace(/\b(Space(?:bar)?)\b/i,K(`keys.spacebar`)).replace(/\b(Del(?:ete)?)\b/i,K(`keys.delete`)),iC=Z({name:`sendBackward`,label:`labels.sendBackward`,keywords:[`move down`,`zindex`,`layer`],icon:Ub,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Ua(e,t,r.scene),appState:t,captureUpdate:V.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Gs.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.sendBackward`)} \u2014 ${Q(`CtrlOrCmd+[`)}`,children:Ub})}),aC=Z({name:`bringForward`,label:`labels.bringForward`,keywords:[`move up`,`zindex`,`layer`],icon:Hb,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:bi(e,t,r.scene),appState:t,captureUpdate:V.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Gs.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.bringForward`)} \u2014 ${Q(`CtrlOrCmd+]`)}`,children:Hb})}),oC=Z({name:`sendToBack`,label:`labels.sendToBack`,keywords:[`move down`,`zindex`,`layer`],icon:Gb,trackEvent:{category:`element`},perform:(e,t)=>({elements:xa(e,t),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>di?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.BRACKET_LEFT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===Gs.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.sendToBack`)} \u2014 ${Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)}`,children:Gb})}),sC=Z({name:`bringToFront`,label:`labels.bringToFront`,keywords:[`move up`,`zindex`,`layer`],icon:Wb,trackEvent:{category:`element`},perform:(e,t)=>({elements:Ft(e,t),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>di?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.BRACKET_RIGHT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===Gs.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:t=>e(null),title:`${K(`labels.bringToFront`)} \u2014 ${Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)}`,children:Wb})}),cC=Z({name:`selectAll`,label:`labels.selectAll`,icon:wS,trackEvent:{category:`canvas`},viewMode:!1,perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing)return!1;let i=e.filter(e=>!e.isDeleted&&!(M(e)&&e.containerId)&&!e.locked).reduce((e,t)=>(e[t.id]=!0,e),{});return{appState:{...t,...Hr({editingGroupId:null,selectedElementIds:i},Cs(e),t,r),selectedLinearElement:Object.keys(i).length===1&&b(e[0])?new I(e[0],lr(e)):null},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.A}),lC=Z({name:`duplicateSelection`,label:`labels.duplicateSelection`,icon:hb,trackEvent:{category:`element`},perform:(e,t,n,r)=>{if(t.selectedElementsAreBeingDragged)return!1;if(t.selectedLinearElement?.isEditing)try{return{elements:e,appState:I.duplicateSelectedPoints(t,r.scene),captureUpdate:V.IMMEDIATELY}}catch{return!1}let{duplicatedElements:i,elementsWithDuplicates:a}=Er({type:`in-place`,elements:e,idsOfElementsToDuplicate:lr(ir(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),appState:t,randomizeSeed:!0,overrides:({origElement:e,origIdToDuplicateId:t})=>{let n=e.frameId&&t.get(e.frameId);return{x:e.x+20/2,y:e.y+20/2,frameId:n??e.frameId}}});if(r.props.onDuplicate&&a){let t=r.props.onDuplicate(a,e);t&&(a=t)}return{elements:fe(a,lr(i)),appState:{...t,...Br(i,Cs(a),t)},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.D,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:hb,title:`${K(`labels.duplicateSelection`)} \u2014 ${Q(`CtrlOrCmd+D`)}`,"aria-label":K(`labels.duplicateSelection`),onClick:()=>n(null),disabled:!Ya(Cs(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?Bs:{}}})}}),uC=new Set([`command_palette`,`export`]),dC=(e,t,n,i)=>{try{if(typeof window>`u`||r.VITE_WORKER_ID||r.VITE_APP_ENABLE_TRACKING!==`true`||!uC.has(e)||Vt())return;r.PROD||console.info(`trackEvent`,{category:e,action:t,label:n,value:i}),window.sa_event&&window.sa_event(t,{category:e,label:n,value:i})}catch(e){console.error(`error during analytics`,e)}},fC=(0,H.forwardRef)((e,t)=>{let{title:n,className:r,testId:i,active:a,standalone:o,icon:s,onClick:c}=e;return(0,W.jsx)(`button`,{type:`button`,ref:t,title:n,"data-testid":i,className:U(r,{standalone:o,active:a}),onClick:c,style:e.style,children:s},n)}),pC=e=>(0,W.jsx)(W.Fragment,{children:e.options.map(t=>e.type===`button`?(0,W.jsx)(fC,{icon:t.icon,title:t.text,testId:t.testId,active:t.active??e.value===t.value,onClick:n=>e.onClick(t.value,n)},t.text):(0,W.jsxs)(`label`,{className:U({active:e.value===t.value}),title:t.text,children:[(0,W.jsx)(`input`,{type:`radio`,name:e.group,onChange:()=>e.onChange(t.value),checked:e.value===t.value,"data-testid":t.testId}),t.icon]},t.text))}),mC=()=>(0,W.jsx)(`div`,{style:{width:1,height:`1rem`,backgroundColor:`var(--default-border-color)`,margin:`0 auto`}}),hC=H.createContext(null),gC=()=>H.useContext(hC),_C=e=>{let[t,n]=(0,H.useState)(null),r=iz(),{theme:i}=gC(),{container:a}=oz();return(0,H.useLayoutEffect)(()=>{t&&(t.className=``,t.classList.add(`excalidraw`,...e?.className?.split(/\s+/)||[]),t.classList.toggle(`excalidraw--mobile`,r.formFactor===`phone`),t.classList.toggle(`theme--dark`,i===R.DARK))},[t,i,r.formFactor,e?.className]),(0,H.useLayoutEffect)(()=>{let t=e?.parentSelector?a?.querySelector(e.parentSelector):document.body;if(!t)return;let r=document.createElement(`div`);return t.appendChild(r),n(r),()=>{t.removeChild(r)}},[a,e?.parentSelector]),t};function vC(e,t,n){(0,H.useEffect)(()=>{function r(r){let i=r;if(!e.current)return;let a=n?.(i,e.current);if(a!==!0){if(a===!1)return t(i);e.current.contains(i.target)||!document.documentElement.contains(i.target)||i.target.closest(`[data-radix-portal]`)||i.target===document.documentElement&&document.body.style.pointerEvents===`none`||i.target.closest(`[data-prevent-outside-click]`)||t(i)}}return document.addEventListener(F.POINTER_DOWN,r),document.addEventListener(F.TOUCH_START,r),()=>{document.removeEventListener(F.POINTER_DOWN,r),document.removeEventListener(F.TOUCH_START,r)}},[e,t,n])}var yC=e=>{let t=(0,H.useRef)(e);return Object.assign(t.current,e),t.current},bC=yc(null),xC=({onCancel:e,onChange:t,onSelect:n,colorPickerType:r})=>{let i=_C({className:`excalidraw-eye-dropper-backdrop`,parentSelector:`.excalidraw-eye-dropper-container`}),a=gC(),o=sz(),s=nz(),c=yC({app:s,onCancel:e,onChange:t,onSelect:n,selectedElements:ir(o,a)}),{container:l}=oz();(0,H.useEffect)(()=>{let e=u.current;if(!e||!s.canvas||!i)return;let t=!1,n=s.canvas.getContext(`2d`),o=({clientX:e,clientY:t})=>{let r=n.getImageData((e-a.offsetLeft)*window.devicePixelRatio,(t-a.offsetTop)*window.devicePixelRatio,1,1).data;return S(r[0],r[1],r[2])},d=({clientX:n,clientY:i,altKey:a})=>{e.style.top=`${i+20}px`,e.style.left=`${n+20}px`;let s=o({clientX:n,clientY:i});t&&c.onChange(r,s,c.selectedElements,{altKey:a}),e.style.background=s},f=()=>{c.onCancel()},p=(e,t)=>{c.onSelect(e,t)},m=e=>{t=!0,e.stopImmediatePropagation()},h=e=>{t=!1,l?.focus(),e.stopImmediatePropagation(),e.preventDefault(),p(o(e),e)},g=e=>{e.key===N.ESCAPE&&(e.preventDefault(),e.stopImmediatePropagation(),f())};return i.tabIndex=-1,i.focus(),d({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),i.addEventListener(F.KEYDOWN,g),i.addEventListener(F.POINTER_DOWN,m),i.addEventListener(F.POINTER_UP,h),window.addEventListener(`pointermove`,d,{passive:!0}),window.addEventListener(F.BLUR,f),()=>{t=!1,i.removeEventListener(F.KEYDOWN,g),i.removeEventListener(F.POINTER_DOWN,m),i.removeEventListener(F.POINTER_UP,h),window.removeEventListener(`pointermove`,d),window.removeEventListener(F.BLUR,f)}},[c,s.canvas,i,r,l,a.offsetLeft,a.offsetTop]);let u=(0,H.useRef)(null);return vC(u,()=>{e()},e=>!!e.target.closest(`.excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop`)),i?(0,_c.createPortal)((0,W.jsx)(`div`,{ref:u,className:`excalidraw-eye-dropper-preview`}),i):null},SC=H.forwardRef(({children:e,padding:t,className:n,style:r},i)=>(0,W.jsx)(`div`,{className:U(`Island`,n),style:{"--padding":t,...r},ref:i,children:e})),CC=H.forwardRef(({className:e,container:t,children:n,style:r,onClose:i,onKeyDown:a,onFocusOutside:o,onPointerLeave:s,onPointerDownOutside:c,preventAutoFocusOnTouch:l=!1},u)=>{let d=iz(),f=d.formFactor===`phone`&&!d.isLandscape;return(0,W.jsx)(U_,{container:t,children:(0,W.jsxs)(W_,{ref:u,className:U(`focus-visible-none`,e),"data-prevent-outside-click":!0,side:f?`bottom`:`right`,align:f?`center`:`start`,alignOffset:-16,sideOffset:20,collisionBoundary:t??void 0,style:{zIndex:`var(--zIndex-ui-styles-popup)`,marginLeft:d.formFactor===`phone`?`0.5rem`:void 0},onPointerLeave:s,onKeyDown:a,onFocusOutside:o,onPointerDownOutside:c,onOpenAutoFocus:e=>{l&&d.isTouchScreen&&e.preventDefault()},onCloseAutoFocus:e=>{e.stopPropagation(),e.preventDefault(),t&&!Me(document.activeElement)&&t.focus(),i()},children:[(0,W.jsx)(SC,{padding:3,style:r,children:n}),(0,W.jsx)(G_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})}),wC=()=>document.querySelector(`.excalidraw-wysiwyg`),TC=()=>{let e=wC();return e?{start:e.selectionStart,end:e.selectionEnd}:null},EC=e=>{setTimeout(()=>{let t=wC();t&&(t.focus(),e&&(t.selectionStart=e.start,t.selectionEnd=e.end))},0)},DC=(e,t,n,r)=>{t&&r&&r();let i=t&&n?TC():null;e(),t&&n&&EC(i)},OC=()=>{let[e,t]=(0,H.useState)(null);return{saveCaretPosition:(0,H.useCallback)(()=>{t(TC())},[]),restoreCaretPosition:(0,H.useCallback)(()=>{setTimeout(()=>{let n=wC();n&&(n.focus(),e&&(n.selectionStart=e.start,n.selectionEnd=e.end,t(null)))},0)},[e]),clearSavedPosition:(0,H.useCallback)(()=>{t(null)},[]),hasSavedPosition:!!e}},kC=(e=100)=>{let t=wC();if(t){let n=t.onblur;t.onblur=null,setTimeout(()=>{t.onblur=n},e)}},AC=({palette:e,color:t})=>{if(!t)return null;for(let[n,r]of Object.entries(e))if(Array.isArray(r)){let e=r.indexOf(t);if(e>-1)return{colorName:n,shade:e}}else if(r===t)return{colorName:n,shade:null};return null},jC=[[`q`,`w`,`e`,`r`,`t`],[`a`,`s`,`d`,`f`,`g`],[`z`,`x`,`c`,`v`,`b`]].flat(),MC=({color:e,palette:t})=>!Object.values(t).flat().includes(e),NC=(e,t,n)=>{let r={elementBackground:`backgroundColor`,elementStroke:`strokeColor`},i=e.filter(e=>{if(e.isDeleted)return!1;let i=e[r[t]];return MC({color:i,palette:n})}),a=new Map;return i.forEach(e=>{let n=e[r[t]];a.has(n)?a.set(n,a.get(n)+1):a.set(n,1)}),[...a.entries()].sort((e,t)=>t[1]-e[1]).map(e=>e[0]).slice(0,5)},PC=yc(null),FC=({color:e,onChange:t,label:n,colorPickerType:r,placeholder:i})=>{let a=iz(),[o,s]=(0,H.useState)(e),[c,l]=vy(PC);(0,H.useEffect)(()=>{s(e)},[e]);let u=(0,H.useCallback)(e=>{let n=e.toLowerCase(),r=ma(n);r&&t(r),s(n)},[t]),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{d.current&&d.current.focus()},[c]);let[p,m]=vy(bC);return(0,H.useEffect)(()=>()=>{m(null)},[m]),(0,W.jsxs)(`div`,{className:`color-picker__input-label`,children:[(0,W.jsx)(`div`,{className:`color-picker__input-hash`,children:`#`}),(0,W.jsx)(`input`,{ref:c===`hex`?d:void 0,style:{border:0,padding:0},spellCheck:!1,className:`color-picker-input`,"aria-label":n,onChange:e=>{u(e.target.value)},value:(o||``).replace(/^#/,``),onBlur:()=>{s(e)},tabIndex:-1,onFocus:()=>l(`hex`),onKeyDown:e=>{e.key!==N.TAB&&(e.key===N.ESCAPE&&f.current?.focus(),e.stopPropagation())},placeholder:i}),a.formFactor!==`phone`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{style:{width:`1px`,height:`1.25rem`,backgroundColor:`var(--default-border-color)`}}),(0,W.jsx)(`div`,{ref:f,className:U(`excalidraw-eye-dropper-trigger`,{selected:p}),onClick:()=>m(e=>e?null:{keepOpenOnAlt:!1,onSelect:e=>t(e),colorPickerType:r}),title:`${K(`labels.eyeDropper`)} \u2014 ${N.I.toLocaleUpperCase()} or ${Q(`Alt`)} `,children:iS})]})]})},IC=({color:e,keyLabel:t,isShade:n=!1})=>(0,W.jsxs)(`div`,{className:`color-picker__button__hotkey-label`,style:{color:yt(e)?`#fff`:`#000`},children:[n&&`⇧`,t]}),LC=({colors:e,color:t,onChange:n,label:r})=>{let[i,a]=vy(PC),o=(0,H.useRef)(null);return(0,H.useEffect)(()=>{o.current&&o.current.focus()},[t,i]),(0,W.jsx)(`div`,{className:`color-picker-content--default`,children:e.map((e,i)=>(0,W.jsxs)(`button`,{ref:t===e?o:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:t===e,"is-transparent":e===`transparent`||!e}),onClick:()=>{n(e),a(`custom`)},title:e,"aria-label":r,style:{"--swatch-color":e},children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),(0,W.jsx)(IC,{color:e,keyLabel:i+1})]},i))})},RC=({palette:e,color:t,onChange:n,activeShade:r,showHotKey:i=!0})=>{let a=AC({color:t,palette:e}),[o,s]=vy(PC),c=(0,H.useRef)(null);return(0,H.useEffect)(()=>{c.current&&o===`baseColors`&&c.current.focus()},[a?.colorName,o]),(0,W.jsx)(`div`,{className:`color-picker-content--default`,children:Object.entries(e).map(([e,t],o)=>{let l=(Array.isArray(t)?t[r]:t)||`transparent`,u=jC[o],d=K(`colors.${e.replace(/\d+/,``)}`,null,``);return(0,W.jsxs)(`button`,{ref:a?.colorName===e?c:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:a?.colorName===e,"is-transparent":l===`transparent`||!l}),onClick:()=>{n(l),s(`baseColors`)},title:`${d}${l.startsWith(`#`)?` ${l}`:``} \u2014 ${u}`,"aria-label":`${d} \u2014 ${u}`,style:l?{"--swatch-color":l}:void 0,"data-testid":`color-${e}`,children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),i&&(0,W.jsx)(IC,{color:l,keyLabel:u})]},e)})})},zC=({children:e})=>(0,W.jsx)(`div`,{className:`color-picker__heading`,children:e}),BC=({color:e,onChange:t,palette:n,showHotKey:r})=>{let i=AC({color:e||`transparent`,palette:n}),[a,o]=vy(PC),s=(0,H.useRef)(null);if((0,H.useEffect)(()=>{s.current&&a===`shades`&&s.current.focus()},[i,a]),i){let{colorName:e,shade:c}=i,l=n[e];if(Array.isArray(l))return(0,W.jsx)(`div`,{className:`color-picker-content--default shades`,children:l.map((n,i)=>(0,W.jsxs)(`button`,{ref:i===c&&a===`shades`?s:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:i===c}),"aria-label":`Shade`,title:`${e} - ${i+1}`,style:n?{"--swatch-color":n}:void 0,onClick:()=>{t(n),o(`shades`)},children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),r&&(0,W.jsx)(IC,{color:n,keyLabel:i+1,isShade:!0})]},i))})}return(0,W.jsxs)(`div`,{className:`color-picker-content--default`,style:{position:`relative`},tabIndex:-1,children:[(0,W.jsx)(`button`,{type:`button`,tabIndex:-1,className:`color-picker__button color-picker__button--large color-picker__button--no-focus-visible`}),(0,W.jsx)(`div`,{tabIndex:-1,style:{position:`absolute`,top:0,left:0,right:0,bottom:0,display:`flex`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,fontSize:`0.75rem`},children:K(`colorPicker.noShades`)})]})},VC=(e,t,n)=>{let r=Math.ceil(n/5);switch(t??=-1,e){case`ArrowLeft`:{let e=t-1;return e<0?n-1:e}case`ArrowRight`:return(t+1)%n;case`ArrowDown`:{let e=t+5;return e>=n?t%5:e}case`ArrowUp`:{let e=t-5,i=e<0?5*r+e:e;return i>=n?void 0:i}}},HC=({e,colorObj:t,onChange:n,palette:r,customColors:i,setActiveColorPickerSection:a,activeShade:o})=>{if(t?.shade!=null&&[`Digit1`,`Digit2`,`Digit3`,`Digit4`,`Digit5`].includes(e.code)&&e.shiftKey){let i=Number(e.code.slice(-1))-1;return n(r[t.colorName][i]),a(`shades`),!0}if([`1`,`2`,`3`,`4`,`5`].includes(e.key)&&i[Number(e.key)-1])return n(i[Number(e.key)-1]),a(`custom`),!0;if(jC.includes(e.key)){let t=jC.indexOf(e.key),i=r[Object.keys(r)[t]];return n(Array.isArray(i)?i[o]:i),a(`baseColors`),!0}return!1},UC=({event:e,activeColorPickerSection:t,palette:n,color:r,onChange:i,customColors:a,setActiveColorPickerSection:o,updateData:s,activeShade:c,onEyeDropperToggle:l,onEscape:u})=>{if(e[N.CTRL_OR_CMD])return!1;if(e.key===N.ESCAPE)return u(e),!0;if(e.key===N.ALT)return l(!0),!0;if(e.key===N.I)return l(),!0;let d=AC({color:r,palette:n});if(e.key===N.TAB){let s={custom:!!a.length,baseColors:!0,shades:d?.shade!=null,hex:!0},c=Object.entries(s).reduce((e,[t,n])=>(n&&e.push(t),e),[]),l=c.indexOf(t),u=e.shiftKey?-1:1,f=c[l+u>c.length-1?0:l+u<0?c.length-1:l+u];return f&&o(f),f===`custom`?i(a[0]):f===`baseColors`&&(Object.entries(n).find(([e,t])=>Array.isArray(t)?t.includes(r):t===r?e:null)||i(hi.black)),e.preventDefault(),e.stopPropagation(),!0}if(HC({e,colorObj:d,onChange:i,palette:n,customColors:a,setActiveColorPickerSection:o,activeShade:c}))return!0;if(t===`shades`&&d){let{shade:t}=d,r=VC(e.key,t,5);if(r!==void 0)return i(n[d.colorName][r]),!0}if(t===`baseColors`&&d){let{colorName:t}=d,r=Object.keys(n),a=r.indexOf(t),o=VC(e.key,a,r.length);if(o!==void 0){let e=n[r[o]];return i(Array.isArray(e)?e[c]:e),!0}}if(t===`custom`){let t=r==null?0:a.indexOf(r),n=VC(e.key,t,a.length);if(n!==void 0){let e=a[n];return i(e),!0}}return!1},WC=H.forwardRef(({color:e,onChange:t,type:n,elements:r,palette:i,updateData:a,children:o,showTitle:s,onEyeDropperToggle:c,onEscape:l,showHotKey:u=!0},d)=>{let f=s?n===`elementStroke`?K(`labels.stroke`):n===`elementBackground`?K(`labels.background`):null:null,[p]=H.useState(()=>n===`canvasBackground`?[]:NC(r,n,i)),[m,h]=vy(PC),g=AC({color:e,palette:i});(0,H.useEffect)(()=>{if(!m){let t=!!e&&MC({color:e,palette:i});h(t&&!p.includes(e)?null:t?`custom`:g?.shade==null?`baseColors`:`shades`)}},[m,e,i,h,g,p]);let[_,v]=(0,H.useState)(g?.shade??(n===`elementBackground`?1:4));(0,H.useEffect)(()=>{g?.shade!=null&&v(g.shade);let e=e=>{e.key===N.ALT&&c(!1)};return document.addEventListener(F.KEYUP,e,{capture:!0}),()=>{document.removeEventListener(F.KEYUP,e,{capture:!0})}},[g,c]);let y=H.useRef(null);return(0,H.useImperativeHandle)(d,()=>y.current),(0,H.useEffect)(()=>{y?.current?.focus()},[]),(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":K(`labels.colorPicker`),children:(0,W.jsxs)(`div`,{ref:y,onKeyDown:n=>{UC({event:n,activeColorPickerSection:m,palette:i,color:e,onChange:t,onEyeDropperToggle:c,customColors:p,setActiveColorPickerSection:h,updateData:a,activeShade:_,onEscape:l})&&(n.preventDefault(),n.stopPropagation())},className:`color-picker-content properties-content`,tabIndex:-1,children:[f&&(0,W.jsx)(`div`,{className:`color-picker__title`,children:f}),!!p.length&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.mostUsedCustomColors`)}),(0,W.jsx)(LC,{colors:p,color:e,label:K(`colorPicker.mostUsedCustomColors`),onChange:t})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.colors`)}),(0,W.jsx)(RC,{color:e,palette:i,onChange:t,activeShade:_,showHotKey:u})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.shades`)}),(0,W.jsx)(BC,{color:e,onChange:t,palette:i,showHotKey:u})]}),o]})})}),GC=({onChange:e,type:t,activeColor:n,topPicks:r})=>{let i;return t===`elementStroke`&&(i=ln),t===`elementBackground`&&(i=ta),t===`canvasBackground`&&(i=Mr),r&&(i=r),i?(0,W.jsx)(`div`,{className:`color-picker__top-picks`,children:i.map(t=>(0,W.jsx)(`button`,{className:U(`color-picker__button`,{active:t===n,"is-transparent":t===`transparent`||!t,"has-outline":!yt(t,240)}),style:{"--swatch-color":t},type:`button`,title:t,onClick:()=>e(t),"data-testid":`color-top-pick-${t}`,children:(0,W.jsx)(`div`,{className:`color-picker__button-outline`})},t))}):(console.error(`Invalid type for TopPicks`),null)},KC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=hi,updateData:o,getOpenPopup:s,appState:c})=>{let{container:l}=oz(),u=az(),d=u!==`full`,f=u===`mobile`,[,p]=vy(PC),[m,h]=vy(bC),g=(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.hexCode`)}),(0,W.jsx)(FC,{color:t||``,label:r,onChange:e=>{n(e)},colorPickerType:e,placeholder:K(`colorPicker.color`)})]}),_=(0,H.useRef)(null),v=()=>{_.current?.focus()};return(0,W.jsx)(CC,{container:l,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!c.editingTextElement,onFocusOutside:e=>{Wr(e.target)||v(),e.preventDefault()},onPointerDownOutside:e=>{m&&e.preventDefault()},onClose:()=>{s()===e&&o({openPopup:null}),p(null),c.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},children:a?(0,W.jsx)(WC,{ref:_,palette:a,color:t,onChange:e=>{let t=c.editingTextElement?TC():null;n(e),c.editingTextElement&&t&&EC(t)},onEyeDropperToggle:t=>{h(r=>t?(r||={keepOpenOnAlt:!0,onSelect:n,colorPickerType:e},r.keepOpenOnAlt=!0,r):t===!1||r?null:{keepOpenOnAlt:!1,onSelect:n,colorPickerType:e})},onEscape:e=>{m?h(null):o({openPopup:null})},type:e,elements:i,updateData:o,showTitle:d,showHotKey:!f,children:g}):g})},qC=({label:e,color:t,type:n,mode:r=`background`,onToggle:i,editingTextElement:a})=>{let o=az(),s=o!==`full`,c=o===`mobile`,l=e=>{e.preventDefault(),e.stopPropagation(),a&&kC(),i()};return(0,W.jsxs)(H_,{type:`button`,className:U(`color-picker__button active-color properties-trigger`,{"is-transparent":!t||t===`transparent`,"has-outline":!t||!yt(t,240),"compact-sizing":s,"mobile-border":c}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:K(n===`elementStroke`?`labels.showStroke`:`labels.showBackground`),"data-openpopup":n,onClick:l,children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`,children:!t&&Mb}),s&&t&&r===`stroke`&&(0,W.jsx)(`div`,{className:`color-picker__button-background`,children:(0,W.jsx)(`span`,{style:{color:t&&yt(t,240)?`#fff`:`#111`},children:qS})})]})},JC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=hi,topPicks:o,updateData:s,appState:c})=>{let l=(0,H.useRef)(c.openPopup);(0,H.useEffect)(()=>{l.current=c.openPopup},[c.openPopup]);let u=az()!==`full`;return(0,W.jsx)(`div`,{children:(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`color-picker-container`,{"color-picker-container--no-top-picks":u}),children:[!u&&(0,W.jsx)(GC,{activeColor:t,onChange:n,type:e,topPicks:o}),!u&&(0,W.jsx)(mC,{}),(0,W.jsxs)(V_,{open:c.openPopup===e,onOpenChange:t=>{t&&s({openPopup:e})},children:[(0,W.jsx)(qC,{color:t,label:r,type:e,mode:e===`elementStroke`?`stroke`:`background`,editingTextElement:!!c.editingTextElement,onToggle:()=>{c.openPopup===e?s({openPopup:null}):(c.openPopup,s({openPopup:e}))}}),c.openPopup===e&&(0,W.jsx)(KC,{type:e,color:t,onChange:n,label:r,elements:i,palette:a,updateData:s,getOpenPopup:()=>l.current,appState:c})]})]})})},YC=H.forwardRef(({className:e,placeholder:t,onChange:n},r)=>(0,W.jsxs)(`div`,{className:U(`QuickSearch__wrapper`,e),children:[vS,(0,W.jsx)(`input`,{ref:r,className:`QuickSearch__input`,type:`text`,placeholder:t,onChange:e=>n(e.target.value.trim().toLowerCase())})]})),XC=({className:e,placeholder:t,children:n})=>{let r=!H.Children.count(n);return(0,W.jsx)(`div`,{className:U(`ScrollableList__wrapper`,e),role:`menu`,children:r?(0,W.jsx)(`div`,{className:`empty`,children:t}):n})},ZC=({children:e,className:t=``,style:n,title:r})=>(0,W.jsxs)(`div`,{className:`dropdown-menu-group ${t}`,style:n,children:[r&&(0,W.jsx)(`p`,{className:`dropdown-menu-group-title`,children:r}),e]}),QC=ZC;ZC.displayName=`DropdownMenuGroup`;var $C=H.createContext({}),ew=(e=``,t=!1,n=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?`dropdown-menu-item--selected`:``} ${n?`dropdown-menu-item--hovered`:``}`.trim(),tw=e=>{let t=(0,H.useContext)($C);return ps(e,e=>{t.onSelect?.(e)})},nw=({children:e,...t})=>(0,W.jsx)(`span`,{...t,style:{textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,...t.style},children:e}),rw=({textStyle:e,icon:t,shortcut:n,children:r,badge:i})=>{let a=iz();return(0,W.jsxs)(W.Fragment,{children:[t&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__icon`,children:t}),(0,W.jsx)(`div`,{style:e,className:`dropdown-menu-item__text`,children:(0,W.jsx)(nw,{children:r})}),i&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__badge`,children:i}),n&&a.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__shortcut`,children:n})]})},iw=({icon:e,badge:t,value:n,children:r,shortcut:i,className:a,selected:o,onSelect:s,...c})=>{let l=tw(s);return(0,W.jsx)(d_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,W.jsx)(`button`,{...c,value:n,className:ew(a,o),title:c.title??c[`aria-label`],children:(0,W.jsx)(rw,{icon:e,shortcut:i,badge:t,children:r})})})};iw.displayName=`DropdownMenuItem`;var aw={GREEN:`green`,RED:`red`,BLUE:`blue`},ow=({type:e=aw.BLUE,children:t})=>{let{theme:n}=cz(),r={display:`inline-flex`,marginLeft:`auto`,padding:`2px 4px`,borderRadius:6,fontSize:9,fontFamily:`Cascadia, monospace`,border:n===R.LIGHT?`1.5px solid white`:`none`};switch(e){case aw.GREEN:Object.assign(r,{backgroundColor:`var(--background-color-badge)`,color:`var(--color-badge)`});break;case aw.RED:Object.assign(r,{backgroundColor:`pink`,color:`darkred`});break;case aw.BLUE:default:Object.assign(r,{background:`var(--color-promo)`,color:`var(--color-surface-lowest)`})}return(0,W.jsx)(`div`,{className:`DropDownMenuItemBadge`,style:r,children:t})};ow.displayName=`DropdownMenuItemBadge`,iw.Badge=ow;var sw=iw,cw=({event:e,inputRef:t,hoveredFont:n,filteredFonts:r,onClose:i,onSelect:a,onHover:o})=>{if(!e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===N.F)return t.current?.focus(),!0;if(e.key===N.ESCAPE)return i(),!0;if(e.key===N.ENTER)return n?.value&&a(n.value),!0;if(e.key===N.ARROW_DOWN)return n?.next?o(n.next.value):r[0]?.value&&o(r[0].value),!0;if(e.key===N.ARROW_UP)return n?.prev?o(n.prev.value):r[r.length-1]?.value&&o(r[r.length-1].value),!0},lw=e=>{switch(e){case to.Excalifont:case to.Virgil:return ab;case to.Nunito:case to.Helvetica:return Bx;case to[`Lilita One`]:return zx;case to[`Comic Shanns`]:case to.Cascadia:return Hx;default:return Bx}},uw=H.memo(({selectedFontFamily:e,hoveredFontFamily:t,onSelect:n,onHover:r,onLeave:i,onOpen:a,onClose:o})=>{let{container:s}=oz(),c=nz(),{fonts:l}=c,{showDeprecatedFonts:u}=rz(),d=az(),[f,p]=(0,H.useState)(``),m=(0,H.useRef)(null),h=(0,H.useMemo)(()=>Array.from(de.registered.entries()).filter(([e,{metadata:t}])=>!t.private&&!t.fallback).map(([e,{metadata:t,fontFaces:n}])=>{let r={value:e,icon:lw(e),text:n[0]?.fontFace?.family??`Unknown`};return t.deprecated&&Object.assign(r,{deprecated:t.deprecated,badge:{type:aw.RED,placeholder:K(`fontList.badge.old`)}}),r}).sort((e,t)=>e.text.toLowerCase()>t.text.toLowerCase()?1:-1),[]),g=(0,H.useMemo)(()=>new Set(l.getSceneFamilies()),[e]),_=(0,H.useMemo)(()=>h.filter(e=>g.has(e.value)),[h,g]),v=(0,H.useMemo)(()=>h.filter(e=>!g.has(e.value)&&(u||!e.deprecated)),[h,g,u]),y=(0,H.useMemo)(()=>Kr([..._,...v].filter(e=>e.text?.toLowerCase().includes(f))),[_,v,f]),b=(0,H.useMemo)(()=>{let n;return t?n=y.find(e=>e.value===t):e&&(n=y.find(t=>t.value===e)),!n&&f&&(y[0]?.value?r(y[0].value):i()),n},[t,e,f,y,r,i]),x=(0,H.useCallback)(e=>{let t=null;if(c.state.editingTextElement){let e=document.querySelector(`.excalidraw-wysiwyg`);e&&(t={start:e.selectionStart,end:e.selectionEnd})}n(e),c.state.editingTextElement&&t&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&t&&(e.focus(),e.selectionStart=t.start,e.selectionEnd=t.end)},0)},[n,c.state.editingTextElement]),S=(0,H.useCallback)(e=>{cw({event:e,inputRef:m,hoveredFont:b,filteredFonts:y,onSelect:x,onHover:r,onClose:o})&&(e.preventDefault(),e.stopPropagation())},[b,y,x,r,o]);(0,H.useEffect)(()=>(a(),()=>{o()}),[]);let C=(0,H.useMemo)(()=>y.filter(e=>g.has(e.value)),[y,g]),w=(0,H.useMemo)(()=>y.filter(e=>!g.has(e.value)),[y,g]),T=({font:t,order:n})=>{let i=(0,H.useRef)(null),a=t.value===b?.value,o=t.value===e;return(0,H.useEffect)(()=>{a&&(n===0?i.current?.scrollIntoView?.({block:`end`}):i.current?.scrollIntoView?.({block:`nearest`}))},[a,n]),(0,W.jsx)(`button`,{ref:i,type:`button`,value:t.value,className:ew(``,o,a),title:t.text,tabIndex:o?0:-1,onClick:e=>{x(Number(e.currentTarget.value))},onMouseMove:()=>{b?.value!==t.value&&r(t.value)},children:(0,W.jsx)(rw,{icon:t.icon,badge:t.badge&&(0,W.jsx)(ow,{type:t.badge.type,children:t.badge.placeholder}),textStyle:{fontFamily:yo({fontFamily:t.value})},children:t.text})})},E=[];return C.length&&E.push((0,W.jsx)(QC,{title:K(`fontList.sceneFonts`),children:C.map((e,t)=>(0,W.jsx)(T,{font:e,order:t},e.value))},`group_1`)),w.length&&E.push((0,W.jsx)(QC,{title:K(`fontList.availableFonts`),children:w.map((e,t)=>(0,W.jsx)(T,{font:e,order:t+C.length},e.value))},`group_2`)),(0,W.jsxs)(CC,{className:`properties-content`,container:s,style:{width:`15rem`},onClose:()=>{o(),c.state.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},onPointerLeave:i,onKeyDown:S,preventAutoFocusOnTouch:!!c.state.editingTextElement,children:[d===`full`&&(0,W.jsx)(YC,{ref:m,placeholder:K(`quickSearch.placeholder`),onChange:wt(p,20)}),(0,W.jsx)(XC,{className:`dropdown-menu fonts manual-hover`,placeholder:K(`fontList.empty`),children:E.length?E:null})]})},(e,t)=>e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),dw=({selectedFontFamily:e,isOpened:t=!1,compactMode:n=!1})=>{let r=lz(),i=n?{...Bs,width:`2rem`,height:`2rem`}:{};return(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`div`,{"data-openpopup":`fontFamily`,className:`properties-trigger`,children:(0,W.jsx)(fC,{standalone:!0,icon:ob,title:K(`labels.showFonts`),className:`properties-trigger`,testId:`font-family-show-fonts`,active:t,onClick:()=>{r(e=>({openPopup:e.openPopup===`fontFamily`?null:e.openPopup}))},style:{border:`none`,...i}})})})},fw=[{value:to.Excalifont,icon:ab,text:K(`labels.handDrawn`),testId:`font-family-hand-drawn`},{value:to.Nunito,icon:Bx,text:K(`labels.normal`),testId:`font-family-normal`},{value:to[`Comic Shanns`],icon:Hx,text:K(`labels.code`),testId:`font-family-code`}];new Set(fw.map(e=>e.value));var pw=H.memo(({isOpened:e,selectedFontFamily:t,hoveredFontFamily:n,onSelect:r,onHover:i,onLeave:a,onPopupChange:o,compactMode:s=!1})=>{let c=(0,H.useMemo)(()=>fw,[]),l=(0,H.useCallback)(e=>{e&&r(e)},[r]);return(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`FontPicker__container`,{"FontPicker__container--compact":s}),children:[!s&&(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{type:`button`,options:c,value:t,onClick:l})}),!s&&(0,W.jsx)(mC,{}),(0,W.jsxs)(V_,{open:e,onOpenChange:o,children:[(0,W.jsx)(dw,{selectedFontFamily:t,isOpened:e,compactMode:s}),e&&(0,W.jsx)(uw,{selectedFontFamily:t,hoveredFontFamily:n,onSelect:l,onHover:i,onLeave:a,onOpen:()=>o(!0),onClose:()=>o(!1)})]})]})},(e,t)=>e.isOpened===t.isOpened&&e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),mw=({className:e,icon:t,size:n=`1em`})=>(0,W.jsx)(`span`,{className:e,style:{width:n,height:`100%`,margin:`0 0.5ex 0 0.5ex`,display:`inline-flex`,lineHeight:0,verticalAlign:`middle`,flex:`0 0 auto`},children:t}),hw=({label:e,open:t,openTrigger:n,children:r,className:i,showCollapsedIcon:a=!0})=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{style:{cursor:`pointer`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},className:i,onClick:n,children:[e,a&&(0,W.jsx)(mw,{icon:t?HS:VS})]}),t&&(0,W.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:r})]}),gw=yc(!1),_w=4,vw=`default`,yw=e=>e.flatMap(e=>e.options),bw=(e,t)=>{for(let n of e){let e=n.options.find(t);if(e)return e}return null},xw=(e,t)=>e.some(e=>e.options.some(t)),Sw=e=>e.flatMap(e=>Array.from({length:Math.ceil(e.options.length/_w)},(t,n)=>e.options.slice(n*_w,n*_w+_w)));function Cw({visibleSections:e,hiddenSections:t=[],value:n,label:r,onChange:i,onClose:a}){let o=iz(),{container:s}=oz(),[c,l]=vy(gw),u=yw([...e,...t]),d=Sw([...e,...c?t:[]]),f=e=>{let t=u.find(t=>t.keyBinding===e.key.toLowerCase());if(!(e.metaKey||e.altKey||e.ctrlKey)&&t)i(t.value),e.preventDefault();else if(e.key===N.TAB){let t=u.findIndex(e=>e.value===n);i(u[e.shiftKey?(u.length+t-1)%u.length:(t+1)%u.length].value)}else if(Pe(e.key)){let t=My().rtl,r=u.findIndex(e=>e.value===n);if(r!==-1){let a=u.length,o=r;switch(e.key){case t?N.ARROW_LEFT:N.ARROW_RIGHT:o=(r+1)%a;break;case t?N.ARROW_RIGHT:N.ARROW_LEFT:o=(a+r-1)%a;break;case N.ARROW_DOWN:{let t=d.findIndex(e=>e.some(e=>e.value===n)),a=d[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=d[(t+1)%d.length];i((s[Math.min(o,s.length-1)]??u[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}case N.ARROW_UP:{let t=d.findIndex(e=>e.some(e=>e.value===n)),a=d[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=d[(d.length+t-1)%d.length];i((s[Math.min(o,s.length-1)]??u[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}}i(u[o].value)}e.preventDefault()}else (e.key===N.ESCAPE||e.key===N.ENTER)&&(e.preventDefault(),a());e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()};(0,H.useEffect)(()=>{xw(t,e=>e.value===n)&&l(!0)},[n,t,l]);let p=e=>(0,W.jsx)(`div`,{className:`picker-content`,children:e.map(e=>(0,W.jsxs)(`button`,{type:`button`,className:U(`picker-option`,{active:n===e.value}),onClick:()=>{i(e.value)},title:e.keyBinding?`${e.text} \u2014 ${e.keyBinding.toUpperCase()}`:e.text,"aria-label":e.text||`none`,"aria-keyshortcuts":e.keyBinding||void 0,ref:t=>{n===e.value&&setTimeout(()=>{t?.focus()},0)},children:[e.icon,e.keyBinding&&(0,W.jsx)(`span`,{className:`picker-keybinding`,children:e.keyBinding})]},e.text))}),m=e=>e.map((e,t)=>e.name===vw?(0,W.jsx)(H.Fragment,{children:p(e.options)},`${e.name}-${t}`):(0,W.jsxs)(`div`,{className:`picker-section`,children:[(0,W.jsx)(`div`,{className:`picker-section-label`,children:e.name}),p(e.options)]},`${e.name}-${t}`)),h=o.formFactor===`phone`;return(0,W.jsx)(W_,{side:h?`right`:`bottom`,align:`start`,sideOffset:h?8:12,style:{zIndex:`var(--zIndex-ui-styles-popup)`},onKeyDown:f,collisionBoundary:s??void 0,children:(0,W.jsx)(`div`,{className:`picker`,role:`dialog`,"aria-modal":`true`,"aria-label":r,children:(0,W.jsxs)(`div`,{className:`picker-sections`,children:[m(e),t.length>0&&(0,W.jsx)(hw,{label:K(`labels.more_options`),open:c,openTrigger:()=>{l(e=>!e)},className:`picker-collapsible`,children:(0,W.jsx)(`div`,{className:`picker-sections`,children:m(t)})})]})})})}function ww({value:e,label:t,visibleSections:n,hiddenSections:r,onChange:i}){let[a,o]=H.useState(!1),s=(0,H.useMemo)(()=>bw(n,t=>t.value===e)??bw(r??[],t=>t.value===e),[n,r,e]);return(0,W.jsx)(`div`,{children:(0,W.jsxs)(V_,{open:a,onOpenChange:e=>o(e),children:[(0,W.jsx)(H_,{type:`button`,"aria-label":t,onClick:()=>o(!a),className:a?`active`:``,children:s?.icon}),a&&(0,W.jsx)(Cw,{visibleSections:n,hiddenSections:r,value:e,label:t,onChange:i,onClose:()=>{o(!1)}})]})})}var Tw=({updateData:e,app:t,testId:n})=>{let r=H.useRef(null),i=H.useRef(null),a=t.scene.getSelectedElements(t.state),o=!0,s=a.at(0),c=a.reduce((e,t)=>(e!=null&&e!==t.opacity&&(o=!1),e==null||e>t.opacity?t.opacity:e),s?.opacity??null)??t.state.currentItemOpacity;return(0,H.useEffect)(()=>{if(r.current&&i.current){let e=r.current,t=i.current,n=e.offsetWidth,a=c/100*(n-15)+15/2;t.style.left=`${a}px`,e.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${c}%, var(--button-bg) ${c}%, var(--button-bg) 100%)`}},[c]),(0,W.jsxs)(`label`,{className:`control-label`,children:[K(`labels.opacity`),(0,W.jsxs)(`div`,{className:`range-wrapper`,children:[(0,W.jsx)(`input`,{style:{"--color-slider-track":o?void 0:`var(--button-bg)`},ref:r,type:`range`,min:`0`,max:`100`,step:`10`,onChange:t=>{e(+t.target.value)},value:c,className:`range-input`,"data-testid":n}),(0,W.jsx)(`div`,{className:`value-bubble`,ref:i,children:c===0?null:c}),(0,W.jsx)(`div`,{className:`zero-label`,children:`0`})]})]})},Ew=.1,Dw=e=>{let t=Ka(e.editorInterface);return{stylesPanelMode:t,isCompact:t!==`full`,isMobile:t===`mobile`}},Ow=(e,t,n,r=!1)=>{let i=lr(ir(e,t,{includeBoundTextElement:r}));return e.map(e=>i.get(e.id)||e.id===t.editingTextElement?.id?n(e):e)},kw=function(e,t,n,r,i){let a=t.state.editingTextElement,o=Cs(e),s=null;if(a&&(s=n(a)),!s)if(Ya(o,t.state)){let e=t.scene.getSelectedElements(t.state);s=it(r===!0?e:e.filter(e=>r(e)),n)??(typeof i==`function`?i(!0):i)}else s=typeof i==`function`?i(!1):i;return s},Aw=(e,t,n)=>ya(t)||!t.autoResize?t:n.mutateElement(t,{x:e.textAlign===`left`?e.x:e.x+(e.width-t.width)/(e.textAlign===`center`?2:1),y:e.y+(e.height-t.height)/2}),jw=(e,t,n,r,i)=>{let a=new Set,o=Ow(e,t,e=>{if(M(e)){let t=r(e);a.add(t);let i=B(e,{fontSize:t});return Zi(i,n.scene.getContainerElement(e),n.scene),i=Aw(e,i,n.scene),i}return e},!0);return ir(e,t,{includeBoundTextElement:!0}).forEach(e=>{M(e)&&ue(e,n.scene)}),{elements:o,appState:{...t,currentItemFontSize:a.size===1?[...a][0]:i??t.currentItemFontSize},captureUpdate:V.IMMEDIATELY}};Z({name:`changeStrokeColor`,label:`labels.stroke`,trackEvent:!1,perform:(e,t,n)=>({...n?.currentItemStrokeColor&&{elements:Ow(e,t,e=>ye(e.type)?B(e,{strokeColor:n.currentItemStrokeColor}):e,!0)},appState:{...t,...n},captureUpdate:n?.currentItemStrokeColor?V.IMMEDIATELY:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Dw(r);return(0,W.jsxs)(W.Fragment,{children:[a===`full`&&(0,W.jsx)(`h3`,{"aria-hidden":`true`,children:K(`labels.stroke`)}),(0,W.jsx)(JC,{topPicks:ln,palette:lt,type:`elementStroke`,label:K(`labels.stroke`),color:kw(e,r,e=>e.strokeColor,!0,e=>e?null:t.currentItemStrokeColor),onChange:e=>n({currentItemStrokeColor:e}),elements:e,appState:t,updateData:n})]})}}),Z({name:`changeBackgroundColor`,label:`labels.changeBackground`,trackEvent:!1,perform:(e,t,n,r)=>{if(!n?.currentItemBackgroundColor)return{appState:{...t,...n},captureUpdate:V.EVENTUALLY};let i,a=r.scene.getSelectedElements(t);if(!Po(n.currentItemBackgroundColor)&&a.every(e=>ca(e)&&Xo(e.points))){let t=lr(a);i=e.map(e=>t.has(e.id)&&ca(e)?B(e,{backgroundColor:n.currentItemBackgroundColor,...g(e,!0)}):e)}else i=Ow(e,t,e=>B(e,{backgroundColor:n.currentItemBackgroundColor}));return{elements:i,appState:{...t,...n},captureUpdate:V.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Dw(r);return(0,W.jsxs)(W.Fragment,{children:[a===`full`&&(0,W.jsx)(`h3`,{"aria-hidden":`true`,children:K(`labels.background`)}),(0,W.jsx)(JC,{topPicks:ta,palette:et,type:`elementBackground`,label:K(`labels.background`),color:kw(e,r,e=>e.backgroundColor,!0,e=>e?null:t.currentItemBackgroundColor),onChange:e=>n({currentItemBackgroundColor:e}),elements:e,appState:t,updateData:n})]})}}),Z({name:`changeFillStyle`,label:`labels.fill`,trackEvent:!1,perform:(e,t,n,r)=>(dC(`element`,`changeFillStyle`,`${n} (${r.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),{elements:Ow(e,t,e=>B(e,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=ir(e,t),a=i.length>0&&i.every(e=>e.fillStyle===`zigzag`);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.fill`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{type:`button`,options:[{value:`hachure`,text:`${K(a?`labels.zigzag`:`labels.hachure`)} (${Q(`Alt-Click`)})`,icon:a?ax:ox,active:a?!0:void 0,testId:`fill-hachure`},{value:`cross-hatch`,text:K(`labels.crossHatch`),icon:sx,testId:`fill-cross-hatch`},{value:`solid`,text:K(`labels.solid`),icon:cx,testId:`fill-solid`}],value:kw(e,r,e=>e.fillStyle,e=>e.hasOwnProperty(`fillStyle`),e=>e?null:t.currentItemFillStyle),onClick:(e,t)=>{n(t.altKey&&e===`hachure`&&i.every(e=>e.fillStyle===`hachure`)?`zigzag`:e)}})})]})}}),Z({name:`changeStrokeWidth`,label:`labels.strokeWidth`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{strokeWidth:n})),appState:{...t,currentItemStrokeWidth:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.strokeWidth`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`stroke-width`,options:[{value:Ze.thin,text:K(`labels.thin`),icon:lx,testId:`strokeWidth-thin`},{value:Ze.bold,text:K(`labels.bold`),icon:ux,testId:`strokeWidth-bold`},{value:Ze.extraBold,text:K(`labels.extraBold`),icon:dx,testId:`strokeWidth-extraBold`}],value:kw(e,r,e=>e.strokeWidth,e=>e.hasOwnProperty(`strokeWidth`),e=>e?null:t.currentItemStrokeWidth),onChange:e=>n(e)})})]})}),Z({name:`changeSloppiness`,label:`labels.sloppiness`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{seed:se(),roughness:n})),appState:{...t,currentItemRoughness:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.sloppiness`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`sloppiness`,options:[{value:0,text:K(`labels.architect`),icon:mx},{value:1,text:K(`labels.artist`),icon:hx},{value:2,text:K(`labels.cartoonist`),icon:gx}],value:kw(e,r,e=>e.roughness,e=>e.hasOwnProperty(`roughness`),e=>e?null:t.currentItemRoughness),onChange:e=>n(e)})})]})}),Z({name:`changeStrokeStyle`,label:`labels.strokeStyle`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.strokeStyle`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`strokeStyle`,options:[{value:`solid`,text:K(`labels.strokeStyle_solid`),icon:lx},{value:`dashed`,text:K(`labels.strokeStyle_dashed`),icon:fx},{value:`dotted`,text:K(`labels.strokeStyle_dotted`),icon:px}],value:kw(e,r,e=>e.strokeStyle,e=>e.hasOwnProperty(`strokeStyle`),e=>e?null:t.currentItemStrokeStyle),onChange:e=>n(e)})})]})}),Z({name:`changeOpacity`,label:`labels.opacity`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({app:e,updateData:t})=>(0,W.jsx)(Tw,{updateData:t,app:e,testId:`opacity`})}),Z({name:`changeFontSize`,label:`labels.fontSize`,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,()=>(gt(n,`actionChangeFontSize: Expected a font size value`),n),n),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Dw(r);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.fontSize`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`font-size`,options:[{value:os.sm,text:K(`labels.small`),icon:Px,testId:`fontSize-small`},{value:os.md,text:K(`labels.medium`),icon:Fx,testId:`fontSize-medium`},{value:os.lg,text:K(`labels.large`),icon:Ix,testId:`fontSize-large`},{value:os.xl,text:K(`labels.veryLarge`),icon:Lx,testId:`fontSize-veryLarge`}],value:kw(e,r,e=>{if(M(e))return e.fontSize;let t=ut(e,r.scene.getNonDeletedElementsMap());return t?t.fontSize:null},e=>M(e)||ut(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:t.currentItemFontSize||20),onChange:e=>{DC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})]})}});var Mw=Z({name:`decreaseFontSize`,label:`labels.decreaseFontSize`,icon:Rx,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,e=>Math.round(1/(1+Ew)*e.fontSize)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_LEFT||e.key===N.COMMA)}),Nw=Z({name:`increaseFontSize`,label:`labels.increaseFontSize`,icon:Rx,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,e=>Math.round(e.fontSize*(1+Ew))),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_RIGHT||e.key===N.PERIOD)});Z({name:`changeFontFamily`,label:`labels.fontFamily`,trackEvent:!1,perform:(e,t,n,r)=>{let{cachedElements:i,resetAll:a,resetContainers:o,...s}=n;if(a)return{elements:Ow(e,t,e=>{let t=i?.get(e.id);return t?B(e,{...t}):e},!0),appState:{...t,...s},captureUpdate:V.NEVER};gt(n,`actionChangeFontFamily: value must be defined`);let{currentItemFontFamily:c,currentHoveredFontFamily:l}=n,u=V.EVENTUALLY,d,f=!1;if(c)d=c,u=V.IMMEDIATELY;else if(l){d=l,u=V.EVENTUALLY;let n=ir(e,t,{includeBoundTextElement:!0}).filter(e=>M(e));if(n.length>200)f=!0;else{let e=0,t=0;for(;e<n.length&&t<5e3;){let r=n[e];t+=r?.originalText.length||0,e++}t>5e3&&(f=!0)}}let p={appState:{...t,...s},captureUpdate:u};if(d&&!f){let n=new Map,a=new Set,s=!1,u=Array.from(de.loadedFontsCache.values()),f=Object.entries(to).find(([e,t])=>t===d)?.[0];l&&f&&u.some(e=>e.startsWith(f))&&(s=!0),Object.assign(p,{elements:Ow(e,t,e=>{if(M(e)&&(e.fontFamily!==d||c)){let t=B(e,{fontFamily:d,lineHeight:ba(d)}),c=i?.get(e.containerId||``)||{},l=r.scene.getContainerElement(e);return o&&l&&c&&r.scene.mutateElement(l,{...c}),s||(a=new Set([...a,...Array.from(t.originalText)])),n.set(t,l),t}return e},!0)});let m=`10px ${yo({fontFamily:d})}`,h=Array.from(a.values()).join();if(s||window.document.fonts.check(m,h))for(let[e,t]of n)Zi(e,t,r.scene);else window.document.fonts.load(m,h).then(e=>{for(let[e,t]of n){let n=r.scene.getElement(e.id),i=t?r.scene.getElement(t.id):null;n&&Zi(n,i,r.scene)}r.fonts.onLoaded(e)})}return p},PanelComponent:({elements:e,appState:t,app:n,updateData:r})=>{let i=(0,H.useRef)(new Map),a=(0,H.useRef)(null),[o,s]=(0,H.useState)({}),c=(0,H.useRef)(!0),{stylesPanelMode:l,isCompact:u}=Dw(n),d=(0,H.useMemo)(()=>{let r=(e,r)=>kw(e,n,e=>{if(M(e))return e.fontFamily;let t=ut(e,r);return t?t.fontFamily:null},e=>M(e)||ut(e,r)!==null,e=>e?null:t.currentItemFontFamily||$r);return o.openPopup===`fontFamily`&&t.openPopup===`fontFamily`?r(Array.from(i.current?.values()??[]),i.current):!o.openPopup&&t.openPopup!==`fontFamily`?r(e,n.scene.getNonDeletedElementsMap()):a.current},[o.openPopup,t,e,n]);return(0,H.useEffect)(()=>{a.current=d},[d]),(0,H.useEffect)(()=>{Object.keys(o).length&&(r(o),s({}))},[o]),(0,H.useEffect)(()=>(c.current=!1,()=>{c.current=!0}),[]),(0,W.jsxs)(W.Fragment,{children:[l===`full`&&(0,W.jsx)(`legend`,{children:K(`labels.fontFamily`)}),(0,W.jsx)(pw,{isOpened:t.openPopup===`fontFamily`,selectedFontFamily:d,hoveredFontFamily:t.currentHoveredFontFamily,compactMode:l!==`full`,onSelect:e=>{DC(()=>{s({openPopup:null,currentHoveredFontFamily:null,currentItemFontFamily:e}),i.current.clear()},u,!!t.editingTextElement)},onHover:e=>{s({currentHoveredFontFamily:e,cachedElements:new Map(i.current),resetContainers:!0})},onLeave:()=>{s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0})},onPopupChange:r=>{if(r){i.current.clear();let{editingTextElement:r}=t;if(r?.type===`text`){let e=n.scene.getElement(r.id);i.current.set(r.id,B(e||r,{},!0))}else{let n=ir(e,t,{includeBoundTextElement:!0});for(let e of n)i.current.set(e.id,B(e,{},!0))}s({...o,openPopup:`fontFamily`})}else s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0}),i.current.clear(),u&&t.editingTextElement&&EC(null)}})]})}}),Z({name:`changeTextAlign`,label:`Change text alignment`,trackEvent:!1,perform:(e,t,n,r)=>({elements:Ow(e,t,e=>{if(M(e)){let t=B(e,{textAlign:n});return Zi(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t,currentItemTextAlign:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let a=r.scene.getNonDeletedElementsMap(),{isCompact:o}=Dw(r);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.textAlign`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`text-align`,options:[{value:`left`,text:K(`labels.left`),icon:Ux,testId:`align-left`},{value:`center`,text:K(`labels.center`),icon:Wx,testId:`align-horizontal-center`},{value:`right`,text:K(`labels.right`),icon:Gx,testId:`align-right`}],value:kw(e,r,e=>{if(M(e))return e.textAlign;let t=ut(e,a);return t?t.textAlign:null},e=>M(e)||ut(e,a)!==null,e=>e?null:t.currentItemTextAlign),onChange:e=>{DC(()=>n(e),o,!!t.editingTextElement,i?.onPreventClose)}})})]})}}),Z({name:`changeVerticalAlign`,label:`Change vertical alignment`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Ow(e,t,e=>{if(M(e)){let t=B(e,{verticalAlign:n});return Zi(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Dw(r);return(0,W.jsx)(`fieldset`,{children:(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`text-align`,options:[{value:Lr.TOP,text:K(`labels.alignTop`),icon:(0,W.jsx)(Kx,{theme:t.theme}),testId:`align-top`},{value:Lr.MIDDLE,text:K(`labels.centerVertically`),icon:(0,W.jsx)(Jx,{theme:t.theme}),testId:`align-middle`},{value:Lr.BOTTOM,text:K(`labels.alignBottom`),icon:(0,W.jsx)(qx,{theme:t.theme}),testId:`align-bottom`}],value:kw(e,r,e=>{if(M(e)&&e.containerId)return e.verticalAlign;let t=ut(e,r.scene.getNonDeletedElementsMap());return t?t.verticalAlign:null},e=>M(e)||ut(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:Lr.MIDDLE),onChange:e=>{DC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})})}}),Z({name:`changeRoundness`,label:`Change edge roundness`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>dr(e)?e:B(e,{roundness:n===`round`?{type:Ga(e.type)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>{let a=si(Cs(e),t).some(e=>e.roundness?.type===Xa.LEGACY);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.edges`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[(0,W.jsx)(pC,{group:`edges`,options:[{value:`sharp`,text:K(`labels.sharp`),icon:_x},{value:`round`,text:K(`labels.round`),icon:vx}],value:kw(e,r,e=>a?null:e.roundness?`round`:`sharp`,e=>!jt(e)&&e.hasOwnProperty(`roundness`),e=>e?null:t.currentItemRoundness),onChange:e=>n(e)}),i(`togglePolygon`)]})]})}});var Pw=e=>({visibleSections:[{name:`default`,options:[{value:null,text:K(`labels.arrowhead_none`),keyBinding:`q`,icon:(0,W.jsx)(yx,{flip:e})},{value:`arrow`,text:K(`labels.arrowhead_arrow`),keyBinding:`w`,icon:(0,W.jsx)(bx,{flip:e})},{value:`triangle`,text:K(`labels.arrowhead_triangle`),icon:(0,W.jsx)(xx,{flip:e}),keyBinding:`e`},{value:`triangle_outline`,text:K(`labels.arrowhead_triangle_outline`),icon:(0,W.jsx)(Sx,{flip:e}),keyBinding:`r`}]}],hiddenSections:[{name:`default`,options:[{value:`circle`,text:K(`labels.arrowhead_circle`),keyBinding:`a`,icon:(0,W.jsx)(Cx,{flip:e})},{value:`circle_outline`,text:K(`labels.arrowhead_circle_outline`),keyBinding:`s`,icon:(0,W.jsx)(wx,{flip:e})},{value:`diamond`,text:K(`labels.arrowhead_diamond`),icon:(0,W.jsx)(Tx,{flip:e}),keyBinding:`d`},{value:`diamond_outline`,text:K(`labels.arrowhead_diamond_outline`),icon:(0,W.jsx)(Ex,{flip:e}),keyBinding:`f`},{value:`bar`,text:K(`labels.arrowhead_bar`),keyBinding:`z`,icon:(0,W.jsx)(Dx,{flip:e})}]},{name:K(`labels.cardinality`),options:[{value:`cardinality_one`,text:K(`labels.arrowhead_cardinality_one`),icon:(0,W.jsx)(Ox,{flip:e}),keyBinding:`x`},{value:`cardinality_many`,text:K(`labels.arrowhead_cardinality_many`),icon:(0,W.jsx)(kx,{flip:e}),keyBinding:`c`},{value:`cardinality_one_or_many`,text:K(`labels.arrowhead_cardinality_one_or_many`),icon:(0,W.jsx)(Ax,{flip:e}),keyBinding:`v`},{value:`cardinality_exactly_one`,text:K(`labels.arrowhead_cardinality_exactly_one`),icon:(0,W.jsx)(jx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_one`,text:K(`labels.arrowhead_cardinality_zero_or_one`),icon:(0,W.jsx)(Mx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_many`,text:K(`labels.arrowhead_cardinality_zero_or_many`),icon:(0,W.jsx)(Nx,{flip:e}),keyBinding:null}]}]});Z({name:`changeArrowhead`,label:`Change arrowheads`,trackEvent:!1,perform:(e,t,n)=>(gt(n,`actionChangeArrowhead: value must be defined`),{elements:Ow(e,t,e=>{if(b(e)){let{position:t,type:r}=n;if(t===`start`)return B(e,{startArrowhead:r});if(t===`end`)return B(e,{endArrowhead:r})}return e}),appState:{...t,[n.position===`start`?`currentItemStartArrowhead`:`currentItemEndArrowhead`]:n.type},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=My().rtl,a=(0,H.useMemo)(()=>Pw(!i),[i]),o=(0,H.useMemo)(()=>Pw(!!i),[i]);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.arrowheads`)}),(0,W.jsxs)(`div`,{className:`iconSelectList buttonList`,children:[(0,W.jsx)(ww,{visibleSections:a.visibleSections,hiddenSections:a.hiddenSections,label:`arrowhead_start`,value:kw(e,r,e=>b(e)&&Ms(e.type)?Qt(e.startArrowhead):t.currentItemStartArrowhead,!0,e=>e?null:t.currentItemStartArrowhead),onChange:e=>n({position:`start`,type:e})}),(0,W.jsx)(ww,{visibleSections:o.visibleSections,hiddenSections:o.hiddenSections,label:`arrowhead_end`,value:kw(e,r,e=>b(e)&&Ms(e.type)?Qt(e.endArrowhead):t.currentItemEndArrowhead,!0,e=>e?null:t.currentItemEndArrowhead),onChange:e=>n({position:`end`,type:e})})]})]})}}),Z({name:`changeArrowProperties`,label:`Change arrow properties`,trackEvent:!1,perform:(e,t,n,r)=>!1,PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[i(`changeArrowhead`),i(`changeArrowType`)]})}),Z({name:`changeArrowType`,label:`Change arrow types`,trackEvent:!1,perform:(e,t,n,r)=>{let i=Ow(e,t,e=>{if(!jt(e))return e;let i=r.scene.getNonDeletedElementsMap(),a=I.getPointAtIndexGlobalCoordinates(e,0,i),o=I.getPointAtIndexGlobalCoordinates(e,-1,i),s=B(e,{x:n===ts.elbow?a[0]:e.x,y:n===ts.elbow?a[1]:e.y,roundness:n===ts.round?{type:Xa.PROPORTIONAL_RADIUS}:null,elbowed:n===ts.elbow,angle:n===ts.elbow?0:e.angle,points:n===ts.elbow||e.elbowed?[I.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},a,i),I.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},o,i)]:e.points});if(dr(s)){s.fixedSegments=null;let e=r.scene.getNonDeletedElementsMap();r.dismissLinearEditor();let n=I.getPointAtIndexGlobalCoordinates(s,0,e),i=I.getPointAtIndexGlobalCoordinates(s,-1,e),a=s.startBinding&&e.get(s.startBinding.elementId),o=s.endBinding&&e.get(s.endBinding.elementId),c=a&&s.startBinding?{...s.startBinding,...wo(s,a,`start`,e,t.isBindingEnabled)}:null,l=o&&s.endBinding?{...s.endBinding,...wo(s,o,`end`,e,t.isBindingEnabled)}:null;s={...s,startBinding:c,endBinding:l,...fi(s,e,{points:[n,i].map(e=>O(e[0]-s.x,e[1]-s.y)),startBinding:c,endBinding:l,fixedSegments:null})}}else{let e=r.scene.getNonDeletedElementsMap();if(s.startBinding){let n=e.get(s.startBinding.elementId);n&&$n(s,n,t.bindMode===`inside`?`inside`:`orbit`,`start`,r.scene)}if(s.endBinding){let n=e.get(s.endBinding.elementId);n&&$n(s,n,t.bindMode===`inside`?`inside`:`orbit`,`end`,r.scene)}}return s}),a={...t,currentItemArrowType:n},o=t.selectedLinearElement?.elementId;if(o){let t=i.find(e=>e.id===o);t&&(a.selectedLinearElement=new I(t,lr(e)))}return{elements:i,appState:a,captureUpdate:V.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.arrowtypes`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`arrowtypes`,options:[{value:ts.sharp,text:K(`labels.arrowtype_sharp`),icon:RS,testId:`sharp-arrow`},{value:ts.round,text:K(`labels.arrowtype_round`),icon:BS,testId:`round-arrow`},{value:ts.elbow,text:K(`labels.arrowtype_elbowed`),icon:zS,testId:`elbow-arrow`}],value:kw(e,r,e=>jt(e)?e.elbowed?ts.elbow:e.roundness?ts.round:ts.sharp:null,e=>jt(e),e=>e?null:t.currentItemArrowType),onChange:e=>n(e)})})]})});var Fw=()=>{let e=document.querySelector(`.excalidraw-tooltip`);if(e)return e;let t=document.createElement(`div`);return document.body.appendChild(t),t.classList.add(`excalidraw-tooltip`),t},Iw=(e,t,n=`bottom`)=>{let r=e.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=t.left+t.width/2-r.width/2;o<0?o=5:o+r.width>=i&&(o=i-r.width-5);let s;n===`bottom`?(s=t.top+t.height+5,s+r.height>=a&&(s=t.top-r.height-5)):(s=t.top-r.height-5,s<0&&(s=t.top+t.height+5)),Object.assign(e.style,{top:`${s}px`,left:`${o}px`})},Lw=(e,t,n,r)=>{t.classList.add(`excalidraw-tooltip--visible`),t.style.minWidth=r?`50ch`:`10ch`,t.style.maxWidth=r?`50ch`:`15ch`,t.textContent=n,Iw(t,e.getBoundingClientRect())},Rw=({children:e,label:t,long:n=!1,style:r,disabled:i})=>((0,H.useEffect)(()=>()=>Fw().classList.remove(`excalidraw-tooltip--visible`),[]),i?null:(0,W.jsx)(`div`,{className:`excalidraw-tooltip-wrapper`,onPointerEnter:e=>Lw(e.currentTarget,Fw(),t,n),onPointerLeave:()=>Fw().classList.remove(`excalidraw-tooltip--visible`),style:r,children:e})),zw=`<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">`,Bw=`<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>`,Vw=`<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>`,Hw=`data:${hs.svg},${encodeURIComponent(`${zw}${Vw}</svg>`)}`,Uw=`data:${hs.svg},${encodeURIComponent(`${zw}${Bw}${Vw}</svg>`)}`,Ww=e=>{e&&(e.style.cursor=``)},Gw=(e,t)=>{e&&(e.style.cursor=t)},Kw,qw,Jw=(e,t)=>{(!Kw||Kw.theme!==t)&&(()=>{let e=t===R.DARK;Kw=document.createElement(`canvas`),Kw.theme=t,Kw.height=20,Kw.width=20;let n=Kw.getContext(`2d`);n.lineWidth=1,n.beginPath(),n.arc(Kw.width/2,Kw.height/2,5,0,2*Math.PI),n.fillStyle=e?`#000`:`#fff`,n.fill(),n.strokeStyle=e?`#fff`:`#000`,n.stroke(),qw=Kw.toDataURL(hs.svg)})(),Gw(e,`url(${qw}) ${20/2} ${20/2}, auto`)},Yw=(e,t)=>{if(e)if(t.activeTool.type===`selection`)Ww(e);else if(Fs(t))e.style.cursor=Kn.GRAB;else if(zr(t))Jw(e,t.theme);else if(t.activeTool.type===`laser`){let n=t.theme===R.LIGHT?Hw:Uw;e.style.cursor=`url(${n}), auto`}else [`image`,`custom`].includes(t.activeTool.type)?t.activeTool.type!==`image`&&(e.style.cursor=Kn.AUTO):e.style.cursor=Kn.CROSSHAIR},Xw=({viewportX:e,viewportY:t,nextZoom:n},r)=>{let i=e-r.offsetLeft,a=t-r.offsetTop,o=r.zoom.value,s=r.scrollX+(i-i/o),c=r.scrollY+(a-a/o),l=-(i-i/n),u=-(a-a/n);return{scrollX:s+l,scrollY:c+u,zoom:{value:n}}};Z({name:`changeViewBackgroundColor`,label:`labels.canvasBackground`,trackEvent:!1,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,n)=>({appState:{...t,...n},captureUpdate:n?.viewBackgroundColor?V.IMMEDIATELY:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r,data:i})=>(0,W.jsx)(JC,{palette:null,topPicks:Mr,label:K(`labels.canvasBackground`),type:`canvasBackground`,color:t.viewBackgroundColor,onChange:e=>n({viewBackgroundColor:e}),"data-testid":`canvas-background-picker`,elements:e,appState:t,updateData:n})});var Zw=Z({name:`clearCanvas`,label:`labels.clearCanvas`,icon:pb,trackEvent:{category:`canvas`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`,perform:(e,t,n,r)=>(r.imageCache.clear(),{elements:e.map(e=>B(e,{isDeleted:!0})),appState:{...cs(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,gridStep:t.gridStep,gridModeEnabled:t.gridModeEnabled,stats:t.stats,activeTool:t.activeTool.type===`image`?{...t.activeTool,type:r.state.preferredSelectionTool.type}:t.activeTool},captureUpdate:V.IMMEDIATELY})}),Qw=Z({name:`zoomIn`,label:`buttons.zoomIn`,viewMode:!0,icon:ub,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(t.zoom.value+qi)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(X,{type:`button`,className:`zoom-in-button zoom-button`,icon:ub,title:`${K(`buttons.zoomIn`)} \u2014 ${Q(`CtrlOrCmd++`)}`,"aria-label":K(`buttons.zoomIn`),disabled:t.zoom.value>=30,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Gs.EQUAL||e.code===Gs.NUM_ADD)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),$w=Z({name:`zoomOut`,label:`buttons.zoomOut`,icon:db,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(t.zoom.value-qi)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(X,{type:`button`,className:`zoom-out-button zoom-button`,icon:db,title:`${K(`buttons.zoomOut`)} \u2014 ${Q(`CtrlOrCmd+-`)}`,"aria-label":K(`buttons.zoomOut`),disabled:t.zoom.value<=mn,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Gs.MINUS||e.code===Gs.NUM_SUBTRACT)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),eT=Z({name:`resetZoom`,label:`buttons.resetZoom`,icon:fb,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(1)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(Rw,{label:K(`buttons.resetZoom`),style:{height:`100%`},children:(0,W.jsxs)(X,{type:`button`,className:`reset-zoom-button zoom-button`,title:K(`buttons.resetZoom`),"aria-label":K(`buttons.resetZoom`),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),`%`]})}),keyTest:e=>(e.code===Gs.ZERO||e.code===Gs.NUM_ZERO)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),tT=(e,t,n=1)=>{let[r,i,a,o]=e,s=a-r,c=t.width/s,l=o-i,u=t.height/l,d=Math.min(c,u)*Ht(n,.1,1);return Math.min(d,1)},nT=({bounds:e,appState:t,canvasOffsets:n,fitToViewport:r=!1,viewportZoomFactor:i=1,minZoom:a=-1/0,maxZoom:o=1/0})=>{i=Ht(i,mn,30);let[s,c,l,u]=e,d=(s+l)/2,f=(c+u)/2,p=n?.left??0,m=n?.top??0,h=n?.right??0,g=n?.bottom??0,_=t.width-p-h,v=t.height-m-g,y;if(r){let e=l-s,t=u-c;y=Math.min(_/e,v/t)*i}else y=tT(e,{width:_,height:v},i);let b=_i(Ht(ie(y,qi,`floor`),a,o)),x=$e({scenePoint:{x:d,y:f},viewportDimensions:{width:t.width,height:t.height},offsets:n,zoom:{value:b}});return{appState:{...t,scrollX:x.scrollX,scrollY:x.scrollY,zoom:{value:b}},captureUpdate:V.EVENTUALLY}},rT=({canvasOffsets:e,targetElements:t,appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o})=>nT({canvasOffsets:e,bounds:Ii(Cs(t)),appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o});Z({name:`zoomToFitSelectionInViewport`,label:`labels.zoomToFitViewport`,icon:kS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return rT({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Gs.TWO&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Z({name:`zoomToFitSelection`,label:`helpDialog.zoomToSelection`,icon:kS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return rT({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!0,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Gs.THREE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Z({name:`zoomToFit`,label:`helpDialog.zoomToFit`,icon:kS,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>rT({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()}),keyTest:e=>e.code===Gs.ONE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]});var iT=Z({name:`toggleTheme`,label:(e,t)=>t.theme===R.DARK?`buttons.lightMode`:`buttons.darkMode`,keywords:[`toggle`,`dark`,`light`,`mode`,`theme`],icon:(e,t)=>e.theme===R.LIGHT?gb:_b,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n)=>({appState:{...t,theme:n||(t.theme===R.LIGHT?R.DARK:R.LIGHT)},captureUpdate:V.EVENTUALLY}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===Gs.D,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.toggleTheme});Z({name:`toggleEraserTool`,label:`toolBar.eraser`,trackEvent:{category:`toolbar`},perform:(e,t,n,r)=>{let i;return i=zr(t)?ka(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):ka(t,{type:`eraser`,lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e.key===N.E}),Z({name:`toggleLassoTool`,label:`toolBar.lasso`,icon:Qy,trackEvent:{category:`toolbar`},predicate:(e,t,n,r)=>r.state.preferredSelectionTool.type!==`lasso`,perform:(e,t,n,r)=>{let i;return t.activeTool.type===`lasso`?i=ka(t,{type:`selection`}):(i=ka(t,{type:`lasso`,fromSelection:!1}),Gw(r.interactiveCanvas,Kn.CROSSHAIR)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.NEVER}}});var aT=Z({name:`toggleHandTool`,label:`toolBar.hand`,trackEvent:{category:`toolbar`},icon:Zx,viewMode:!1,perform:(e,t,n,r)=>{let i;return Fs(t)?i=ka(t,{...t.activeTool.lastActiveTool||{type:`selection`},lastActiveToolBeforeEraser:null}):(i=ka(t,{type:`hand`,lastActiveToolBeforeEraser:t.activeTool}),Gw(r.interactiveCanvas,Kn.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.IMMEDIATELY}},keyTest:e=>!e.altKey&&!e[N.CTRL_OR_CMD]&&e.key===N.H});Z({name:`setEmbeddableAsActiveTool`,trackEvent:{category:`toolbar`},target:`Tool`,label:`toolBar.embeddable`,perform:(e,t,n,r)=>{let i=ka(t,{type:`embeddable`});return Yw(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:ka(t,{type:`embeddable`})},captureUpdate:V.EVENTUALLY}}});var oT=Z({name:`finalize`,label:``,trackEvent:!1,perform:(e,t,n,r)=>{let i=e,{interactiveCanvas:a,focusContainer:o,scene:s}=r,c=s.getNonDeletedElementsMap();if(n&&t.selectedLinearElement){let{event:a,sceneCoords:o}=n,l=I.getElement(t.selectedLinearElement.elementId,c);gt(l,`Arrow element should exist if selectedLinearElement is set`),gt(o,`sceneCoords should be defined if actionFinalize is called with event`);let u=I.handlePointerUp(a,t.selectedLinearElement,t,r.scene);if(ss(l)&&!t.selectedLinearElement.segmentMidPointHoveredCoords){let e=!!t.newElement;Ur(l,(e||!t.selectedLinearElement.selectedPointsIndices?[l.points.length-1]:t.selectedLinearElement.selectedPointsIndices).reduce((e,t)=>(e.set(t,{point:I.pointFromAbsoluteCoords(l,O(o.x-u.pointerOffset.x,o.y-u.pointerOffset.y),c)}),e),new Map)??new Map,o.x-u.pointerOffset.x,o.y-u.pointerOffset.y,s,t,{newArrow:e,altKey:a.altKey,angleLocked:mr(a)})}else ca(l)&&t.selectedLinearElement?.isEditing&&!t.newElement&&!zs(l.points)&&s.mutateElement(l,{polygon:!1});if(u!==t.selectedLinearElement){l&&na(l)&&(i=i.map(e=>e.id===l.id?B(e,{isDeleted:!0}):e));let n=t.activeTool?.locked;return{elements:l.points.length<2||na(l)?e.map(e=>e.id===l.id?B(e,{isDeleted:!0}):e):i,appState:{...t,cursorButton:`up`,selectedLinearElement:n?null:{...u,selectedPointsIndices:null,isEditing:!1,initialState:{...u.initialState,lastClickedPoint:-1},pointerOffset:{x:0,y:0}},selectionElement:null,suggestedBinding:null,newElement:null,multiElement:null},captureUpdate:V.IMMEDIATELY}}}window.document.activeElement instanceof HTMLElement&&o();let l=null;if(t.multiElement)l=t.multiElement;else if(t.newElement?.type===`freedraw`||ss(t.newElement))l=t.newElement;else if(Object.keys(t.selectedElementIds).length===1){let e=c.get(Object.keys(t.selectedElementIds)[0]);e&&(l=e)}if(l){if(t.selectedLinearElement&&t.multiElement&&l.type!==`freedraw`&&t.lastPointerDownWith!==`touch`){let{points:e}=l,{lastCommittedPoint:n}=t.selectedLinearElement;(!n||e[e.length-1]!==n)&&s.mutateElement(l,{points:l.points.slice(0,-1)})}if(l&&na(l)&&(i=i.map(e=>e.id===l?.id?B(e,{isDeleted:!0}):e)),b(l)||Js(l)){if(ra(l.points,t.zoom.value)&&(ca(l)||Js(l))){let e=l.points,t=e[0],n=e.map((n,r)=>r===e.length-1?O(t[0],t[1]):n);ca(l)?s.mutateElement(l,{points:n,polygon:!0}):s.mutateElement(l,{points:n})}ca(l)&&!zs(l.points)&&s.mutateElement(l,{polygon:!1})}}(!t.activeTool.locked&&t.activeTool.type!==`freedraw`||!l)&&Ww(a);let u;u=t.activeTool.type===`eraser`?ka(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):ka(t,{type:r.state.preferredSelectionTool.type});let d=l&&b(l)?new I(l,lr(i)):t.selectedLinearElement;return d&&={...d,isEditing:t.newElement?!1:d.isEditing,initialState:{...d.initialState,lastClickedPoint:-1,origin:null}},{elements:i,appState:{...t,cursorButton:`up`,activeTool:(t.activeTool.locked||t.activeTool.type===`freedraw`)&&l?t.activeTool:u,activeEmbeddable:null,newElement:null,selectionElement:null,multiElement:null,editingTextElement:null,startBoundElement:null,suggestedBinding:null,selectedElementIds:l&&!t.activeTool.locked&&t.activeTool.type!==`freedraw`?{...t.selectedElementIds,[l.id]:!0}:t.selectedElementIds,selectedLinearElement:d},captureUpdate:V.IMMEDIATELY}},keyTest:(e,t)=>e.key===N.ESCAPE&&(t.selectedLinearElement?.isEditing||!t.newElement&&t.multiElement===null)||(e.key===N.ESCAPE||e.key===N.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>(0,W.jsx)(X,{type:`button`,icon:Fb,title:K(`buttons.done`),"aria-label":K(`buttons.done`),onClick:t,visible:e.multiElement!=null,size:n?.size||`medium`,style:{pointerEvents:`all`}})}),sT=({children:e,checked:t,onChange:n,className:r})=>(0,W.jsxs)(`div`,{className:U(`Checkbox`,r,{"is-checked":t}),onClick:e=>{n(!t,e),e.currentTarget.querySelector(`.Checkbox-box`).focus()},children:[(0,W.jsx)(`button`,{type:`button`,className:`Checkbox-box`,role:`checkbox`,"aria-checked":t,children:Eb}),(0,W.jsx)(`div`,{className:`Checkbox-label`,children:e})]}),cT=e=>{let t=e.title||(e.value===R.DARK?K(`buttons.lightMode`):K(`buttons.darkMode`));return(0,W.jsx)(X,{type:`icon`,icon:e.value===R.LIGHT?lT.MOON:lT.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===R.DARK?R.LIGHT:R.DARK),"data-testid":`toggle-dark-mode`})},lT={SUN:(0,W.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,W.jsx)(`path`,{fill:`currentColor`,d:`M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z`})}),MOON:(0,W.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,W.jsx)(`path`,{fill:`currentColor`,d:`M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z`})})},uT=e=>{let{id:t}=oz(),[n,r]=(0,H.useState)(e.value);return(0,W.jsxs)(`div`,{className:`ProjectName`,children:[(0,W.jsx)(`label`,{className:`ProjectName-label`,htmlFor:`filename`,children:`${e.label}:`}),(0,W.jsx)(`input`,{type:`text`,className:`TextInput`,onBlur:t=>{e.ignoreFocus||Ra(t.target);let n=t.target.value;n!==e.value&&e.onChange(n)},onKeyDown:e=>{if(e.key===N.ENTER){if(e.preventDefault(),e.nativeEvent.isComposing||e.keyCode===229)return;e.currentTarget.blur()}},id:`${t}-filename`,value:n,onChange:e=>r(e.target.value)})]})},dT=5e3,fT=Object.assign(({message:e,onClose:t,closable:n=!1,duration:r=dT,style:i})=>{let a=(0,H.useRef)(0),o=r!==1/0,s=(0,H.useCallback)(()=>{o&&(a.current=window.setTimeout(()=>t(),r))},[t,r,o]);return(0,H.useEffect)(()=>{if(o)return s(),()=>clearTimeout(a.current)},[s,e,r,o]),(0,W.jsxs)(`div`,{className:`Toast`,role:`status`,onMouseEnter:o?()=>clearTimeout(a?.current):void 0,onMouseLeave:o?s:void 0,style:i,children:[(0,W.jsx)(`div`,{className:`Toast__message`,children:e}),n&&(0,W.jsx)(X,{icon:nx,"aria-label":`close`,type:`icon`,onClick:t,className:`close`})]})},{ProgressBar:({progress:e})=>(0,W.jsx)(`div`,{className:`Toast__progress-bar`,children:(0,W.jsx)(`div`,{className:`Toast__progress-bar-fill`,style:{width:`${Math.min(5,Math.round(e*100))}%`}})})});`clipboard`in navigator&&`readText`in navigator.clipboard;var pT=`clipboard`in navigator&&`writeText`in navigator.clipboard,mT=`clipboard`in navigator&&`write`in navigator.clipboard&&`ClipboardItem`in window&&`toBlob`in HTMLCanvasElement.prototype,hT=e=>!!([Na.excalidraw,Na.excalidrawClipboard,Na.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),gT=({types:e,files:t})=>{!e&&!t&&console.warn(`createPasteEvent: no types or files provided`);let n=new ClipboardEvent(F.PASTE,{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e)){if(typeof i!=`string`){t||=[],t.push(i);continue}try{if(n.clipboardData?.items.add(i,r),n.clipboardData?.getData(r)!==i)throw Error(`Failed to set "${r}" as clipboardData item`)}catch(e){throw Error(e.message)}}if(t){let e=-1;for(let r of t){e++;try{if(n.clipboardData?.items.add(r),n.clipboardData?.files[e]!==r)throw Error(`Failed to set file "${r.name}" as clipboardData item`)}catch(e){throw Error(e.message)}}}return n},_T=({elements:e,files:t})=>{let n=lr(e),r=new Set(e.filter(e=>L(e))),i=!1,a=e.reduce((e,n)=>(d(n)&&(i=!0,t&&t[n.fileId]&&(e[n.fileId]=t[n.fileId])),e),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let o={type:Na.excalidrawClipboard,elements:e.map(e=>{if(No(e,n)&&!r.has(No(e,n))){let t=qn(e);return jn(t,n,{frameId:null}),t}return e}),files:t?a:void 0};return JSON.stringify(o)},vT=async(e,t,n)=>{let r=_T({elements:e,files:t});await AT({[hs.excalidrawClipboard]:r,[hs.text]:r},n)};function yT(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let e=n.textContent?.trim();e&&t.push({type:`text`,value:e})}else if(n instanceof HTMLImageElement){let e=n.getAttribute(`src`);e&&e.startsWith(`http`)&&t.push({type:`imageUrl`,value:e})}else t=t.concat(yT(n));return t}var bT=e=>{let t=e.value;try{let e=yT(new DOMParser().parseFromString(t,hs.html).body);if(e.length)return{type:`mixedContent`,value:e}}catch(e){console.error(`error in parseHTMLFromPaste: ${e.message}`)}return null},xT=async()=>{let e={},t;try{t=await navigator.clipboard?.read()}catch(t){try{if(navigator.clipboard?.readText){console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);let e=await navigator.clipboard?.readText();if(e)return{[hs.text]:e}}}catch(t){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);else{if(t.name===`DataError`)return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${t.message}`),e;throw t}}throw t}for(let n of t)for(let t of n.types)if(Sn(Ri,t))try{if(t===hs.text||t===hs.html)e[t]=await(await n.getType(t)).text();else if(Ba(t))e[t]=pa(await n.getType(t),t,void 0);else throw new Ct(`Unsupported clipboard type: ${t}`)}catch(e){console.warn(e instanceof Ct?e.message:`Cannot retrieve ${t} from clipboardItem: ${e.message}`)}return Object.keys(e).length===0&&console.warn(`No clipboard data found from clipboard.read().`),e},ST=async(e,t=!1)=>{try{let n=e.findByType(hs.html),r=!t&&n&&bT(n);return r?r.value.every(e=>e.type===`text`)?{type:`text`,value:e.getData(hs.text)??r.value.map(e=>e.value).join(`
|
|
51
|
-
`).trim()}:r:{type:`text`,value:(e.getData(hs.text)||``).trim()}}catch{return{type:`text`,value:``}}},CT=function(e){return this.find(t=>t.type===e)||null},wT=function(e){return this.find(t=>t.type===e)?.value??null},TT=function(){return this.filter(e=>e.kind===`file`)},ET=e=>{let t;t=MT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=new Set;for(let e of Array.from(t||[]))n.has(e.type)||n.add(e.type);return n},DT=async e=>{let t;t=MT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=(await Promise.all(Array.from(t||[]).map(async t=>{if(t.kind===`file`){let e=t.getAsFile();if(e){let n=await ct(t);return e=await z(e),{type:e.type,kind:`file`,file:e,fileHandle:n}}}else if(t.kind===`string`){let{type:n}=t,r;return r=`clipboardData`in e&&e.clipboardData?e.clipboardData?.getData(n):await new Promise(e=>{t.getAsString(t=>e(t))}),{type:n,kind:`string`,value:r}}return null}))).filter(e=>e!=null);return Object.assign(n,{findByType:CT,getData:wT,getFiles:TT})},OT=async(e,t=!1)=>{let n=await ST(e,t);if(n.type===`mixedContent`)return{mixedContent:n.value};try{let e=JSON.parse(n.value),r=e.type===Na.excalidrawClipboardWithAPI;if(hT(e))return{elements:e.elements,files:e.files,text:t?JSON.stringify(e.elements,null,2):void 0,programmaticAPI:r}}catch{}return{text:n.value}},kT=async e=>{try{await navigator.clipboard.write([new ClipboardItem({[hs.png]:e})])}catch(t){if(ge(e))await navigator.clipboard.write([new ClipboardItem({[hs.png]:await e})]);else throw t}},AT=async(e,t)=>{e||=``;let n=Object.entries(typeof e==`string`?{[hs.text]:e}:e);try{if(t){for(let[e,r]of n)if(t.clipboardData?.setData(e,r),t.clipboardData?.getData(e)!==r)throw Error(`Failed to setData on clipboardEvent`);return}}catch(e){console.error(e)}let r=n.find(([e])=>e===hs.text);if(pT&&r)try{await navigator.clipboard.writeText(r[1]);return}catch(e){console.error(e)}if(r&&!jT(r[1]))throw Error(`Error copying to clipboard.`)},jT=e=>{e||=` `;let t=document.documentElement.getAttribute(`dir`)===`rtl`,n=document.createElement(`textarea`);n.style.border=`0`,n.style.padding=`0`,n.style.margin=`0`,n.style.position=`absolute`,n.style[t?`right`:`left`]=`-9999px`;let r=window.pageYOffset||document.documentElement.scrollTop;n.style.top=`${r}px`,n.style.fontSize=`12pt`,n.setAttribute(`readonly`,``),n.value=e,document.body.appendChild(n);let i=!1;try{n.select(),n.setSelectionRange(0,n.value.length),i=document.execCommand(`copy`)}catch(e){console.error(e)}return n.remove(),i},MT=e=>e.type===F.PASTE||e.type===F.COPY||e.type===F.CUT,NT=(e,{selectedElementIds:t},n)=>{e=Cs(e);let r=n&&Ya(e,{selectedElementIds:t}),i=null,a=r?ir(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return r&&(a.length===1&&L(a[0])?(i=a[0],a=fo(e,i)):a.length>1&&(a=ir(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:i,exportedElements:js(a)}},PT=async(e,t,r,i,{exportBackground:a,exportPadding:o=10,viewBackgroundColor:s,name:c=r.name||`Untitled`,fileHandle:l=null,exportingFrame:u=null})=>{if(t.length===0)throw Error(K(`alerts.cannotExportEmptyCanvas`));if(e===`svg`||e===`clipboard-svg`){let n=be(t,{exportBackground:a,exportWithDarkMode:r.exportWithDarkMode,viewBackgroundColor:s,exportPadding:o,exportScale:r.exportScale,exportEmbedScene:r.exportEmbedScene&&e===`svg`},i,{exportingFrame:u});if(e===`svg`)return ti(n.then(e=>new Blob([Mo+e.outerHTML],{type:hs.svg})),{description:`Export to SVG`,name:c,extension:r.exportEmbedScene?`excalidraw.svg`:`svg`,mimeTypes:[Da.svg],fileHandle:l});if(e===`clipboard-svg`){let e=await n.then(e=>e.outerHTML);try{await AT(e)}catch{throw Error(K(`errors.copyToSystemClipboardFailed`))}return}}let d=j(t,r,i,{exportBackground:a,viewBackgroundColor:s,exportPadding:o,exportingFrame:u});if(e===`png`){let e=er(d);return r.exportEmbedScene&&(e=e.then(e=>n(async()=>{let{encodePngMetadata:e}=await import(`./image-32MOCVDX-
|
|
50
|
+
`},xd=0,Sd=[];function Cd(e){var t=H.useRef([]),n=H.useRef([0,0]),r=H.useRef(),i=H.useState(xd++)[0],a=H.useState(Gu)[0],o=H.useRef(e);H.useEffect(function(){o.current=e},[e]),H.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=bu([e.lockRef.current],(e.shards||[]).map(vd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=H.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=gd(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ld(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ld(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return hd(h,t,e,h===`h`?s:c,!0)},[]),c=H.useCallback(function(e){var n=e;if(!(!Sd.length||Sd[Sd.length-1]!==a)){var r=`deltaY`in n?_d(n):gd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&yd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(vd).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=H.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:wd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=H.useCallback(function(e){n.current=gd(e),r.current=void 0},[]),d=H.useCallback(function(t){l(t.type,_d(t),t.target,s(t,e.lockRef.current))},[]),f=H.useCallback(function(t){l(t.type,gd(t),t.target,s(t,e.lockRef.current))},[]);H.useEffect(function(){return Sd.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,id),document.addEventListener(`touchmove`,c,id),document.addEventListener(`touchstart`,u,id),function(){Sd=Sd.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,id),document.removeEventListener(`touchmove`,c,id),document.removeEventListener(`touchstart`,u,id)}},[]);var p=e.removeScrollBar,m=e.inert;return H.createElement(H.Fragment,null,m?H.createElement(a,{styles:bd(i)}):null,p?H.createElement(td,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Td=Pu(Fu,Cd),Ed=H.forwardRef(function(e,t){return H.createElement(Lu,vu({},e,{ref:t,sideCar:Td}))});Ed.classNames=Lu.classNames;var Dd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Od=new WeakMap,kd=new WeakMap,Ad={},jd=0,Md=function(e){return e&&(e.host||Md(e.parentNode))},Nd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Md(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pd=function(e,t,n,r){var i=Nd(t,Array.isArray(e)?e:[e]);Ad[n]||(Ad[n]=new WeakMap);var a=Ad[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Od.get(e)||0)+1,l=(a.get(e)||0)+1;Od.set(e,c),a.set(e,l),o.push(e),c===1&&i&&kd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),jd++,function(){o.forEach(function(e){var t=Od.get(e)-1,i=a.get(e)-1;Od.set(e,t),a.set(e,i),t||(kd.has(e)||e.removeAttribute(r),kd.delete(e)),i||e.removeAttribute(n)}),jd--,jd||(Od=new WeakMap,Od=new WeakMap,kd=new WeakMap,Ad={})}},Fd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Dd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pd(r,i,n,`aria-hidden`)):function(){return null}},Id=t((e=>{var t=s();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),s=r[0].inst,l=r[1];return o(function(){s.value=n,s.getSnapshot=t,u(s)&&l({inst:s})},[e,n,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ld=t(((e,t)=>{t.exports=Id()}));function Rd(e){let[t,n]=H.useState(void 0);return xl(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var zd=[`top`,`right`,`bottom`,`left`],Bd=Math.min,Vd=Math.max,Hd=Math.round,Ud=Math.floor,Wd=e=>({x:e,y:e}),Gd={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Kd(e,t,n){return Vd(e,Bd(t,n))}function qd(e,t){return typeof e==`function`?e(t):e}function Jd(e){return e.split(`-`)[0]}function Yd(e){return e.split(`-`)[1]}function Xd(e){return e===`x`?`y`:`x`}function Zd(e){return e===`y`?`height`:`width`}function Qd(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $d(e){return Xd(Qd(e))}function ef(e,t,n){n===void 0&&(n=!1);let r=Yd(e),i=$d(e),a=Zd(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=uf(o)),[o,uf(o)]}function tf(e){let t=uf(e);return[nf(e),t,nf(t)]}function nf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rf=[`left`,`right`],af=[`right`,`left`],of=[`top`,`bottom`],sf=[`bottom`,`top`];function cf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?af:rf:t?rf:af;case`left`:case`right`:return t?of:sf;default:return[]}}function lf(e,t,n,r){let i=Yd(e),a=cf(Jd(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nf)))),a}function uf(e){let t=Jd(e);return Gd[t]+e.slice(t.length)}function df(e){return{top:0,right:0,bottom:0,left:0,...e}}function ff(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:df(e)}function pf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function mf(e,t,n){let{reference:r,floating:i}=e,a=Qd(t),o=$d(t),s=Zd(o),c=Jd(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Yd(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function hf(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=qd(t,e),p=ff(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=pf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=pf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var gf=50,_f=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:hf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=mf(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<gf&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=mf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},vf=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=qd(e,t)||{};if(l==null)return{};let d=ff(u),f={x:n,y:r},p=$d(i),m=Zd(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Bd(d[_],T),D=Bd(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,ee=Kd(O,A,k),te=!c.arrow&&Yd(i)!=null&&A!==ee&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,ne=te?A<O?A-O:A-k:0;return{[p]:f[p]+ne,data:{[p]:ee,centerOffset:A-ee-ne,...te&&{alignmentOffset:ne}},reset:te}}}),yf=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=qd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Jd(r),_=Qd(o),v=Jd(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[uf(o)]:tf(o)),x=p!==`none`;!d&&x&&b.push(...lf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ef(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Qd(t))||T.every(e=>Qd(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Qd(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function bf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xf(e){return zd.some(t=>e[t]>=0)}var Sf=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=qd(e,t);switch(i){case`referenceHidden`:{let e=bf(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xf(e)}}}case`escaped`:{let e=bf(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:xf(e)}}}default:return{}}}}},Cf=new Set([`left`,`top`]);async function wf(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Jd(n),s=Yd(n),c=Qd(n)===`y`,l=Cf.has(o)?-1:1,u=a&&c?-1:1,d=qd(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Tf=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await wf(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ef=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=qd(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qd(Jd(i)),p=Xd(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Kd(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Kd(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Df=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=qd(e,t),u={x:n,y:r},d=Qd(i),f=Xd(d),p=u[f],m=u[d],h=qd(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Cf.has(Jd(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Of=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=qd(e,t),u=await o.detectOverflow(t,l),d=Jd(i),f=Yd(i),p=Qd(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Bd(h-u[g],v),x=Bd(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Vd(u.left,0),t=Vd(u.right,0),n=Vd(u.top,0),r=Vd(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Vd(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Vd(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function kf(){return typeof window<`u`}function Af(e){return Nf(e)?(e.nodeName||``).toLowerCase():`#document`}function jf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mf(e){return((Nf(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Nf(e){return kf()?e instanceof Node||e instanceof jf(e).Node:!1}function Pf(e){return kf()?e instanceof Element||e instanceof jf(e).Element:!1}function Ff(e){return kf()?e instanceof HTMLElement||e instanceof jf(e).HTMLElement:!1}function If(e){return!kf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof jf(e).ShadowRoot}function Lf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Jf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Rf(e){return/^(table|td|th)$/.test(Af(e))}function zf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Bf=/transform|translate|scale|rotate|perspective|filter/,Vf=/paint|layout|strict|content/,Hf=e=>!!e&&e!==`none`,Uf;function Wf(e){let t=Pf(e)?Jf(e):e;return Hf(t.transform)||Hf(t.translate)||Hf(t.scale)||Hf(t.rotate)||Hf(t.perspective)||!Kf()&&(Hf(t.backdropFilter)||Hf(t.filter))||Bf.test(t.willChange||``)||Vf.test(t.contain||``)}function Gf(e){let t=Xf(e);for(;Ff(t)&&!qf(t);){if(Wf(t))return t;if(zf(t))return null;t=Xf(t)}return null}function Kf(){return Uf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Uf}function qf(e){return/^(html|body|#document)$/.test(Af(e))}function Jf(e){return jf(e).getComputedStyle(e)}function Yf(e){return Pf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xf(e){if(Af(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||If(e)&&e.host||Mf(e);return If(t)?t.host:t}function Zf(e){let t=Xf(e);return qf(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ff(t)&&Lf(t)?t:Zf(t)}function Qf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Zf(e),i=r===e.ownerDocument?.body,a=jf(r);if(i){let e=$f(a);return t.concat(a,a.visualViewport||[],Lf(r)?r:[],e&&n?Qf(e):[])}else return t.concat(r,Qf(r,[],n))}function $f(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ep(e){let t=Jf(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ff(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Hd(n)!==a||Hd(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tp(e){return Pf(e)?e:e.contextElement}function np(e){let t=tp(e);if(!Ff(t))return Wd(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ep(t),o=(a?Hd(n.width):n.width)/r,s=(a?Hd(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rp=Wd(0);function ip(e){let t=jf(e);return!Kf()||!t.visualViewport?rp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ap(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jf(e)?!1:t}function op(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tp(e),o=Wd(1);t&&(r?Pf(r)&&(o=np(r)):o=np(e));let s=ap(a,n,r)?ip(a):Wd(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=jf(a),t=r&&Pf(r)?jf(r):r,n=e,i=$f(n);for(;i&&r&&t!==n;){let e=np(i),t=i.getBoundingClientRect(),r=Jf(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=jf(i),i=$f(n)}}return pf({width:u,height:d,x:c,y:l})}function sp(e,t){let n=Yf(e).scrollLeft;return t?t.left+n:op(Mf(e)).left+n}function cp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-sp(e,n),y:n.top+t.scrollTop}}function lp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Mf(r),s=t?zf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Wd(1),u=Wd(0),d=Ff(r);if((d||!d&&!a)&&((Af(r)!==`body`||Lf(o))&&(c=Yf(r)),d)){let e=op(r);l=np(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?cp(o,c):Wd(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function up(e){return Array.from(e.getClientRects())}function dp(e){let t=Mf(e),n=Yf(e),r=e.ownerDocument.body,i=Vd(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Vd(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+sp(e),s=-n.scrollTop;return Jf(r).direction===`rtl`&&(o+=Vd(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var fp=25;function pp(e,t){let n=jf(e),r=Mf(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Kf();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=sp(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=fp&&(a-=o)}else l<=fp&&(a+=l);return{width:a,height:o,x:s,y:c}}function mp(e,t){let n=op(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ff(e)?np(e):Wd(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function hp(e,t,n){let r;if(t===`viewport`)r=pp(e,n);else if(t===`document`)r=dp(Mf(e));else if(Pf(t))r=mp(t,n);else{let n=ip(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pf(r)}function gp(e,t){let n=Xf(e);return n===t||!Pf(n)||qf(n)?!1:Jf(n).position===`fixed`||gp(n,t)}function _p(e,t){let n=t.get(e);if(n)return n;let r=Qf(e,[],!1).filter(e=>Pf(e)&&Af(e)!==`body`),i=null,a=Jf(e).position===`fixed`,o=a?Xf(e):e;for(;Pf(o)&&!qf(o);){let t=Jf(o),n=Wf(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Lf(o)&&!n&&gp(e,o))?r=r.filter(e=>e!==o):i=t,o=Xf(o)}return t.set(e,r),r}function vp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?zf(t)?[]:_p(t,this._c):[].concat(n),r],o=hp(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=hp(t,a[e],i);s=Vd(n.top,s),c=Bd(n.right,c),l=Bd(n.bottom,l),u=Vd(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function yp(e){let{width:t,height:n}=ep(e);return{width:t,height:n}}function bp(e,t,n){let r=Ff(t),i=Mf(t),a=n===`fixed`,o=op(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Wd(0);function l(){c.x=sp(i)}if(r||!r&&!a)if((Af(t)!==`body`||Lf(i))&&(s=Yf(t)),r){let e=op(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?cp(i,s):Wd(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function xp(e){return Jf(e).position===`static`}function Sp(e,t){if(!Ff(e)||Jf(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Mf(e)===n&&(n=n.ownerDocument.body),n}function Cp(e,t){let n=jf(e);if(zf(e))return n;if(!Ff(e)){let t=Xf(e);for(;t&&!qf(t);){if(Pf(t)&&!xp(t))return t;t=Xf(t)}return n}let r=Sp(e,t);for(;r&&Rf(r)&&xp(r);)r=Sp(r,t);return r&&qf(r)&&xp(r)&&!Wf(r)?n:r||Gf(e)||n}var wp=async function(e){let t=this.getOffsetParent||Cp,n=this.getDimensions,r=await n(e.floating);return{reference:bp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tp(e){return Jf(e).direction===`rtl`}var Ep={convertOffsetParentRelativeRectToViewportRelativeRect:lp,getDocumentElement:Mf,getClippingRect:vp,getOffsetParent:Cp,getElementRects:wp,getClientRects:up,getDimensions:yp,getScale:np,isElement:Pf,isRTL:Tp};function Dp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Op(e,t){let n=null,r,i=Mf(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ud(d),h=Ud(i.clientWidth-(u+f)),g=Ud(i.clientHeight-(d+p)),_=Ud(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Vd(0,Bd(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Dp(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function kp(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tp(e),u=i||a?[...l?Qf(l):[],...t?Qf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Op(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?op(e):null;c&&g();function g(){let t=op(e);h&&!Dp(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ap=Tf,jp=Ef,Mp=yf,Np=Of,Pp=Sf,Fp=vf,Ip=Df,Lp=(e,t,n)=>{let r=new Map,i={platform:Ep,...n},a={...i.platform,_c:r};return _f(e,t,{...i,platform:a})},Rp=typeof document<`u`?H.useLayoutEffect:function(){};function zp(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,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!zp(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Bp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vp(e,t){let n=Bp(e);return Math.round(t*n)/n}function Hp(e){let t=H.useRef(e);return Rp(()=>{t.current=e}),t}function Up(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=H.useState(r);zp(f,r)||p(r);let[m,h]=H.useState(null),[g,_]=H.useState(null),v=H.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=H.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=H.useRef(null),C=H.useRef(null),w=H.useRef(u),T=c!=null,E=Hp(c),D=Hp(i),O=Hp(l),k=H.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Lp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!zp(w.current,t)&&(w.current=t,_c.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Rp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=H.useRef(!1);Rp(()=>(A.current=!0,()=>{A.current=!1}),[]),Rp(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let ee=H.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),te=H.useMemo(()=>({reference:b,floating:x}),[b,x]),ne=H.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Vp(te.floating,u.x),r=Vp(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Bp(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:k,refs:ee,elements:te,floatingStyles:ne}),[u,k,ee,te,ne])}var Wp=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fp({element:r.current,padding:i}).fn(n):r?Fp({element:r,padding:i}).fn(n):{}}}},Gp=(e,t)=>{let n=Ap(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kp=(e,t)=>{let n=jp(e);return{name:n.name,fn:n.fn,options:[e,t]}},qp=(e,t)=>({fn:Ip(e).fn,options:[e,t]}),Jp=(e,t)=>{let n=Mp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yp=(e,t)=>{let n=Np(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xp=(e,t)=>{let n=Pp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zp=(e,t)=>{let n=Wp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qp=`Arrow`,$p=H.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,W.jsx)(gl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,W.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});$p.displayName=Qp;var em=$p,tm=`Popper`,[nm,rm]=vl(tm),[im,am]=nm(tm),om=e=>{let{__scopePopper:t,children:n}=e,[r,i]=H.useState(null);return(0,W.jsx)(im,{scope:t,anchor:r,onAnchorChange:i,children:n})};om.displayName=tm;var sm=`PopperAnchor`,cm=H.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=am(sm,n),o=H.useRef(null),s=ll(t,o),c=H.useRef(null);return H.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,W.jsx)(gl.div,{...i,ref:s})});cm.displayName=sm;var lm=`PopperContent`,[um,dm]=nm(lm),fm=H.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=am(lm,n),[_,v]=H.useState(null),y=ll(t,e=>v(e)),[b,x]=H.useState(null),S=Rd(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(gm),altBoundary:O},{refs:A,floatingStyles:ee,placement:te,isPositioned:ne,middlewareData:j}=Up({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>kp(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Gp({mainAxis:i+w,alignmentAxis:o}),c&&Kp({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?qp():void 0,...k}),c&&Jp({...k}),Yp({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Zp({element:b,padding:s}),_m({arrowWidth:C,arrowHeight:w}),f&&Xp({strategy:`referenceHidden`,...k})]}),[re,ie]=vm(te),ae=Il(m);xl(()=>{ne&&ae?.()},[ne,ae]);let oe=j.arrow?.x,se=j.arrow?.y,ce=j.arrow?.centerOffset!==0,[le,ue]=H.useState();return xl(()=>{_&&ue(window.getComputedStyle(_).zIndex)},[_]),(0,W.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:ne?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[j.transformOrigin?.x,j.transformOrigin?.y].join(` `),...j.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,W.jsx)(um,{scope:n,placedSide:re,onArrowChange:x,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,W.jsx)(gl.div,{"data-side":re,"data-align":ie,...h,ref:y,style:{...h.style,animation:ne?void 0:`none`}})})})});fm.displayName=lm;var pm=`PopperArrow`,mm={top:`bottom`,right:`left`,bottom:`top`,left:`right`},hm=H.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=dm(pm,n),a=mm[i.placedSide];return(0,W.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,W.jsx)(em,{...r,ref:t,style:{...r.style,display:`block`}})})});hm.displayName=pm;function gm(e){return e!==null}var _m=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=vm(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function vm(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ym=om,bm=cm,xm=fm,Sm=hm,Cm=`rovingFocusGroup.onEntryFocus`,wm={bubbles:!1,cancelable:!0},Tm=`RovingFocusGroup`,[Em,Dm,Om]=bl(Tm),[km,Am]=vl(Tm,[Om]),[jm,Mm]=km(Tm),Nm=H.forwardRef((e,t)=>(0,W.jsx)(Em.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(Em.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(Pm,{...e,ref:t})})}));Nm.displayName=Tm;var Pm=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=H.useRef(null),p=ll(t,f),m=Fl(a),[h,g]=Cl({prop:o,defaultProp:s??null,onChange:c,caller:Tm}),[_,v]=H.useState(!1),y=Il(l),b=Dm(n),x=H.useRef(!1),[S,C]=H.useState(0);return H.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Cm,y),()=>e.removeEventListener(Cm,y)},[y]),(0,W.jsx)(jm,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:H.useCallback(e=>g(e),[g]),onItemShiftTab:H.useCallback(()=>v(!0),[]),onFocusableItemAdd:H.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:H.useCallback(()=>C(e=>e-1),[]),children:(0,W.jsx)(gl.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:G(e.onMouseDown,()=>{x.current=!0}),onFocus:G(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Cm,wm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Bm([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:G(e.onBlur,()=>v(!1))})})}),Fm=`RovingFocusGroupItem`,Im=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Nl(),l=a||c,u=Mm(Fm,n),d=u.currentTabStopId===l,f=Dm(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return H.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,W.jsx)(Em.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,W.jsx)(gl.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:G(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:G(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:G(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=zm(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Vm(n,r+1):n.slice(r+1)}setTimeout(()=>Bm(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Im.displayName=Fm;var Lm={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Rm(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function zm(e,t,n){let r=Rm(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Lm[r]}function Bm(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Vm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hm=Nm,Um=Im,Wm=[`Enter`,` `],Gm=[`ArrowDown`,`PageUp`,`Home`],Km=[`ArrowUp`,`PageDown`,`End`],qm=[...Gm,...Km],Jm={ltr:[...Wm,`ArrowRight`],rtl:[...Wm,`ArrowLeft`]},Ym={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xm=`Menu`,[Zm,Qm,$m]=bl(Xm),[eh,th]=vl(Xm,[$m,rm,Am]),nh=rm(),rh=Am(),[ih,ah]=eh(Xm),[oh,sh]=eh(Xm),ch=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=nh(t),[c,l]=H.useState(null),u=H.useRef(!1),d=Il(a),f=Fl(i);return H.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,W.jsx)(ym,{...s,children:(0,W.jsx)(ih,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,W.jsx)(oh,{scope:t,onClose:H.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};ch.displayName=Xm;var lh=`MenuAnchor`,uh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nh(n);return(0,W.jsx)(bm,{...i,...r,ref:t})});uh.displayName=lh;var dh=`MenuPortal`,[fh,ph]=eh(dh,{forceMount:void 0}),mh=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ah(dh,t);return(0,W.jsx)(fh,{scope:t,forceMount:n,children:(0,W.jsx)(Dl,{present:n||a.open,children:(0,W.jsx)(mu,{asChild:!0,container:i,children:r})})})};mh.displayName=dh;var hh=`MenuContent`,[gh,_h]=eh(hh),vh=H.forwardRef((e,t)=>{let n=ph(hh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ah(hh,e.__scopeMenu),o=sh(hh,e.__scopeMenu);return(0,W.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Dl,{present:r||a.open,children:(0,W.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:o.modal?(0,W.jsx)(yh,{...i,ref:t}):(0,W.jsx)(bh,{...i,ref:t})})})})}),yh=H.forwardRef((e,t)=>{let n=ah(hh,e.__scopeMenu),r=H.useRef(null),i=ll(t,r);return H.useEffect(()=>{let e=r.current;if(e)return Fd(e)},[]),(0,W.jsx)(Sh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bh=H.forwardRef((e,t)=>{let n=ah(hh,e.__scopeMenu);return(0,W.jsx)(Sh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xh=ul(`MenuContent.ScrollLock`),Sh=H.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=ah(hh,n),_=sh(hh,n),v=nh(n),y=rh(n),b=Qm(n),[x,S]=H.useState(null),C=H.useRef(null),w=ll(t,C,g.onContentChange),T=H.useRef(0),E=H.useRef(``),D=H.useRef(0),O=H.useRef(null),k=H.useRef(`right`),A=H.useRef(0),ee=m?Ed:H.Fragment,te=m?{as:xh,allowPinchZoom:!0}:void 0,ne=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=og(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};H.useEffect(()=>()=>window.clearTimeout(T.current),[]),gu();let j=H.useCallback(e=>k.current===O.current?.side&&cg(e,O.current?.area),[]);return(0,W.jsx)(gh,{scope:n,searchRef:E,onItemEnter:H.useCallback(e=>{j(e)&&e.preventDefault()},[j]),onItemLeave:H.useCallback(e=>{j(e)||(C.current?.focus(),S(null))},[j]),onTriggerLeave:H.useCallback(e=>{j(e)&&e.preventDefault()},[j]),pointerGraceTimerRef:D,onPointerGraceIntentChange:H.useCallback(e=>{O.current=e},[]),children:(0,W.jsx)(ee,{...te,children:(0,W.jsx)(tu,{asChild:!0,trapped:i,onMountAutoFocus:G(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,W.jsx)(Wl,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,W.jsx)(Hm,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:G(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,W.jsx)(xm,{role:`menu`,"aria-orientation":`vertical`,"data-state":tg(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:G(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=C.current;if(e.target!==i||!qm.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Km.includes(e.key)&&a.reverse(),ig(a)}),onBlur:G(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:G(e.onPointerMove,lg(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});vh.displayName=hh;var Ch=`MenuGroup`,wh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{role:`group`,...r,ref:t})});wh.displayName=Ch;var Th=`MenuLabel`,Eh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{...r,ref:t})});Eh.displayName=Th;var Dh=`MenuItem`,Oh=`menu.itemSelect`,kh=H.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=H.useRef(null),o=sh(Dh,e.__scopeMenu),s=_h(Dh,e.__scopeMenu),c=ll(t,a),l=H.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Oh,{bubbles:!0,cancelable:!0});e.addEventListener(Oh,e=>r?.(e),{once:!0}),_l(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,W.jsx)(Ah,{...i,ref:c,disabled:n,onClick:G(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:G(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:G(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Wm.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kh.displayName=Dh;var Ah=H.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=_h(Dh,n),s=rh(n),c=H.useRef(null),l=ll(t,c),[u,d]=H.useState(!1),[f,p]=H.useState(``);return H.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,W.jsx)(Zm.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,W.jsx)(Um,{asChild:!0,...s,focusable:!r,children:(0,W.jsx)(gl.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:G(e.onPointerMove,lg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,lg(e=>o.onItemLeave(e))),onFocus:G(e.onFocus,()=>d(!0)),onBlur:G(e.onBlur,()=>d(!1))})})})}),jh=`MenuCheckboxItem`,Mh=H.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,W.jsx)(Bh,{scope:e.__scopeMenu,checked:n,children:(0,W.jsx)(kh,{role:`menuitemcheckbox`,"aria-checked":ng(n)?`mixed`:n,...i,ref:t,"data-state":rg(n),onSelect:G(i.onSelect,()=>r?.(ng(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mh.displayName=jh;var Nh=`MenuRadioGroup`,[Ph,Fh]=eh(Nh,{value:void 0,onValueChange:()=>{}}),Ih=H.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Il(r);return(0,W.jsx)(Ph,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,W.jsx)(wh,{...i,ref:t})})});Ih.displayName=Nh;var Lh=`MenuRadioItem`,Rh=H.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fh(Lh,e.__scopeMenu),a=n===i.value;return(0,W.jsx)(Bh,{scope:e.__scopeMenu,checked:a,children:(0,W.jsx)(kh,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":rg(a),onSelect:G(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rh.displayName=Lh;var zh=`MenuItemIndicator`,[Bh,Vh]=eh(zh,{checked:!1}),Hh=H.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vh(zh,n);return(0,W.jsx)(Dl,{present:r||ng(a.checked)||a.checked===!0,children:(0,W.jsx)(gl.span,{...i,ref:t,"data-state":rg(a.checked)})})});Hh.displayName=zh;var Uh=`MenuSeparator`,Wh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wh.displayName=Uh;var Gh=`MenuArrow`,Kh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nh(n);return(0,W.jsx)(Sm,{...i,...r,ref:t})});Kh.displayName=Gh;var qh=`MenuSub`,[Jh,Yh]=eh(qh),Xh=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ah(qh,t),o=nh(t),[s,c]=H.useState(null),[l,u]=H.useState(null),d=Il(i);return H.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,W.jsx)(ym,{...o,children:(0,W.jsx)(ih,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,W.jsx)(Jh,{scope:t,contentId:Nl(),triggerId:Nl(),trigger:s,onTriggerChange:c,children:n})})})};Xh.displayName=qh;var Zh=`MenuSubTrigger`,Qh=H.forwardRef((e,t)=>{let n=ah(Zh,e.__scopeMenu),r=sh(Zh,e.__scopeMenu),i=Yh(Zh,e.__scopeMenu),a=_h(Zh,e.__scopeMenu),o=H.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=H.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return H.useEffect(()=>u,[u]),H.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,W.jsx)(uh,{asChild:!0,...l,children:(0,W.jsx)(Ah,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tg(n.open),...e,ref:cl(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(e.onPointerMove,lg(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:G(e.onPointerLeave,lg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:G(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Jm[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qh.displayName=Zh;var $h=`MenuSubContent`,eg=H.forwardRef((e,t)=>{let n=ph(hh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ah(hh,e.__scopeMenu),o=sh(hh,e.__scopeMenu),s=Yh($h,e.__scopeMenu),c=H.useRef(null),l=ll(t,c);return(0,W.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Dl,{present:r||a.open,children:(0,W.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:(0,W.jsx)(Sh,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:G(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:G(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ym[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});eg.displayName=$h;function tg(e){return e?`open`:`closed`}function ng(e){return e===`indeterminate`}function rg(e){return ng(e)?`indeterminate`:e?`checked`:`unchecked`}function ig(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ag(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function og(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ag(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sg(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cg(e,t){return t?sg({x:e.clientX,y:e.clientY},t):!1}function lg(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ug=ch,dg=uh,fg=mh,pg=vh,mg=wh,hg=Eh,gg=kh,_g=Mh,vg=Ih,yg=Rh,bg=Hh,xg=Wh,Sg=Kh,Cg=Xh,wg=Qh,Tg=eg,Eg=`DropdownMenu`,[Dg,Og]=vl(Eg,[th]),kg=th(),[Ag,jg]=Dg(Eg),Mg=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=kg(t),l=H.useRef(null),[u,d]=Cl({prop:i,defaultProp:a??!1,onChange:o,caller:Eg});return(0,W.jsx)(Ag,{scope:t,triggerId:Nl(),triggerRef:l,contentId:Nl(),open:u,onOpenChange:d,onOpenToggle:H.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,W.jsx)(ug,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Mg.displayName=Eg;var Ng=`DropdownMenuTrigger`,Pg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=jg(Ng,n),o=kg(n);return(0,W.jsx)(dg,{asChild:!0,...o,children:(0,W.jsx)(gl.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:cl(t,a.triggerRef),onPointerDown:G(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:G(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Pg.displayName=Ng;var Fg=`DropdownMenuPortal`,Ig=e=>{let{__scopeDropdownMenu:t,...n}=e,r=kg(t);return(0,W.jsx)(fg,{...r,...n})};Ig.displayName=Fg;var Lg=`DropdownMenuContent`,Rg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jg(Lg,n),a=kg(n),o=H.useRef(!1);return(0,W.jsx)(pg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:G(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.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)`}})});Rg.displayName=Lg;var zg=`DropdownMenuGroup`,Bg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(mg,{...i,...r,ref:t})});Bg.displayName=zg;var Vg=`DropdownMenuLabel`,Hg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(hg,{...i,...r,ref:t})});Hg.displayName=Vg;var Ug=`DropdownMenuItem`,Wg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(gg,{...i,...r,ref:t})});Wg.displayName=Ug;var Gg=`DropdownMenuCheckboxItem`,Kg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(_g,{...i,...r,ref:t})});Kg.displayName=Gg;var qg=`DropdownMenuRadioGroup`,Jg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(vg,{...i,...r,ref:t})});Jg.displayName=qg;var Yg=`DropdownMenuRadioItem`,Xg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(yg,{...i,...r,ref:t})});Xg.displayName=Yg;var Zg=`DropdownMenuItemIndicator`,Qg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(bg,{...i,...r,ref:t})});Qg.displayName=Zg;var $g=`DropdownMenuSeparator`,e_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(xg,{...i,...r,ref:t})});e_.displayName=$g;var t_=`DropdownMenuArrow`,n_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(Sg,{...i,...r,ref:t})});n_.displayName=t_;var r_=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=kg(t),[s,c]=Cl({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,W.jsx)(Cg,{...o,open:s,onOpenChange:c,children:n})},i_=`DropdownMenuSubTrigger`,a_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(wg,{...i,...r,ref:t})});a_.displayName=i_;var o_=`DropdownMenuSubContent`,s_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(Tg,{...i,...r,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)`}})});s_.displayName=o_;var c_=Mg,l_=Pg,u_=Rg,d_=Wg,f_=r_,p_=a_,m_=s_,h_=`Popover`,[g_,__]=vl(h_,[rm]),v_=rm(),[y_,b_]=g_(h_),x_=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=v_(t),c=H.useRef(null),[l,u]=H.useState(!1),[d,f]=Cl({prop:r,defaultProp:i??!1,onChange:a,caller:h_});return(0,W.jsx)(ym,{...s,children:(0,W.jsx)(y_,{scope:t,contentId:Nl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:H.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:n})})};x_.displayName=h_;var S_=`PopoverAnchor`,C_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(S_,n),a=v_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return H.useEffect(()=>(o(),()=>s()),[o,s]),(0,W.jsx)(bm,{...a,...r,ref:t})});C_.displayName=S_;var w_=`PopoverTrigger`,T_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(w_,n),a=v_(n),o=ll(t,i.triggerRef),s=(0,W.jsx)(gl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":B_(i.open),...r,ref:o,onClick:G(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,W.jsx)(bm,{asChild:!0,...a,children:s})});T_.displayName=w_;var E_=`PopoverPortal`,[D_,O_]=g_(E_,{forceMount:void 0}),k_=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=b_(E_,t);return(0,W.jsx)(D_,{scope:t,forceMount:n,children:(0,W.jsx)(Dl,{present:n||a.open,children:(0,W.jsx)(mu,{asChild:!0,container:i,children:r})})})};k_.displayName=E_;var A_=`PopoverContent`,j_=H.forwardRef((e,t)=>{let n=O_(A_,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=b_(A_,e.__scopePopover);return(0,W.jsx)(Dl,{present:r||a.open,children:a.modal?(0,W.jsx)(N_,{...i,ref:t}):(0,W.jsx)(P_,{...i,ref:t})})});j_.displayName=A_;var M_=ul(`PopoverContent.RemoveScroll`),N_=H.forwardRef((e,t)=>{let n=b_(A_,e.__scopePopover),r=H.useRef(null),i=ll(t,r),a=H.useRef(!1);return H.useEffect(()=>{let e=r.current;if(e)return Fd(e)},[]),(0,W.jsx)(Ed,{as:M_,allowPinchZoom:!0,children:(0,W.jsx)(F_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),P_=H.forwardRef((e,t)=>{let n=b_(A_,e.__scopePopover),r=H.useRef(!1),i=H.useRef(!1);return(0,W.jsx)(F_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),F_=H.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=b_(A_,n),p=v_(n);return gu(),(0,W.jsx)(tu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,W.jsx)(Wl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,W.jsx)(xm,{"data-state":B_(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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)`}})})})}),I_=`PopoverClose`,L_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(I_,n);return(0,W.jsx)(gl.button,{type:`button`,...r,ref:t,onClick:G(e.onClick,()=>i.onOpenChange(!1))})});L_.displayName=I_;var R_=`PopoverArrow`,z_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=v_(n);return(0,W.jsx)(Sm,{...i,...r,ref:t})});z_.displayName=R_;function B_(e){return e?`open`:`closed`}var V_=x_,H_=T_,U_=k_,W_=j_,G_=z_,K_=`Tabs`,[q_,J_]=vl(K_,[Am]),Y_=Am(),[X_,Z_]=q_(K_),Q_=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Fl(s),[d,f]=Cl({prop:r,onChange:i,defaultProp:a??``,caller:K_});return(0,W.jsx)(X_,{scope:n,baseId:Nl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,W.jsx)(gl.div,{dir:u,"data-orientation":o,...l,ref:t})})});Q_.displayName=K_;var $_=`TabsList`,ev=H.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Z_($_,n),o=Y_(n);return(0,W.jsx)(Hm,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,W.jsx)(gl.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ev.displayName=$_;var tv=`TabsTrigger`,nv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Z_(tv,n),s=Y_(n),c=av(o.baseId,r),l=ov(o.baseId,r),u=r===o.value;return(0,W.jsx)(Um,{asChild:!0,...s,focusable:!i,active:u,children:(0,W.jsx)(gl.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:G(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:G(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});nv.displayName=tv;var rv=`TabsContent`,iv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Z_(rv,n),c=av(s.baseId,r),l=ov(s.baseId,r),u=r===s.value,d=H.useRef(u);return H.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,W.jsx)(Dl,{present:i||u,children:({present:n})=>(0,W.jsx)(gl.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});iv.displayName=rv;function av(e,t){return`${e}-trigger-${t}`}function ov(e,t){return`${e}-content-${t}`}var sv=Q_,cv=ev,lv=nv,uv=iv,dv=e(t(((e,t)=>{(function(){var n=this,r={};e===void 0?n.fuzzy=r:t.exports=r,r.simpleFilter=function(e,t){return t.filter(function(t){return r.test(e,t)})},r.test=function(e,t){return r.match(e,t)!==null},r.match=function(e,t,n){n||={};var r=0,i=[],a=t.length,o=0,s=0,c=n.pre||``,l=n.post||``,u=n.caseSensitive&&t||t.toLowerCase(),d;e=n.caseSensitive&&e||e.toLowerCase();for(var f=0;f<a;f++)d=t[f],u[f]===e[r]?(d=c+d+l,r+=1,s+=1+s):s=0,o+=s,i[i.length]=d;return r===e.length?(o=u===e?1/0:o,{rendered:i.join(``),score:o}):null},r.filter=function(e,t,n){return!t||t.length===0?[]:typeof e==`string`?(n||={},t.reduce(function(t,i,a,o){var s=i;n.extract&&(s=n.extract(i));var c=r.match(e,s,n);return c!=null&&(t[t.length]={string:c.rendered,score:c.score,index:a,original:i}),t},[]).sort(function(e,t){return t.score-e.score||e.index-t.index})):t}})()}))(),1),fv=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},pv=e=>e?fv(e):fv,mv=t((e=>{var t=s(),n=Ld();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),s!==void 0&&f.hasValue){var t=f.value;if(s(t,e))return c=t}return c=e}if(t=c,i(o,e))return t;var n=r(e);return s!==void 0&&s(t,n)?(o=e,t):(o=e,c=n)}var a=!1,o,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,s]);var p=a(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),hv=e(t(((e,t)=>{t.exports=mv()}))(),1),{useDebugValue:gv}=H.default,{useSyncExternalStoreWithSelector:_v}=hv.default,vv=e=>e;function yv(e,t=vv,n){let r=_v(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return gv(r),r}var bv=e=>{let t=typeof e==`function`?pv(e):e,n=(e,n)=>yv(t,e,n);return Object.assign(n,t),n},xv=e=>e?bv(e):bv,Sv,Cv=typeof window<`u`&&((Sv=window.document)!=null&&Sv.createElement||window.navigator?.product===`ReactNative`)?H.useLayoutEffect:H.useEffect;function wv(){let e=xv(e=>({current:[],version:0,set:e}));return{In:({children:t})=>{let n=e(e=>e.set),r=e(e=>e.version);return Cv(()=>{n(e=>({version:e.version+1}))},[]),Cv(()=>(n(({current:e})=>({current:[...e,t]})),()=>n(({current:e})=>({current:e.filter(e=>e!==t)}))),[t,r]),null},Out:()=>{let t=e(e=>e.current);return H.createElement(H.Fragment,null,t)}}}function Tv(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function Ev(e,t,n){let r=Tv(t,n);if(r===0)return Tv(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),Tv(e,Dv(t,n,i))}function Dv(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Ov(e,t){return kv(e,0,e.length,t)}function kv(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=Ev(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(kv(e,t,l+1,r,a),kv(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function Av(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}function jv(e){return[-e[0],-e[1]]}function Mv(e,t){return[e[0]+t[0],e[1]+t[1]]}function Nv(e,t){return[e[0]-t[0],e[1]-t[1]]}function Pv(e,t){return[e[0]*t,e[1]*t]}function Fv(e,t){return[e[0]/t,e[1]/t]}function Iv(e){return[e[1],-e[0]]}function Lv(e,t){return e[0]*t[0]+e[1]*t[1]}function Rv(e,t){return e[0]===t[0]&&e[1]===t[1]}function zv(e){return Math.hypot(e[0],e[1])}function Bv(e){return e[0]*e[0]+e[1]*e[1]}function Vv(e,t){return Bv(Nv(e,t))}function Hv(e){return Fv(e,zv(e))}function Uv(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Wv(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function Gv(e,t,n){return Mv(e,Pv(Nv(t,e),n))}function Kv(e,t,n){return Mv(e,Pv(t,n))}var{min:qv,PI:Jv}=Math,Yv=.275,Xv=Jv+1e-4;function Zv(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=s.taper===!1?0:s.taper===!0?Math.max(n,m):s.taper,g=c.taper===!1?0:c.taper===!0?Math.max(n,m):c.taper,_=(n*r)**2,v=[],y=[],b=e.slice(0,10).reduce((e,t)=>{let r=t.pressure;if(a){let i=qv(1,t.distance/n);r=qv(1,e+(qv(1,1-i)-e)*(i*Yv))}return(e+r)/2},e[0].pressure),x=Av(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,w=e[0].point,T=w,E=w,D=T,O=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t];if(t<e.length-1&&m-u<3)continue;if(i){if(a){let e=qv(1,l/n),t=qv(1,1-e);r=qv(1,b+(t-b)*(e*Yv))}x=Av(n,i,r,o)}else x=n/2;S===void 0&&(S=x);let f=u<h?d(u/h):1,k=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(f,k));let A=(t<e.length-1?e[t+1]:e[t]).vector,ee=t<e.length-1?Lv(c,A):1,te=Lv(c,C)<0&&!O,ne=ee!==null&&ee<0;if(te||ne){let e=Pv(Iv(C),x);for(let t=0;t<=1;t+=.07692307692307693)E=Wv(Nv(s,e),s,Xv*t),v.push(E),D=Wv(Mv(s,e),s,Xv*-t),y.push(D);w=E,T=D,ne&&(O=!0);continue}if(O=!1,t===e.length-1){let e=Pv(Iv(c),x);v.push(Nv(s,e)),y.push(Mv(s,e));continue}let j=Pv(Iv(Gv(A,c,ee)),x);E=Nv(s,j),(t<=1||Vv(w,E)>_)&&(v.push(E),w=E),D=Mv(s,j),(t<=1||Vv(T,D)>_)&&(y.push(D),T=D),b=r,C=c}let k=e[0].point.slice(0,2),A=e.length>1?e[e.length-1].point.slice(0,2):Mv(e[0].point,[1,1]),ee=[],te=[];if(e.length===1){if(!(h||g)||l){let e=Kv(k,Hv(Iv(Nv(k,A))),-(S||x)),t=[];for(let n=1/13,r=n;r<=1;r+=n)t.push(Wv(e,k,Xv*2*r));return t}}else{if(!(h||g&&e.length===1))if(u)for(let e=1/13,t=e;t<=1;t+=e){let e=Wv(y[0],k,Xv*t);ee.push(e)}else{let e=Nv(v[0],y[0]),t=Pv(e,.5),n=Pv(e,.51);ee.push(Nv(k,t),Nv(k,n),Mv(k,n),Mv(k,t))}let t=Iv(jv(e[e.length-1].vector));if(g||h&&e.length===1)te.push(A);else if(f){let e=Kv(A,t,x);for(let t=1/29,n=t;n<1;n+=t)te.push(Wv(e,A,Xv*3*n))}else te.push(Mv(A,Pv(t,x)),Mv(A,Pv(t,x*.99)),Nv(A,Pv(t,x*.99)),Nv(A,Pv(t,x)))}return v.concat(te,y.reverse(),ee)}function Qv(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=.5})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(Gv(o[0],e,t/4))}o.length===1&&(o=[...o,[...Mv(o[0],[1,1]),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:o[0][2]>=0?o[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?o[e].slice(0,2):Gv(u.point,o[e],a);if(Rv(u.point,t))continue;let n=Uv(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}u={point:t,pressure:o[e][2]>=0?o[e][2]:.5,vector:Hv(Nv(u.point,t)),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function $v(e,t={}){return Zv(Qv(e,t),t)}function ey(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}ey({},`LaserPointer`,()=>hy);function ty([e,t,n],[r,i,a]){return[e+r,t+i,n+a]}function ny([e,t,n],[r,i,a]){return[e-r,t-i,n-a]}function ry([e,t,n],r){return[e*r,t*r,n*r]}function iy([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function ay([e,t,n],r){return[Math.cos(r)*e-Math.sin(r)*t,Math.sin(r)*e+Math.cos(r)*t,n]}function oy(e,t,n){return ty(e,ry(ny(t,e),n))}function sy(e,t,n){return Math.atan2(n[1]-e[1],n[0]-e[0])-Math.atan2(t[1]-e[1],t[0]-e[0])}function cy(e){return Math.atan2(Math.sin(e),Math.cos(e))}function ly([e,t]){return Math.sqrt(e**2+t**2)}function uy([e,t],[n,r]){return Math.sqrt((n-e)**2+(r-t)**2)}function dy(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=uy(e[n-1],e[n]);return t+=uy(e[e.length-2],e[e.length-1]),t}var fy=(e,t,n)=>Math.max(t,Math.min(n,e));function py(e,t,n){let r=uy(t,n);if(r===0)return uy(e,t);let i=fy(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r**2,0,1);return uy([t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]],e)}function my(e,t){if(t===0||e.length<=2)return e;let n=e[0],r=e[e.length-1],[i,a]=e.reduce(([e,t],i,a)=>{let o=py(i,n,r);return o>e?[o,a]:[e,t]},[0,-1]);if(i>=t){let i=e[a];return[...my([n,...e.slice(1,a),i],t).slice(0,-1),i,...my([i,...e.slice(a,-1),r],t).slice(1)]}else return[n,r]}var hy=class e{static{this.defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:`output`,keepHead:!1,sizeMapping:()=>1}}static{this.constants={cornerDetectionMaxAngle:75,cornerDetectionVariance:e=>e>35?.5:1,maxTailLength:50}}constructor(t){this.originalPoints=[],this.stablePoints=[],this.tailPoints=[],this.isFresh=!0,this.options=Object.assign({},e.defaults,t)}get lastPoint(){return this.tailPoints[this.tailPoints.length-1]??this.stablePoints[this.stablePoints.length-1]}addPoint(t){let n=this.originalPoints[this.originalPoints.length-1];if(!(n&&n[0]===t[0]&&n[1]===t[1])){if(this.originalPoints.push(t),this.isFresh){this.isFresh=!1,this.stablePoints.push(t);return}this.options.streamline>0&&(t=oy(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),dy(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase==`tail`)throw Error(`Not implemented yet`);this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(e,t,n,r,i){return(e??this.options.size)*this.options.sizeMapping({pressure:t,runningLength:i,currentIndex:n,totalLength:r})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase===`input`&&(n=my(n,this.options.simplify));let r=n.length;if(r===0)return[];if(r===1){let e=n[0],i=this.getSize(t,e[2],0,r,0);if(i<.5)return[];let a=[];for(let t=0;t<=Math.PI*2;t+=Math.PI/16)a.push(ty(e,ry(ay([1,0,0],t),i)));return a.push(ty(e,ry([1,0,0],this.getSize(t,e[2],0,r,0)))),a}if(r===2){let e=n[0],i=n[1],a=this.getSize(t,e[2],0,r,0),o=this.getSize(t,i[2],0,r,0);if(a<.5||o<.5)return[];let s=[],c=sy(e,[e[0],e[1]-100,e[2]],i);for(let t=c;t<=Math.PI+c;t+=Math.PI/16)s.push(ty(e,ry(ay([1,0,0],t),a)));for(let e=Math.PI+c;e<=Math.PI*2+c;e+=Math.PI/16)s.push(ty(i,ry(ay([1,0,0],e),o)));return s.push(s[0]),s}let i=[],a=[],o=0,s=0,c=0,l=0;for(let u=1;u<r-1;u++){let d=n[u-1],f=n[u],p=n[u+1],m=f[2],h=uy(d,f);l+=h,o=s+(h-s)*.2;let g=this.getSize(t,m,u,r,l);if(g===0){c=u+1;continue}let _=iy(ny(d,f)),v=iy(ny(p,f)),y=ay(_,Math.PI/2),b=ay(_,-Math.PI/2),x=ay(v,Math.PI/2),S=ay(v,-Math.PI/2),C=ty(f,ry(y,g)),w=ty(f,ry(b,g)),T=ty(f,ry(x,g)),E=ty(f,ry(S,g)),D=ty(y,S),O=ty(b,x),k=ty(f,ry(ly(D)===0?_:iy(D),g)),A=ty(f,ry(ly(O)===0?v:iy(O),g)),ee=cy(sy(f,d,p)),te=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(o);if(Math.abs(ee)<te){let e=Math.abs(cy(Math.PI-ee));if(e===0)continue;if(ee<0){a.push(w,A);for(let t=0;t<=e;t+=e/4)i.push(ty(f,ay(ry(y,g),t)));for(let t=e;t>=0;t-=e/4)a.push(ty(f,ay(ry(y,g),t)));a.push(A,T)}else{i.push(C,k);for(let t=0;t<=e;t+=e/4)a.push(ty(f,ay(ry(y,-g),-t)));for(let t=e;t>=0;t-=e/4)i.push(ty(f,ay(ry(y,-g),-t)));i.push(k,E)}}else i.push(k),a.push(A);s=o}if(c>=r-2)if(this.options.keepHead){let e=n[r-1],t=[];for(let n=0;n<=Math.PI*2;n+=Math.PI/16)t.push(ty(e,ry(ay([1,0,0],n),this.options.size)));return t.push(ty(e,ry([1,0,0],this.options.size))),t}else return[];let u=n[c],d=n[c+1],f=n[r-2],p=n[r-1],m=iy(ny(d,u)),h=iy(ny(f,p)),g=ay(m,-Math.PI/2),_=ay(h,Math.PI/2),v=this.getSize(t,u[2],0,r,0),y=[],b=this.options.keepHead?this.options.size:this.getSize(t,f[2],r-2,r,l),x=[];if(v>1){for(let e=0;e<=Math.PI;e+=Math.PI/16)y.unshift(ty(u,ay(ry(g,v),-e)));y.unshift(ty(u,ry(g,-v)))}else y.push(u);for(let e=0;e<=Math.PI*3;e+=Math.PI/16)x.push(ty(p,ay(ry(_,-b),-e)));let S=[...y,...i,...x.reverse(),...a.reverse()];return y.length>0&&S.push(y[0]),this.options.simplify>0&&this.options.simplifyPhase===`output`?my(S,this.options.simplify):S}},gy=e(t(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,h=Math.min,g=function(){return f.Date.now()};function _(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=x(t)||0,v(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(x(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?h(i,o-r):i}function S(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=g();if(S(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,p&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(g())}function D(){var e=g(),n=S(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return y(l);if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return D.cancel=T,D.flush=E,D}function v(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function y(e){return!!e&&typeof e==`object`}function b(e){return typeof e==`symbol`||y(e)&&p.call(e)==i}function x(e){if(typeof e==`number`)return e;if(b(e))return r;if(v(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=v(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=_}))(),1),_y=il(),{useAtom:vy,useSetAtom:yy,useAtomValue:by,useStore:xy}=_y,Sy=_y.Provider,Cy=Vc(),wy=a({"./locales/ar-SA.json":()=>n(()=>import(`./ar-SA-NXDWD63E-C3GLfrYV.js`),__vite__mapDeps([0,1,2]),import.meta.url),"./locales/az-AZ.json":()=>n(()=>import(`./az-AZ-MXSORGZV-BJ2t-y-C.js`),__vite__mapDeps([3,1,2]),import.meta.url),"./locales/bg-BG.json":()=>n(()=>import(`./bg-BG-O6MV2KSF-Cd3kEZI-.js`),__vite__mapDeps([4,1,2]),import.meta.url),"./locales/bn-BD.json":()=>n(()=>import(`./bn-BD-T2VJNT7N-BFCx9nbZ.js`),__vite__mapDeps([5,1,2]),import.meta.url),"./locales/bn-IN.json":()=>n(()=>import(`./bn-IN-MMW2ORAC-Dn9W9dUT.js`),__vite__mapDeps([6,1,2]),import.meta.url),"./locales/ca-ES.json":()=>n(()=>import(`./ca-ES-MKBCGNOG-D_BNlrmg.js`),__vite__mapDeps([7,1,2]),import.meta.url),"./locales/cs-CZ.json":()=>n(()=>import(`./cs-CZ-V77HGUP7-gpioT6mv.js`),__vite__mapDeps([8,1,2]),import.meta.url),"./locales/da-DK.json":()=>n(()=>import(`./da-DK-I5RFNTM4-CVv-_qu9.js`),__vite__mapDeps([9,1,2]),import.meta.url),"./locales/de-CH.json":()=>n(()=>import(`./de-CH-WLRDEVBV-CL0gsFEp.js`),__vite__mapDeps([10,1,2]),import.meta.url),"./locales/de-DE.json":()=>n(()=>import(`./de-DE-DTI4WUSC-BQO1SHIK.js`),__vite__mapDeps([11,1,2]),import.meta.url),"./locales/el-GR.json":()=>n(()=>import(`./el-GR-ZXDJ2OS4-DGa9DqWI.js`),__vite__mapDeps([12,1,2]),import.meta.url),"./locales/en.json":()=>n(()=>import(`./en-CTDJDZ6K-DC-4I8h8.js`),__vite__mapDeps([13,14,1,2]),import.meta.url),"./locales/es-ES.json":()=>n(()=>import(`./es-ES-DYQHAD43-Cox3GUnj.js`),__vite__mapDeps([15,1,2]),import.meta.url),"./locales/eu-ES.json":()=>n(()=>import(`./eu-ES-QDSYU5Y3-DrPM2uSX.js`),__vite__mapDeps([16,1,2]),import.meta.url),"./locales/fa-IR.json":()=>n(()=>import(`./fa-IR-26LZG4PM-ViTdxAWX.js`),__vite__mapDeps([17,1,2]),import.meta.url),"./locales/fi-FI.json":()=>n(()=>import(`./fi-FI-6YS4KDE4-BTBRGd69.js`),__vite__mapDeps([18,1,2]),import.meta.url),"./locales/fr-FR.json":()=>n(()=>import(`./fr-FR-BRLLPTZC-z-POHcHJ.js`),__vite__mapDeps([19,1,2]),import.meta.url),"./locales/gl-ES.json":()=>n(()=>import(`./gl-ES-OKUZTLYG-BQtfDFNk.js`),__vite__mapDeps([20,1,2]),import.meta.url),"./locales/he-IL.json":()=>n(()=>import(`./he-IL-26MGYIU7-Dyw-xS4W.js`),__vite__mapDeps([21,1,2]),import.meta.url),"./locales/hi-IN.json":()=>n(()=>import(`./hi-IN-Q4ZOGTP2-BqENUkZA.js`),__vite__mapDeps([22,1,2]),import.meta.url),"./locales/hu-HU.json":()=>n(()=>import(`./hu-HU-P2OXPSN5-D1HGK0_M.js`),__vite__mapDeps([23,1,2]),import.meta.url),"./locales/id-ID.json":()=>n(()=>import(`./id-ID-2EIKXYN6-BEjyfllL.js`),__vite__mapDeps([24,1,2]),import.meta.url),"./locales/it-IT.json":()=>n(()=>import(`./it-IT-4CFKVXI2-C24G-VcQ.js`),__vite__mapDeps([25,1,2]),import.meta.url),"./locales/ja-JP.json":()=>n(()=>import(`./ja-JP-MAND2Z4V-DLhvsdYk.js`),__vite__mapDeps([26,1,2]),import.meta.url),"./locales/kaa.json":()=>n(()=>import(`./kaa-HQRTCXTJ-DC8l3BuJ.js`),__vite__mapDeps([27,1,2]),import.meta.url),"./locales/kab-KAB.json":()=>n(()=>import(`./kab-KAB-JKIKKTGH-DVFog4hd.js`),__vite__mapDeps([28,1,2]),import.meta.url),"./locales/kk-KZ.json":()=>n(()=>import(`./kk-KZ-HXQ63ZFC-CULUfwMg.js`),__vite__mapDeps([29,1,2]),import.meta.url),"./locales/km-KH.json":()=>n(()=>import(`./km-KH-PKL3LSGX-CnLlEv7i.js`),__vite__mapDeps([30,1,2]),import.meta.url),"./locales/ko-KR.json":()=>n(()=>import(`./ko-KR-KXLREZX3-DNKXAYCx.js`),__vite__mapDeps([31,1,2]),import.meta.url),"./locales/ku-TR.json":()=>n(()=>import(`./ku-TR-MJ4IER3X-DLUiMa4h.js`),__vite__mapDeps([32,1,2]),import.meta.url),"./locales/lt-LT.json":()=>n(()=>import(`./lt-LT-H6WFQ6FJ-CoFiurzb.js`),__vite__mapDeps([33,1,2]),import.meta.url),"./locales/lv-LV.json":()=>n(()=>import(`./lv-LV-GOCK6SJW-DzeEvHxX.js`),__vite__mapDeps([34,1,2]),import.meta.url),"./locales/mr-IN.json":()=>n(()=>import(`./mr-IN-IXVLDMEQ-C5i5R9H5.js`),__vite__mapDeps([35,1,2]),import.meta.url),"./locales/my-MM.json":()=>n(()=>import(`./my-MM-YG6MYTTD-DvwceqO-.js`),__vite__mapDeps([36,1,2]),import.meta.url),"./locales/nb-NO.json":()=>n(()=>import(`./nb-NO-XGWJISD2-BUhX8hX0.js`),__vite__mapDeps([37,1,2]),import.meta.url),"./locales/nl-NL.json":()=>n(()=>import(`./nl-NL-XVDVCPNC-BV6Y0-Q0.js`),__vite__mapDeps([38,1,2]),import.meta.url),"./locales/nn-NO.json":()=>n(()=>import(`./nn-NO-EMX5MJX5-CF_bB9Jq.js`),__vite__mapDeps([39,1,2]),import.meta.url),"./locales/oc-FR.json":()=>n(()=>import(`./oc-FR-ROEINTVO-CiNI8fg8.js`),__vite__mapDeps([40,1,2]),import.meta.url),"./locales/pa-IN.json":()=>n(()=>import(`./pa-IN-ZYN6SUDY-CsbIU150.js`),__vite__mapDeps([41,1,2]),import.meta.url),"./locales/percentages.json":()=>n(()=>import(`./percentages-5DKR754L-Dp1vwDEq.js`),__vite__mapDeps([42,43,1,2]),import.meta.url),"./locales/pl-PL.json":()=>n(()=>import(`./pl-PL-6VTG7PHC-D1Nnx7R3.js`),__vite__mapDeps([44,1,2]),import.meta.url),"./locales/pt-BR.json":()=>n(()=>import(`./pt-BR-5YFKRR5G-DEDTeWEP.js`),__vite__mapDeps([45,1,2]),import.meta.url),"./locales/pt-PT.json":()=>n(()=>import(`./pt-PT-GEIXXZ67-BpqPVZom.js`),__vite__mapDeps([46,1,2]),import.meta.url),"./locales/ro-RO.json":()=>n(()=>import(`./ro-RO-E2P6TFZI-4vRM1jVT.js`),__vite__mapDeps([47,1,2]),import.meta.url),"./locales/ru-RU.json":()=>n(()=>import(`./ru-RU-YBIIY43T-Cfbhz4Ew.js`),__vite__mapDeps([48,1,2]),import.meta.url),"./locales/si-LK.json":()=>n(()=>import(`./si-LK-673C2CI2-0muNkOEn.js`),__vite__mapDeps([49,1,2]),import.meta.url),"./locales/sk-SK.json":()=>n(()=>import(`./sk-SK-CKZHQ4AP-EnLgxyJL.js`),__vite__mapDeps([50,1,2]),import.meta.url),"./locales/sl-SI.json":()=>n(()=>import(`./sl-SI-557H2GWM-BN6npqVj.js`),__vite__mapDeps([51,1,2]),import.meta.url),"./locales/sv-SE.json":()=>n(()=>import(`./sv-SE-XOPKKDWS-D3VSs2SQ.js`),__vite__mapDeps([52,1,2]),import.meta.url),"./locales/ta-IN.json":()=>n(()=>import(`./ta-IN-XBH7DQI3-BKR1mqfo.js`),__vite__mapDeps([53,1,2]),import.meta.url),"./locales/th-TH.json":()=>n(()=>import(`./th-TH-TOCWH3R4-Bek1dQcW.js`),__vite__mapDeps([54,1,2]),import.meta.url),"./locales/tr-TR.json":()=>n(()=>import(`./tr-TR-GXW6CYY5-xdLb7Dgi.js`),__vite__mapDeps([55,1,2]),import.meta.url),"./locales/uk-UA.json":()=>n(()=>import(`./uk-UA-IJKTNUDG-Cd0AhTti.js`),__vite__mapDeps([56,1,2]),import.meta.url),"./locales/uz-UZ.json":()=>n(()=>import(`./uz-UZ-TBZZEA4V-DQH4e-QC.js`),__vite__mapDeps([57,1,2]),import.meta.url),"./locales/vi-VN.json":()=>n(()=>import(`./vi-VN-MULSGNVB-BYDcPrAo.js`),__vite__mapDeps([58,1,2]),import.meta.url),"./locales/zh-CN.json":()=>n(()=>import(`./zh-CN-MVX3E32U-BqZQ-18-.js`),__vite__mapDeps([59,1,2]),import.meta.url),"./locales/zh-HK.json":()=>n(()=>import(`./zh-HK-JNU5RLIE-CbF8Agwa.js`),__vite__mapDeps([60,1,2]),import.meta.url),"./locales/zh-TW.json":()=>n(()=>import(`./zh-TW-LENVCA6T-CepoVycx.js`),__vite__mapDeps([61,1,2]),import.meta.url)}),Ty=85,Ey={code:`en`,label:`English`},Dy=[Ey,...[{code:`ar-SA`,label:`العربية`,rtl:!0},{code:`bg-BG`,label:`Български`},{code:`ca-ES`,label:`Català`},{code:`cs-CZ`,label:`Česky`},{code:`de-DE`,label:`Deutsch`},{code:`el-GR`,label:`Ελληνικά`},{code:`es-ES`,label:`Español`},{code:`eu-ES`,label:`Euskara`},{code:`fa-IR`,label:`فارسی`,rtl:!0},{code:`fi-FI`,label:`Suomi`},{code:`fr-FR`,label:`Français`},{code:`gl-ES`,label:`Galego`},{code:`he-IL`,label:`עברית`,rtl:!0},{code:`hi-IN`,label:`हिन्दी`},{code:`hu-HU`,label:`Magyar`},{code:`id-ID`,label:`Bahasa Indonesia`},{code:`it-IT`,label:`Italiano`},{code:`ja-JP`,label:`日本語`},{code:`kab-KAB`,label:`Taqbaylit`},{code:`kk-KZ`,label:`Қазақ тілі`},{code:`ko-KR`,label:`한국어`},{code:`ku-TR`,label:`Kurdî`},{code:`lt-LT`,label:`Lietuvių`},{code:`lv-LV`,label:`Latviešu`},{code:`my-MM`,label:`Burmese`},{code:`nb-NO`,label:`Norsk bokmål`},{code:`nl-NL`,label:`Nederlands`},{code:`nn-NO`,label:`Norsk nynorsk`},{code:`oc-FR`,label:`Occitan`},{code:`pa-IN`,label:`ਪੰਜਾਬੀ`},{code:`pl-PL`,label:`Polski`},{code:`pt-BR`,label:`Português Brasileiro`},{code:`pt-PT`,label:`Português`},{code:`ro-RO`,label:`Română`},{code:`ru-RU`,label:`Русский`},{code:`sk-SK`,label:`Slovenčina`},{code:`sv-SE`,label:`Svenska`},{code:`sl-SI`,label:`Slovenščina`},{code:`tr-TR`,label:`Türkçe`},{code:`uk-UA`,label:`Українська`},{code:`zh-CN`,label:`简体中文`},{code:`zh-TW`,label:`繁體中文`},{code:`vi-VN`,label:`Tiếng Việt`},{code:`mr-IN`,label:`मराठी`}].filter(e=>ec[e.code]>=Ty).sort((e,t)=>e.label>t.label?1:-1)],Oy=`__test__`;Vt()&&Dy.unshift({code:Oy,label:`test language`},{code:`${Oy}.rtl`,label:`test language (rtl)`,rtl:!0});var ky=Ey,Ay={},jy=async e=>{if(ky=e,document.documentElement.dir=ky.rtl?`rtl`:`ltr`,document.documentElement.lang=ky.code,e.code.startsWith(Oy))Ay={};else try{Ay=await wy(`./locales/${ky.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),Ay=$s}Cy.set(Py,e.code)},My=()=>ky,Ny=(e,t)=>{for(let n=0;n<t.length;++n){let r=t[n];if(e[r]===void 0)return;e=e[r]}if(typeof e==`string`)return e},K=(e,t,n)=>{if(ky.code.startsWith(Oy))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let i=e.split(`.`),a=Ny(Ay,i)||Ny($s,i)||n;if(a===void 0){let t=`Can't find translation for ${e}`;if(r.PROD)return console.warn(t),``;throw Error(t)}if(t)for(let e in t)a=a.replace(`{{${e}}}`,String(t[e]));return a},Py=yc(Ey.code),Fy=()=>({t:K,langCode:by(Py)}),Iy=e=>`var(--icon-fill-color)`,Ly=e=>e===R.LIGHT?`#fff`:`#1e1e1e`,q=(e,t=512)=>{let{width:n=512,height:r=n,mirror:i,style:a,...o}=typeof t==`number`?{width:t}:t;return(0,W.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,role:`img`,viewBox:`0 0 ${n} ${r}`,className:U({"rtl-mirror":i}),style:a,...o,children:typeof e==`string`?(0,W.jsx)(`path`,{fill:`currentColor`,d:e}):e})},J={width:24,height:24,fill:`none`,strokeWidth:2,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},Y={width:20,height:20,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},Ry={width:40,height:20};q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`rect`,{x:3,y:8,width:18,height:4,rx:1}),(0,W.jsx)(`line`,{x1:12,y1:8,x2:12,y2:21}),(0,W.jsx)(`path`,{d:`M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7`}),(0,W.jsx)(`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5`})]}),J);var zy=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,W.jsx)(`path`,{d:`M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,W.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3`,y2:`19`}),(0,W.jsx)(`line`,{x1:`12`,y1:`6`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`21`,y1:`6`,x2:`21`,y2:`19`})]}),J),By=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),J),Vy=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1`})]}),J),Hy=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,W.jsx)(`path`,{d:`M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,W.jsx)(`path`,{d:`M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]}),J),Uy=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M9 4v6l-2 4v2h10v-2l-2 -4v-6`}),(0,W.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`21`}),(0,W.jsx)(`line`,{x1:`8`,y1:`4`,x2:`16`,y2:`4`})]}),J),Wy=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M6.5 9.5l3.5 -3`}),(0,W.jsx)(`path`,{d:`M14 5.5l3 1.5`}),(0,W.jsx)(`path`,{d:`M18.5 10l-2.5 7`}),(0,W.jsx)(`path`,{d:`M13.5 17.5l-7 -5`})]}),J),Gy=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{d:`M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`path`,{d:`M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`UnlockedIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:6,y:1,width:9,height:9,children:(0,W.jsx)(`path`,{stroke:`none`,d:`M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481`,fill:`#fff`})}),(0,W.jsx)(`g`,{mask:`url(#UnlockedIcon)`,children:(0,W.jsx)(`path`,{stroke:`none`,d:`M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z`,fill:`currentColor`})})]}),Y),Ky=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z`}),(0,W.jsx)(`path`,{d:`M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z`}),(0,W.jsx)(`path`,{d:`M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916`})]}),Y),qy=q((0,W.jsx)(`g`,{fill:`currentColor`,children:(0,W.jsx)(`path`,{d:`M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3`})}),{width:24,height:24}),Jy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:41,height:94,fill:`none`}),Yy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:85,height:71,fill:`none`}),Xy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:38,height:78,fill:`none`});q((0,W.jsx)(`g`,{fill:`currentColor`,children:(0,W.jsx)(`path`,{d:`M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z`,fill:`currentColor`})}),{width:40,height:40,fill:`none`});var Zy=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z`}),(0,W.jsx)(`path`,{d:`M13.5 13.5l4.5 4.5`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),Qy=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,children:[(0,W.jsx)(`path`,{d:`M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255`}),(0,W.jsx)(`path`,{d:`M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 17c0 1.42 .316 2.805 1 4`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),$y=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})]}),J),eb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z`})]}),J),tb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),J),nb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`16`,x2:`19`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`8`,x2:`19`,y2:`12`})]}),J),rb=q((0,W.jsx)(`path`,{d:`M4.167 10h11.666`,strokeWidth:`1.5`}),Y),ib=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z`}),(0,W.jsx)(`path`,{d:`M16 7h4`}),(0,W.jsx)(`path`,{d:`M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3`})]}),J),ab=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z`}),(0,W.jsx)(`path`,{d:`m11.25 5.417 3.333 3.333`})]}),Y),ob=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`7`,y2:`20`}),(0,W.jsx)(`line`,{x1:`14`,y1:`20`,x2:`21`,y2:`20`}),(0,W.jsx)(`line`,{x1:`6.9`,y1:`15`,x2:`13.8`,y2:`15`}),(0,W.jsx)(`line`,{x1:`10.2`,y1:`6.3`,x2:`16`,y2:`20`}),(0,W.jsx)(`polyline`,{points:`5 20 11 4 13 4 20 20`})]}),J),sb=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,W.jsx)(`path`,{d:`M10 5v14`}),(0,W.jsx)(`path`,{d:`M12 19h-4`}),(0,W.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,W.jsx)(`path`,{d:`M18 12v7`}),(0,W.jsx)(`path`,{d:`M17 19h2`})]}),J),cb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M12.5 6.667h.01`}),(0,W.jsx)(`path`,{d:`M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z`}),(0,W.jsx)(`path`,{d:`m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166`}),(0,W.jsx)(`path`,{d:`m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667`})]}),Y),lb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3`}),(0,W.jsx)(`path`,{d:`M18 13.3l-6.3 -6.3`})]}),J),ub=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M10 4.167v11.666M4.167 10h11.666`}),Y),db=q((0,W.jsx)(`path`,{d:`M5 10h10`,strokeWidth:`1.25`}),Y),fb=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M21 21l-6 -6`}),(0,W.jsx)(`path`,{d:`M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403`}),(0,W.jsx)(`path`,{d:`M3 4v4h4`})]}),J),pb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5`}),Y),mb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`polyline`,{points:`12 16 18 10 12 4`}),(0,W.jsx)(`polyline`,{points:`8 4 2 10 8 16`})]}),Y),hb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z`}),(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z`})]}),Y),gb=q((0,W.jsx)(`path`,{clipRule:`evenodd`,d:`M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z`,stroke:`currentColor`}),Y),_b=q((0,W.jsx)(`g`,{stroke:`currentColor`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667`})}),{...Y,strokeWidth:1.5}),vb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`6`,x2:`20`,y2:`6`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`line`,{x1:`4`,y1:`18`,x2:`20`,y2:`18`})]}),J),yb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10`}),Y),bb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J),xb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J),Sb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5`}),Y),Cb=q((0,W.jsx)(`path`,{d:`M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5`,strokeWidth:`1.25`}),Y),wb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0`}),(0,W.jsx)(`path`,{d:`M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084`})]}),Y),Tb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 4l11.733 16h4.267l-11.733 -16z`}),(0,W.jsx)(`path`,{d:`M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772`})]}),J),Eb=q((0,W.jsx)(`polyline`,{fill:`none`,stroke:`currentColor`,points:`20 6 9 17 4 12`}),{width:24,height:24}),Db=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416`}),(0,W.jsx)(`path`,{d:`M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416`})]}),Y),Ob=q(`M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z`,{width:448,height:512}),kb=q(`M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z`,{width:448,height:512}),Ab=q((0,W.jsx)(`path`,{d:`m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z`,strokeWidth:`1.25`}),Y);q(`M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z`,{width:384,height:512}),q(`M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z`);var jb=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z`}),(0,W.jsx)(`path`,{d:`M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z`}),(0,W.jsx)(`path`,{d:`M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208`})]}),J),Mb=q((0,W.jsx)(`g`,{strokeWidth:1.5,children:(0,W.jsx)(`path`,{d:`M6 18l12 -12`})}),J),Nb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 8h.01`}),(0,W.jsx)(`path`,{d:`M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5`}),(0,W.jsx)(`path`,{d:`M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4`}),(0,W.jsx)(`path`,{d:`M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598`}),(0,W.jsx)(`path`,{d:`M19 16v6`}),(0,W.jsx)(`path`,{d:`M22 19l-3 3l-3 -3`})]}),J),Pb=q(`M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z`,{width:512,height:512});q(`M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z`,{width:448,height:512}),q(`M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z`,{width:448,height:512});var Fb=q(`M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z`);q(`M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z`);var Ib=q((0,W.jsx)(`path`,{d:`M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5`,strokeWidth:`1.25`}),Y),Lb=q((0,W.jsx)(`path`,{d:`M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5`,strokeWidth:`1.25`}),Y),Rb=q(`M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z`,{mirror:!0}),zb=q((0,W.jsx)(`path`,{d:`M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834`,strokeWidth:`1.5`}),Y);q(`M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z`),q(`M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z`,{width:24,height:24}),q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1`}),(0,W.jsx)(`path`,{d:`M12 14v-11`}),(0,W.jsx)(`path`,{d:`M9 6l3 -3l3 3`})]}),J),q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{fill:`currentColor`,d:`M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z`}),(0,W.jsx)(`path`,{stroke:`currentColor`,fill:`currentColor`,d:`M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z`})]}),{width:64,height:64}),q((0,W.jsx)(`path`,{stroke:`currentColor`,strokeWidth:`40`,fill:`currentColor`,d:`M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z`}),{width:1024});var Bb=(0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 10l0 10`}),(0,W.jsx)(`path`,{d:`M12 10l4 4`}),(0,W.jsx)(`path`,{d:`M12 10l-4 4`}),(0,W.jsx)(`path`,{d:`M4 4l16 0`})]}),Vb=(0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 5l0 14`}),(0,W.jsx)(`path`,{d:`M16 9l-4 -4`}),(0,W.jsx)(`path`,{d:`M8 9l4 -4`})]}),Hb=q(Vb,J),Ub=q(Vb,{...J,style:{transform:`rotate(180deg)`}}),Wb=q(Bb,J),Gb=q(Bb,{...J,style:{transform:`rotate(180deg)`}}),Kb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),qb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Jb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Yb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M16.667 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Xb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M16.667 3.333v13.334M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Zb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333h13.334M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Qb=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M1.667 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M8.333 10h3.334`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M15.417 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z`})]}),Y),$b=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M10 18.333v-2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10 11.667V8.333`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10 4.583V1.667`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z`})]}),Y),ex=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,W.jsx)(`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`}),(0,W.jsx)(`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`}),(0,W.jsx)(`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`})]}),J);q(`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z`);var tx=q(`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z`),nx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M15 5 5 15M5 5l10 10`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y);q(`M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z`,{mirror:!0}),q(`M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z`,{width:24}),q(`M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z`,{width:384,height:512});var rx=H.memo(({theme:e})=>q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsxs)(`g`,{fill:Ly(e),stroke:Iy(e),strokeWidth:`6`,children:[(0,W.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`2.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`2.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),ix=H.memo(({theme:e})=>q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsxs)(`g`,{fill:Ly(e),stroke:Iy(e),strokeWidth:`6`,children:[(0,W.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`78.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`78.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`105.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`2.5`,y:`102.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),ax=q((0,W.jsx)(`g`,{strokeWidth:1.25,children:(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793`})}),Y),ox=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`FillHachureIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:2,y:2,width:16,height:16,children:(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`1.25`})}),(0,W.jsx)(`g`,{mask:`url(#FillHachureIcon)`,children:(0,W.jsx)(`path`,{d:`M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),Y),sx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,children:[(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`FillCrossHatchIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:-1,y:-1,width:22,height:22,children:(0,W.jsx)(`path`,{d:`M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`g`,{mask:`url(#FillCrossHatchIcon)`,children:(0,W.jsx)(`path`,{d:`M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z`,fill:`currentColor`})})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),cx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z`,stroke:`currentColor`,strokeWidth:`1.25`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),{...Y,fill:`currentColor`}),lx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`path`,{d:`M4.167 10h11.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),Y),ux=q((0,W.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),Y),dx=q((0,W.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`3.75`,strokeLinecap:`round`,strokeLinejoin:`round`}),Y);H.memo(({theme:e})=>q((0,W.jsx)(`path`,{d:`M6 10H34`,stroke:Iy(e),strokeWidth:2,fill:`none`,strokeLinecap:`round`}),{width:40,height:20}));var fx=q((0,W.jsxs)(`g`,{strokeWidth:`2`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12h2`}),(0,W.jsx)(`path`,{d:`M17 12h2`}),(0,W.jsx)(`path`,{d:`M11 12h2`})]}),J),px=q((0,W.jsxs)(`g`,{strokeWidth:`2`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 12v.01`}),(0,W.jsx)(`path`,{d:`M8 12v.01`}),(0,W.jsx)(`path`,{d:`M12 12v.01`}),(0,W.jsx)(`path`,{d:`M16 12v.01`}),(0,W.jsx)(`path`,{d:`M20 12v.01`})]}),J),mx=q((0,W.jsx)(`path`,{d:`M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814`,strokeWidth:`1.25`}),Y),hx=q((0,W.jsx)(`path`,{d:`M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43`,strokeWidth:`1.25`}),Y),gx=q((0,W.jsx)(`path`,{d:`M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42`,strokeWidth:`1.25`}),Y),_x=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{d:`M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10`}),(0,W.jsx)(`path`,{d:`M13.3333 3.33331V3.34331`}),(0,W.jsx)(`path`,{d:`M16.6667 3.33331V3.34331`}),(0,W.jsx)(`path`,{d:`M16.6667 6.66669V6.67669`}),(0,W.jsx)(`path`,{d:`M16.6667 10V10.01`}),(0,W.jsx)(`path`,{d:`M3.33334 13.3333V13.3433`}),(0,W.jsx)(`path`,{d:`M16.6667 13.3333V13.3433`}),(0,W.jsx)(`path`,{d:`M3.33334 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M6.66666 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M10 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M13.3333 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M16.6667 16.6667V16.6767`})]}),Y),vx=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 12v-4a4 4 0 0 1 4 -4h4`}),(0,W.jsx)(`line`,{x1:`16`,y1:`4`,x2:`16`,y2:`4.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`4`,x2:`20`,y2:`4.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`8`,x2:`20`,y2:`8.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`12`,x2:`20`,y2:`12.01`}),(0,W.jsx)(`line`,{x1:`4`,y1:`16`,x2:`4`,y2:`16.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`16`,x2:`20`,y2:`16.01`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`4`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`8`,y1:`20`,x2:`8`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`12`,y1:`20`,x2:`12`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`16`,y1:`20`,x2:`16`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`20`,x2:`20`,y2:`20.01`})]}),J),yx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,opacity:.3,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H19`}),(0,W.jsx)(`path`,{d:`M25,6 L33,16 M33,6 L25,16`})]}),Ry)),bx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M7,11 H33 M23,5 L33,11 L23,17`})}),Ry)),xx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H23`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Ry)),Sx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H23`}),(0,W.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Ry)),Cx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,children:[(0,W.jsx)(`path`,{d:`M7,11 H25`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Ry)),wx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M7,11 H25`,strokeLinecap:`round`}),(0,W.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Ry)),Tx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H21`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Ry)),Ex=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,strokeWidth:2,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H21`}),(0,W.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Ry)),Dx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:(0,W.jsx)(`path`,{d:`M11,11 H31 M31,5 V17`})}),Ry)),Ox=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,5 V17`})}),Ry)),kx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,11 L7,5 M15,11 L7,17`})}),Ry)),Ax=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17`})}),Ry)),jx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,5 V17 M7,5 V17`})}),Ry)),Mx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M35,11 H19 M11,11 H7 M7,5 V17`}),(0,W.jsx)(`circle`,{cx:`15`,cy:`11`,r:`4`})]}),Ry)),Nx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17`}),(0,W.jsx)(`circle`,{cx:`23`,cy:`11`,r:`4`})]}),Ry)),Px=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Fx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M5 16.667V3.333L10 15l5-11.667v13.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Ix=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M5.833 3.333v13.334h8.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Lx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`path`,{d:`m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),Y),Rx=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,W.jsx)(`path`,{d:`M10 5v14`}),(0,W.jsx)(`path`,{d:`M12 19h-4`}),(0,W.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,W.jsx)(`path`,{d:`M18 12v7`}),(0,W.jsx)(`path`,{d:`M17 19h2`})]}),J),zx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 12h10`}),(0,W.jsx)(`path`,{d:`M7 5v14`}),(0,W.jsx)(`path`,{d:`M17 5v14`}),(0,W.jsx)(`path`,{d:`M15 19h4`}),(0,W.jsx)(`path`,{d:`M15 5h4`}),(0,W.jsx)(`path`,{d:`M5 19h4`}),(0,W.jsx)(`path`,{d:`M5 5h4`})]})}),J),Bx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334`})})}),Y),Vx=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,W.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,W.jsx)(`path`,{d:`M14 4l-4 16`})]}),J),Hx=Vx,Ux=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`12`,y2:`12`}),(0,W.jsx)(`line`,{x1:`4`,y1:`16`,x2:`16`,y2:`16`})]}),J),Wx=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`}),(0,W.jsx)(`line`,{x1:`6`,y1:`16`,x2:`18`,y2:`16`})]}),J),Gx=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`10`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`line`,{x1:`8`,y1:`16`,x2:`20`,y2:`16`})]}),J),Kx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`4`}),(0,W.jsx)(`rect`,{x:`9`,y:`8`,width:`6`,height:`12`,rx:`2`})]}),J)),qx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`2`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`20`,y2:`20`}),(0,W.jsx)(`rect`,{x:`9`,y:`4`,width:`6`,height:`12`,rx:`2`})]}),J)),Jx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`9`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`rect`,{x:`9`,y:`6`,width:`6`,height:`12`,rx:`2`})]}),J)),Yx=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M21 19h-18l9 -15`}),(0,W.jsx)(`path`,{d:`M20.615 15.171h.015`}),(0,W.jsx)(`path`,{d:`M19.515 11.771h.015`}),(0,W.jsx)(`path`,{d:`M17.715 8.671h.015`}),(0,W.jsx)(`path`,{d:`M15.415 5.971h.015`})]}),J),Xx=q((0,W.jsx)(`path`,{d:`M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z`,fill:`currentColor`}),{width:640,height:512});q((0,W.jsx)(`path`,{d:`M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z`}));var Zx=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,W.jsx)(`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`}),(0,W.jsx)(`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,W.jsx)(`path`,{d:`M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47`})]}),J),Qx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`}),(0,W.jsx)(`path`,{d:`M7 11l5 5l5 -5`}),(0,W.jsx)(`path`,{d:`M12 4l0 12`})]}),J),$x=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2`})]}),J),eS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M9.15 14.85l8.85 -10.85`}),(0,W.jsx)(`path`,{d:`M6 4l8.85 10.85`})]}),J),tS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 .01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J);q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 4v16l13 -8z`})]}),J),q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z`,strokeWidth:`0`,fill:`currentColor`})]}),J);var nS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]}),J),rS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z`}),(0,W.jsx)(`path`,{d:`M12 9v4`}),(0,W.jsx)(`path`,{d:`M12 17h.01`})]}),J),iS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11 7l6 6`}),(0,W.jsx)(`path`,{d:`M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z`})]}),J),aS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 3l-4 7h8z`}),(0,W.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z`})]}),J),oS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 7l16 0`}),(0,W.jsx)(`path`,{d:`M4 17l16 0`}),(0,W.jsx)(`path`,{d:`M7 4l0 16`}),(0,W.jsx)(`path`,{d:`M17 4l0 16`})]}),J),sS=q((0,W.jsx)(`path`,{fill:`currentColor`,d:`M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z`})),cS=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`}),(0,W.jsx)(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})]}),J),lS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 10l-2 1l8 4l8 -4l-2 -1`}),(0,W.jsx)(`path`,{d:`M4 15l8 4l8 -4`}),(0,W.jsx)(`path`,{d:`M12 4v7`}),(0,W.jsx)(`path`,{d:`M15 8l-3 3l-3 -3`})]}),J),uS=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M4.16602 10H15.8327`}),(0,W.jsx)(`path`,{d:`M12.5 13.3333L15.8333 10`}),(0,W.jsx)(`path`,{d:`M12.5 6.66666L15.8333 9.99999`})]}),Y),dS=q((0,W.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`rotate(90 10 10)`,children:[(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z`}),(0,W.jsx)(`path`,{d:`m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13`})]}),20),fS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,W.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,W.jsx)(`path`,{d:`M15 6l3 3`}),(0,W.jsx)(`path`,{d:`M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`}),(0,W.jsx)(`path`,{d:`M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,W.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,W.jsx)(`path`,{d:`M15 6l3 3`}),(0,W.jsx)(`path`,{d:`M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`}),(0,W.jsx)(`path`,{d:`M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`})]}),J),q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35`}),(0,W.jsx)(`path`,{d:`M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946`}),(0,W.jsx)(`path`,{d:`M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348`}),(0,W.jsx)(`path`,{d:`M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45`}),(0,W.jsx)(`path`,{d:`M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946`}),(0,W.jsx)(`path`,{d:`M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42`})]}),J);var pS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`}),(0,W.jsx)(`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`}),(0,W.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`}),(0,W.jsx)(`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`})]}),J),mS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0`}),(0,W.jsx)(`path`,{d:`M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6`})]}),J),hS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.585 10.587a2 2 0 0 0 2.829 2.828`}),(0,W.jsx)(`path`,{d:`M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87`}),(0,W.jsx)(`path`,{d:`M3 3l18 18`})]}),J),gS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,W.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,W.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,W.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),J),_S=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,W.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,W.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,W.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),J),vS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`}),(0,W.jsx)(`path`,{d:`M21 21l-6 -6`})]}),J),yS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20.984 12.53a9 9 0 1 0 -7.552 8.355`}),(0,W.jsx)(`path`,{d:`M12 7v5l3 3`}),(0,W.jsx)(`path`,{d:`M19 16l-2 3h4l-2 3`})]}),J),bS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 8l0 4l2 2`}),(0,W.jsx)(`path`,{d:`M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5`})]}),J),xS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z`}),(0,W.jsx)(`path`,{d:`M5 10a7 7 0 0 0 14 0`}),(0,W.jsx)(`path`,{d:`M8 21l8 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 4`})]}),J),SS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 3l18 18`}),(0,W.jsx)(`path`,{d:`M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1`}),(0,W.jsx)(`path`,{d:`M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85`}),(0,W.jsx)(`path`,{d:`M8 21l8 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 4`})]}),J),CS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`})]}),J),wS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M12 20v.01`}),(0,W.jsx)(`path`,{d:`M16 20v.01`}),(0,W.jsx)(`path`,{d:`M8 20v.01`}),(0,W.jsx)(`path`,{d:`M4 20v.01`}),(0,W.jsx)(`path`,{d:`M4 16v.01`}),(0,W.jsx)(`path`,{d:`M4 12v.01`}),(0,W.jsx)(`path`,{d:`M4 8v.01`}),(0,W.jsx)(`path`,{d:`M4 4v.01`}),(0,W.jsx)(`path`,{d:`M8 4v.01`}),(0,W.jsx)(`path`,{d:`M12 4v.01`}),(0,W.jsx)(`path`,{d:`M16 4v.01`}),(0,W.jsx)(`path`,{d:`M20 4v.01`}),(0,W.jsx)(`path`,{d:`M20 8v.01`}),(0,W.jsx)(`path`,{d:`M20 12v.01`}),(0,W.jsx)(`path`,{d:`M20 16v.01`}),(0,W.jsx)(`path`,{d:`M20 20v.01`})]}),J),TS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 3v18`}),(0,W.jsx)(`path`,{d:`M19 21v-18`}),(0,W.jsx)(`path`,{d:`M5 7h14`}),(0,W.jsx)(`path`,{d:`M5 15h14`}),(0,W.jsx)(`path`,{d:`M8 13v4`}),(0,W.jsx)(`path`,{d:`M11 13v4`}),(0,W.jsx)(`path`,{d:`M16 13v4`}),(0,W.jsx)(`path`,{d:`M14 5v4`}),(0,W.jsx)(`path`,{d:`M11 5v4`}),(0,W.jsx)(`path`,{d:`M8 5v4`}),(0,W.jsx)(`path`,{d:`M3 21h18`})]}),J),ES=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 12l18 0`}),(0,W.jsx)(`path`,{d:`M7 16l10 0l-10 5l0 -5`}),(0,W.jsx)(`path`,{d:`M7 8l10 0l-10 -5l0 5`})]}),J),DS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 3l0 18`}),(0,W.jsx)(`path`,{d:`M16 7l0 10l5 0l-5 -10`}),(0,W.jsx)(`path`,{d:`M8 7l0 10l-5 0l5 -10`})]}),J),OS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2`}),(0,W.jsx)(`path`,{d:`M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`})]}),J),kS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0`}),(0,W.jsx)(`path`,{d:`M22 22l-3 -3`}),(0,W.jsx)(`path`,{d:`M6 18h-1a2 2 0 0 1 -2 -2v-1`}),(0,W.jsx)(`path`,{d:`M3 11v-1`}),(0,W.jsx)(`path`,{d:`M3 6v-1a2 2 0 0 1 2 -2h1`}),(0,W.jsx)(`path`,{d:`M10 3h1`}),(0,W.jsx)(`path`,{d:`M15 3h1a2 2 0 0 1 2 2v1`})]}),J),AS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,W.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,W.jsx)(`path`,{d:`M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75`}),(0,W.jsx)(`path`,{d:`M10 15l2 6l2 -6`}),(0,W.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`})]}),J),jS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,W.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,W.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`}),(0,W.jsx)(`path`,{d:`M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6`}),(0,W.jsx)(`path`,{d:`M11 21v-6l3 6v-6`})]}),J),MS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0`}),(0,W.jsx)(`path`,{d:`M4 8l5 0`}),(0,W.jsx)(`path`,{d:`M15 8l4 0`})]}),J),NS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1`}),(0,W.jsx)(`path`,{d:`M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,W.jsx)(`path`,{d:`M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,W.jsx)(`path`,{d:`M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z`}),(0,W.jsx)(`path`,{d:`M16.746 16.726a3 3 0 1 0 .252 -5.555`})]}),J),PS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4`})]}),{...J,strokeWidth:1.5});q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`}),(0,W.jsx)(`path`,{d:`M21 12h-13l3 -3`}),(0,W.jsx)(`path`,{d:`M11 15l-3 -3`})]}),J);var FS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z`}),(0,W.jsx)(`path`,{d:`M10 9l5 3l-5 3z`})]}),J),IS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 6h18`}),(0,W.jsx)(`path`,{d:`M3 12h18`}),(0,W.jsx)(`path`,{d:`M3 18h18`}),(0,W.jsx)(`path`,{d:`M6 3v18`}),(0,W.jsx)(`path`,{d:`M12 3v18`}),(0,W.jsx)(`path`,{d:`M18 3v18`})]}),J),LS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M17 5c-6.627 0 -12 5.373 -12 12`})]}),J),RS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 18l12 -12`}),(0,W.jsx)(`path`,{d:`M18 10v-4h-4`})]}),J),zS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7`}),(0,W.jsx)(`path`,{d:`M18 4l3 3l-3 3`})]}),J),BS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{d:`M16,12L20,9L16,6`}),(0,W.jsx)(`path`,{d:`M6 20c0 -6.075 4.925 -11 11 -11h3`})]}),J),VS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 9l6 6l6 -6`})]}),J),HS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),J),US=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),J),WS=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 5v10a1 1 0 0 0 1 1h10`}),(0,W.jsx)(`path`,{d:`M5 8h10a1 1 0 0 1 1 1v10`})]}),J),GS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 7l0 10`}),(0,W.jsx)(`path`,{d:`M7 5l10 0`}),(0,W.jsx)(`path`,{d:`M7 19l10 0`}),(0,W.jsx)(`path`,{d:`M19 7l0 10`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1`}),(0,W.jsx)(`path`,{d:`M4 12h7a1 1 0 0 1 1 1v7`})]}),J);var KS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 6l8 0`}),(0,W.jsx)(`path`,{d:`M16 6l4 0`}),(0,W.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 12l2 0`}),(0,W.jsx)(`path`,{d:`M10 12l10 0`}),(0,W.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 18l11 0`}),(0,W.jsx)(`path`,{d:`M19 18l1 0`})]}),J),qS=q((0,W.jsxs)(`g`,{strokeWidth:1,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4`})]}),J),JS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,W.jsx)(`path`,{d:`M13.5 6.5l4 4`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11 7l-5 5l5 5`}),(0,W.jsx)(`path`,{d:`M17 7l-5 5l5 5`})]}),J);var YS=q((0,W.jsxs)(`g`,{strokeWidth:`1.75`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M15 4l0 16`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1`})]}),J),q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 4l18 0`}),(0,W.jsx)(`path`,{d:`M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10`}),(0,W.jsx)(`path`,{d:`M12 16l0 4`}),(0,W.jsx)(`path`,{d:`M9 20l6 0`}),(0,W.jsx)(`path`,{d:`M8 12l3 -3l2 2l3 -3`})]}),J);var XS=(0,W.jsx)(`div`,{style:{width:`1rem`,height:`1rem`}}),ZS=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`polyline`,{points:`9 6 15 12 9 18`})]}),J),QS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 6l8 0`}),(0,W.jsx)(`path`,{d:`M16 6l4 0`}),(0,W.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 12l2 0`}),(0,W.jsx)(`path`,{d:`M10 12l10 0`}),(0,W.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 18l11 0`}),(0,W.jsx)(`path`,{d:`M19 18l1 0`})]}),J),$S=({size:e=`1em`,circleWidth:t=8,synchronized:n=!1,className:r=``})=>{let i=-(H.useRef(Date.now()).current%1600);return(0,W.jsx)(`div`,{className:`Spinner ${r}`,children:(0,W.jsx)(`svg`,{viewBox:`0 0 100 100`,style:{width:e,height:e,"--spinner-delay":n?`${i}ms`:0},children:(0,W.jsx)(`circle`,{cx:`50`,cy:`50`,r:50-t/2,strokeWidth:t,fill:`none`,strokeMiterlimit:`10`})})})},X=H.forwardRef(({size:e=`medium`,visible:t=!0,className:n=``,...r},i)=>{let{id:a}=oz(),o=H.useRef(null);H.useImperativeHandle(i,()=>o.current);let s=`ToolIcon_size_${e}`,[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(!0),d=async e=>{let t=`onClick`in r&&r.onClick?.(e);if(ge(t))try{l(!0),await t}catch(e){if(e instanceof E)console.warn(e);else throw e}finally{u.current&&l(!1)}};(0,H.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let f=(0,H.useRef)(null);if(r.type===`button`||r.type===`icon`||r.type===`submit`){let e=r.type===`icon`?`button`:r.type;return(0,W.jsxs)(`button`,{className:U(`ToolIcon_type_button`,s,n,t&&!r.hidden?`ToolIcon_type_button--show`:`ToolIcon_type_button--hide`,{ToolIcon:!r.hidden,"ToolIcon--selected":r.selected,"ToolIcon--plain":r.type===`icon`}),style:r.style,"data-testid":r[`data-testid`],hidden:r.hidden,title:r.title,"aria-label":r[`aria-label`],type:e,onClick:d,ref:o,disabled:c||r.isLoading||!!r.disabled,children:[(r.icon||r.label)&&(0,W.jsxs)(`div`,{className:`ToolIcon__icon`,"aria-hidden":`true`,"aria-disabled":!!r.disabled,children:[r.icon||r.label,r.keyBindingLabel&&(0,W.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel}),r.isLoading&&(0,W.jsx)($S,{})]}),r.showAriaLabel&&(0,W.jsxs)(`div`,{className:`ToolIcon__label`,children:[r[`aria-label`],` `,c&&(0,W.jsx)($S,{})]}),r.children]})}return(0,W.jsxs)(`label`,{className:U(`ToolIcon`,n),title:r.title,onPointerDown:e=>{f.current=e.pointerType||null,r.onPointerDown?.({pointerType:e.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{f.current=null})},children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_radio ${s}`,type:`radio`,name:r.name,"aria-label":r[`aria-label`],"aria-keyshortcuts":r[`aria-keyshortcuts`],"data-testid":r[`data-testid`],id:`${a}-${r.id}`,onChange:()=>{r.onChange?.({pointerType:f.current})},checked:r.checked,ref:o}),(0,W.jsxs)(`div`,{className:`ToolIcon__icon`,children:[r.icon,r.keyBindingLabel&&(0,W.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel})]})]})});X.displayName=`ToolButton`;var eC=[],Z=e=>(eC=eC.concat(e),e),tC=(e,t,n)=>{let r=new Set(ir(e.filter(e=>L(e)),t).map(e=>e.id)),i={},a=n.scene.getNonDeletedElementsMap(),o=new Set;for(let t of r){let n=Di(e,t);for(let e of n)if(!o.has(e.id)){if(ya(e)){let t=so(e,a);t&&(i[t.id]=!0)}else i[e.id]=!0;o.add(e.id)}}let s=!0,c=e.map(e=>{if(t.selectedElementIds[e.id]){let t=ya(e)?so(e,a):null;return e.frameId&&r.has(e.frameId)?(s=!1,i[e.id]=!0,e):t?.frameId&&r.has(t?.frameId)?e:(e.boundElements&&e.boundElements.forEach(t=>{let r=n.scene.getNonDeletedElementsMap().get(t.id);r&&dr(r)&&n.scene.mutateElement(r,{startBinding:e.id===r.startBinding?.elementId?null:r.startBinding,endBinding:e.id===r.endBinding?.elementId?null:r.endBinding})}),B(e,{isDeleted:!0}))}return e.frameId&&r.has(e.frameId)?(s=!1,ya(e)||(i[e.id]=!0),B(e,{frameId:null})):ya(e)&&t.selectedElementIds[e.containerId]?B(e,{isDeleted:!0}):e}),l=t.editingGroupId;if(s&&t.editingGroupId){let e=Ki(c,t.editingGroupId).filter(e=>!e.isDeleted);if(e.length>1)e[0]&&(i[e[0].id]=!0);else{l=null,e[0]&&(i[e[0].id]=!0);let n=e[0];if(n){let e=n.groupIds.findIndex(e=>e===t.editingGroupId),r=n.groupIds[e+1];if(r){let e=Ki(c,r).filter(e=>!e.isDeleted);e.length>1&&(l=r,e.forEach(e=>{i[e.id]=!0}))}}}}return{elements:c,appState:{...t,...Hr({selectedElementIds:i,editingGroupId:l},c,t,null)}}},nC=(e,t)=>{if(e.editingGroupId){let n=Ki(Cs(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},rC=Z({name:`deleteSelectedElements`,label:`labels.delete`,icon:pb,trackEvent:{category:`element`,action:`delete`},perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing){let{elementId:n,selectedPointsIndices:i}=t.selectedLinearElement,a=r.scene.getNonDeletedElementsMap(),o=I.getElement(n,a);if(!o||i==null)return!1;if(i.length>=o.points.length){let n=e.map(e=>e.id===o.id?B(e,{isDeleted:!0}):e);return{elements:n,appState:{...nC(t,n),selectedLinearElement:null},captureUpdate:V.IMMEDIATELY}}return I.deletePoints(o,r,i),{elements:e,appState:{...t,selectedLinearElement:{...t.selectedLinearElement,selectedPointsIndices:i?.[0]>0?[i[0]-1]:[0]}},captureUpdate:V.IMMEDIATELY}}let{elements:i,appState:a}=tC(e,t,r);return Go(i,i.filter(e=>e.isDeleted)),a=nC(a,i),{elements:i,appState:{...a,activeTool:ka(t,{type:r.state.preferredSelectionTool.type}),multiElement:null,newElement:null,activeEmbeddable:null,selectedLinearElement:null},captureUpdate:Ya(Cs(e),t)?V.IMMEDIATELY:V.EVENTUALLY}},keyTest:(e,t,n)=>(e.key===N.BACKSPACE||e.key===N.DELETE)&&!e[N.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:pb,title:K(`labels.delete`),"aria-label":K(`labels.delete`),onClick:()=>n(null),disabled:!Ya(Cs(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?Bs:{}}})}}),Q=e=>e.replace(/\b(Opt(?:ion)?|Alt)\b/i,K(di?`keys.option`:`keys.alt`)).replace(/\bShift\b/i,K(`keys.shift`)).replace(/\b(Enter|Return)\b/i,K(`keys.enter`)).replace(/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,K(di?`keys.cmd`:`keys.ctrl`)).replace(/\b(Esc(?:ape)?)\b/i,K(`keys.escape`)).replace(/\b(Space(?:bar)?)\b/i,K(`keys.spacebar`)).replace(/\b(Del(?:ete)?)\b/i,K(`keys.delete`)),iC=Z({name:`sendBackward`,label:`labels.sendBackward`,keywords:[`move down`,`zindex`,`layer`],icon:Ub,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Ua(e,t,r.scene),appState:t,captureUpdate:V.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Gs.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.sendBackward`)} \u2014 ${Q(`CtrlOrCmd+[`)}`,children:Ub})}),aC=Z({name:`bringForward`,label:`labels.bringForward`,keywords:[`move up`,`zindex`,`layer`],icon:Hb,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:bi(e,t,r.scene),appState:t,captureUpdate:V.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Gs.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.bringForward`)} \u2014 ${Q(`CtrlOrCmd+]`)}`,children:Hb})}),oC=Z({name:`sendToBack`,label:`labels.sendToBack`,keywords:[`move down`,`zindex`,`layer`],icon:Gb,trackEvent:{category:`element`},perform:(e,t)=>({elements:xa(e,t),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>di?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.BRACKET_LEFT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===Gs.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.sendToBack`)} \u2014 ${Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)}`,children:Gb})}),sC=Z({name:`bringToFront`,label:`labels.bringToFront`,keywords:[`move up`,`zindex`,`layer`],icon:Wb,trackEvent:{category:`element`},perform:(e,t)=>({elements:Ft(e,t),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>di?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.BRACKET_RIGHT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===Gs.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:t=>e(null),title:`${K(`labels.bringToFront`)} \u2014 ${Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)}`,children:Wb})}),cC=Z({name:`selectAll`,label:`labels.selectAll`,icon:wS,trackEvent:{category:`canvas`},viewMode:!1,perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing)return!1;let i=e.filter(e=>!e.isDeleted&&!(M(e)&&e.containerId)&&!e.locked).reduce((e,t)=>(e[t.id]=!0,e),{});return{appState:{...t,...Hr({editingGroupId:null,selectedElementIds:i},Cs(e),t,r),selectedLinearElement:Object.keys(i).length===1&&b(e[0])?new I(e[0],lr(e)):null},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.A}),lC=Z({name:`duplicateSelection`,label:`labels.duplicateSelection`,icon:hb,trackEvent:{category:`element`},perform:(e,t,n,r)=>{if(t.selectedElementsAreBeingDragged)return!1;if(t.selectedLinearElement?.isEditing)try{return{elements:e,appState:I.duplicateSelectedPoints(t,r.scene),captureUpdate:V.IMMEDIATELY}}catch{return!1}let{duplicatedElements:i,elementsWithDuplicates:a}=Er({type:`in-place`,elements:e,idsOfElementsToDuplicate:lr(ir(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),appState:t,randomizeSeed:!0,overrides:({origElement:e,origIdToDuplicateId:t})=>{let n=e.frameId&&t.get(e.frameId);return{x:e.x+20/2,y:e.y+20/2,frameId:n??e.frameId}}});if(r.props.onDuplicate&&a){let t=r.props.onDuplicate(a,e);t&&(a=t)}return{elements:fe(a,lr(i)),appState:{...t,...Br(i,Cs(a),t)},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.D,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:hb,title:`${K(`labels.duplicateSelection`)} \u2014 ${Q(`CtrlOrCmd+D`)}`,"aria-label":K(`labels.duplicateSelection`),onClick:()=>n(null),disabled:!Ya(Cs(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?Bs:{}}})}}),uC=new Set([`command_palette`,`export`]),dC=(e,t,n,i)=>{try{if(typeof window>`u`||r.VITE_WORKER_ID||r.VITE_APP_ENABLE_TRACKING!==`true`||!uC.has(e)||Vt())return;r.PROD||console.info(`trackEvent`,{category:e,action:t,label:n,value:i}),window.sa_event&&window.sa_event(t,{category:e,label:n,value:i})}catch(e){console.error(`error during analytics`,e)}},fC=(0,H.forwardRef)((e,t)=>{let{title:n,className:r,testId:i,active:a,standalone:o,icon:s,onClick:c}=e;return(0,W.jsx)(`button`,{type:`button`,ref:t,title:n,"data-testid":i,className:U(r,{standalone:o,active:a}),onClick:c,style:e.style,children:s},n)}),pC=e=>(0,W.jsx)(W.Fragment,{children:e.options.map(t=>e.type===`button`?(0,W.jsx)(fC,{icon:t.icon,title:t.text,testId:t.testId,active:t.active??e.value===t.value,onClick:n=>e.onClick(t.value,n)},t.text):(0,W.jsxs)(`label`,{className:U({active:e.value===t.value}),title:t.text,children:[(0,W.jsx)(`input`,{type:`radio`,name:e.group,onChange:()=>e.onChange(t.value),checked:e.value===t.value,"data-testid":t.testId}),t.icon]},t.text))}),mC=()=>(0,W.jsx)(`div`,{style:{width:1,height:`1rem`,backgroundColor:`var(--default-border-color)`,margin:`0 auto`}}),hC=H.createContext(null),gC=()=>H.useContext(hC),_C=e=>{let[t,n]=(0,H.useState)(null),r=iz(),{theme:i}=gC(),{container:a}=oz();return(0,H.useLayoutEffect)(()=>{t&&(t.className=``,t.classList.add(`excalidraw`,...e?.className?.split(/\s+/)||[]),t.classList.toggle(`excalidraw--mobile`,r.formFactor===`phone`),t.classList.toggle(`theme--dark`,i===R.DARK))},[t,i,r.formFactor,e?.className]),(0,H.useLayoutEffect)(()=>{let t=e?.parentSelector?a?.querySelector(e.parentSelector):document.body;if(!t)return;let r=document.createElement(`div`);return t.appendChild(r),n(r),()=>{t.removeChild(r)}},[a,e?.parentSelector]),t};function vC(e,t,n){(0,H.useEffect)(()=>{function r(r){let i=r;if(!e.current)return;let a=n?.(i,e.current);if(a!==!0){if(a===!1)return t(i);e.current.contains(i.target)||!document.documentElement.contains(i.target)||i.target.closest(`[data-radix-portal]`)||i.target===document.documentElement&&document.body.style.pointerEvents===`none`||i.target.closest(`[data-prevent-outside-click]`)||t(i)}}return document.addEventListener(F.POINTER_DOWN,r),document.addEventListener(F.TOUCH_START,r),()=>{document.removeEventListener(F.POINTER_DOWN,r),document.removeEventListener(F.TOUCH_START,r)}},[e,t,n])}var yC=e=>{let t=(0,H.useRef)(e);return Object.assign(t.current,e),t.current},bC=yc(null),xC=({onCancel:e,onChange:t,onSelect:n,colorPickerType:r})=>{let i=_C({className:`excalidraw-eye-dropper-backdrop`,parentSelector:`.excalidraw-eye-dropper-container`}),a=gC(),o=sz(),s=nz(),c=yC({app:s,onCancel:e,onChange:t,onSelect:n,selectedElements:ir(o,a)}),{container:l}=oz();(0,H.useEffect)(()=>{let e=u.current;if(!e||!s.canvas||!i)return;let t=!1,n=s.canvas.getContext(`2d`),o=({clientX:e,clientY:t})=>{let r=n.getImageData((e-a.offsetLeft)*window.devicePixelRatio,(t-a.offsetTop)*window.devicePixelRatio,1,1).data;return S(r[0],r[1],r[2])},d=({clientX:n,clientY:i,altKey:a})=>{e.style.top=`${i+20}px`,e.style.left=`${n+20}px`;let s=o({clientX:n,clientY:i});t&&c.onChange(r,s,c.selectedElements,{altKey:a}),e.style.background=s},f=()=>{c.onCancel()},p=(e,t)=>{c.onSelect(e,t)},m=e=>{t=!0,e.stopImmediatePropagation()},h=e=>{t=!1,l?.focus(),e.stopImmediatePropagation(),e.preventDefault(),p(o(e),e)},g=e=>{e.key===N.ESCAPE&&(e.preventDefault(),e.stopImmediatePropagation(),f())};return i.tabIndex=-1,i.focus(),d({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),i.addEventListener(F.KEYDOWN,g),i.addEventListener(F.POINTER_DOWN,m),i.addEventListener(F.POINTER_UP,h),window.addEventListener(`pointermove`,d,{passive:!0}),window.addEventListener(F.BLUR,f),()=>{t=!1,i.removeEventListener(F.KEYDOWN,g),i.removeEventListener(F.POINTER_DOWN,m),i.removeEventListener(F.POINTER_UP,h),window.removeEventListener(`pointermove`,d),window.removeEventListener(F.BLUR,f)}},[c,s.canvas,i,r,l,a.offsetLeft,a.offsetTop]);let u=(0,H.useRef)(null);return vC(u,()=>{e()},e=>!!e.target.closest(`.excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop`)),i?(0,_c.createPortal)((0,W.jsx)(`div`,{ref:u,className:`excalidraw-eye-dropper-preview`}),i):null},SC=H.forwardRef(({children:e,padding:t,className:n,style:r},i)=>(0,W.jsx)(`div`,{className:U(`Island`,n),style:{"--padding":t,...r},ref:i,children:e})),CC=H.forwardRef(({className:e,container:t,children:n,style:r,onClose:i,onKeyDown:a,onFocusOutside:o,onPointerLeave:s,onPointerDownOutside:c,preventAutoFocusOnTouch:l=!1},u)=>{let d=iz(),f=d.formFactor===`phone`&&!d.isLandscape;return(0,W.jsx)(U_,{container:t,children:(0,W.jsxs)(W_,{ref:u,className:U(`focus-visible-none`,e),"data-prevent-outside-click":!0,side:f?`bottom`:`right`,align:f?`center`:`start`,alignOffset:-16,sideOffset:20,collisionBoundary:t??void 0,style:{zIndex:`var(--zIndex-ui-styles-popup)`,marginLeft:d.formFactor===`phone`?`0.5rem`:void 0},onPointerLeave:s,onKeyDown:a,onFocusOutside:o,onPointerDownOutside:c,onOpenAutoFocus:e=>{l&&d.isTouchScreen&&e.preventDefault()},onCloseAutoFocus:e=>{e.stopPropagation(),e.preventDefault(),t&&!Me(document.activeElement)&&t.focus(),i()},children:[(0,W.jsx)(SC,{padding:3,style:r,children:n}),(0,W.jsx)(G_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})}),wC=()=>document.querySelector(`.excalidraw-wysiwyg`),TC=()=>{let e=wC();return e?{start:e.selectionStart,end:e.selectionEnd}:null},EC=e=>{setTimeout(()=>{let t=wC();t&&(t.focus(),e&&(t.selectionStart=e.start,t.selectionEnd=e.end))},0)},DC=(e,t,n,r)=>{t&&r&&r();let i=t&&n?TC():null;e(),t&&n&&EC(i)},OC=()=>{let[e,t]=(0,H.useState)(null);return{saveCaretPosition:(0,H.useCallback)(()=>{t(TC())},[]),restoreCaretPosition:(0,H.useCallback)(()=>{setTimeout(()=>{let n=wC();n&&(n.focus(),e&&(n.selectionStart=e.start,n.selectionEnd=e.end,t(null)))},0)},[e]),clearSavedPosition:(0,H.useCallback)(()=>{t(null)},[]),hasSavedPosition:!!e}},kC=(e=100)=>{let t=wC();if(t){let n=t.onblur;t.onblur=null,setTimeout(()=>{t.onblur=n},e)}},AC=({palette:e,color:t})=>{if(!t)return null;for(let[n,r]of Object.entries(e))if(Array.isArray(r)){let e=r.indexOf(t);if(e>-1)return{colorName:n,shade:e}}else if(r===t)return{colorName:n,shade:null};return null},jC=[[`q`,`w`,`e`,`r`,`t`],[`a`,`s`,`d`,`f`,`g`],[`z`,`x`,`c`,`v`,`b`]].flat(),MC=({color:e,palette:t})=>!Object.values(t).flat().includes(e),NC=(e,t,n)=>{let r={elementBackground:`backgroundColor`,elementStroke:`strokeColor`},i=e.filter(e=>{if(e.isDeleted)return!1;let i=e[r[t]];return MC({color:i,palette:n})}),a=new Map;return i.forEach(e=>{let n=e[r[t]];a.has(n)?a.set(n,a.get(n)+1):a.set(n,1)}),[...a.entries()].sort((e,t)=>t[1]-e[1]).map(e=>e[0]).slice(0,5)},PC=yc(null),FC=({color:e,onChange:t,label:n,colorPickerType:r,placeholder:i})=>{let a=iz(),[o,s]=(0,H.useState)(e),[c,l]=vy(PC);(0,H.useEffect)(()=>{s(e)},[e]);let u=(0,H.useCallback)(e=>{let n=e.toLowerCase(),r=ma(n);r&&t(r),s(n)},[t]),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{d.current&&d.current.focus()},[c]);let[p,m]=vy(bC);return(0,H.useEffect)(()=>()=>{m(null)},[m]),(0,W.jsxs)(`div`,{className:`color-picker__input-label`,children:[(0,W.jsx)(`div`,{className:`color-picker__input-hash`,children:`#`}),(0,W.jsx)(`input`,{ref:c===`hex`?d:void 0,style:{border:0,padding:0},spellCheck:!1,className:`color-picker-input`,"aria-label":n,onChange:e=>{u(e.target.value)},value:(o||``).replace(/^#/,``),onBlur:()=>{s(e)},tabIndex:-1,onFocus:()=>l(`hex`),onKeyDown:e=>{e.key!==N.TAB&&(e.key===N.ESCAPE&&f.current?.focus(),e.stopPropagation())},placeholder:i}),a.formFactor!==`phone`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{style:{width:`1px`,height:`1.25rem`,backgroundColor:`var(--default-border-color)`}}),(0,W.jsx)(`div`,{ref:f,className:U(`excalidraw-eye-dropper-trigger`,{selected:p}),onClick:()=>m(e=>e?null:{keepOpenOnAlt:!1,onSelect:e=>t(e),colorPickerType:r}),title:`${K(`labels.eyeDropper`)} \u2014 ${N.I.toLocaleUpperCase()} or ${Q(`Alt`)} `,children:iS})]})]})},IC=({color:e,keyLabel:t,isShade:n=!1})=>(0,W.jsxs)(`div`,{className:`color-picker__button__hotkey-label`,style:{color:yt(e)?`#fff`:`#000`},children:[n&&`⇧`,t]}),LC=({colors:e,color:t,onChange:n,label:r})=>{let[i,a]=vy(PC),o=(0,H.useRef)(null);return(0,H.useEffect)(()=>{o.current&&o.current.focus()},[t,i]),(0,W.jsx)(`div`,{className:`color-picker-content--default`,children:e.map((e,i)=>(0,W.jsxs)(`button`,{ref:t===e?o:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:t===e,"is-transparent":e===`transparent`||!e}),onClick:()=>{n(e),a(`custom`)},title:e,"aria-label":r,style:{"--swatch-color":e},children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),(0,W.jsx)(IC,{color:e,keyLabel:i+1})]},i))})},RC=({palette:e,color:t,onChange:n,activeShade:r,showHotKey:i=!0})=>{let a=AC({color:t,palette:e}),[o,s]=vy(PC),c=(0,H.useRef)(null);return(0,H.useEffect)(()=>{c.current&&o===`baseColors`&&c.current.focus()},[a?.colorName,o]),(0,W.jsx)(`div`,{className:`color-picker-content--default`,children:Object.entries(e).map(([e,t],o)=>{let l=(Array.isArray(t)?t[r]:t)||`transparent`,u=jC[o],d=K(`colors.${e.replace(/\d+/,``)}`,null,``);return(0,W.jsxs)(`button`,{ref:a?.colorName===e?c:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:a?.colorName===e,"is-transparent":l===`transparent`||!l}),onClick:()=>{n(l),s(`baseColors`)},title:`${d}${l.startsWith(`#`)?` ${l}`:``} \u2014 ${u}`,"aria-label":`${d} \u2014 ${u}`,style:l?{"--swatch-color":l}:void 0,"data-testid":`color-${e}`,children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),i&&(0,W.jsx)(IC,{color:l,keyLabel:u})]},e)})})},zC=({children:e})=>(0,W.jsx)(`div`,{className:`color-picker__heading`,children:e}),BC=({color:e,onChange:t,palette:n,showHotKey:r})=>{let i=AC({color:e||`transparent`,palette:n}),[a,o]=vy(PC),s=(0,H.useRef)(null);if((0,H.useEffect)(()=>{s.current&&a===`shades`&&s.current.focus()},[i,a]),i){let{colorName:e,shade:c}=i,l=n[e];if(Array.isArray(l))return(0,W.jsx)(`div`,{className:`color-picker-content--default shades`,children:l.map((n,i)=>(0,W.jsxs)(`button`,{ref:i===c&&a===`shades`?s:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:i===c}),"aria-label":`Shade`,title:`${e} - ${i+1}`,style:n?{"--swatch-color":n}:void 0,onClick:()=>{t(n),o(`shades`)},children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),r&&(0,W.jsx)(IC,{color:n,keyLabel:i+1,isShade:!0})]},i))})}return(0,W.jsxs)(`div`,{className:`color-picker-content--default`,style:{position:`relative`},tabIndex:-1,children:[(0,W.jsx)(`button`,{type:`button`,tabIndex:-1,className:`color-picker__button color-picker__button--large color-picker__button--no-focus-visible`}),(0,W.jsx)(`div`,{tabIndex:-1,style:{position:`absolute`,top:0,left:0,right:0,bottom:0,display:`flex`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,fontSize:`0.75rem`},children:K(`colorPicker.noShades`)})]})},VC=(e,t,n)=>{let r=Math.ceil(n/5);switch(t??=-1,e){case`ArrowLeft`:{let e=t-1;return e<0?n-1:e}case`ArrowRight`:return(t+1)%n;case`ArrowDown`:{let e=t+5;return e>=n?t%5:e}case`ArrowUp`:{let e=t-5,i=e<0?5*r+e:e;return i>=n?void 0:i}}},HC=({e,colorObj:t,onChange:n,palette:r,customColors:i,setActiveColorPickerSection:a,activeShade:o})=>{if(t?.shade!=null&&[`Digit1`,`Digit2`,`Digit3`,`Digit4`,`Digit5`].includes(e.code)&&e.shiftKey){let i=Number(e.code.slice(-1))-1;return n(r[t.colorName][i]),a(`shades`),!0}if([`1`,`2`,`3`,`4`,`5`].includes(e.key)&&i[Number(e.key)-1])return n(i[Number(e.key)-1]),a(`custom`),!0;if(jC.includes(e.key)){let t=jC.indexOf(e.key),i=r[Object.keys(r)[t]];return n(Array.isArray(i)?i[o]:i),a(`baseColors`),!0}return!1},UC=({event:e,activeColorPickerSection:t,palette:n,color:r,onChange:i,customColors:a,setActiveColorPickerSection:o,updateData:s,activeShade:c,onEyeDropperToggle:l,onEscape:u})=>{if(e[N.CTRL_OR_CMD])return!1;if(e.key===N.ESCAPE)return u(e),!0;if(e.key===N.ALT)return l(!0),!0;if(e.key===N.I)return l(),!0;let d=AC({color:r,palette:n});if(e.key===N.TAB){let s={custom:!!a.length,baseColors:!0,shades:d?.shade!=null,hex:!0},c=Object.entries(s).reduce((e,[t,n])=>(n&&e.push(t),e),[]),l=c.indexOf(t),u=e.shiftKey?-1:1,f=c[l+u>c.length-1?0:l+u<0?c.length-1:l+u];return f&&o(f),f===`custom`?i(a[0]):f===`baseColors`&&(Object.entries(n).find(([e,t])=>Array.isArray(t)?t.includes(r):t===r?e:null)||i(hi.black)),e.preventDefault(),e.stopPropagation(),!0}if(HC({e,colorObj:d,onChange:i,palette:n,customColors:a,setActiveColorPickerSection:o,activeShade:c}))return!0;if(t===`shades`&&d){let{shade:t}=d,r=VC(e.key,t,5);if(r!==void 0)return i(n[d.colorName][r]),!0}if(t===`baseColors`&&d){let{colorName:t}=d,r=Object.keys(n),a=r.indexOf(t),o=VC(e.key,a,r.length);if(o!==void 0){let e=n[r[o]];return i(Array.isArray(e)?e[c]:e),!0}}if(t===`custom`){let t=r==null?0:a.indexOf(r),n=VC(e.key,t,a.length);if(n!==void 0){let e=a[n];return i(e),!0}}return!1},WC=H.forwardRef(({color:e,onChange:t,type:n,elements:r,palette:i,updateData:a,children:o,showTitle:s,onEyeDropperToggle:c,onEscape:l,showHotKey:u=!0},d)=>{let f=s?n===`elementStroke`?K(`labels.stroke`):n===`elementBackground`?K(`labels.background`):null:null,[p]=H.useState(()=>n===`canvasBackground`?[]:NC(r,n,i)),[m,h]=vy(PC),g=AC({color:e,palette:i});(0,H.useEffect)(()=>{if(!m){let t=!!e&&MC({color:e,palette:i});h(t&&!p.includes(e)?null:t?`custom`:g?.shade==null?`baseColors`:`shades`)}},[m,e,i,h,g,p]);let[_,v]=(0,H.useState)(g?.shade??(n===`elementBackground`?1:4));(0,H.useEffect)(()=>{g?.shade!=null&&v(g.shade);let e=e=>{e.key===N.ALT&&c(!1)};return document.addEventListener(F.KEYUP,e,{capture:!0}),()=>{document.removeEventListener(F.KEYUP,e,{capture:!0})}},[g,c]);let y=H.useRef(null);return(0,H.useImperativeHandle)(d,()=>y.current),(0,H.useEffect)(()=>{y?.current?.focus()},[]),(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":K(`labels.colorPicker`),children:(0,W.jsxs)(`div`,{ref:y,onKeyDown:n=>{UC({event:n,activeColorPickerSection:m,palette:i,color:e,onChange:t,onEyeDropperToggle:c,customColors:p,setActiveColorPickerSection:h,updateData:a,activeShade:_,onEscape:l})&&(n.preventDefault(),n.stopPropagation())},className:`color-picker-content properties-content`,tabIndex:-1,children:[f&&(0,W.jsx)(`div`,{className:`color-picker__title`,children:f}),!!p.length&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.mostUsedCustomColors`)}),(0,W.jsx)(LC,{colors:p,color:e,label:K(`colorPicker.mostUsedCustomColors`),onChange:t})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.colors`)}),(0,W.jsx)(RC,{color:e,palette:i,onChange:t,activeShade:_,showHotKey:u})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.shades`)}),(0,W.jsx)(BC,{color:e,onChange:t,palette:i,showHotKey:u})]}),o]})})}),GC=({onChange:e,type:t,activeColor:n,topPicks:r})=>{let i;return t===`elementStroke`&&(i=ln),t===`elementBackground`&&(i=ta),t===`canvasBackground`&&(i=Mr),r&&(i=r),i?(0,W.jsx)(`div`,{className:`color-picker__top-picks`,children:i.map(t=>(0,W.jsx)(`button`,{className:U(`color-picker__button`,{active:t===n,"is-transparent":t===`transparent`||!t,"has-outline":!yt(t,240)}),style:{"--swatch-color":t},type:`button`,title:t,onClick:()=>e(t),"data-testid":`color-top-pick-${t}`,children:(0,W.jsx)(`div`,{className:`color-picker__button-outline`})},t))}):(console.error(`Invalid type for TopPicks`),null)},KC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=hi,updateData:o,getOpenPopup:s,appState:c})=>{let{container:l}=oz(),u=az(),d=u!==`full`,f=u===`mobile`,[,p]=vy(PC),[m,h]=vy(bC),g=(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.hexCode`)}),(0,W.jsx)(FC,{color:t||``,label:r,onChange:e=>{n(e)},colorPickerType:e,placeholder:K(`colorPicker.color`)})]}),_=(0,H.useRef)(null),v=()=>{_.current?.focus()};return(0,W.jsx)(CC,{container:l,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!c.editingTextElement,onFocusOutside:e=>{Wr(e.target)||v(),e.preventDefault()},onPointerDownOutside:e=>{m&&e.preventDefault()},onClose:()=>{s()===e&&o({openPopup:null}),p(null),c.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},children:a?(0,W.jsx)(WC,{ref:_,palette:a,color:t,onChange:e=>{let t=c.editingTextElement?TC():null;n(e),c.editingTextElement&&t&&EC(t)},onEyeDropperToggle:t=>{h(r=>t?(r||={keepOpenOnAlt:!0,onSelect:n,colorPickerType:e},r.keepOpenOnAlt=!0,r):t===!1||r?null:{keepOpenOnAlt:!1,onSelect:n,colorPickerType:e})},onEscape:e=>{m?h(null):o({openPopup:null})},type:e,elements:i,updateData:o,showTitle:d,showHotKey:!f,children:g}):g})},qC=({label:e,color:t,type:n,mode:r=`background`,onToggle:i,editingTextElement:a})=>{let o=az(),s=o!==`full`,c=o===`mobile`,l=e=>{e.preventDefault(),e.stopPropagation(),a&&kC(),i()};return(0,W.jsxs)(H_,{type:`button`,className:U(`color-picker__button active-color properties-trigger`,{"is-transparent":!t||t===`transparent`,"has-outline":!t||!yt(t,240),"compact-sizing":s,"mobile-border":c}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:K(n===`elementStroke`?`labels.showStroke`:`labels.showBackground`),"data-openpopup":n,onClick:l,children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`,children:!t&&Mb}),s&&t&&r===`stroke`&&(0,W.jsx)(`div`,{className:`color-picker__button-background`,children:(0,W.jsx)(`span`,{style:{color:t&&yt(t,240)?`#fff`:`#111`},children:qS})})]})},JC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=hi,topPicks:o,updateData:s,appState:c})=>{let l=(0,H.useRef)(c.openPopup);(0,H.useEffect)(()=>{l.current=c.openPopup},[c.openPopup]);let u=az()!==`full`;return(0,W.jsx)(`div`,{children:(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`color-picker-container`,{"color-picker-container--no-top-picks":u}),children:[!u&&(0,W.jsx)(GC,{activeColor:t,onChange:n,type:e,topPicks:o}),!u&&(0,W.jsx)(mC,{}),(0,W.jsxs)(V_,{open:c.openPopup===e,onOpenChange:t=>{t&&s({openPopup:e})},children:[(0,W.jsx)(qC,{color:t,label:r,type:e,mode:e===`elementStroke`?`stroke`:`background`,editingTextElement:!!c.editingTextElement,onToggle:()=>{c.openPopup===e?s({openPopup:null}):(c.openPopup,s({openPopup:e}))}}),c.openPopup===e&&(0,W.jsx)(KC,{type:e,color:t,onChange:n,label:r,elements:i,palette:a,updateData:s,getOpenPopup:()=>l.current,appState:c})]})]})})},YC=H.forwardRef(({className:e,placeholder:t,onChange:n},r)=>(0,W.jsxs)(`div`,{className:U(`QuickSearch__wrapper`,e),children:[vS,(0,W.jsx)(`input`,{ref:r,className:`QuickSearch__input`,type:`text`,placeholder:t,onChange:e=>n(e.target.value.trim().toLowerCase())})]})),XC=({className:e,placeholder:t,children:n})=>{let r=!H.Children.count(n);return(0,W.jsx)(`div`,{className:U(`ScrollableList__wrapper`,e),role:`menu`,children:r?(0,W.jsx)(`div`,{className:`empty`,children:t}):n})},ZC=({children:e,className:t=``,style:n,title:r})=>(0,W.jsxs)(`div`,{className:`dropdown-menu-group ${t}`,style:n,children:[r&&(0,W.jsx)(`p`,{className:`dropdown-menu-group-title`,children:r}),e]}),QC=ZC;ZC.displayName=`DropdownMenuGroup`;var $C=H.createContext({}),ew=(e=``,t=!1,n=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?`dropdown-menu-item--selected`:``} ${n?`dropdown-menu-item--hovered`:``}`.trim(),tw=e=>{let t=(0,H.useContext)($C);return ps(e,e=>{t.onSelect?.(e)})},nw=({children:e,...t})=>(0,W.jsx)(`span`,{...t,style:{textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,...t.style},children:e}),rw=({textStyle:e,icon:t,shortcut:n,children:r,badge:i})=>{let a=iz();return(0,W.jsxs)(W.Fragment,{children:[t&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__icon`,children:t}),(0,W.jsx)(`div`,{style:e,className:`dropdown-menu-item__text`,children:(0,W.jsx)(nw,{children:r})}),i&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__badge`,children:i}),n&&a.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__shortcut`,children:n})]})},iw=({icon:e,badge:t,value:n,children:r,shortcut:i,className:a,selected:o,onSelect:s,...c})=>{let l=tw(s);return(0,W.jsx)(d_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,W.jsx)(`button`,{...c,value:n,className:ew(a,o),title:c.title??c[`aria-label`],children:(0,W.jsx)(rw,{icon:e,shortcut:i,badge:t,children:r})})})};iw.displayName=`DropdownMenuItem`;var aw={GREEN:`green`,RED:`red`,BLUE:`blue`},ow=({type:e=aw.BLUE,children:t})=>{let{theme:n}=cz(),r={display:`inline-flex`,marginLeft:`auto`,padding:`2px 4px`,borderRadius:6,fontSize:9,fontFamily:`Cascadia, monospace`,border:n===R.LIGHT?`1.5px solid white`:`none`};switch(e){case aw.GREEN:Object.assign(r,{backgroundColor:`var(--background-color-badge)`,color:`var(--color-badge)`});break;case aw.RED:Object.assign(r,{backgroundColor:`pink`,color:`darkred`});break;case aw.BLUE:default:Object.assign(r,{background:`var(--color-promo)`,color:`var(--color-surface-lowest)`})}return(0,W.jsx)(`div`,{className:`DropDownMenuItemBadge`,style:r,children:t})};ow.displayName=`DropdownMenuItemBadge`,iw.Badge=ow;var sw=iw,cw=({event:e,inputRef:t,hoveredFont:n,filteredFonts:r,onClose:i,onSelect:a,onHover:o})=>{if(!e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===N.F)return t.current?.focus(),!0;if(e.key===N.ESCAPE)return i(),!0;if(e.key===N.ENTER)return n?.value&&a(n.value),!0;if(e.key===N.ARROW_DOWN)return n?.next?o(n.next.value):r[0]?.value&&o(r[0].value),!0;if(e.key===N.ARROW_UP)return n?.prev?o(n.prev.value):r[r.length-1]?.value&&o(r[r.length-1].value),!0},lw=e=>{switch(e){case to.Excalifont:case to.Virgil:return ab;case to.Nunito:case to.Helvetica:return Bx;case to[`Lilita One`]:return zx;case to[`Comic Shanns`]:case to.Cascadia:return Hx;default:return Bx}},uw=H.memo(({selectedFontFamily:e,hoveredFontFamily:t,onSelect:n,onHover:r,onLeave:i,onOpen:a,onClose:o})=>{let{container:s}=oz(),c=nz(),{fonts:l}=c,{showDeprecatedFonts:u}=rz(),d=az(),[f,p]=(0,H.useState)(``),m=(0,H.useRef)(null),h=(0,H.useMemo)(()=>Array.from(de.registered.entries()).filter(([e,{metadata:t}])=>!t.private&&!t.fallback).map(([e,{metadata:t,fontFaces:n}])=>{let r={value:e,icon:lw(e),text:n[0]?.fontFace?.family??`Unknown`};return t.deprecated&&Object.assign(r,{deprecated:t.deprecated,badge:{type:aw.RED,placeholder:K(`fontList.badge.old`)}}),r}).sort((e,t)=>e.text.toLowerCase()>t.text.toLowerCase()?1:-1),[]),g=(0,H.useMemo)(()=>new Set(l.getSceneFamilies()),[e]),_=(0,H.useMemo)(()=>h.filter(e=>g.has(e.value)),[h,g]),v=(0,H.useMemo)(()=>h.filter(e=>!g.has(e.value)&&(u||!e.deprecated)),[h,g,u]),y=(0,H.useMemo)(()=>Kr([..._,...v].filter(e=>e.text?.toLowerCase().includes(f))),[_,v,f]),b=(0,H.useMemo)(()=>{let n;return t?n=y.find(e=>e.value===t):e&&(n=y.find(t=>t.value===e)),!n&&f&&(y[0]?.value?r(y[0].value):i()),n},[t,e,f,y,r,i]),x=(0,H.useCallback)(e=>{let t=null;if(c.state.editingTextElement){let e=document.querySelector(`.excalidraw-wysiwyg`);e&&(t={start:e.selectionStart,end:e.selectionEnd})}n(e),c.state.editingTextElement&&t&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&t&&(e.focus(),e.selectionStart=t.start,e.selectionEnd=t.end)},0)},[n,c.state.editingTextElement]),S=(0,H.useCallback)(e=>{cw({event:e,inputRef:m,hoveredFont:b,filteredFonts:y,onSelect:x,onHover:r,onClose:o})&&(e.preventDefault(),e.stopPropagation())},[b,y,x,r,o]);(0,H.useEffect)(()=>(a(),()=>{o()}),[]);let C=(0,H.useMemo)(()=>y.filter(e=>g.has(e.value)),[y,g]),w=(0,H.useMemo)(()=>y.filter(e=>!g.has(e.value)),[y,g]),T=({font:t,order:n})=>{let i=(0,H.useRef)(null),a=t.value===b?.value,o=t.value===e;return(0,H.useEffect)(()=>{a&&(n===0?i.current?.scrollIntoView?.({block:`end`}):i.current?.scrollIntoView?.({block:`nearest`}))},[a,n]),(0,W.jsx)(`button`,{ref:i,type:`button`,value:t.value,className:ew(``,o,a),title:t.text,tabIndex:o?0:-1,onClick:e=>{x(Number(e.currentTarget.value))},onMouseMove:()=>{b?.value!==t.value&&r(t.value)},children:(0,W.jsx)(rw,{icon:t.icon,badge:t.badge&&(0,W.jsx)(ow,{type:t.badge.type,children:t.badge.placeholder}),textStyle:{fontFamily:yo({fontFamily:t.value})},children:t.text})})},E=[];return C.length&&E.push((0,W.jsx)(QC,{title:K(`fontList.sceneFonts`),children:C.map((e,t)=>(0,W.jsx)(T,{font:e,order:t},e.value))},`group_1`)),w.length&&E.push((0,W.jsx)(QC,{title:K(`fontList.availableFonts`),children:w.map((e,t)=>(0,W.jsx)(T,{font:e,order:t+C.length},e.value))},`group_2`)),(0,W.jsxs)(CC,{className:`properties-content`,container:s,style:{width:`15rem`},onClose:()=>{o(),c.state.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},onPointerLeave:i,onKeyDown:S,preventAutoFocusOnTouch:!!c.state.editingTextElement,children:[d===`full`&&(0,W.jsx)(YC,{ref:m,placeholder:K(`quickSearch.placeholder`),onChange:wt(p,20)}),(0,W.jsx)(XC,{className:`dropdown-menu fonts manual-hover`,placeholder:K(`fontList.empty`),children:E.length?E:null})]})},(e,t)=>e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),dw=({selectedFontFamily:e,isOpened:t=!1,compactMode:n=!1})=>{let r=lz(),i=n?{...Bs,width:`2rem`,height:`2rem`}:{};return(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`div`,{"data-openpopup":`fontFamily`,className:`properties-trigger`,children:(0,W.jsx)(fC,{standalone:!0,icon:ob,title:K(`labels.showFonts`),className:`properties-trigger`,testId:`font-family-show-fonts`,active:t,onClick:()=>{r(e=>({openPopup:e.openPopup===`fontFamily`?null:e.openPopup}))},style:{border:`none`,...i}})})})},fw=[{value:to.Excalifont,icon:ab,text:K(`labels.handDrawn`),testId:`font-family-hand-drawn`},{value:to.Nunito,icon:Bx,text:K(`labels.normal`),testId:`font-family-normal`},{value:to[`Comic Shanns`],icon:Hx,text:K(`labels.code`),testId:`font-family-code`}];new Set(fw.map(e=>e.value));var pw=H.memo(({isOpened:e,selectedFontFamily:t,hoveredFontFamily:n,onSelect:r,onHover:i,onLeave:a,onPopupChange:o,compactMode:s=!1})=>{let c=(0,H.useMemo)(()=>fw,[]),l=(0,H.useCallback)(e=>{e&&r(e)},[r]);return(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`FontPicker__container`,{"FontPicker__container--compact":s}),children:[!s&&(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{type:`button`,options:c,value:t,onClick:l})}),!s&&(0,W.jsx)(mC,{}),(0,W.jsxs)(V_,{open:e,onOpenChange:o,children:[(0,W.jsx)(dw,{selectedFontFamily:t,isOpened:e,compactMode:s}),e&&(0,W.jsx)(uw,{selectedFontFamily:t,hoveredFontFamily:n,onSelect:l,onHover:i,onLeave:a,onOpen:()=>o(!0),onClose:()=>o(!1)})]})]})},(e,t)=>e.isOpened===t.isOpened&&e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),mw=({className:e,icon:t,size:n=`1em`})=>(0,W.jsx)(`span`,{className:e,style:{width:n,height:`100%`,margin:`0 0.5ex 0 0.5ex`,display:`inline-flex`,lineHeight:0,verticalAlign:`middle`,flex:`0 0 auto`},children:t}),hw=({label:e,open:t,openTrigger:n,children:r,className:i,showCollapsedIcon:a=!0})=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{style:{cursor:`pointer`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},className:i,onClick:n,children:[e,a&&(0,W.jsx)(mw,{icon:t?HS:VS})]}),t&&(0,W.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:r})]}),gw=yc(!1),_w=4,vw=`default`,yw=e=>e.flatMap(e=>e.options),bw=(e,t)=>{for(let n of e){let e=n.options.find(t);if(e)return e}return null},xw=(e,t)=>e.some(e=>e.options.some(t)),Sw=e=>e.flatMap(e=>Array.from({length:Math.ceil(e.options.length/_w)},(t,n)=>e.options.slice(n*_w,n*_w+_w)));function Cw({visibleSections:e,hiddenSections:t=[],value:n,label:r,onChange:i,onClose:a}){let o=iz(),{container:s}=oz(),[c,l]=vy(gw),u=yw([...e,...t]),d=Sw([...e,...c?t:[]]),f=e=>{let t=u.find(t=>t.keyBinding===e.key.toLowerCase());if(!(e.metaKey||e.altKey||e.ctrlKey)&&t)i(t.value),e.preventDefault();else if(e.key===N.TAB){let t=u.findIndex(e=>e.value===n);i(u[e.shiftKey?(u.length+t-1)%u.length:(t+1)%u.length].value)}else if(Pe(e.key)){let t=My().rtl,r=u.findIndex(e=>e.value===n);if(r!==-1){let a=u.length,o=r;switch(e.key){case t?N.ARROW_LEFT:N.ARROW_RIGHT:o=(r+1)%a;break;case t?N.ARROW_RIGHT:N.ARROW_LEFT:o=(a+r-1)%a;break;case N.ARROW_DOWN:{let t=d.findIndex(e=>e.some(e=>e.value===n)),a=d[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=d[(t+1)%d.length];i((s[Math.min(o,s.length-1)]??u[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}case N.ARROW_UP:{let t=d.findIndex(e=>e.some(e=>e.value===n)),a=d[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=d[(d.length+t-1)%d.length];i((s[Math.min(o,s.length-1)]??u[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}}i(u[o].value)}e.preventDefault()}else (e.key===N.ESCAPE||e.key===N.ENTER)&&(e.preventDefault(),a());e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()};(0,H.useEffect)(()=>{xw(t,e=>e.value===n)&&l(!0)},[n,t,l]);let p=e=>(0,W.jsx)(`div`,{className:`picker-content`,children:e.map(e=>(0,W.jsxs)(`button`,{type:`button`,className:U(`picker-option`,{active:n===e.value}),onClick:()=>{i(e.value)},title:e.keyBinding?`${e.text} \u2014 ${e.keyBinding.toUpperCase()}`:e.text,"aria-label":e.text||`none`,"aria-keyshortcuts":e.keyBinding||void 0,ref:t=>{n===e.value&&setTimeout(()=>{t?.focus()},0)},children:[e.icon,e.keyBinding&&(0,W.jsx)(`span`,{className:`picker-keybinding`,children:e.keyBinding})]},e.text))}),m=e=>e.map((e,t)=>e.name===vw?(0,W.jsx)(H.Fragment,{children:p(e.options)},`${e.name}-${t}`):(0,W.jsxs)(`div`,{className:`picker-section`,children:[(0,W.jsx)(`div`,{className:`picker-section-label`,children:e.name}),p(e.options)]},`${e.name}-${t}`)),h=o.formFactor===`phone`;return(0,W.jsx)(W_,{side:h?`right`:`bottom`,align:`start`,sideOffset:h?8:12,style:{zIndex:`var(--zIndex-ui-styles-popup)`},onKeyDown:f,collisionBoundary:s??void 0,children:(0,W.jsx)(`div`,{className:`picker`,role:`dialog`,"aria-modal":`true`,"aria-label":r,children:(0,W.jsxs)(`div`,{className:`picker-sections`,children:[m(e),t.length>0&&(0,W.jsx)(hw,{label:K(`labels.more_options`),open:c,openTrigger:()=>{l(e=>!e)},className:`picker-collapsible`,children:(0,W.jsx)(`div`,{className:`picker-sections`,children:m(t)})})]})})})}function ww({value:e,label:t,visibleSections:n,hiddenSections:r,onChange:i}){let[a,o]=H.useState(!1),s=(0,H.useMemo)(()=>bw(n,t=>t.value===e)??bw(r??[],t=>t.value===e),[n,r,e]);return(0,W.jsx)(`div`,{children:(0,W.jsxs)(V_,{open:a,onOpenChange:e=>o(e),children:[(0,W.jsx)(H_,{type:`button`,"aria-label":t,onClick:()=>o(!a),className:a?`active`:``,children:s?.icon}),a&&(0,W.jsx)(Cw,{visibleSections:n,hiddenSections:r,value:e,label:t,onChange:i,onClose:()=>{o(!1)}})]})})}var Tw=({updateData:e,app:t,testId:n})=>{let r=H.useRef(null),i=H.useRef(null),a=t.scene.getSelectedElements(t.state),o=!0,s=a.at(0),c=a.reduce((e,t)=>(e!=null&&e!==t.opacity&&(o=!1),e==null||e>t.opacity?t.opacity:e),s?.opacity??null)??t.state.currentItemOpacity;return(0,H.useEffect)(()=>{if(r.current&&i.current){let e=r.current,t=i.current,n=e.offsetWidth,a=c/100*(n-15)+15/2;t.style.left=`${a}px`,e.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${c}%, var(--button-bg) ${c}%, var(--button-bg) 100%)`}},[c]),(0,W.jsxs)(`label`,{className:`control-label`,children:[K(`labels.opacity`),(0,W.jsxs)(`div`,{className:`range-wrapper`,children:[(0,W.jsx)(`input`,{style:{"--color-slider-track":o?void 0:`var(--button-bg)`},ref:r,type:`range`,min:`0`,max:`100`,step:`10`,onChange:t=>{e(+t.target.value)},value:c,className:`range-input`,"data-testid":n}),(0,W.jsx)(`div`,{className:`value-bubble`,ref:i,children:c===0?null:c}),(0,W.jsx)(`div`,{className:`zero-label`,children:`0`})]})]})},Ew=.1,Dw=e=>{let t=Ka(e.editorInterface);return{stylesPanelMode:t,isCompact:t!==`full`,isMobile:t===`mobile`}},Ow=(e,t,n,r=!1)=>{let i=lr(ir(e,t,{includeBoundTextElement:r}));return e.map(e=>i.get(e.id)||e.id===t.editingTextElement?.id?n(e):e)},kw=function(e,t,n,r,i){let a=t.state.editingTextElement,o=Cs(e),s=null;if(a&&(s=n(a)),!s)if(Ya(o,t.state)){let e=t.scene.getSelectedElements(t.state);s=it(r===!0?e:e.filter(e=>r(e)),n)??(typeof i==`function`?i(!0):i)}else s=typeof i==`function`?i(!1):i;return s},Aw=(e,t,n)=>ya(t)||!t.autoResize?t:n.mutateElement(t,{x:e.textAlign===`left`?e.x:e.x+(e.width-t.width)/(e.textAlign===`center`?2:1),y:e.y+(e.height-t.height)/2}),jw=(e,t,n,r,i)=>{let a=new Set,o=Ow(e,t,e=>{if(M(e)){let t=r(e);a.add(t);let i=B(e,{fontSize:t});return Zi(i,n.scene.getContainerElement(e),n.scene),i=Aw(e,i,n.scene),i}return e},!0);return ir(e,t,{includeBoundTextElement:!0}).forEach(e=>{M(e)&&ue(e,n.scene)}),{elements:o,appState:{...t,currentItemFontSize:a.size===1?[...a][0]:i??t.currentItemFontSize},captureUpdate:V.IMMEDIATELY}};Z({name:`changeStrokeColor`,label:`labels.stroke`,trackEvent:!1,perform:(e,t,n)=>({...n?.currentItemStrokeColor&&{elements:Ow(e,t,e=>ye(e.type)?B(e,{strokeColor:n.currentItemStrokeColor}):e,!0)},appState:{...t,...n},captureUpdate:n?.currentItemStrokeColor?V.IMMEDIATELY:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Dw(r);return(0,W.jsxs)(W.Fragment,{children:[a===`full`&&(0,W.jsx)(`h3`,{"aria-hidden":`true`,children:K(`labels.stroke`)}),(0,W.jsx)(JC,{topPicks:ln,palette:lt,type:`elementStroke`,label:K(`labels.stroke`),color:kw(e,r,e=>e.strokeColor,!0,e=>e?null:t.currentItemStrokeColor),onChange:e=>n({currentItemStrokeColor:e}),elements:e,appState:t,updateData:n})]})}}),Z({name:`changeBackgroundColor`,label:`labels.changeBackground`,trackEvent:!1,perform:(e,t,n,r)=>{if(!n?.currentItemBackgroundColor)return{appState:{...t,...n},captureUpdate:V.EVENTUALLY};let i,a=r.scene.getSelectedElements(t);if(!Po(n.currentItemBackgroundColor)&&a.every(e=>ca(e)&&Xo(e.points))){let t=lr(a);i=e.map(e=>t.has(e.id)&&ca(e)?B(e,{backgroundColor:n.currentItemBackgroundColor,...g(e,!0)}):e)}else i=Ow(e,t,e=>B(e,{backgroundColor:n.currentItemBackgroundColor}));return{elements:i,appState:{...t,...n},captureUpdate:V.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Dw(r);return(0,W.jsxs)(W.Fragment,{children:[a===`full`&&(0,W.jsx)(`h3`,{"aria-hidden":`true`,children:K(`labels.background`)}),(0,W.jsx)(JC,{topPicks:ta,palette:et,type:`elementBackground`,label:K(`labels.background`),color:kw(e,r,e=>e.backgroundColor,!0,e=>e?null:t.currentItemBackgroundColor),onChange:e=>n({currentItemBackgroundColor:e}),elements:e,appState:t,updateData:n})]})}}),Z({name:`changeFillStyle`,label:`labels.fill`,trackEvent:!1,perform:(e,t,n,r)=>(dC(`element`,`changeFillStyle`,`${n} (${r.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),{elements:Ow(e,t,e=>B(e,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=ir(e,t),a=i.length>0&&i.every(e=>e.fillStyle===`zigzag`);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.fill`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{type:`button`,options:[{value:`hachure`,text:`${K(a?`labels.zigzag`:`labels.hachure`)} (${Q(`Alt-Click`)})`,icon:a?ax:ox,active:a?!0:void 0,testId:`fill-hachure`},{value:`cross-hatch`,text:K(`labels.crossHatch`),icon:sx,testId:`fill-cross-hatch`},{value:`solid`,text:K(`labels.solid`),icon:cx,testId:`fill-solid`}],value:kw(e,r,e=>e.fillStyle,e=>e.hasOwnProperty(`fillStyle`),e=>e?null:t.currentItemFillStyle),onClick:(e,t)=>{n(t.altKey&&e===`hachure`&&i.every(e=>e.fillStyle===`hachure`)?`zigzag`:e)}})})]})}}),Z({name:`changeStrokeWidth`,label:`labels.strokeWidth`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{strokeWidth:n})),appState:{...t,currentItemStrokeWidth:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.strokeWidth`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`stroke-width`,options:[{value:Ze.thin,text:K(`labels.thin`),icon:lx,testId:`strokeWidth-thin`},{value:Ze.bold,text:K(`labels.bold`),icon:ux,testId:`strokeWidth-bold`},{value:Ze.extraBold,text:K(`labels.extraBold`),icon:dx,testId:`strokeWidth-extraBold`}],value:kw(e,r,e=>e.strokeWidth,e=>e.hasOwnProperty(`strokeWidth`),e=>e?null:t.currentItemStrokeWidth),onChange:e=>n(e)})})]})}),Z({name:`changeSloppiness`,label:`labels.sloppiness`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{seed:se(),roughness:n})),appState:{...t,currentItemRoughness:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.sloppiness`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`sloppiness`,options:[{value:0,text:K(`labels.architect`),icon:mx},{value:1,text:K(`labels.artist`),icon:hx},{value:2,text:K(`labels.cartoonist`),icon:gx}],value:kw(e,r,e=>e.roughness,e=>e.hasOwnProperty(`roughness`),e=>e?null:t.currentItemRoughness),onChange:e=>n(e)})})]})}),Z({name:`changeStrokeStyle`,label:`labels.strokeStyle`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.strokeStyle`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`strokeStyle`,options:[{value:`solid`,text:K(`labels.strokeStyle_solid`),icon:lx},{value:`dashed`,text:K(`labels.strokeStyle_dashed`),icon:fx},{value:`dotted`,text:K(`labels.strokeStyle_dotted`),icon:px}],value:kw(e,r,e=>e.strokeStyle,e=>e.hasOwnProperty(`strokeStyle`),e=>e?null:t.currentItemStrokeStyle),onChange:e=>n(e)})})]})}),Z({name:`changeOpacity`,label:`labels.opacity`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({app:e,updateData:t})=>(0,W.jsx)(Tw,{updateData:t,app:e,testId:`opacity`})}),Z({name:`changeFontSize`,label:`labels.fontSize`,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,()=>(gt(n,`actionChangeFontSize: Expected a font size value`),n),n),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Dw(r);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.fontSize`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`font-size`,options:[{value:os.sm,text:K(`labels.small`),icon:Px,testId:`fontSize-small`},{value:os.md,text:K(`labels.medium`),icon:Fx,testId:`fontSize-medium`},{value:os.lg,text:K(`labels.large`),icon:Ix,testId:`fontSize-large`},{value:os.xl,text:K(`labels.veryLarge`),icon:Lx,testId:`fontSize-veryLarge`}],value:kw(e,r,e=>{if(M(e))return e.fontSize;let t=ut(e,r.scene.getNonDeletedElementsMap());return t?t.fontSize:null},e=>M(e)||ut(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:t.currentItemFontSize||20),onChange:e=>{DC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})]})}});var Mw=Z({name:`decreaseFontSize`,label:`labels.decreaseFontSize`,icon:Rx,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,e=>Math.round(1/(1+Ew)*e.fontSize)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_LEFT||e.key===N.COMMA)}),Nw=Z({name:`increaseFontSize`,label:`labels.increaseFontSize`,icon:Rx,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,e=>Math.round(e.fontSize*(1+Ew))),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_RIGHT||e.key===N.PERIOD)});Z({name:`changeFontFamily`,label:`labels.fontFamily`,trackEvent:!1,perform:(e,t,n,r)=>{let{cachedElements:i,resetAll:a,resetContainers:o,...s}=n;if(a)return{elements:Ow(e,t,e=>{let t=i?.get(e.id);return t?B(e,{...t}):e},!0),appState:{...t,...s},captureUpdate:V.NEVER};gt(n,`actionChangeFontFamily: value must be defined`);let{currentItemFontFamily:c,currentHoveredFontFamily:l}=n,u=V.EVENTUALLY,d,f=!1;if(c)d=c,u=V.IMMEDIATELY;else if(l){d=l,u=V.EVENTUALLY;let n=ir(e,t,{includeBoundTextElement:!0}).filter(e=>M(e));if(n.length>200)f=!0;else{let e=0,t=0;for(;e<n.length&&t<5e3;){let r=n[e];t+=r?.originalText.length||0,e++}t>5e3&&(f=!0)}}let p={appState:{...t,...s},captureUpdate:u};if(d&&!f){let n=new Map,a=new Set,s=!1,u=Array.from(de.loadedFontsCache.values()),f=Object.entries(to).find(([e,t])=>t===d)?.[0];l&&f&&u.some(e=>e.startsWith(f))&&(s=!0),Object.assign(p,{elements:Ow(e,t,e=>{if(M(e)&&(e.fontFamily!==d||c)){let t=B(e,{fontFamily:d,lineHeight:ba(d)}),c=i?.get(e.containerId||``)||{},l=r.scene.getContainerElement(e);return o&&l&&c&&r.scene.mutateElement(l,{...c}),s||(a=new Set([...a,...Array.from(t.originalText)])),n.set(t,l),t}return e},!0)});let m=`10px ${yo({fontFamily:d})}`,h=Array.from(a.values()).join();if(s||window.document.fonts.check(m,h))for(let[e,t]of n)Zi(e,t,r.scene);else window.document.fonts.load(m,h).then(e=>{for(let[e,t]of n){let n=r.scene.getElement(e.id),i=t?r.scene.getElement(t.id):null;n&&Zi(n,i,r.scene)}r.fonts.onLoaded(e)})}return p},PanelComponent:({elements:e,appState:t,app:n,updateData:r})=>{let i=(0,H.useRef)(new Map),a=(0,H.useRef)(null),[o,s]=(0,H.useState)({}),c=(0,H.useRef)(!0),{stylesPanelMode:l,isCompact:u}=Dw(n),d=(0,H.useMemo)(()=>{let r=(e,r)=>kw(e,n,e=>{if(M(e))return e.fontFamily;let t=ut(e,r);return t?t.fontFamily:null},e=>M(e)||ut(e,r)!==null,e=>e?null:t.currentItemFontFamily||$r);return o.openPopup===`fontFamily`&&t.openPopup===`fontFamily`?r(Array.from(i.current?.values()??[]),i.current):!o.openPopup&&t.openPopup!==`fontFamily`?r(e,n.scene.getNonDeletedElementsMap()):a.current},[o.openPopup,t,e,n]);return(0,H.useEffect)(()=>{a.current=d},[d]),(0,H.useEffect)(()=>{Object.keys(o).length&&(r(o),s({}))},[o]),(0,H.useEffect)(()=>(c.current=!1,()=>{c.current=!0}),[]),(0,W.jsxs)(W.Fragment,{children:[l===`full`&&(0,W.jsx)(`legend`,{children:K(`labels.fontFamily`)}),(0,W.jsx)(pw,{isOpened:t.openPopup===`fontFamily`,selectedFontFamily:d,hoveredFontFamily:t.currentHoveredFontFamily,compactMode:l!==`full`,onSelect:e=>{DC(()=>{s({openPopup:null,currentHoveredFontFamily:null,currentItemFontFamily:e}),i.current.clear()},u,!!t.editingTextElement)},onHover:e=>{s({currentHoveredFontFamily:e,cachedElements:new Map(i.current),resetContainers:!0})},onLeave:()=>{s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0})},onPopupChange:r=>{if(r){i.current.clear();let{editingTextElement:r}=t;if(r?.type===`text`){let e=n.scene.getElement(r.id);i.current.set(r.id,B(e||r,{},!0))}else{let n=ir(e,t,{includeBoundTextElement:!0});for(let e of n)i.current.set(e.id,B(e,{},!0))}s({...o,openPopup:`fontFamily`})}else s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0}),i.current.clear(),u&&t.editingTextElement&&EC(null)}})]})}}),Z({name:`changeTextAlign`,label:`Change text alignment`,trackEvent:!1,perform:(e,t,n,r)=>({elements:Ow(e,t,e=>{if(M(e)){let t=B(e,{textAlign:n});return Zi(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t,currentItemTextAlign:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let a=r.scene.getNonDeletedElementsMap(),{isCompact:o}=Dw(r);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.textAlign`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`text-align`,options:[{value:`left`,text:K(`labels.left`),icon:Ux,testId:`align-left`},{value:`center`,text:K(`labels.center`),icon:Wx,testId:`align-horizontal-center`},{value:`right`,text:K(`labels.right`),icon:Gx,testId:`align-right`}],value:kw(e,r,e=>{if(M(e))return e.textAlign;let t=ut(e,a);return t?t.textAlign:null},e=>M(e)||ut(e,a)!==null,e=>e?null:t.currentItemTextAlign),onChange:e=>{DC(()=>n(e),o,!!t.editingTextElement,i?.onPreventClose)}})})]})}}),Z({name:`changeVerticalAlign`,label:`Change vertical alignment`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Ow(e,t,e=>{if(M(e)){let t=B(e,{verticalAlign:n});return Zi(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Dw(r);return(0,W.jsx)(`fieldset`,{children:(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`text-align`,options:[{value:Lr.TOP,text:K(`labels.alignTop`),icon:(0,W.jsx)(Kx,{theme:t.theme}),testId:`align-top`},{value:Lr.MIDDLE,text:K(`labels.centerVertically`),icon:(0,W.jsx)(Jx,{theme:t.theme}),testId:`align-middle`},{value:Lr.BOTTOM,text:K(`labels.alignBottom`),icon:(0,W.jsx)(qx,{theme:t.theme}),testId:`align-bottom`}],value:kw(e,r,e=>{if(M(e)&&e.containerId)return e.verticalAlign;let t=ut(e,r.scene.getNonDeletedElementsMap());return t?t.verticalAlign:null},e=>M(e)||ut(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:Lr.MIDDLE),onChange:e=>{DC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})})}}),Z({name:`changeRoundness`,label:`Change edge roundness`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>dr(e)?e:B(e,{roundness:n===`round`?{type:Ga(e.type)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>{let a=si(Cs(e),t).some(e=>e.roundness?.type===Xa.LEGACY);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.edges`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[(0,W.jsx)(pC,{group:`edges`,options:[{value:`sharp`,text:K(`labels.sharp`),icon:_x},{value:`round`,text:K(`labels.round`),icon:vx}],value:kw(e,r,e=>a?null:e.roundness?`round`:`sharp`,e=>!jt(e)&&e.hasOwnProperty(`roundness`),e=>e?null:t.currentItemRoundness),onChange:e=>n(e)}),i(`togglePolygon`)]})]})}});var Pw=e=>({visibleSections:[{name:`default`,options:[{value:null,text:K(`labels.arrowhead_none`),keyBinding:`q`,icon:(0,W.jsx)(yx,{flip:e})},{value:`arrow`,text:K(`labels.arrowhead_arrow`),keyBinding:`w`,icon:(0,W.jsx)(bx,{flip:e})},{value:`triangle`,text:K(`labels.arrowhead_triangle`),icon:(0,W.jsx)(xx,{flip:e}),keyBinding:`e`},{value:`triangle_outline`,text:K(`labels.arrowhead_triangle_outline`),icon:(0,W.jsx)(Sx,{flip:e}),keyBinding:`r`}]}],hiddenSections:[{name:`default`,options:[{value:`circle`,text:K(`labels.arrowhead_circle`),keyBinding:`a`,icon:(0,W.jsx)(Cx,{flip:e})},{value:`circle_outline`,text:K(`labels.arrowhead_circle_outline`),keyBinding:`s`,icon:(0,W.jsx)(wx,{flip:e})},{value:`diamond`,text:K(`labels.arrowhead_diamond`),icon:(0,W.jsx)(Tx,{flip:e}),keyBinding:`d`},{value:`diamond_outline`,text:K(`labels.arrowhead_diamond_outline`),icon:(0,W.jsx)(Ex,{flip:e}),keyBinding:`f`},{value:`bar`,text:K(`labels.arrowhead_bar`),keyBinding:`z`,icon:(0,W.jsx)(Dx,{flip:e})}]},{name:K(`labels.cardinality`),options:[{value:`cardinality_one`,text:K(`labels.arrowhead_cardinality_one`),icon:(0,W.jsx)(Ox,{flip:e}),keyBinding:`x`},{value:`cardinality_many`,text:K(`labels.arrowhead_cardinality_many`),icon:(0,W.jsx)(kx,{flip:e}),keyBinding:`c`},{value:`cardinality_one_or_many`,text:K(`labels.arrowhead_cardinality_one_or_many`),icon:(0,W.jsx)(Ax,{flip:e}),keyBinding:`v`},{value:`cardinality_exactly_one`,text:K(`labels.arrowhead_cardinality_exactly_one`),icon:(0,W.jsx)(jx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_one`,text:K(`labels.arrowhead_cardinality_zero_or_one`),icon:(0,W.jsx)(Mx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_many`,text:K(`labels.arrowhead_cardinality_zero_or_many`),icon:(0,W.jsx)(Nx,{flip:e}),keyBinding:null}]}]});Z({name:`changeArrowhead`,label:`Change arrowheads`,trackEvent:!1,perform:(e,t,n)=>(gt(n,`actionChangeArrowhead: value must be defined`),{elements:Ow(e,t,e=>{if(b(e)){let{position:t,type:r}=n;if(t===`start`)return B(e,{startArrowhead:r});if(t===`end`)return B(e,{endArrowhead:r})}return e}),appState:{...t,[n.position===`start`?`currentItemStartArrowhead`:`currentItemEndArrowhead`]:n.type},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=My().rtl,a=(0,H.useMemo)(()=>Pw(!i),[i]),o=(0,H.useMemo)(()=>Pw(!!i),[i]);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.arrowheads`)}),(0,W.jsxs)(`div`,{className:`iconSelectList buttonList`,children:[(0,W.jsx)(ww,{visibleSections:a.visibleSections,hiddenSections:a.hiddenSections,label:`arrowhead_start`,value:kw(e,r,e=>b(e)&&Ms(e.type)?Qt(e.startArrowhead):t.currentItemStartArrowhead,!0,e=>e?null:t.currentItemStartArrowhead),onChange:e=>n({position:`start`,type:e})}),(0,W.jsx)(ww,{visibleSections:o.visibleSections,hiddenSections:o.hiddenSections,label:`arrowhead_end`,value:kw(e,r,e=>b(e)&&Ms(e.type)?Qt(e.endArrowhead):t.currentItemEndArrowhead,!0,e=>e?null:t.currentItemEndArrowhead),onChange:e=>n({position:`end`,type:e})})]})]})}}),Z({name:`changeArrowProperties`,label:`Change arrow properties`,trackEvent:!1,perform:(e,t,n,r)=>!1,PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[i(`changeArrowhead`),i(`changeArrowType`)]})}),Z({name:`changeArrowType`,label:`Change arrow types`,trackEvent:!1,perform:(e,t,n,r)=>{let i=Ow(e,t,e=>{if(!jt(e))return e;let i=r.scene.getNonDeletedElementsMap(),a=I.getPointAtIndexGlobalCoordinates(e,0,i),o=I.getPointAtIndexGlobalCoordinates(e,-1,i),s=B(e,{x:n===ts.elbow?a[0]:e.x,y:n===ts.elbow?a[1]:e.y,roundness:n===ts.round?{type:Xa.PROPORTIONAL_RADIUS}:null,elbowed:n===ts.elbow,angle:n===ts.elbow?0:e.angle,points:n===ts.elbow||e.elbowed?[I.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},a,i),I.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},o,i)]:e.points});if(dr(s)){s.fixedSegments=null;let e=r.scene.getNonDeletedElementsMap();r.dismissLinearEditor();let n=I.getPointAtIndexGlobalCoordinates(s,0,e),i=I.getPointAtIndexGlobalCoordinates(s,-1,e),a=s.startBinding&&e.get(s.startBinding.elementId),o=s.endBinding&&e.get(s.endBinding.elementId),c=a&&s.startBinding?{...s.startBinding,...wo(s,a,`start`,e,t.isBindingEnabled)}:null,l=o&&s.endBinding?{...s.endBinding,...wo(s,o,`end`,e,t.isBindingEnabled)}:null;s={...s,startBinding:c,endBinding:l,...fi(s,e,{points:[n,i].map(e=>O(e[0]-s.x,e[1]-s.y)),startBinding:c,endBinding:l,fixedSegments:null})}}else{let e=r.scene.getNonDeletedElementsMap();if(s.startBinding){let n=e.get(s.startBinding.elementId);n&&$n(s,n,t.bindMode===`inside`?`inside`:`orbit`,`start`,r.scene)}if(s.endBinding){let n=e.get(s.endBinding.elementId);n&&$n(s,n,t.bindMode===`inside`?`inside`:`orbit`,`end`,r.scene)}}return s}),a={...t,currentItemArrowType:n},o=t.selectedLinearElement?.elementId;if(o){let t=i.find(e=>e.id===o);t&&(a.selectedLinearElement=new I(t,lr(e)))}return{elements:i,appState:a,captureUpdate:V.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.arrowtypes`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`arrowtypes`,options:[{value:ts.sharp,text:K(`labels.arrowtype_sharp`),icon:RS,testId:`sharp-arrow`},{value:ts.round,text:K(`labels.arrowtype_round`),icon:BS,testId:`round-arrow`},{value:ts.elbow,text:K(`labels.arrowtype_elbowed`),icon:zS,testId:`elbow-arrow`}],value:kw(e,r,e=>jt(e)?e.elbowed?ts.elbow:e.roundness?ts.round:ts.sharp:null,e=>jt(e),e=>e?null:t.currentItemArrowType),onChange:e=>n(e)})})]})});var Fw=()=>{let e=document.querySelector(`.excalidraw-tooltip`);if(e)return e;let t=document.createElement(`div`);return document.body.appendChild(t),t.classList.add(`excalidraw-tooltip`),t},Iw=(e,t,n=`bottom`)=>{let r=e.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=t.left+t.width/2-r.width/2;o<0?o=5:o+r.width>=i&&(o=i-r.width-5);let s;n===`bottom`?(s=t.top+t.height+5,s+r.height>=a&&(s=t.top-r.height-5)):(s=t.top-r.height-5,s<0&&(s=t.top+t.height+5)),Object.assign(e.style,{top:`${s}px`,left:`${o}px`})},Lw=(e,t,n,r)=>{t.classList.add(`excalidraw-tooltip--visible`),t.style.minWidth=r?`50ch`:`10ch`,t.style.maxWidth=r?`50ch`:`15ch`,t.textContent=n,Iw(t,e.getBoundingClientRect())},Rw=({children:e,label:t,long:n=!1,style:r,disabled:i})=>((0,H.useEffect)(()=>()=>Fw().classList.remove(`excalidraw-tooltip--visible`),[]),i?null:(0,W.jsx)(`div`,{className:`excalidraw-tooltip-wrapper`,onPointerEnter:e=>Lw(e.currentTarget,Fw(),t,n),onPointerLeave:()=>Fw().classList.remove(`excalidraw-tooltip--visible`),style:r,children:e})),zw=`<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">`,Bw=`<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>`,Vw=`<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>`,Hw=`data:${hs.svg},${encodeURIComponent(`${zw}${Vw}</svg>`)}`,Uw=`data:${hs.svg},${encodeURIComponent(`${zw}${Bw}${Vw}</svg>`)}`,Ww=e=>{e&&(e.style.cursor=``)},Gw=(e,t)=>{e&&(e.style.cursor=t)},Kw,qw,Jw=(e,t)=>{(!Kw||Kw.theme!==t)&&(()=>{let e=t===R.DARK;Kw=document.createElement(`canvas`),Kw.theme=t,Kw.height=20,Kw.width=20;let n=Kw.getContext(`2d`);n.lineWidth=1,n.beginPath(),n.arc(Kw.width/2,Kw.height/2,5,0,2*Math.PI),n.fillStyle=e?`#000`:`#fff`,n.fill(),n.strokeStyle=e?`#fff`:`#000`,n.stroke(),qw=Kw.toDataURL(hs.svg)})(),Gw(e,`url(${qw}) ${20/2} ${20/2}, auto`)},Yw=(e,t)=>{if(e)if(t.activeTool.type===`selection`)Ww(e);else if(Fs(t))e.style.cursor=Kn.GRAB;else if(zr(t))Jw(e,t.theme);else if(t.activeTool.type===`laser`){let n=t.theme===R.LIGHT?Hw:Uw;e.style.cursor=`url(${n}), auto`}else [`image`,`custom`].includes(t.activeTool.type)?t.activeTool.type!==`image`&&(e.style.cursor=Kn.AUTO):e.style.cursor=Kn.CROSSHAIR},Xw=({viewportX:e,viewportY:t,nextZoom:n},r)=>{let i=e-r.offsetLeft,a=t-r.offsetTop,o=r.zoom.value,s=r.scrollX+(i-i/o),c=r.scrollY+(a-a/o),l=-(i-i/n),u=-(a-a/n);return{scrollX:s+l,scrollY:c+u,zoom:{value:n}}};Z({name:`changeViewBackgroundColor`,label:`labels.canvasBackground`,trackEvent:!1,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,n)=>({appState:{...t,...n},captureUpdate:n?.viewBackgroundColor?V.IMMEDIATELY:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r,data:i})=>(0,W.jsx)(JC,{palette:null,topPicks:Mr,label:K(`labels.canvasBackground`),type:`canvasBackground`,color:t.viewBackgroundColor,onChange:e=>n({viewBackgroundColor:e}),"data-testid":`canvas-background-picker`,elements:e,appState:t,updateData:n})});var Zw=Z({name:`clearCanvas`,label:`labels.clearCanvas`,icon:pb,trackEvent:{category:`canvas`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`,perform:(e,t,n,r)=>(r.imageCache.clear(),{elements:e.map(e=>B(e,{isDeleted:!0})),appState:{...cs(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,gridStep:t.gridStep,gridModeEnabled:t.gridModeEnabled,stats:t.stats,activeTool:t.activeTool.type===`image`?{...t.activeTool,type:r.state.preferredSelectionTool.type}:t.activeTool},captureUpdate:V.IMMEDIATELY})}),Qw=Z({name:`zoomIn`,label:`buttons.zoomIn`,viewMode:!0,icon:ub,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(t.zoom.value+qi)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(X,{type:`button`,className:`zoom-in-button zoom-button`,icon:ub,title:`${K(`buttons.zoomIn`)} \u2014 ${Q(`CtrlOrCmd++`)}`,"aria-label":K(`buttons.zoomIn`),disabled:t.zoom.value>=30,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Gs.EQUAL||e.code===Gs.NUM_ADD)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),$w=Z({name:`zoomOut`,label:`buttons.zoomOut`,icon:db,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(t.zoom.value-qi)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(X,{type:`button`,className:`zoom-out-button zoom-button`,icon:db,title:`${K(`buttons.zoomOut`)} \u2014 ${Q(`CtrlOrCmd+-`)}`,"aria-label":K(`buttons.zoomOut`),disabled:t.zoom.value<=mn,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Gs.MINUS||e.code===Gs.NUM_SUBTRACT)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),eT=Z({name:`resetZoom`,label:`buttons.resetZoom`,icon:fb,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(1)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(Rw,{label:K(`buttons.resetZoom`),style:{height:`100%`},children:(0,W.jsxs)(X,{type:`button`,className:`reset-zoom-button zoom-button`,title:K(`buttons.resetZoom`),"aria-label":K(`buttons.resetZoom`),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),`%`]})}),keyTest:e=>(e.code===Gs.ZERO||e.code===Gs.NUM_ZERO)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),tT=(e,t,n=1)=>{let[r,i,a,o]=e,s=a-r,c=t.width/s,l=o-i,u=t.height/l,d=Math.min(c,u)*Ht(n,.1,1);return Math.min(d,1)},nT=({bounds:e,appState:t,canvasOffsets:n,fitToViewport:r=!1,viewportZoomFactor:i=1,minZoom:a=-1/0,maxZoom:o=1/0})=>{i=Ht(i,mn,30);let[s,c,l,u]=e,d=(s+l)/2,f=(c+u)/2,p=n?.left??0,m=n?.top??0,h=n?.right??0,g=n?.bottom??0,_=t.width-p-h,v=t.height-m-g,y;if(r){let e=l-s,t=u-c;y=Math.min(_/e,v/t)*i}else y=tT(e,{width:_,height:v},i);let b=_i(Ht(ie(y,qi,`floor`),a,o)),x=$e({scenePoint:{x:d,y:f},viewportDimensions:{width:t.width,height:t.height},offsets:n,zoom:{value:b}});return{appState:{...t,scrollX:x.scrollX,scrollY:x.scrollY,zoom:{value:b}},captureUpdate:V.EVENTUALLY}},rT=({canvasOffsets:e,targetElements:t,appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o})=>nT({canvasOffsets:e,bounds:Ii(Cs(t)),appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o});Z({name:`zoomToFitSelectionInViewport`,label:`labels.zoomToFitViewport`,icon:kS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return rT({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Gs.TWO&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Z({name:`zoomToFitSelection`,label:`helpDialog.zoomToSelection`,icon:kS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return rT({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!0,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Gs.THREE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Z({name:`zoomToFit`,label:`helpDialog.zoomToFit`,icon:kS,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>rT({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()}),keyTest:e=>e.code===Gs.ONE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]});var iT=Z({name:`toggleTheme`,label:(e,t)=>t.theme===R.DARK?`buttons.lightMode`:`buttons.darkMode`,keywords:[`toggle`,`dark`,`light`,`mode`,`theme`],icon:(e,t)=>e.theme===R.LIGHT?gb:_b,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n)=>({appState:{...t,theme:n||(t.theme===R.LIGHT?R.DARK:R.LIGHT)},captureUpdate:V.EVENTUALLY}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===Gs.D,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.toggleTheme});Z({name:`toggleEraserTool`,label:`toolBar.eraser`,trackEvent:{category:`toolbar`},perform:(e,t,n,r)=>{let i;return i=zr(t)?ka(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):ka(t,{type:`eraser`,lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e.key===N.E}),Z({name:`toggleLassoTool`,label:`toolBar.lasso`,icon:Qy,trackEvent:{category:`toolbar`},predicate:(e,t,n,r)=>r.state.preferredSelectionTool.type!==`lasso`,perform:(e,t,n,r)=>{let i;return t.activeTool.type===`lasso`?i=ka(t,{type:`selection`}):(i=ka(t,{type:`lasso`,fromSelection:!1}),Gw(r.interactiveCanvas,Kn.CROSSHAIR)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.NEVER}}});var aT=Z({name:`toggleHandTool`,label:`toolBar.hand`,trackEvent:{category:`toolbar`},icon:Zx,viewMode:!1,perform:(e,t,n,r)=>{let i;return Fs(t)?i=ka(t,{...t.activeTool.lastActiveTool||{type:`selection`},lastActiveToolBeforeEraser:null}):(i=ka(t,{type:`hand`,lastActiveToolBeforeEraser:t.activeTool}),Gw(r.interactiveCanvas,Kn.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.IMMEDIATELY}},keyTest:e=>!e.altKey&&!e[N.CTRL_OR_CMD]&&e.key===N.H});Z({name:`setEmbeddableAsActiveTool`,trackEvent:{category:`toolbar`},target:`Tool`,label:`toolBar.embeddable`,perform:(e,t,n,r)=>{let i=ka(t,{type:`embeddable`});return Yw(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:ka(t,{type:`embeddable`})},captureUpdate:V.EVENTUALLY}}});var oT=Z({name:`finalize`,label:``,trackEvent:!1,perform:(e,t,n,r)=>{let i=e,{interactiveCanvas:a,focusContainer:o,scene:s}=r,c=s.getNonDeletedElementsMap();if(n&&t.selectedLinearElement){let{event:a,sceneCoords:o}=n,l=I.getElement(t.selectedLinearElement.elementId,c);gt(l,`Arrow element should exist if selectedLinearElement is set`),gt(o,`sceneCoords should be defined if actionFinalize is called with event`);let u=I.handlePointerUp(a,t.selectedLinearElement,t,r.scene);if(ss(l)&&!t.selectedLinearElement.segmentMidPointHoveredCoords){let e=!!t.newElement;Ur(l,(e||!t.selectedLinearElement.selectedPointsIndices?[l.points.length-1]:t.selectedLinearElement.selectedPointsIndices).reduce((e,t)=>(e.set(t,{point:I.pointFromAbsoluteCoords(l,O(o.x-u.pointerOffset.x,o.y-u.pointerOffset.y),c)}),e),new Map)??new Map,o.x-u.pointerOffset.x,o.y-u.pointerOffset.y,s,t,{newArrow:e,altKey:a.altKey,angleLocked:mr(a)})}else ca(l)&&t.selectedLinearElement?.isEditing&&!t.newElement&&!zs(l.points)&&s.mutateElement(l,{polygon:!1});if(u!==t.selectedLinearElement){l&&na(l)&&(i=i.map(e=>e.id===l.id?B(e,{isDeleted:!0}):e));let n=t.activeTool?.locked;return{elements:l.points.length<2||na(l)?e.map(e=>e.id===l.id?B(e,{isDeleted:!0}):e):i,appState:{...t,cursorButton:`up`,selectedLinearElement:n?null:{...u,selectedPointsIndices:null,isEditing:!1,initialState:{...u.initialState,lastClickedPoint:-1},pointerOffset:{x:0,y:0}},selectionElement:null,suggestedBinding:null,newElement:null,multiElement:null},captureUpdate:V.IMMEDIATELY}}}window.document.activeElement instanceof HTMLElement&&o();let l=null;if(t.multiElement)l=t.multiElement;else if(t.newElement?.type===`freedraw`||ss(t.newElement))l=t.newElement;else if(Object.keys(t.selectedElementIds).length===1){let e=c.get(Object.keys(t.selectedElementIds)[0]);e&&(l=e)}if(l){if(t.selectedLinearElement&&t.multiElement&&l.type!==`freedraw`&&t.lastPointerDownWith!==`touch`){let{points:e}=l,{lastCommittedPoint:n}=t.selectedLinearElement;(!n||e[e.length-1]!==n)&&s.mutateElement(l,{points:l.points.slice(0,-1)})}if(l&&na(l)&&(i=i.map(e=>e.id===l?.id?B(e,{isDeleted:!0}):e)),b(l)||Js(l)){if(ra(l.points,t.zoom.value)&&(ca(l)||Js(l))){let e=l.points,t=e[0],n=e.map((n,r)=>r===e.length-1?O(t[0],t[1]):n);ca(l)?s.mutateElement(l,{points:n,polygon:!0}):s.mutateElement(l,{points:n})}ca(l)&&!zs(l.points)&&s.mutateElement(l,{polygon:!1})}}(!t.activeTool.locked&&t.activeTool.type!==`freedraw`||!l)&&Ww(a);let u;u=t.activeTool.type===`eraser`?ka(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):ka(t,{type:r.state.preferredSelectionTool.type});let d=l&&b(l)?new I(l,lr(i)):t.selectedLinearElement;return d&&={...d,isEditing:t.newElement?!1:d.isEditing,initialState:{...d.initialState,lastClickedPoint:-1,origin:null}},{elements:i,appState:{...t,cursorButton:`up`,activeTool:(t.activeTool.locked||t.activeTool.type===`freedraw`)&&l?t.activeTool:u,activeEmbeddable:null,newElement:null,selectionElement:null,multiElement:null,editingTextElement:null,startBoundElement:null,suggestedBinding:null,selectedElementIds:l&&!t.activeTool.locked&&t.activeTool.type!==`freedraw`?{...t.selectedElementIds,[l.id]:!0}:t.selectedElementIds,selectedLinearElement:d},captureUpdate:V.IMMEDIATELY}},keyTest:(e,t)=>e.key===N.ESCAPE&&(t.selectedLinearElement?.isEditing||!t.newElement&&t.multiElement===null)||(e.key===N.ESCAPE||e.key===N.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>(0,W.jsx)(X,{type:`button`,icon:Fb,title:K(`buttons.done`),"aria-label":K(`buttons.done`),onClick:t,visible:e.multiElement!=null,size:n?.size||`medium`,style:{pointerEvents:`all`}})}),sT=({children:e,checked:t,onChange:n,className:r})=>(0,W.jsxs)(`div`,{className:U(`Checkbox`,r,{"is-checked":t}),onClick:e=>{n(!t,e),e.currentTarget.querySelector(`.Checkbox-box`).focus()},children:[(0,W.jsx)(`button`,{type:`button`,className:`Checkbox-box`,role:`checkbox`,"aria-checked":t,children:Eb}),(0,W.jsx)(`div`,{className:`Checkbox-label`,children:e})]}),cT=e=>{let t=e.title||(e.value===R.DARK?K(`buttons.lightMode`):K(`buttons.darkMode`));return(0,W.jsx)(X,{type:`icon`,icon:e.value===R.LIGHT?lT.MOON:lT.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===R.DARK?R.LIGHT:R.DARK),"data-testid":`toggle-dark-mode`})},lT={SUN:(0,W.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,W.jsx)(`path`,{fill:`currentColor`,d:`M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z`})}),MOON:(0,W.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,W.jsx)(`path`,{fill:`currentColor`,d:`M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z`})})},uT=e=>{let{id:t}=oz(),[n,r]=(0,H.useState)(e.value);return(0,W.jsxs)(`div`,{className:`ProjectName`,children:[(0,W.jsx)(`label`,{className:`ProjectName-label`,htmlFor:`filename`,children:`${e.label}:`}),(0,W.jsx)(`input`,{type:`text`,className:`TextInput`,onBlur:t=>{e.ignoreFocus||Ra(t.target);let n=t.target.value;n!==e.value&&e.onChange(n)},onKeyDown:e=>{if(e.key===N.ENTER){if(e.preventDefault(),e.nativeEvent.isComposing||e.keyCode===229)return;e.currentTarget.blur()}},id:`${t}-filename`,value:n,onChange:e=>r(e.target.value)})]})},dT=5e3,fT=Object.assign(({message:e,onClose:t,closable:n=!1,duration:r=dT,style:i})=>{let a=(0,H.useRef)(0),o=r!==1/0,s=(0,H.useCallback)(()=>{o&&(a.current=window.setTimeout(()=>t(),r))},[t,r,o]);return(0,H.useEffect)(()=>{if(o)return s(),()=>clearTimeout(a.current)},[s,e,r,o]),(0,W.jsxs)(`div`,{className:`Toast`,role:`status`,onMouseEnter:o?()=>clearTimeout(a?.current):void 0,onMouseLeave:o?s:void 0,style:i,children:[(0,W.jsx)(`div`,{className:`Toast__message`,children:e}),n&&(0,W.jsx)(X,{icon:nx,"aria-label":`close`,type:`icon`,onClick:t,className:`close`})]})},{ProgressBar:({progress:e})=>(0,W.jsx)(`div`,{className:`Toast__progress-bar`,children:(0,W.jsx)(`div`,{className:`Toast__progress-bar-fill`,style:{width:`${Math.min(5,Math.round(e*100))}%`}})})});`clipboard`in navigator&&`readText`in navigator.clipboard;var pT=`clipboard`in navigator&&`writeText`in navigator.clipboard,mT=`clipboard`in navigator&&`write`in navigator.clipboard&&`ClipboardItem`in window&&`toBlob`in HTMLCanvasElement.prototype,hT=e=>!!([Na.excalidraw,Na.excalidrawClipboard,Na.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),gT=({types:e,files:t})=>{!e&&!t&&console.warn(`createPasteEvent: no types or files provided`);let n=new ClipboardEvent(F.PASTE,{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e)){if(typeof i!=`string`){t||=[],t.push(i);continue}try{if(n.clipboardData?.items.add(i,r),n.clipboardData?.getData(r)!==i)throw Error(`Failed to set "${r}" as clipboardData item`)}catch(e){throw Error(e.message)}}if(t){let e=-1;for(let r of t){e++;try{if(n.clipboardData?.items.add(r),n.clipboardData?.files[e]!==r)throw Error(`Failed to set file "${r.name}" as clipboardData item`)}catch(e){throw Error(e.message)}}}return n},_T=({elements:e,files:t})=>{let n=lr(e),r=new Set(e.filter(e=>L(e))),i=!1,a=e.reduce((e,n)=>(d(n)&&(i=!0,t&&t[n.fileId]&&(e[n.fileId]=t[n.fileId])),e),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let o={type:Na.excalidrawClipboard,elements:e.map(e=>{if(No(e,n)&&!r.has(No(e,n))){let t=qn(e);return jn(t,n,{frameId:null}),t}return e}),files:t?a:void 0};return JSON.stringify(o)},vT=async(e,t,n)=>{let r=_T({elements:e,files:t});await AT({[hs.excalidrawClipboard]:r,[hs.text]:r},n)};function yT(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let e=n.textContent?.trim();e&&t.push({type:`text`,value:e})}else if(n instanceof HTMLImageElement){let e=n.getAttribute(`src`);e&&e.startsWith(`http`)&&t.push({type:`imageUrl`,value:e})}else t=t.concat(yT(n));return t}var bT=e=>{let t=e.value;try{let e=yT(new DOMParser().parseFromString(t,hs.html).body);if(e.length)return{type:`mixedContent`,value:e}}catch(e){console.error(`error in parseHTMLFromPaste: ${e.message}`)}return null},xT=async()=>{let e={},t;try{t=await navigator.clipboard?.read()}catch(t){try{if(navigator.clipboard?.readText){console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);let e=await navigator.clipboard?.readText();if(e)return{[hs.text]:e}}}catch(t){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);else{if(t.name===`DataError`)return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${t.message}`),e;throw t}}throw t}for(let n of t)for(let t of n.types)if(Sn(Ri,t))try{if(t===hs.text||t===hs.html)e[t]=await(await n.getType(t)).text();else if(Ba(t))e[t]=pa(await n.getType(t),t,void 0);else throw new Ct(`Unsupported clipboard type: ${t}`)}catch(e){console.warn(e instanceof Ct?e.message:`Cannot retrieve ${t} from clipboardItem: ${e.message}`)}return Object.keys(e).length===0&&console.warn(`No clipboard data found from clipboard.read().`),e},ST=async(e,t=!1)=>{try{let n=e.findByType(hs.html),r=!t&&n&&bT(n);return r?r.value.every(e=>e.type===`text`)?{type:`text`,value:e.getData(hs.text)??r.value.map(e=>e.value).join(`
|
|
51
|
+
`).trim()}:r:{type:`text`,value:(e.getData(hs.text)||``).trim()}}catch{return{type:`text`,value:``}}},CT=function(e){return this.find(t=>t.type===e)||null},wT=function(e){return this.find(t=>t.type===e)?.value??null},TT=function(){return this.filter(e=>e.kind===`file`)},ET=e=>{let t;t=MT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=new Set;for(let e of Array.from(t||[]))n.has(e.type)||n.add(e.type);return n},DT=async e=>{let t;t=MT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=(await Promise.all(Array.from(t||[]).map(async t=>{if(t.kind===`file`){let e=t.getAsFile();if(e){let n=await ct(t);return e=await z(e),{type:e.type,kind:`file`,file:e,fileHandle:n}}}else if(t.kind===`string`){let{type:n}=t,r;return r=`clipboardData`in e&&e.clipboardData?e.clipboardData?.getData(n):await new Promise(e=>{t.getAsString(t=>e(t))}),{type:n,kind:`string`,value:r}}return null}))).filter(e=>e!=null);return Object.assign(n,{findByType:CT,getData:wT,getFiles:TT})},OT=async(e,t=!1)=>{let n=await ST(e,t);if(n.type===`mixedContent`)return{mixedContent:n.value};try{let e=JSON.parse(n.value),r=e.type===Na.excalidrawClipboardWithAPI;if(hT(e))return{elements:e.elements,files:e.files,text:t?JSON.stringify(e.elements,null,2):void 0,programmaticAPI:r}}catch{}return{text:n.value}},kT=async e=>{try{await navigator.clipboard.write([new ClipboardItem({[hs.png]:e})])}catch(t){if(ge(e))await navigator.clipboard.write([new ClipboardItem({[hs.png]:await e})]);else throw t}},AT=async(e,t)=>{e||=``;let n=Object.entries(typeof e==`string`?{[hs.text]:e}:e);try{if(t){for(let[e,r]of n)if(t.clipboardData?.setData(e,r),t.clipboardData?.getData(e)!==r)throw Error(`Failed to setData on clipboardEvent`);return}}catch(e){console.error(e)}let r=n.find(([e])=>e===hs.text);if(pT&&r)try{await navigator.clipboard.writeText(r[1]);return}catch(e){console.error(e)}if(r&&!jT(r[1]))throw Error(`Error copying to clipboard.`)},jT=e=>{e||=` `;let t=document.documentElement.getAttribute(`dir`)===`rtl`,n=document.createElement(`textarea`);n.style.border=`0`,n.style.padding=`0`,n.style.margin=`0`,n.style.position=`absolute`,n.style[t?`right`:`left`]=`-9999px`;let r=window.pageYOffset||document.documentElement.scrollTop;n.style.top=`${r}px`,n.style.fontSize=`12pt`,n.setAttribute(`readonly`,``),n.value=e,document.body.appendChild(n);let i=!1;try{n.select(),n.setSelectionRange(0,n.value.length),i=document.execCommand(`copy`)}catch(e){console.error(e)}return n.remove(),i},MT=e=>e.type===F.PASTE||e.type===F.COPY||e.type===F.CUT,NT=(e,{selectedElementIds:t},n)=>{e=Cs(e);let r=n&&Ya(e,{selectedElementIds:t}),i=null,a=r?ir(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return r&&(a.length===1&&L(a[0])?(i=a[0],a=fo(e,i)):a.length>1&&(a=ir(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:i,exportedElements:js(a)}},PT=async(e,t,r,i,{exportBackground:a,exportPadding:o=10,viewBackgroundColor:s,name:c=r.name||`Untitled`,fileHandle:l=null,exportingFrame:u=null})=>{if(t.length===0)throw Error(K(`alerts.cannotExportEmptyCanvas`));if(e===`svg`||e===`clipboard-svg`){let n=be(t,{exportBackground:a,exportWithDarkMode:r.exportWithDarkMode,viewBackgroundColor:s,exportPadding:o,exportScale:r.exportScale,exportEmbedScene:r.exportEmbedScene&&e===`svg`},i,{exportingFrame:u});if(e===`svg`)return ti(n.then(e=>new Blob([Mo+e.outerHTML],{type:hs.svg})),{description:`Export to SVG`,name:c,extension:r.exportEmbedScene?`excalidraw.svg`:`svg`,mimeTypes:[Da.svg],fileHandle:l});if(e===`clipboard-svg`){let e=await n.then(e=>e.outerHTML);try{await AT(e)}catch{throw Error(K(`errors.copyToSystemClipboardFailed`))}return}}let d=j(t,r,i,{exportBackground:a,viewBackgroundColor:s,exportPadding:o,exportingFrame:u});if(e===`png`){let e=er(d);return r.exportEmbedScene&&(e=e.then(e=>n(async()=>{let{encodePngMetadata:e}=await import(`./image-32MOCVDX-BBXPyAeU.js`);return{encodePngMetadata:e}},__vite__mapDeps([62,63,2,64,65,1]),import.meta.url).then(({encodePngMetadata:n})=>n({blob:e,metadata:Io(t,r,i,`local`)})))),ti(e,{description:`Export to PNG`,name:c,extension:r.exportEmbedScene?`excalidraw.png`:`png`,mimeTypes:[Da.png],fileHandle:l})}else if(e===`clipboard`)try{await kT(er(d))}catch(e){throw console.warn(e),e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(K(`canvasError.canvasTooBig`)):xt&&e.name===`TypeError`?Error(`${K(`alerts.couldNotCopyToClipboard`)}
|
|
52
52
|
|
|
53
53
|
${K(`hints.firefox_clipboard_write`)}`):Error(K(`alerts.couldNotCopyToClipboard`))}else throw Error(`Unsupported export type`)},FT=async(e,t,n)=>{let r=Mi(t);if(Math.random()<1)throw Error(`OLALALALA`);if(!Ie(r))throw Error(`fileHandle should exist and should be of type svg or png when resaving`);let{elements:i,appState:a,files:o}=await e,{exportBackground:s,viewBackgroundColor:c}=a;a={...a,exportEmbedScene:!0};let{exportedElements:l,exportingFrame:u}=NT(i,a,!1);return await PT(r,l,a,o,{exportBackground:s,viewBackgroundColor:c,name:n,fileHandle:t,exportingFrame:u}),{fileHandle:t}},IT=Z({name:`changeProjectName`,label:`labels.fileTitle`,trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t,appProps:n,data:r,app:i})=>(0,W.jsx)(uT,{label:K(`labels.fileTitle`),value:i.getName(),onChange:e=>t(e),ignoreFocus:r?.ignoreFocus??!1})}),LT=Z({name:`changeExportScale`,label:`imageExportDialog.scale`,trackEvent:{category:`export`,action:`scale`},perform:(e,t,n)=>({appState:{...t,exportScale:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=Cs(e),i=Ya(r,t)?ir(r,t):r;return(0,W.jsx)(W.Fragment,{children:Wi.map(e=>{let[r,a]=Ni(i,10,e),o=`${K(`imageExportDialog.label.scale`)} ${e}x (${r}x${a})`;return(0,W.jsx)(X,{size:`small`,type:`radio`,icon:`${e}x`,name:`export-canvas-scale`,title:o,"aria-label":o,id:`export-canvas-scale`,checked:e===t.exportScale,onChange:()=>n(e)},e)})})}}),RT=Z({name:`changeExportBackground`,label:`imageExportDialog.label.withBackground`,trackEvent:{category:`export`,action:`toggleBackground`},perform:(e,t,n)=>({appState:{...t,exportBackground:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,W.jsx)(sT,{checked:e.exportBackground,onChange:e=>t(e),children:K(`imageExportDialog.label.withBackground`)})}),zT=Z({name:`changeExportEmbedScene`,label:`imageExportDialog.tooltip.embedScene`,trackEvent:{category:`export`,action:`embedScene`},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,W.jsxs)(sT,{checked:e.exportEmbedScene,onChange:e=>t(e),children:[K(`imageExportDialog.label.embedScene`),(0,W.jsx)(Rw,{label:K(`imageExportDialog.tooltip.embedScene`),long:!0,children:(0,W.jsx)(`div`,{className:`excalidraw-tooltip-icon`,children:Rb})})]})}),BT=!1,VT=(e,t)=>{let n=t.message??K(`progressDialog.defaultMessage`);e.setAppState({toast:{message:t.progress==null?n:(0,W.jsxs)(W.Fragment,{children:[n,(0,W.jsx)(fT.ProgressBar,{progress:t.progress})]}),duration:1/0}})};async function HT(e,t){if(t.app.state.isLoading&&(VT(t.app,{progress:null}),await t.app.onStateChange({predicate:e=>!e.isLoading})),typeof e==`object`&&e&&Symbol.asyncIterator in e){for await(let n of e){if(t.signal.aborted){e.return();return}if(n.type===`progress`)VT(t.app,{message:n.message,progress:n.progress??null});else if(n.type===`done`)return}return}e instanceof Promise&&(VT(t.app,{progress:null}),await e)}function UT(e,t,n,r){let i=new AbortController,a=i.signal;return{abortController:i,data:new Promise(async i=>{try{r.props.onExport&&await HT(r.props.onExport(`json`,{elements:e,appState:t,files:n},{signal:a}),{app:r,signal:a})}catch(e){e?.name===`AbortError`?console.warn(`onExport() aborted by host app (signal aborted: ${a.aborted})`):console.error(`Error during props.onExport() handling`,e)}i({elements:e,appState:t,files:r.files})})}}var WT=Z({name:`saveToActiveFile`,label:`buttons.save`,icon:yb,trackEvent:{category:`export`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{if(BT)return!1;BT=!0;let i=t.fileHandle,a=r.getName(),{abortController:o,data:s}=UT(e,t,r.files,r);try{let{fileHandle:e}=ja(i)?await FT(s,i,a):await wr({data:s,filename:a,fileHandle:i});return{captureUpdate:V.NEVER,appState:{fileHandle:e,toast:{message:i&&e?.name?K(`toast.fileSavedToFilename`).replace(`{filename}`,`"${e.name}"`):K(`toast.fileSaved`),duration:1500}}}}catch(e){return o.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:V.NEVER,appState:{toast:null}}}finally{BT=!1}},keyTest:e=>e.key===N.S&&e[N.CTRL_OR_CMD]&&!e.shiftKey}),GT=Z({name:`saveFileToDisk`,label:`exportDialog.disk_title`,icon:yb,viewMode:!0,trackEvent:{category:`export`},perform:async(e,t,n,r)=>{if(BT)return!1;BT=!0;let{abortController:i,data:a}=UT(e,t,r.files,r);try{let{fileHandle:e}=await wr({data:a,filename:r.getName(),fileHandle:null});return{captureUpdate:V.NEVER,appState:{openDialog:null,fileHandle:e,toast:{message:K(`toast.fileSaved`),duration:3e3}}}}catch(e){return i.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:V.NEVER,appState:{toast:null}}}finally{BT=!1}},keyTest:e=>e.key.toLowerCase()===N.S&&e.shiftKey&&e[N.CTRL_OR_CMD],PanelComponent:({updateData:e})=>(0,W.jsx)(X,{type:`button`,icon:kb,title:K(`buttons.saveAs`),"aria-label":K(`buttons.saveAs`),showAriaLabel:iz().formFactor===`phone`,hidden:!no,onClick:()=>e(null),"data-testid":`save-as-button`})}),KT=Z({name:`loadScene`,label:`buttons.load`,trackEvent:{category:`export`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.loadScene&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{try{let{elements:n,appState:r,files:i}=await _s(t,e);return{elements:n,appState:r,files:i,captureUpdate:V.IMMEDIATELY}}catch(n){return n?.name===`AbortError`?(console.warn(n),!1):{elements:e,appState:{...t,errorMessage:n.message},files:r.files,captureUpdate:V.EVENTUALLY}}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.O}),qT=Z({name:`exportWithDarkMode`,label:`imageExportDialog.label.darkMode`,trackEvent:{category:`export`,action:`toggleTheme`},perform:(e,t,n,r)=>(r.sessionExportThemeOverride=n?R.DARK:R.LIGHT,{appState:{...t,exportWithDarkMode:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,W.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`-45px`,marginBottom:`10px`},children:(0,W.jsx)(cT,{value:e.exportWithDarkMode?R.DARK:R.LIGHT,onChange:e=>{t(e===R.DARK)},title:K(`imageExportDialog.label.darkMode`)})})}),JT=`{}`,YT=Z({name:`copyStyles`,label:`labels.copyStyles`,icon:OS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=[],a=e.find(e=>t.selectedElementIds[e.id]);if(i.push(a),a&&xr(a)){let e=ut(a,r.scene.getNonDeletedElementsMap());i.push(e)}return a&&(JT=JSON.stringify(i)),{appState:{...t,toast:{message:K(`toast.copyStyles`)}},captureUpdate:V.EVENTUALLY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.C}),XT=Z({name:`pasteStyles`,label:`labels.pasteStyles`,icon:OS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=JSON.parse(JT),a=i[0],o=i[1];if(!Ee(a))return{elements:e,captureUpdate:V.EVENTUALLY};let s=ir(e,t,{includeBoundTextElement:!0}),c=s.map(e=>e.id);return{elements:e.map(e=>{if(c.includes(e.id)){let t=a;if(M(e)&&e.containerId&&(t=o),!t)return e;let n=B(e,{backgroundColor:t?.backgroundColor,strokeWidth:t?.strokeWidth,strokeColor:t?.strokeColor,strokeStyle:t?.strokeStyle,fillStyle:t?.fillStyle,opacity:t?.opacity,roughness:t?.roughness,roundness:t.roundness?Xr(t.roundness.type,e)?t.roundness:Rn(e):null});if(M(n)){let e=t.fontSize||20,i=t.fontFamily||$r;n=B(n,{fontSize:e,fontFamily:i,textAlign:t.textAlign||`left`,lineHeight:t.lineHeight||ba(i)});let a=null;n.containerId&&(a=s.find(e=>M(n)&&e.id===n.containerId)||null),Zi(n,a,r.scene)}return n.type===`arrow`&&jt(t)&&(n=B(n,{startArrowhead:t.startArrowhead,endArrowhead:t.endArrowhead})),L(e)&&(n=B(n,{roundness:null,backgroundColor:`transparent`})),n}return e}),captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.V}),ZT=Z({name:`toggleShortcuts`,label:`welcomeScreen.defaults.helpHint`,icon:xb,viewMode:!0,trackEvent:{category:`menu`,action:`toggleHelpDialog`},perform:(e,t,n,{focusContainer:r})=>(t.openDialog?.name===`help`&&r(),{appState:{...t,openDialog:t.openDialog?.name===`help`?null:{name:`help`},openMenu:null,openPopup:null},captureUpdate:V.EVENTUALLY}),keyTest:e=>e.key===N.QUESTION_MARK}),QT=e=>{if(e.length>=2){let t=e[0].groupIds;for(let n of t)if(e.reduce((e,t)=>e&&Lo(t,n),!0))return!0}return!1},$T=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return r.length>=2&&!QT(r)&&!Dr(r)},eE=Z({name:`group`,label:`labels.group`,icon:e=>(0,W.jsx)(rx,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=re(r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}));if(i.length<2)return{appState:t,elements:e,captureUpdate:V.EVENTUALLY};let a=po(t);if(a.length===1){let n=a[0],r=new Set(Ki(e,n).map(e=>e.id)),o=new Set(i.map(e=>e.id));if(new Set([...Array.from(r),...Array.from(o)]).size===r.size)return{appState:t,elements:e,captureUpdate:V.EVENTUALLY}}let o=[...e];new Set(i.map(e=>e.frameId)).size>1&&pi(i).forEach((e,t)=>{Pi(e,r.scene.getNonDeletedElementsMap())});let s=Bi(),c=lr(i);o=o.map(e=>c.get(e.id)?B(e,{groupIds:wn(e.groupIds,s,t.editingGroupId)}):e);let l=Ki(o,s),u=l[l.length-1],d=o.lastIndexOf(u),f=o.slice(d+1),p=fe([...o.slice(0,d).filter(e=>!Lo(e,s)),...l,...f],lr(l));return{appState:{...t,...Aa(s,{...t,selectedGroupIds:{}},Cs(o))},elements:p,captureUpdate:V.IMMEDIATELY}},predicate:(e,t,n,r)=>$T(e,t,r),keyTest:e=>!e.shiftKey&&e[N.CTRL_OR_CMD]&&e.key===N.G,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!$T(e,t,r),type:`button`,icon:(0,W.jsx)(rx,{theme:t.theme}),onClick:()=>n(null),title:`${K(`labels.group`)} \u2014 ${Q(`CtrlOrCmd+G`)}`,"aria-label":K(`labels.group`),visible:Ya(Cs(e),t)})}),tE=Z({name:`ungroup`,label:`labels.ungroup`,icon:e=>(0,W.jsx)(ix,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=po(t),a=lr(e);if(i.length===0)return{appState:t,elements:e,captureUpdate:V.EVENTUALLY};let o=[...e],s=[];o=o.map(e=>{ya(e)&&s.push(e.id);let n=Ji(e.groupIds,t.selectedGroupIds);return n.length===e.groupIds.length?e:B(e,{groupIds:n})});let c=Hr(t,Cs(o),t,null),l=r.scene.getSelectedElements(t),u=new Set(l.filter(e=>e.frameId).map(e=>e.frameId));return wi(e).filter(e=>u.has(e.id)).forEach(e=>{e&&(o=Ai(o,kn(o,e,t,a),e,r))}),c.selectedElementIds=Object.entries(c.selectedElementIds).reduce((e,[t,n])=>(n&&!s.includes(t)&&(e[t]=!0),e),{}),{appState:{...t,...c},elements:o,captureUpdate:V.IMMEDIATELY}},keyTest:e=>e.shiftKey&&e[N.CTRL_OR_CMD]&&e.key===N.G.toUpperCase(),predicate:(e,t)=>po(t).length>0,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,W.jsx)(X,{type:`button`,hidden:po(t).length===0,icon:(0,W.jsx)(ix,{theme:t.theme}),onClick:()=>n(null),title:`${K(`labels.ungroup`)} \u2014 ${Q(`CtrlOrCmd+Shift+G`)}`,"aria-label":K(`labels.ungroup`),visible:Ya(Cs(e),t)})}),nE=(e,t,n,r,i,a,o)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill(),o&&(e.strokeStyle=o),e.stroke()};function rE(e){let t=0;if(e.length===0)return t;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r}return t}var iE=(e,t)=>`hsl(${Math.abs(rE(t?.id||e))%37*10}, 100%, 83%)`,aE=e=>{let t=e?.trim()?.codePointAt(0);return(t?String.fromCodePoint(t):`?`).toUpperCase()},oE=({context:e,renderConfig:t,appState:n,normalizedWidth:r,normalizedHeight:i})=>{for(let[a,o]of t.remotePointerViewportCoords){let{x:s,y:c}=o,l=n.collaborators.get(a);s-=n.offsetLeft,c-=n.offsetTop;let u=s<0||s>r-11||c<0||c>i-14;s=Math.max(s,0),s=Math.min(s,r-11),c=Math.max(c,0),c=Math.min(c,i-14);let d=iE(a,l);e.save(),e.strokeStyle=d,e.fillStyle=d;let f=t.remotePointerUserStates.get(a),p=u||f===Ye.IDLE||f===Ye.AWAY;p&&(e.globalAlpha=.3),t.remotePointerButton.get(a)===`down`&&(e.beginPath(),e.arc(s,c,15,0,2*Math.PI,!1),e.lineWidth=3,e.strokeStyle=`#ffffff88`,e.stroke(),e.closePath(),e.beginPath(),e.arc(s,c,15,0,2*Math.PI,!1),e.lineWidth=1,e.strokeStyle=d,e.stroke(),e.closePath());let m=n.theme===R.DARK?`#2f6330`:ao,h=l?.isSpeaking;h&&(e.fillStyle=m,e.strokeStyle=m,e.lineWidth=10,e.lineJoin=`round`,e.beginPath(),e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.stroke(),e.fill()),e.fillStyle=yi,e.strokeStyle=yi,e.lineWidth=6,e.lineJoin=`round`,e.beginPath(),e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.stroke(),e.fill(),e.fillStyle=d,e.strokeStyle=d,e.lineWidth=2,e.lineJoin=`round`,e.beginPath(),p?(e.moveTo(s-1,c-1),e.lineTo(s-1,c+15),e.lineTo(s+5,c+10),e.lineTo(s+12,c+9),e.closePath(),e.fill()):(e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.fill(),e.stroke());let g=t.remotePointerUsernames.get(a)||``;if(!u&&g){e.font=`600 12px sans-serif`;let t=(h?s+0:s)+11/2,n=(h?c+0:c)+14+2,r=e.measureText(g),i=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent,a=Math.max(i,12),o=t-1,l=n-1,u=r.width+2+10+2,f=a+2+6+2;e.roundRect?(e.beginPath(),e.roundRect(o,l,u,f,8),e.fillStyle=d,e.fill(),e.strokeStyle=`#ffffff`,e.stroke(),h&&(e.beginPath(),e.roundRect(o-2,l-2,u+4,f+4,8),e.strokeStyle=m,e.stroke())):nE(e,o,l,u,f,8,`#ffffff`),e.fillStyle=`#1e1e1e`,e.fillText(g,t+5+1,n+3+r.actualBoundingBoxAscent+Math.floor((a-i)/2)+2),h&&(e.fillStyle=m,e.fillRect(o+u+8,l+(f/2-8/2),2,8),e.fillRect(o+u+8+5,l+(f/2-16/2),2,16),e.fillRect(o+u+8+10,l+(f/2-8/2),2,8))}e.restore(),e.closePath()}},sE=({color:e,onClick:t,name:n,src:r,className:i})=>{let a=aE(n),[o,s]=(0,H.useState)(!1),c=!o&&r,l=c?void 0:{background:e};return(0,W.jsx)(`div`,{className:U(`Avatar`,i),style:l,onClick:t,children:c?(0,W.jsx)(`img`,{className:`Avatar-img`,src:r,alt:a,referrerPolicy:`no-referrer`,onError:()=>s(!0)}):a})};Z({name:`goToCollaborator`,label:`Go to a collaborator`,viewMode:!0,trackEvent:{category:`collab`},perform:(e,t,n)=>(gt(n,`actionGoToCollaborator: collaborator should be defined when actionGoToCollaborator is called`),!n.socketId||t.userToFollow?.socketId===n.socketId||n.isCurrentUser?{appState:{...t,userToFollow:null},captureUpdate:V.EVENTUALLY}:{appState:{...t,userToFollow:{socketId:n.socketId,username:n.username||``},openMenu:t.openMenu===`canvas`?null:t.openMenu},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,data:t,appState:n})=>{let{socketId:r,collaborator:i,withName:a,isBeingFollowed:o}=t,s=iE(r,i),c=U({"is-followed":o,"is-current-user":i.isCurrentUser===!0,"is-speaking":i.isSpeaking,"is-in-call":i.isInCall,"is-muted":i.isMuted}),l=i.isInCall?i.isSpeaking?(0,W.jsxs)(`div`,{className:`UserList__collaborator-status-icon-speaking-indicator`,title:K(`userList.hint.isSpeaking`),children:[(0,W.jsx)(`div`,{}),(0,W.jsx)(`div`,{}),(0,W.jsx)(`div`,{})]}):i.isMuted?(0,W.jsx)(`div`,{className:`UserList__collaborator-status-icon-microphone-muted`,title:K(`userList.hint.micMuted`),children:SS}):(0,W.jsx)(`div`,{title:K(`userList.hint.inCall`),children:xS}):null;return a?(0,W.jsxs)(`div`,{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${c}`,style:{"--avatar-size":`1.5rem`},onClick:()=>e(i),children:[(0,W.jsx)(sE,{color:s,onClick:()=>{},name:i.username||``,src:i.avatarUrl,className:c}),(0,W.jsx)(`div`,{className:`UserList__collaborator-name`,children:i.username}),(0,W.jsxs)(`div`,{className:`UserList__collaborator-status-icons`,"aria-hidden":!0,children:[o&&(0,W.jsx)(`div`,{className:`UserList__collaborator-status-icon-is-followed`,title:K(`userList.hint.followStatus`),children:mS}),l]})]}):(0,W.jsxs)(`div`,{className:`UserList__collaborator UserList__collaborator--avatar-only ${c}`,children:[(0,W.jsx)(sE,{color:s,onClick:()=>{e(i)},name:i.username||``,src:i.avatarUrl,className:c}),l&&(0,W.jsx)(`div`,{className:`UserList__collaborator-status-icon`,children:l})]})}});var cE=Z({name:`addToLibrary`,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});for(let e of Le)if(i.some(t=>t.type===e))return{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`errors.libraryElementTypeError.${e}`)}};return r.library.getLatestLibrary().then(e=>r.library.setLibrary([{id:Bi(),status:`unpublished`,elements:i.map(qn),created:Date.now()},...e])).then(()=>({captureUpdate:V.EVENTUALLY,appState:{...t,toast:{message:K(`toast.addedToLibrary`)}}})).catch(e=>({captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:e.message}}))},label:`labels.addToLibrary`}),lE=(e,t)=>{let n=t.scene.getSelectedElements(e);return Xt(n,t.scene.getNonDeletedElementsMap(),e).length>1&&!n.some(e=>L(e))},uE=(e,t,n,r)=>{let i=lr(Xe(n.scene.getSelectedElements(t),r,n.scene,t));return lo(e.map(e=>i.get(e.id)||e),t,n)};Z({name:`alignTop`,label:`labels.alignTop`,icon:Kb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`start`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Kb,onClick:()=>n(null),title:`${K(`labels.alignTop`)} \u2014 ${Q(`CtrlOrCmd+Shift+Up`)}`,"aria-label":K(`labels.alignTop`),visible:Ya(Cs(e),t)})}),Z({name:`alignBottom`,label:`labels.alignBottom`,icon:qb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`end`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:qb,onClick:()=>n(null),title:`${K(`labels.alignBottom`)} \u2014 ${Q(`CtrlOrCmd+Shift+Down`)}`,"aria-label":K(`labels.alignBottom`),visible:Ya(Cs(e),t)})}),Z({name:`alignLeft`,label:`labels.alignLeft`,icon:Jb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`start`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Jb,onClick:()=>n(null),title:`${K(`labels.alignLeft`)} \u2014 ${Q(`CtrlOrCmd+Shift+Left`)}`,"aria-label":K(`labels.alignLeft`),visible:Ya(Cs(e),t)})}),Z({name:`alignRight`,label:`labels.alignRight`,icon:Yb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`end`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Yb,onClick:()=>n(null),title:`${K(`labels.alignRight`)} \u2014 ${Q(`CtrlOrCmd+Shift+Right`)}`,"aria-label":K(`labels.alignRight`),visible:Ya(Cs(e),t)})}),Z({name:`alignVerticallyCentered`,label:`labels.centerVertically`,icon:Qb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`center`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Qb,onClick:()=>n(null),title:K(`labels.centerVertically`),"aria-label":K(`labels.centerVertically`),visible:Ya(Cs(e),t)})}),Z({name:`alignHorizontallyCentered`,label:`labels.centerHorizontally`,icon:$b,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`center`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:$b,onClick:()=>n(null),title:K(`labels.centerHorizontally`),"aria-label":K(`labels.centerHorizontally`),visible:Ya(Cs(e),t)})});var dE=(e,t)=>{let n=t.scene.getSelectedElements(e);return Xt(n,t.scene.getNonDeletedElementsMap(),e).length>2&&!n.some(e=>L(e))},fE=(e,t,n,r)=>{let i=lr(ce(n.scene.getSelectedElements(t),n.scene.getNonDeletedElementsMap(),r,t,n.scene));return lo(e.map(e=>i.get(e.id)||e),t,n)};Z({name:`distributeHorizontally`,label:`labels.distributeHorizontally`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:fE(e,t,r,{space:`between`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.H,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!dE(t,r),type:`button`,icon:Xb,onClick:()=>n(null),title:`${K(`labels.distributeHorizontally`)} \u2014 ${Q(`Alt+H`)}`,"aria-label":K(`labels.distributeHorizontally`),visible:Ya(Cs(e),t)})}),Z({name:`distributeVertically`,label:`labels.distributeVertically`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:fE(e,t,r,{space:`between`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.V,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!dE(t,r),type:`button`,icon:Zb,onClick:()=>n(null),title:`${K(`labels.distributeVertically`)} \u2014 ${Q(`Alt+V`)}`,"aria-label":K(`labels.distributeVertically`),visible:Ya(Cs(e),t)})});var pE=Z({name:`flipHorizontal`,label:`labels.flipHorizontal`,icon:DS,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:lo(hE(e,r.scene.getNonDeletedElementsMap(),t,`horizontal`,r),t,r),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Gs.H}),mE=Z({name:`flipVertical`,label:`labels.flipVertical`,icon:ES,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:lo(hE(e,r.scene.getNonDeletedElementsMap(),t,`vertical`,r),t,r),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Gs.V&&!e[N.CTRL_OR_CMD]}),hE=(e,t,n,r,i)=>{let a=lr(gE(ir(Cs(e),n,{includeBoundTextElement:!0,includeElementsInFrames:!0}),t,r,i));return e.map(e=>a.get(e.id)||e)},gE=(e,t,n,r)=>{if(e.every(e=>jt(e)&&(e.startBinding||e.endBinding)))return e.map(e=>{let t=e;return B(t,{startArrowhead:t.endArrowhead,endArrowhead:t.startArrowhead})});let{midX:i,midY:a}=Pa(e);ds(e,t,`nw`,r.scene,new Map(Array.from(t.values()).map(e=>[e.id,qn(e)])),{flipByX:n===`horizontal`,flipByY:n===`vertical`,shouldResizeFromCenter:!0,shouldMaintainAspectRatio:!0}),Bo(e.filter(jt),r.scene,r.state);let{elbowArrows:o,otherElements:s}=e.reduce((e,t)=>dr(t)?{...e,elbowArrows:e.elbowArrows.concat(t)}:{...e,otherElements:e.otherElements.concat(t)},{elbowArrows:[],otherElements:[]}),{midX:c,midY:l}=Pa(e),[u,d]=[i-c,a-l];return s.forEach(e=>r.scene.mutateElement(e,{x:e.x+u,y:e.y+d})),o.forEach(e=>r.scene.mutateElement(e,{x:e.x+u,y:e.y+d})),e},_E=Z({name:`copy`,label:`labels.copy`,icon:hb,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await vT(i,r.files,n)}catch(e){return{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:e.message}}}return{captureUpdate:V.EVENTUALLY}},keyTest:void 0}),vE=Z({name:`paste`,label:`labels.paste`,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i;try{i=await xT()}catch(e){return e.name===`AbortError`||e.name===`NotAllowedError`?!1:(console.error(`actionPaste ${e.name}: ${e.message}`),xt?{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`hints.firefox_clipboard_write`)}}:{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`errors.asyncPasteFailedOnRead`)}})}try{r.pasteFromClipboard(gT({types:i}))}catch(e){return console.error(e),{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`errors.asyncPasteFailedOnParse`)}}}return{captureUpdate:V.EVENTUALLY}},keyTest:void 0}),yE=Z({name:`cut`,label:`labels.cut`,icon:eS,trackEvent:{category:`element`},perform:(e,t,n,r)=>(_E.perform(e,t,n,r),rC.perform(e,t,null,r)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.X}),bE=Z({name:`copyAsSvg`,label:`labels.copyAsSvg`,icon:AS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:V.EVENTUALLY};let{exportedElements:i,exportingFrame:a}=NT(e,t,!0);try{return await PT(`clipboard-svg`,i,t,r.files,{...t,exportingFrame:a,name:r.getName()}),{appState:{toast:{message:K(`toast.copyToClipboardAsSvg`,{exportSelection:r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).length?K(`toast.selection`):K(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?K(`buttons.darkMode`):K(`buttons.lightMode`)})}},captureUpdate:V.EVENTUALLY}}catch(e){return console.error(e),{appState:{errorMessage:e.message},captureUpdate:V.EVENTUALLY}}},predicate:e=>pT&&e.length>0,keywords:[`svg`,`clipboard`,`copy`]}),xE=Z({name:`copyAsPng`,label:`labels.copyAsPng`,icon:jS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:V.EVENTUALLY};let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:a,exportingFrame:o}=NT(e,t,!0);try{return await PT(`clipboard`,a,t,r.files,{...t,exportingFrame:o,name:r.getName()}),{appState:{...t,toast:{message:K(`toast.copyToClipboardAsPng`,{exportSelection:i.length?K(`toast.selection`):K(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?K(`buttons.darkMode`):K(`buttons.lightMode`)})}},captureUpdate:V.EVENTUALLY}}catch(e){return console.error(e),{appState:{...t,errorMessage:e.message},captureUpdate:V.EVENTUALLY}}},predicate:e=>mT&&e.length>0,keyTest:e=>e.code===Gs.C&&e.altKey&&e.shiftKey,keywords:[`png`,`clipboard`,`copy`]}),SE=Z({name:`copyText`,label:`labels.copyText`,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});try{AT(As(i))}catch{throw Error(K(`errors.copyToSystemClipboardFailed`))}return{captureUpdate:V.EVENTUALLY}},predicate:(e,t,n,r)=>pT&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(M),keywords:[`text`,`clipboard`,`copy`]}),CE=Z({name:`gridMode`,icon:IS,keywords:[`snap`],label:`labels.toggleGrid`,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>e.gridModeEnabled},perform(e,t){return{appState:{...t,gridModeEnabled:!this.checked(t),objectsSnapModeEnabled:!1},captureUpdate:V.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[N.CTRL_OR_CMD]&&e.code===Gs.QUOTE}),wE=Z({name:`zenMode`,label:`buttons.zenMode`,icon:NS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},captureUpdate:V.EVENTUALLY}},checked:e=>e.zenModeEnabled,predicate:(e,t,n,r)=>r.editorInterface.formFactor!==`phone`&&typeof n.zenModeEnabled>`u`,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.Z}),TE=Z({name:`objectsSnapMode`,label:`buttons.objectsSnapMode`,icon:MS,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridModeEnabled:!1},captureUpdate:V.EVENTUALLY}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,n)=>typeof n.objectsSnapModeEnabled>`u`,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.S}),EE=Z({name:`arrowBinding`,label:`labels.arrowBinding`,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>e.bindingPreference===`disabled`},perform(e,t){let n=t.bindingPreference===`enabled`?`disabled`:`enabled`;return{appState:{...t,bindingPreference:n,isBindingEnabled:n===`enabled`},captureUpdate:V.NEVER}},checked:e=>e.bindingPreference===`enabled`}),DE=Z({name:`midpointSnapping`,label:`labels.midpointSnapping`,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>!e.isMidpointSnappingEnabled},perform(e,t){return{appState:{...t,isMidpointSnappingEnabled:!this.checked(t)},captureUpdate:V.NEVER}},checked:e=>e.isMidpointSnappingEnabled}),OE=Z({name:`stats`,label:`stats.fullTitle`,icon:TS,viewMode:!0,trackEvent:{category:`menu`},keywords:[`edit`,`attributes`,`customize`],perform(e,t){return{appState:{...t,stats:{...t.stats,open:!this.checked(t)}},captureUpdate:V.EVENTUALLY}},checked:e=>e.stats.open,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.SLASH}),kE=Z({name:`unbindText`,label:`labels.unbindText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>r.scene.getSelectedElements(t).some(e=>xr(e)),perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=r.scene.getNonDeletedElementsMap();return i.forEach(e=>{let t=ut(e,a);if(t){let{width:n,height:i}=gn(t.originalText,u(t),t.lineHeight),o=f(e.id);$t(e.id);let{x:s,y:c}=ui(e,t,a);r.scene.mutateElement(t,{containerId:null,width:n,height:i,text:t.originalText,x:s,y:c}),r.scene.mutateElement(e,{boundElements:e.boundElements?.filter(e=>e.id!==t.id),height:o||e.height})}}),{elements:e,appState:t,captureUpdate:V.IMMEDIATELY}}}),AE=Z({name:`bindText`,label:`labels.bindText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);if(i.length===2){let e=M(i[0])||M(i[1]),t;if(k(i[0])?t=i[0]:k(i[1])&&(t=i[1]),e&&t&&ut(t,r.scene.getNonDeletedElementsMap())===null)return!0}return!1},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a,o;M(i[0])&&k(i[1])?(a=i[0],o=i[1]):(a=i[1],o=i[0]),r.scene.mutateElement(a,{containerId:o.id,verticalAlign:Lr.MIDDLE,textAlign:Zo.CENTER,autoResize:!0,angle:jt(o)?0:o?.angle??0}),r.scene.mutateElement(o,{boundElements:(o.boundElements||[]).concat({type:`text`,id:a.id})});let s=o.height;return Zi(a,o,r.scene),Cr(o.id,s),{elements:jE(e,o,a),appState:{...t,selectedElementIds:{[o.id]:!0}},captureUpdate:V.IMMEDIATELY}}}),jE=(e,t,n)=>{let r=e.slice(),i=r.findIndex(e=>e.id===n.id);r.splice(i,1);let a=r.findIndex(e=>e.id===t.id);return r.splice(a+1,0,n),fe(r,lr([t,n])),r},ME=(e,t,n)=>{let r=e.slice(),i=r.findIndex(e=>e.id===t.id);r.splice(i,1);let a=r.findIndex(e=>e.id===n.id);return r.splice(a,0,t),fe(r,lr([t,n])),r},NE=Z({name:`wrapTextInContainer`,label:`labels.createContainerFromText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=i.some(e=>M(e)&&!ya(e));return i.length>0&&a},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=e.slice(),o={};for(let e of i)if(M(e)&&!ya(e)){let n=cn({type:`rectangle`,backgroundColor:t.currentItemBackgroundColor,boundElements:[...e.boundElements||[],{id:e.id,type:`text`}],angle:e.angle,fillStyle:t.currentItemFillStyle,strokeColor:t.currentItemStrokeColor,roughness:t.currentItemRoughness,strokeWidth:t.currentItemStrokeWidth,strokeStyle:t.currentItemStrokeStyle,roundness:t.currentItemRoundness===`round`?{type:Ga(`rectangle`)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:e.x-5,y:e.y-5,width:je(e.width,`rectangle`),height:je(e.height,`rectangle`),groupIds:e.groupIds,frameId:e.frameId});if(e.boundElements?.length){let t=e.boundElements.filter(e=>e.type===`arrow`).map(e=>e.id);a.filter(e=>t.includes(e.id)).forEach(t=>{let i=t.startBinding,a=t.endBinding;i?.elementId===e.id&&(i={...i,elementId:n.id}),a?.elementId===e.id&&(a={...a,elementId:n.id}),(i||a)&&r.scene.mutateElement(t,{startBinding:i,endBinding:a})})}r.scene.mutateElement(e,{containerId:n.id,verticalAlign:Lr.MIDDLE,boundElements:null,textAlign:Zo.CENTER,autoResize:!0}),Zi(e,n,r.scene),a=ME([...a,n],n,e),o[n.id]=!0}return{elements:a,appState:{...t,selectedElementIds:o},captureUpdate:V.IMMEDIATELY}}}),PE=380,FE=42,IE=5,LE=85,RE=500,zE=!1,BE=new Map,VE=({element:e,scene:t,setAppState:n,onLinkOpen:r,setToast:i,updateEmbedValidationStatus:a})=>{let o=t.getNonDeletedElementsMap(),s=cz(),c=rz(),l=iz(),u=e.link||``,[d,f]=(0,H.useState)(u),m=(0,H.useRef)(null),h=s.showHyperlinkPopup===`editor`,g=(0,H.useCallback)(()=>{if(!m.current)return;let r=Hs(m.current.value)||null;if(!e.link&&r&&dC(`hyperlink`,`create`),rs(e)){if(s.activeEmbeddable?.element===e&&n({activeEmbeddable:null}),!r){t.mutateElement(e,{link:null}),a(e,!1);return}if(!Lt(r,c.validateEmbeddable))r&&i({message:K(`toast.unableToEmbed`),closable:!0}),e.link&&BE.set(e.id,e.link),t.mutateElement(e,{link:r}),a(e,!1);else{let{width:n,height:o}=e,s=qs(r);s?.error instanceof URIError&&i({message:K(`toast.unrecognizedLinkFormat`),closable:!0});let c=s?s.intrinsicSize.w/s.intrinsicSize.h:1,l=BE.get(e.id)!==e.link;t.mutateElement(e,{...l?{width:s?.type===`video`?n>o?n:o*c:n,height:s?.type===`video`&&n>o?n/c:o}:{},link:r}),a(e,!0),BE.has(e.id)&&BE.delete(e.id)}}else t.mutateElement(e,{link:r})},[e,t,i,c.validateEmbeddable,s.activeEmbeddable,n,a]);(0,H.useLayoutEffect)(()=>()=>{g()},[g]),(0,H.useEffect)(()=>{h&&m?.current&&!(l.formFactor===`phone`||l.isTouchScreen)&&m.current.select()},[h,l.formFactor,l.isTouchScreen]),(0,H.useEffect)(()=>{let t=null,r=r=>{h||(t&&clearTimeout(t),JE(e,o,s,O(r.clientX,r.clientY))&&(t=window.setTimeout(()=>{n({showHyperlinkPopup:!1})},RE)))};return window.addEventListener(F.POINTER_MOVE,r,!1),()=>{window.removeEventListener(F.POINTER_MOVE,r,!1),t&&clearTimeout(t)}},[s,e,h,n,o]);let _=(0,H.useCallback)(()=>{dC(`hyperlink`,`delete`),t.mutateElement(e,{link:null}),n({showHyperlinkPopup:!1})},[n,e,t]),v=()=>{dC(`hyperlink`,`edit`,`popup-ui`),n({showHyperlinkPopup:`editor`})},{x:y,y:b}=HE(e,s,o);return s.contextMenu||s.selectedElementsAreBeingDragged||s.resizingElement||s.isRotating||s.openMenu||s.viewModeEnabled?null:(0,W.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer`,style:{top:`${b}px`,left:`${y}px`,width:PE,padding:IE},children:[h?(0,W.jsx)(`input`,{className:U(`excalidraw-hyperlinkContainer-input`),placeholder:K(`labels.link.hint`),ref:m,value:d,onChange:e=>f(e.target.value),autoFocus:!0,onKeyDown:e=>{e.stopPropagation(),e[N.CTRL_OR_CMD]&&e.key===N.K&&e.preventDefault(),(e.key===N.ENTER||e.key===N.ESCAPE)&&(g(),n({showHyperlinkPopup:`info`}))}}):e.link?(0,W.jsx)(`a`,{href:Hs(e.link||``),className:`excalidraw-hyperlinkContainer-link`,target:p(e.link)?`_self`:`_blank`,onClick:t=>{if(e.link&&r){let n=Fi(F.EXCALIDRAW_LINK,t.nativeEvent);r({...e,link:Hs(e.link)},n),n.defaultPrevented&&t.preventDefault()}},rel:`noopener noreferrer`,children:e.link}):(0,W.jsx)(`div`,{className:`excalidraw-hyperlinkContainer-link`,children:K(`labels.link.empty`)}),(0,W.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer__buttons`,children:[!h&&(0,W.jsx)(X,{type:`button`,title:K(`buttons.edit`),"aria-label":K(`buttons.edit`),label:K(`buttons.edit`),onClick:v,className:`excalidraw-hyperlinkContainer--edit`,icon:ab}),(0,W.jsx)(X,{type:`button`,title:K(`labels.linkToElement`),"aria-label":K(`labels.linkToElement`),label:K(`labels.linkToElement`),onClick:()=>{n({openDialog:{name:`elementLinkSelector`,sourceElementId:e.id}})},icon:GS}),u&&!rs(e)&&(0,W.jsx)(X,{type:`button`,title:K(`buttons.remove`),"aria-label":K(`buttons.remove`),label:K(`buttons.remove`),onClick:_,className:`excalidraw-hyperlinkContainer--remove`,icon:pb})]})]})},HE=(e,t,n)=>{let[r,i]=ei(e,n),{x:a,y:o}=Ci({sceneX:r+e.width/2,sceneY:i},t);return{x:a-t.offsetLeft-PE/2,y:o-t.offsetTop-LE}},UE=(e,t)=>{let n=ir(e,t);return rs(n[0])?`labels.link.editEmbed`:n[0]?.link?`labels.link.edit`:`labels.link.create`},WE=null,GE=(e,t,n)=>{WE&&clearTimeout(WE),WE=window.setTimeout(()=>KE(e,t,n),300)},KE=(e,t,n)=>{if(!e.link)return;let r=Fw();r.classList.add(`excalidraw-tooltip--visible`),r.style.maxWidth=`20rem`,r.textContent=Bn(e.link)?K(`labels.link.goToElement`):e.link;let[i,a,o,s]=ei(e,n),[c,l,u,d]=ro([i,a,o,s],e.angle,t),f=Ci({sceneX:c,sceneY:l},t);Iw(r,{left:f.x,top:f.y,width:u,height:d},`top`),dC(`hyperlink`,`tooltip`,`link-icon`),zE=!0},qE=()=>{WE&&clearTimeout(WE),zE&&(zE=!1,Fw().classList.remove(`excalidraw-tooltip--visible`))},JE=(e,t,n,[r,i])=>{let{x:a,y:o}=la({clientX:r,clientY:i},n),s=15/n.zoom.value;if(Re(O(a,o),e,t))return!1;let[c,l,u]=ei(e,t);if(a>=c&&a<=u&&o>=l-LE&&o<=l)return!1;let{x:d,y:f}=HE(e,n,t);return!(r>=d-s&&r<=d+PE+IE*2+s&&i>=f-s&&i<=f+s+IE*2+FE)},YE=Z({name:`hyperlink`,label:(e,t)=>UE(e,t),icon:Db,perform:(e,t)=>t.showHyperlinkPopup===`editor`?!1:{elements:e,appState:{...t,showHyperlinkPopup:`editor`,openMenu:null},captureUpdate:V.IMMEDIATELY},trackEvent:{category:`hyperlink`,action:`click`},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.K,predicate:(e,t)=>ir(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=ir(e,t);return(0,W.jsx)(X,{type:`button`,icon:Db,"aria-label":K(UE(e,t)),title:`${rs(e[0])?K(`labels.link.labelEmbed`):K(`labels.link.label`)} - ${Q(`CtrlOrCmd+K`)}`,onClick:()=>n(null),selected:r.length===1&&!!r[0].link})}}),XE=e=>e.every(e=>!e.locked),ZE=Z({name:`toggleElementLock`,label:(e,t,n)=>XE(n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}))?`labels.elementLock.lock`:`labels.elementLock.unlock`,icon:(e,t)=>XE(ir(t,e))?Ky:Gy,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return i.length>0&&!i.some(e=>e.locked&&e.frameId)},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});if(!i.length)return!1;let a=XE(i),o=lr(i),s=i.length>1&&Co(i),c=i.length===1||s?null:Bi(),l={...t.lockedMultiSelections};if(a)l={...t.lockedMultiSelections,...c?{[c]:!0}:{}};else if(s){let e=i[0].groupIds.at(-1);delete l[e]}let u=e.map(e=>{if(!o.has(e.id))return e;let n=e.groupIds;return a?c&&(n=[...n,c]):n=n.filter(e=>!t.lockedMultiSelections[e]),B(e,{locked:a,groupIds:n.length===e.groupIds.length?e.groupIds:n})}),d=lr(u),f=a?{}:Object.fromEntries(i.map(e=>[e.id,!0])),p=i.map(e=>d.get(e.id)||e),m=a?{}:Kt(p,t),h=a?c||(s?i[0].groupIds.at(-1):i[0].id):null;return{elements:u,appState:{...t,selectedElementIds:f,selectedGroupIds:m,selectedLinearElement:a?null:t.selectedLinearElement,lockedMultiSelections:l,activeLockedId:h},captureUpdate:V.IMMEDIATELY}},keyTest:(e,t,n,r)=>e.key.toLocaleLowerCase()===N.L&&e[N.CTRL_OR_CMD]&&e.shiftKey&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),QE=Z({name:`unlockAllElements`,trackEvent:{category:`canvas`},viewMode:!1,icon:Gy,predicate:(e,t)=>ir(e,t).length===0&&e.some(e=>e.locked),perform:(e,t)=>{let n=e.filter(e=>e.locked),r=e.map(e=>{if(e.locked){let n=e.groupIds.filter(e=>!t.lockedMultiSelections[e]);return B(e,{locked:!1,groupIds:e.groupIds.length===n.length?e.groupIds:n})}return e}),i=lr(r),a=n.map(e=>i.get(e.id)||e);return{elements:r,appState:{...t,selectedElementIds:Object.fromEntries(n.map(e=>[e.id,!0])),selectedGroupIds:Kt(a,t),lockedMultiSelections:{},activeLockedId:null},captureUpdate:V.IMMEDIATELY}},label:`labels.elementLock.unlockAll`}),$E=8,eD=10,tD=[`rectangle`,`diamond`,`ellipse`],nD=[`line`,`sharpArrow`,`curvedArrow`,`elbowArrow`],rD=new Set(tD),iD=new Set(nD),aD=e=>rD.has(e),oD=e=>e===`arrow`||iD.has(e),sD=yc(null),cD=new Map,lD=new Map,uD=({app:e})=>{let t=e.scene.getSelectedElements(e.state),n=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(t.length===0){e.updateEditorAtom(sD,null);return}let r=mD(t);r&&!n.current?n.current=r:(n.current&&!r||n.current&&r!==n.current)&&(e.updateEditorAtom(sD,null),n.current=null)},[t,e]),(0,H.useEffect)(()=>()=>{cD.clear(),lD.clear()},[]),(0,W.jsx)(dD,{app:e,elements:t})},dD=({app:e,elements:t})=>{let n=mD(t),r=(0,H.useMemo)(()=>n===`generic`?_D(t):[],[n,t]),i=(0,H.useMemo)(()=>n===`linear`?vD(t):[],[n,t]),a=n===`generic`?r.every(e=>e.type===r[0].type):n===`linear`?i.every(e=>st(e)===st(i[0])):!1,[o,s]=(0,H.useState)({x:0,y:0}),c=(0,H.useRef)(``),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{let t=[...r,...i].sort((e,t)=>e.id.localeCompare(t.id)),n=`
|
|
54
54
|
${e.state.scrollX}${e.state.scrollY}${e.state.offsetTop}${e.state.offsetLeft}${e.state.zoom.value}${t.map(e=>e.id).join(`,`)}`;if(n===c.current)return;c.current=n;let a;if(t.length===1){let[n,,,r,i,o]=ei(t[0],e.scene.getNonDeletedElementsMap());a=ke(O(n,r),O(i,o),t[0].angle)}else{let{minX:e,maxY:n}=Pa(t);a=O(e,n)}let{x:o,y:l}=Ci({sceneX:a[0],sceneY:a[1]},e.state);s({x:o,y:l})},[r,i,e.scene,e.state]),(0,H.useEffect)(()=>{for(let e of i){let t=gD(e.id,DD(e));lD.has(t)||lD.set(t,e)}},[i]),(0,H.useEffect)(()=>{for(let t of r)if(!cD.has(t.id)){let n=ut(t,e.scene.getNonDeletedElementsMap());n&&cD.set(t.id,{fontSize:n.fontSize})}},[r,e.scene]);let u=n===`linear`?[[`line`,rb],[`sharpArrow`,RS],[`curvedArrow`,BS],[`elbowArrow`,zS]]:n===`generic`?[[`rectangle`,$y],[`diamond`,eb],[`ellipse`,tb]]:[];return(0,W.jsx)(`div`,{ref:l,tabIndex:-1,style:{position:`absolute`,top:`${o.y+(eD+8)*e.state.zoom.value-e.state.offsetTop}px`,left:`${o.x-e.state.offsetLeft-$E}px`,zIndex:2},className:Qn.CONVERT_ELEMENT_TYPE_POPUP,children:u.map(([o,s])=>(0,W.jsx)(X,{className:`Shape`,type:`radio`,icon:s,checked:a&&(n===`generic`&&r[0].type===o||n===`linear`&&st(i[0])===o),name:`convertElementType-option`,title:o,keyBindingLabel:``,"aria-label":o,"data-testid":`toolbar-${o}`,onChange:()=>{e.state.activeTool.type!==o&&dC(`convertElementType`,o,`ui`),pD(e,{conversionType:n,nextType:o}),l.current?.focus()}},`${t[0].id}${t[0].version}_${o}`))})},fD=(e,t,n)=>{let r=Ne(e,t),i=_e(e,t),a=gn(Jt(t.text,u(t),r),u(t),t.lineHeight),o=t.fontSize;for(;(a.width>r||a.height>i)&&o>0;){--o;let e={...t,fontSize:o};a=gn(t.text,u(e),t.lineHeight)}jn(t,n.getNonDeletedElementsMap(),{fontSize:o,width:a.width,height:a.height}),Zi(t,e,n)},pD=(e,{conversionType:t,nextType:n,direction:r=`right`})=>{if(!t)return!1;let i=e.scene.getSelectedElements(e.state),a=i.reduce((e,t)=>({...e,[t.id]:!0}),{}),o=r===`right`?1:-1;if(t===`generic`){let t=_D(i),r=t.every(e=>e.type===t[0].type)?tD.indexOf(t[0].type):-1;if(n??=tD[(r+tD.length+o)%tD.length],n&&aD(n)){let r={};for(let i of t){let t=TD(i,n,e);r[t.id]=t}let i=[];for(let t of e.scene.getElementsIncludingDeleted())r[t.id]?i.push(r[t.id]):i.push(t);e.scene.replaceAllElements(i);for(let t of Object.values(r)){let n=ut(t,e.scene.getNonDeletedElementsMap());n&&(cD.get(t.id)&&jn(n,e.scene.getNonDeletedElementsMap(),{fontSize:cD.get(t.id)?.fontSize??n.fontSize}),fD(t,n,e.scene))}e.setState(e=>({selectedElementIds:a,activeTool:ka(e,{type:`selection`})}))}}if(t===`linear`){let t=vD(i);if(!n){let e=it(t,st);n=nD[((e?nD.indexOf(e):-1)+nD.length+o)%nD.length]}if(oD(n)){let r=[],i=e.scene.getElementsMapIncludingDeleted();for(let a of t){let t=lD.get(gD(a.id,n));if(t&&st(t)===n)i.set(t.id,t),r.push(t);else{let t=TD(a,n,e);i.set(t.id,t),r.push(t)}}e.scene.replaceAllElements(i);for(let t of r)if(b(t))if(dr(t)){let n=CD(t);if(n.length<2)continue;let r=[];for(let e=1;e<n.length-2;e++)r.push({start:n[e],end:n[e+1],index:e+1});let i=fi(t,e.scene.getNonDeletedElementsMap(),{points:n,fixedSegments:r});jn(t,e.scene.getNonDeletedElementsMap(),{...i,endArrowhead:`arrow`})}else{let n=le([`line`,`sharpArrow`,`curvedArrow`],e=>lD.get(gD(t.id,e)));if(n){let r=n.points;e.scene.mutateElement(t,{points:r})}}}let r=vD(e.scene.getSelectedElements(e.state));e.setState(t=>({selectedElementIds:a,selectedLinearElement:r.length===1?new I(r[0],e.scene.getNonDeletedElementsMap()):null,activeTool:ka(t,{type:`selection`})}))}return!0},mD=e=>{if(e.length===0)return null;let t=!1;for(let n of e){if(aD(n.type))return`generic`;hD(n)&&(t=!0)}return t?`linear`:null},hD=e=>b(e)&&(!jt(e)||!Yi(e)&&!xr(e)),gD=(e,t)=>`${e}:${t}`,_D=e=>e.filter(e=>aD(e.type)),vD=e=>e.filter(e=>hD(e)),yD=20,bD=(e,t)=>e[0]===t[0],xD=(e,t)=>e[1]===t[1],SD=(e,t)=>bD(e,t)?Math.abs(e[1]-t[1]):Math.abs(e[0]-t[0]),CD=e=>{let t=[e.points[0]],n=wD(e.points);for(let e=1;e<n.length;++e){let r=t[t.length-1],i=[...n[e]];Math.abs(i[0]-r[0])<yD?i[0]=r[0]:Math.abs(i[1]-r[1])<yD&&(i[1]=r[1]),bD(r,i)||xD(r,i)||t.push(O(r[0],i[1])),t.push(i)}let r=[t[0]];for(let e=1;e<t.length-1;++e)bD(t[e-1],t[e])&&bD(t[e],t[e+1])||xD(t[e-1],t[e])&&xD(t[e],t[e+1])||r.push(t[e]);r.push(t[t.length-1]);let i=[r[0]];for(let e=1;e<r.length-1;++e){let t=i[i.length-1],n=r[e],a=r[e+1],o=bD(t,n),s=bD(n,a);if(o!==s){let e=SD(t,n),r=SD(n,a);if(e<yD||r<yD){if(r<e)o?a[0]=t[0]:a[1]=t[1];else if(s)for(let e=i.length-1;e>=0&&i[e][0]===t[0];--e)i[e][0]=n[0];else for(let e=i.length-1;e>=0&&i[e][1]===t[1];--e)i[e][1]=n[1];continue}}i.push(n)}return i.push(r[r.length-1]),i},wD=e=>{if(e.length===0)return[];let t=[e[0]];for(let n=1;n<e.length;n++){let[r,i]=t[t.length-1],[a,o]=e[n];(r!==a||i!==o)&&t.push(e[n])}return t},TD=(e,t,n)=>{if(!ED(e.type,t)){if(!co())throw Error(`Invalid conversion from ${e.type} to ${t}.`);return e}if(e.type===t)return e;if(bn.delete(e),aD(t)){let r=qa(cn({...e,type:t,roundness:t===`diamond`&&e.roundness?{type:Ga(t)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:e.roundness}));return Xn(r,n.scene,n.state),r}if(oD(t))switch(t){case`line`:return qa(Tn({...e,type:`line`}));case`sharpArrow`:return qa(or({...e,type:`arrow`,elbowed:!1,roundness:null,startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`curvedArrow`:return qa(or({...e,type:`arrow`,elbowed:!1,roundness:{type:Xa.PROPORTIONAL_RADIUS},startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`elbowArrow`:return qa(or({...e,type:`arrow`,elbowed:!0,fixedSegments:null,roundness:null}))}return Ro(t,`unhandled conversion type: ${t}`),e},ED=(e,t)=>!!(aD(e)&&aD(t)||oD(e)&&oD(t)),DD=e=>b(e)?st(e):e.type,OD=uD,kD=Z({name:`toggleShapeSwitch`,label:`labels.shapeSwitch`,icon:()=>null,viewMode:!0,trackEvent:{category:`shape_switch`,action:`toggle`},keywords:[`change`,`switch`,`swap`],perform(e,t,n,r){return Cy.set(sD,{type:`panel`}),{captureUpdate:V.NEVER}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>mD(e)!==null}),AD=Z({name:`copyElementLink`,label:`labels.copyElementLink`,icon:$x,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=ir(e,t);try{if(window.location){let n=Fa(i,t);return n?(await AT(r.props.generateLinkForSelection?r.props.generateLinkForSelection(n.id,n.type):_a(n.id,n.type)),{appState:{toast:{message:K(`toast.elementLinkCopied`),closable:!0}},captureUpdate:V.EVENTUALLY}):{appState:t,elements:e,app:r,captureUpdate:V.EVENTUALLY}}}catch(e){console.error(e)}return{appState:t,elements:e,app:r,captureUpdate:V.EVENTUALLY}},predicate:(e,t)=>vi(ir(e,t))}),jD=Z({name:`linkToElement`,label:`labels.linkToElement`,icon:GS,perform:(e,t,n,r)=>{let i=ir(e,t);return i.length!==1||!vi(i)?{elements:e,appState:t,app:r,captureUpdate:V.EVENTUALLY}:{appState:{...t,openDialog:{name:`elementLinkSelector`,sourceElementId:ir(e,t)[0].id}},captureUpdate:V.IMMEDIATELY}},predicate:(e,t,n,r)=>{let i=ir(e,t);return t.openDialog?.name!==`elementLinkSelector`&&i.length===1&&vi(i)},trackEvent:!1}),MD={toggleTheme:[Q(`Shift+Alt+D`)],saveScene:[Q(`CtrlOrCmd+S`)],loadScene:[Q(`CtrlOrCmd+O`)],clearCanvas:[Q(`CtrlOrCmd+Delete`)],imageExport:[Q(`CtrlOrCmd+Shift+E`)],commandPalette:[Q(`CtrlOrCmd+/`),Q(`CtrlOrCmd+Shift+P`)],cut:[Q(`CtrlOrCmd+X`)],copy:[Q(`CtrlOrCmd+C`)],paste:[Q(`CtrlOrCmd+V`)],copyStyles:[Q(`CtrlOrCmd+Alt+C`)],pasteStyles:[Q(`CtrlOrCmd+Alt+V`)],selectAll:[Q(`CtrlOrCmd+A`)],deleteSelectedElements:[Q(`Delete`)],duplicateSelection:[Q(`CtrlOrCmd+D`),Q(`Alt+${K(`helpDialog.drag`)}`)],sendBackward:[Q(`CtrlOrCmd+[`)],bringForward:[Q(`CtrlOrCmd+]`)],sendToBack:[Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)],bringToFront:[Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)],copyAsPng:[Q(`Shift+Alt+C`)],group:[Q(`CtrlOrCmd+G`)],ungroup:[Q(`CtrlOrCmd+Shift+G`)],gridMode:[Q(`CtrlOrCmd+'`)],zenMode:[Q(`Alt+Z`)],objectsSnapMode:[Q(`Alt+S`)],stats:[Q(`Alt+/`)],addToLibrary:[],flipHorizontal:[Q(`Shift+H`)],flipVertical:[Q(`Shift+V`)],viewMode:[Q(`Alt+R`)],hyperlink:[Q(`CtrlOrCmd+K`)],toggleElementLock:[Q(`CtrlOrCmd+Shift+L`)],resetZoom:[Q(`CtrlOrCmd+0`)],zoomOut:[Q(`CtrlOrCmd+-`)],zoomIn:[Q(`CtrlOrCmd++`)],zoomToFitSelection:[Q(`Shift+3`)],zoomToFit:[Q(`Shift+1`)],zoomToFitSelectionInViewport:[Q(`Shift+2`)],toggleEraserTool:[Q(`E`)],toggleHandTool:[Q(`H`)],setFrameAsActiveTool:[Q(`F`)],saveFileToDisk:[Q(`CtrlOrCmd+S`)],saveToActiveFile:[Q(`CtrlOrCmd+S`)],toggleShortcuts:[Q(`?`)],searchMenu:[Q(`CtrlOrCmd+F`)],wrapSelectionInFrame:[],toolLock:[Q(`Q`)]},ND=(e,t=0)=>{let n=MD[e];return n&&n.length>0?n[t]||n[0]:``},PD=RegExp(`[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]`,`g`),FD=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ID={À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,Ç:`C`,ç:`c`,Ð:`D`,ð:`d`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,è:`e`,é:`e`,ê:`e`,ë:`e`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,ì:`i`,í:`i`,î:`i`,ï:`i`,Ñ:`N`,ñ:`n`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,ù:`u`,ú:`u`,û:`u`,ü:`u`,Ý:`Y`,ý:`y`,ÿ:`y`,Æ:`E`,æ:`e`,Þ:`T`,þ:`t`,ß:`s`,Ā:`A`,Ă:`A`,Ą:`A`,ā:`a`,ă:`a`,ą:`a`,Ć:`C`,Ĉ:`C`,Ċ:`C`,Č:`C`,ć:`c`,ĉ:`c`,ċ:`c`,č:`c`,Ď:`D`,Đ:`D`,ď:`d`,đ:`d`,Ē:`E`,Ĕ:`E`,Ė:`E`,Ę:`E`,Ě:`E`,ē:`e`,ĕ:`e`,ė:`e`,ę:`e`,ě:`e`,Ĝ:`G`,Ğ:`G`,Ġ:`G`,Ģ:`G`,ĝ:`g`,ğ:`g`,ġ:`g`,ģ:`g`,Ĥ:`H`,Ħ:`H`,ĥ:`h`,ħ:`h`,Ĩ:`I`,Ī:`I`,Ĭ:`I`,Į:`I`,İ:`I`,ĩ:`i`,ī:`i`,ĭ:`i`,į:`i`,ı:`i`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,ĸ:`k`,Ĺ:`L`,Ļ:`L`,Ľ:`L`,Ŀ:`L`,Ł:`L`,ĺ:`l`,ļ:`l`,ľ:`l`,ŀ:`l`,ł:`l`,Ń:`N`,Ņ:`N`,Ň:`N`,Ŋ:`N`,ń:`n`,ņ:`n`,ň:`n`,ŋ:`n`,Ō:`O`,Ŏ:`O`,Ő:`O`,ō:`o`,ŏ:`o`,ő:`o`,Ŕ:`R`,Ŗ:`R`,Ř:`R`,ŕ:`r`,ŗ:`r`,ř:`r`,Ś:`S`,Ŝ:`S`,Ş:`S`,Š:`S`,ś:`s`,ŝ:`s`,ş:`s`,š:`s`,Ţ:`T`,Ť:`T`,Ŧ:`T`,ţ:`t`,ť:`t`,ŧ:`t`,Ũ:`U`,Ū:`U`,Ŭ:`U`,Ů:`U`,Ű:`U`,Ų:`U`,ũ:`u`,ū:`u`,ŭ:`u`,ů:`u`,ű:`u`,ų:`u`,Ŵ:`W`,ŵ:`w`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Ź:`Z`,Ż:`Z`,Ž:`Z`,ź:`z`,ż:`z`,ž:`z`,IJ:`I`,ij:`i`,Œ:`E`,œ:`e`,ʼn:`n`,ſ:`s`},LD=e=>e.replace(FD,e=>ID[e]||e).replace(PD,``),RD=()=>{let[e,t]=(0,H.useState)(null);return[e,(0,H.useCallback)(e=>t(e),[])]},zD=({elements:e,appState:t,files:n,maxWidthOrHeight:r,getDimensions:i,exportPadding:a,exportingFrame:o})=>{let s=Sa(e,null,{deleteInvisibleElements:!0}),c=gr(t,null),{exportBackground:l,viewBackgroundColor:u}=c;return j(s,{...c,offsetTop:0,offsetLeft:0,width:0,height:0},n||{},{exportBackground:l,exportPadding:a,viewBackgroundColor:u,exportingFrame:o},(e,n)=>{let a=document.createElement(`canvas`);if(r){typeof i==`function`&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");let o=Math.max(e,n),s=r<o?r/o:t?.exportScale??1;return a.width=e*s,a.height=n*s,{canvas:a,scale:s}}let o=i?.(e,n)||{width:e,height:n};return a.width=o.width,a.height=o.height,{canvas:a,scale:o.scale??1}})},BD=async({elements:e,appState:t=cs(),files:n={},exportPadding:r,renderEmbeddables:i,exportingFrame:a,skipInliningFonts:o,reuseImages:s})=>be(Sa(e,null,{deleteInvisibleElements:!0}),{...gr(t,null),exportPadding:r},n,{exportingFrame:a,renderEmbeddables:i,skipInliningFonts:o,reuseImages:s}),VD=yc(new Map),HD=async e=>await BD({elements:e,appState:{exportBackground:!1,viewBackgroundColor:hi.white},files:null,renderEmbeddables:!1,skipInliningFonts:!0}),UD=(e,t,n,r)=>{let[i,a]=(0,H.useState)();return(0,H.useEffect)(()=>{if(t)if(e){let r=n.get(e);r?a(r):(async()=>{let r=await HD(t);r.querySelector(`.style-fonts`)?.remove(),r&&(n.set(e,r),a(r))})()}else (async()=>{a(await HD(t))})()},[e,t,n,a]),(0,H.useEffect)(()=>{let e=r.current;if(e)return i&&(e.innerHTML=i.outerHTML),()=>{e.innerHTML=``}},[i,r]),i},WD=()=>{let[e]=vy(VD);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:t=>{t.forEach(t=>e.delete(t))},svgCache:e}},GD=new Be,KD=yc({status:`loaded`,isInitialized:!1,libraryItems:[]}),qD=e=>js(e),JD=(e,t)=>!e.find(e=>e.elements.length===t.elements.length?e.elements.every((e,n)=>e.id===t.elements[n].id&&e.versionNonce===t.elements[n].versionNonce):!1),YD=(e,t)=>{let n=[];for(let r of t)JD(e,r)&&n.push(r);return[...n,...e]},XD=(e,t)=>{let n=lr(t),r={deletedItems:new Map,addedItems:new Map,updatedItems:new Map};for(let t of e)n.has(t.id)||r.deletedItems.set(t.id,t);let i=lr(e);for(let e of t){let t=i.get(e.id);t?eO(t)!==eO(e)&&r.updatedItems.set(e.id,e):r.addedItems.set(e.id,e)}return r},ZD=class{constructor(e){i(this,`currLibraryItems`,[]),i(this,`prevLibraryItems`,qD(this.currLibraryItems)),i(this,`app`),i(this,`updateQueue`,[]),i(this,`getLastUpdateTask`,()=>this.updateQueue[this.updateQueue.length-1]),i(this,`notifyListeners`,()=>{if(this.updateQueue.length>0)Cy.set(KD,e=>({status:`loading`,libraryItems:this.currLibraryItems,isInitialized:e.isInitialized}));else{Cy.set(KD,{status:`loaded`,libraryItems:this.currLibraryItems,isInitialized:!0});try{let e=this.prevLibraryItems;this.prevLibraryItems=qD(this.currLibraryItems);let t=qD(this.currLibraryItems);this.app.props.onLibraryChange?.(t),GD.trigger(XD(e,t),t)}catch(e){console.error(e)}}}),i(this,`destroy`,()=>{this.updateQueue=[],this.currLibraryItems=[],Cy.set(VD,new Map)}),i(this,`resetLibrary`,()=>this.setLibrary([])),i(this,`getLatestLibrary`,()=>new Promise(async e=>{try{let t=await(this.getLastUpdateTask()||this.currLibraryItems);this.updateQueue.length>0?e(this.getLatestLibrary()):e(qD(t))}catch{return e(this.currLibraryItems)}})),i(this,`updateLibrary`,async({libraryItems:e,prompt:t=!1,merge:n=!1,openLibraryMenu:r=!1,defaultStatus:i=`unpublished`})=>(r&&this.app.setState({openSidebar:{name:At.name,tab:`library`}}),this.setLibrary(()=>new Promise(async(r,a)=>{try{let o=await(typeof e==`function`&&!(e instanceof Blob)?e(this.currLibraryItems):e),s;s=o instanceof Blob?await Yt(o,i):zn(o,i),!t||window.confirm(K(`alerts.confirmAddLibrary`,{numShapes:s.length}))?(t&&this.app.focusContainer(),r(n?YD(this.currLibraryItems,s):s)):a(new E)}catch(e){a(e)}})))),i(this,`setLibrary`,e=>{let t=new Promise(async(t,n)=>{try{await this.getLastUpdateTask(),typeof e==`function`&&(e=e(this.currLibraryItems)),this.currLibraryItems=qD(await e),t(this.currLibraryItems)}catch(e){n(e)}}).catch(e=>{if(e.name===`AbortError`)return console.warn(`Library update aborted by user`),this.currLibraryItems;throw e}).finally(()=>{this.updateQueue=this.updateQueue.filter(e=>e!==t),this.notifyListeners()});return this.updateQueue.push(t),this.notifyListeners(),t}),this.app=e}},QD=e=>{let t=Math.ceil(Math.sqrt(e.length)),n=[],r=n=>e.slice(n*t,n*t+t).reduce((e,t)=>{let{height:n}=Pa(t.elements);return Math.max(e,n)},0),i=n=>{let r=0,i=0,a=0;for(let o of e){if(r%t===0&&(i=0),i===n){let{width:e}=Pa(o.elements);a=Math.max(a,e)}r++,i++}return a},a=0,o=0,s=0,c=0,l=0,u=0,d=0;for(let f of e){l&&l%t===0&&(o+=s+50,a=0,u=0,d++),u===0&&(s=r(d)),c=i(u);let{minX:e,minY:p,width:m,height:h}=Pa(f.elements),g=(c-m)/2,_=(s-h)/2;n.push(...f.elements.map(t=>({...t,x:t.x+a+g-e,y:t.y+o+_-p}))),a+=c+50,l++,u++}return n},$D=class e{constructor(e){i(this,`adapter`),this.adapter=e}static async getLibraryItems(t,n,r=!0){let i=()=>new Promise(async(e,r)=>{try{e(zn((await t.load({source:n}))?.libraryItems||[],`published`))}catch(e){r(e)}});return r?e.queue.push(i):i()}getLibraryItems(t){return e.getLibraryItems(this.adapter,t,!1)}};i($D,`queue`,new _o),i($D,`run`,async(e,t)=>{let n=new $D(e);return $D.queue.push(()=>t(n))});var eO=e=>`${e.id}:${e.name||``}:${Si(e.elements)}`,tO=({theme:e,id:t,libraryReturnUrl:n})=>{let i=n||window.location.origin+window.location.pathname;return(0,W.jsx)(`a`,{className:`library-menu-browse-button`,href:`${r.VITE_APP_LIBRARY_URL}?target=${window.name||`_blank`}&referrer=${i}&useHash=true&token=${t}&theme=${e}&version=${Ei.excalidrawLibrary}`,target:`_excalidraw_libraries`,children:K(`labels.libraries`)})},nO=({libraryReturnUrl:e,theme:t,id:n,style:r,children:i,className:a})=>(0,W.jsxs)(`div`,{className:U(`library-menu-control-buttons`,a),style:r,children:[(0,W.jsx)(tO,{id:n,libraryReturnUrl:e,theme:t}),i]}),rO=yc(0),iO=e=>{let[t,n]=vy(rO);return(0,H.useEffect)(()=>{let{current:t}=e;if(!t)return;let r=(0,gc.default)(()=>{let{scrollTop:e}=t;n(e)},200);return t.addEventListener(`scroll`,r),()=>{r.cancel(),t.removeEventListener(`scroll`,r)}},[e,n]),t},aO=({label:e,onClick:t,className:n,children:r,actionType:i,type:a=`button`,isLoading:o,...s})=>(0,W.jsxs)(`button`,{className:U(`Dialog__action-button`,i?`Dialog__action-button--${i}`:``,n),type:a,"aria-label":e,onClick:t,...s,children:[r&&(0,W.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:r}),(0,W.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:e}),o&&(0,W.jsx)(`div`,{style:{position:`absolute`,inset:0},children:(0,W.jsx)($S,{})})]}),oO=e=>{let{onConfirm:t,onCancel:n,children:r,confirmText:i=K(`buttons.confirm`),cancelText:a=K(`buttons.cancel`),className:o=``,...s}=e,c=lz(),l=yy(rk),{container:u}=oz();return(0,W.jsxs)(dk,{onCloseRequest:n,size:`small`,...s,className:`confirm-dialog ${o}`,children:[r,(0,W.jsxs)(`div`,{className:`confirm-dialog-buttons`,children:[(0,W.jsx)(aO,{label:a,onClick:()=>{c({openMenu:null}),l(!1),(0,_c.flushSync)(()=>{n()}),u?.focus()}}),(0,W.jsx)(aO,{label:i,onClick:()=>{c({openMenu:null}),l(!1),(0,_c.flushSync)(()=>{t()}),u?.focus()},actionType:`danger`})]})]})},sO=class{static has(e){try{return!!window.localStorage.getItem(e)}catch(e){return console.warn(`localStorage.getItem error: ${e.message}`),!1}}static get(e){try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return console.warn(`localStorage.getItem error: ${e.message}`),null}}};i(sO,`set`,(e,t)=>{try{return window.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){return console.warn(`localStorage.setItem error: ${e.message}`),!1}}),i(sO,`delete`,e=>{try{window.localStorage.removeItem(e)}catch(e){console.warn(`localStorage.removeItem error: ${e.message}`)}});var cO=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,lO=/{{([\w-]+)}}/,uO=/<([\w-]+)>/,dO=/<\/([\w-]+)>/,fO=(e,t)=>{let n=[{name:``,children:[]}];return e.split(cO).filter(Boolean).forEach(r=>{let i=r.match(uO),a=r.match(dO),o=r.match(lO);if(i!==null){let r=i[1];t.hasOwnProperty(r)?n.push({name:r,children:[]}):console.warn(`Trans: missed to pass in prop ${r} for interpolating ${e}`)}else if(a!==null)if(a[1]===n[n.length-1].name){let e=n.pop(),r=H.createElement(H.Fragment,{},...e.children),i=t[e.name];typeof i==`function`&&n[n.length-1].children.push(i(r))}else console.warn(`Trans: unexpected end tag ${r} for interpolating ${e}`);else if(o!==null){let r=o[1];t.hasOwnProperty(r)?n[n.length-1].children.push(t[r]):console.warn(`Trans: key ${r} not in props for interpolating ${e}`)}else n[n.length-1].children.push(r)}),n.length!==1&&console.warn(`Trans: stack not empty for interpolating ${e}`),n[0].children},pO=({i18nKey:e,children:t,...n})=>{let{t:r}=Fy();return H.createElement(H.Fragment,{},...fO(r(e),n))},mO=async e=>{let t=ar(e,6),n=document.createElement(`canvas`);n.width=t[0].length*128+(t[0].length+1)*16-16,n.height=t.length*128+(t.length+1)*16-16;let r=n.getContext(`2d`);r.fillStyle=`#fff`,r.fillRect(0,0,n.width,n.height);for(let[t,n]of e.entries()){let e=await zD({elements:n.elements,files:null,maxWidthOrHeight:128}),{width:i,height:a}=e,o=Math.floor(t/6)*144,s=t%6*144;r.drawImage(e,s+(128-i)/2+8,o+(128-a)/2+8),r.lineWidth=2,r.strokeStyle=`#ced4da`,r.strokeRect(s+8/2,o+8/2,136,136)}return await Bt(new File([await er(n)],`preview`,{type:hs.png}),{outputType:hs.jpg,maxWidthOrHeight:5e3})},hO=({libItem:e,appState:t,index:n,onChange:r,onRemove:i})=>{let a=(0,H.useRef)(null),o=(0,H.useRef)(null);return(0,H.useEffect)(()=>{let n=a.current;n&&(async()=>{n.innerHTML=(await BD({elements:e.elements,appState:{...t,viewBackgroundColor:`#fff`,exportBackground:!0},files:null,skipInliningFonts:!0})).outerHTML})()},[e.elements,t]),(0,W.jsxs)(`div`,{className:`single-library-item`,children:[e.status===`published`&&(0,W.jsx)(`span`,{className:`single-library-item-status`,children:K(`labels.statusPublished`)}),(0,W.jsx)(`div`,{ref:a,className:`single-library-item__svg`}),(0,W.jsx)(X,{"aria-label":K(`buttons.remove`),type:`button`,icon:nx,className:`single-library-item--remove`,onClick:i.bind(null,e.id),title:K(`buttons.remove`)}),(0,W.jsxs)(`div`,{style:{display:`flex`,margin:`0.8rem 0`,width:`100%`,fontSize:`14px`,fontWeight:500,flexDirection:`column`},children:[(0,W.jsxs)(`label`,{style:{display:`flex`,justifyContent:`space-between`,flexDirection:`column`},children:[(0,W.jsxs)(`div`,{style:{padding:`0.5em 0`},children:[(0,W.jsx)(`span`,{style:{fontWeight:500,color:`#868e96`},children:K(`publishDialog.itemName`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`input`,{type:`text`,ref:o,style:{width:`80%`,padding:`0.2rem`},defaultValue:e.name,placeholder:`Item name`,onChange:e=>{r(e.target.value,n)}})]}),(0,W.jsx)(`span`,{className:`error`,children:e.error})]})]})},gO=({onClose:e,libraryItems:t,appState:n,onSuccess:i,onError:a,updateItemsInStorage:o,onRemove:s})=>{let[c,l]=(0,H.useState)({authorName:``,githubHandle:``,name:``,description:``,twitterHandle:``,website:``}),[u,d]=(0,H.useState)(!1);(0,H.useEffect)(()=>{let e=sO.get(da.PUBLISH_LIBRARY);e&&l(e)},[]);let[f,p]=(0,H.useState)(t.slice());(0,H.useEffect)(()=>{p(t.slice())},[t]);let m=e=>{l({...c,[e.target.name]:e.target.value})},h=async e=>{e.preventDefault(),d(!0);let t=[],n=!1;if(f.forEach(e=>{let r=``;e.name||(r=K(`publishDialog.errors.required`),n=!0),t.push({...e,error:r})}),n){p(t),d(!1);return}let o=await mO(f),s={type:Na.excalidrawLibrary,version:Ei.excalidrawLibrary,source:So(),libraryItems:f},l=JSON.stringify(s,null,2),u=new Blob([l],{type:`application/json`}),m=new FormData;m.append(`excalidrawLib`,u),m.append(`previewImage`,o),m.append(`previewImageType`,o.type),m.append(`title`,c.name),m.append(`authorName`,c.authorName),m.append(`githubHandle`,c.githubHandle),m.append(`name`,c.name),m.append(`description`,c.description),m.append(`twitterHandle`,c.twitterHandle),m.append(`website`,c.website),fetch(`${r.VITE_APP_LIBRARY_BACKEND}/submit`,{method:`post`,body:m}).then(e=>e.ok?e.json().then(({url:e})=>{sO.delete(da.PUBLISH_LIBRARY),i({url:e,authorName:c.authorName,items:f})}):e.json().catch(()=>{throw Error(e.statusText||`something went wrong`)}).then(t=>{throw Error(t.message||e.statusText||`something went wrong`)}),e=>{console.error(e),a(e),d(!1)}).catch(e=>{console.error(e),a(e),d(!1)})},g=()=>{let e=[];return f.forEach((t,r)=>{e.push((0,W.jsx)(`div`,{className:`single-library-item-wrapper`,children:(0,W.jsx)(hO,{libItem:t,appState:n,index:r,onChange:(e,t)=>{let n=f.slice();n[t].name=e,p(n)},onRemove:s})},r))}),(0,W.jsx)(`div`,{className:`selected-library-items`,children:e})},_=(0,H.useCallback)(()=>{o(f),sO.set(da.PUBLISH_LIBRARY,c),e()},[f,e,o,c]),v=!!t.length,y=t.some(e=>e.status===`published`);return(0,W.jsx)(dk,{onCloseRequest:_,title:K(`publishDialog.title`),className:`publish-library`,children:v?(0,W.jsxs)(`form`,{onSubmit:h,children:[(0,W.jsx)(`div`,{className:`publish-library-note`,children:(0,W.jsx)(pO,{i18nKey:`publishDialog.noteDescription`,link:e=>(0,W.jsx)(`a`,{href:`https://libraries.excalidraw.com`,target:`_blank`,rel:`noopener`,children:e})})}),(0,W.jsx)(`span`,{className:`publish-library-note`,children:(0,W.jsx)(pO,{i18nKey:`publishDialog.noteGuidelines`,link:e=>(0,W.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries#guidelines`,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,W.jsx)(`div`,{className:`publish-library-note`,children:K(`publishDialog.noteItems`)}),y&&(0,W.jsx)(`span`,{className:`publish-library-note publish-library-warning`,children:K(`publishDialog.republishWarning`)}),g(),(0,W.jsxs)(`div`,{className:`publish-library__fields`,children:[(0,W.jsxs)(`label`,{children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.libraryName`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`input`,{type:`text`,name:`name`,required:!0,value:c.name,onChange:m,placeholder:K(`publishDialog.placeholder.libraryName`)})]}),(0,W.jsxs)(`label`,{style:{alignItems:`flex-start`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.libraryDesc`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`textarea`,{name:`description`,rows:4,required:!0,value:c.description,onChange:m,placeholder:K(`publishDialog.placeholder.libraryDesc`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.authorName`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`input`,{type:`text`,name:`authorName`,required:!0,value:c.authorName,onChange:m,placeholder:K(`publishDialog.placeholder.authorName`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.githubUsername`)}),(0,W.jsx)(`input`,{type:`text`,name:`githubHandle`,value:c.githubHandle,onChange:m,placeholder:K(`publishDialog.placeholder.githubHandle`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.twitterUsername`)}),(0,W.jsx)(`input`,{type:`text`,name:`twitterHandle`,value:c.twitterHandle,onChange:m,placeholder:K(`publishDialog.placeholder.twitterHandle`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.website`)}),(0,W.jsx)(`input`,{type:`text`,name:`website`,pattern:`https?://.+`,title:K(`publishDialog.errors.website`),value:c.website,onChange:m,placeholder:K(`publishDialog.placeholder.website`)})]}),(0,W.jsx)(`span`,{className:`publish-library-note`,children:(0,W.jsx)(pO,{i18nKey:`publishDialog.noteLicense`,link:e=>(0,W.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE`,target:`_blank`,rel:`noopener noreferrer`,children:e})})})]}),(0,W.jsxs)(`div`,{className:`publish-library__buttons`,children:[(0,W.jsx)(aO,{label:K(`buttons.saveLibNames`),onClick:_,"data-testid":`cancel-clear-canvas-button`}),(0,W.jsx)(aO,{type:`submit`,label:K(`buttons.submit`),actionType:`primary`,isLoading:u})]})]}):(0,W.jsx)(`p`,{style:{padding:`1em`,textAlign:`center`,fontWeight:500},children:K(`publishDialog.atleastOneLibItem`)})})},_O={Row:(0,H.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,W.jsx)(`div`,{className:U(`Stack Stack_horizontal`,i),style:{"--gap":t,alignItems:n,justifyContent:r,...a},ref:o,children:e})),Col:(0,H.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,W.jsx)(`div`,{className:U(`Stack Stack_vertical`,i),style:{"--gap":t,justifyItems:n,justifyContent:r,...a},ref:o,children:e}))},vO=({children:e,onClickOutside:t,className:n=``,onSelect:r,open:i=!0,align:a=`end`,style:o})=>{let s=iz(),c=(0,H.useRef)(null),l=yC({onClickOutside:t});vC(c,(0,H.useCallback)(e=>{c.current?.closest(`.${Qn.DROPDOWN_MENU_EVENT_WRAPPER}`)?.contains(e.target)||l.onClickOutside?.()},[l])),(0,H.useEffect)(()=>{if(!i)return;let e=e=>{e.key===N.ESCAPE&&(e.stopImmediatePropagation(),l.onClickOutside?.())},t={capture:!0};return document.addEventListener(F.KEYDOWN,e,t),()=>{document.removeEventListener(F.KEYDOWN,e,t)}},[l,i]);let u=U(`dropdown-menu ${n}`,{"dropdown-menu--mobile":s.formFactor===`phone`}).trim();return(0,W.jsx)($C.Provider,{value:{onSelect:r},children:(0,W.jsx)(u_,{ref:c,className:u,style:o,"data-testid":`dropdown-menu`,align:a,sideOffset:8,onCloseAutoFocus:e=>e.preventDefault(),children:s.formFactor===`phone`?(0,W.jsx)(_O.Col,{className:`dropdown-menu-container`,children:e}):(0,W.jsx)(SC,{className:`dropdown-menu-container`,padding:2,children:e})})})};vO.displayName=`DropdownMenuContent`;var yO=vO,bO=({children:e,className:t=``,selected:n,...r})=>(0,W.jsx)(`div`,{...r,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${n?`dropdown-menu-item--selected`:``}`.trim(),children:e}),xO=({icon:e,shortcut:t,href:n,children:r,onSelect:i,className:a=``,selected:o,rel:s=`noopener`,...c})=>{let l=tw(i);return(0,W.jsx)(d_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,W.jsx)(`a`,{...c,href:n,target:`_blank`,rel:`noopener ${s}`,className:ew(a,o),title:c.title??c[`aria-label`],children:(0,W.jsx)(rw,{icon:e,shortcut:t,children:r})})})},SO=xO;xO.displayName=`DropdownMenuItemLink`;var CO=()=>(0,W.jsx)(`div`,{style:{height:`1px`,backgroundColor:`var(--default-border-color)`,margin:`6px 0`,flex:`0 0 auto`}}),wO=CO;CO.displayName=`DropdownMenuSeparator`;var TO=-4,EO=4,DO=({children:e,className:t})=>{let n=iz(),r=U(`dropdown-menu dropdown-submenu ${t}`,{"dropdown-menu--mobile":n.formFactor===`phone`}).trim(),i=(0,H.useCallback)(e=>{if(e){let t=e.closest(`.dropdown-menu-container`)?.getBoundingClientRect();if(t){let n=e.getBoundingClientRect().width,r=window.innerWidth-t.right;r<n+20&&(o(r-n+TO),c(TO+8))}}},[]),[a,o]=(0,H.useState)(EO),[s,c]=(0,H.useState)(TO);return(0,W.jsx)(m_,{className:r,sideOffset:a,alignOffset:s,collisionPadding:8,ref:i,children:n.formFactor===`phone`?(0,W.jsx)(_O.Col,{className:`dropdown-menu-container`,children:e}):(0,W.jsx)(SC,{className:`dropdown-menu-container`,padding:2,style:{zIndex:1},children:e})})},OO=DO;DO.displayName=`DropdownMenuSubContent`;var kO=({children:e,icon:t,shortcut:n,className:r})=>(0,W.jsxs)(p_,{className:`${ew(r)} dropdown-menu__submenu-trigger`,children:[(0,W.jsx)(rw,{icon:t,shortcut:n,children:e}),(0,W.jsx)(`div`,{className:`dropdown-menu__submenu-trigger-icon`,children:ZS})]}),AO=kO;kO.displayName=`DropdownMenuSubTrigger`;var jO=e=>t=>H.Children.toArray(t).find(t=>H.isValidElement(t)&&typeof t.type!=`string`&&t?.type.displayName&&t.type.displayName===e)||null,MO=jO(`DropdownMenuTrigger`),NO=jO(`DropdownMenuContent`),PO=jO(`DropdownMenuSubTrigger`),FO=jO(`DropdownMenuSubContent`),IO=({children:e})=>{let t=PO(e),n=FO(e);return(0,W.jsxs)(f_,{children:[t,n]})};IO.Trigger=AO,IO.Content=OO,IO.displayName=`DropdownMenuSub`;var LO=IO,RO=({className:e=``,children:t,onToggle:n,title:r,...i})=>{let a=iz(),o=U(`dropdown-menu-button ${e}`,`zen-mode-transition`,{"dropdown-menu-button--mobile":a.formFactor===`phone`}).trim();return(0,W.jsx)(l_,{className:o,onClick:n,type:`button`,"data-testid":`dropdown-menu-button`,title:r,...i,children:t})},zO=RO;RO.displayName=`DropdownMenuTrigger`;var BO=e=>(0,W.jsx)(sw,{...e,icon:e.checked?Eb:XS}),VO=({children:e,open:t})=>{let n=MO(e),r=NO(e),i=r&&H.isValidElement(r)?H.cloneElement(r,{open:t}):r;return(0,W.jsx)(c_,{open:t,modal:!1,children:(0,W.jsxs)(`div`,{className:Qn.DROPDOWN_MENU_EVENT_WRAPPER,style:{display:`contents`},children:[n,i]})})};VO.Trigger=zO,VO.Content=yO,VO.Item=sw,VO.ItemCheckbox=BO,VO.ItemLink=SO,VO.ItemCustom=bO,VO.Group=QC,VO.Separator=wO,VO.Sub=LO;var HO=VO;VO.displayName=`DropdownMenu`;var UO=(e,t)=>e.filter(e=>t.includes(e.id)),WO=({setAppState:e,selectedItems:t,library:n,onRemoveFromLibrary:r,resetLibrary:i,onSelectItems:a,appState:o,className:s})=>{let[c]=vy(KD),[l,u]=vy(rk),d=()=>{let e=t.length?K(`alerts.removeItemsFromsLibrary`,{count:t.length}):K(`alerts.resetLibrary`);return(0,W.jsx)(oO,{onConfirm:()=>{t.length?r():i(),p(!1)},onCancel:()=>{p(!1)},title:t.length?K(`confirmDialog.removeItemsFromLib`):K(`confirmDialog.resetLibrary`),children:(0,W.jsx)(`p`,{children:e})})},[f,p]=(0,H.useState)(!1),m=!!t.length,h=m?c.libraryItems.filter(e=>t.includes(e.id)):c.libraryItems,g=K(m?`buttons.remove`:`buttons.resetLibrary`),[_,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(null),x=(0,H.useCallback)(()=>(0,W.jsxs)(dk,{onCloseRequest:()=>b(null),title:K(`publishSuccessDialog.title`),className:`publish-library-success`,size:`small`,children:[(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`publishSuccessDialog.content`,authorName:y.authorName,link:e=>(0,W.jsx)(`a`,{href:y?.url,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,W.jsx)(X,{type:`button`,title:K(`buttons.close`),"aria-label":K(`buttons.close`),label:K(`buttons.close`),onClick:()=>b(null),"data-testid":`publish-library-success-close`,className:`publish-library-success-close`})]}),[b,y]),S=(e,r)=>{v(!1),b({url:e.url,authorName:e.authorName});let i=r.slice();i.forEach(e=>{t.includes(e.id)&&(e.status=`published`)}),n.setLibrary(i)},C=async()=>{try{await n.updateLibrary({libraryItems:Wo({description:`Excalidraw library files`}),merge:!0,openLibraryMenu:!0})}catch(t){if(t?.name===`AbortError`){console.warn(t);return}e({errorMessage:K(`errors.importLibraryError`)})}},w=async()=>{Hi(m?h:await n.getLatestLibrary()).catch(te).catch(t=>{e({errorMessage:t.message})})};return(0,W.jsxs)(`div`,{className:U(`library-menu-dropdown-container`,s),children:[(0,W.jsxs)(HO,{open:l,children:[(0,W.jsx)(HO.Trigger,{onToggle:()=>u(!l),children:Vy}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>u(!1),onSelect:()=>u(!1),className:`library-menu`,children:[!m&&(0,W.jsx)(HO.Item,{onSelect:C,icon:Ab,"data-testid":`lib-dropdown--load`,children:K(`buttons.load`)}),!!h.length&&(0,W.jsx)(HO.Item,{onSelect:w,icon:yb,"data-testid":`lib-dropdown--export`,children:K(`buttons.export`)}),m&&(0,W.jsx)(HO.Item,{icon:Xx,onSelect:()=>v(!0),"data-testid":`lib-dropdown--remove`,children:K(`buttons.publishLibrary`)}),!!h.length&&(0,W.jsx)(HO.Item,{onSelect:()=>p(!0),icon:pb,children:g})]})]}),t.length>0&&(0,W.jsx)(`div`,{className:`library-actions-counter`,children:t.length}),f&&d(),_&&(0,W.jsx)(gO,{onClose:()=>v(!1),libraryItems:UO(c.libraryItems,t),appState:o,onSuccess:e=>S(e,c.libraryItems),onError:e=>window.alert(e),updateItemsInStorage:()=>n.setLibrary(c.libraryItems),onRemove:e=>a(t.filter(t=>t!==e))}),y&&x()]})},GO=({selectedItems:e,onSelectItems:t,className:n})=>{let{library:r}=nz(),{clearLibraryCache:i,deleteItemsFromLibraryCache:a}=WD(),o=gC(),s=lz(),[c]=vy(KD),l=async n=>{let i=n.filter(t=>!e.includes(t.id));r.setLibrary(i).catch(()=>{s({errorMessage:K(`alerts.errorRemovingFromLibrary`)})}),a(e),t([])};return(0,W.jsx)(WO,{appState:o,setAppState:s,selectedItems:e,onSelectItems:t,library:r,onRemoveFromLibrary:()=>l(c.libraryItems),resetLibrary:()=>{r.resetLibrary(),i()},className:n})};function KO(){return[!1,(0,H.useCallback)(e=>e(),[])]}var qO=H.useTransition||KO,JO=(0,H.memo)(({id:e,elements:t,isPending:n,onClick:r,selected:i,onToggle:a,onDrag:o,svgCache:s})=>{let c=(0,H.useRef)(null),l=UD(e,t,s,c),[u,d]=(0,H.useState)(!1),f=iz().formFactor===`phone`,p=n&&(0,W.jsx)(`div`,{className:`library-unit__adder`,children:By});return(0,W.jsxs)(`div`,{className:U(`library-unit`,{"library-unit__active":t,"library-unit--hover":t&&u,"library-unit--selected":i,"library-unit--skeleton":!l}),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[(0,W.jsx)(`div`,{className:U(`library-unit__dragger`,{"library-unit__pulse":!!n}),ref:c,draggable:!!t,onClick:t||n?t=>{e&&t.shiftKey?a(e,t):r(e)}:void 0,onDragStart:t=>{if(!e){t.preventDefault();return}d(!1),o(e,t)}}),p,e&&t&&(u||f||i)&&(0,W.jsx)(sT,{checked:i,onChange:(t,n)=>a(e,n),className:`library-unit__checkbox`})]})}),YO=()=>(0,W.jsx)(`div`,{className:`library-unit library-unit--skeleton`}),XO=({children:e})=>(0,W.jsx)(`div`,{className:`library-menu-items-container__grid`,children:e}),ZO=(0,H.memo)(({items:e,onItemSelectToggle:t,onItemDrag:n,isItemSelected:r,onClick:i,svgCache:a,itemsRenderedPerBatch:o})=>{let[,s]=qO(),[c,l]=(0,H.useState)(0);return(0,H.useEffect)(()=>{c<e.length&&s(()=>{l(c+o)})},[c,e.length,s,o]),(0,W.jsx)(W.Fragment,{children:e.map((e,o)=>o<c?(0,W.jsx)(JO,{elements:e?.elements,isPending:!e?.id&&!!e?.elements,onClick:i,svgCache:a,id:e?.id,selected:r(e.id),onToggle:t,onDrag:n},e?.id??o):(0,W.jsx)(YO,{},o))})}),QO=({type:e=`button`,onSelect:t,selected:n,children:r,className:i=``,...a})=>(0,W.jsx)(`button`,{onClick:ps(a.onClick,e=>{t()}),type:e,className:U(`excalidraw-button`,i,{selected:n}),...a,children:r}),$O=(0,H.forwardRef)(({onChange:e,label:t,fullWidth:n,placeholder:r,readonly:i,selectOnRender:a,onKeyDown:o,isRedacted:s=!1,icon:c,className:l,type:u,...d},f)=>{let p=(0,H.useRef)(null);(0,H.useImperativeHandle)(f,()=>p.current),(0,H.useLayoutEffect)(()=>{a&&(p.current?.focus(),p.current?.select())},[a]);let[m,h]=(0,H.useState)(!1);return(0,W.jsxs)(`div`,{className:U(`ExcTextField`,l,{"ExcTextField--fullWidth":n,"ExcTextField--hasIcon":!!c}),onClick:()=>{p.current?.focus()},children:[c,t&&(0,W.jsx)(`div`,{className:`ExcTextField__label`,children:t}),(0,W.jsxs)(`div`,{className:U(`ExcTextField__input`,{"ExcTextField__input--readonly":i}),children:[(0,W.jsx)(`input`,{className:U({"is-redacted":`value`in d&&d.value&&s&&!m}),readOnly:i,value:`value`in d?d.value:void 0,defaultValue:`defaultValue`in d?d.defaultValue:void 0,placeholder:r,ref:p,onChange:t=>e?.(t.target.value),onKeyDown:o,type:u}),s&&(0,W.jsx)(QO,{onSelect:()=>h(!m),style:{border:0,userSelect:`none`},children:m?hS:mS})]})]})}),ek=17,tk=64;function nk({isLoading:e,libraryItems:t,onAddToLibrary:n,onInsertLibraryItems:r,pendingElements:i,theme:a,id:o,libraryReturnUrl:s,onSelectItems:c,selectedItems:l}){let u=iz(),d=(0,H.useRef)(null),f=iO(d);(0,H.useEffect)(()=>{f>0&&d.current?.scrollTo(0,f)},[]);let{svgCache:p}=WD(),[m,h]=(0,H.useState)(null),[g,_]=(0,H.useState)(``),v=!t.length&&!i.length,y=!v&&!!g.trim(),b=(0,H.useMemo)(()=>{let e=LD(g.trim().toLowerCase());return e?t.filter(t=>{let n=t.name||``;return n.trim()&&LD(n.toLowerCase()).includes(e)}):[]},[t,g]),x=(0,H.useMemo)(()=>t.filter(e=>e.status!==`published`),[t]),S=(0,H.useMemo)(()=>t.filter(e=>e.status===`published`),[t]),C=(0,H.useCallback)((e,t)=>{let n=!l.includes(e),r=[...x,...S];if(n){if(t.shiftKey&&m){let t=r.findIndex(e=>e.id===m),n=r.findIndex(t=>t.id===e);if(t===-1||n===-1){c([...l,e]);return}let i=lr(l),a=Math.min(t,n),o=Math.max(t,n);c(r.reduce((e,t,n)=>((n>=a&&n<=o||i.has(t.id))&&e.push(t.id),e),[]))}else c([...l,e]);h(e)}else h(null),c(l.filter(t=>t!==e))},[m,c,S,l,x]);(0,H.useEffect)(()=>{l.length||h(null)},[l]);let w=(0,H.useCallback)(e=>{let n;return n=l.includes(e)?t.filter(e=>l.includes(e.id)):t.filter(t=>t.id===e),n.map(e=>({...e,elements:Er({type:`everything`,elements:e.elements,randomizeSeed:!0}).duplicatedElements}))},[t,l]),T=(0,H.useCallback)((e,t)=>{let n={itemIds:l.includes(e)?l:[e]};t.dataTransfer.setData(hs.excalidrawlibIds,JSON.stringify(n))},[l]),E=(0,H.useCallback)(e=>e?l.includes(e):!1,[l]),D=(0,H.useCallback)(()=>{n(i)},[i,n]),O=(0,H.useCallback)(e=>{e&&r(w(e))},[w,r]),k=p.size>=(b.length?b:t).length?tk:ek,A=(0,H.useRef)(null);(0,H.useEffect)(()=>{Tr(()=>{A.current?.focus()})},[]);let ee=!y&&(0,W.jsxs)(W.Fragment,{children:[!v&&(0,W.jsx)(`div`,{className:`library-menu-items-container__header`,children:K(`labels.personalLib`)}),!i.length&&!x.length?(0,W.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[!S.length&&(0,W.jsx)(`div`,{className:`library-menu-items__no-items__label`,children:K(`library.noItems`)}),(0,W.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:S.length>0?K(`library.hint_emptyPrivateLibrary`):K(`library.hint_emptyLibrary`)})]}):(0,W.jsxs)(XO,{children:[i.length>0&&(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:[{id:null,elements:i}],onItemSelectToggle:C,onItemDrag:T,onClick:D,isItemSelected:E,svgCache:p}),(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:x,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})]}),S.length>0&&(0,W.jsx)(`div`,{className:`library-menu-items-container__header`,style:{marginTop:`0.75rem`},children:K(`labels.excalidrawLib`)}),S.length>0&&(0,W.jsx)(XO,{children:(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:S,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})})]}),te=y&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`library-menu-items-container__header`,children:[K(`library.search.heading`),!e&&(0,W.jsxs)(`div`,{className:`library-menu-items-container__header__hint`,style:{cursor:`pointer`},onPointerDown:e=>e.preventDefault(),onClick:e=>{_(``)},children:[(0,W.jsx)(`kbd`,{children:`esc`}),` to clear`]})]}),b.length>0?(0,W.jsx)(XO,{children:(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:b,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})}):(0,W.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[(0,W.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:K(`library.search.noResults`)}),(0,W.jsx)(QO,{onPointerDown:e=>e.preventDefault(),onSelect:()=>{_(``)},style:{width:`auto`,marginTop:`1rem`},children:K(`library.search.clearSearch`)})]})]});return(0,W.jsxs)(`div`,{className:`library-menu-items-container`,style:i.length||x.length||S.length?{justifyContent:`flex-start`}:{borderBottom:0},children:[(0,W.jsxs)(`div`,{className:`library-menu-items-header`,children:[!v&&(0,W.jsx)($O,{ref:A,type:`search`,className:U(`library-menu-items-container__search`,{hideCancelButton:u.formFactor!==`phone`}),placeholder:K(`library.search.inputPlaceholder`),value:g,onChange:e=>_(e)}),(0,W.jsx)(GO,{selectedItems:l,onSelectItems:c,className:`library-menu-dropdown-container--in-heading`})]}),(0,W.jsxs)(_O.Col,{className:`library-menu-items-container__items`,align:`start`,gap:1,style:{flex:S.length>0?1:`0 1 auto`,margin:v?`auto`:0},ref:d,children:[e&&(0,W.jsx)(`div`,{style:{position:`absolute`,top:`var(--container-padding-y)`,right:`var(--container-padding-x)`,transform:`translateY(50%)`},children:(0,W.jsx)($S,{})}),ee,te,v&&(0,W.jsx)(nO,{style:{padding:`16px 0`,width:`100%`},id:o,libraryReturnUrl:s,theme:a})]})]})}var rk=yc(!1),ik=({children:e})=>(0,W.jsx)(`div`,{className:`layer-ui__library`,children:e}),ak=(0,H.memo)(({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:n,setAppState:r,libraryReturnUrl:i,library:a,id:o,theme:s,selectedItems:c,onSelectItems:l})=>{let[u]=vy(KD),d=(0,H.useCallback)(e=>{(async(e,t)=>{dC(`element`,`addToLibrary`,`ui`);for(let t of Le)if(e.some(e=>e.type===t))return r({errorMessage:K(`errors.libraryElementTypeError.${t}`)});let i=[{status:`unpublished`,elements:e,id:Bi(),created:Date.now()},...t];n(),a.setLibrary(i).catch(()=>{r({errorMessage:K(`alerts.errorAddingToLibrary`)})})})(e,u.libraryItems)},[n,a,r,u.libraryItems]),f=(0,H.useMemo)(()=>u.libraryItems,[u]);if(u.status===`loading`&&!u.isInitialized)return(0,W.jsx)(ik,{children:(0,W.jsx)(`div`,{className:`layer-ui__library-message`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)($S,{size:`2em`}),(0,W.jsx)(`span`,{children:K(`labels.libraryLoadingMessage`)})]})})});let p=u.libraryItems.length>0||t.length>0;return(0,W.jsxs)(ik,{children:[(0,W.jsx)(nk,{isLoading:u.status===`loading`,libraryItems:f,onAddToLibrary:d,onInsertLibraryItems:e,pendingElements:t,id:o,libraryReturnUrl:i,theme:s,onSelectItems:l,selectedItems:c}),p&&(0,W.jsx)(nO,{className:`library-menu-control-buttons--at-bottom`,style:{padding:`16px 12px 0 12px`},id:o,libraryReturnUrl:i,theme:s})]})}),ok=(e,t)=>({elements:e,pending:ir(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}),selectedElementIds:t}),sk=(e,t)=>{let n=sz(),[r,i]=(0,H.useState)(()=>ok(n,e.selectedElementIds)),a=(0,H.useRef)(new Map);return(0,H.useEffect)(()=>{for(let e of r.pending)a.current.set(e.id,e.version)},[r.pending]),(0,H.useEffect)(()=>{t.state.cursorButton===`up`&&t.state.activeTool.type===`selection`&&i(r=>{if(!ji(r.selectedElementIds,e.selectedElementIds))return a.current.clear(),ok(n,e.selectedElementIds);let i=t.scene.getNonDeletedElementsMap();for(let t of Object.keys(e.selectedElementIds)){let r=i.get(t)?.version;if(r&&r!==a.current.get(t))return ok(n,e.selectedElementIds)}return r})},[t,t.state.cursorButton,t.state.activeTool.type,e.selectedElementIds,n]),r.pending},ck=(0,H.memo)(()=>{let e=nz(),{onInsertElements:t}=e,n=rz(),r=gC(),i=lz(),[a,o]=(0,H.useState)([]),s=(0,H.useMemo)(()=>e.library,[e.library]),c=sk(r,e);return(0,H.useEffect)(()=>w(document,F.KEYDOWN,t=>{if(t.key===N.ESCAPE&&t.target instanceof HTMLElement){let n=t.target;if(n.closest(`.${Qn.SIDEBAR}`))a.length>0?(t.stopPropagation(),o([])):Wr(n)&&n instanceof HTMLInputElement&&!n.value&&(t.stopPropagation(),i({openSidebar:null}),e.focusContainer());else if(a.length>0){let{x:n,y:r}=e.lastViewportPosition;document.elementFromPoint(n,r)?.closest(`.${Qn.SIDEBAR}`)&&(t.stopPropagation(),o([]))}}},{capture:!0}),[a,i,e]),(0,W.jsx)(ak,{pendingElements:c,onInsertLibraryItems:(0,H.useCallback)(n=>{t(QD(n)),e.focusContainer()},[t,e]),onAddToLibrary:(0,H.useCallback)(()=>{i({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[i]),setAppState:i,libraryReturnUrl:n.libraryReturnUrl,library:s,id:e.id,theme:r.theme,selectedItems:a,onSelectItems:o})}),lk=e=>{let{closeOnClickOutside:t=!0}=e,n=_C({className:`excalidraw-modal-container`}),r=(0,H.useRef)(document.body.classList.contains(`excalidraw-animations-disabled`));if(!n)return null;let i=t=>{t.key===N.ESCAPE&&(t.nativeEvent.stopImmediatePropagation(),t.stopPropagation(),e.onCloseRequest())};return(0,_c.createPortal)((0,W.jsxs)(`div`,{className:U(`Modal`,e.className,{"animations-disabled":r.current}),role:`dialog`,"aria-modal":`true`,onKeyDown:i,"aria-labelledby":e.labelledBy,children:[(0,W.jsx)(`div`,{className:`Modal__background`,onClick:t?e.onCloseRequest:void 0}),(0,W.jsx)(`div`,{className:`Modal__content`,style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),n)};function uk(e){if(e&&typeof e==`number`)return e;switch(e){case`small`:return 550;case`wide`:return 1024;default:return 800}}var dk=e=>{let[t,n]=RD(),[r]=(0,H.useState)(document.activeElement),{id:i}=oz(),a=iz().formFactor===`phone`;(0,H.useEffect)(()=>{if(!t)return;let n=is(t);setTimeout(()=>{n.length>0&&e.autofocus!==!1&&(n[1]||n[0]).focus()});let r=e=>{if(e.key===N.TAB){let n=is(t),{activeElement:r}=document,i=n.findIndex(e=>e===r);i===0&&e.shiftKey?(n[n.length-1].focus(),e.preventDefault()):i===n.length-1&&!e.shiftKey&&(n[0].focus(),e.preventDefault())}};return t.addEventListener(`keydown`,r),()=>t.removeEventListener(`keydown`,r)},[t,e.autofocus]);let o=lz(),s=yy(rk),c=()=>{o({openMenu:null}),s(!1),r.focus(),e.onCloseRequest()};return(0,W.jsx)(lk,{className:U(`Dialog`,e.className,{"Dialog--fullscreen":a}),labelledBy:`dialog-title`,maxWidth:uk(e.size),onCloseRequest:c,closeOnClickOutside:e.closeOnClickOutside,children:(0,W.jsxs)(SC,{ref:n,children:[e.title&&(0,W.jsx)(`h2`,{id:`${i}-dialog-title`,className:`Dialog__title`,children:(0,W.jsx)(`span`,{className:`Dialog__titleContent`,children:e.title})}),a&&(0,W.jsx)(`button`,{className:`Dialog__close`,onClick:c,title:K(`buttons.close`),"aria-label":K(`buttons.close`),type:`button`,children:nx}),(0,W.jsx)(`div`,{className:`Dialog__content`,children:e.children})]})})},fk=[{icon:Zx,value:`hand`,key:N.H,numericKey:null,fillable:!1,toolbar:!0},{icon:Zy,value:`selection`,key:N.V,numericKey:N[1],fillable:!0,toolbar:!0},{icon:$y,value:`rectangle`,key:N.R,numericKey:N[2],fillable:!0,toolbar:!0},{icon:eb,value:`diamond`,key:N.D,numericKey:N[3],fillable:!0,toolbar:!0},{icon:tb,value:`ellipse`,key:N.O,numericKey:N[4],fillable:!0,toolbar:!0},{icon:nb,value:`arrow`,key:N.A,numericKey:N[5],fillable:!0,toolbar:!0},{icon:rb,value:`line`,key:N.L,numericKey:N[6],fillable:!0,toolbar:!0},{icon:ab,value:`freedraw`,key:[N.P,N.X],numericKey:N[7],fillable:!1,toolbar:!0},{icon:ob,value:`text`,key:N.T,numericKey:N[8],fillable:!1,toolbar:!0},{icon:cb,value:`image`,key:null,numericKey:N[9],fillable:!1,toolbar:!0},{icon:lb,value:`eraser`,key:N.E,numericKey:N[0],fillable:!1,toolbar:!0},{icon:dS,value:`laser`,key:N.K,numericKey:null,fillable:!1,toolbar:!1}],pk=e=>e.state.preferredSelectionTool.type===`lasso`?[{value:`lasso`,icon:Zy,key:N.V,numericKey:N[1],fillable:!0,toolbar:!0},...fk.slice(1)]:fk,mk=(e,t)=>pk(t).find((t,n)=>t.numericKey!=null&&e===t.numericKey.toString()||t.key&&(typeof t.key==`string`?t.key===e:t.key.includes(e)))?.value||null,hk=H.createContext(null),gk=()=>H.useContext(hk),_k=il(),vk=()=>H.useMemo(()=>({MainMenuTunnel:wv(),WelcomeScreenMenuHintTunnel:wv(),WelcomeScreenToolbarHintTunnel:wv(),WelcomeScreenHelpHintTunnel:wv(),WelcomeScreenCenterTunnel:wv(),FooterCenterTunnel:wv(),DefaultSidebarTriggerTunnel:wv(),DefaultSidebarTabTriggersTunnel:wv(),OverwriteConfirmDialogTunnel:wv(),TTDDialogTriggerTunnel:wv(),tunnelsJotai:_k}),[]),yk=Z({name:`viewMode`,label:`labels.viewMode`,icon:mS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},captureUpdate:V.EVENTUALLY}},checked:e=>e.viewModeEnabled,predicate:(e,t,n)=>typeof n.viewModeEnabled>`u`,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.R}),bk=({app:e,options:t,activeTool:n,defaultOption:r,className:i=`Shape`,namePrefix:a,title:o,"data-testid":s,onToolChange:c,displayedOption:l,fillable:u=!1})=>{let[d,f]=(0,H.useState)(!1),p=n.type,m=l.type===p,{container:h}=oz();return!t.some(e=>e.type===p)&&d&&f(!1),(0,H.useEffect)(()=>{let t=e.onPointerDownEmitter.on(()=>{f(!1)});return()=>t?.()},[e]),(0,W.jsxs)(V_,{open:d,children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(X,{className:U(i,{fillable:u,active:t.some(e=>e.type===n.type)}),type:`radio`,icon:l.icon,checked:m,name:`editor-current-shape`,title:o,"aria-label":o,"data-testid":s,onPointerDown:()=>{f(e=>!e),c(r)}})}),(0,W.jsx)(W_,{className:`tool-popover-content`,sideOffset:26,collisionBoundary:h??void 0,children:t.map(({type:t,icon:n,title:r})=>(0,W.jsx)(X,{className:U(i,{active:p===t}),type:`radio`,icon:n,checked:p===t,name:`${a}-option`,title:r||Ge(t),keyBindingLabel:``,"aria-label":r||Ge(t),"data-testid":`toolbar-${t}`,onChange:()=>{e.state.activeTool.type!==t&&dC(`toolbar`,t,`ui`),e.setActiveTool({type:t}),c?.(t)}},t))})]})},xk=U([Qn.SHAPE_ACTIONS_THEME_SCOPE,`properties-content`]),Sk=(e,t)=>{let n=t[0]?.type||null;for(let e of t)if(e.type!==n){n=null;break}return ye(e.activeTool.type)&&n!==`image`&&n!==`frame`&&n!==`magicframe`||t.some(e=>ye(e.type))},Ck=(e,t)=>Ir(e.activeTool.type)||t.some(e=>Ir(e.type)),wk=({appState:e,elementsMap:t,renderAction:n,app:r})=>{let i=si(t,e),a=!1;i.length===2&&(xr(i[0])||xr(i[1]))&&(a=!0);let o=!!(e.editingTextElement||e.newElement),s=iz(),c=document.documentElement.getAttribute(`dir`)===`rtl`,l=Ir(e.activeTool.type)&&!Po(e.currentItemBackgroundColor)||i.some(e=>Ir(e.type)&&!Po(e.backgroundColor)),u=i.length===1||a,d=!e.selectedLinearElement?.isEditing&&i.length===1&&b(i[0])&&!dr(i[0]),f=!e.croppingElementId&&i.length===1&&io(i[0]),p=!a&&lE(e,r);return(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,W.jsx)(`div`,{children:Sk(e,i)&&n(`changeStrokeColor`)}),Ck(e,i)&&(0,W.jsx)(`div`,{children:n(`changeBackgroundColor`)}),l&&n(`changeFillStyle`),(bt(e.activeTool.type)||i.some(e=>bt(e.type)))&&n(`changeStrokeWidth`),(e.activeTool.type===`freedraw`||i.some(e=>e.type===`freedraw`))&&n(`changeStrokeShape`),(es(e.activeTool.type)||i.some(e=>es(e.type)))&&(0,W.jsxs)(W.Fragment,{children:[n(`changeStrokeStyle`),n(`changeSloppiness`)]}),(za(e.activeTool.type)||i.some(e=>za(e.type)))&&(0,W.jsx)(W.Fragment,{children:n(`changeRoundness`)}),(ko(e.activeTool.type)||i.some(e=>ko(e.type)))&&(0,W.jsx)(W.Fragment,{children:n(`changeArrowType`)}),(e.activeTool.type===`text`||i.some(M))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`fieldset`,{children:n(`changeFontFamily`)}),n(`changeFontSize`),(e.activeTool.type===`text`||Gn(i,t))&&n(`changeTextAlign`)]}),aa(i,t)&&n(`changeVerticalAlign`),(Ms(e.activeTool.type)||i.some(e=>Ms(e.type)))&&(0,W.jsx)(W.Fragment,{children:n(`changeArrowhead`)}),n(`changeOpacity`),(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.layers`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[n(`sendToBack`),n(`sendBackward`),n(`bringForward`),n(`bringToFront`)]})]}),p&&!a&&(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.align`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[c?(0,W.jsxs)(W.Fragment,{children:[n(`alignRight`),n(`alignHorizontallyCentered`),n(`alignLeft`)]}):(0,W.jsxs)(W.Fragment,{children:[n(`alignLeft`),n(`alignHorizontallyCentered`),n(`alignRight`)]}),i.length>2&&n(`distributeHorizontally`),(0,W.jsx)(`div`,{style:{flexBasis:`100%`,height:0}}),(0,W.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`.5rem`,marginTop:`-0.5rem`},children:[n(`alignTop`),n(`alignVerticallyCentered`),n(`alignBottom`),i.length>2&&n(`distributeVertically`)]})]})]}),!o&&i.length>0&&(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.actions`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[s.formFactor!==`phone`&&n(`duplicateSelection`),s.formFactor!==`phone`&&n(`deleteSelectedElements`),n(`group`),n(`ungroup`),u&&n(`hyperlink`),f&&n(`cropEditor`),d&&n(`toggleLinearEditor`)]})]})]})},Tk=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i})=>{let a=Ir(e.activeTool.type)&&!Po(e.currentItemBackgroundColor)||r.some(e=>Ir(e.type)&&!Po(e.backgroundColor)),o=r.length>0||e.activeTool.type!==`selection`&&e.activeTool.type!==`eraser`&&e.activeTool.type!==`hand`&&e.activeTool.type!==`laser`&&e.activeTool.type!==`lasso`,s=e.openPopup===`compactStrokeStyles`;return o?(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:s,onOpenChange:e=>{n(e?{openPopup:`compactStrokeStyles`}:{openPopup:null})},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:s}),title:K(`labels.stroke`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:s?null:`compactStrokeStyles`})},children:KS})}),s&&(0,W.jsx)(CC,{className:xk,container:i,style:{maxWidth:`13rem`},onClose:()=>{},children:(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[a&&t(`changeFillStyle`),(bt(e.activeTool.type)||r.some(e=>bt(e.type)))&&t(`changeStrokeWidth`),(es(e.activeTool.type)||r.some(e=>es(e.type)))&&(0,W.jsxs)(W.Fragment,{children:[t(`changeStrokeStyle`),t(`changeSloppiness`)]}),(za(e.activeTool.type)||r.some(e=>za(e.type)))&&t(`changeRoundness`),t(`changeOpacity`)]})})]})}):null},Ek=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i,app:a})=>{let o=ko(e.activeTool.type)||r.some(e=>ko(e.type)),s=e.openPopup===`compactArrowProperties`;return o?(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:s,onOpenChange:e=>{n(e?{openPopup:`compactArrowProperties`}:{openPopup:null})},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:s}),title:K(`labels.arrowtypes`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:s?null:`compactArrowProperties`})},children:(()=>{let t=kw(r,a,e=>jt(e)?e.elbowed?`elbow`:e.roundness?`round`:`sharp`:null,e=>jt(e),t=>t?null:e.currentItemArrowType);return t===`elbow`?zS:t===`round`?BS:RS})()})}),s&&(0,W.jsx)(CC,{container:i,className:`properties-content`,style:{maxWidth:`13rem`},onClose:()=>{},children:t(`changeArrowProperties`)})]})}):null},Dk=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i,elementsMap:a})=>{let{saveCaretPosition:o,restoreCaretPosition:s}=OC(),c=e.openPopup===`compactTextProperties`;return(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:c,onOpenChange:t=>{t?(e.editingTextElement&&o(),n({openPopup:`compactTextProperties`})):(n({openPopup:null}),e.editingTextElement&&s())},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:c}),title:K(`labels.textAlign`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c?n({openPopup:null}):(e.editingTextElement&&o(),n({openPopup:`compactTextProperties`}))},children:sb})}),e.openPopup===`compactTextProperties`&&(0,W.jsx)(CC,{className:xk,container:i,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!e.editingTextElement,onClose:()=>{e.editingTextElement&&s()},children:(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[(e.activeTool.type===`text`||r.some(M))&&t(`changeFontSize`),(e.activeTool.type===`text`||Gn(r,a))&&t(`changeTextAlign`),aa(r,a)&&t(`changeVerticalAlign`)]})})]})})},Ok=({appState:e,renderAction:t,targetElements:n,setAppState:r,container:i,app:a,showDuplicate:o,showDelete:s})=>{let c=!!(e.editingTextElement||e.newElement),l=!e.croppingElementId&&n.length===1&&io(n[0]),u=n.length===1,d=lE(e,a),f=!1;n.length===2&&(xr(n[0])||xr(n[1]))&&(f=!0);let p=document.documentElement.getAttribute(`dir`)===`rtl`,m=e.openPopup===`compactOtherProperties`;return c||n.length===0?null:(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:m,onOpenChange:e=>{r(e?{openPopup:`compactOtherProperties`}:{openPopup:null})},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:m}),title:K(`labels.actions`),onClick:e=>{e.preventDefault(),e.stopPropagation(),r({openPopup:m?null:`compactOtherProperties`})},children:Hy})}),m&&(0,W.jsx)(CC,{className:xk,container:i,style:{maxWidth:`12rem`,justifyContent:`center`,alignItems:`center`},onClose:()=>{},children:(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.layers`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[t(`sendToBack`),t(`sendBackward`),t(`bringForward`),t(`bringToFront`)]})]}),d&&!f&&(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.align`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[p?(0,W.jsxs)(W.Fragment,{children:[t(`alignRight`),t(`alignHorizontallyCentered`),t(`alignLeft`)]}):(0,W.jsxs)(W.Fragment,{children:[t(`alignLeft`),t(`alignHorizontallyCentered`),t(`alignRight`)]}),n.length>2&&t(`distributeHorizontally`),(0,W.jsx)(`div`,{style:{flexBasis:`100%`,height:0}}),(0,W.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`.5rem`,marginTop:`-0.5rem`},children:[t(`alignTop`),t(`alignVerticallyCentered`),t(`alignBottom`),n.length>2&&t(`distributeVertically`)]})]})]}),(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.actions`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[t(`group`),t(`ungroup`),u&&t(`hyperlink`),l&&t(`cropEditor`),o&&t(`duplicateSelection`),s&&t(`deleteSelectedElements`)]})]})]})})]})})},kk=({appState:e,renderAction:t,targetElements:n})=>!e.selectedLinearElement?.isEditing&&n.length===1&&b(n[0])&&!dr(n[0])?(0,W.jsx)(`div`,{className:`compact-action-item`,children:t(`toggleLinearEditor`)}):null,Ak=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=si(t,e),{container:o}=oz(),s=!!(e.editingTextElement||e.newElement),c=!e.selectedLinearElement?.isEditing&&a.length===1&&b(a[0])&&!dr(a[0]);return(0,W.jsxs)(`div`,{className:`compact-shape-actions`,children:[Sk(e,a)&&(0,W.jsx)(`div`,{className:U(`compact-action-item`),children:n(`changeStrokeColor`)}),Ck(e,a)&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),(0,W.jsx)(Tk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o}),(0,W.jsx)(Ek,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,app:r}),c&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`toggleLinearEditor`)}),(e.activeTool.type===`text`||a.some(M))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,W.jsx)(Dk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,elementsMap:t})]}),!s&&a.length>0&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),!s&&a.length>0&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)}),(0,W.jsx)(Ok,{appState:e,renderAction:n,targetElements:a,setAppState:i,container:o,app:r})]})},jk=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=si(t,e),{container:o}=oz(),s=(0,H.useRef)(null),c=s.current?.getBoundingClientRect()?.width??0,l=c>=374,u=c>=412;return(0,W.jsxs)(SC,{className:`compact-shape-actions mobile-shape-actions`,style:{flexDirection:`row`,boxShadow:`none`,padding:0,zIndex:2,backgroundColor:`transparent`,height:32*1.35,marginBottom:4,alignItems:`center`,gap:6,pointerEvents:`none`},ref:s,children:[(0,W.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6,flex:1},children:[Sk(e,a)&&(0,W.jsx)(`div`,{className:U(`compact-action-item`),children:n(`changeStrokeColor`)}),Ck(e,a)&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),(0,W.jsx)(Tk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o}),(0,W.jsx)(Ek,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,app:r}),(0,W.jsx)(kk,{appState:e,renderAction:n,targetElements:a}),(e.activeTool.type===`text`||a.some(M))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,W.jsx)(Dk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,elementsMap:t})]}),(0,W.jsx)(Ok,{appState:e,renderAction:n,targetElements:a,setAppState:i,container:o,app:r,showDuplicate:!u,showDelete:!l})]}),(0,W.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6},children:[(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`undo`)}),(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`redo`)}),u&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),l&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)})]})]})},Mk=({activeTool:e,setAppState:t,app:n,UIOptions:r})=>{let[i,a]=(0,H.useState)(!1),o=az(),s=o===`full`,c=o===`compact`,l=[{type:`selection`,icon:Zy,title:Ge(K(`toolBar.selection`))},{type:`lasso`,icon:Qy,title:Ge(K(`toolBar.lasso`))}],u=e.type===`frame`,d=e.type===`laser`,f=s&&e.type===`lasso`&&n.state.preferredSelectionTool.type!==`lasso`,p=e.type===`embeddable`,{TTDDialogTriggerTunnel:m}=gk();return(0,W.jsxs)(W.Fragment,{children:[pk(n).map(({value:i,icon:a,key:o,numericKey:s,fillable:u,toolbar:d})=>{if(d===!1||r.tools?.[i]===!1)return null;let f=K(`toolBar.${i}`),p=o&&Ge(typeof o==`string`?o:o[0]),m=p?`${p} ${K(`helpDialog.or`)} ${s}`:`${s}`,h=i===`hand`?void 0:s||p;return(i===`selection`||i===`lasso`)&&c?(0,W.jsx)(bk,{app:n,options:l,activeTool:e,defaultOption:n.state.preferredSelectionTool.type,namePrefix:`selectionType`,title:Ge(K(`toolBar.selection`)),"data-testid":`toolbar-selection`,onToolChange:e=>{(e===`selection`||e===`lasso`)&&(n.setActiveTool({type:e}),t({preferredSelectionTool:{type:e,initialized:!0}}))},displayedOption:l.find(e=>e.type===n.state.preferredSelectionTool.type)||l[0],fillable:e.type===`selection`},`selection-popover`):(0,W.jsx)(X,{className:U(`Shape`,{fillable:u}),type:`radio`,icon:a,checked:e.type===i,name:`editor-current-shape`,title:`${Ge(f)} \u2014 ${m}`,keyBindingLabel:h,"aria-label":Ge(f),"aria-keyshortcuts":m,"data-testid":`toolbar-${i}`,onPointerDown:({pointerType:e})=>{!n.state.penDetected&&e===`pen`&&n.togglePenMode(!0),i===`selection`&&(n.state.activeTool.type===`selection`?n.setActiveTool({type:`lasso`}):n.setActiveTool({type:`selection`}))},onChange:({pointerType:e})=>{n.state.activeTool.type!==i&&dC(`toolbar`,i,`ui`),n.setActiveTool({type:i})}},i)}),(0,W.jsx)(`div`,{className:`App-toolbar__divider`}),(0,W.jsxs)(HO,{open:i,children:[(0,W.jsx)(HO.Trigger,{className:U(`App-toolbar__extra-tools-trigger`,{"App-toolbar__extra-tools-trigger--selected":u||p||f||d&&!n.props.isCollaborating}),onToggle:()=>{a(!i),t({openMenu:null,openPopup:null})},title:K(`toolBar.extraTools`),children:u?oS:p?mb:d&&!n.props.isCollaborating?dS:f?Qy:aS}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>a(!1),onSelect:()=>a(!1),className:`App-toolbar__extra-tools-dropdown`,children:[(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`frame`}),icon:oS,shortcut:N.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:u,children:K(`toolBar.frame`)}),(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`embeddable`}),icon:mb,"data-testid":`toolbar-embeddable`,selected:p,children:K(`toolBar.embeddable`)}),(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`laser`}),icon:dS,"data-testid":`toolbar-laser`,selected:d,shortcut:N.K.toLocaleUpperCase(),children:K(`toolBar.laser`)}),s&&(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`lasso`}),icon:Qy,"data-testid":`toolbar-lasso`,selected:f,children:K(`toolBar.lasso`)}),(0,W.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),n.props.aiEnabled!==!1&&(0,W.jsx)(m.Out,{}),(0,W.jsx)(HO.Item,{onSelect:()=>n.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:sS,"data-testid":`toolbar-embeddable`,children:K(`toolBar.mermaidToExcalidraw`)}),n.props.aiEnabled!==!1&&n.plugins.diagramToCode&&(0,W.jsx)(HO.Item,{onSelect:()=>n.onMagicframeToolSelect(),icon:fS,"data-testid":`toolbar-magicframe`,badge:(0,W.jsx)(HO.Item.Badge,{children:`AI`}),children:K(`toolBar.magicframe`)})]})]})]})},Nk=({renderAction:e,zoom:t})=>(0,W.jsx)(_O.Col,{gap:1,className:Qn.ZOOM_ACTIONS,children:(0,W.jsxs)(_O.Row,{align:`center`,children:[e(`zoomOut`),e(`resetZoom`),e(`zoomIn`)]})}),Pk=({renderAction:e,className:t})=>(0,W.jsxs)(`div`,{className:`undo-redo-buttons ${t}`,children:[(0,W.jsx)(`div`,{className:`undo-button-container`,children:(0,W.jsx)(Rw,{label:K(`buttons.undo`),children:e(`undo`)})}),(0,W.jsx)(`div`,{className:`redo-button-container`,children:(0,W.jsxs)(Rw,{label:K(`buttons.redo`),children:[` `,e(`redo`)]})})]}),Fk=({actionManager:e,showExitZenModeBtn:t})=>(0,W.jsx)(`button`,{type:`button`,className:U(`disable-zen-mode`,{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(wE),children:K(`buttons.exitZenMode`)}),Ik=({actionManager:e})=>(0,W.jsx)(`button`,{type:`button`,className:`disable-view-mode`,onClick:()=>e.executeAction(yk),children:JS}),Lk=e=>{let t=(0,H.useRef)({userFn:e});return t.current.userFn=e,t.current.stableFn||(t.current.stableFn=(...e)=>t.current.userFn(...e)),t.current.stableFn},Rk=yc(null),zk=()=>{let[e,t]=vy(Rk),n=uz();return e&&e===`clearCanvas`?(0,W.jsx)(oO,{onConfirm:()=>{n.executeAction(Zw),t(null)},onCancel:()=>t(null),title:K(`clearCanvasDialog.title`),children:(0,W.jsxs)(`p`,{className:`clear-canvas__content`,children:[` `,K(`alerts.clearReset`)]})}):null},Bk={};o(Bk,{toggleTheme:()=>Vk});var Vk={...iT,category:`App`,label:`Toggle theme`,perform:({actionManager:e})=>{e.executeAction(iT,`commandPalette`)}},Hk=yc(null),Uk={app:`App`,export:`Export`,tools:`Tools`,editor:`Editor`,elements:`Elements`,links:`Links`,library:`Library`},Wk=e=>{switch(e){case Uk.app:return 1;case Uk.export:return 2;case Uk.editor:return 3;case Uk.tools:return 4;case Uk.elements:return 5;case Uk.links:return 6;default:return 10}},Gk=({shortcut:e,className:t,children:n})=>{let r=e.replace(`++`,`+$`).split(`+`);return(0,W.jsxs)(`div`,{className:U(`shortcut`,t),children:[r.map((e,t)=>(0,W.jsx)(`div`,{className:`shortcut-wrapper`,children:(0,W.jsx)(`div`,{className:`shortcut-key`,children:e===`$`?`+`:e})},e)),(0,W.jsx)(`div`,{className:`shortcut-desc`,children:n})]})},Kk=e=>!e.altKey&&e[N.CTRL_OR_CMD]&&(e.shiftKey&&e.key.toLowerCase()===N.P||e.key===N.SLASH);Object.assign(e=>{let t=gC(),n=lz();return(0,H.useEffect)(()=>{let e=e=>{Kk(e)&&(e.preventDefault(),e.stopPropagation(),n(e=>{let t=e.openDialog?.name===`commandPalette`?null:{name:`commandPalette`};return t&&dC(`command_palette`,`open`,`shortcut`),{openDialog:t}}))};return window.addEventListener(F.KEYDOWN,e,{capture:!0}),()=>window.removeEventListener(F.KEYDOWN,e,{capture:!0})},[n]),t.openDialog?.name===`commandPalette`?(0,W.jsx)(qk,{...e}):null},{defaultItems:Bk});function qk({customCommandPaletteItems:e}){let t=nz(),n=gC(),r=lz(),i=rz(),a=uz(),[o,s]=vy(Hk),[c,l]=(0,H.useState)(null),u=(0,H.useRef)(null),d=yC({uiAppState:n,customCommandPaletteItems:e,appProps:i}),[f]=vy(KD),p=(0,H.useMemo)(()=>f.libraryItems?.filter(e=>!!e.name).map(e=>({label:e.name,icon:(0,W.jsx)(Jk,{id:e.id,elements:e.elements}),category:`Library`,order:Wk(`Library`),haystack:LD(e.name),perform:()=>{t.onInsertElements(QD([e]))}}))||[],[t,f.libraryItems]);(0,H.useEffect)(()=>{let{uiAppState:e,customCommandPaletteItems:n,appProps:i}=d,c=n=>{let r=``;return n.label&&(r=typeof n.label==`function`?K(n.label(t.scene.getNonDeletedElements(),e,t)):K(n.label)),r},u=n=>typeof n.icon==`function`?n.icon(e,t.scene.getNonDeletedElements()):n.icon,f=[],m=(e,t,n)=>{let r={label:c(e),icon:u(e),category:t,shortcut:ND(e.name),keywords:e.keywords,predicate:e.predicate,viewMode:e.viewMode,perform:()=>{a.executeAction(e,`commandPalette`)}};return n?n(r,e):r};if(e&&t.scene&&a){let d=[a.actions.group,a.actions.ungroup,a.actions.cut,a.actions.copy,a.actions.deleteSelectedElements,a.actions.wrapSelectionInFrame,a.actions.copyStyles,a.actions.pasteStyles,a.actions.bringToFront,a.actions.bringForward,a.actions.sendBackward,a.actions.sendToBack,a.actions.alignTop,a.actions.alignBottom,a.actions.alignLeft,a.actions.alignRight,a.actions.alignVerticallyCentered,a.actions.alignHorizontallyCentered,a.actions.duplicateSelection,a.actions.flipHorizontal,a.actions.flipVertical,a.actions.zoomToFitSelection,a.actions.zoomToFitSelectionInViewport,a.actions.increaseFontSize,a.actions.decreaseFontSize,a.actions.toggleLinearEditor,a.actions.cropEditor,a.actions.togglePolygon,YE,AD,jD].map(e=>m(e,Uk.elements,(e,t)=>({...e,predicate:t.predicate?t.predicate:(e,t,n,r)=>ir(e,t).length>0}))),h=[a.actions.toggleHandTool,a.actions.setFrameAsActiveTool,a.actions.toggleLassoTool].map(e=>m(e,Uk.tools)),g=[a.actions.undo,a.actions.redo,a.actions.zoomIn,a.actions.zoomOut,a.actions.resetZoom,a.actions.zoomToFit,a.actions.zenMode,a.actions.viewMode,a.actions.gridMode,a.actions.objectsSnapMode,a.actions.toggleShortcuts,a.actions.selectAll,a.actions.toggleElementLock,a.actions.unlockAllElements,a.actions.stats].map(e=>m(e,Uk.editor)),_=[a.actions.saveToActiveFile,a.actions.saveFileToDisk,a.actions.copyAsPng,a.actions.copyAsSvg].map(e=>m(e,Uk.export));f=[...d,...g,{label:c(Zw),icon:u(Zw),shortcut:ND(Zw.name),category:Uk.editor,keywords:[`delete`,`destroy`],viewMode:!1,perform:()=>{Cy.set(Rk,`clearCanvas`)}},{label:K(`buttons.exportImage`),category:Uk.export,icon:Nb,shortcut:ND(`imageExport`),keywords:[`export`,`image`,`png`,`jpeg`,`svg`,`clipboard`,`picture`],perform:()=>{r({openDialog:{name:`imageExport`}})}},..._];let v=[{label:K(`toolBar.library`),category:Uk.app,icon:zy,viewMode:!1,perform:()=>{e.openSidebar?r({openSidebar:null}):r({openSidebar:{name:At.name,tab:At.defaultTab}})}},{label:K(`search.title`),category:Uk.app,icon:vS,viewMode:!0,perform:()=>{a.executeAction(ZA)}},{label:K(`labels.shapeSwitch`),category:Uk.elements,icon:CS,perform:()=>{a.executeAction(kD)}},{label:K(`labels.changeStroke`),keywords:[`color`,`outline`],category:Uk.elements,icon:jb,viewMode:!1,predicate:(e,t)=>{let n=ir(e,t);return n.length>0&&Sk(t,n)},perform:()=>{r(e=>({openPopup:`elementStroke`}))}},{label:K(`labels.changeBackground`),keywords:[`color`,`fill`],icon:jb,category:Uk.elements,viewMode:!1,predicate:(e,t)=>{let n=ir(e,t);return n.length>0&&Ck(t,n)},perform:()=>{r(e=>({openPopup:`elementBackground`}))}},{label:K(`labels.canvasBackground`),keywords:[`color`],icon:jb,category:Uk.editor,viewMode:!1,perform:()=>{r(e=>({openMenu:e.openMenu===`canvas`?null:`canvas`,openPopup:`canvasBackground`}))}},...fk.reduce((e,n)=>{let{value:r,icon:a,key:o,numericKey:s}=n;if(i.UIOptions.tools?.[r]===!1)return e;let c=o&&Ge(typeof o==`string`?o:o[0])||s,l={label:K(`toolBar.${r}`),category:Uk.tools,shortcut:c,icon:a,keywords:[`toolbar`],viewMode:!1,perform:({event:e})=>{t.setActiveTool({type:r})}};return e.push(l),e},[]),...h,{label:K(`toolBar.lock`),category:Uk.tools,icon:e.activeTool.locked?Ky:Gy,shortcut:N.Q.toLocaleUpperCase(),viewMode:!1,perform:()=>{t.toggleLock()}},{label:`${K(`labels.textToDiagram`)}...`,category:Uk.tools,icon:_S,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`text-to-diagram`}}))}},{label:`${K(`toolBar.mermaidToExcalidraw`)}...`,category:Uk.tools,icon:sS,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`mermaid`}}))}}],y=[...f,...v,...n||[]].map(e=>({...e,icon:e.icon||CS,order:e.order??Wk(e.category),haystack:`${LD(e.label.toLocaleLowerCase())} ${e.keywords?.join(` `)||``}`}));l(y),s([...y,...p].find(e=>e.label===o?.label)??null)}},[d,t,a,l,o?.label,s,r,p]);let[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(null),[v,y]=(0,H.useState)({}),b=e=>{r({openDialog:null},e),h(``)},x=(e,t)=>{n.openDialog?.name===`commandPalette`&&(t.stopPropagation(),t.preventDefault(),document.body.classList.add(`excalidraw-animations-disabled`),b(()=>{e.perform({actionManager:a,event:t}),s(e),requestAnimationFrame(()=>{document.body.classList.remove(`excalidraw-animations-disabled`)})}))},S=Lk(e=>e.viewMode===!1&&n.viewModeEnabled?!1:typeof e.predicate==`function`?e.predicate(t.scene.getNonDeletedElements(),n,i,t):e.predicate===void 0||e.predicate),C=Lk(e=>{let t=Wr(e.target)||Kk(e)||e.key===N.ESCAPE;if(t&&e.key!==N.ARROW_UP&&e.key!==N.ARROW_DOWN&&e.key!==N.ENTER)return;let n=Object.values(v).flat(),r=o&&!m&&S(o);if(e.key===N.ARROW_UP){e.preventDefault();let t=n.findIndex(e=>e.label===g?.label);if(r){if(t===0){_(o);return}if(g===o){let e=n[n.length-1];e&&_(e);return}}let i;i=t===-1||t===0?n.length-1:(t-1)%n.length;let a=n[i];a&&_(a);return}if(e.key===N.ARROW_DOWN){e.preventDefault();let t=n.findIndex(e=>e.label===g?.label);if(r){if(!g||t===n.length-1){_(o);return}if(g===o){let e=n[0];e&&_(e);return}}let i=n[(t+1)%n.length];i&&_(i);return}if(e.key===N.ENTER&&g&&setTimeout(()=>{x(g,e)}),!t){if(e.stopPropagation(),/^[a-zA-Z0-9]$/.test(e.key)){u?.current?.focus();return}e.preventDefault()}});return(0,H.useEffect)(()=>(window.addEventListener(F.KEYDOWN,C,{capture:!0}),()=>window.removeEventListener(F.KEYDOWN,C,{capture:!0})),[C]),(0,H.useEffect)(()=>{if(!c)return;let e=e=>{let t={};for(let n of e)t[n.category]?t[n.category].push(n):t[n.category]=[n];return t},t=m?.length>1?[...c.filter(S).sort((e,t)=>e.order-t.order),...p]:c.filter(S).sort((e,t)=>e.order-t.order),n=!m&&o&&S(o);if(!m){y(e(n?t.filter(e=>e.label!==o?.label):t)),_(n?o:t[0]||null);return}let r=LD(m.toLocaleLowerCase().replace(/[<>_| -]/g,``));t=dv.default.filter(r,t,{extract:e=>e.haystack??``}).sort((e,t)=>t.score-e.score).map(e=>e.original),y(e(t)),_(t[0]??null)},[m,c,S,o,p]),(0,W.jsxs)(dk,{onCloseRequest:()=>b(),closeOnClickOutside:!0,title:!1,size:720,autofocus:!0,className:`command-palette-dialog`,children:[(0,W.jsx)($O,{value:m,placeholder:K(`commandPalette.search.placeholder`),onChange:e=>{h(e)},selectOnRender:!0,ref:u}),t.editorInterface.formFactor!==`phone`&&(0,W.jsxs)(`div`,{className:`shortcuts-wrapper`,children:[(0,W.jsx)(Gk,{shortcut:`↑↓`,children:K(`commandPalette.shortcuts.select`)}),(0,W.jsx)(Gk,{shortcut:`↵`,children:K(`commandPalette.shortcuts.confirm`)}),(0,W.jsx)(Gk,{shortcut:Q(`Esc`),children:K(`commandPalette.shortcuts.close`)})]}),(0,W.jsxs)(`div`,{className:`commands`,children:[o&&!m&&(0,W.jsxs)(`div`,{className:`command-category`,children:[(0,W.jsxs)(`div`,{className:`command-category-title`,children:[K(`commandPalette.recents`),(0,W.jsx)(`div`,{className:`icon`,style:{marginLeft:`6px`},children:yS})]}),(0,W.jsx)(Yk,{command:o,isSelected:o.label===g?.label,onClick:e=>x(o,e),disabled:!S(o),onMouseMove:()=>_(o),showShortcut:t.editorInterface.formFactor!==`phone`,appState:n})]}),Object.keys(v).length>0?Object.keys(v).map((e,r)=>(0,W.jsxs)(`div`,{className:`command-category`,children:[(0,W.jsx)(`div`,{className:`command-category-title`,children:e}),v[e].map(r=>(0,W.jsx)(Yk,{command:r,isSelected:r.label===g?.label,onClick:e=>x(r,e),onMouseMove:()=>_(r),showShortcut:t.editorInterface.formFactor!==`phone`,appState:n,size:e===`Library`?`large`:`small`},r.label))]},e)):c?(0,W.jsxs)(`div`,{className:`no-match`,children:[(0,W.jsx)(`div`,{className:`icon`,children:vS}),` `,K(`commandPalette.search.noMatch`)]}):null]})]})}var Jk=({id:e,elements:t})=>{let n=(0,H.useRef)(null),{svgCache:r}=WD();return UD(e,t,r,n),(0,W.jsx)(`div`,{className:`library-item-icon`,ref:n})},Yk=({command:e,isSelected:t,disabled:n,onMouseMove:r,onClick:i,showShortcut:a,appState:o,size:s=`small`})=>{let c=()=>{};return(0,W.jsxs)(`div`,{className:U(`command-item`,{"item-selected":t,"item-disabled":n,"command-item-large":s===`large`}),ref:e=>{t&&!n&&e?.scrollIntoView?.({block:`nearest`})},onClick:n?c:i,onMouseMove:n?c:r,title:n?K(`commandPalette.itemNotAvailable`):``,children:[(0,W.jsxs)(`div`,{className:`name`,children:[e.icon&&(0,W.jsx)(mw,{className:`icon`,size:`var(--icon-size, 1rem)`,icon:typeof e.icon==`function`?e.icon(o,[]):e.icon}),(0,W.jsx)(nw,{children:e.label})]}),a&&e.shortcut&&(0,W.jsx)(Gk,{shortcut:e.shortcut})]})},Xk=e=>{if(!e)return[];for(let t of e.sets)if(t.type===`path`)return t.ops;return e.sets[0].ops},Zk=e=>!!e&&e.type===`embeddable`,Qk=e=>!!e&&e.type===`iframe`,$k=e=>!!e&&(e.type===`iframe`||e.type===`embeddable`),eA=e=>e!=null&&e.type===`text`,tA=e=>e!=null&&(e.type===`frame`||e.type===`magicframe`),nA=e=>e!=null&&aA(e.type),rA=e=>e!=null&&e.type===`arrow`,iA=e=>rA(e)&&e.elbowed,aA=e=>e===`arrow`||e===`line`,oA=e=>e!==null&&`containerId`in e&&e.containerId!==null&&eA(e),sA=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return Se(n,r)<=8/t}return!1},cA=(e,t)=>{if(t.roundness?.type===Xa.PROPORTIONAL_RADIUS||t.roundness?.type===Xa.LEGACY)return e*qt;if(t.roundness?.type===Xa.ADAPTIVE_RADIUS){let n=t.roundness?.value??32;return e<=n/.25?e*qt:n}return 0};`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`.toLocaleUpperCase();var lA=[1,0],uA=[0,1],dA=[-1,0],fA=[0,-1],pA=e=>{let[t,n]=e,r=Math.abs(t),i=Math.abs(n);return t>i?lA:t<=-i?dA:n>r?uA:fA},mA=(e,t)=>pA(Mn(e,t)),hA=(e,t)=>_A(mA(e,t)),gA=(e,t)=>e[0]===t[0]&&e[1]===t[1],_A=e=>gA(e,lA)||gA(e,dA),vA=e=>{let t=Math.floor(e.width/2)+1,n=e.width,r=Math.floor(e.height/2)+1;return[t,0,n,r,t,e.height,0,r]},yA=20,bA=15,xA=e=>{switch(e){case`arrow`:return 25;case`diamond`:case`diamond_outline`:return 12;case`cardinality_many`:case`cardinality_one_or_many`:case`cardinality_zero_or_many`:return bA;case`cardinality_one`:case`cardinality_exactly_one`:case`cardinality_zero_or_one`:return yA;default:return 15}},SA=e=>{switch(e){case`bar`:return 90;case`arrow`:return 20;default:return 25}},CA=(e,t,n,r,i=0)=>{if(r===null||t.length<1)return null;let a=Xk(t[0]);if(a.length<1)return null;let o=n===`start`?1:a.length-1,s=a[o].data;gt(s.length===6,`Op data length is not 6`);let c=O(s[4],s[5]),l=O(s[2],s[3]),u=O(s[0],s[1]),d=a[o-1],f=O(0,0);if(d.op===`move`){let e=Vn(d.data);gt(e!=null,`Op data is not a point`),f=e}else d.op===`bcurveTo`&&(f=O(d.data[4],d.data[5]));let p=(e,t)=>(1-e)**3*c[t]+3*e*(1-e)**2*l[t]+3*e**2*(1-e)*u[t]+f[t]*e**3,[m,h]=n===`start`?f:c,[g,_]=[p(.3,0),p(.3,1)],v=Math.hypot(m-g,h-_),y=(m-g)/v,b=(h-_)/v,x=xA(r),S=0;{let[t,r]=n===`end`?e.points[e.points.length-1]:e.points[0],[i,a]=e.points.length>1?n===`end`?e.points[e.points.length-2]:e.points[1]:[0,0];S=Math.hypot(t-i,r-a)}let C=Math.min(x,S*(r===`diamond`||r===`diamond_outline`?.25:.5)),w=m-y*C*i,T=h-b*C*i,E=w-y*C,D=T-b*C;if(r===`circle`||r===`circle_outline`)return[w,T,Math.hypot(D-T,E-w)+e.strokeWidth-2];let k=SA(r);if(r===`cardinality_many`||r===`cardinality_one_or_many`){let[e,t]=ke(O(w,T),O(E,D),Pt(-k)),[n,r]=ke(O(w,T),O(E,D),Pt(k));return[E,D,e,t,n,r]}let[A,ee]=ke(O(E,D),O(w,T),-k*Math.PI/180),[te,ne]=ke(O(E,D),O(w,T),Pt(k));if(r===`diamond`||r===`diamond_outline`){let t,r;if(n===`start`){let[n,i]=e.points.length>1?e.points[1]:[0,0];[t,r]=ke(O(w+C*2,T),O(w,T),Math.atan2(i-T,n-w))}else{let[n,i]=e.points.length>1?e.points[e.points.length-2]:[0,0];[t,r]=ke(O(w-C*2,T),O(w,T),Math.atan2(T-i,w-n))}return[w,T,A,ee,t,r,te,ne]}return[w,T,A,ee,te,ne]};(function(){let e=null,t=null,n=null,r=(r,i,a,o)=>{if(n!==void 0&&i===t&&r===e&&a.editingGroupId===n?.editingGroupId)return n;let s={};for(let e of r){let t=e.groupIds;if(a.editingGroupId){let e=t.indexOf(a.editingGroupId);e>-1&&(t=t.slice(0,e))}if(t.length>0){let e=t[t.length-1];s[e]=!0}}let c={},l=i.reduce((e,t)=>{if(t.isDeleted)return e;let n=t.groupIds.find(e=>s[e]);return n&&(e[t.id]=!0,Array.isArray(c[n])?c[n].push(t.id):c[n]=[t.id]),e},{});for(let e of Object.keys(c))c[e].length<2&&s[e]&&(s[e]=!1);return t=i,e=r,n={editingGroupId:a.editingGroupId,selectedGroupIds:s,selectedElementIds:TA({...a.selectedElementIds,...l},o)},n},i=(e,t,n,i)=>{let a=i?i.scene.getSelectedElements({selectedElementIds:e.selectedElementIds,elements:t}):wA(t,e);return a.length?r(a,t,e,n):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:TA(e.selectedElementIds,n)}};return i.clearCache=()=>{t=null,e=null,n=null},i})(),(function(){let e=null,t=null,n=null,r=(r,i)=>(n!=null&&r===e&&i.selectedElementIds===t||(n=r.some(e=>i.selectedElementIds[e.id]),e=r,t=i.selectedElementIds),n);return r.clearCache=()=>{e=null,t=null,n=null},r})();var wA=(e,t,n)=>{let r=new Set,i=[];for(let a of e.values()){if(t.selectedElementIds[a.id]){i.push(a),r.add(a.id);continue}if(n?.includeBoundTextElement&&oA(a)&&t.selectedElementIds[a?.containerId]){i.push(a),r.add(a.id);continue}}if(n?.includeElementsInFrames){let t=[];return i.forEach(n=>{tA(n)&&EA(e,n.id).forEach(e=>!r.has(e.id)&&t.push(e)),t.push(n)}),t}return i},TA=(e,t)=>ji(t.selectedElementIds,e)?t.selectedElementIds:e,EA=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n},DA=typeof document<`u`?document.createElement(`img`):{src:``};DA.src=`data:${hs.svg},%3Csvg%20aria-hidden%3D%22true%22%20focusable%3D%22false%22%20data-prefix%3D%22fas%22%20data-icon%3D%22image%22%20class%3D%22svg-inline--fa%20fa-image%20fa-w-16%22%20role%3D%22img%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20fill%3D%22%23888%22%20d%3D%22M464%20448H48c-26.51%200-48-21.49-48-48V112c0-26.51%2021.49-48%2048-48h416c26.51%200%2048%2021.49%2048%2048v288c0%2026.51-21.49%2048-48%2048zM112%20120c-30.928%200-56%2025.072-56%2056s25.072%2056%2056%2056%2056-25.072%2056-56-25.072-56-56-56zM64%20384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971%200L208%20320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971%200L64%20336v48z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E`;var OA=typeof document<`u`?document.createElement(`img`):{src:``};OA.src=`data:${hs.svg},%3Csvg%20viewBox%3D%220%200%20668%20668%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xml%3Aspace%3D%22preserve%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%22%3E%3Cpath%20d%3D%22M464%20448H48c-26.51%200-48-21.49-48-48V112c0-26.51%2021.49-48%2048-48h416c26.51%200%2048%2021.49%2048%2048v288c0%2026.51-21.49%2048-48%2048ZM112%20120c-30.928%200-56%2025.072-56%2056s25.072%2056%2056%2056%2056-25.072%2056-56-25.072-56-56-56ZM64%20384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971%200L208%20320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971%200L64%20336v48Z%22%20style%3D%22fill%3A%23888%3Bfill-rule%3Anonzero%22%20transform%3D%22matrix(.81709%200%200%20.81709%20124.825%20145.825)%22%2F%3E%3Cpath%20d%3D%22M256%208C119.034%208%208%20119.033%208%20256c0%20136.967%20111.034%20248%20248%20248s248-111.034%20248-248S392.967%208%20256%208Zm130.108%20117.892c65.448%2065.448%2070%20165.481%2020.677%20235.637L150.47%20105.216c70.204-49.356%20170.226-44.735%20235.638%2020.676ZM125.892%20386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53%20406.784c-70.203%2049.356-170.226%2044.736-235.638-20.676Z%22%20style%3D%22fill%3A%23888%3Bfill-rule%3Anonzero%22%20transform%3D%22matrix(.30366%200%200%20.30366%20506.822%2060.065)%22%2F%3E%3C%2Fsvg%3E`;var kA=new WeakMap,AA=e=>e===`rectangle`||e===`iframe`||e===`embeddable`||e===`line`||e===`diamond`||e===`image`,jA=class{};i(jA,`rg`,new fa),i(jA,`cache`,new WeakMap),i(jA,`get`,(e,t)=>{let n=jA.cache.get(e);if(n&&(t===null||n.theme===t))return n.shape}),i(jA,`delete`,e=>{jA.cache.delete(e),kA.delete(e)}),i(jA,`destroy`,()=>{jA.cache=new WeakMap}),i(jA,`generateElementShape`,(e,t)=>{let n=t?.isExporting?void 0:jA.get(e,t?t.theme:null);if(n!==void 0)return n;kA.delete(e);let r=HA(e,jA.rg,t||{isExporting:!1,canvasBackgroundColor:hi.white,embedsValidationStatus:null,theme:R.LIGHT});return t?.isExporting||jA.cache.set(e,{shape:r,theme:t?.theme||R.LIGHT}),r});var MA=e=>[8,8+e],NA=e=>[1.5,6+e];function PA(e){let t=e.roughness,n=Math.max(e.width,e.height),r=Math.min(e.width,e.height);return r>=20&&n>=50||r>=15&&e.roundness&&AA(e.type)||nA(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var FA=(e,t=!1,n=!1)=>{let r={seed:e.seed,strokeLineDash:e.strokeStyle===`dashed`?MA(e.strokeWidth):e.strokeStyle===`dotted`?NA(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!==`solid`,strokeWidth:e.strokeStyle===`solid`?e.strokeWidth:e.strokeWidth+.5,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:PA(e),stroke:n?D(e.strokeColor):e.strokeColor,preserveVertices:t||e.roughness<Ia.cartoonist};switch(e.type){case`rectangle`:case`iframe`:case`embeddable`:case`diamond`:case`ellipse`:return r.fillStyle=e.fillStyle,r.fill=Po(e.backgroundColor)?void 0:n?D(e.backgroundColor):e.backgroundColor,e.type===`ellipse`&&(r.curveFitting=1),r;case`line`:case`freedraw`:return sA(e.points)&&(r.fillStyle=e.fillStyle,r.fill=e.backgroundColor===`transparent`?void 0:n?D(e.backgroundColor):e.backgroundColor),r;case`arrow`:return r;default:throw Error(`Unimplemented type ${e.type}`)}},IA=(e,t,n)=>$k(e)&&(t||Zk(e)&&n?.get(e.id)!==!0)&&Po(e.backgroundColor)&&Po(e.strokeColor)?{...e,roughness:0,backgroundColor:`#d3d3d3`,fillStyle:`solid`}:Qk(e)?{...e,strokeColor:Po(e.strokeColor)?`#000000`:e.strokeColor,backgroundColor:Po(e.backgroundColor)?`#f4f4f6`:e.backgroundColor}:e,LA=(e,t,n)=>{if(t===null)return[];let[,,r,i,a,o]=t;return[e.line(r,i,a,o,n)]},RA=(e,t,n)=>{if(t===null)return[];let[r,i,a,o,s,c]=t;return[e.line(a,o,r,i,n),e.line(s,c,r,i,n)]},zA=(e,t)=>{let n={...t};if(e.strokeStyle===`dotted`){let t=NA(e.strokeWidth-1);n.strokeLineDash=[t[0],t[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},BA=(e,t,n,r,i,a=1)=>{if(r===null)return[];let[o,s,c]=r,l={...t,fill:i,fillStyle:`solid`,stroke:n,roughness:Math.min(.5,t.roughness||0)};return delete l.strokeLineDash,[e.circle(o,s,c*a,l)]},VA=(e,t,n,r,i,a,o,s)=>{if(r===null)return[];let c=s?D(e.strokeColor):e.strokeColor,l=s?D(o):o,u=.8;switch(r){case`circle`:case`circle_outline`:return BA(i,a,c,CA(e,t,n,r),r===`circle_outline`?l:c);case`triangle`:case`triangle_outline`:{let o=CA(e,t,n,r);if(o===null)return[];let[s,u,d,f,p,m]=o,h={...a,fill:r===`triangle_outline`?l:c,fillStyle:`solid`,roughness:Math.min(1,a.roughness||0)};return delete h.strokeLineDash,[i.polygon([[s,u],[d,f],[p,m],[s,u]],h)]}case`diamond`:case`diamond_outline`:{let o=CA(e,t,n,r);if(o===null)return[];let[s,u,d,f,p,m,h,g]=o,_={...a,fill:r===`diamond_outline`?l:c,fillStyle:`solid`,roughness:Math.min(1,a.roughness||0)};return delete _.strokeLineDash,[i.polygon([[s,u],[d,f],[p,m],[h,g],[s,u]],_)]}case`cardinality_one`:return LA(i,CA(e,t,n,r),zA(e,a));case`cardinality_many`:return RA(i,CA(e,t,n,r),zA(e,a));case`cardinality_one_or_many`:{let r=zA(e,a);return[...RA(i,CA(e,t,n,`cardinality_many`),r),...LA(i,CA(e,t,n,`cardinality_one`,-.25),r)]}case`cardinality_exactly_one`:{let r=zA(e,a);return[...LA(i,CA(e,t,n,`cardinality_one`,-.5),r),...LA(i,CA(e,t,n,`cardinality_one`),r)]}case`cardinality_zero_or_one`:{let r=zA(e,a);return[...BA(i,a,c,CA(e,t,n,`circle_outline`,1.5),l,u),...LA(i,CA(e,t,n,`cardinality_one`,-.5),r)]}case`cardinality_zero_or_many`:{let r=zA(e,a);return[...RA(i,CA(e,t,n,`cardinality_many`),r),...BA(i,a,c,CA(e,t,n,`circle_outline`,1.5),l,u)]}default:return RA(i,CA(e,t,n,r),zA(e,a))}},HA=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i,theme:a})=>{let o=a===R.DARK;switch(e.type){case`rectangle`:case`iframe`:case`embeddable`:{let r;if(e.roundness){let a=e.width,s=e.height,c=cA(Math.min(a,s),e);r=t.path(`M ${c} 0 L ${a-c} 0 Q ${a} 0, ${a} ${c} L ${a} ${s-c} Q ${a} ${s}, ${a-c} ${s} L ${c} ${s} Q 0 ${s}, 0 ${s-c} L 0 ${c} Q 0 0, ${c} 0`,FA(IA(e,n,i),!0,o))}else r=t.rectangle(0,0,e.width,e.height,FA(IA(e,n,i),!1,o));return r}case`diamond`:{let n,[r,i,a,s,c,l,u,d]=vA(e);if(e.roundness){let f=cA(Math.abs(r-u),e),p=cA(Math.abs(s-i),e);n=t.path(`M ${r+f} ${i+p} L ${a-f} ${s-p}
|
|
@@ -65,7 +65,7 @@ ${K(`hints.firefox_clipboard_write`)}`):Error(K(`alerts.couldNotCopyToClipboard`
|
|
|
65
65
|
`).filter(e=>e.trim().length>0).map(e=>e.split(t).map(e=>e.trim())),n=[` `,`,`,`;`].map(e=>{let n=t(e),r=n[0]?.length??0;return{delimiter:e,parsed:n,numCols:r,isConsistent:n.length>0&&n.every(e=>e.length===r)}}),r=(n.find(e=>e.isConsistent&&e.numCols>1)??n.find(e=>e.isConsistent)??n[0]).parsed;if(r.length===0)return{ok:!1,reason:`No values`};let i=r[0].length;return r.every(e=>e.length===i)?mN(r):{ok:!1,reason:`All rows don't have same number of columns`}},gN=(e,t,n,r)=>{if(!BM(e,`radar`))return null;let i=e.labels??e.series[0].values.map((e,t)=>`Value ${t+1}`),a=e.series,{normalize:o,renderSteps:s}=YM(a,i.length),c=qM(r),l=JM(c),d=KM(a.length,c),{chartWidth:f,chartHeight:p}=WM(),m=t+f/2,h=n-p/2,g=TM/2,_=i.map((e,t)=>-Math.PI/2+Math.PI*2*t/i.length),{axisLabels:v,axisLabelTopY:y,axisLabelBottomY:b}=QM(i,_,m,h,g,l),x=to[`Lilita One`],S=os.xl,C=ba(x),w=u({fontFamily:x,fontSize:S}),T=e.title?ZM(e.title,w,f+OM*2):null,E=T?gn(T,w,C):null,D=T?Li({backgroundColor:l,...LM,text:T,originalText:e.title??T,x:t+f/2,y:y-OM-E.height/2,fontFamily:x,fontSize:S,lineHeight:C,textAlign:`center`}):null,k=s?Array.from({length:DM},(e,t)=>{let n=g*((t+1)/DM),r=_.map(e=>O(Math.cos(e)*n,Math.sin(e)*n));return r.push(O(r[0][0],r[0][1])),Tn({backgroundColor:`transparent`,...LM,type:`line`,x:m,y:h,width:n*2,height:n*2,strokeStyle:`solid`,roughness:Ia.architect,opacity:EM,polygon:!0,points:r})}):[],A=_.map(e=>{let t=Math.cos(e)*g,n=Math.sin(e)*g;return Tn({backgroundColor:`transparent`,...LM,type:`line`,x:m,y:h,width:Math.abs(t),height:Math.abs(n),strokeStyle:`solid`,roughness:Ia.architect,opacity:EM,points:[O(0,0),O(t,n)]})}),ee=a.map((e,t)=>{let n=_.map((t,n)=>{let r=o(e.values[n]??0,n)*g;return O(Math.cos(t)*r,Math.sin(t)*r)});return n.push(O(n[0][0],n[0][1])),Tn({backgroundColor:`transparent`,...LM,type:`line`,x:m,y:h,width:g*2,height:g*2,strokeColor:d[t],strokeWidth:2,polygon:!0,points:n})}),te=$M(a,d,m,b,n+wM*5,l);return[...D?[D]:[],...v,...k,...A,...ee,...te]},_N=(e,t,n,r,i)=>e===`line`?dN(t,n,r,i):e===`radar`?gN(t,n,r,i):uN(t,n,r,i),vN=()=>(0,W.jsxs)(`div`,{"data-testid":`brave-measure-text-error`,children:[(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line1`,bold:e=>(0,W.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line2`,bold:e=>(0,W.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line3`,link:e=>(0,W.jsx)(`a`,{href:`http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser`,children:e})})}),(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line4`,issueLink:e=>(0,W.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw/issues/new`,children:e}),discordLink:e=>(0,W.jsxs)(`a`,{href:`https://discord.gg/UexuTaE`,children:[e,`.`]})})})]}),yN=({children:e,left:t,top:n,onCloseRequest:r,fitInViewport:i=!1,offsetLeft:a=0,offsetTop:o=0,viewportWidth:s=window.innerWidth,viewportHeight:c=window.innerHeight,className:l})=>{let u=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=u.current;if(!e)return;e.contains(document.activeElement)||e.focus();let t=t=>{if(t.key===N.TAB){let n=is(e),{activeElement:r}=document,i=n.findIndex(e=>e===r);r===e?(t.shiftKey?n[n.length-1]?.focus():n[0].focus(),t.preventDefault(),t.stopImmediatePropagation()):i===0&&t.shiftKey?(n[n.length-1]?.focus(),t.preventDefault(),t.stopImmediatePropagation()):i===n.length-1&&!t.shiftKey&&(n[0]?.focus(),t.preventDefault(),t.stopImmediatePropagation())}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[]);let d=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{if(i&&u.current&&n!=null&&t!=null){let e=u.current,{width:r,height:i}=e.getBoundingClientRect();if(d.current?.top===n&&d.current?.left===t)return;d.current={top:n,left:t},r>=s?(e.style.width=`${s}px`,e.style.left=`0px`,e.style.overflowX=`scroll`):t+r-a>s?e.style.left=`${s-r-10}px`:e.style.left=`${t}px`,i>=c?(e.style.height=`${c-20}px`,e.style.top=`10px`,e.style.overflowY=`scroll`):n+i-o>c?e.style.top=`${c-i}px`:e.style.top=`${n}px`}},[n,t,i,s,c,a,o]),(0,H.useEffect)(()=>{if(r){let e=e=>{u.current?.contains(e.target)||(0,_c.unstable_batchedUpdates)(()=>r(e))};return document.addEventListener(`pointerdown`,e,!1),()=>document.removeEventListener(`pointerdown`,e,!1)}},[r]),(0,W.jsx)(`div`,{className:U(`popover`,l),ref:u,tabIndex:-1,children:e})},bN=`separator`,xN=H.memo(({actionManager:e,items:t,top:n,left:r,onClose:i})=>{let a=cz(),o=sz(),s=t.reduce((t,n)=>(n&&(n===bN||!n.predicate||n.predicate(o,a,e.app.props,e.app))&&t.push(n),t),[]);return(0,W.jsx)(yN,{onCloseRequest:()=>{i()},top:n,left:r,fitInViewport:!0,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop,viewportWidth:a.width,viewportHeight:a.height,className:`context-menu-popover`,children:(0,W.jsx)(`ul`,{className:`context-menu`,onContextMenu:e=>e.preventDefault(),children:s.map((t,n)=>{if(t===bN)return!s[n-1]||s[n-1]===bN?null:(0,W.jsx)(`hr`,{className:`context-menu-item-separator`},n);let r=t.name,c=``;return t.label&&(c=typeof t.label==`function`?K(t.label(o,a,e.app)):K(t.label)),(0,W.jsx)(`li`,{"data-testid":r,onClick:()=>{i(()=>{e.executeAction(t,`contextMenu`)})},children:(0,W.jsxs)(`button`,{type:`button`,className:U(`context-menu-item`,{dangerous:r===`deleteSelectedElements`,checkmark:t.checked?.(a)}),children:[(0,W.jsx)(`div`,{className:`context-menu-item__label`,children:c}),(0,W.jsx)(`kbd`,{className:`context-menu-item__shortcut`,children:r?ND(r):``})]})},n)})})})}),SN=({height:e,width:t,userToFollow:n,onDisconnect:r})=>(0,W.jsx)(`div`,{className:`follow-mode`,style:{width:t,height:e},children:(0,W.jsxs)(`div`,{className:`follow-mode__badge`,children:[(0,W.jsxs)(`div`,{className:`follow-mode__badge__label`,children:[`Following`,` `,(0,W.jsx)(`span`,{className:`follow-mode__badge__username`,title:n.username,children:n.username})]}),(0,W.jsx)(`button`,{type:`button`,onClick:r,className:`follow-mode__disconnect-btn`,children:nx})]})}),CN=({delay:e,theme:t})=>{let[n,r]=(0,H.useState)(!!e);return(0,H.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{r(!1)},e);return()=>clearTimeout(t)},[e]),n?null:(0,W.jsxs)(`div`,{className:U(`LoadingMessage`,{"LoadingMessage--dark":t===R.DARK}),children:[(0,W.jsx)(`div`,{children:(0,W.jsx)($S,{})}),(0,W.jsx)(`div`,{className:`LoadingMessage-text`,children:K(`labels.loadingScene`)})]})},wN=`medium`,TN={CHECKED:Ky,UNCHECKED:Gy},EN=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__lock`,`ToolIcon_size_${wN}`,{"is-mobile":e.isMobile}),title:`${e.title} \u2014 Q`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":`toolbar-lock`}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:e.checked?TN.CHECKED:TN.UNCHECKED})]}),DN=e=>(0,W.jsx)(X,{className:U(`Shape`,{fillable:!1,active:e.checked}),type:`radio`,icon:Zx,name:`editor-current-shape`,checked:e.checked,title:`${e.title} \u2014 H`,keyBindingLabel:e.isMobile?void 0:N.H.toLocaleUpperCase(),"aria-label":`${e.title} \u2014 H`,"aria-keyshortcuts":N.H,"data-testid":`toolbar-hand`,onChange:()=>e.onChange?.()}),ON=[{type:`rectangle`,icon:$y,title:Ge(K(`toolBar.rectangle`))},{type:`diamond`,icon:eb,title:Ge(K(`toolBar.diamond`))},{type:`ellipse`,icon:tb,title:Ge(K(`toolBar.ellipse`))}],kN=[{type:`selection`,icon:Zy,title:Ge(K(`toolBar.selection`))},{type:`lasso`,icon:Qy,title:Ge(K(`toolBar.lasso`))}],AN=[{type:`arrow`,icon:nb,title:Ge(K(`toolBar.arrow`))},{type:`line`,icon:rb,title:Ge(K(`toolBar.line`))}],jN=({app:e,onHandToolToggle:t,setAppState:n})=>{let r=e.state.activeTool,[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(`rectangle`),[c,l]=(0,H.useState)(`arrow`);(0,H.useEffect)(()=>{(r.type===`rectangle`||r.type===`diamond`||r.type===`ellipse`)&&s(r.type)},[r.type]),(0,H.useEffect)(()=>{(r.type===`arrow`||r.type===`line`)&&l(r.type)},[r.type]);let u=r.type===`frame`,d=r.type===`laser`,f=r.type===`embeddable`,{TTDDialogTriggerTunnel:p}=gk(),m=(t,n)=>{e.state.activeTool.type!==t&&dC(`toolbar`,t,`ui`),t===`selection`?e.state.activeTool.type===`selection`||e.setActiveTool({type:`selection`}):e.setActiveTool({type:t})},[h,g]=(0,H.useState)(0),_=h>=316,v=h>=356,y=h>=396,b=[`text`,`frame`,`embeddable`,`laser`,`magicframe`].filter(e=>!(_&&e===`text`||v&&e===`image`||y&&e===`frame`)).includes(r.type),x=b?r.type===`text`?ob:r.type===`image`?cb:r.type===`frame`?oS:r.type===`embeddable`?mb:r.type===`laser`?dS:r.type===`magicframe`?fS:aS:aS;return(0,W.jsxs)(`div`,{className:`mobile-toolbar`,ref:e=>{e&&g(e.getBoundingClientRect().width)},children:[(0,W.jsx)(DN,{checked:Fs(e.state),onChange:t,title:K(`toolBar.hand`),isMobile:!0}),(0,W.jsx)(bk,{app:e,options:kN,activeTool:r,defaultOption:e.state.preferredSelectionTool.type,namePrefix:`selectionType`,title:Ge(K(`toolBar.selection`)),"data-testid":`toolbar-selection`,onToolChange:t=>{(t===`selection`||t===`lasso`)&&(e.setActiveTool({type:t}),n({preferredSelectionTool:{type:t,initialized:!0}}))},displayedOption:kN.find(t=>t.type===e.state.preferredSelectionTool.type)||kN[0]}),(0,W.jsx)(X,{className:U({active:r.type===`freedraw`}),type:`radio`,icon:ab,checked:r.type===`freedraw`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.freedraw`))}`,"aria-label":Ge(K(`toolBar.freedraw`)),"data-testid":`toolbar-freedraw`,onChange:()=>m(`freedraw`)}),(0,W.jsx)(X,{className:U({active:r.type===`eraser`}),type:`radio`,icon:lb,checked:r.type===`eraser`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.eraser`))}`,"aria-label":Ge(K(`toolBar.eraser`)),"data-testid":`toolbar-eraser`,onChange:()=>m(`eraser`)}),(0,W.jsx)(bk,{app:e,options:ON,activeTool:r,defaultOption:o,namePrefix:`shapeType`,title:Ge(K(o===`rectangle`?`toolBar.rectangle`:o===`diamond`?`toolBar.diamond`:o===`ellipse`?`toolBar.ellipse`:`toolBar.rectangle`)),"data-testid":`toolbar-rectangle`,onToolChange:t=>{(t===`rectangle`||t===`diamond`||t===`ellipse`)&&(s(t),e.setActiveTool({type:t}))},displayedOption:ON.find(e=>e.type===o)||ON[0]}),(0,W.jsx)(bk,{app:e,options:AN,activeTool:r,defaultOption:c,namePrefix:`linearElementType`,title:Ge(K(c===`arrow`?`toolBar.arrow`:`toolBar.line`)),"data-testid":`toolbar-arrow`,fillable:!0,onToolChange:t=>{(t===`arrow`||t===`line`)&&(l(t),e.setActiveTool({type:t}))},displayedOption:AN.find(e=>e.type===c)||AN[0]}),_&&(0,W.jsx)(X,{className:U({active:r.type===`text`}),type:`radio`,icon:ob,checked:r.type===`text`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.text`))}`,"aria-label":Ge(K(`toolBar.text`)),"data-testid":`toolbar-text`,onChange:()=>m(`text`)}),v&&(0,W.jsx)(X,{className:U({active:r.type===`image`}),type:`radio`,icon:cb,checked:r.type===`image`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.image`))}`,"aria-label":Ge(K(`toolBar.image`)),"data-testid":`toolbar-image`,onChange:()=>m(`image`)}),y&&(0,W.jsx)(X,{className:U({active:u}),type:`radio`,icon:oS,checked:u,name:`editor-current-shape`,title:`${Ge(K(`toolBar.frame`))}`,"aria-label":Ge(K(`toolBar.frame`)),"data-testid":`toolbar-frame`,onChange:()=>m(`frame`)}),(0,W.jsxs)(HO,{open:i,children:[(0,W.jsx)(HO.Trigger,{className:U(`App-toolbar__extra-tools-trigger App-toolbar__extra-tools-trigger--mobile`,{"App-toolbar__extra-tools-trigger--selected":b||i}),onToggle:()=>{a(!i),n({openMenu:null,openPopup:null})},title:K(`toolBar.extraTools`),style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`},children:x}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>a(!1),onSelect:()=>a(!1),className:`App-toolbar__extra-tools-dropdown`,align:`start`,children:[!_&&(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`text`}),icon:ob,shortcut:N.T.toLocaleUpperCase(),"data-testid":`toolbar-text`,selected:r.type===`text`,children:K(`toolBar.text`)}),!v&&(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`image`}),icon:cb,"data-testid":`toolbar-image`,selected:r.type===`image`,children:K(`toolBar.image`)}),!y&&(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`frame`}),icon:oS,shortcut:N.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:u,children:K(`toolBar.frame`)}),(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`embeddable`}),icon:mb,"data-testid":`toolbar-embeddable`,selected:f,children:K(`toolBar.embeddable`)}),(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`laser`}),icon:dS,"data-testid":`toolbar-laser`,selected:d,shortcut:N.K.toLocaleUpperCase(),children:K(`toolBar.laser`)}),(0,W.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),e.props.aiEnabled!==!1&&(0,W.jsx)(p.Out,{}),(0,W.jsx)(HO.Item,{onSelect:()=>e.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:sS,"data-testid":`toolbar-embeddable`,children:K(`toolBar.mermaidToExcalidraw`)}),e.props.aiEnabled!==!1&&e.plugins.diagramToCode&&(0,W.jsx)(W.Fragment,{children:(0,W.jsx)(HO.Item,{onSelect:()=>e.onMagicframeToolSelect(),icon:fS,"data-testid":`toolbar-magicframe`,badge:(0,W.jsx)(HO.Item.Badge,{children:`AI`}),children:K(`toolBar.magicframe`)})})]})]})]})},MN=({children:e,side:t,className:n})=>(0,W.jsx)(`div`,{className:U(`FixedSideContainer`,`FixedSideContainer_side_${t}`,n),children:e}),NN=`medium`,PN=e=>e.penDetected?(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__penMode`,`ToolIcon_size_${NN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:ib})]}):null,FN=({appState:e,elements:t,actionManager:n,setAppState:r,onHandToolToggle:i,renderTopLeftUI:a,renderTopRightUI:o,renderSidebars:s,renderWelcomeScreen:c,UIOptions:l,app:u,onPenModeToggle:d})=>{let{WelcomeScreenCenterTunnel:f,MainMenuTunnel:p,DefaultSidebarTriggerTunnel:m}=gk();return(0,W.jsxs)(W.Fragment,{children:[s(),(0,W.jsx)(`div`,{className:`App-welcome-screen`,children:c&&(0,W.jsx)(f.Out,{})}),!e.viewModeEnabled&&(0,W.jsxs)(`div`,{className:`App-bottom-bar`,style:{marginBottom:$j+Qj},children:[(0,W.jsx)(jk,{appState:e,elementsMap:u.scene.getNonDeletedElementsMap(),renderAction:n.renderAction,app:u,setAppState:r}),(0,W.jsxs)(SC,{className:`App-toolbar`,children:[!e.viewModeEnabled&&e.openDialog?.name!==`elementLinkSelector`&&(0,W.jsx)(jN,{app:u,onHandToolToggle:i,setAppState:r}),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&(0,W.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...An(t,e)}))},children:K(`buttons.scrollBackToContent`)})]})]}),(0,W.jsx)(MN,{side:`top`,className:`App-top-bar`,children:(()=>{if(e.openDialog?.name===`elementLinkSelector`)return null;let t=(0,W.jsxs)(`div`,{className:`excalidraw-ui-top-right`,children:[o?.(!0,e)??(!e.viewModeEnabled&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(PN,{checked:e.penMode,onChange:()=>d(null),title:K(`toolBar.penMode`),isMobile:!0,penDetected:e.penDetected}),(0,W.jsx)(m.Out,{})]})),e.viewModeEnabled&&(0,W.jsx)(Ik,{actionManager:n})]});return(0,W.jsxs)(`div`,{className:`App-toolbar-content`,style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`},children:[(0,W.jsxs)(`div`,{className:`excalidraw-ui-top-left`,children:[a?.(!0,e),(0,W.jsx)(p.Out,{})]}),t]})})()})]})},IN=e=>{switch(e){case`bar`:return K(`labels.chartType_bar`);case`line`:return K(`labels.chartType_line`);case`radar`:return K(`labels.chartType_radar`);default:return e}},LN=e=>{let t=(0,H.useRef)(null),[n,r]=(0,H.useState)(null),{theme:i}=gC();(0,H.useLayoutEffect)(()=>{if(!e.spreadsheet){r(null);return}let n=_N(e.chartType,e.spreadsheet,0,0,e.colorSeed);if(!n){r(null),t.current?.replaceChildren();return}r(n);let a,o=t.current;return(async()=>(a=await be(n,{exportBackground:!1,viewBackgroundColor:`#fff`,exportWithDarkMode:i===`dark`},null,{skipInliningFonts:!0}),a.querySelector(`.style-fonts`)?.remove(),o.replaceChildren(),o.appendChild(a)))(),()=>{o.replaceChildren()}},[e.spreadsheet,e.chartType,e.colorSeed,i]);let a=IN(e.chartType);return(0,W.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":a,onClick:()=>{n&&e.onClick(e.chartType,n)},children:[(0,W.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,W.jsx)(`div`,{className:`ChartPreview__label`,children:a})]})},RN=e=>{let t=(0,H.useRef)(null),{theme:n}=gC();return(0,H.useLayoutEffect)(()=>{if(!e.rawText)return;let r=Li({text:e.rawText,x:0,y:0}),i=t.current;return(async()=>{let e=await be([r],{exportBackground:!1,viewBackgroundColor:`#fff`,exportWithDarkMode:n===`dark`},null,{skipInliningFonts:!0});e.querySelector(`.style-fonts`)?.remove(),i.replaceChildren(),i.appendChild(e)})(),()=>{i.replaceChildren()}},[e.rawText,n]),(0,W.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":K(`labels.chartType_plaintext`),onClick:()=>{e.onClick(e.rawText)},children:[(0,W.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,W.jsx)(`div`,{className:`ChartPreview__label`,children:K(`labels.chartType_plaintext`)})]})},zN=({data:e,rawText:t,onClose:n})=>{let{onInsertElements:r,focusContainer:i}=nz(),[a,o]=(0,H.useState)(Math.random()),s=H.useCallback(()=>{o(Math.random())},[]),c=H.useCallback(()=>{n&&n()},[n]),l=(e,t)=>{r(t),dC(`paste`,`chart`,e),n(),i()};return(0,W.jsx)(dk,{size:`regular`,onCloseRequest:c,title:(0,W.jsxs)(`div`,{className:`PasteChartDialog__title`,children:[(0,W.jsx)(`div`,{className:`PasteChartDialog__titleText`,children:K(`labels.pasteCharts`)}),(0,W.jsx)(`div`,{className:`PasteChartDialog__reshuffleBtn`,onClick:s,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},children:jb})]}),className:`PasteChartDialog`,autofocus:!1,children:(0,W.jsxs)(`div`,{className:`container`,children:[[`bar`,`line`,`radar`].map(t=>BM(e,t)?(0,W.jsx)(LN,{chartType:t,spreadsheet:e,colorSeed:a,onClick:l},t):null),t&&(0,W.jsx)(RN,{rawText:t,onClick:e=>{r([Li({text:e,x:0,y:0})]),dC(`paste`,`chart`,`plaintext`),n(),i()}})]})})},BN=({heading:e,children:t,...n})=>{let{id:r}=oz(),i=(0,W.jsx)(`h2`,{className:`visually-hidden`,id:`${r}-${e}-title`,children:K(`headings.${e}`)});return(0,W.jsx)(`section`,{...n,"aria-labelledby":`${r}-${e}-title`,children:typeof t==`function`?t(i):(0,W.jsxs)(W.Fragment,{children:[i,t]})})},VN=4,HN=8,UN=({shouldWrap:e,children:t,username:n})=>e?(0,W.jsx)(Rw,{label:n||`Unknown user`,children:t}):(0,W.jsx)(W.Fragment,{children:t}),WN=({actionManager:e,collaborator:t,socketId:n,withName:r=!1,shouldWrapWithTooltip:i=!1,isBeingFollowed:a})=>{let o={socketId:n,collaborator:t,withName:r,isBeingFollowed:a},s=e.renderAction(`goToCollaborator`,o);return(0,W.jsx)(UN,{username:t.username,shouldWrap:i,children:s},n)},GN=[`avatarUrl`,`id`,`socketId`,`username`,`isInCall`,`isSpeaking`,`isMuted`],KN=H.memo(({className:e,mobile:t,collaborators:n,userToFollow:r})=>{let i=uz(),a=new Map;n.forEach((e,t)=>{let n=e.id||t;a.set(n,{...e,socketId:t})});let o=Array.from(a.values()).filter(e=>e.username?.trim()),[s,c]=H.useState(``),l=o.filter(e=>e.username?.toLowerCase().includes(s)),u=H.useRef(null);(0,H.useLayoutEffect)(()=>{if(u.current){let e=e=>{f(Math.max(1,Math.min(8,Math.floor(e/38))))};if(e(u.current.clientWidth),!He)return;let t=new ResizeObserver(t=>{for(let n of t){let{width:t}=n.contentRect;e(t)}});return t.observe(u.current),()=>{t.disconnect()}}},[]);let[d,f]=H.useState(VN),p=o.slice(0,d-1).map(e=>WN({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}));return t?(0,W.jsx)(`div`,{className:U(`UserList UserList_mobile`,e),children:o.map(e=>WN({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}))}):(0,W.jsx)(`div`,{className:`UserList__wrapper`,ref:u,children:(0,W.jsxs)(`div`,{className:U(`UserList`,e),style:{"--max-avatars":d},children:[p,o.length>d-1&&(0,W.jsxs)(V_,{children:[(0,W.jsxs)(H_,{className:`UserList__more`,children:[`+`,o.length-d+1]}),(0,W.jsx)(W_,{style:{zIndex:2,width:`15rem`,textAlign:`left`},align:`end`,sideOffset:10,children:(0,W.jsxs)(SC,{padding:2,children:[o.length>=HN&&(0,W.jsx)(YC,{placeholder:K(`quickSearch.placeholder`),onChange:c}),(0,W.jsx)(XC,{className:`dropdown-menu UserList__collaborators`,placeholder:K(`userList.empty`),children:l.length>0?[(0,W.jsx)(`div`,{className:`hint`,children:K(`userList.hint.text`)}),l.map(e=>WN({actionManager:i,collaborator:e,socketId:e.socketId,withName:!0,isBeingFollowed:e.socketId===r}))]:[]}),(0,W.jsx)(G_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})]})]})})},(e,t)=>{if(e.collaborators.size!==t.collaborators.size||e.mobile!==t.mobile||e.className!==t.className||e.userToFollow!==t.userToFollow)return!1;let n=t.collaborators.keys();for(let[r,i]of e.collaborators){let e=t.collaborators.get(r);if(!e||r!==n.next().value||!ji(i,e,GN))return!1}return!0}),qN=e=>(0,W.jsx)(`button`,{className:`help-icon`,onClick:e.onClick,type:`button`,title:`${K(`helpDialog.title`)} \u2014 ?`,"aria-label":K(`helpDialog.title`),children:bb}),JN=({appState:e,actionManager:t,showExitZenModeBtn:n,renderWelcomeScreen:r})=>{let{FooterCenterTunnel:i,WelcomeScreenHelpHintTunnel:a}=gk();return(0,W.jsxs)(`footer`,{role:`contentinfo`,className:`layer-ui__wrapper__footer App-menu App-menu_bottom`,children:[(0,W.jsx)(`div`,{className:U(`layer-ui__wrapper__footer-left zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:(0,W.jsx)(_O.Col,{gap:2,children:(0,W.jsxs)(BN,{heading:`canvasActions`,children:[(0,W.jsx)(Nk,{renderAction:t.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&(0,W.jsx)(Pk,{renderAction:t.renderAction,className:U(`zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})})]})})}),(0,W.jsx)(i.Out,{}),(0,W.jsx)(`div`,{className:U(`layer-ui__wrapper__footer-right zen-mode-transition`,{"transition-right":e.zenModeEnabled}),children:(0,W.jsxs)(`div`,{style:{position:`relative`},children:[r&&(0,W.jsx)(a.Out,{}),(0,W.jsx)(qN,{onClick:()=>t.executeAction(ZT)})]})}),(0,W.jsx)(Fk,{actionManager:t,showExitZenModeBtn:n})]})},YN=JN;JN.displayName=`Footer`;var XN=H.createContext({}),ZN=({children:e,className:t})=>{let n=iz(),r=(0,H.useContext)(XN),i=!!(n.canFitSidebar&&r.shouldRenderDockButton);return(0,W.jsxs)(`div`,{className:U(`sidebar__header`,t),"data-testid":`sidebar-header`,children:[e,(0,W.jsxs)(`div`,{className:`sidebar__header__buttons`,children:[i&&(0,W.jsx)(Rw,{label:K(`labels.sidebarLock`),children:(0,W.jsx)(QO,{onSelect:()=>r.onDock?.(!r.docked),selected:!!r.docked,className:`sidebar__dock`,"data-testid":`sidebar-dock`,"aria-label":K(`labels.sidebarLock`),children:Uy})}),(0,W.jsx)(QO,{"data-testid":`sidebar-close`,className:`sidebar__close`,onSelect:r.onCloseRequest,"aria-label":K(`buttons.close`),children:nx})]})]})};ZN.displayName=`SidebarHeader`;var QN=({children:e,tab:t,onSelect:n,...r})=>(0,W.jsx)(lv,{value:t,asChild:!0,onSelect:n,children:(0,W.jsx)(`button`,{type:`button`,className:`excalidraw-button sidebar-tab-trigger`,...r,children:e})});QN.displayName=`SidebarTabTrigger`;var $N=({children:e,...t})=>(0,W.jsx)(cv,{className:`sidebar-triggers`,...t,children:e});$N.displayName=`SidebarTabTriggers`;var eP=({name:e,tab:t,icon:n,title:r,children:i,onToggle:a,className:o,style:s})=>{let c=lz();return(0,W.jsxs)(`label`,{title:r,className:`sidebar-trigger__label-element`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,onChange:n=>{document.querySelector(`.layer-ui__wrapper`)?.classList.remove(`animate`);let r=n.target.checked;c({openSidebar:r?{name:e,tab:t}:null,openMenu:null,openPopup:null}),a?.(r)},checked:gC().openSidebar?.name===e,"aria-label":r,"aria-keyshortcuts":`0`}),(0,W.jsxs)(`div`,{className:U(`sidebar-trigger`,o),style:s,children:[n&&(0,W.jsx)(`div`,{children:n}),i&&(0,W.jsx)(`div`,{className:`sidebar-trigger__label`,children:i})]})]})};eP.displayName=`SidebarTrigger`;var tP=({children:e,...t})=>{let n=gC(),r=lz();if(!n.openSidebar)return null;let{name:i}=n.openSidebar;return(0,W.jsx)(sv,{className:`sidebar-tabs-root`,value:n.openSidebar.tab,onValueChange:e=>r(t=>({...t,openSidebar:{...t.openSidebar,name:i,tab:e}})),...t,children:e})};tP.displayName=`SidebarTabs`;var nP=({tab:e,children:t,...n})=>(0,W.jsx)(uv,{...n,value:e,"data-testid":e,children:t});nP.displayName=`SidebarTab`;var rP=yc(!1),iP=(0,H.forwardRef)(({name:e,children:t,onDock:n,docked:r,className:i,...a},o)=>{Vt()&&n&&r==null&&console.warn("Sidebar: `docked` must be set when `onDock` is supplied for the sidebar to be user-dockable. To hide this message, either pass `docked` or remove `onDock`");let s=lz(),c=yy(rP);(0,H.useLayoutEffect)(()=>(c(!!r),()=>{c(!1)}),[c,r]);let l=(0,H.useRef)({});l.current.onCloseRequest=()=>{s({openSidebar:null})},l.current.onDock=e=>n?.(e),l.current=Jr(l.current,{docked:r,shouldRenderDockButton:!!n&&r!=null});let u=(0,H.useRef)(null);(0,H.useImperativeHandle)(o,()=>u.current);let d=iz(),f=(0,H.useCallback)(()=>{document.querySelector(`.Dialog`)||s({openSidebar:null})},[s]);return vC(u,(0,H.useCallback)(e=>{e.target.closest(`.sidebar-trigger`)||(!r||!d.canFitSidebar)&&f()},[f,r,d.canFitSidebar])),(0,H.useEffect)(()=>{let e=e=>{e.key===N.ESCAPE&&(!r||!d.canFitSidebar)&&f()};return document.addEventListener(F.KEYDOWN,e),()=>{document.removeEventListener(F.KEYDOWN,e)}},[f,r,d.canFitSidebar]),(0,W.jsx)(SC,{...a,className:U(Qn.SIDEBAR,{"sidebar--docked":r},i),ref:u,children:(0,W.jsx)(XN.Provider,{value:l.current,children:t})})});iP.displayName=`SidebarInner`;var aP=Object.assign((0,H.forwardRef)((e,t)=>{let n=gC(),{onStateChange:r}=e,i=(0,H.useRef)(n.openSidebar);(0,H.useEffect)(()=>{(!n.openSidebar&&i?.current?.name===e.name||n.openSidebar?.name===e.name&&i?.current?.name!==e.name||i.current?.name===e.name)&&n.openSidebar!==i.current&&r?.(n.openSidebar?.name===e.name?n.openSidebar:null),i.current=n.openSidebar},[n.openSidebar,r,e.name]);let[a,o]=(0,H.useState)(!1);return(0,H.useLayoutEffect)(()=>(o(!0),()=>o(!1)),[]),a&&n.openSidebar?.name===e.name?(0,H.createElement)(iP,{...e,ref:t,key:e.name}):null}),{Header:ZN,TabTriggers:$N,TabTrigger:QN,Tabs:tP,Tab:nP,Trigger:eP});aP.displayName=`Sidebar`;var oP=(e,t)=>{let n=yc(0),r=e=>{let{tunnelsJotai:{useAtom:r}}=gk(),[,i]=r(n),a=(0,H.useRef)({preferHost:!1,counter:0});return(0,H.useLayoutEffect)(()=>{let e=a.current;return i(t=>{let n=t+1;return e.counter=n,n}),()=>{i(t=>{let n=t-1;return e.counter=n,n||(e.preferHost=!1),n})}},[i]),e.__fallback||(a.current.preferHost=!0),!a.current.counter&&e.__fallback&&a.current.preferHost||a.current.counter>1&&e.__fallback?null:(0,W.jsx)(t,{...e})};return r.displayName=e,r},sP={};o(sP,{ChangeCanvasBackground:()=>xP,ClearCanvas:()=>yP,CommandPalette:()=>gP,Export:()=>SP,Help:()=>vP,LiveCollaborationTrigger:()=>wP,LoadScene:()=>pP,Preferences:()=>NP,PreferencesToggleGridModeItem:()=>kP,PreferencesToggleZenModeItem:()=>AP,SaveAsImage:()=>hP,SaveToActiveFile:()=>mP,SearchMenu:()=>_P,Socials:()=>CP,ToggleTheme:()=>bP});var cP=yc({active:!1});async function lP({title:e,description:t,actionLabel:n,color:r}){return new Promise(i=>{Cy.set(cP,{active:!0,onConfirm:()=>i(!0),onClose:()=>i(!1),onReject:()=>i(!1),title:e,description:t,actionLabel:n,color:r})})}var uP=function({onChange:e,value:t,choices:n,name:r}){return(0,W.jsx)(`div`,{className:`RadioGroup`,children:n.map(n=>(0,W.jsxs)(`div`,{className:U(`RadioGroup__choice`,{active:n.value===t}),title:n.ariaLabel,children:[(0,W.jsx)(`input`,{name:r,type:`radio`,checked:n.value===t,onChange:()=>e(n.value),"aria-label":n.ariaLabel}),n.label]},String(n.value)))})},dP=({value:e,shortcut:t,onChange:n,choices:r,children:i,name:a})=>{let o=iz();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`dropdown-menu-item-base dropdown-menu-item-bare`,children:[(0,W.jsx)(`label`,{className:`dropdown-menu-item__text`,children:i}),(0,W.jsx)(uP,{name:a,value:e,onChange:n,choices:r})]}),t&&o.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned`,children:t})]})};dP.displayName=`DropdownMenuItemContentRadio`;var fP=dP,pP=()=>{let{t:e}=Fy(),t=uz(),n=sz();return t.isActionEnabled(KT)?(0,W.jsx)(sw,{icon:Ab,onSelect:async()=>{(!n.length||await lP({title:e(`overwriteConfirm.modal.loadFromFile.title`),actionLabel:e(`overwriteConfirm.modal.loadFromFile.button`),color:`warning`,description:(0,W.jsx)(pO,{i18nKey:`overwriteConfirm.modal.loadFromFile.description`,bold:e=>(0,W.jsx)(`strong`,{children:e}),br:()=>(0,W.jsx)(`br`,{})})}))&&t.executeAction(KT)},"data-testid":`load-button`,shortcut:ND(`loadScene`),"aria-label":e(`buttons.load`),children:e(`buttons.load`)}):null};pP.displayName=`LoadScene`;var mP=()=>{let{t:e}=Fy(),t=uz();return t.isActionEnabled(WT)?(0,W.jsx)(sw,{shortcut:ND(`saveScene`),"data-testid":`save-button`,onSelect:()=>t.executeAction(WT),icon:Ob,"aria-label":`${e(`buttons.save`)}`,children:`${e(`buttons.save`)}`}):null};mP.displayName=`SaveToActiveFile`;var hP=()=>{let e=lz(),{t}=Fy();return(0,W.jsx)(sw,{icon:Nb,"data-testid":`image-export-button`,onSelect:()=>e({openDialog:{name:`imageExport`}}),shortcut:ND(`imageExport`),"aria-label":t(`buttons.exportImage`),children:t(`buttons.exportImage`)})};hP.displayName=`SaveAsImage`;var gP=e=>{let t=lz(),{t:n}=Fy();return(0,W.jsx)(sw,{icon:CS,"data-testid":`command-palette-button`,onSelect:()=>{dC(`command_palette`,`open`,`menu`),t({openDialog:{name:`commandPalette`}})},shortcut:ND(`commandPalette`),"aria-label":n(`commandPalette.title`),className:e?.className,children:n(`commandPalette.title`)})};gP.displayName=`CommandPalette`;var _P=e=>{let{t}=Fy(),n=uz();return(0,W.jsx)(sw,{icon:vS,"data-testid":`search-menu-button`,onSelect:()=>{n.executeAction(ZA)},shortcut:ND(`searchMenu`),"aria-label":t(`search.title`),className:e?.className,children:t(`search.title`)})};_P.displayName=`SearchMenu`;var vP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(sw,{"data-testid":`help-menu-item`,icon:bb,onSelect:()=>t.executeAction(ZT),shortcut:`?`,"aria-label":e(`helpDialog.title`),children:e(`helpDialog.title`)})};vP.displayName=`Help`;var yP=()=>{let{t:e}=Fy(),t=yy(Rk);return uz().isActionEnabled(Zw)?(0,W.jsx)(sw,{icon:pb,onSelect:()=>t(`clearCanvas`),"data-testid":`clear-canvas-button`,"aria-label":e(`buttons.clearReset`),children:e(`buttons.clearReset`)}):null};yP.displayName=`ClearCanvas`;var bP=e=>{let{t}=Fy(),n=gC(),r=uz(),i=ND(`toggleTheme`);return r.isActionEnabled(iT)?e?.allowSystemTheme?(0,W.jsx)(fP,{name:`theme`,value:e.theme,onChange:t=>e.onSelect(t),choices:[{value:R.LIGHT,label:_b,ariaLabel:`${t(`buttons.lightMode`)} - ${i}`},{value:R.DARK,label:gb,ariaLabel:`${t(`buttons.darkMode`)} - ${i}`},{value:`system`,label:PS,ariaLabel:t(`buttons.systemMode`)}],children:t(`labels.theme`)}):(0,W.jsx)(sw,{onSelect:t=>{if(t.preventDefault(),e?.onSelect)e.onSelect(n.theme===R.DARK?R.LIGHT:R.DARK);else return r.executeAction(iT)},icon:n.theme===R.DARK?_b:gb,"data-testid":`toggle-dark-mode`,shortcut:i,"aria-label":n.theme===R.DARK?t(`buttons.lightMode`):t(`buttons.darkMode`),children:n.theme===R.DARK?t(`buttons.lightMode`):t(`buttons.darkMode`)}):null};bP.displayName=`ToggleTheme`;var xP=()=>{let{t:e}=Fy(),t=gC(),n=uz(),r=rz();return t.viewModeEnabled||!r.UIOptions.canvasActions.changeViewBackgroundColor?null:(0,W.jsxs)(`div`,{style:{marginTop:`0.75rem`},children:[(0,W.jsx)(`div`,{"data-testid":`canvas-background-label`,style:{fontSize:`0.875rem`,marginBottom:`0.25rem`,marginLeft:`0.5rem`},children:e(`labels.canvasBackground`)}),(0,W.jsx)(`div`,{style:{padding:`0 0.625rem`},children:n.renderAction(`changeViewBackgroundColor`)})]})};xP.displayName=`ChangeCanvasBackground`;var SP=()=>{let{t:e}=Fy(),t=lz();return(0,W.jsx)(sw,{icon:yb,onSelect:()=>{t({openDialog:{name:`jsonExport`}})},"data-testid":`json-export-button`,"aria-label":e(`buttons.export`),children:e(`buttons.export`)})};SP.displayName=`Export`;var CP=()=>{let{t:e}=Fy();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(SO,{icon:Cb,href:`https://github.com/excalidraw/excalidraw`,"aria-label":`GitHub`,children:`GitHub`}),(0,W.jsx)(SO,{icon:Tb,href:`https://x.com/excalidraw`,"aria-label":`X`,children:e(`labels.followUs`)}),(0,W.jsx)(SO,{icon:wb,href:`https://discord.gg/UexuTaE`,"aria-label":`Discord`,children:e(`labels.discordChat`)})]})};CP.displayName=`Socials`;var wP=({onSelect:e,isCollaborating:t})=>{let{t:n}=Fy();return(0,W.jsx)(sw,{"data-testid":`collab-button`,icon:ex,className:U({"active-collab":t}),onSelect:e,children:n(`labels.liveCollaboration`)})};wP.displayName=`LiveCollaborationTrigger`;var TP=()=>{let{t:e}=Fy(),t=nz();return(0,W.jsx)(BO,{checked:gC().activeTool.locked,shortcut:ND(`toolLock`),onSelect:e=>{t.toggleLock(),e.preventDefault()},children:e(`labels.preferences_toolLock`)})},EP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().objectsSnapModeEnabled,shortcut:ND(`objectsSnapMode`),onSelect:e=>{t.executeAction(TE),e.preventDefault()},children:e(`buttons.objectsSnapMode`)})},DP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().bindingPreference===`enabled`,onSelect:e=>{t.executeAction(EE),e.preventDefault()},children:e(`labels.arrowBinding`)})},OP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().isMidpointSnappingEnabled,onSelect:e=>{t.executeAction(DE),e.preventDefault()},children:e(`labels.midpointSnapping`)})},kP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().gridModeEnabled,shortcut:ND(`gridMode`),onSelect:e=>{t.executeAction(CE),e.preventDefault()},children:e(`labels.toggleGrid`)})},AP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().zenModeEnabled,shortcut:ND(`zenMode`),onSelect:e=>{t.executeAction(wE),e.preventDefault()},children:e(`buttons.zenMode`)})},jP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().viewModeEnabled,shortcut:ND(`viewMode`),onSelect:e=>{t.executeAction(yk),e.preventDefault()},children:e(`labels.viewMode`)})},MP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().stats.open,shortcut:ND(`stats`),onSelect:e=>{t.executeAction(OE),e.preventDefault()},children:e(`stats.fullTitle`)})},NP=({children:e,additionalItems:t})=>{let{t:n}=Fy();return(0,W.jsxs)(LO,{children:[(0,W.jsx)(LO.Trigger,{icon:QS,children:n(`labels.preferences`)}),(0,W.jsxs)(LO.Content,{className:`excalidraw-main-menu-preferences-submenu`,children:[e||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(TP,{}),(0,W.jsx)(EP,{}),(0,W.jsx)(kP,{}),(0,W.jsx)(AP,{}),(0,W.jsx)(jP,{}),(0,W.jsx)(MP,{}),(0,W.jsx)(DP,{}),(0,W.jsx)(OP,{})]}),t]})]})};NP.ToggleToolLock=TP,NP.ToggleSnapMode=EP,NP.ToggleArrowBinding=DP,NP.ToggleMidpointSnapping=OP,NP.ToggleGridMode=kP,NP.ToggleZenMode=AP,NP.ToggleViewMode=jP,NP.ToggleElementProperties=MP,NP.displayName=`Preferences`;var PP=Object.assign(oP(`MainMenu`,({children:e,onSelect:t})=>{let{MainMenuTunnel:n}=gk(),r=iz(),i=gC(),a=lz();return(0,W.jsx)(n.In,{children:(0,W.jsxs)(HO,{open:i.openMenu===`canvas`,children:[(0,W.jsx)(HO.Trigger,{onToggle:()=>{a({openMenu:i.openMenu===`canvas`?null:`canvas`,openPopup:null,openDialog:null})},"data-testid":`main-menu-trigger`,className:`main-menu-trigger`,children:vb}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>a({openMenu:null}),onSelect:ps(t,()=>{a({openMenu:null})}),className:`main-menu`,align:`start`,children:[e,r.formFactor===`phone`&&i.collaborators.size>0&&(0,W.jsxs)(`fieldset`,{className:`UserList-Wrapper`,children:[(0,W.jsx)(`legend`,{children:K(`labels.collaborators`)}),(0,W.jsx)(KN,{mobile:!0,collaborators:i.collaborators,userToFollow:i.userToFollow?.socketId||null})]})]})]})})}),{Trigger:HO.Trigger,Item:HO.Item,ItemLink:HO.ItemLink,ItemCustom:HO.ItemCustom,Group:HO.Group,Separator:HO.Separator,Sub:LO,DefaultItems:sP}),FP=(0,H.forwardRef)(({children:e,icon:t,onClick:n,label:r,variant:i=`filled`,color:a=`primary`,size:o=`medium`,fullWidth:s,className:c,status:l,disabled:u},d)=>{let[f,p]=(0,H.useState)(!1),m=async e=>{let t=n?.(e);if(ge(t)){let e=window.setTimeout(()=>{p(!0)},50);try{await t}catch(e){if(e instanceof E)console.warn(e);else throw e}finally{clearTimeout(e),p(!1)}}},h=f?`loading`:l;return a=h===`success`?`success`:a,(0,W.jsx)(`button`,{className:U(`ExcButton`,`ExcButton--color-${a}`,`ExcButton--variant-${i}`,`ExcButton--size-${o}`,`ExcButton--status-${h}`,{"ExcButton--fullWidth":s},c),onClick:m,type:`button`,"aria-label":r,ref:d,disabled:u||h===`loading`||h===`success`,children:(0,W.jsxs)(`div`,{className:`ExcButton__contents`,children:[h===`loading`?(0,W.jsx)($S,{className:`ExcButton__statusIcon`}):h===`success`&&(0,W.jsx)(`div`,{className:`ExcButton__statusIcon`,children:nS}),t&&(0,W.jsx)(`div`,{className:`ExcButton__icon`,"aria-hidden":!0,children:t}),i!==`icon`&&(e??r)]})})}),IP=({title:e,children:t,actionLabel:n,onClick:r})=>(0,W.jsxs)(`div`,{className:`OverwriteConfirm__Actions__Action`,children:[(0,W.jsx)(`h4`,{children:e}),(0,W.jsx)(`div`,{className:`OverwriteConfirm__Actions__Action__content`,children:t}),(0,W.jsx)(FP,{variant:`outlined`,color:`muted`,label:n,size:`large`,fullWidth:!0,onClick:r})]}),LP=Object.assign(({children:e})=>(0,W.jsx)(`div`,{className:`OverwriteConfirm__Actions`,children:e}),{ExportToImage:()=>{let{t:e}=Fy(),t=uz(),n=lz();return(0,W.jsx)(IP,{title:e(`overwriteConfirm.action.exportToImage.title`),actionLabel:e(`overwriteConfirm.action.exportToImage.button`),onClick:()=>{t.executeAction(zT,`ui`,!0),n({openDialog:{name:`imageExport`}})},children:e(`overwriteConfirm.action.exportToImage.description`)})},SaveToDisk:()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(IP,{title:e(`overwriteConfirm.action.saveToDisk.title`),actionLabel:e(`overwriteConfirm.action.saveToDisk.button`),onClick:()=>{t.executeAction(GT,`ui`)},children:e(`overwriteConfirm.action.saveToDisk.description`)})}}),RP=Object.assign(oP(`OverwriteConfirmDialog`,({children:e})=>{let{OverwriteConfirmDialogTunnel:t}=gk(),[n,r]=vy(cP);return n.active?(0,W.jsx)(t.In,{children:(0,W.jsx)(dk,{onCloseRequest:()=>{n.onClose(),r(e=>({...e,active:!1}))},title:!1,size:916,children:(0,W.jsxs)(`div`,{className:`OverwriteConfirm`,children:[(0,W.jsx)(`h3`,{children:n.title}),(0,W.jsxs)(`div`,{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${n.color}`,children:[(0,W.jsx)(`div`,{className:`OverwriteConfirm__Description__icon`,children:rS}),(0,W.jsx)(`div`,{children:n.description}),(0,W.jsx)(`div`,{className:`OverwriteConfirm__Description__spacer`}),(0,W.jsx)(FP,{color:n.color,size:`large`,label:n.actionLabel,onClick:()=>{n.onConfirm(),r(e=>({...e,active:!1}))}})]}),(0,W.jsx)(LP,{children:e})]})})}):null}),{Actions:LP,Action:IP}),zP=yc(``),BP=yc(null),VP=350,HP=()=>{let e=nz(),t=lz(),n=(0,H.useRef)(null),[r,i]=vy(zP),a=r.trim(),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)({nonce:null,items:[]}),u=(0,H.useRef)(null),d=(0,H.useRef)(void 0),[f,p]=vy(BP);(0,H.useEffect)(()=>{o||(a!==u.current||e.scene.getSceneNonce()!==d.current)&&(u.current=null,XP(a,e,(n,r)=>{l({nonce:se(),items:n}),u.current=a,d.current=e.scene.getSceneNonce(),t({searchMatches:n.length?{focusedId:null,matches:n.map(e=>({id:e.element.id,focus:!1,matchedLines:e.matchedLines}))}:null})}))},[o,a,e.scene.getNonDeletedElementsMap(),e,t,p,d]);let m=()=>{c.items.length>0&&p(e=>e===null?0:(e+1)%c.items.length)},h=()=>{c.items.length>0&&p(e=>e===null?0:e-1<0?c.items.length-1:e-1)};(0,H.useEffect)(()=>{t(e=>e.searchMatches?{searchMatches:{focusedId:f!==null&&e.searchMatches?.matches[f]?.id||null,matches:e.searchMatches.matches.map((e,t)=>t===f?{...e,focus:!0}:{...e,focus:!1})}}:null)},[f,t]),(0,H.useEffect)(()=>{if(c.items.length>0&&f!==null){let t=c.items[f];if(t){let n=e.state.zoom.value,r=Li({text:t.searchQuery,x:t.element.x+(t.matchedLines[0]?.offsetX??0),y:t.element.y+(t.matchedLines[0]?.offsetY??0),width:t.matchedLines[0]?.width,height:t.matchedLines[0]?.height,fontSize:L(t.element)?On.nameFontSize:t.element.fontSize,fontFamily:L(t.element)?to.Assistant:t.element.fontFamily}),i=r.fontSize,a=i*n<14;if(!ms([r],e.canvas.width/window.devicePixelRatio,e.canvas.height/window.devicePixelRatio,{offsetLeft:e.state.offsetLeft,offsetTop:e.state.offsetTop,scrollX:e.state.scrollX,scrollY:e.state.scrollY,zoom:e.state.zoom},e.scene.getNonDeletedElementsMap(),e.getEditorUIOffsets())||a){let t;t=a?i>=14?{fitToContent:!0}:{fitToViewport:!0,maxZoom:on(14/i,1)}:{fitToContent:!0},e.scrollToContent(r,{animate:!0,duration:300,...t,canvasOffsets:e.getEditorUIOffsets()})}}}},[f,c,e]),(0,H.useEffect)(()=>()=>{p(null),u.current=null,d.current=void 0,t({searchMatches:null}),s(!1)},[t,p]);let g=yC({goToNextItem:m,goToPreviousItem:h,searchMatches:c});(0,H.useEffect)(()=>w(window,F.KEYDOWN,r=>{if(r.key===N.ESCAPE&&!e.state.openDialog&&!e.state.openPopup){r.preventDefault(),r.stopPropagation(),t({openSidebar:null});return}if(r[N.CTRL_OR_CMD]&&r.key===N.F){if(r.preventDefault(),r.stopPropagation(),e.state.openDialog)return;n.current?.matches(`:focus`)||(e.state.openDialog&&t({openDialog:null}),n.current?.focus(),n.current?.select())}r.target instanceof HTMLElement&&r.target.closest(`.layer-ui__search`)&&g.searchMatches.items.length&&(r.key===N.ENTER&&(r.stopPropagation(),g.goToNextItem()),r.key===N.ARROW_UP?(r.stopPropagation(),g.goToPreviousItem()):r.key===N.ARROW_DOWN&&(r.stopPropagation(),g.goToNextItem()))},{capture:!0,passive:!1}),[t,g,e]);let _=`${c.items.length} ${c.items.length===1?K(`search.singleResult`):K(`search.multipleResults`)}`;return(0,W.jsxs)(`div`,{className:`layer-ui__search`,children:[(0,W.jsx)(`div`,{className:`layer-ui__search-header`,children:(0,W.jsx)($O,{className:Qn.SEARCH_MENU_INPUT_WRAPPER,value:r,ref:n,placeholder:K(`search.placeholder`),icon:vS,onChange:n=>{i(n),s(!0);let r=n.trim();XP(r,e,(n,i)=>{l({nonce:se(),items:n}),p(i),u.current=r,d.current=e.scene.getSceneNonce(),t({searchMatches:n.length?{focusedId:null,matches:n.map(e=>({id:e.element.id,focus:!1,matchedLines:e.matchedLines}))}:null}),s(!1)})},selectOnRender:!0})}),(0,W.jsxs)(`div`,{className:`layer-ui__search-count`,children:[c.items.length>0&&(0,W.jsxs)(W.Fragment,{children:[f!==null&&f>-1?(0,W.jsxs)(`div`,{children:[f+1,` / `,_]}):(0,W.jsx)(`div`,{children:_}),(0,W.jsxs)(`div`,{className:`result-nav`,children:[(0,W.jsx)(QO,{onSelect:()=>{m()},className:`result-nav-btn`,children:VS}),(0,W.jsx)(QO,{onSelect:()=>{h()},className:`result-nav-btn`,children:US})]})]}),c.items.length===0&&a&&u.current&&(0,W.jsx)(`div`,{style:{margin:`1rem auto`},children:K(`search.noMatch`)})]}),(0,W.jsx)(WP,{matches:c,onItemClick:p,focusIndex:f,searchQuery:a})]})},UP=e=>{let t=[e.preview.moreBefore?`...`:``,e.preview.previewText.slice(0,e.preview.indexInSearchQuery),e.preview.previewText.slice(e.preview.indexInSearchQuery,e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.previewText.slice(e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.moreAfter?`...`:``];return(0,W.jsx)(`div`,{tabIndex:-1,className:U(`layer-ui__result-item`,{active:e.highlighted}),onClick:e.onClick,ref:t=>{e.highlighted&&t?.scrollIntoView({behavior:`auto`,block:`nearest`})},children:(0,W.jsx)(`div`,{className:`preview-text`,children:t.flatMap((e,t)=>(0,W.jsx)(H.Fragment,{children:t===2?(0,W.jsx)(`b`,{children:e}):e},t))})})},WP=(0,H.memo)(e=>{let t=(0,H.useMemo)(()=>e.matches.items.filter(e=>L(e.element)),[e.matches]),n=(0,H.useMemo)(()=>e.matches.items.filter(e=>M(e.element)),[e.matches]);return(0,W.jsxs)(`div`,{children:[t.length>0&&(0,W.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,W.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,W.jsx)(`div`,{className:`title-icon`,children:oS}),(0,W.jsx)(`div`,{children:K(`search.frames`)})]}),t.map((t,n)=>(0,W.jsx)(UP,{searchQuery:e.searchQuery,preview:t.preview,highlighted:n===e.focusIndex,onClick:()=>e.onItemClick(n)},t.element.id+t.index)),n.length>0&&(0,W.jsx)(`div`,{className:`layer-ui__divider`})]}),n.length>0&&(0,W.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,W.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,W.jsx)(`div`,{className:`title-icon`,children:ob}),(0,W.jsx)(`div`,{children:K(`search.texts`)})]}),n.map((n,r)=>(0,W.jsx)(UP,{searchQuery:e.searchQuery,preview:n.preview,highlighted:r+t.length===e.focusIndex,onClick:()=>e.onItemClick(r+t.length)},n.element.id+n.index))]})]})},(e,t)=>e.matches.nonce===t.matches.nonce&&e.focusIndex===t.focusIndex),GP=(e,t,n)=>{let r=e.slice(0,t),i=r.split(/\s+/),a=r.endsWith(` `),o=i.length-2-1-(a?0:1),s=i.slice(o<=0?0:o).join(` `)+(a?` `:``);s=s.length>20?s.slice(-20):s;let c=e.slice(t+n.length),l=c.split(/\s+/),u=!c.startsWith(` `),d=u?6:5,f=(u?``:` `)+l.slice(0,d).join(` `);return{indexInSearchQuery:s.length,previewText:s+n+f,moreBefore:o>0,moreAfter:l.length>d}},KP=(e,t)=>{let n=e.split(`
|
|
66
66
|
`),r=[],i=0;for(let e=0;e<n.length;e++){let a=n[e],o=n[e+1];if(o){let e=t.indexOf(o,i);if(e>a.length+i){let t=e-(a.length+i);for(;t>0;)a+=` `,t--}}r.push(a),i+=a.length}return r.join(`
|
|
67
67
|
`)},qP=(e,t,n)=>{let r=KP(e.text,e.originalText).split(`
|
|
68
|
-
`),i=[],a=0,o=0;for(let e of r){let t=a,n=t+e.length-1;i.push({line:e,startIndex:t,endIndex:n,lineNumber:o}),a=n+1,o++}let s=n,c=e.originalText.slice(n,n+t.length),l=[];for(let t of i){if(c===``)break;if(s>=t.startIndex&&s<=t.endIndex){let n=t.endIndex+1-s,r=t.line.slice(0,s-t.startIndex),i=c.slice(0,n);c=c.slice(n);let a=gn(r,u(e),e.lineHeight);if(r===``&&(a.width=0),e.textAlign!==`left`&&t.line.length>0){let n=gn(t.line,u(e),e.lineHeight),r=e.textAlign===`center`?(e.width-n.width)/2:e.width-n.width;a.width+=r}let{width:o,height:d}=gn(i,u(e),e.lineHeight),f=a.width,p=t.lineNumber*a.height;l.push({offsetX:f,offsetY:p,width:o,height:d,showOnCanvas:!0}),s+=n}}return l},JP=(e,t,n,r)=>{let i=e.name??Us(e),a=i.slice(n,n+t.length),o=i.slice(0,n),s=u({fontSize:On.nameFontSize,fontFamily:to.Assistant}),c=ba(to.Assistant),l=gn(o,s,c);o===``&&(l.width=0);let d=gn(a,s,c),f=l.width,p=-l.height-On.strokeWidth,m=d.width;return[{offsetX:f,offsetY:p,width:m,height:d.height,showOnCanvas:f+m<=e.width*r}]},YP=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,`\\$&`),XP=(0,gy.default)((e,t,n)=>{if(!e||e===``){n([],null);return}let r=t.scene.getNonDeletedElements(),i=r.filter(e=>M(e)),a=r.filter(e=>L(e));i.sort((e,t)=>e.y-t.y),a.sort((e,t)=>e.y-t.y);let o=[],s=new RegExp(YP(e),`gi`);for(let t of i){let n=null,r=t.originalText;for(;(n=s.exec(r))!==null;){let i=GP(r,n.index,e),a=qP(t,e,n.index);a.length>0&&o.push({element:t,searchQuery:e,preview:i,index:n.index,matchedLines:a})}}let c=[];for(let n of a){let r=null,i=n.name??Us(n);for(;(r=s.exec(i))!==null;){let a=GP(i,r.index,e),o=JP(n,e,r.index,t.state.zoom.value);o.length>0&&c.push({element:n,searchQuery:e,preview:a,index:r.index,matchedLines:o})}}let l=new Set(t.visibleElements.map(e=>e.id)),u=[...c,...o];n(u,u.findIndex(e=>l.has(e.element.id))??null)},VP),ZP=oP(`DefaultSidebarTrigger`,e=>{let{DefaultSidebarTriggerTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsx)(aP.Trigger,{...e,className:`default-sidebar-trigger`,name:At.name})})});ZP.displayName=`DefaultSidebarTrigger`;var QP=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:t}=gk();return(0,W.jsx)(t.In,{children:e})};QP.displayName=`DefaultTabTriggers`;var $P=Object.assign(oP(`DefaultSidebar`,({children:e,className:t,onDock:n,docked:r,...i})=>{let a=gC(),o=lz(),{DefaultSidebarTabTriggersTunnel:s}=gk(),c=a.openSidebar?.tab===Ln;return(0,H.createElement)(aP,{...i,name:`default`,key:`default`,className:U(`default-sidebar`,t),docked:c||(r??a.defaultSidebarDockedPreference),onDock:c||n===!1||!n&&r!=null?void 0:ps(n,e=>{o({defaultSidebarDockedPreference:e})})},(0,W.jsxs)(aP.Tabs,{children:[(0,W.jsx)(aP.Header,{children:(0,W.jsxs)(aP.TabTriggers,{children:[(0,W.jsx)(aP.TabTrigger,{tab:Ln,children:vS}),(0,W.jsx)(aP.TabTrigger,{tab:En,children:zy}),(0,W.jsx)(s.Out,{})]})}),(0,W.jsx)(aP.Tab,{tab:En,children:(0,W.jsx)(ck,{})}),(0,W.jsx)(aP.Tab,{tab:Ln,children:(0,W.jsx)(HP,{})}),e]}))}),{Trigger:ZP,TabTriggers:QP}),eF=300,tF=({input:e,placeholder:t,onChange:r,onKeyboardSubmit:i,errorLine:a})=>{let o=(0,H.useRef)(null),s=(0,H.useRef)(i);s.current=i;let[c,l]=(0,H.useState)({type:`loading`}),[u,d]=(0,H.useState)(!1),{theme:f}=gC();if((0,H.useEffect)(()=>{let e=!1,t=setTimeout(()=>{e||d(!0)},eF);return n(()=>import(`./CodeMirrorEditor-UCMRAMCV-
|
|
68
|
+
`),i=[],a=0,o=0;for(let e of r){let t=a,n=t+e.length-1;i.push({line:e,startIndex:t,endIndex:n,lineNumber:o}),a=n+1,o++}let s=n,c=e.originalText.slice(n,n+t.length),l=[];for(let t of i){if(c===``)break;if(s>=t.startIndex&&s<=t.endIndex){let n=t.endIndex+1-s,r=t.line.slice(0,s-t.startIndex),i=c.slice(0,n);c=c.slice(n);let a=gn(r,u(e),e.lineHeight);if(r===``&&(a.width=0),e.textAlign!==`left`&&t.line.length>0){let n=gn(t.line,u(e),e.lineHeight),r=e.textAlign===`center`?(e.width-n.width)/2:e.width-n.width;a.width+=r}let{width:o,height:d}=gn(i,u(e),e.lineHeight),f=a.width,p=t.lineNumber*a.height;l.push({offsetX:f,offsetY:p,width:o,height:d,showOnCanvas:!0}),s+=n}}return l},JP=(e,t,n,r)=>{let i=e.name??Us(e),a=i.slice(n,n+t.length),o=i.slice(0,n),s=u({fontSize:On.nameFontSize,fontFamily:to.Assistant}),c=ba(to.Assistant),l=gn(o,s,c);o===``&&(l.width=0);let d=gn(a,s,c),f=l.width,p=-l.height-On.strokeWidth,m=d.width;return[{offsetX:f,offsetY:p,width:m,height:d.height,showOnCanvas:f+m<=e.width*r}]},YP=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,`\\$&`),XP=(0,gy.default)((e,t,n)=>{if(!e||e===``){n([],null);return}let r=t.scene.getNonDeletedElements(),i=r.filter(e=>M(e)),a=r.filter(e=>L(e));i.sort((e,t)=>e.y-t.y),a.sort((e,t)=>e.y-t.y);let o=[],s=new RegExp(YP(e),`gi`);for(let t of i){let n=null,r=t.originalText;for(;(n=s.exec(r))!==null;){let i=GP(r,n.index,e),a=qP(t,e,n.index);a.length>0&&o.push({element:t,searchQuery:e,preview:i,index:n.index,matchedLines:a})}}let c=[];for(let n of a){let r=null,i=n.name??Us(n);for(;(r=s.exec(i))!==null;){let a=GP(i,r.index,e),o=JP(n,e,r.index,t.state.zoom.value);o.length>0&&c.push({element:n,searchQuery:e,preview:a,index:r.index,matchedLines:o})}}let l=new Set(t.visibleElements.map(e=>e.id)),u=[...c,...o];n(u,u.findIndex(e=>l.has(e.element.id))??null)},VP),ZP=oP(`DefaultSidebarTrigger`,e=>{let{DefaultSidebarTriggerTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsx)(aP.Trigger,{...e,className:`default-sidebar-trigger`,name:At.name})})});ZP.displayName=`DefaultSidebarTrigger`;var QP=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:t}=gk();return(0,W.jsx)(t.In,{children:e})};QP.displayName=`DefaultTabTriggers`;var $P=Object.assign(oP(`DefaultSidebar`,({children:e,className:t,onDock:n,docked:r,...i})=>{let a=gC(),o=lz(),{DefaultSidebarTabTriggersTunnel:s}=gk(),c=a.openSidebar?.tab===Ln;return(0,H.createElement)(aP,{...i,name:`default`,key:`default`,className:U(`default-sidebar`,t),docked:c||(r??a.defaultSidebarDockedPreference),onDock:c||n===!1||!n&&r!=null?void 0:ps(n,e=>{o({defaultSidebarDockedPreference:e})})},(0,W.jsxs)(aP.Tabs,{children:[(0,W.jsx)(aP.Header,{children:(0,W.jsxs)(aP.TabTriggers,{children:[(0,W.jsx)(aP.TabTrigger,{tab:Ln,children:vS}),(0,W.jsx)(aP.TabTrigger,{tab:En,children:zy}),(0,W.jsx)(s.Out,{})]})}),(0,W.jsx)(aP.Tab,{tab:En,children:(0,W.jsx)(ck,{})}),(0,W.jsx)(aP.Tab,{tab:Ln,children:(0,W.jsx)(HP,{})}),e]}))}),{Trigger:ZP,TabTriggers:QP}),eF=300,tF=({input:e,placeholder:t,onChange:r,onKeyboardSubmit:i,errorLine:a})=>{let o=(0,H.useRef)(null),s=(0,H.useRef)(i);s.current=i;let[c,l]=(0,H.useState)({type:`loading`}),[u,d]=(0,H.useState)(!1),{theme:f}=gC();if((0,H.useEffect)(()=>{let e=!1,t=setTimeout(()=>{e||d(!0)},eF);return n(()=>import(`./CodeMirrorEditor-UCMRAMCV-C5yVpm45.js`).then(t=>{e||l({type:`ready`,component:t.default})}),__vite__mapDeps([66,2,67,68,1,69]),import.meta.url).catch(()=>{e||l({type:`fallback`})}).finally(()=>{clearTimeout(t)}),()=>{e=!0,clearTimeout(t)}},[]),(0,H.useEffect)(()=>{if(c.type!==`fallback`||!s.current)return;let e=o.current;if(e){let t=e=>{e[N.CTRL_OR_CMD]&&e.key===N.ENTER&&(e.preventDefault(),s.current?.())};return e.focus(),e.addEventListener(F.KEYDOWN,t),()=>{e.removeEventListener(F.KEYDOWN,t)}}},[c.type]),c.type===`ready`){let n=c.component;return(0,W.jsx)(n,{value:e,onChange:r,onKeyboardSubmit:i,placeholder:t,theme:f,errorLine:a})}return c.type===`fallback`?(0,W.jsx)(`textarea`,{className:`ttd-dialog-input`,onChange:e=>r(e.target.value),value:e,placeholder:t,ref:o}):u?(0,W.jsx)(`div`,{className:`ttd-dialog-input ttd-dialog-input--loading`,children:(0,W.jsx)($S,{})}):null},nF=/(?:Parse|Lexical) error on line (\d+)[.:]/i,rF=/Trying to inactivate an inactive participant \((.+)\)/i,iF=/^\s*-+\^\s*$/,aF=e=>nF.test(e),oF=e=>aF(e)||rF.test(e),sF=e=>iF.test(e),cF=e=>{let t=e.match(rF);return t?.[1]?t[1].trim():null},lF=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),uF=(e,t)=>{let n=cF(e);if(!n)return null;let r=RegExp(`^\\s*deactivate\\s+${lF(n)}(?:\\s+%%.*)?\\s*$`),i=t.split(/\r?\n/);for(let e=i.length-1;e>=0;e--)if(r.test(i[e]))return e+1;return null},dF=(e,t)=>{let n=e.match(nF);return n?Number.parseInt(n[1],10):t?uF(e,t):null},fF=(e,t)=>(e.match(t)||[]).length,pF=(e,t)=>{if(!aF(e))return null;let n=dF(e,t),r=n?`Syntax error near line ${n}.`:`Syntax error in Mermaid diagram.`,i=[];return t&&(fF(t,/\[/g)!==fF(t,/\]/g)&&i.push(`Unbalanced square brackets in a node label.`),fF(t,/\(/g)!==fF(t,/\)/g)&&i.push(`Unbalanced parentheses in a node shape.`),fF(t,/\{/g)!==fF(t,/\}/g)&&i.push(`Unbalanced braces in a decision node.`),fF(t,/^\s*subgraph\b/gm)>fF(t,/^\s*end\s*$/gm)&&i.push("A block is missing an `end` statement.")),(/got 'NODE_STRING'/.test(e)||/got 'PS'/.test(e))&&i.push(`An extra character/token may appear after a node or label definition.`),i.length===0&&(i.push(`A node or edge line is malformed (missing/extra delimiters).`),i.push("A block (`subgraph`, `class`, etc.) may be incomplete.")),{summary:r,likelyCauses:[...new Set(i)]}},mF=e=>aF(e)?e.replace(/\n\s*Expecting[\s\S]*$/,``).trimEnd():e,hF=({error:e,canvasRef:t,loaded:n,hideErrorDetails:r,sourceText:i,autoFixAvailable:a,onApplyAutoFix:o})=>{let s=e?r?K(`chat.errors.mermaidParseError`):mF(e.message):null,c=e&&!r?pF(e.message,i):null,l=!!a&&!!o&&!r,u=s?.split(/\r?\n/)??[];return(0,W.jsxs)(`div`,{className:`ttd-dialog-output-wrapper ${e?`ttd-dialog-output-wrapper--error`:``}`,children:[e&&(0,W.jsx)(`div`,{"data-testid":`ttd-dialog-output-error`,className:`ttd-dialog-output-error`,children:(0,W.jsxs)(`div`,{className:`ttd-dialog-output-error-content`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-icon`,children:rS}),c&&(0,W.jsxs)(`div`,{className:`ttd-dialog-output-error-summary`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-summary__headline`,children:c.summary}),(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-summary__label`,children:`Likely causes:`}),(0,W.jsx)(`ul`,{className:`ttd-dialog-output-error-summary__causes`,children:c.likelyCauses.map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-message`,children:u.map((e,t)=>(0,W.jsxs)(`span`,{className:sF(e)?`ttd-dialog-output-error-message__caret`:void 0,children:[e,t<u.length-1?`
|
|
69
69
|
`:``]},`error-line-${t}`))}),!r&&(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-autofix-slot`,children:l?(0,W.jsx)(QO,{className:`ttd-dialog-panel-button ttd-dialog-output-error-autofix`,onSelect:o,children:K(`mermaid.autoFixAvailable`)}):null})]})},`error`),n?(0,W.jsx)(`div`,{className:U(`ttd-dialog-output-canvas-container`,{invisible:!!e}),children:(0,W.jsx)(`div`,{ref:t,className:`ttd-dialog-output-canvas-content`})},`canvas`):(0,W.jsx)($S,{size:`2rem`})]})},gF=({label:e,children:t,panelActions:n=[],onTextSubmitInProgess:r,renderTopRight:i,renderSubmitShortcut:a,className:o,panelActionJustifyContent:s=`flex-start`})=>{let c=e=>{if(e?.variant===`link`)return(0,W.jsxs)(`button`,{className:U(`ttd-dialog-panel-action-link`,e.className),onClick:e.action,disabled:e?.disabled||r,type:`button`,children:[e.label,e.icon&&(0,W.jsx)(`span`,{className:`ttd-dialog-panel-action-link__icon`,children:e.icon})]});if(e?.variant===`button`)return(0,W.jsxs)(QO,{className:U(`ttd-dialog-panel-button`,e.className),onSelect:e.action?e.action:()=>{},disabled:e?.disabled||r,children:[(0,W.jsxs)(`div`,{className:U({invisible:r}),children:[e?.label,e?.icon&&(0,W.jsx)(`span`,{children:e.icon})]}),r&&(0,W.jsx)($S,{})]});if(e?.variant===`rateLimit`)return(0,W.jsx)(`div`,{className:U(`ttd-dialog-panel__rate-limit`,e.className),children:e.label})};return(0,W.jsxs)(`div`,{className:U(`ttd-dialog-panel`,o),children:[(e||i)&&(0,W.jsxs)(`div`,{className:`ttd-dialog-panel__header`,children:[typeof e==`string`?(0,W.jsx)(`label`,{children:e}):e,i?.()]}),t,(0,W.jsxs)(`div`,{className:U(`ttd-dialog-panel-button-container`,{invisible:!n.length}),style:{justifyContent:s},children:[n.filter(Boolean).map(e=>(0,W.jsx)(H.Fragment,{children:c(e)},e.label)),!r&&a?.()]})]})},_F=({children:e})=>(0,W.jsx)(`div`,{className:`ttd-dialog-panels`,children:e}),vF=()=>(0,W.jsxs)(`div`,{className:`ttd-dialog-submit-shortcut`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Q(`CtrlOrCmd`)}),(0,W.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Q(`Enter`)})]}),yF=(e,t)=>{let n=dF(e,t);return n==null?null:n-1},bF=(e,t,n)=>{if(t<0||t>=e.length)return null;let r=n(e[t]);if(r===e[t])return null;let i=[...e];return i[t]=r,i.join(`
|
|
70
70
|
`)},xF=e=>{let t=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([A-Za-z]+)\s*$/);if(t)return t[1];let n=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([,;:])\s*$/);return n?n[1]:e},SF=e=>e.replace(/(\|[^|\n]+\|)\s*>\s*(?=[A-Za-z0-9_("[{'`])/g,`$1 `),CF=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),wF=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${CF(t)}(?:\\s+%%.*)?\\s*$`),r=e.split(/\r?\n/);for(let e=r.length-1;e>=0;e--)if(n.test(r[e]))return r.filter((t,n)=>n!==e).join(`
|
|
71
71
|
`);return null},TF=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${CF(t)}(?:\\s+%%.*)?\\s*$`),r=e.split(/\r?\n/),i=!1,a=r.filter(e=>n.test(e)?(i=!0,!1):!0);return i?a.join(`
|
|
@@ -77,7 +77,7 @@ ${n}`},DF=e=>e.replace(/[“”]/g,`"`).replace(/[‘’]/g,`'`),OF=(e,t)=>{if(!
|
|
|
77
77
|
C -->|One| D[Laptop]
|
|
78
78
|
C -->|Two| E[iPhone]
|
|
79
79
|
C -->|Three| F[Car]`,PF=wt(jF,300),FF=500,IF=4,LF=30,RF=e=>e instanceof Error?e.message:typeof e==`string`?e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`?e.message:``,zF=({mermaidToExcalidrawLib:e,isActive:t})=>{let[n,r]=(0,H.useState)(()=>sO.get(da.MERMAID_TO_EXCALIDRAW)||NF),i=(0,H.useDeferredValue)(n),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(null),l=a?.message?dF(a.message,i):null,u=(0,H.useRef)(null),d=(0,H.useRef)({elements:[],files:null}),f=nz(),{theme:p}=gC();(0,H.useEffect)(()=>{t&&((async()=>{try{if(!i.trim()){kF({canvasRef:u,setError:o});return}let t=await AF({canvasRef:u,data:d,mermaidToExcalidrawLib:e,setError:o,mermaidDefinition:i,theme:p});t.success||o(t.error??Error(`Invalid mermaid definition`))}catch(e){Vt()&&console.error(`Failed to parse mermaid definition`,e)}})(),PF(i))},[i,e,t,p]),(0,H.useEffect)(()=>()=>{PF.flush()},[]),(0,H.useEffect)(()=>{let n=a?.message??``,r=i;if(!(t&&oF(n)&&r.trim()&&e.loaded)){c(null);return}let o=OF(r,n);if(!o.length){c(null);return}let s=!1,l=setTimeout(async()=>{try{let t=await e.api,n=new Set([r]),i=o.map(e=>({text:e,depth:1})),a=0;for(;i.length>0&&a<LF;){let e=i.shift();if(!(!e||n.has(e.text))){n.add(e.text),a+=1;try{await t.parseMermaidToExcalidraw(e.text),s||c(e.text);return}catch(t){if(e.depth>=IF)continue;let r=RF(t);if(!r)continue;let a=OF(e.text,r);for(let t of a)n.has(t)||i.push({text:t,depth:e.depth+1})}}}}catch{}s||c(null)},FF);return()=>{s=!0,clearTimeout(l)}},[i,a?.message,t,e]);let m=()=>{MF({app:f,data:d,text:n,shouldSaveMermaidDataToStorage:!0})};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`ttd-dialog-desc`,children:(0,W.jsx)(pO,{i18nKey:`mermaid.description`,flowchartLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/flowchart.html`,target:`_blank`,rel:`noreferrer`,children:e}),sequenceLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/sequenceDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),classLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/classDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),erdLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/entityRelationshipDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e})})}),(0,W.jsxs)(_F,{children:[(0,W.jsx)(gF,{children:(0,W.jsx)(tF,{input:n,placeholder:K(`mermaid.inputPlaceholder`),onChange:e=>r(e),errorLine:l,onKeyboardSubmit:()=>{m()}})}),(0,W.jsx)(gF,{panelActions:[{action:()=>{m()},label:K(`mermaid.button`),icon:uS,variant:`button`}],renderSubmitShortcut:()=>(0,W.jsx)(vF,{}),children:(0,W.jsx)(hF,{canvasRef:u,loaded:e.loaded,error:a,sourceText:n,autoFixAvailable:!!s,onApplyAutoFix:()=>{s&&r(s)}})})]})]})},BF=()=>(0,W.jsxs)(`div`,{className:`chat-interface__welcome-screen__welcome-message`,children:[(0,W.jsx)(`h3`,{children:K(`chat.placeholder.title`)}),(0,W.jsx)(`p`,{children:K(`chat.placeholder.description`)}),(0,W.jsx)(`p`,{children:K(`chat.placeholder.hint`)})]}),VF=({message:e,onMermaidTabClick:t,onAiRepairClick:n,onDeleteMessage:i,onInsertMessage:a,onRetry:o,rateLimitRemaining:s,isLastMessage:c,renderWarning:l,allowFixingParseError:u})=>{let[d,f]=(0,H.useState)(!1);(0,H.useEffect)(()=>{if(!e.error||!c)return;if(e.error&&!e.lastAttemptAt){f(!0);return}let t=Date.now()-e.lastAttemptAt,n=Math.max(0,5e3-t);if(n===0){f(!0);return}f(!1);let r=setTimeout(()=>{f(!0)},n);return()=>clearTimeout(r)},[e.error,e.lastAttemptAt,c]);let p=e=>e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});if(e.type===`warning`){let t=l?.(e);return(0,W.jsx)(`div`,{className:`chat-message chat-message--system`,children:(0,W.jsxs)(`div`,{className:`chat-message__content`,children:[(0,W.jsxs)(`div`,{className:`chat-message__header`,children:[(0,W.jsx)(`span`,{className:`chat-message__role`,children:K(`chat.role.system`)}),(0,W.jsx)(`span`,{className:`chat-message__timestamp`,children:p(e.timestamp)})]}),(0,W.jsx)(`div`,{className:`chat-message__body`,children:(0,W.jsx)(`div`,{className:`chat-message__text`,children:t||(e.warningType===`messageLimitExceeded`?(0,W.jsxs)(W.Fragment,{children:[K(`chat.rateLimit.messageLimit`),(0,W.jsx)(`div`,{style:{marginTop:`10px`},children:(0,W.jsx)(FP,{onClick:()=>{window.open(`${r.VITE_APP_PLUS_LP}/plus?utm_source=excalidraw&utm_medium=app&utm_content=ttdChatBanner#excalidraw-redirect`,`_blank`,`noopener`)},children:K(`chat.upsellBtnLabel`)})})]}):K(`chat.rateLimit.generalRateLimit`))})})]})})}return(0,W.jsxs)(`div`,{className:`chat-message chat-message--${e.type}`,children:[(0,W.jsxs)(`div`,{className:`chat-message__content`,children:[(0,W.jsxs)(`div`,{className:`chat-message__header`,children:[(0,W.jsx)(`span`,{className:`chat-message__role`,children:e.type===`user`?K(`chat.role.user`):K(`chat.role.assistant`)}),(0,W.jsx)(`span`,{className:`chat-message__timestamp`,children:p(e.timestamp)})]}),(0,W.jsx)(`div`,{className:`chat-message__body`,children:e.error?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`chat-message__error`,children:e.content}),e.errorType!==`parse`&&(0,W.jsxs)(`div`,{className:`chat-message__error_message`,children:[`Error: `,e.error||K(`chat.errors.generationFailed`)]}),e.errorType===`parse`&&u&&(0,W.jsxs)(`div`,{className:`chat-message__error_message`,children:[(0,W.jsx)(`p`,{children:K(`chat.errors.invalidDiagram`)}),(0,W.jsxs)(`div`,{className:`chat-message__error-actions`,children:[t&&(0,W.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>t(e),type:`button`,children:K(`chat.errors.fixInMermaid`)}),n&&(0,W.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>n(e),disabled:s===0,type:`button`,children:K(`chat.errors.aiRepair`)})]})]})]}):(0,W.jsxs)(`div`,{className:`chat-message__text`,children:[e.content,e.isGenerating&&(0,W.jsx)(`span`,{className:`chat-message__cursor`,children:`▋`})]})})]}),e.type===`assistant`&&!e.isGenerating&&(0,W.jsxs)(`div`,{className:`chat-message__actions`,children:[!e.error&&a&&(0,W.jsx)(`button`,{className:`chat-message__action`,onClick:()=>a(e),type:`button`,"aria-label":K(`chat.insert`),title:K(`chat.insert`),children:lS}),t&&e.content&&(0,W.jsx)(`button`,{className:`chat-message__action`,onClick:()=>t(e),type:`button`,"aria-label":K(`chat.viewAsMermaid`),title:K(`chat.viewAsMermaid`),children:Vx}),i&&e.errorType!==`network`&&(0,W.jsx)(`button`,{className:`chat-message__action chat-message__action--danger`,onClick:()=>i(e.id),type:`button`,"aria-label":K(`chat.deleteMessage`),title:K(`chat.deleteMessage`),children:pb}),e.errorType===`network`&&o&&c&&(0,W.jsx)(`button`,{className:U(`chat-message__action`,{invisible:!d}),onClick:()=>o(e),type:`button`,"aria-label":K(`chat.retry`),title:K(`chat.retry`),children:cS})]})]})},HF=({chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,rateLimits:o,onAbort:s,onMermaidTabClick:c,onAiRepairClick:l,onDeleteMessage:u,onInsertMessage:d,onRetry:f,renderWelcomeScreen:p,renderWarning:m})=>{let h=(0,H.useRef)(null),g=(0,H.useRef)(null);(0,H.useLayoutEffect)(()=>{h.current?.scrollIntoView()},[t]),(0,H.useEffect)(()=>{g.current&&g.current.focus()},[e]);let _=e=>{let t=e.target.value;r(t)},v=()=>{if(a&&s){s();return}let e=n.trim();e&&(i({prompt:e}),r(``))},y=e=>{e.key===N.ENTER&&!e.shiftKey&&(e.preventDefault(),a||v())},b=n.trim().length>3&&!a&&(o?.rateLimitRemaining??1)>0,x=a&&!!s;return(0,W.jsxs)(`div`,{className:`chat-interface`,children:[(0,W.jsxs)(`div`,{className:`chat-interface__messages`,children:[t.length===0?(0,W.jsx)(`div`,{className:`chat-interface__welcome-screen`,children:p?p({rateLimits:o??null}):(0,W.jsx)(BF,{})}):t.map((e,n)=>(0,W.jsx)(VF,{message:e,onMermaidTabClick:c,onAiRepairClick:l,onDeleteMessage:u,onInsertMessage:d,onRetry:f,rateLimitRemaining:o?.rateLimitRemaining,isLastMessage:n===t.length-1,renderWarning:m,allowFixingParseError:e.errorType===`parse`&&n===t.length-1},e.id)),(0,W.jsx)(`div`,{ref:h,id:`messages-end`})]}),(0,W.jsx)(`div`,{className:`chat-interface__input-container`,children:(0,W.jsx)(`div`,{className:`chat-interface__input-outer`,children:(0,W.jsxs)(`div`,{className:`chat-interface__input-wrapper`,style:{borderColor:a?`var(--dialog-border-color)`:void 0},children:[(0,W.jsx)(`textarea`,{ref:g,autoFocus:!0,className:`chat-interface__input`,value:n,onChange:_,onKeyDown:y,placeholder:a?K(`chat.generating`):o?.rateLimitRemaining===0?K(`chat.rateLimit.messageLimitInputPlaceholder`):t.length>0?K(`chat.inputPlaceholderWithMessages`):K(`chat.inputPlaceholder`,{shortcut:`Shift + Enter`}),disabled:o?.rateLimitRemaining===0,rows:1,cols:30,onInput:e=>{let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,120)}px`}}),(0,W.jsx)(`button`,{className:`chat-interface__send-button`,onClick:v,disabled:!b&&!x,type:`button`,children:(0,W.jsx)(mw,{size:`1.5em`,icon:a?tx:uS})})]})})})]})},UF=yc(null),WF=yc(!1),GF=yc(null),KF=yc({id:Bi(),messages:[],currentPrompt:``}),qF=(e,t)=>{let{messages:n}=e,r=_n(n,e=>e.type===`assistant`);if(r===-1)return e;let i=n[r],a=n.slice();return a[r]={...i,...t},{...e,messages:a}},JF=e=>{let{messages:t}=e;return t[_n(t,e=>e.type===`assistant`)]},YF=(e,t)=>{let n=t.map(e=>({...e,id:Bi(),timestamp:new Date}));return{...e,messages:[...e.messages,...n]}},XF=e=>{let t=_n(e.messages??[],e=>e.type===`assistant`);return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}},ZF=e=>{let t=[];for(let n of e.messages)n.content&&(n.type===`user`||n.type===`assistant`)&&t.push({role:n.type,content:n.content});return t},QF=()=>{let[e,t]=vy(KF);return{addUserMessage:e=>{t(t=>YF(t,[{type:`user`,content:e}]))},addAssistantMessage:()=>{t(e=>YF(e,[{type:`assistant`,content:``,isGenerating:!0}]))},setAssistantError:(e,n=`other`,r)=>{let i=r?JSON.stringify({name:r instanceof Error?r.name:`Error`,message:r instanceof Error?r.message:String(r),stack:r instanceof Error?r.stack:void 0}):void 0;t(t=>qF(t,{isGenerating:!1,error:e,errorType:n,errorDetails:i}))},chatHistory:e,setChatHistory:t,setLastRetryAttempt:()=>{t(e=>qF(e,{lastAttemptAt:Date.now()}))}}},$F=e=>{let t=e.trim();return t.length<=50?t:`${t.substring(0,47)}...`},eI=yc([]),tI=yc(!1),nI=yc(!1),rI=({persistenceAdapter:e})=>{let[t]=vy(KF),[n,r]=vy(eI),[i,a]=vy(tI),[o,s]=vy(nI),c=(0,H.useRef)(n);c.current=n;let l=t?.messages[t?.messages.length-1],u=(0,H.useCallback)(async()=>{if(!(o||i)){a(!0);try{r(await e.loadChats()),s(!0)}catch(e){console.warn(`Failed to load chats:`,e),r([]),s(!0)}finally{a(!1)}}},[o,i,r,a,s,e]);(0,H.useEffect)(()=>{u()},[]);let d=(0,H.useCallback)(async()=>{if(t.messages.length===0)return;let n=t.messages.find(e=>e.type===`user`);if(!n||typeof n.content!=`string`)return;let i=$F(n.content),a=c.current,o=a.find(e=>e.id===t.id),s=!o||o.messages.length!==t.messages.length||o.messages.some((e,n)=>e.id!==t.messages[n]?.id||e.content!==t.messages[n]?.content),l={id:t.id,title:i,messages:t.messages.filter(e=>e.type===`user`||e.type===`assistant`).map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp)})),currentPrompt:t.currentPrompt,timestamp:s?Date.now():o?.timestamp??Date.now()},u=[...a.filter(e=>e.id!==t.id),l].sort((e,t)=>t.timestamp-e.timestamp).slice(0,10);r(u);try{await e.saveChats(u)}catch(e){console.warn(`Failed to save chats:`,e)}},[t,r,e]);return(0,H.useEffect)(()=>{l?.isGenerating||d()},[t.messages?.length,l?.id,l?.isGenerating]),{savedChats:n,saveCurrentChat:d,deleteChat:(0,H.useCallback)(async t=>{let n=c.current.filter(e=>e.id!==t);r(n);try{await e.saveChats(n)}catch(e){console.warn(`Failed to save after delete:`,e)}return n},[r,e]),restoreChat:(0,H.useCallback)(e=>e,[]),createNewChatId:(0,H.useCallback)(async()=>(await d(),Bi()),[d])}},iI=e=>{let t=e.trim();if(!t)return!1;let n=(t.match(/\[/g)||[]).length,r=(t.match(/\]/g)||[]).length,i=(t.match(/\{/g)||[]).length,a=(t.match(/\}/g)||[]).length,o=(t.match(/\(/g)||[]).length,s=(t.match(/\)/g)||[]).length;if(n!==r||i!==a||o!==s)return!1;let c=t.split(`
|
|
80
|
-
`).pop()?.trim()||``;return![/-->$/,/--$/,/-\.$/,/==>$/,/==$/,/~~$/,/::$/,/:$/,/\|$/,/&$/].some(e=>e.test(c))},aI=300,oI=3e3,sI=100,cI=100,lI=({mermaidToExcalidrawLib:e,canvasRef:t})=>{let[n]=vy(KF),[,r]=vy(GF),[i,a]=vy(WF),o=(0,H.useRef)(!1),s=(0,H.useMemo)(()=>JF(n),[n]),c=(0,H.useRef)(s);(0,H.useEffect)(()=>{c.current=s},[s]);let l=(0,H.useRef)({elements:[],files:null}),u=(0,H.useRef)(0),d=(0,H.useRef)(null),f=(0,H.useRef)(!1),p=(0,H.useRef)(aI),{theme:m}=gC(),h=(0,H.useCallback)(async n=>{if(!n.trim()||!e.loaded||o.current)return!1;o.current=!0;let i=performance.now(),a=await AF({canvasRef:t,data:l,mermaidToExcalidrawLib:e,setError:r,mermaidDefinition:n,theme:m});return performance.now()-i<sI?p.current=aI:p.current=oI,o.current=!1,a.success},[t,e,r,m]),g=(0,H.useMemo)(()=>{let e=async e=>{let t=Date.now(),n=t-u.current,r=p.current;if(!iI(e)){f.current||=(u.current=Math.max(u.current,t-r+cI),!0),d.current=e;return}if(f.current=!1,n<r){d.current=e;return}d.current=null;let i=await h(e);u.current=Date.now(),i||(u.current=u.current-r+cI,f.current=!0)};return e.flush=async()=>{if(d.current){let e=d.current;d.current=null,await h(e),u.current=Date.now()}},e.cancel=()=>{d.current=null},e},[h]),_=(0,H.useCallback)(()=>{u.current=0,d.current=null,f.current=!1,p.current=aI},[]);return(0,H.useEffect)(()=>{s?.content&&s?.isGenerating?g(s.content):s?.isGenerating||(g.flush(),_(),s?.content&&g(s.content))},[_,g,s?.isGenerating,s?.content]),(0,H.useEffect)(()=>{let e=c.current;!e?.content||e.error||i&&h(e.content)},[n?.id,h,i]),(0,H.useEffect)(()=>{if(n.messages?.filter(e=>e.type===`assistant`).length)i||a(!0);else{let e=t.current;if(e){let t=e.parentElement;t&&(t.style.background=``,e.replaceChildren())}a(!1)}},[n.messages,a,t,i]),{data:l}},uI=3,dI=1e4,fI=({onTextSubmit:e})=>{let[,t]=vy(GF),[n,r]=vy(UF),[i,a]=vy(KF),{addUserMessage:o,addAssistantMessage:s,setAssistantError:c}=QF(),l=(0,H.useRef)(null),u=e=>e.length>dI||e.length<uI||n?.rateLimitRemaining===0?(e.length<uI&&t(Error(K(`chat.errors.promptTooShort`,{min:uI}))),e.length>dI&&t(Error(K(`chat.errors.promptTooLong`,{max:dI}))),!1):!0;return{onGenerate:async({prompt:n,isRepairFlow:d=!1})=>{if(!u(n))return;l.current&&l.current.abort(),t(null);let f=new AbortController;l.current=f,d?a(e=>qF(e,{isGenerating:!0,content:``,error:void 0,errorType:void 0,errorDetails:void 0})):(o(n),s());try{dC(`ai`,`generate`,`ttd`);let{generatedResponse:o,error:s,rateLimit:l,rateLimitRemaining:u}=await e({messages:[...ZF(i).slice(-3),{role:`user`,content:n}],onStreamCreated:()=>{d&&a(e=>qF(e,{content:``,error:``,isGenerating:!0}))},onChunk:e=>{a(t=>qF(t,{content:JF(t).content+e}))},signal:f.signal});if(a(e=>qF(e,{isGenerating:!1})),Ls(l)&&Ls(u)&&r({rateLimit:l,rateLimitRemaining:u}),(s?.status===429||u===0)&&a(e=>(s?.status===429&&(e=XF(e)),e={...e,messages:e.messages.filter(e=>e.type!==`warning`||e.warningType===`rateLimitExceeded`||e.warningType===`messageLimitExceeded`)},YF(e,[{type:`warning`,warningType:u===0?`messageLimitExceeded`:`rateLimitExceeded`}]))),s){if(s.name===`AbortError`||s.message===`Aborted`||f.signal.aborted)return;let e=Error(s.message||K(`chat.errors.requestFailed`));s.status!==429&&c(e.message,`network`),t(e);return}try{await
|
|
80
|
+
`).pop()?.trim()||``;return![/-->$/,/--$/,/-\.$/,/==>$/,/==$/,/~~$/,/::$/,/:$/,/\|$/,/&$/].some(e=>e.test(c))},aI=300,oI=3e3,sI=100,cI=100,lI=({mermaidToExcalidrawLib:e,canvasRef:t})=>{let[n]=vy(KF),[,r]=vy(GF),[i,a]=vy(WF),o=(0,H.useRef)(!1),s=(0,H.useMemo)(()=>JF(n),[n]),c=(0,H.useRef)(s);(0,H.useEffect)(()=>{c.current=s},[s]);let l=(0,H.useRef)({elements:[],files:null}),u=(0,H.useRef)(0),d=(0,H.useRef)(null),f=(0,H.useRef)(!1),p=(0,H.useRef)(aI),{theme:m}=gC(),h=(0,H.useCallback)(async n=>{if(!n.trim()||!e.loaded||o.current)return!1;o.current=!0;let i=performance.now(),a=await AF({canvasRef:t,data:l,mermaidToExcalidrawLib:e,setError:r,mermaidDefinition:n,theme:m});return performance.now()-i<sI?p.current=aI:p.current=oI,o.current=!1,a.success},[t,e,r,m]),g=(0,H.useMemo)(()=>{let e=async e=>{let t=Date.now(),n=t-u.current,r=p.current;if(!iI(e)){f.current||=(u.current=Math.max(u.current,t-r+cI),!0),d.current=e;return}if(f.current=!1,n<r){d.current=e;return}d.current=null;let i=await h(e);u.current=Date.now(),i||(u.current=u.current-r+cI,f.current=!0)};return e.flush=async()=>{if(d.current){let e=d.current;d.current=null,await h(e),u.current=Date.now()}},e.cancel=()=>{d.current=null},e},[h]),_=(0,H.useCallback)(()=>{u.current=0,d.current=null,f.current=!1,p.current=aI},[]);return(0,H.useEffect)(()=>{s?.content&&s?.isGenerating?g(s.content):s?.isGenerating||(g.flush(),_(),s?.content&&g(s.content))},[_,g,s?.isGenerating,s?.content]),(0,H.useEffect)(()=>{let e=c.current;!e?.content||e.error||i&&h(e.content)},[n?.id,h,i]),(0,H.useEffect)(()=>{if(n.messages?.filter(e=>e.type===`assistant`).length)i||a(!0);else{let e=t.current;if(e){let t=e.parentElement;t&&(t.style.background=``,e.replaceChildren())}a(!1)}},[n.messages,a,t,i]),{data:l}},uI=3,dI=1e4,fI=({onTextSubmit:e})=>{let[,t]=vy(GF),[n,r]=vy(UF),[i,a]=vy(KF),{addUserMessage:o,addAssistantMessage:s,setAssistantError:c}=QF(),l=(0,H.useRef)(null),u=e=>e.length>dI||e.length<uI||n?.rateLimitRemaining===0?(e.length<uI&&t(Error(K(`chat.errors.promptTooShort`,{min:uI}))),e.length>dI&&t(Error(K(`chat.errors.promptTooLong`,{max:dI}))),!1):!0;return{onGenerate:async({prompt:n,isRepairFlow:d=!1})=>{if(!u(n))return;l.current&&l.current.abort(),t(null);let f=new AbortController;l.current=f,d?a(e=>qF(e,{isGenerating:!0,content:``,error:void 0,errorType:void 0,errorDetails:void 0})):(o(n),s());try{dC(`ai`,`generate`,`ttd`);let{generatedResponse:o,error:s,rateLimit:l,rateLimitRemaining:u}=await e({messages:[...ZF(i).slice(-3),{role:`user`,content:n}],onStreamCreated:()=>{d&&a(e=>qF(e,{content:``,error:``,isGenerating:!0}))},onChunk:e=>{a(t=>qF(t,{content:JF(t).content+e}))},signal:f.signal});if(a(e=>qF(e,{isGenerating:!1})),Ls(l)&&Ls(u)&&r({rateLimit:l,rateLimitRemaining:u}),(s?.status===429||u===0)&&a(e=>(s?.status===429&&(e=XF(e)),e={...e,messages:e.messages.filter(e=>e.type!==`warning`||e.warningType===`rateLimitExceeded`||e.warningType===`messageLimitExceeded`)},YF(e,[{type:`warning`,warningType:u===0?`messageLimitExceeded`:`rateLimitExceeded`}]))),s){if(s.name===`AbortError`||s.message===`Aborted`||f.signal.aborted)return;let e=Error(s.message||K(`chat.errors.requestFailed`));s.status!==429&&c(e.message,`network`),t(e);return}try{await cc(o??``),dC(`ai`,`mermaid parse success`,`ttd`)}catch(e){dC(`ai`,`mermaid parse failed`,`ttd`);let n=Error(e.message||K(`chat.errors.mermaidParseError`));c(n.message,`parse`),t(n)}}catch(e){let n=Error(e.message||K(`chat.errors.generationFailed`));c(n.message,`other`),t(n)}finally{l.current=null}},handleAbort:()=>{l.current&&l.current.abort()}}},pI=({persistenceAdapter:e})=>{let t=yy(GF),[n,r]=vy(KF),[i,a]=(0,H.useState)(!1),{restoreChat:o,deleteChat:s,createNewChatId:c}=rI({persistenceAdapter:e}),l=(0,H.useCallback)(e=>{let n=e.messages.map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp)})),i={id:e.id,messages:n,currentPrompt:``},a=JF(i);t(a?.error?Error(a?.error):null),r(i)},[t,r]),u=(0,H.useCallback)(async()=>{r({id:await c(),messages:[],currentPrompt:``}),t(null)},[c,r,t]);return{isMenuOpen:i,onRestoreChat:(0,H.useCallback)(e=>{l(o(e)),a(!1)},[o,l]),handleDeleteChat:(0,H.useCallback)(async(e,t)=>{t.stopPropagation();let r=e===n.id,i=await s(e);if(r)if(i.length>0){let e=i[0];l(e)}else await u()},[n.id,s,l,u]),handleNewChat:(0,H.useCallback)(async()=>{await u(),a(!1)},[u]),handleMenuToggle:(0,H.useCallback)(()=>{a(e=>!e)},[]),handleMenuClose:(0,H.useCallback)(()=>{a(!1)},[])}},mI=({isOpen:e,onToggle:t,onClose:n,onNewChat:r,onRestoreChat:i,onDeleteChat:a,isNewChatBtnVisible:o,savedChats:s,activeSessionId:c,disabled:l})=>(0,W.jsxs)(`div`,{className:`ttd-chat-history-menu`,children:[o&&(0,W.jsx)(FP,{onClick:r,disabled:l,children:K(`chat.newChat`)}),s.length>0&&(0,W.jsx)(`div`,{className:`ttd-dialog-panel__menu-wrapper`,children:(0,W.jsxs)(HO,{open:e,children:[(0,W.jsx)(HO.Trigger,{onToggle:t,className:`ttd-dialog-menu-trigger`,disabled:l,title:K(`chat.menu`),"aria-label":K(`chat.menu`),children:bS}),(0,W.jsx)(HO.Content,{onClickOutside:n,onSelect:n,children:(0,W.jsx)(W.Fragment,{children:s.map(e=>(0,W.jsxs)(HO.ItemCustom,{className:U(`ttd-chat-menu-item`,{"ttd-chat-menu-item--active":e.id===c}),onClick:()=>{i(e)},children:[(0,W.jsx)(`span`,{className:`ttd-chat-menu-item__title`,children:e.title}),(0,W.jsx)(`button`,{className:`ttd-chat-menu-item__delete`,onClick:t=>a(e.id,t),title:K(`chat.deleteChat`),"aria-label":K(`chat.deleteChat`),type:`button`,children:pb})]},e.id))})})]})})]}),hI=({chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,generatedResponse:o,isMenuOpen:s,onMenuToggle:c,onMenuClose:l,onNewChat:u,onRestoreChat:d,onDeleteChat:f,savedChats:p,activeSessionId:m,onAbort:h,onMermaidTabClick:g,onAiRepairClick:_,onDeleteMessage:v,onInsertMessage:y,onRetry:b,onViewAsMermaid:x,renderWelcomeScreen:S,renderWarning:C})=>{let[w]=vy(UF),T=(()=>{let e=[];return w&&e.push({label:K(`chat.rateLimitRemaining`,{count:w.rateLimitRemaining}),variant:`rateLimit`,className:w.rateLimitRemaining<5?`ttd-dialog-panel__rate-limit--danger`:``}),o&&e.push({action:x,label:K(`chat.viewAsMermaid`),icon:(0,W.jsx)(mw,{icon:uS}),variant:`link`}),e})();return(0,W.jsx)(gF,{label:(0,W.jsxs)(`div`,{className:`ttd-dialog-panel__label-wrapper`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-panel__label-group`}),(0,W.jsx)(`div`,{className:`ttd-dialog-panel__header-right`,children:(0,W.jsx)(mI,{isNewChatBtnVisible:!!t.length,isOpen:s,onToggle:c,onClose:l,onNewChat:u,onRestoreChat:d,onDeleteChat:f,savedChats:p,activeSessionId:m,disabled:a})})]}),className:`ttd-dialog-chat-panel`,panelActionJustifyContent:T.length===2?`space-between`:T.length===1&&T[0].variant===`rateLimit`?`flex-start`:`flex-end`,panelActions:T,children:(0,W.jsx)(HF,{chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,generatedResponse:o,onAbort:h,onMermaidTabClick:g,onAiRepairClick:_,onDeleteMessage:v,onInsertMessage:y,onRetry:b,rateLimits:w,renderWelcomeScreen:S,renderWarning:C})})},gI=({canvasRef:e,error:t,loaded:n,onInsert:r,hideErrorDetails:i})=>(0,W.jsx)(gF,{panelActionJustifyContent:`flex-end`,panelActions:[{action:r,label:K(`chat.insert`),icon:uS,variant:`button`}],className:`ttd-dialog-preview-panel`,children:(0,W.jsx)(hF,{canvasRef:e,error:t,loaded:n,hideErrorDetails:i})}),_I=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>{let a=nz(),o=lz(),s=(0,H.useRef)(null),[c,l]=vy(GF),[u,d]=vy(KF),f=by(WF),{savedChats:p}=rI({persistenceAdapter:i}),m=JF(u),{setLastRetryAttempt:h}=QF(),{data:g}=lI({canvasRef:s,mermaidToExcalidrawLib:e}),{onGenerate:_,handleAbort:v}=fI({onTextSubmit:t}),{isMenuOpen:y,onRestoreChat:b,handleDeleteChat:x,handleNewChat:S,handleMenuToggle:C,handleMenuClose:w}=pI({persistenceAdapter:i});return(0,W.jsxs)(`div`,{className:`ttd-dialog-layout ${f?`ttd-dialog-layout--split`:`ttd-dialog-layout--chat-only`}`,children:[(0,W.jsx)(hI,{chatId:u.id,messages:u.messages,currentPrompt:u.currentPrompt,onPromptChange:e=>{d(t=>({...t,currentPrompt:e}))},onGenerate:_,isGenerating:m?.isGenerating??!1,generatedResponse:m?.content,isMenuOpen:y,onMenuToggle:C,onMenuClose:w,onNewChat:S,onRestoreChat:b,onDeleteChat:x,savedChats:p,activeSessionId:u.id,onAbort:v,onMermaidTabClick:e=>{let t=e.content||``;t&&(jF(t),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},onAiRepairClick:async e=>{let t=e.content||``,n=e.error||``;t&&await _({prompt:`Fix the error in this Mermaid diagram. The diagram is:
|
|
81
81
|
|
|
82
82
|
\`\`\`mermaid
|
|
83
83
|
${t}
|
|
@@ -85,7 +85,7 @@ ${t}
|
|
|
85
85
|
|
|
86
86
|
The exception/error is: ${n}
|
|
87
87
|
|
|
88
|
-
Please fix the Mermaid syntax and regenerate a valid diagram.`,isRepairFlow:!0})},onDeleteMessage:e=>{let t=u.messages.findIndex(t=>t.id===e&&t.type===`assistant`),n=u.messages.slice(0,t-1);d({...u,messages:n})},onInsertMessage:async t=>{let n=t.content||``;if(!n.trim()||!e.loaded)return;let r={current:{elements:[],files:null}};(await AF({canvasRef:s,data:r,mermaidToExcalidrawLib:e,setError:l,mermaidDefinition:n,theme:a.state.theme})).success&&MF({app:a,data:r,text:n,shouldSaveMermaidDataToStorage:!0})},onRetry:async e=>{let t=u.messages.findIndex(t=>t.id===e.id);if(t>0){let e=u.messages[t-1];e.type===`user`&&typeof e.content==`string`&&(h(),await _({prompt:e.content,isRepairFlow:!0}))}},onViewAsMermaid:()=>{typeof m?.content==`string`&&(jF(m.content),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},renderWarning:r,renderWelcomeScreen:n}),f&&(0,W.jsx)(gI,{canvasRef:s,hideErrorDetails:m?.errorType===`parse`,error:c,loaded:e.loaded,onInsert:()=>{MF({app:a,data:g})}})]})},vI=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>(0,W.jsx)(_I,{mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i}),yI=e=>{let t=lz(),n=(0,H.useRef)(null),r=(0,H.useRef)(0);return(0,W.jsx)(sv,{ref:n,className:`ttd-dialog-tabs-root`,value:e.tab,onValueChange:i=>{if(!i)return;let a=n.current?.closest(`.Modal__content`);if(a){let e=a.offsetHeight||0;e>r.current&&(r.current=e,a.style.minHeight=`min(${r.current}px, 100%)`)}e.dialog===`ttd`&&Sn([`text-to-diagram`,`mermaid`],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})};yI.displayName=`TTDDialogTabs`;var bI=yI,xI=({children:e,...t})=>(0,W.jsx)(cv,{className:`ttd-dialog-triggers`,...t,children:e});xI.displayName=`TTDDialogTabTriggers`;var SI=({children:e,tab:t,onSelect:n,...r})=>(0,W.jsx)(lv,{value:t,asChild:!0,onSelect:n,children:(0,W.jsx)(`button`,{type:`button`,className:`ttd-dialog-tab-trigger`,...r,children:e})});SI.displayName=`TTDDialogTabTrigger`;var CI=({tab:e,children:t,...n})=>(0,W.jsx)(uv,{...n,value:e,children:t});CI.displayName=`TTDDialogTab`;var wI=e=>{let t=gC();return t.openDialog?.name===`ttd`?(0,W.jsx)(TI,{...e,tab:t.openDialog.tab}):null};wI.WelcomeMessage=BF;var TI=oP(`TTDDialogBase`,({tab:e,...t})=>{let r=nz(),[i,a]=(0,H.useState)({loaded:!1,api:n(()=>import(`./excalidraw-mermaid-stub-C1ZaaI05.js`),__vite__mapDeps([70,71]),import.meta.url)});return(0,H.useEffect)(()=>{(async()=>{await i.api,a(e=>({...e,loaded:!0}))})()},[i.api]),(0,W.jsx)(dk,{className:`ttd-dialog`,onCloseRequest:()=>{r.setOpenDialog(null)},size:1520,title:!1,...t,autofocus:!1,children:(0,W.jsxs)(bI,{dialog:`ttd`,tab:e,children:[`__fallback`in t&&t.__fallback?(0,W.jsx)(`p`,{className:`dialog-mermaid-title`,children:K(`mermaid.title`)}):(0,W.jsxs)(xI,{children:[(0,W.jsx)(SI,{tab:`text-to-diagram`,children:(0,W.jsxs)(`div`,{className:`ttd-dialog-tab-trigger__content`,children:[K(`labels.textToDiagram`),(0,W.jsx)(`div`,{className:`ttd-dialog-tab-trigger__badge`,children:K(`chat.aiBeta`)})]})}),(0,W.jsx)(SI,{tab:`mermaid`,children:K(`mermaid.label`)})]}),!(`__fallback`in t)&&(0,W.jsx)(CI,{className:`ttd-dialog-content`,tab:`text-to-diagram`,children:(0,W.jsx)(vI,{mermaidToExcalidrawLib:i,onTextSubmit:t.onTextSubmit,renderWelcomeScreen:t.renderWelcomeScreen,renderWarning:t.renderWarning,persistenceAdapter:t.persistenceAdapter})}),(0,W.jsx)(CI,{className:`ttd-dialog-content`,tab:`mermaid`,children:(0,W.jsx)(zF,{mermaidToExcalidrawLib:i,isActive:e===`mermaid`})})]})})}),EI=.01,DI=10,OI=(e,t)=>!(t===`angle`&&L(e)),kI=(e,t)=>{let n=e+t/2;return n-n%t},AI=(e,t,n)=>Object.keys(e).map(e=>({original:(n??t).get(e),latest:t.get(e)})).filter(e=>e.original!==void 0&&e.latest!==void 0),jI=(e,t,n,r,i,a,o=!0)=>{if(ss(n)&&(n.startBinding||n.endBinding)){if(Math.abs(e-n.x)<10&&Math.abs(t-n.y)<10)return;vr(n,`start`,r),vr(n,`end`,r)}let s=r.getNonDeletedElementsMap(),c=s.get(n.id);if(!c)return;let[l,u]=[n.x+n.width/2,n.y+n.height/2],[d,f]=ke(O(n.x,n.y),O(l,u),n.angle),p=e-d,m=t-f,[h,g]=ke(O(e,t),O(l+p,u+m),-n.angle);r.mutateElement(c,{x:h,y:g},{informMutation:o,isDragging:!1}),Xn(c,r,i);let _=ut(n,a);if(_){let e=s.get(_.id);e&&r.mutateElement(e,{x:_.x+p,y:_.y+m},{informMutation:o,isDragging:!1})}if(L(n)){let e=Di(a,n.id);e.forEach(t=>{let n=s.get(t.id);if(!n)return;let[a,c]=[t.x+t.width/2,t.y+t.height/2],[l,u]=ke(O(t.x,t.y),O(a,c),t.angle),[d,f]=ke(O(Math.round(l+p),Math.round(u+m)),O(a+p,c+m),-t.angle);r.mutateElement(n,{x:d,y:f},{informMutation:o,isDragging:!1}),Xn(n,r,i,{simultaneouslyUpdated:e})})}},MI=(e,t)=>{let n=po(t).map(t=>Ki(e,t).reduce((e,t)=>(e[t.id]=!0,e),{}));return e.filter(e=>!Nn(e)).forEach(e=>{n.push({[e.id]:!0})}),n},NI=({label:e,icon:t,dragInputCallback:n,value:r,elements:i,editable:a=!0,shouldKeepAspectRatio:o,property:s,scene:c,appState:l,sensitivity:u=1,dragFinishedCallback:d})=>{let f=nz(),p=lz(),m=(0,H.useRef)(null),h=(0,H.useRef)(null),[g,_]=(0,H.useState)(r.toString()),v=(0,H.useRef)(null);v.current||={originalAppState:js(l),originalElements:i,lastUpdatedValue:g,updatePending:!1},(0,H.useEffect)(()=>{let e=r.toString();_(e),v.current.lastUpdatedValue=e},[r]);let y=(e,t,i)=>{if(!v.current.updatePending)return!1;v.current.updatePending=!1;let a=Number(e);if(isNaN(a)){_(r.toString());return}let l=Number(a.toFixed(2)),u=Number(r);(isNaN(u)||Math.abs(l-u)>=EI)&&(v.current.lastUpdatedValue=e,n({accumulatedChange:0,instantChange:0,originalElements:t,originalElementsMap:f.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:o,shouldChangeByStepSize:!1,scene:c,nextValue:l,property:s,originalAppState:i,setInputValue:e=>_(String(e)),app:f,setAppState:p}),f.syncActionResult({captureUpdate:V.IMMEDIATELY}))},b=(0,H.useRef)({});return b.current.handleInputValue=y,(0,H.useEffect)(()=>{let e=m.current,t=b.current;return()=>{let n=e?.value;n&&t.handleInputValue?.(n,v.current.originalElements,v.current.originalAppState),window.removeEventListener(F.POINTER_MOVE,t.onPointerMove,!1),window.removeEventListener(F.POINTER_UP,t.onPointerUp,!1)}},[a]),a?(0,W.jsxs)(`div`,{className:U(`drag-input-container`,!a&&`disabled`),"data-testid":e,children:[(0,W.jsx)(`div`,{className:`drag-input-label`,ref:h,onPointerDown:e=>{if(m.current&&a){document.body.classList.add(`excalidraw-cursor-resize`);let e=Number(m.current.value);isNaN(e)&&(e=0);let t=null,r=f.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,qn(t)),e),new Map),a=i.map(e=>r.get(e.id)),h=js(l),g=0,v=0,y=e=>{if(t&&r!==null&&a!==null){let i=e.clientX-t.x;i!==0&&(v+=i,Math.abs(v)>=u&&(v=Math.sign(v)*Math.floor(Math.abs(v)/u),g+=v,n({accumulatedChange:g,instantChange:v,originalElements:a,originalElementsMap:r,shouldKeepAspectRatio:o,shouldChangeByStepSize:e.shiftKey,property:s,scene:c,originalAppState:h,setInputValue:e=>_(String(e)),app:f,setAppState:p}),v=0))}t={x:e.clientX,y:e.clientY}},x=()=>{window.removeEventListener(F.POINTER_MOVE,y,!1),f.syncActionResult({captureUpdate:V.IMMEDIATELY}),d?.({app:f,setAppState:p,originalElements:a,originalAppState:h}),t=null,g=0,v=0,a=null,r=null,document.body.classList.remove(`excalidraw-cursor-resize`),window.removeEventListener(F.POINTER_UP,x,!1)};b.current.onPointerMove=y,b.current.onPointerUp=x,window.addEventListener(F.POINTER_MOVE,y,!1),window.addEventListener(F.POINTER_UP,x,!1)}},onPointerEnter:()=>{h.current&&(h.current.style.cursor=`ew-resize`)},children:t?(0,W.jsx)(mw,{icon:t}):e}),(0,W.jsx)(`input`,{className:`drag-input`,autoComplete:`off`,spellCheck:`false`,onKeyDown:e=>{if(a){let t=e.target;t instanceof HTMLInputElement&&e.key===N.ENTER&&(y(t.value,i,l),f.focusContainer())}},ref:m,value:g,onChange:e=>{v.current.updatePending=!0,_(e.target.value)},onFocus:e=>{e.target.select(),v.current.originalElements=i,v.current.originalAppState=js(l)},onBlur:e=>{g?a&&y(e.target.value,v.current.originalElements,v.current.originalAppState):_(r.toString())},disabled:!a})]}):null},PI=15,FI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i,app:a})=>{let o=i.getNonDeletedElementsMap(),s=t[0];if(s&&!dr(s)){let t=o.get(s.id);if(!t)return;if(r!==void 0){let e=Pt(r);i.mutateElement(t,{angle:e}),Xn(t,i,a.state);let n=ut(t,o);n&&!jt(t)&&i.mutateElement(n,{angle:e});return}let c=(Math.round(ha(s.angle)*100)/100+Math.round(e))%360;n&&(c=kI(c,PI)),c=c<0?c+360:c;let l=Pt(c);i.mutateElement(t,{angle:l}),Xn(t,i,a.state);let u=ut(t,o);u&&!jt(t)&&i.mutateElement(u,{angle:l})}},II=({element:e,scene:t,appState:n,property:r})=>(0,W.jsx)(NI,{label:`A`,icon:Yx,value:Math.round(ha(e.angle)%360*100)/100,elements:[e],dragInputCallback:FI,editable:OI(e,`angle`),scene:t,appState:n,property:r}),LI=5,RI=({property:e,scene:t,appState:n,setAppState:r})=>(0,W.jsx)(NI,{label:`Grid step`,sensitivity:8,elements:[],dragInputCallback:({nextValue:e,instantChange:t,shouldChangeByStepSize:n,setInputValue:i})=>{r(r=>{let a;return e?a=e:t&&(a=n?kI(r.gridStep+LI*Math.sign(t),LI):r.gridStep+t),a?(a=l(a),i(a),{gridStep:a}):(i(r.gridStep),null)})},scene:t,value:n.gridStep,property:e,appState:n}),zI=10,BI=e=>e.type===`image`,VI=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldKeepAspectRatio:r,shouldChangeByStepSize:i,nextValue:a,property:o,originalAppState:s,instantChange:c,scene:l,app:u,setAppState:d})=>{let f=l.getNonDeletedElementsMap(),p=t[0],m=f.get(p.id);if(p&&m){let t=r||BI(p),h=p.width/p.height;if(s.croppingElementId===p.id){let e=f.get(p.id);if(!e||!io(e)||!e.crop)return;let t=e.crop,n={...t},r=e.scale[0]===-1,i=e.scale[1]===-1,{width:s,height:u}=A(e),d=t.naturalWidth/s,m=t.naturalHeight/u,h=r?t.width+t.x:t.naturalWidth-t.x,g=i?t.height+t.y:t.naturalHeight-t.y,_=10*d,v=10*m;if(a!==void 0){if(o===`width`){let e=Ht(a*d,_,h);n={...n,width:e,x:r?t.x+t.width-e:t.x}}else if(o===`height`){let e=Ht(a*m,v,g);n={...n,height:e,y:i?t.y+t.height-e:t.y}}l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}let y=o===`width`?c:0,b=o===`height`?c:0,x=Ht(t.width+y,_,h),S=Ht(t.height+b,_,g);n={...t,x:r?t.x+t.width-x:t.x,y:i?t.y+t.height-S:t.y,width:x,height:S},l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}if(a!==void 0){if(nt(Math.max(o===`width`?a:t?a*h:p.width,1),Math.max(o===`height`?a:t?a/h:p.height,1),m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),L(m)){let e=kn(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap()),t=Ai(l.getElementsIncludingDeleted(),e,m,u);l.replaceAllElements(t)}return}{let r=o===`width`?e:0,a=o===`height`?e:0,c=Math.max(0,p.width+r);o===`width`&&(c=i?kI(c,zI):Math.round(c));let u=Math.max(0,p.height+a);o===`height`&&(u=i?kI(u,zI):Math.round(u)),t&&(o===`width`?u=Math.round(c/h*100)/100:c=Math.round(u*h*100)/100),u=Math.max(1,u),c=Math.max(1,c),nt(c,u,m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),L(m)&&d({elementsToHighlight:kn(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap())})}}},HI=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&L(o)){let n=kn(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=Ai(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},UI=({property:e,element:t,scene:n,appState:r})=>{let i=on(e===`width`?t.width:t.height,2);if(r.croppingElementId&&r.croppingElementId===t.id&&io(t)&&t.crop){let{width:n,height:r}=A(t);if(e===`width`){let e=n/t.crop.naturalWidth;i=on(t.crop.width*e,2)}if(e===`height`){let e=r/t.crop.naturalHeight;i=on(t.crop.height*e,2)}}return(0,W.jsx)(NI,{label:e===`width`?`W`:`H`,elements:[t],dragInputCallback:VI,value:i,editable:OI(t,e),scene:n,appState:r,property:e,dragFinishedCallback:HI})},WI=4,GI=4,KI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t[0];if(o){let t=a.get(o.id);if(!t||!M(t))return;let s;if(r!==void 0)s=Math.max(Math.round(r),WI);else if(o.type===`text`){let t=Math.round(o.fontSize);s=Math.max(t+Math.round(e),WI),n&&(s=kI(s,GI))}s&&(i.mutateElement(t,{fontSize:s}),Zi(t,i.getContainerElement(t),i))}},qI=({element:e,scene:t,appState:n,property:r})=>{let i=M(e)?e:xr(e)?ut(e,t.getNonDeletedElementsMap()):null;return i?(0,W.jsx)(NI,{label:`F`,value:Math.round(i.fontSize*10)/10,elements:[i],dragInputCallback:KI,icon:Rx,appState:n,scene:t,property:r}):null},JI=15,YI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,property:i,scene:a})=>{let o=a.getNonDeletedElementsMap(),s=t.map(e=>o.get(e.id)).filter(e=>e&&!Nn(e)&&OI(e,i)),c=t.filter(e=>!Nn(e)&&OI(e,i));if(r!==void 0){let e=Pt(r);for(let t of s){if(!t)continue;a.mutateElement(t,{angle:e});let n=ut(t,o);n&&!jt(t)&&a.mutateElement(n,{angle:e})}a.triggerUpdate();return}for(let t=0;t<s.length;t++){let r=s[t];if(!r)continue;let i=c[t],l=(Math.round(ha(i.angle)*100)/100+Math.round(e))%360;n&&(l=kI(l,JI)),l=l<0?l+360:l;let u=Pt(l);a.mutateElement(r,{angle:u});let d=ut(r,o);d&&!jt(r)&&a.mutateElement(d,{angle:u})}a.triggerUpdate()},XI=({elements:e,scene:t,appState:n,property:r})=>{let i=e.filter(e=>!Nn(e)&&OI(e,`angle`)),a=i.map(e=>Math.round(ha(e.angle)%360*100)/100);return(0,W.jsx)(NI,{label:`A`,icon:Yx,value:new Set(a).size===1?a[0]:`Mixed`,elements:e,dragInputCallback:YI,editable:i.some(e=>OI(e,`angle`)),appState:n,scene:t,property:r})},ZI=10,QI=(e,t,n,r)=>{let i=r.x-e,a=r.y-t,o=r.width*n,s=r.height*n;return{width:o,height:s,x:e+i*n,y:t+a*n,...Rr(r,o,s,!1),...M(r)?{fontSize:r.fontSize*n}:{}}},$I=(e,t,n,r,i,a,o,s)=>{let c=s.getNonDeletedElementsMap(),l=QI(e,t,r,a);s.mutateElement(i,l);let u=ut(a,o);if(u){let e=u.fontSize*r;ue(i,s);let t=c.get(u.id);t&&M(t)&&(s.mutateElement(t,{fontSize:e}),ci(i,s,n===`width`?`e`:`s`,!0))}},eL=(e,t,n,r,i,a,o,s,c,l)=>{a===`width`?t=Math.round(e/r*100)/100:e=Math.round(t*r*100)/100;let u=t/n;for(let e=0;e<s.length;e++){let t=s[e],n=o[e];$I(i[0],i[1],a,u,n,t,c,l)}},tL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,originalAppState:r,shouldChangeByStepSize:i,nextValue:a,scene:o,property:s,setAppState:c,app:l})=>{let u=o.getNonDeletedElementsMap(),d=MI(t,r);if(a!==void 0){for(let e of d){let t=AI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[i,c,l,u]=Ii(r),d=l-i,f=u-c,p=d/f;eL(Math.max(1,s===`width`?Math.max(0,a):d),Math.max(1,s===`height`?Math.max(0,a):f),f,p,O(i,c),s,e,r,n,o)}else{let[e]=t,c=e?.latest,u=e?.original;if(c&&u&&OI(c,s)){let e=s===`width`?Math.max(0,a):c.width;s===`width`&&(e=i?kI(e,ZI):Math.round(e));let t=s===`height`?Math.max(0,a):c.height;if(s===`height`&&(t=i?kI(t,ZI):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),nt(e,t,c,u,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),L(c)){let e=kn(o.getElementsIncludingDeleted(),c,r,o.getNonDeletedElementsMap()),t=Ai(o.getElementsIncludingDeleted(),e,c,l);o.replaceAllElements(t)}}}}o.triggerUpdate();return}let f=s===`width`?e:0,p=s===`height`?e:0,m=[];for(let e of d){let t=AI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[a,c,l,u]=Ii(r),d=l-a,m=u-c,h=d/m,g=Math.max(0,d+f);s===`width`&&(g=i?kI(g,ZI):Math.round(g));let _=Math.max(0,m+p);s===`height`&&(_=i?kI(_,ZI):Math.round(_)),g=Math.max(1,g),_=Math.max(1,_),eL(g,_,m,h,O(a,c),s,e,r,n,o)}else{let[e]=t,a=e?.latest,c=e?.original;if(a&&c&&OI(a,s)){let e=Math.max(0,c.width+f);s===`width`&&(e=i?kI(e,ZI):Math.round(e));let t=Math.max(0,c.height+p);if(s===`height`&&(t=i?kI(t,ZI):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),nt(e,t,a,c,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),L(a)){let e=kn(o.getElementsIncludingDeleted(),a,r,o.getNonDeletedElementsMap());m.push(...e)}}}}c({elementsToHighlight:m}),o.triggerUpdate()},nL=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&L(o)){let n=kn(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=Ai(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},rL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,H.useMemo)(()=>r.map(t=>{let r=AI(t,n);if(r.length>1){let[t,n,i,a]=Ii(r.map(e=>e.latest));return Math.round((e===`width`?i-t:a-n)*100)/100}let[i]=r;return Math.round((e===`width`?i.latest.width:i.latest.height)*100)/100}),[n,r,e]),s=new Set(o).size===1?Math.round(o[0]*100)/100:`Mixed`,c=o.length>0;return(0,W.jsx)(NI,{label:e===`width`?`W`:`H`,elements:t,dragInputCallback:tL,value:s,editable:c,appState:a,property:e,scene:i,dragFinishedCallback:nL})},iL=4,aL=4,oL=(e,t)=>e.reduce((e,n)=>{if(!n||Nn(n))return e;if(M(n))return e.push(n),e;if(xr(n)){let r=ut(n,t);if(r)return e.push(r),e}return e},[]),sL=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t.map(e=>a.get(e.id)),s;if(r){s=Math.max(Math.round(r),iL);for(let e of o)i.mutateElement(e,{fontSize:s}),Zi(e,i.getContainerElement(e),i);i.triggerUpdate()}else{let r=t;for(let t=0;t<o.length;t++){let a=o[t],s=r[t],c=Math.round(s.fontSize),l=Math.max(c+Math.round(e),iL);n&&(l=kI(l,aL)),i.mutateElement(a,{fontSize:l}),Zi(a,i.getContainerElement(a),i)}i.triggerUpdate()}},cL=({elements:e,scene:t,appState:n,property:r,elementsMap:i})=>{let a=oL(e,i);if(!a.length)return null;let o=a.map(e=>Math.round(e.fontSize*10)/10);return(0,W.jsx)(NI,{label:`F`,icon:Rx,elements:a,dragInputCallback:sL,value:new Set(o).size===1?o[0]:`Mixed`,editable:o.length>0,scene:t,property:r,appState:n})},lL=(e,t,n,r,i,a,o)=>{for(let s=0;s<r.length;s++){let c=r[s],[l,u]=[c.x+c.width/2,c.y+c.height/2],[d,f]=ke(O(c.x,c.y),O(l,u),c.angle);jI(e===`x`?Math.round(d+t):d,e===`y`?Math.round(f+n):f,c,a,o,i,!1)}},uL=(e,t,n,r,i,a)=>{let o=i.getNonDeletedElementsMap(),[s,c,,]=Ii(n),l=e-s,u=t-c;for(let e=0;e<n.length;e++){let t=n[e],s=o.get(t.id);if(s&&(!M(s)||!s.containerId)){let[e,n]=[s.x+s.width/2,s.y+s.height/2],[o,c]=ke(O(s.x,s.y),O(e,n),s.angle);jI(o+l,c+u,t,i,a,r,!1)}}},dL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldChangeByStepSize:r,nextValue:i,property:a,scene:o,originalAppState:s,app:c})=>{let l=o.getNonDeletedElementsMap();if(i!==void 0){for(let e of MI(t,s)){let t=AI(e,l,n);if(t.length>1){let[e,r,,]=Ii(t.map(e=>e.latest));uL(a===`x`?i:e,a===`y`?i:r,t.map(e=>e.original),n,o,c.state)}else{let e=t[0]?.original,r=t[0]?.latest;if(e&&r&&OI(r,a)){let[t,r]=[e.x+e.width/2,e.y+e.height/2],[s,l]=ke(O(e.x,e.y),O(t,r),e.angle);jI(a===`x`?i:s,a===`y`?i:l,e,o,c.state,n,!1)}}}o.triggerUpdate();return}let u=r?kI(e,DI):e;lL(a,a===`x`?u:0,a===`y`?u:0,t,n,o,c.state),o.triggerUpdate()},fL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,H.useMemo)(()=>r.map(t=>{let r=Object.keys(t).map(e=>n.get(e)).filter(e=>e!==void 0);if(r.length>1){let[t,n]=Ii(r);return Math.round((e===`x`?t:n)*100)/100}let[i]=r,[a,o]=[i.x+i.width/2,i.y+i.height/2],[s,c]=ke(O(i.x,i.y),O(a,o),i.angle);return Math.round((e===`x`?s:c)*100)/100}),[r,n,e]),s=new Set(o).size===1?o[0]:`Mixed`;return(0,W.jsx)(NI,{label:e===`x`?`X`:`Y`,elements:t,dragInputCallback:dL,value:s,property:e,scene:i,appState:a})},pL=({accumulatedChange:e,instantChange:t,originalElements:n,originalElementsMap:r,shouldChangeByStepSize:i,nextValue:a,property:o,scene:s,originalAppState:c,app:l})=>{let u=s.getNonDeletedElementsMap(),d=n[0],[f,p]=[d.x+d.width/2,d.y+d.height/2],[m,h]=ke(O(d.x,d.y),O(f,p),d.angle);if(c.croppingElementId===d.id){let e=u.get(d.id);if(!e||!io(e)||!e.crop)return;let n=e.crop,r=n,i=e.scale[0]===-1,c=e.scale[1]===-1,{width:l,height:f}=A(e);if(a!==void 0){if(o===`x`){let e=a*(n.naturalWidth/l);r=i?{...n,x:Ht(n.naturalWidth-e-n.width,0,n.naturalWidth-n.width)}:{...n,x:Ht(a*(n.naturalWidth/l),0,n.naturalWidth-n.width)}}o===`y`&&(r={...n,y:Ht(a*(n.naturalHeight/f),0,n.naturalHeight-n.height)}),s.mutateElement(e,{crop:r});return}let p=(o===`x`?t:0)*(i?-1:1),m=(o===`y`?t:0)*(c?-1:1);r={...n,x:Ht(n.x+p,0,n.naturalWidth-n.width),y:Ht(n.y+m,0,n.naturalHeight-n.height)},s.mutateElement(e,{crop:r});return}if(a!==void 0){jI(o===`x`?a:m,o===`y`?a:h,d,s,l.state,r);return}let g=o===`x`?e:0,_=o===`y`?e:0;jI(o===`x`?Math.round(i?kI(d.x+g,DI):m+g):m,o===`y`?Math.round(i?kI(d.y+_,DI):h+_):h,d,s,l.state,r)},mL=({property:e,element:t,elementsMap:n,scene:r,appState:i})=>{let[a,o]=ke(O(t.x,t.y),O(t.x+t.width/2,t.y+t.height/2),t.angle),s=on(e===`x`?a:o,2);if(i.croppingElementId===t.id&&io(t)&&t.crop){let n=hr(t);n&&(s=on(e===`x`?n.x:n.y,2))}return(0,W.jsx)(NI,{label:e===`x`?`X`:`Y`,elements:[t],dragInputCallback:pL,scene:r,value:s,property:e,appState:i})},hL=50,gL=e=>{let t=cz(),n=e.app.scene.getSceneNonce()||1,r=e.app.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}),i=Sj(e.app);return(0,W.jsx)(yL,{...e,appState:t,sceneNonce:n,selectedElements:r,gridModeEnabled:i})},_L=({children:e,columns:t=1,heading:n,style:r,...i})=>(0,W.jsx)(`div`,{className:U(`exc-stats__row`,{"exc-stats__row--heading":n}),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,...r},...i,children:e});_L.displayName=`StatsRow`;var vL=({children:e,order:t,style:n,...r})=>(0,W.jsx)(`div`,{className:`exc-stats__rows`,style:{order:t,...n},...r,children:e});vL.displayName=`StatsRows`,gL.StatsRow=_L,gL.StatsRows=vL;var yL=(0,H.memo)(({app:e,onClose:t,renderCustomStats:n,selectedElements:r,appState:i,sceneNonce:a,gridModeEnabled:o})=>{let s=e.scene,c=s.getNonDeletedElements(),l=s.getNonDeletedElementsMap(),u=lz(),d=r.length===1?r[0]:null,f=r.length>1?r:null,p=i.croppingElementId&&io(d),m=p?A(d):null,[h,g]=(0,H.useState)({width:0,height:0}),_=(0,H.useMemo)(()=>(0,gc.default)(e=>{let t=Ii(e);g({width:Math.round(t[2])-Math.round(t[0]),height:Math.round(t[3])-Math.round(t[1])})},hL),[]);(0,H.useEffect)(()=>{_(c)},[a,c,_]),(0,H.useEffect)(()=>()=>_.cancel(),[_]);let v=(0,H.useMemo)(()=>MI(r,i),[r,i]),y=(0,H.useMemo)(()=>Dr(r),[r]);return(0,W.jsx)(`div`,{className:`exc-stats`,children:(0,W.jsxs)(SC,{padding:3,children:[(0,W.jsxs)(`div`,{className:`title`,children:[(0,W.jsx)(`h2`,{children:K(`stats.title`)}),(0,W.jsx)(`div`,{className:`close`,onClick:t,children:nx})]}),(0,W.jsxs)(hw,{label:(0,W.jsx)(`h3`,{children:K(`stats.generalStats`)}),open:!!(i.stats.panels&Fr.generalStats),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Fr.generalStats}})),children:[(0,W.jsxs)(vL,{children:[(0,W.jsx)(_L,{heading:!0,children:K(`stats.scene`)}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.shapes`)}),(0,W.jsx)(`div`,{children:c.length})]}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.width`)}),(0,W.jsx)(`div`,{children:h.width})]}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.height`)}),(0,W.jsx)(`div`,{children:h.height})]}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_L,{heading:!0,children:`Canvas`}),(0,W.jsx)(_L,{children:(0,W.jsx)(RI,{property:`gridStep`,scene:s,appState:i,setAppState:u})})]})]}),n?.(c,i)]}),!y&&r.length>0&&(0,W.jsx)(`div`,{id:`elementStats`,style:{marginTop:12},children:(0,W.jsx)(hw,{label:(0,W.jsx)(`h3`,{children:K(`stats.elementProperties`)}),open:!!(i.stats.panels&Fr.elementProperties),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Fr.elementProperties}})),children:(0,W.jsxs)(vL,{children:[d&&(0,W.jsxs)(W.Fragment,{children:[p&&(0,W.jsx)(_L,{heading:!0,children:K(`labels.unCroppedDimension`)}),i.croppingElementId&&io(d)&&m&&(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.width`)}),(0,W.jsx)(`div`,{children:on(m.width,2)})]}),i.croppingElementId&&io(d)&&m&&(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.height`)}),(0,W.jsx)(`div`,{children:on(m.height,2)})]}),(0,W.jsx)(_L,{heading:!0,"data-testid":`stats-element-type`,style:{margin:`0.3125rem 0`},children:i.croppingElementId?K(`labels.imageCropping`):K(`element.${d.type}`)}),(0,W.jsx)(_L,{children:(0,W.jsx)(mL,{element:d,property:`x`,elementsMap:l,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(mL,{element:d,property:`y`,elementsMap:l,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(UI,{property:`width`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(UI,{property:`height`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(II,{property:`angle`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(qI,{property:`fontSize`,element:d,scene:s,appState:i})})]}),f&&(0,W.jsxs)(W.Fragment,{children:[Co(f)&&(0,W.jsx)(_L,{heading:!0,children:K(`element.group`)}),(0,W.jsxs)(_L,{columns:2,style:{margin:`0.3125rem 0`},children:[(0,W.jsx)(`div`,{children:K(`stats.shapes`)}),(0,W.jsx)(`div`,{children:r.length})]}),(0,W.jsx)(_L,{children:(0,W.jsx)(fL,{property:`x`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(fL,{property:`y`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(rL,{property:`width`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(rL,{property:`height`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(XI,{property:`angle`,elements:f,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(cL,{property:`fontSize`,elements:f,scene:s,appState:i,elementsMap:l})})]})]})})})]})})},(e,t)=>e.sceneNonce===t.sceneNonce&&e.selectedElements===t.selectedElements&&e.appState.stats.panels===t.appState.stats.panels&&e.gridModeEnabled===t.gridModeEnabled&&e.appState.gridStep===t.appState.gridStep&&e.appState.croppingElementId===t.appState.croppingElementId),bL=({sourceElementId:e,onClose:t,appState:n,scene:r,generateLinkForSelection:i=_a})=>{let a=r.getNonDeletedElementsMap(),o=a.get(e)?.link??null,[s,c]=(0,H.useState)(o),[l,u]=(0,H.useState)(!1);(0,H.useEffect)(()=>{let e=ir(a,n),t=o;if(e.length>0&&i){let r=Fa(e,n);r&&(t=Hs(i(r.id,r.type)))}c(t)},[a,n,n.selectedElementIds,o,i]);let d=(0,H.useCallback)(()=>{if(s&&s!==a.get(e)?.link){let t=a.get(e);t&&r.mutateElement(t,{link:s})}if(!s&&l&&e){let t=a.get(e);t&&r.mutateElement(t,{link:null})}t?.()},[e,s,a,l,r,t]);return(0,H.useEffect)(()=>{let e=e=>{n.openDialog?.name===`elementLinkSelector`&&e.key===N.ENTER&&d(),n.openDialog?.name===`elementLinkSelector`&&e.key===N.ESCAPE&&t?.()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n,t,d]),(0,W.jsxs)(`div`,{className:`ElementLinkDialog`,children:[(0,W.jsxs)(`div`,{className:`ElementLinkDialog__header`,children:[(0,W.jsx)(`h2`,{children:K(`elementLink.title`)}),(0,W.jsx)(`p`,{children:K(`elementLink.desc`)})]}),(0,W.jsxs)(`div`,{className:`ElementLinkDialog__input`,children:[(0,W.jsx)($O,{value:s??``,onChange:e=>{l||u(!0),c(e)},onKeyDown:e=>{e.key===N.ENTER&&d()},className:`ElementLinkDialog__input-field`,selectOnRender:!0}),o&&s&&(0,W.jsx)(X,{type:`button`,title:K(`buttons.remove`),"aria-label":K(`buttons.remove`),label:K(`buttons.remove`),onClick:()=>{c(null),u(!0)},className:`ElementLinkDialog__remove`,icon:pb})]}),(0,W.jsxs)(`div`,{className:`ElementLinkDialog__actions`,children:[(0,W.jsx)(aO,{label:K(`buttons.cancel`),onClick:()=>{t?.()},style:{marginRight:10}}),(0,W.jsx)(aO,{label:K(`buttons.confirm`),onClick:d,actionType:`primary`})]})]})},xL=({children:e,onClose:t})=>{let[n,r]=(0,H.useState)(!!e),{container:i}=oz(),a=H.useCallback(()=>{r(!1),t&&t(),i?.focus()},[t,i]);return(0,W.jsx)(W.Fragment,{children:n&&(0,W.jsx)(dk,{size:`small`,onCloseRequest:a,title:K(`errorDialog.title`),children:(0,W.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:e})})})},SL=()=>(0,W.jsxs)(`div`,{className:`HelpDialog__header`,children:[(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://docs.excalidraw.com`,target:`_blank`,rel:`noopener`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Sb}),K(`helpDialog.documentation`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://plus.excalidraw.com/blog`,target:`_blank`,rel:`noopener`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Sb}),K(`helpDialog.blog`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://github.com/excalidraw/excalidraw/issues`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Cb}),K(`helpDialog.github`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://youtube.com/@excalidraw`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:FS}),`YouTube`]})]}),CL=e=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{children:e.title}),(0,W.jsx)(`div`,{className:`HelpDialog__islands-container`,children:e.children})]}),wL=e=>(0,W.jsxs)(`div`,{className:`HelpDialog__island ${e.className}`,children:[(0,W.jsx)(`h4`,{className:`HelpDialog__island-title`,children:e.caption}),(0,W.jsx)(`div`,{className:`HelpDialog__island-content`,children:e.children})]});function*TL(e,t){let n=!0;for(let r of e)n||(yield t),n=!1,yield r}var EL=e=>e.replace(/\b[a-z]\b/,e=>e.toUpperCase()),$=({label:e,shortcuts:t,isOr:n=!0})=>{let r=t.map(e=>(e.endsWith(`++`)?[...e.slice(0,-2).split(`+`),`+`]:e.split(`+`)).map(e=>(0,W.jsx)(DL,{children:EL(e)},e)));return(0,W.jsxs)(`div`,{className:`HelpDialog__shortcut`,children:[(0,W.jsx)(`div`,{children:e}),(0,W.jsx)(`div`,{className:`HelpDialog__key-container`,children:[...TL(r,n?K(`helpDialog.or`):null)]})]})},DL=e=>(0,W.jsx)(`kbd`,{className:`HelpDialog__key`,...e}),OL=({onClose:e})=>(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(dk,{onCloseRequest:H.useCallback(()=>{e&&e()},[e]),title:K(`helpDialog.title`),className:`HelpDialog`,children:[(0,W.jsx)(SL,{}),(0,W.jsxs)(CL,{title:K(`helpDialog.shortcuts`),children:[(0,W.jsxs)(wL,{className:`HelpDialog__island--tools`,caption:K(`helpDialog.tools`),children:[(0,W.jsx)($,{label:K(`toolBar.hand`),shortcuts:[N.H]}),(0,W.jsx)($,{label:K(`toolBar.selection`),shortcuts:[N.V,N[1]]}),(0,W.jsx)($,{label:K(`toolBar.rectangle`),shortcuts:[N.R,N[2]]}),(0,W.jsx)($,{label:K(`toolBar.diamond`),shortcuts:[N.D,N[3]]}),(0,W.jsx)($,{label:K(`toolBar.ellipse`),shortcuts:[N.O,N[4]]}),(0,W.jsx)($,{label:K(`toolBar.arrow`),shortcuts:[N.A,N[5]]}),(0,W.jsx)($,{label:K(`toolBar.line`),shortcuts:[N.L,N[6]]}),(0,W.jsx)($,{label:K(`toolBar.freedraw`),shortcuts:[N.P,N[7]]}),(0,W.jsx)($,{label:K(`toolBar.text`),shortcuts:[N.T,N[8]]}),(0,W.jsx)($,{label:K(`toolBar.image`),shortcuts:[N[9]]}),(0,W.jsx)($,{label:K(`toolBar.eraser`),shortcuts:[N.E,N[0]]}),(0,W.jsx)($,{label:K(`toolBar.frame`),shortcuts:[N.F]}),(0,W.jsx)($,{label:K(`toolBar.laser`),shortcuts:[N.K]}),(0,W.jsx)($,{label:K(`labels.eyeDropper`),shortcuts:[N.I,`Shift+S`,`Shift+G`]}),(0,W.jsx)($,{label:K(`helpDialog.editLineArrowPoints`),shortcuts:[Q(`CtrlOrCmd+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.editText`),shortcuts:[Q(`Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.textNewLine`),shortcuts:[Q(`Enter`),Q(`Shift+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.textFinish`),shortcuts:[Q(`Esc`),Q(`CtrlOrCmd+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.curvedArrow`),shortcuts:[`A`,K(`helpDialog.click`),K(`helpDialog.click`),K(`helpDialog.click`)],isOr:!1}),(0,W.jsx)($,{label:K(`helpDialog.curvedLine`),shortcuts:[`L`,K(`helpDialog.click`),K(`helpDialog.click`),K(`helpDialog.click`)],isOr:!1}),(0,W.jsx)($,{label:K(`helpDialog.cropStart`),shortcuts:[K(`helpDialog.doubleClick`),Q(`Enter`)],isOr:!0}),(0,W.jsx)($,{label:K(`helpDialog.cropFinish`),shortcuts:[Q(`Enter`),Q(`Escape`)],isOr:!0}),(0,W.jsx)($,{label:K(`toolBar.lock`),shortcuts:[N.Q]}),(0,W.jsx)($,{label:K(`helpDialog.preventBinding`),shortcuts:[Q(`CtrlOrCmd`)]}),(0,W.jsx)($,{label:K(`toolBar.link`),shortcuts:[Q(`CtrlOrCmd+K`)]}),(0,W.jsx)($,{label:K(`toolBar.convertElementType`),shortcuts:[`Tab`,`Shift+Tab`],isOr:!0})]}),(0,W.jsxs)(wL,{className:`HelpDialog__island--view`,caption:K(`helpDialog.view`),children:[(0,W.jsx)($,{label:K(`buttons.zoomIn`),shortcuts:[Q(`CtrlOrCmd++`)]}),(0,W.jsx)($,{label:K(`buttons.zoomOut`),shortcuts:[Q(`CtrlOrCmd+-`)]}),(0,W.jsx)($,{label:K(`buttons.resetZoom`),shortcuts:[Q(`CtrlOrCmd+0`)]}),(0,W.jsx)($,{label:K(`helpDialog.zoomToFit`),shortcuts:[`Shift+1`]}),(0,W.jsx)($,{label:K(`helpDialog.zoomToSelection`),shortcuts:[`Shift+2`]}),(0,W.jsx)($,{label:K(`helpDialog.movePageUpDown`),shortcuts:[`PgUp/PgDn`]}),(0,W.jsx)($,{label:K(`helpDialog.movePageLeftRight`),shortcuts:[`Shift+PgUp/PgDn`]}),(0,W.jsx)($,{label:K(`buttons.zenMode`),shortcuts:[Q(`Alt+Z`)]}),(0,W.jsx)($,{label:K(`buttons.objectsSnapMode`),shortcuts:[Q(`Alt+S`)]}),(0,W.jsx)($,{label:K(`labels.toggleGrid`),shortcuts:[Q(`CtrlOrCmd+'`)]}),(0,W.jsx)($,{label:K(`labels.viewMode`),shortcuts:[Q(`Alt+R`)]}),(0,W.jsx)($,{label:K(`labels.toggleTheme`),shortcuts:[Q(`Alt+Shift+D`)]}),(0,W.jsx)($,{label:K(`stats.fullTitle`),shortcuts:[Q(`Alt+/`)]}),(0,W.jsx)($,{label:K(`search.title`),shortcuts:[ND(`searchMenu`)]}),(0,W.jsx)($,{label:K(`commandPalette.title`),shortcuts:xt?[ND(`commandPalette`)]:[ND(`commandPalette`),ND(`commandPalette`,1)]})]}),(0,W.jsxs)(wL,{className:`HelpDialog__island--editor`,caption:K(`helpDialog.editor`),children:[(0,W.jsx)($,{label:K(`helpDialog.createFlowchart`),shortcuts:[Q(`CtrlOrCmd+Arrow Key`)],isOr:!0}),(0,W.jsx)($,{label:K(`helpDialog.navigateFlowchart`),shortcuts:[Q(`Alt+Arrow Key`)],isOr:!0}),(0,W.jsx)($,{label:K(`labels.moveCanvas`),shortcuts:[Q(`Space+${K(`helpDialog.drag`)}`),Q(`Wheel+${K(`helpDialog.drag`)}`)],isOr:!0}),(0,W.jsx)($,{label:K(`buttons.clearReset`),shortcuts:[Q(`CtrlOrCmd+Delete`)]}),(0,W.jsx)($,{label:K(`labels.delete`),shortcuts:[Q(`Delete`)]}),(0,W.jsx)($,{label:K(`labels.cut`),shortcuts:[Q(`CtrlOrCmd+X`)]}),(0,W.jsx)($,{label:K(`labels.copy`),shortcuts:[Q(`CtrlOrCmd+C`)]}),(0,W.jsx)($,{label:K(`labels.paste`),shortcuts:[Q(`CtrlOrCmd+V`)]}),(0,W.jsx)($,{label:K(`labels.pasteAsPlaintext`),shortcuts:[Q(`CtrlOrCmd+Shift+V`)]}),(0,W.jsx)($,{label:K(`labels.selectAll`),shortcuts:[Q(`CtrlOrCmd+A`)]}),(0,W.jsx)($,{label:K(`labels.multiSelect`),shortcuts:[Q(`Shift+${K(`helpDialog.click`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.deepSelect`),shortcuts:[Q(`CtrlOrCmd+${K(`helpDialog.click`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.deepBoxSelect`),shortcuts:[Q(`CtrlOrCmd+${K(`helpDialog.drag`)}`)]}),(mT||xt)&&(0,W.jsx)($,{label:K(`labels.copyAsPng`),shortcuts:[Q(`Shift+Alt+C`)]}),(0,W.jsx)($,{label:K(`labels.copyStyles`),shortcuts:[Q(`CtrlOrCmd+Alt+C`)]}),(0,W.jsx)($,{label:K(`labels.pasteStyles`),shortcuts:[Q(`CtrlOrCmd+Alt+V`)]}),(0,W.jsx)($,{label:K(`labels.sendToBack`),shortcuts:[Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)]}),(0,W.jsx)($,{label:K(`labels.bringToFront`),shortcuts:[Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)]}),(0,W.jsx)($,{label:K(`labels.sendBackward`),shortcuts:[Q(`CtrlOrCmd+[`)]}),(0,W.jsx)($,{label:K(`labels.bringForward`),shortcuts:[Q(`CtrlOrCmd+]`)]}),(0,W.jsx)($,{label:K(`labels.alignTop`),shortcuts:[Q(`CtrlOrCmd+Shift+Up`)]}),(0,W.jsx)($,{label:K(`labels.alignBottom`),shortcuts:[Q(`CtrlOrCmd+Shift+Down`)]}),(0,W.jsx)($,{label:K(`labels.alignLeft`),shortcuts:[Q(`CtrlOrCmd+Shift+Left`)]}),(0,W.jsx)($,{label:K(`labels.alignRight`),shortcuts:[Q(`CtrlOrCmd+Shift+Right`)]}),(0,W.jsx)($,{label:K(`labels.duplicateSelection`),shortcuts:[Q(`CtrlOrCmd+D`),Q(`Alt+${K(`helpDialog.drag`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.toggleElementLock`),shortcuts:[Q(`CtrlOrCmd+Shift+L`)]}),(0,W.jsx)($,{label:K(`buttons.undo`),shortcuts:[Q(`CtrlOrCmd+Z`)]}),(0,W.jsx)($,{label:K(`buttons.redo`),shortcuts:tn?[Q(`CtrlOrCmd+Y`),Q(`CtrlOrCmd+Shift+Z`)]:[Q(`CtrlOrCmd+Shift+Z`)]}),(0,W.jsx)($,{label:K(`labels.group`),shortcuts:[Q(`CtrlOrCmd+G`)]}),(0,W.jsx)($,{label:K(`labels.ungroup`),shortcuts:[Q(`CtrlOrCmd+Shift+G`)]}),(0,W.jsx)($,{label:K(`labels.flipHorizontal`),shortcuts:[Q(`Shift+H`)]}),(0,W.jsx)($,{label:K(`labels.flipVertical`),shortcuts:[Q(`Shift+V`)]}),(0,W.jsx)($,{label:K(`labels.showStroke`),shortcuts:[Q(`S`)]}),(0,W.jsx)($,{label:K(`labels.showBackground`),shortcuts:[Q(`G`)]}),(0,W.jsx)($,{label:K(`labels.showFonts`),shortcuts:[Q(`Shift+F`)]}),(0,W.jsx)($,{label:K(`labels.decreaseFontSize`),shortcuts:[Q(`CtrlOrCmd+Shift+<`)]}),(0,W.jsx)($,{label:K(`labels.increaseFontSize`),shortcuts:[Q(`CtrlOrCmd+Shift+>`)]})]})]})]})}),kL=e=>Array.isArray(e)?`<kbd>${e.map(Q).join(` + `)}</kbd>`:`<kbd>${Q(e)}</kbd>`,AL=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let{activeTool:i,isResizing:a,isRotating:o,lastPointerDownWith:s}=e,c=e.multiElement!==null;if(e.openSidebar?.name===At.name&&e.openSidebar.tab===`search`&&e.searchMatches?.matches.length)return K(`hints.dismissSearch`,{shortcut:kL(`Escape`)});if(e.openSidebar&&!n.canFitSidebar)return null;if(zr(e))return K(`hints.eraserRevert`,{shortcut:kL(`Alt`)});let l=r.scene.getSelectedElements(e);if(e.selectedLinearElement?.isDragging&&l[0]?.type===`arrow`)return K(`hints.arrowBindModifiers`,{shortcut_1:kL(`Ctrl`),shortcut_2:kL(`Alt`)});if(i.type===`arrow`||i.type===`line`)return c?K(`hints.linearElementMulti`,{shortcut_1:kL(`Escape`),shortcut_2:kL(`Enter`)}):i.type===`arrow`?K(`hints.arrowTool`,{shortcut:kL(`A`)}):K(`hints.linearElement`);if(i.type===`freedraw`)return K(`hints.freeDraw`);if(i.type===`text`)return K(`hints.text`);if(i.type===`embeddable`)return K(`hints.embeddable`);if(a&&s===`mouse`&&l.length===1){let e=l[0];return b(e)&&e.points.length===2?K(`hints.lockAngle`,{shortcut:kL(`Shift`)}):io(e)?K(`hints.resizeImage`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)}):K(`hints.resize`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)})}if(o&&s===`mouse`)return K(`hints.rotate`,{shortcut:kL(`Shift`)});if(l.length===1&&M(l[0]))return K(`hints.text_selected`,{shortcut:kL(`Enter`)});if(e.editingTextElement)return K(`hints.text_editing`,{shortcut_1:kL(`Escape`),shortcut_2:kL([`CtrlOrCmd`,`Enter`])});if(e.croppingElementId)return K(`hints.leaveCropEditor`,{shortcut_1:kL(`Enter`),shortcut_2:kL(`Escape`)});if(l.length===1&&io(l[0]))return K(`hints.enterCropEditor`,{shortcut:kL(`Enter`)});if(i.type===`selection`){if(e.selectionElement&&!l.length&&!e.editingTextElement&&!e.selectedLinearElement?.isEditing)return K(`hints.deepBoxSelect`,{shortcut:kL(`CtrlOrCmd`)});if(Sj(r)&&e.selectedElementsAreBeingDragged)return K(`hints.disableSnapping`,{shortcut:kL(`CtrlOrCmd`)});if(!l.length&&!t)return K(`hints.canvasPanning`,{shortcut_1:kL(K(`keys.mmb`)),shortcut_2:kL(`Space`)});if(l.length===1){if(b(l[0]))return e.selectedLinearElement?.isEditing?e.selectedLinearElement.selectedPointsIndices?K(`hints.lineEditor_pointSelected`,{shortcut_1:kL(`Delete`),shortcut_2:kL([`CtrlOrCmd`,`D`])}):K(`hints.lineEditor_nothingSelected`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)}):ca(l[0])?K(`hints.lineEditor_line_info`,{shortcut:kL(`Enter`)}):K(`hints.lineEditor_info`,{shortcut_1:kL(`CtrlOrCmd`),shortcut_2:kL([`CtrlOrCmd`,`Enter`])});if(!e.newElement&&!e.selectedElementsAreBeingDragged&&k(l[0])){let e=K(`hints.bindTextToElement`,{shortcut:kL(`Enter`)}),t=K(`hints.createFlowchart`,{shortcut:kL([`CtrlOrCmd`,`↑↓`])});return Vi(l[0])?(Dt(l[0],r.scene.getNonDeletedElementsMap()),[e,t]):e}}}return null},jL=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let i=AL({appState:e,isMobile:t,editorInterface:n,app:r});return i?(0,W.jsx)(`div`,{className:`HintViewer`,children:(0,W.jsx)(`span`,{children:(Array.isArray(i)?i.map(e=>e.replace(/\. ?$/,``)).join(`, `):i).split(/(<kbd>[^<]+<\/kbd>)/g).map((e,t)=>{if(t%2==1){let n=e[0]===`<`&&e.match(/^<kbd>([^<]+)<\/kbd>$/);return(0,W.jsx)(`kbd`,{children:n?n[1]:e},t)}return e})})}):null},ML=2e3,NL=()=>{let[e,t]=(0,H.useState)(null),n=(0,H.useRef)(0);return{copyStatus:e,resetCopyStatus:(0,H.useCallback)(()=>{t(null)},[]),onCopy:()=>{clearTimeout(n.current),t(`success`),n.current=window.setTimeout(()=>{t(null)},ML)}}},PL=({title:e,name:t,checked:n,onChange:r,disabled:i=!1})=>(0,W.jsx)(`div`,{className:U(`Switch`,{toggled:n,disabled:i}),children:(0,W.jsx)(`input`,{name:t,id:t,title:e,type:`checkbox`,checked:n,disabled:i,onChange:()=>r(!n),onKeyDown:e=>{e.key===` `&&r(!n)}})}),FL=()=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{children:K(`canvasError.cannotShowPreview`)}),(0,W.jsx)(`p`,{children:(0,W.jsx)(`span`,{children:K(`canvasError.canvasTooBig`)})}),(0,W.jsxs)(`em`,{children:[`(`,K(`canvasError.canvasTooBigTip`),`)`]})]}),IL=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:r,onExportImage:i,name:a,exportWithDarkMode:o})=>{let s=Ya(t,e),[c,l]=(0,H.useState)(a),[u,d]=(0,H.useState)(s),[f,p]=(0,H.useState)(e.exportBackground),[m,h]=(0,H.useState)(e.exportEmbedScene),[g,_]=(0,H.useState)(e.exportScale),v=(0,H.useRef)(null),y=(0,H.useRef)(0),[b,x]=(0,H.useState)(null),{onCopy:S,copyStatus:C,resetCopyStatus:w}=NL();(0,H.useEffect)(()=>{w()},[c,f,o,g,m,w]);let{exportedElements:T,exportingFrame:E}=NT(t,e,u);return(0,H.useEffect)(()=>{let t=v.current;if(!t)return;let r=t.offsetWidth,i=t.offsetHeight;if(!r)return;let a=++y.current,s=()=>a!==y.current;return zD({elements:T,appState:{...e,name:c,exportBackground:f,exportWithDarkMode:o,exportScale:g,exportEmbedScene:m},files:n,exportPadding:10,maxWidthOrHeight:Math.max(r,i),exportingFrame:E}).then(async e=>{if(!s()){try{await er(e)}catch(e){throw e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(K(`canvasError.canvasTooBig`)):e}s()||(x(null),t.replaceChildren(e))}}).catch(e=>{s()||(console.error(e),x(e))}),()=>{y.current+=1}},[e,n,T,E,c,f,o,g,m]),(0,W.jsxs)(`div`,{className:`ImageExportModal`,children:[(0,W.jsx)(`h3`,{children:K(`imageExportDialog.header`)}),(0,W.jsxs)(`div`,{className:`ImageExportModal__preview`,children:[(0,W.jsx)(`div`,{className:`ImageExportModal__preview__canvas`,ref:v,children:b&&(0,W.jsx)(FL,{})}),(0,W.jsx)(`div`,{className:`ImageExportModal__preview__filename`,children:!no&&(0,W.jsx)(`input`,{type:`text`,className:`TextInput`,value:c,style:{width:`30ch`},onChange:e=>{l(e.target.value),r.executeAction(IT,`ui`,e.target.value)}})})]}),(0,W.jsxs)(`div`,{className:`ImageExportModal__settings`,children:[(0,W.jsx)(`h3`,{children:K(`imageExportDialog.header`)}),s&&(0,W.jsx)(LL,{label:K(`imageExportDialog.label.onlySelected`),name:`exportOnlySelected`,children:(0,W.jsx)(PL,{name:`exportOnlySelected`,checked:u,onChange:e=>{d(e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.withBackground`),name:`exportBackgroundSwitch`,children:(0,W.jsx)(PL,{name:`exportBackgroundSwitch`,checked:f,onChange:e=>{p(e),r.executeAction(RT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.darkMode`),name:`exportDarkModeSwitch`,children:(0,W.jsx)(PL,{name:`exportDarkModeSwitch`,checked:o,onChange:e=>{r.executeAction(qT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.embedScene`),tooltip:K(`imageExportDialog.tooltip.embedScene`),name:`exportEmbedSwitch`,children:(0,W.jsx)(PL,{name:`exportEmbedSwitch`,checked:m,onChange:e=>{h(e),r.executeAction(zT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.scale`),name:`exportScale`,children:(0,W.jsx)(uP,{name:`exportScale`,value:g,onChange:e=>{_(e),r.executeAction(LT,`ui`,e)},choices:Wi.map(e=>({value:e,label:`${e}\xD7`}))})}),(0,W.jsxs)(`div`,{className:`ImageExportModal__settings__buttons`,children:[(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.exportToPng`),onClick:()=>i(oi.png,T,{exportingFrame:E}),icon:Qx,children:K(`imageExportDialog.button.exportToPng`)}),(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.exportToSvg`),onClick:()=>i(oi.svg,T,{exportingFrame:E}),icon:Qx,children:K(`imageExportDialog.button.exportToSvg`)}),(mT||xt)&&(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.copyPngToClipboard`),status:C,onClick:async()=>{await i(oi.clipboard,T,{exportingFrame:E}),S()},icon:$x,children:K(`imageExportDialog.button.copyPngToClipboard`)})]})]})]})},LL=({label:e,children:t,tooltip:n,name:r})=>(0,W.jsxs)(`div`,{className:`ImageExportModal__settings__setting`,title:e,children:[(0,W.jsxs)(`label`,{htmlFor:r,className:`ImageExportModal__settings__setting__label`,children:[e,n&&(0,W.jsx)(Rw,{label:n,long:!0,children:tS})]}),(0,W.jsx)(`div`,{className:`ImageExportModal__settings__setting__content`,children:t})]}),RL=({elements:e,appState:t,files:n,actionManager:r,onExportImage:i,onCloseRequest:a,name:o})=>{let[{appStateSnapshot:s,elementsSnapshot:c}]=(0,H.useState)(()=>({appStateSnapshot:js(t),elementsSnapshot:js(e)}));return(0,W.jsx)(dk,{onCloseRequest:a,size:`wide`,title:!1,children:(0,W.jsx)(IL,{elementsSnapshot:c,appStateSnapshot:s,files:n,actionManager:r,onExportImage:i,name:o,exportWithDarkMode:t.exportWithDarkMode})})},zL={primary:{base:`var(--color-primary)`,darker:`var(--color-primary-darker)`,darkest:`var(--color-primary-darkest)`},lime:{base:`#74b816`,darker:`#66a80f`,darkest:`#5c940d`},pink:{base:`#d6336c`,darker:`#c2255c`,darkest:`#a61e4d`}},BL=({children:e,color:t})=>(0,W.jsx)(`div`,{className:`Card`,style:{"--card-color":zL[t].base,"--card-color-darker":zL[t].darker,"--card-color-darkest":zL[t].darkest},children:e}),VL=({elements:e,appState:t,setAppState:n,files:r,actionManager:i,exportOpts:a,canvas:o,onCloseRequest:s})=>{let{onExportToBackend:c}=a;return(0,W.jsx)(`div`,{className:`ExportDialog ExportDialog--json`,children:(0,W.jsxs)(`div`,{className:`ExportDialog-cards`,children:[a.saveFileToDisk&&(0,W.jsxs)(BL,{color:`lime`,children:[(0,W.jsx)(`div`,{className:`Card-icon`,children:Pb}),(0,W.jsx)(`h2`,{children:K(`exportDialog.disk_title`)}),(0,W.jsxs)(`div`,{className:`Card-details`,children:[K(`exportDialog.disk_details`),!no&&i.renderAction(`changeProjectName`)]}),(0,W.jsx)(X,{className:`Card-button`,type:`button`,title:K(`exportDialog.disk_button`),"aria-label":K(`exportDialog.disk_button`),showAriaLabel:!0,onClick:()=>{i.executeAction(GT,`ui`)}})]}),c&&(0,W.jsxs)(BL,{color:`pink`,children:[(0,W.jsx)(`div`,{className:`Card-icon`,children:Db}),(0,W.jsx)(`h2`,{children:K(`exportDialog.link_title`)}),(0,W.jsx)(`div`,{className:`Card-details`,children:K(`exportDialog.link_details`)}),(0,W.jsx)(X,{className:`Card-button`,type:`button`,title:K(`exportDialog.link_button`),"aria-label":K(`exportDialog.link_button`),showAriaLabel:!0,onClick:async()=>{try{dC(`export`,`link`,`ui (${Sr()})`),await c(e,t,r),s()}catch(e){n({errorMessage:e.message})}}})]}),a.renderCustomUI&&a.renderCustomUI(e,t,r,o)]})})},HL=({elements:e,appState:t,files:n,actionManager:r,exportOpts:i,canvas:a,setAppState:o})=>{let s=H.useCallback(()=>{o({openDialog:null})},[o]);return(0,W.jsx)(W.Fragment,{children:t.openDialog?.name===`jsonExport`&&(0,W.jsx)(dk,{onCloseRequest:s,title:K(`buttons.export`),children:(0,W.jsx)(VL,{elements:e,appState:t,setAppState:o,files:n,actionManager:r,onCloseRequest:s,exportOpts:i,canvas:a})})})},UL=`small`,WL=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__LaserPointer`,`ToolIcon_size_${UL}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":`toolbar-LaserPointer`}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:dS})]}),GL=({UIOptions:e})=>(0,W.jsxs)(PP,{__fallback:!0,children:[(0,W.jsx)(PP.DefaultItems.LoadScene,{}),(0,W.jsx)(PP.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,W.jsx)(PP.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,W.jsx)(PP.DefaultItems.SaveAsImage,{}),(0,W.jsx)(PP.DefaultItems.SearchMenu,{}),(0,W.jsx)(PP.DefaultItems.Help,{}),(0,W.jsx)(PP.DefaultItems.ClearCanvas,{}),(0,W.jsx)(PP.Separator,{}),(0,W.jsx)(PP.Group,{title:`Excalidraw links`,children:(0,W.jsx)(PP.DefaultItems.Socials,{})}),(0,W.jsx)(PP.Separator,{}),(0,W.jsx)(PP.DefaultItems.ToggleTheme,{}),(0,W.jsx)(PP.DefaultItems.ChangeCanvasBackground,{})]}),KL=()=>(0,W.jsxs)(RP,{__fallback:!0,children:[(0,W.jsx)(RP.Actions.SaveToDisk,{}),(0,W.jsx)(RP.Actions.ExportToImage,{})]}),qL=({actionManager:e,appState:t,files:n,setAppState:r,elements:i,canvas:a,onLockToggle:o,onHandToolToggle:s,onPenModeToggle:c,showExitZenModeBtn:l,renderTopLeftUI:u,renderTopRightUI:d,renderCustomStats:f,UIOptions:p,onExportImage:m,renderWelcomeScreen:h,children:g,app:_,isCollaborating:v,generateLinkForSelection:y})=>{let b=iz(),x=az()===`compact`,S=vk(),C=x?{menuTopGap:4,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:.5,islandPadding:1,collabMarginLeft:8}:{menuTopGap:6,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:1,islandPadding:1,collabMarginLeft:8},w=S.tunnelsJotai.Provider,[T,E]=vy(bC),D=()=>p.canvasActions.export?(0,W.jsx)(HL,{elements:i,appState:t,files:n,actionManager:e,exportOpts:p.canvasActions.export,canvas:a,setAppState:r}):null,O=()=>!p.canvasActions.saveAsImage||t.openDialog?.name!==`imageExport`?null:(0,W.jsx)(RL,{elements:i,appState:t,files:n,actionManager:e,onExportImage:m,onCloseRequest:()=>r({openDialog:null}),name:_.getName()}),k=()=>(0,W.jsxs)(`div`,{style:{position:`relative`},children:[(0,W.jsx)(S.MainMenuTunnel.Out,{}),h&&(0,W.jsx)(S.WelcomeScreenMenuHintTunnel.Out,{})]}),A=()=>{let n=x;return(0,W.jsx)(BN,{heading:`selectedShapeActions`,className:U(`selected-shape-actions zen-mode-transition`,{"transition-left":t.zenModeEnabled}),children:n?(0,W.jsx)(SC,{className:U(`compact-shape-actions-island`),padding:0,style:{maxHeight:`${t.height-166}px`},children:(0,W.jsx)(Ak,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_,setAppState:r})}):(0,W.jsx)(SC,{className:Qn.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:(0,W.jsx)(wk,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_})})})},ee=()=>{let n=oo(t,i),a=t.stats.open&&!t.zenModeEnabled&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`;return(0,W.jsx)(MN,{side:`top`,children:(0,W.jsxs)(`div`,{className:`App-menu App-menu_top`,children:[(0,W.jsxs)(_O.Col,{gap:C.menuTopGap,className:U(`App-menu_top__left`),children:[k(),(0,W.jsx)(`div`,{className:U(`selected-shape-actions-container`,{"selected-shape-actions-container--compact":x}),children:n&&A()})]}),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(0,W.jsx)(BN,{heading:`shapes`,className:`shapes-section`,children:e=>(0,W.jsxs)(`div`,{style:{position:`relative`},children:[h&&(0,W.jsx)(S.WelcomeScreenToolbarHintTunnel.Out,{}),(0,W.jsx)(_O.Col,{gap:C.toolbarColGap,align:`start`,children:(0,W.jsxs)(_O.Row,{gap:C.toolbarRowGap,className:U(`App-toolbar-container`,{"zen-mode":t.zenModeEnabled}),children:[(0,W.jsxs)(SC,{padding:C.islandPadding,className:U(`App-toolbar`,{"zen-mode":t.zenModeEnabled,"App-toolbar--compact":x}),children:[(0,W.jsx)(jL,{appState:t,isMobile:b.formFactor===`phone`,editorInterface:b,app:_}),e,(0,W.jsxs)(_O.Row,{gap:C.toolbarInnerRowGap,children:[(0,W.jsx)(PN,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>c(null),title:K(`toolBar.penMode`),penDetected:t.penDetected}),(0,W.jsx)(EN,{checked:t.activeTool.locked,onChange:o,title:K(`toolBar.lock`)}),(0,W.jsx)(`div`,{className:`App-toolbar__divider`}),(0,W.jsx)(Mk,{setAppState:r,activeTool:t.activeTool,UIOptions:p,app:_})]})]}),v&&(0,W.jsx)(SC,{style:{marginLeft:C.collabMarginLeft,alignSelf:`center`,height:`fit-content`},children:(0,W.jsx)(WL,{title:K(`toolBar.laser`),checked:t.activeTool.type===va.laser,onChange:()=>_.setActiveTool({type:va.laser}),isMobile:!0})})]})})]})}),(0,W.jsxs)(`div`,{className:U(`layer-ui__wrapper__top-right zen-mode-transition`,{"transition-right":t.zenModeEnabled,"layer-ui__wrapper__top-right--compact":x}),children:[t.collaborators.size>0&&(0,W.jsx)(KN,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),d?.(b.formFactor===`phone`,t),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(!ne||t.openSidebar?.name!==At.name)&&(0,W.jsx)(S.DefaultSidebarTriggerTunnel.Out,{}),a&&(0,W.jsx)(gL,{app:_,onClose:()=>{e.executeAction(OE)},renderCustomStats:f})]})]})})},te=()=>(0,W.jsx)($P,{__fallback:!0,onDock:e=>{dC(`sidebar`,`toggleDock (${e?`dock`:`undock`})`,`(${b.formFactor===`phone`?`mobile`:`desktop`})`)}}),ne=by(rP),j=(0,W.jsxs)(W.Fragment,{children:[g,(0,W.jsx)(GL,{UIOptions:p}),(0,W.jsx)($P.Trigger,{__fallback:!0,icon:YS,title:Ge(K(`toolBar.library`)),onToggle:e=>{e&&dC(`sidebar`,`${At.name} (open)`,`button (${b.formFactor===`phone`?`mobile`:`desktop`})`)},tab:At.defaultTab}),(0,W.jsx)(KL,{}),t.openDialog?.name===`ttd`&&(0,W.jsx)(wI,{__fallback:!0}),t.isLoading&&(0,W.jsx)(CN,{delay:250}),t.errorMessage&&(0,W.jsx)(xL,{onClose:()=>r({errorMessage:null}),children:t.errorMessage}),T&&b.formFactor!==`phone`&&(0,W.jsx)(xC,{colorPickerType:T.colorPickerType,onCancel:()=>{E(null)},onChange:(e,t,n,{altKey:a})=>{if(!(e!==`elementBackground`&&e!==`elementStroke`))if(n.length){for(let r of n)jn(r,lr(i),{[a&&T.swapPreviewOnAlt?e===`elementBackground`?`strokeColor`:`backgroundColor`:e===`elementBackground`?`backgroundColor`:`strokeColor`]:t}),bn.delete(r);_.scene.triggerUpdate()}else r(e===`elementBackground`?{currentItemBackgroundColor:t}:{currentItemStrokeColor:t})},onSelect:(e,t)=>{E(e=>e?.keepOpenOnAlt&&t.altKey?e:null),T?.onSelect?.(e,t)}}),t.openDialog?.name===`help`&&(0,W.jsx)(OL,{onClose:()=>{r({openDialog:null})}}),(0,W.jsx)(zk,{}),t.openDialog?.name===`elementLinkSelector`&&(0,W.jsx)(bL,{sourceElementId:t.openDialog.sourceElementId,onClose:()=>{r({openDialog:null})},scene:_.scene,appState:t,generateLinkForSelection:y}),(0,W.jsx)(S.OverwriteConfirmDialogTunnel.Out,{}),O(),D(),t.openDialog?.name===`charts`&&(0,W.jsx)(zN,{data:t.openDialog.data,rawText:t.openDialog.rawText,onClose:()=>r({openDialog:null})}),b.formFactor===`phone`&&(0,W.jsx)(FN,{app:_,appState:t,elements:i,actionManager:e,renderJSONExportDialog:D,renderImageExportDialog:O,setAppState:r,onHandToolToggle:s,onPenModeToggle:c,renderTopLeftUI:u,renderTopRightUI:d,renderSidebars:te,renderWelcomeScreen:h,UIOptions:p}),b.formFactor!==`phone`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`layer-ui__wrapper`,style:t.openSidebar&&ne&&b.canFitSidebar?{width:`calc(100% - var(--right-sidebar-width))`}:{},children:[h&&(0,W.jsx)(S.WelcomeScreenCenterTunnel.Out,{}),ee(),(0,W.jsx)(YN,{appState:t,actionManager:e,showExitZenModeBtn:l,renderWelcomeScreen:h}),(t.toast||t.scrolledOutside)&&(0,W.jsxs)(`div`,{className:`floating-status-stack`,children:[t.toast&&(0,W.jsx)(fT,{message:t.toast.message,onClose:()=>r({toast:null}),duration:t.toast.duration,closable:t.toast.closable}),!t.toast&&t.scrolledOutside&&(0,W.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...An(i,e)}))},children:K(`buttons.scrollBackToContent`)})]})]}),te()]})]});return(0,W.jsx)(hC.Provider,{value:t,children:(0,W.jsx)(w,{children:(0,W.jsx)(hk.Provider,{value:S,children:j})})})},JL=e=>{let{startBoundElement:t,cursorButton:n,scrollX:r,scrollY:i,...a}=e;return a},YL=H.memo(qL,(e,t)=>{if(e.children!==t.children)return!1;let{canvas:n,appState:r,...i}=e,{canvas:a,appState:o,...s}=t;return ji(JL(r),JL(o),{selectedElementIds:ji,selectedGroupIds:ji})&&ji(i,s)}),XL=`small`,ZL=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__MagicButton`,`ToolIcon_size_${XL}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:e.icon})]}),QL=({trails:e})=>{let t=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(t.current)for(let n of e)n.start(t.current);return()=>{for(let t of e)t.stop()}},e),(0,W.jsx)(`div`,{className:`SVGLayer`,children:(0,W.jsx)(`svg`,{ref:t})})},$L=`#ff6b6b`,eR=`#ff0000`,tR=1,nR=2,rR=(e,t)=>{if(!t.snapLines.length)return;let n=t.theme===R.LIGHT||t.zenModeEnabled?$L:eR,r=(t.zenModeEnabled?tR*1.5:tR)/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY);for(let i of t.snapLines)i.type===`pointer`?(e.lineWidth=r,e.strokeStyle=n,aR(i,e,t)):i.type===`gap`?(e.lineWidth=r,e.strokeStyle=n,cR(i.points[0],i.points[1],i.direction,t,e)):i.type===`points`&&(e.lineWidth=r,e.strokeStyle=n,iR(i,e,t));e.restore()},iR=(e,t,n)=>{if(!n.zenModeEnabled){let n=e.points[0],r=e.points[e.points.length-1];sR(n,r,t)}for(let r of e.points)oR(r,n,t)},aR=(e,t,n)=>{oR(e.points[0],n,t),n.zenModeEnabled||sR(e.points[0],e.points[1],t)},oR=([e,t],n,r)=>{r.save();let i=(n.zenModeEnabled?nR*1.5:nR)/n.zoom.value;r.beginPath(),r.moveTo(e-i,t-i),r.lineTo(e+i,t+i),r.moveTo(e+i,t-i),r.lineTo(e-i,t+i),r.stroke(),r.restore()},sR=(e,t,n)=>{n.beginPath(),n.lineTo(e[0],e[1]),n.lineTo(t[0],t[1]),n.stroke()},cR=(e,t,n,r,i)=>{let a=8/r.zoom.value,o=a/2,s=a/4;if(n===`horizontal`){let n=[(e[0]+t[0])/2,e[1]];r.zenModeEnabled||sR(O(e[0],e[1]-a),O(e[0],e[1]+a),i),sR(O(n[0]-s,n[1]-o),O(n[0]-s,n[1]+o),i),sR(O(n[0]+s,n[1]-o),O(n[0]+s,n[1]+o),i),r.zenModeEnabled||(sR(O(t[0],t[1]-a),O(t[0],t[1]+a),i),sR(e,t,i))}else{let n=[e[0],(e[1]+t[1])/2];r.zenModeEnabled||sR(O(e[0]-a,e[1]),O(e[0]+a,e[1]),i),sR(O(n[0]-o,n[1]-s),O(n[0]+o,n[1]-s),i),sR(O(n[0]-o,n[1]+s),O(n[0]+o,n[1]+s),i),r.zenModeEnabled||(sR(O(t[0]-a,t[1]),O(t[0]+a,t[1]),i),sR(e,t,i))}},lR=(e,t)=>{gt(t.selectedLinearElement,`selectedLinearElement is null`);let{segmentMidPointHoveredCoords:n}=t.selectedLinearElement;gt(n,`midPointCoords is null`),e.save(),e.translate(t.scrollX,t.scrollY),dR(n,e,t),e.restore()},uR=(e,t,n)=>{let{elementId:r,hoverPointIndex:i}=t.selectedLinearElement;if(t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(i)||t.selectedLinearElement?.isDragging)return;let a=I.getElement(r,n);if(!a)return;let o=I.getPointAtIndexGlobalCoordinates(a,i,n);e.save(),e.translate(t.scrollX,t.scrollY),dR(o,e,t),e.restore()},dR=(e,t,n)=>{t.fillStyle=`rgba(105, 101, 219, 0.4)`,De(t,e[0],e[1],I.POINT_HANDLE_SIZE/n.zoom.value,!1)},fR=(e,t,n)=>{e.save(),e.translate(t.scrollX,t.scrollY),dR(n,e,t),e.restore()},pR=(e,t,n,r,i,a,o)=>{e.strokeStyle=`#5e5ad8`,e.setLineDash([]),e.fillStyle=`rgba(255, 255, 255, 0.9)`,i?e.fillStyle=`rgba(134, 131, 226, 0.9)`:a&&(e.fillStyle=`rgba(177, 151, 252, 0.7)`),De(e,n[0],n[1],(o?r*(t.selectedLinearElement?.isEditing?1.5:2):r)/t.zoom.value,!a,!o||i)},mR=(e,t,n,r,i)=>{let a=t.element.frameId&&n.get(t.element.frameId);switch(a&&L(a)&&(e.translate(a.x,a.y),e.beginPath(),On.radius&&e.roundRect?e.roundRect(-1,-1,a.width+1,a.height+1,On.radius/r.zoom.value):e.rect(-1,-1,a.width+1,a.height+1),e.clip(),e.translate(-a.x,-a.y)),t.element.type){case`magicframe`:case`frame`:e.save(),e.translate(t.element.x,t.element.y),e.lineWidth=On.strokeWidth/r.zoom.value,e.strokeStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,On.radius&&e.roundRect?(e.beginPath(),e.roundRect(0,0,t.element.width,t.element.height,On.radius/r.zoom.value),e.stroke(),e.closePath()):e.strokeRect(0,0,t.element.width,t.element.height),e.restore();break;default:e.save();let i=Ae(t.element,n);switch(e.translate(i[0],i[1]),e.rotate(t.element.angle),e.translate(-i[0],-i[1]),e.translate(t.element.x,t.element.y),e.lineWidth=Ht(1.75,t.element.strokeWidth,4)/Math.max(.25,r.zoom.value),e.strokeStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,t.element.type){case`ellipse`:e.beginPath(),e.ellipse(t.element.width/2,t.element.height/2,t.element.width/2,t.element.height/2,0,0,2*Math.PI),e.closePath(),e.stroke();break;case`diamond`:{let[n,r]=ur(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break;default:{let[n,r]=ee(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break}e.restore();break}if(r.isMidpointSnappingEnabled&&(L(t.element)||un(t.element))){let a=r.selectedLinearElement,o=a?.elementId&&I.getElement(a?.elementId,n),s=i&&Ui({point:i,element:t.element,elementsMap:n,threshold:0,overrideShouldTestInside:!0}),c=o&&dr(o)||r.activeTool.type===`arrow`&&r.currentItemArrowType===`elbow`;if(!s||c){e.save();let a=Ae(t.element,n),o;if(t.element.type===`diamond`){let e=Ae(t.element,n);o=as(t.element).map(n=>{let r=ke(Os(n,.5),e,t.element.angle);return O(r[0],r[1])})}else o=[{x:t.element.width,y:t.element.height/2},{x:t.element.width/2,y:t.element.height},{x:0,y:t.element.height/2},{x:t.element.width/2,y:0}].map(e=>{let n=ke(O(e.x+t.element.x,e.y+t.element.y),a,t.element.angle);return O(n[0],n[1])});let l=i&&o.reduce((e,t,n)=>{let r=Se(t,i);return n===-1||r<e.distance?{idx:n,distance:r}:e},{idx:-1,distance:1/0}),u=4/r.zoom.value,d=ii(r.zoom)+t.element.strokeWidth/2;o.forEach((t,n)=>{let i=(!s||c)&&l?.idx===n&&l.distance<=d,a=!i&&(c||n===l?.idx&&l.distance<=d*2);i?(e.fillStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,e.beginPath(),e.arc(t[0],t[1],u,0,2*Math.PI),e.fill()):a&&(e.fillStyle=r.theme===R.DARK?`rgba(0, 0, 0, 0.8)`:`rgba(65, 65, 65, 0.5)`,e.beginPath(),e.arc(t[0],t[1],u,0,2*Math.PI),e.fill())}),e.restore()}}},hR=(e,t,n,r,i,a,o)=>{let s=e.state.bindMode===`orbit`&&e.bindModeHandler!==null,c=700-(o?.runtime??(s?0:700)),l=Ht(1/700*c,1e-4,1),u=n.strokeWidth/2,d=n.frameId&&r.get(n.frameId);switch(d&&L(d)&&(t.translate(d.x,d.y),t.beginPath(),On.radius&&t.roundRect?t.roundRect(-1,-1,d.width+1,d.height+1,On.radius/i.zoom.value):t.rect(-1,-1,d.width+1,d.height+1),t.clip(),t.translate(-d.x,-d.y)),n.type){case`magicframe`:case`frame`:t.save(),t.translate(n.x,n.y),t.lineWidth=On.strokeWidth/i.zoom.value,t.strokeStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l})`:`rgba(106, 189, 252, ${l})`,On.radius&&t.roundRect?(t.beginPath(),t.roundRect(0,0,n.width,n.height,On.radius/i.zoom.value),t.stroke(),t.closePath()):t.strokeRect(0,0,n.width,n.height),t.restore();break;default:t.save();let e=Ae(n,r),a=e[0]+i.scrollX,o=e[1]+i.scrollY;switch(t.translate(a,o),t.rotate(n.angle),t.translate(-a,-o),t.translate(n.x+i.scrollX-u,n.y+i.scrollY-u),t.lineWidth=Ht(2.5,n.strokeWidth*1.75,4)/Math.max(.25,i.zoom.value),t.strokeStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l/2})`:`rgba(106, 189, 252, ${l/2})`,n.type){case`ellipse`:t.beginPath(),t.ellipse((n.width+u*2)/2,(n.height+u*2)/2,(n.width+u*2)/2,(n.height+u*2)/2,0,0,2*Math.PI),t.closePath(),t.stroke();break;case`diamond`:{let[e,r]=ur(n,u);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+u,e[0][1]-n.y+u),t.lineTo(e[1][0]-n.x+u,e[1][1]-n.y+u),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+u,r[1]-n.y+u),t.bezierCurveTo(i[0]-n.x+u,i[1]-n.y+u,a[0]-n.x+u,a[1]-n.y+u,o[0]-n.x+u,o[1]-n.y+u),t.stroke()})}break;default:{let[e,r]=ee(n,u);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+u,e[0][1]-n.y+u),t.lineTo(e[1][0]-n.x+u,e[1][1]-n.y+u),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+u,r[1]-n.y+u),t.bezierCurveTo(i[0]-n.x+u,i[1]-n.y+u,a[0]-n.x+u,a[1]-n.y+u,o[0]-n.x+u,o[1]-n.y+u),t.stroke()})}break}t.restore();break}if(!s||(o?.runtime??0)>700)return;let f=.5*(Math.min(n.width,n.height)/2);if(!L(n)){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let e=1/700*c;if(t.strokeStyle=`rgba(0, 0, 0, 0.2)`,t.lineWidth=1/i.zoom.value,t.setLineDash([4/i.zoom.value,4/i.zoom.value]),t.lineDashOffset=-e*10/i.zoom.value,t.beginPath(),t.ellipse(n.width/2,n.height/2,f,f,0,0,2*Math.PI),t.stroke(),t.fillStyle=`rgba(0, 0, 0, 0.04)`,t.beginPath(),t.ellipse(n.width/2,n.height/2,f*(1-l),f*(1-l),0,0,2*Math.PI),t.fill(),t.restore(),i.isMidpointSnappingEnabled){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let e=5/i.zoom.value,a=e+5/i.zoom.value,o;if(n.type===`diamond`){let[,e]=ur(n),t=Ae(n,r);o=e.map(e=>{let r=ke(Os(e,.5),t,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}else{let e=Ae(n,r);o=[{x:n.width/2,y:0},{x:n.width,y:n.height/2},{x:n.width/2,y:n.height},{x:0,y:n.height/2}].map(t=>{let r=ke(O(t.x+n.x,t.y+n.y),e,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}o.forEach(e=>{t.clearRect(e.x-a,e.y-a,a*2,a*2)}),t.fillStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l})`:`rgba(106, 189, 252, ${l})`,o.forEach(n=>{t.beginPath(),t.arc(n.x,n.y,e,0,2*Math.PI),t.fill()}),t.restore()}}return{runtime:(o?.runtime??0)+a}},gR=(e,t,n,r,i,a,o)=>{if(n!==null){if(Ys(`COMPLEX_BINDINGS`))return hR(e,t,n.element,r,i,a,o);t.save(),t.translate(i.scrollX,i.scrollY),mR(t,n,r,i,e.lastPointerMoveCoords?O(e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y):null),t.restore()}},_R=(e,t,n)=>{let{angle:r,x1:i,y1:a,x2:o,y2:s,selectionColors:c,cx:l,cy:u,dashed:d,activeEmbeddable:f}=n,p=o-i,m=s-a,h=(n.padding??4)/t.zoom.value,g=8/t.zoom.value,_=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(f?4:1)/t.zoom.value;let v=c.length;for(let t=0;t<v;++t)e.strokeStyle=c[t],d&&e.setLineDash([g,_+(g+_)*(v-1)]),e.lineDashOffset=(g+_)*t,Oo(e,i-h,a-h,p+h*2,m+h*2,l,u,r);e.restore()},vR=(e,t,n,r)=>{let[i,a,o,s]=ei(n,r),c=o-i,l=s-a;e.strokeStyle=`rgb(0,118,255)`,e.lineWidth=On.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),Oo(e,i,a,c,l,i+c/2,a+l/2,n.angle,!1,On.radius/t.zoom.value),e.restore()},yR=(e,t,n,r)=>{let{colors:i=[`rgb(0,118,255)`],dashed:a=!1}=r||{},o=n.filter(e=>e.groupIds.length===0),s=n.filter(e=>e.groupIds.length>0),c=e=>{let[t,n,r,o]=Ii(e);return{angle:0,x1:t,x2:r,y1:n,y2:o,selectionColors:i,dashed:a,cx:t+(r-t)/2,cy:n+(o-n)/2,activeEmbeddable:!1}},l=e=>c(Ki(n,e));Object.entries(Kt(s,t)).filter(([e,t])=>t).map(([e,t])=>e).map(e=>l(e)).concat(o.map(e=>c([e]))).forEach(n=>_R(e,t,n))},bR=(e,t,n,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let i=I.getPointsGlobalCoordinates(n,r),{POINT_HANDLE_SIZE:a}=I,o=t.selectedLinearElement?.isEditing?a:a/2,s=dr(n),c=ca(n);if(i.forEach((r,a)=>{if(s&&a!==0&&a!==i.length-1)return;let l=a>0&&(a!==i.length-1||!c||!n.polygon)&&Tt(r,a===i.length-1?i[0]:i[a-1],2/t.zoom.value),u=!!t.selectedLinearElement?.isEditing&&!!t.selectedLinearElement?.selectedPointsIndices?.includes(a);c&&n.polygon&&!u&&a===n.points.length-1&&t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(0)&&(u=!0),pR(e,t,r,o,u,!1,l)}),dr(n)){let r=n.fixedSegments?.map(e=>e.index)||[];i.slice(0,-1).forEach((o,s)=>{I.isSegmentTooShort(n,i[s+1],i[s],s,t.zoom)||pR(e,t,O((o[0]+i[s+1][0])/2,(o[1]+i[s+1][1])/2),a/2,!1,!r.includes(s+1),!1)})}else I.getEditorMidPoints(n,r,t).filter((e,t,r)=>e!==null&&!(dr(n)&&(t===0||t===r.length-1))).forEach(n=>{(t.selectedLinearElement?.isEditing||i.length===2)&&pR(e,t,n,a/2,!1,!0,!1)});e.restore()},xR=(e,t,n,r)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([4/t.zoom.value,4/t.zoom.value]),e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(r[0],r[1]),e.stroke(),e.restore()},SR=(e,t,n,r,i)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([]),e.fillStyle=i?`rgba(134, 131, 226, 0.9)`:`rgba(255, 255, 255, 0.9)`,De(e,n[0],n[1],r/t.zoom.value,!0,!0),e.restore()},CR=({arrow:e,appState:t,type:n,context:r,elementsMap:i})=>{let a=n===`start`?e.startBinding:e.endBinding,o=a?.elementId&&i.get(a.elementId);if(!o||!un(o)||o.isDeleted)return;let s=xi(a.fixedPoint,o,i);if(!sa(s,e,o,i,t,n))return;let c=t.selectedLinearElement,l=!!c?.isDragging,u=n===`start`?0:e.points.length-1,d=!!c?.selectedPointsIndices?.includes(u);if(c?.hoveredFocusPointBinding===n&&!c.draggedFocusPointBinding&&fR(r,t,s),!(d&&l)){let s=xi(a.fixedPoint,o,i),l=c?.hoveredFocusPointBinding===n;xR(r,t,I.getPointAtIndexGlobalCoordinates(e,u,i),s),SR(r,t,s,hn/1.5,l)}},wR=(e,t,n,r,i)=>{Object.keys(r).forEach(a=>{let o=r[a];if(o!==void 0){let[r,s,c,l]=o;e.save(),e.lineWidth=1/n.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),a===`rotation`?De(e,r+c/2,s+l/2,c/2,!0):e.roundRect?(e.beginPath(),e.roundRect(r,s,c,l,2/n.zoom.value),e.fill(),e.stroke()):Oo(e,r,s,c,l,r+c/2,s+l/2,i,!0),e.restore()}})},TR=(e,t,n,r,i)=>{let[a,o,,,s,c]=ei(r,i),l=3/n.zoom.value,u=l/2,d=s-a+l,f=c-o+l,p=Math.min(20/n.zoom.value,d),m=Math.min(20/n.zoom.value,f);e.save(),e.fillStyle=t.selectionColor,e.strokeStyle=t.selectionColor,e.lineWidth=l,[[[-d,-f],[0,u],[p,u],[u,0],[u,m]],[[d-u,-f],[u,u],[-p+u,u],[0,0],[0,m]],[[-d,f],[0,-u],[p,-u],[u,0],[u,-m]],[[d-u,f],[u,-u],[-p+u,-u],[0,0],[0,-m]]].forEach(t=>{let[[n,i],[a,o],[l,u],[d,f],[p,m]]=t;e.save(),e.translate(s,c),e.rotate(r.angle),e.beginPath(),e.moveTo(n+a,i+o),e.lineTo(n+l,i+u),e.stroke(),e.beginPath(),e.moveTo(n+d,i+f),e.lineTo(n+p,i+m),e.stroke(),e.restore()}),e.restore()},ER=(e,t,n,r)=>{t.save();let i=4/n.zoom.value,a=e.width+i*2,o=e.height+i*2,s=e.x+a/2,c=e.y+o/2,l=-(a/2+i),u=-(o/2+i);t.translate(s+n.scrollX,c+n.scrollY),t.rotate(e.angle),t.lineWidth=1/n.zoom.value,t.strokeStyle=r,t.strokeRect(l,u,a,o),t.restore()},DR=({app:e,canvas:t,elementsMap:n,visibleElements:r,selectedElements:i,allElementsMap:a,scale:o,appState:s,renderConfig:c,editorInterface:l,animationState:u,deltaTime:d})=>{if(t===null)return{atLeastOneVisibleElement:!1,elementsMap:n};let[f,p]=_(t,o),m=u,h=ht({canvas:t,scale:o,normalizedWidth:f,normalizedHeight:p});h.save(),h.scale(s.zoom.value,s.zoom.value);let g;if(r.forEach(e=>{s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===e.id&&e&&(g=e)}),g&&bR(h,s,g,n),s.selectionElement&&!s.isCropping)try{Oa(s.selectionElement,h,s,c.selectionColor)}catch(e){console.error(e)}if(s.editingTextElement&&M(s.editingTextElement)){let e=a.get(s.editingTextElement.id);e&&!e.autoResize&&ER(e,h,s,c.selectionColor)}if(m=s.isBindingEnabled&&s.suggestedBinding?{...u,bindingHighlight:gR(e,h,s.suggestedBinding,a,s,d,u?.bindingHighlight)}:{...u,bindingHighlight:void 0},s.frameToHighlight&&vR(h,s,s.frameToHighlight,n),s.elementsToHighlight&&yR(h,s,s.elementsToHighlight),s.activeLockedId){let e=a.get(s.activeLockedId);yR(h,s,e?[e]:Ki(a,s.activeLockedId),{colors:[`#ced4da`],dashed:!0})}let v=i.some(e=>L(e));i.length===1&&s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===i[0].id&&bR(h,s,i[0],n);let y=s.selectedLinearElement,x=y&&I.getElement(y.elementId,a);if(x&&(s.selectedLinearElement.isDragging||(y.segmentMidPointHoveredCoords?lR(h,s):(dr(x)?y.hoverPointIndex===0||y.hoverPointIndex===x.points.length-1:y.hoverPointIndex>=0)&&uR(h,s,n)),jt(x)&&(CR({arrow:x,elementsMap:a,appState:s,context:h,type:`start`}),CR({arrow:x,elementsMap:a,appState:s,context:h,type:`end`}))),!s.multiElement&&!s.newElement&&!s.selectedLinearElement?.isEditing){let e=Jo(i,s,l),t=i.length===1&&b(i[0]);t&&s.selectedLinearElement?.elementId===i[0].id&&!i[0].locked&&bR(h,s,i[0],n);let r=c.selectionColor||`#000`;if(e){let e=lr(i),a=[];for(let i of n.values()){let o=[],l=c.remoteSelectedElementIds.get(i.id);if(t&&dr(i)&&(i.startBinding||i.endBinding)||(e.has(i.id)&&!ft(s,i)&&o.push(r),l&&o.push(...l.map(e=>iE(e,s.collaborators.get(e))))),o.length){let[e,t,r,c,u,d]=ei(i,n,!0);a.push({angle:i.angle,x1:e,y1:t,x2:r,y2:c,selectionColors:i.locked?[`#ced4da`]:o,dashed:!!l||i.locked,cx:u,cy:d,activeEmbeddable:s.activeEmbeddable?.element===i&&s.activeEmbeddable.state===`active`,padding:i.id===s.croppingElementId||io(i)?0:void 0})}}let o=e=>{let t=Ki(n,e),[r,i,o,s]=Ii(t);a.push({angle:0,x1:r,x2:o,y1:i,y2:s,selectionColors:t.some(e=>e.locked)?[`#ced4da`]:[`#000`],dashed:!0,cx:r+(o-r)/2,cy:i+(s-i)/2,activeEmbeddable:!1})};for(let e of po(s))o(e);s.editingGroupId&&o(s.editingGroupId),a.forEach(e=>_R(h,s,e))}if(h.save(),h.translate(s.scrollX,s.scrollY),i.length===1){h.fillStyle=`#fff`;let t=Ce(i[0],s.zoom,n,`mouse`,Ea(l));if(!s.viewModeEnabled&&e&&!M(s.editingTextElement)&&!s.croppingElementId&&wR(h,c,s,t,i[0].angle),s.croppingElementId&&!s.isCropping){let e=n.get(s.croppingElementId);e&&io(e)&&TR(h,c,s,e,n)}}else if(i.length>1&&!s.isRotating&&!i.some(e=>e.locked)){let e=4/s.zoom.value;h.fillStyle=`#fff`;let[t,a,o,u]=Ii(i,n),d=h.getLineDash();h.setLineDash([2/s.zoom.value]);let f=h.lineWidth;h.lineWidth=1/s.zoom.value,h.strokeStyle=r,Oo(h,t-e,a-e,o-t+e*2,u-a+e*2,(t+o)/2,(a+u)/2,0),h.lineWidth=f,h.setLineDash(d);let p=Do([t,a,o,u,(t+o)/2,(a+u)/2],0,s.zoom,`mouse`,v?{...Ea(l),rotation:!0}:Ea(l));i.some(e=>!e.locked)&&wR(h,c,s,p,0)}h.restore()}s.searchMatches?.matches.forEach(({id:e,focus:t,matchedLines:r})=>{let i=n.get(e);if(i){let[e,a,,,o,c]=ei(i,n,!0);h.save(),s.theme===R.LIGHT?t?h.fillStyle=`rgba(255, 124, 0, 0.4)`:h.fillStyle=`rgba(255, 226, 0, 0.4)`:t?h.fillStyle=`rgba(229, 82, 0, 0.4)`:h.fillStyle=`rgba(99, 52, 0, 0.4)`;let l=L(i)?s.zoom.value:1;h.translate(s.scrollX,s.scrollY),h.translate(o,c),h.rotate(i.angle),r.forEach(n=>{(n.showOnCanvas||t)&&h.fillRect(e+n.offsetX/l-o,a+n.offsetY/l-c,n.width/l,n.height/l)}),h.restore()}}),rR(h,s),h.restore(),oE({context:h,renderConfig:c,appState:s,normalizedWidth:f,normalizedHeight:p});let S;return c.renderScrollbars&&(S=tM(n,f,p,s),h.save(),h.fillStyle=eM,h.strokeStyle=`rgba(255,255,255,0.8)`,[S.horizontal,S.vertical].forEach(e=>{e&&nE(h,e.x,e.y,e.width,e.height,$j/2)}),h.restore()),{scrollBars:S,atLeastOneVisibleElement:r.length>0,elementsMap:n,animationState:m}},OR=e=>{let t=DR(e);return e.callback(t),t},kR=class e{static start(t,n){let r=n({deltaTime:0,state:void 0});r&&(e.animations.set(t,{animation:n,lastTime:0,state:r}),e.isRunning||(e.isRunning=!0,Yj()?requestAnimationFrame(e.tick):setTimeout(e.tick,0)))}static tick(){if(e.animations.size>0){for(let[t,n]of e.animations){let r=performance.now(),i=n.lastTime===0?0:r-n.lastTime,a=n.animation({deltaTime:i,state:n.state});if(a)n.lastTime=r,n.state=a;else if(e.animations.delete(t),e.animations.size===0){e.isRunning=!1;return}}Yj()?requestAnimationFrame(e.tick):setTimeout(e.tick,0)}}static running(t){return e.animations.has(t)}static cancel(t){e.animations.delete(t)}};i(kR,`isRunning`,!1),i(kR,`animations`,new Map);var AR=kR,jR=`animateInteractiveScene`,MR=e=>{let t=(0,H.useRef)(!1),n=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(!t.current){t.current=!0;return}let r=new Map,i=new Map,a=new Map,o=new Map,s=new Map;e.appState.collaborators.forEach((t,n)=>{if(t.selectedElementIds)for(let e of Object.keys(t.selectedElementIds))a.has(e)||a.set(e,[]),a.get(e).push(n);!t.pointer||t.pointer.renderCursor===!1||(t.username&&o.set(n,t.username),t.userState&&s.set(n,t.userState),i.set(n,Ci({sceneX:t.pointer.x,sceneY:t.pointer.y},e.appState)),r.set(n,t.button))});let c=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue(`--color-selection`)||`#6965db`;n.current={app:e.app,canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,allElementsMap:e.allElementsMap,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:i,remotePointerButton:r,remoteSelectedElementIds:a,remotePointerUsernames:o,remotePointerUserStates:s,selectionColor:c,renderScrollbars:e.renderScrollbars,lastViewportPosition:e.app.lastViewportPosition},editorInterface:e.editorInterface,callback:e.renderInteractiveSceneCallback,animationState:{bindingHighlight:void 0},deltaTime:0},AR.running(jR)||AR.start(jR,({deltaTime:e,state:t})=>{let r=OR({...n.current,deltaTime:e,animationState:t}).animationState;if(r){for(let e in r)if(r[e]!==void 0)return r}})}),(0,W.jsx)(`canvas`,{className:`excalidraw__canvas interactive`,style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled&&e.appState.activeTool.type!==`laser`?Kn.GRAB:Kn.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:K(`labels.drawingCanvas`)})},NR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,activeTool:e.activeTool,openDialog:e.openDialog,editingGroupId:e.editingGroupId,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,newElement:e.newElement,isBindingEnabled:e.isBindingEnabled,isMidpointSnappingEnabled:e.isMidpointSnappingEnabled,suggestedBinding:e.suggestedBinding,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled,editingTextElement:e.editingTextElement,isCropping:e.isCropping,croppingElementId:e.croppingElementId,searchMatches:e.searchMatches,activeLockedId:e.activeLockedId,hoveredElementIds:e.hoveredElementIds,frameRendering:e.frameRendering,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,currentItemArrowType:e.currentItemArrowType}),PR=H.memo(MR,(e,t)=>e.selectionNonce!==t.selectionNonce||e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements||e.renderScrollbars!==t.renderScrollbars?!1:ji(NR(e.appState),NR(t.appState))),FR=e=>{let t=(0,H.useRef)(null),n=(0,H.useRef)(!1);return(0,H.useEffect)(()=>{e.canvas.style.width=`${e.appState.width}px`,e.canvas.style.height=`${e.appState.height}px`,e.canvas.width=e.appState.width*e.scale,e.canvas.height=e.appState.height*e.scale},[e.appState.height,e.appState.width,e.canvas,e.scale]),(0,H.useEffect)(()=>{let r=t.current;if(!r)return;let i=e.canvas;n.current||(n.current=!0,r.replaceChildren(i),i.classList.add(`excalidraw__canvas`,`static`)),We({canvas:i,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},Yj())}),(0,W.jsx)(`div`,{className:`excalidraw__canvas-wrapper`,ref:t})},IR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,hoveredElementIds:e.hoveredElementIds,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,gridStep:e.gridStep,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId,currentHoveredFontFamily:e.currentHoveredFontFamily,croppingElementId:e.croppingElementId,suggestedBinding:e.suggestedBinding}),LR=H.memo(FR,(e,t)=>e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:ji(IR(e.appState),IR(t.appState))&&ji(e.renderConfig,t.renderConfig)),RR=({canvas:e,rc:t,newElement:n,elementsMap:r,allElementsMap:i,scale:a,appState:o,renderConfig:s})=>{if(e){let[c,l]=_(e,a),u=ht({canvas:e,scale:a,normalizedWidth:c,normalizedHeight:l});if(u.save(),u.scale(o.zoom.value,o.zoom.value),n&&n.type!==`selection`){if(na(n))return;if((n.frameId||o.frameToHighlight?.id)&&o.frameRendering.enabled&&o.frameRendering.clip){let e=Ts(n,r,o);e&&Yr(n,e,o,r)&&Ws(e,u,s,o)}_t(n,r,i,t,u,s,o)}else u.clearRect(0,0,c,l);u.restore()}},zR=mi(e=>{RR(e)}),BR=(e,t)=>{if(t){zR(e);return}RR(e)},VR=e=>{let t=(0,H.useRef)(null);return(0,H.useEffect)(()=>{t.current&&BR({canvas:t.current,scale:e.scale,newElement:e.appState.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},Yj())}),(0,W.jsx)(`canvas`,{className:`excalidraw__canvas`,style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:t})},HR=class{constructor(e){this.getState=e,i(this,`listeners`,[]),i(this,`onStateChange`,(e,t,n)=>{let{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}=this.normalize(e,t,n);return a?s&&(queueMicrotask(()=>{let e=this.getState();a(i(e),e)}),o)?()=>{}:this.subscribe({predicate:r,getValue:i,callback:a,once:o}):s?Promise.resolve(i(this.getState())):new Promise(e=>{this.subscribe({predicate:r,getValue:i,callback:t=>e(t),once:!0})})})}isStateChangePredicateOptions(e){return typeof e==`object`&&!Array.isArray(e)&&`predicate`in e}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}normalize(e,t,n){let r,i,a=t,o=n?.once??!1,s=!1;if(this.isStateChangePredicateOptions(e)){let{predicate:t,callback:n,once:c}=e;r=t,i=e=>e,a=n?(e,t)=>n(t):void 0,o=c??!1,s=t(this.getState())}else if(typeof e==`function`){let t=e;r=(e,n)=>t(e)!==t(n),i=e=>t(e)}else if(Array.isArray(e)){let t=e;r=(e,n)=>t.some(t=>e[t]!==n[t]),i=e=>e}else{let t=e;r=(e,n)=>e[t]!==n[t],i=e=>e[t]}return{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}}flush(e){if(!this.listeners.length)return;let t=this.getState(),n=[];for(let r of this.listeners)r.predicate(t,e)?(r.callback(r.getValue(t),t),r.once||n.push(r)):n.push(r);this.listeners=n}clear(){this.listeners=[]}},UR=({app:e,activeLockedId:t})=>{let n=e.scene.getElement(t),r=n?[n]:Ki(e.scene.getNonDeletedElementsMap(),t);if(r.length===0)return null;let[i,a]=Ii(r),{x:o,y:s}=Ci({sceneX:i,sceneY:a},e.state);return(0,W.jsx)(`div`,{className:`UnlockPopup`,style:{bottom:`${e.state.height+12-s+e.state.offsetTop}px`,left:`${o-e.state.offsetLeft}px`},onClick:()=>{(0,_c.flushSync)(()=>{let t=Kt(r,e.state);e.setState({selectedElementIds:r.reduce((e,t)=>({...e,[t.id]:!0}),{}),selectedGroupIds:t,activeLockedId:null})}),e.actionManager.executeAction(ZE)},title:K(`labels.elementLock.unlock`),children:qy})},WR=H.createContext(null),GR=H.createContext(null),KR={formFactor:`desktop`,desktopUIMode:`full`,userAgent:Ko(typeof navigator<`u`?navigator.userAgent:``),isTouchScreen:!1,canFitSidebar:!1,isLandscape:!0},qR=H.createContext(KR);qR.displayName=`EditorInterfaceContext`;var JR={"editor:mount":{cardinality:`once`,replay:`last`},"editor:initialize":{cardinality:`once`,replay:`last`},"editor:unmount":{cardinality:`once`,replay:`last`}},YR=H.createContext({container:null,id:null});YR.displayName=`ExcalidrawContainerContext`;var XR=H.createContext([]);XR.displayName=`ExcalidrawElementsContext`;var ZR=H.createContext({...cs(),width:0,height:0,offsetLeft:0,offsetTop:0});ZR.displayName=`ExcalidrawAppStateContext`;var QR=H.createContext(()=>{console.warn(`Uninitialized ExcalidrawSetAppStateContext context!`)});QR.displayName=`ExcalidrawSetAppStateContext`;var $R=H.createContext(null);$R.displayName=`ExcalidrawActionManagerContext`;var ez=H.createContext(null);ez.displayName=`ExcalidrawAPIContext`;var tz=H.createContext(null);tz.displayName=`ExcalidrawAPISetContext`;var nz=()=>(0,H.useContext)(WR),rz=()=>(0,H.useContext)(GR),iz=()=>(0,H.useContext)(qR),az=()=>Ka(iz()),oz=()=>(0,H.useContext)(YR),sz=()=>(0,H.useContext)(XR),cz=()=>(0,H.useContext)(ZR),lz=()=>(0,H.useContext)(QR),uz=()=>(0,H.useContext)($R),dz=!1,fz=0,pz=null,mz=!1,hz=!1,gz=!1,_z={horizontal:null,vertical:null},vz=0,yz=!1,bz=new Map,xz=!1,Sz=0,Cz=!1,wz=null,Tz={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},Ez=class e extends H.Component{constructor(t){super(t),i(this,`canvas`),i(this,`interactiveCanvas`,null),i(this,`sessionExportThemeOverride`),i(this,`rc`),i(this,`unmounted`,!1),i(this,`actionManager`),i(this,`editorInterface`,KR),i(this,`stylesPanelMode`,Ka(KR)),i(this,`excalidrawContainerRef`,H.createRef()),i(this,`scene`),i(this,`fonts`),i(this,`renderer`),i(this,`visibleElements`),i(this,`resizeObserver`),i(this,`library`),i(this,`libraryItemsFromStorage`),i(this,`id`),i(this,`store`),i(this,`history`),i(this,`excalidrawContainerValue`),i(this,`files`,{}),i(this,`imageCache`,new Map),i(this,`iFrameRefs`,new Map),i(this,`embedsValidationStatus`,new Map),i(this,`initializedEmbeds`,new Set),i(this,`elementsPendingErasure`,new Set),i(this,`_initialized`,!1),i(this,`editorLifecycleEvents`,new ve(JR)),i(this,`onEvent`,this.editorLifecycleEvents.on.bind(this.editorLifecycleEvents)),i(this,`appStateObserver`,new HR(()=>this.state)),i(this,`onStateChange`,this.appStateObserver.onStateChange),i(this,`flowChartCreator`,new ea),i(this,`flowChartNavigator`,new fn),i(this,`bindModeHandler`,null),i(this,`hitLinkElement`),i(this,`lastPointerDownEvent`,null),i(this,`lastPointerUpEvent`,null),i(this,`lastPointerMoveEvent`,null),i(this,`lastPointerMoveCoords`,null),i(this,`previousPointerMoveCoords`,null),i(this,`lastViewportPosition`,{x:0,y:0}),i(this,`animationFrameHandler`,new pj),i(this,`laserTrails`,new Kj(this.animationFrameHandler,this)),i(this,`eraserTrail`,new cM(this.animationFrameHandler,this)),i(this,`lassoTrail`,new sM(this.animationFrameHandler,this)),i(this,`onChangeEmitter`,new Be),i(this,`onPointerDownEmitter`,new Be),i(this,`onPointerUpEmitter`,new Be),i(this,`onUserFollowEmitter`,new Be),i(this,`onScrollChangeEmitter`,new Be),i(this,`missingPointerEventCleanupEmitter`,new Be),i(this,`onRemoveEventListenersEmitter`,new Be),i(this,`api`),i(this,`updateEditorAtom`,(e,...t)=>{let n=Cy.set(e,...t);return this.triggerRender(),n}),i(this,`previousHoveredBindableElement`,null),i(this,`getEffectiveGridSize`,()=>Sj(this)?this.state.gridSize:null),i(this,`handleIframeLikeElementHover`,({hitElement:e,scenePointer:t,moveEvent:n})=>e&&Rs(e)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(e,n,t.x,t.y))?(Gw(this.interactiveCanvas,Kn.POINTER),this.setState({activeEmbeddable:{element:e,state:`hover`}}),!0):(this.state.activeEmbeddable?.state===`hover`&&this.setState({activeEmbeddable:null}),!1)),i(this,`updateEmbedValidationStatus`,(e,t)=>{this.embedsValidationStatus.set(e.id,t),bn.delete(e)}),i(this,`updateEmbeddables`,()=>{let e=new Set,t=!1;this.scene.getNonDeletedElements().filter(n=>{if(rs(n)){if(e.add(n.id),!this.embedsValidationStatus.has(n.id)){t=!0;let e=Lt(n.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(n,e)}}else Vs(n)&&e.add(n.id);return!1}),t&&this.scene.triggerUpdate(),this.iFrameRefs.forEach((t,n)=>{e.has(n)||this.iFrameRefs.delete(n)})}),i(this,`getFrameNameDOMId`,e=>`${this.id}-frame-name-${e.id}`),i(this,`frameNameBoundsCache`,{get:e=>{let t=this.frameNameBoundsCache._cache.get(e.id);if(!t||t.zoom!==this.state.zoom.value||t.versionNonce!==e.versionNonce){let n=document.getElementById(this.getFrameNameDOMId(e));if(n){let r=n.getBoundingClientRect(),i=la({clientX:r.x,clientY:r.y},this.state),a=la({clientX:r.right,clientY:r.bottom},this.state);return t={x:i.x,y:i.y,width:a.x-i.x,height:a.y-i.y,angle:0,zoom:this.state.zoom.value,versionNonce:e.versionNonce},this.frameNameBoundsCache._cache.set(e.id,t),t}return null}return t},_cache:new Map}),i(this,`resetEditingFrame`,e=>{e&&this.scene.mutateElement(e,{name:e.name?.trim()||null}),this.setState({editingFrame:null})}),i(this,`renderFrameNames`,()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return this.state.editingFrame&&this.resetEditingFrame(null),null;let e=this.state.theme===R.DARK,t=this.scene.getNonDeletedFramesLikes(),n=t.length>0&&this.state.searchMatches?.focusedId&&L(this.scene.getElement(this.state.searchMatches.focusedId))?this.state.searchMatches.matches.find(e=>e.focus):null;return t.map(t=>{if(!vn(t,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap()))return this.state.editingFrame===t.id&&this.resetEditingFrame(t),null;let{x:r,y:i}=Ci({sceneX:t.x,sceneY:t.y},this.state),a,o=ua(t);if(t.id===this.state.editingFrame){let n=o;a=(0,W.jsx)(`input`,{autoFocus:!0,value:n,onChange:e=>{this.scene.mutateElement(t,{name:e.target.value})},onFocus:e=>e.target.select(),onBlur:()=>this.resetEditingFrame(t),onKeyDown:e=>{(e.key===N.ESCAPE||e.key===N.ENTER)&&this.resetEditingFrame(t)},style:{background:e?D(this.state.viewBackgroundColor):this.state.viewBackgroundColor,zIndex:2,border:`none`,display:`block`,padding:`6px`,borderRadius:4,boxShadow:`inset 0 0 0 1px var(--color-primary)`,fontFamily:`Assistant`,fontSize:`${On.nameFontSize}px`,transform:`translate(-6px, 6px)`,color:e?On.nameColorDarkTheme:On.nameColorLightTheme,overflow:`hidden`,maxWidth:`${document.body.clientWidth-r-6}px`},size:n.length+1||1,dir:`auto`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`})}else a=o;return(0,W.jsx)(`div`,{id:this.getFrameNameDOMId(t),className:Qn.FRAME_NAME,style:{position:`absolute`,bottom:`${this.state.height+On.nameOffsetY-i+this.state.offsetTop}px`,left:`${r-this.state.offsetLeft}px`,zIndex:2,fontSize:On.nameFontSize,color:e?On.nameColorDarkTheme:On.nameColorLightTheme,lineHeight:On.nameLineHeight,width:`max-content`,maxWidth:n?.id===t.id&&n?.focus?`none`:`${t.width*this.state.zoom.value}px`,overflow:t.id===this.state.editingFrame?`visible`:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,cursor:Kn.MOVE,pointerEvents:this.state.viewModeEnabled?uo.disabled:uo.enabled},onPointerDown:e=>this.handleCanvasPointerDown(e),onWheel:e=>this.handleWheel(e),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:t.id})},children:a},t.id)})}),i(this,`focusContainer`,()=>{this.excalidrawContainerRef.current?.focus()}),i(this,`getSceneElementsIncludingDeleted`,()=>this.scene.getElementsIncludingDeleted()),i(this,`getSceneElementsMapIncludingDeleted`,()=>this.scene.getElementsMapIncludingDeleted()),i(this,`getSceneElements`,()=>this.scene.getNonDeletedElements()),i(this,`onInsertElements`,e=>{this.addElementsFromPasteOrLibrary({elements:e,position:`center`,files:null})}),i(this,`onExportImage`,async(e,t,n)=>{dC(`export`,e,`ui`);let r=await PT(e,t,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:n.exportingFrame}).catch(te).catch(e=>{console.error(e),this.setState({errorMessage:e.message})});this.state.exportEmbedScene&&r&&ja(r)&&this.setState({fileHandle:r})}),i(this,`magicGenerations`,new Map),i(this,`updateMagicGeneration`,({frameElement:e,data:t})=>{t.status===`pending`?this.scene.mutateElement(e,{customData:{generationData:void 0}},{informMutation:!1,isDragging:!1}):this.scene.mutateElement(e,{customData:{generationData:t}},{informMutation:!1,isDragging:!1}),this.magicGenerations.set(e.id,t),this.triggerRender()}),i(this,`plugins`,{}),i(this,`onMagicframeToolSelect`,()=>{let e=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(e.length===0)this.setActiveTool({type:va.magicframe}),dC(`ai`,`tool-select (empty-selection)`,`d2c`);else{let t=e.length===1&&xe(e[0])&&e[0];if(!t&&e.some(e=>L(e)||e.frameId)){this.setActiveTool({type:va.magicframe});return}dC(`ai`,`tool-select (existing selection)`,`d2c`);let n;if(t)n=t;else{let[t,r,i,a]=Ii(e);n=Pn({...On,x:t-50,y:r-50,width:i-t+100,height:a-r+100,opacity:100,locked:!1}),this.scene.insertElement(n);for(let t of e)this.scene.mutateElement(t,{frameId:n.id});this.setState({selectedElementIds:{[n.id]:!0}})}this.onMagicFrameGenerate(n,`upstream`)}}),i(this,`openEyeDropper`,({type:e})=>{this.updateEditorAtom(bC,{swapPreviewOnAlt:!0,colorPickerType:e===`stroke`?`elementStroke`:`elementBackground`,onSelect:(t,n)=>{let r=e===`background`&&n.altKey||e===`stroke`&&!n.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!==`selection`?r?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:t},captureUpdate:V.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:t},captureUpdate:V.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(e=>this.state.selectedElementIds[e.id]?B(e,{[r?`strokeColor`:`backgroundColor`]:t}):e),captureUpdate:V.IMMEDIATELY})},keepOpenOnAlt:!1})}),i(this,`dismissLinearEditor`,()=>{setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isEditing:!1}})})}),i(this,`syncActionResult`,qj(e=>{if(this.unmounted||e===!1)return;this.store.scheduleAction(e.captureUpdate);let t=!1,n=null;if(e.elements&&(this.scene.replaceAllElements(e.elements),t=!0),e.files&&(this.addMissingFiles(e.files,e.replaceFiles),this.addNewImagesToImageCache()),e.appState||n||this.state.contextMenu){let r=e?.appState?.viewModeEnabled||!1,i=e?.appState?.zenModeEnabled||!1,a=e?.appState?.theme||this.props.theme||R.LIGHT,o=e?.appState?.name??this.state.name,s=e?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<`u`&&(r=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<`u`&&(i=this.props.zenModeEnabled),n=e.appState?.editingTextElement||null,e.elements&&n&&e.elements.forEach(e=>{n?.id===e.id&&n!==e&&Is(e)&&M(e)&&(n=e)}),n?.isDeleted&&(n=null),this.setState(t=>{let c=e.appState||{};return{...t,...c,contextMenu:null,editingTextElement:n,viewModeEnabled:r,zenModeEnabled:i,theme:a,name:o,errorMessage:s}}),t=!0}t||this.scene.triggerUpdate()})),i(this,`onBlur`,qj(()=>{mz=!1,this.setState({isBindingEnabled:this.state.bindingPreference===`enabled`})})),i(this,`onUnload`,()=>{this.onBlur()}),i(this,`disableEvent`,e=>{e.preventDefault()}),i(this,`resetHistory`,()=>{this.history.clear()}),i(this,`resetStore`,()=>{this.store.clear()}),i(this,`resetScene`,qj(e=>{this.scene.replaceAllElements([]),this.setState(t=>({...cs(),isLoading:e?.resetLoadingState?!1:t.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()})),i(this,`initializeScene`,async()=>{`launchQueue`in window&&`LaunchParams`in window&&window.launchQueue.setConsumer(async e=>{if(!e.files.length)return;let t=e.files[0],n=await t.getFile();this.loadFileToCanvas(new File([n],n.name||``,{type:n.type}),t)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let e=null;try{e=typeof this.props.initialData==`function`?await this.props.initialData()||null:await this.props.initialData||null,e?.libraryItems&&this.library.updateLibrary({libraryItems:e.libraryItems,merge:!0}).catch(e=>{console.error(e)})}catch(t){console.error(t),e={appState:{errorMessage:t.message||`Encountered an error during importing or restoring scene data`}}}let t=Sa(e?.elements,null,{repairBindings:!0,deleteInvisibleElements:!0}),n=gr(e?.appState,null),r=n.activeTool;n.preferredSelectionTool.initialized||(n.preferredSelectionTool={type:this.editorInterface.formFactor===`phone`?`lasso`:`selection`,initialized:!0}),n={...n,theme:this.props.theme||n.theme,openSidebar:n?.openSidebar||this.state.openSidebar,activeTool:r.type===`image`||r.type===`lasso`||r.type===`selection`?{...r,type:n.preferredSelectionTool.type}:n.activeTool,isLoading:!1,toast:this.state.toast},e?.scrollToContent&&(n={...n,...An(t,{...n,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.resetStore(),this.resetHistory(),this.syncActionResult({elements:t,appState:n,files:e?.files,captureUpdate:V.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(e=>{this.fonts.onLoaded(e)}),Bn(window.location.href)&&this.scrollToContent(window.location.href,{animate:!1})}),i(this,`getFormFactor`,(e,t)=>this.props.UIOptions.getFormFactor?.(e,t)??$a(e,t)),i(this,`refreshEditorInterface`,()=>{let e=this.excalidrawContainerRef.current;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect(),r=Zs(),i=Ko(typeof navigator<`u`?navigator.userAgent:``),a=this.props.UIOptions.dockedSidebarBreakpoint==null?Qi:this.props.UIOptions.dockedSidebarBreakpoint,o=Jr(this.editorInterface,{desktopUIMode:r??this.editorInterface.desktopUIMode,formFactor:this.getFormFactor(t,n),userAgent:i,canFitSidebar:t>a,isLandscape:t>n});this.editorInterface=o,this.reconcileStylesPanelMode(o)}),i(this,`reconcileStylesPanelMode`,e=>{let t=Ka(e);if(t===this.stylesPanelMode)return;let n=this.stylesPanelMode;this.stylesPanelMode=t,n!==`full`&&t===`full`&&this.setState(e=>({preferredSelectionTool:{type:`selection`,initialized:!0}}))}),i(this,`setDesktopUIMode`,e=>{let t=Ar(e);this.editorInterface=Jr(this.editorInterface,{desktopUIMode:t}),this.reconcileStylesPanelMode(this.editorInterface)}),i(this,`onResize`,qj(()=>{this.scene.getElementsIncludingDeleted().forEach(e=>bn.delete(e)),this.refreshEditorInterface(),this.updateDOMRect(),this.setState({})})),i(this,`onFullscreenChange`,()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state===`active`&&this.setState({activeEmbeddable:null})}),i(this,`renderInteractiveSceneCallback`,({atLeastOneVisibleElement:e,scrollBars:t,elementsMap:n})=>{t&&(_z=t);let r=this.state.editingTextElement?!1:!e&&n.size>0;this.state.scrolledOutside!==r&&this.setState({scrolledOutside:r}),this.scheduleImageRefresh()}),i(this,`onScroll`,wt(()=>{let{offsetTop:e,offsetLeft:t}=this.getCanvasOffsets();this.setState(n=>n.offsetLeft===t&&n.offsetTop===e?null:{offsetTop:e,offsetLeft:t})},100)),i(this,`onCut`,qj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Wr(e.target)||(this.actionManager.executeAction(yE,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onCopy`,qj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Wr(e.target)||(this.actionManager.executeAction(_E,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onTouchStart`,t=>{if(Yo&&t.preventDefault(),!dz){dz=!0,t.touches.length===1&&(pz={x:t.touches[0].clientX,y:t.touches[0].clientY}),clearTimeout(fz),fz=window.setTimeout(e.resetTapTwice,300);return}if(dz&&t.touches.length===1&&pz){let e=t.touches[0];Se(O(e.clientX,e.clientY),O(pz.x,pz.y))<=35&&(this.lassoTrail.endPath(),this.deselectElements(),this.handleCanvasDoubleClick({clientX:e.clientX,clientY:e.clientY})),dz=!1,clearTimeout(fz)}t.touches.length===2&&this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null})}),i(this,`onTouchEnd`,e=>{this.resetContextMenuTimer(),e.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:P(this.state.previousSelectedElementIds,this.state)}):Tz.pointers.clear()}),i(this,`pasteFromClipboard`,qj(async e=>{let t=!!xz,n=document.activeElement,r=this.excalidrawContainerRef.current?.contains(n);if(e&&!r)return;let i=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(e&&(!(i instanceof HTMLCanvasElement)||Wr(n)))return;let a=await DT(e),o=a.getFiles(),s=await OT(a,t);if(this.props.onPaste)try{if(await this.props.onPaste(s,e)===!1)return}catch(e){console.error(e)}await this.insertClipboardContent(s,o,t),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),e?.preventDefault()})),i(this,`addElementsFromPasteOrLibrary`,e=>{let t=Sa(e.elements,null,{deleteInvisibleElements:!0}),[n,r,i,a]=Ii(t),o=fr(n,i)/2,s=fr(r,a)/2,{x:c,y:l}=la({clientX:typeof e.position==`object`?e.position.clientX:e.position===`cursor`?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,clientY:typeof e.position==`object`?e.position.clientY:e.position===`cursor`?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop},this.state),[u,d]=It(c-o,l-s,this.getEffectiveGridSize()),{duplicatedElements:f}=Er({type:`everything`,elements:t.map(e=>B(e,{x:e.x+u-n,y:e.y+d-r})),randomizeSeed:!e.retainSeed}),p=this.scene.getElementsIncludingDeleted(),m=[...p,...f];m=this.props.onDuplicate?.(m,p)||m,fe(m,lr(f));let h=this.getTopLayerFrameAtSceneCoords({x:c,y:l});if(h){let e=ze(f,h);Je(m,e,h,this.state)}this.scene.replaceAllElements(m),f.forEach(e=>{M(e)&&ya(e)&&Zi(e,so(e,this.scene.getElementsMapIncludingDeleted()),this.scene)}),Or&&de.loadElementsFonts(f).then(e=>{this.fonts.onLoaded(e)}),e.files&&this.addMissingFiles(e.files);let g=Zn(f);this.store.scheduleCapture(),this.setState({...this.state,openSidebar:this.state.openSidebar&&this.editorInterface.canFitSidebar&&Cy.get(rP)?this.state.openSidebar:null,...Hr({editingGroupId:null,selectedElementIds:g.reduce((e,t)=>(ya(t)||(e[t.id]=!0),e),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{e.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),e.fitToContent&&this.scrollToContent(f,{fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()})}),i(this,`setAppState`,(e,t)=>{this.setState(e,t)}),i(this,`removePointer`,e=>{vz&&this.resetContextMenuTimer(),Tz.pointers.delete(e.pointerId)}),i(this,`toggleLock`,(e=`ui`)=>{this.state.activeTool.locked||dC(`toolbar`,`toggleLock`,`${e} (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),this.setState(e=>({activeTool:{...e.activeTool,...ka(this.state,e.activeTool.locked?{type:this.state.preferredSelectionTool.type}:e.activeTool),locked:!e.activeTool.locked}}))}),i(this,`updateFrameRendering`,e=>{this.setState(t=>{let n=typeof e==`function`?e(t.frameRendering):e;return{frameRendering:{enabled:n?.enabled??t.frameRendering.enabled,clip:n?.clip??t.frameRendering.clip,name:n?.name??t.frameRendering.name,outline:n?.outline??t.frameRendering.outline}}})}),i(this,`togglePenMode`,e=>{this.setState(t=>({penMode:e??!t.penMode,penDetected:!0}))}),i(this,`onHandToolToggle`,()=>{this.actionManager.executeAction(aT)}),i(this,`zoomCanvas`,e=>{this.setState({...Xw({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:_i(e)},this.state)})}),i(this,`cancelInProgressAnimation`,null),i(this,`scrollToContent`,(e=this.scene.getNonDeletedElements(),t)=>{if(typeof e==`string`){let n;if(n=Bn(e)?ne(e):e,n){let r=this.scene.getElementsFromId(n);r?.length?this.scrollToContent(r,{fitToContent:t?.fitToContent??!0,animate:t?.animate??!0}):Bn(e)&&this.setState({toast:{message:K(`elementLink.notFound`),duration:3e3,closable:!0}})}return}this.cancelInProgressAnimation?.();let n=Array.isArray(e)?e:[e],r=this.state.zoom,i=this.state.scrollX,a=this.state.scrollY;if(t?.fitToContent||t?.fitToViewport){let{appState:e}=rT({canvasOffsets:t.canvasOffsets,targetElements:n,appState:this.state,fitToViewport:!!t?.fitToViewport,viewportZoomFactor:t?.viewportZoomFactor,minZoom:t?.minZoom,maxZoom:t?.maxZoom});r=e.zoom,i=e.scrollX,a=e.scrollY}else{let e=An(n,this.state);i=e.scrollX,a=e.scrollY}if(t?.animate){let e=this.state.scrollX,n=this.state.scrollY,o=this.state.zoom.value,s=Ot({fromValues:{scrollX:e,scrollY:n,zoom:o},toValues:{scrollX:i,scrollY:a,zoom:r.value},interpolateValue:(e,t,n,r)=>{if(r===`zoom`)return e*(t/e)**+Oe(n)},onStep:({scrollX:e,scrollY:t,zoom:n})=>{this.setState({scrollX:e,scrollY:t,zoom:{value:n}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.setState({shouldCacheIgnoreZoom:!1})},duration:t?.duration??500});this.cancelInProgressAnimation=()=>{s(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:i,scrollY:a,zoom:r})}),i(this,`maybeUnfollowRemoteUser`,()=>{this.state.userToFollow&&this.setState({userToFollow:null})}),i(this,`translateCanvas`,e=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(e)}),i(this,`setToast`,e=>{this.setState({toast:e})}),i(this,`restoreFileFromShare`,async()=>{try{let e=await caches.open(`web-share-target`),t=await e.match(`shared-file`);if(t){let n=await t.blob(),r=new File([n],n.name||``,{type:n.type});this.loadFileToCanvas(r,null),await e.delete(`shared-file`),window.history.replaceState(null,dt,window.location.pathname)}}catch(e){this.setState({errorMessage:e.message})}}),i(this,`addFiles`,qj(e=>{let{addedFiles:t}=this.addMissingFiles(e);this.clearImageShapeCache(t),this.scene.triggerUpdate(),this.addNewImagesToImageCache()})),i(this,`addMissingFiles`,(e,t=!1)=>{let n=t?{}:{...this.files},r={},i=Array.isArray(e)?e:Object.values(e);for(let e of i)if(!n[e.id]&&(r[e.id]=e,n[e.id]=e,e.mimeType===hs.svg))try{let t=Qo(ae(Jn(e.dataURL)),hs.svg);e.dataURL!==t&&(e.version=(e.version??1)+1,e.dataURL=t)}catch(e){console.error(e)}return this.files=n,{addedFiles:r}}),i(this,`updateScene`,qj(e=>{let{elements:t,appState:n,collaborators:r,captureUpdate:i}=e;if(i){let e=t||void 0,r=n?Oi({...this.store.snapshot.appState,...n}):void 0;this.store.scheduleMicroAction({action:i,elements:e,appState:r})}n&&this.setState(n),t&&this.scene.replaceAllElements(t),r&&this.setState({collaborators:r})})),i(this,`applyDeltas`,(e,t)=>{let n=Ps.squash(...e),r={...this.state},i=new Map(this.scene.getElementsMapIncludingDeleted());return Ps.applyTo(n,i,r,t)}),i(this,`mutateElement`,(e,t,n=!0)=>this.scene.mutateElement(e,t,{informMutation:n,isDragging:!1})),i(this,`triggerRender`,e=>{e===!0?this.scene.triggerUpdate():this.setState({})}),i(this,`toggleSidebar`,({name:e,tab:t,force:n})=>{let r;r=n===void 0?this.state.openSidebar?.name===e&&this.state.openSidebar?.tab===t?null:e:n?e:null;let i=r?{name:r}:null;return i&&t&&(i.tab=t),this.setState({openSidebar:i}),!!r}),i(this,`updateCurrentCursorPosition`,qj(e=>{this.lastViewportPosition.x=e.clientX,this.lastViewportPosition.y=e.clientY})),i(this,`getEditorUIOffsets`,()=>{let e=this.excalidrawContainerRef?.current?.querySelector(`.App-toolbar`)?.getBoundingClientRect()?.bottom??0,t=this.excalidrawContainerRef?.current?.querySelector(`.sidebar`)?.getBoundingClientRect(),n=this.excalidrawContainerRef?.current?.querySelector(`.App-menu__left`)?.getBoundingClientRect();return My().rtl?{top:e+16,right:Math.max(this.state.width-(n?.left??this.state.width),0)+16,bottom:16,left:Math.max(t?.right??0,0)+16}:{top:e+16,right:Math.max(this.state.width-(t?.left??this.state.width)+16,0),bottom:16,left:Math.max(n?.right??0,0)+16}}),i(this,`onKeyDown`,qj(e=>{if(`Proxy`in window&&(!e.shiftKey&&/^[A-Z]$/.test(e.key)||e.shiftKey&&/^[a-z]$/.test(e.key))&&(e=new Proxy(e,{get(t,n){let r=t[n];return typeof r==`function`?r.bind(t):n===`key`?e.shiftKey?t.key.toUpperCase():t.key.toLowerCase():r}})),!Zr(e.target)){if((e.key===N.ESCAPE||e.key===N.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}let t=ir(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&io(t[0])&&e.key===N.ENTER){this.startImageCropping(t[0]);return}if(e.key===N.ESCAPE)this.updateEditorAtom(sD,null);else if(e.key===N.TAB&&(document.activeElement===this.excalidrawContainerRef?.current||document.activeElement?.classList.contains(Qn.CONVERT_ELEMENT_TYPE_POPUP))){e.preventDefault();let n=mD(t);Cy.get(sD)?.type===`panel`&&pD(this,{conversionType:n,direction:e.shiftKey?`left`:`right`})&&this.store.scheduleCapture(),n&&this.updateEditorAtom(sD,{type:`panel`})}if(e.key===N.ESCAPE&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.clear(),this.triggerRender(!0);return}let n=Pe(e.key);if(e[N.CTRL_OR_CMD]&&n&&!e.shiftKey){e.preventDefault();let t=ir(this.scene.getNonDeletedElementsMap(),this.state);t.length===1&&Vi(t[0])&&this.flowChartCreator.createNodes(t[0],this.state,Qe(e.key),this.scene),this.flowChartCreator.pendingNodes?.length&&!ms(this.flowChartCreator.pendingNodes,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(this.flowChartCreator.pendingNodes,{animate:!0,duration:300,fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()});return}if(e.altKey){let t=ir(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&n){e.preventDefault();let n=this.flowChartNavigator.exploreByDirection(t[0],this.scene.getNonDeletedElementsMap(),Qe(e.key));if(n){this.setState(e=>({selectedElementIds:P({[n]:!0},e)}));let e=this.scene.getNonDeletedElementsMap().get(n);e&&!ms([e],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(e,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})}return}}}if(e[N.CTRL_OR_CMD]&&e.key===N.P&&!e.shiftKey&&!e.altKey){this.setToast({message:K(`commandPalette.shortcutHint`,{shortcut:ND(`commandPalette`)})}),e.preventDefault();return}if(e[N.CTRL_OR_CMD]&&e.key.toLowerCase()===N.V&&(xz=e.shiftKey,clearTimeout(Sz),Sz=window.setTimeout(()=>{xz=!1},100)),e[N.CTRL_OR_CMD]&&Wr(e.target)&&(e.code===Gs.MINUS||e.code===Gs.EQUAL)){e.preventDefault();return}if(Wr(e.target)&&e.key!==N.ESCAPE||Pe(e.key)&&Zr(e.target))return;if(e.key===N.QUESTION_MARK){this.setState({openDialog:{name:`help`}});return}else if(e.key.toLowerCase()===N.E&&e.shiftKey&&e[N.CTRL_OR_CMD]){e.preventDefault(),this.setState({openDialog:{name:`imageExport`}});return}if(e.key===N.PAGE_UP||e.key===N.PAGE_DOWN){let t=(e.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;e.key===N.PAGE_DOWN&&(t=-t),e.shiftKey?this.translateCanvas(e=>({scrollX:e.scrollX+t})):this.translateCanvas(e=>({scrollY:e.scrollY+t}))}if(this.state.openDialog?.name===`elementLinkSelector`||(e.key===N.ALT&&(Ys(`COMPLEX_BINDINGS`)?this.handleSkipBindMode():C({app:this,event:e})),this.actionManager.handleKeyDown(e)))return;let t=this.props.viewModeEnabled===!0;if(!t&&this.state.viewModeEnabled&&e.key===N.ESCAPE){this.setActiveTool({type:`selection`});return}if(!t&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged){let t=mk(e.key,this);if(this.state.viewModeEnabled&&!v(t,[`laser`,`hand`]))return;if(t){this.state.activeTool.type!==t&&dC(`toolbar`,t,`keyboard (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),t===`arrow`&&this.state.activeTool.type===`arrow`&&this.setState(e=>({currentItemArrowType:e.currentItemArrowType===ts.sharp?ts.round:e.currentItemArrowType===ts.round?ts.elbow:ts.sharp})),t===`lasso`&&this.state.activeTool.type===`laser`?this.setActiveTool({type:this.state.preferredSelectionTool.type}):this.setActiveTool({type:t}),e.stopPropagation();return}else if(e.key===N.Q){this.toggleLock(`keyboard`),e.stopPropagation();return}}if(this.state.viewModeEnabled)return;if(e[N.CTRL_OR_CMD]&&!e.repeat&&(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),C({app:this,event:e})),Pe(e.key)){let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),n=new Set;t.filter(e=>ss(e)).filter(e=>{let n=e.startBinding&&!t.some(t=>t.id===e.startBinding?.elementId),r=e.endBinding&&!t.some(t=>t.id===e.endBinding?.elementId);return n||r}).forEach(e=>n.add(e.id)),t=t.filter(e=>!n.has(e.id));let r=this.getEffectiveGridSize()&&(e.shiftKey?1:this.getEffectiveGridSize())||(e.shiftKey?5:1),i=0,a=0;e.key===N.ARROW_LEFT?i=-r:e.key===N.ARROW_RIGHT?i=r:e.key===N.ARROW_UP?a=-r:e.key===N.ARROW_DOWN&&(a=r),t.forEach(e=>{this.scene.mutateElement(e,{x:e.x+i,y:e.y+a},{informMutation:!1,isDragging:!1}),ue(e,this.scene,{simultaneouslyUpdated:t})}),this.scene.triggerUpdate(),e.preventDefault()}else if(e.key===N.ENTER){let t=this.scene.getSelectedElements(this.state);if(t.length===1){let n=t[0];if(e[N.CTRL_OR_CMD]||ca(n))b(n)&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==n.id)&&(this.store.scheduleCapture(),dr(n)||this.actionManager.executeAction(XA));else if(M(n)||ni(n)){let t;M(n)||(t=n);let r=nn(n,this.state,this.scene.getNonDeletedElementsMap()),i=r.x,a=r.y;this.startTextEditing({sceneX:i,sceneY:a,container:t}),e.preventDefault();return}else L(n)&&this.setState({editingFrame:n.id})}}if(e.key===N.SPACE&&Tz.pointers.size===0&&(mz=!0,Gw(this.interactiveCanvas,Kn.GRAB),e.preventDefault()),(e.key===N.G||e.key===N.S)&&!e.altKey&&!e[N.CTRL_OR_CMD]){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;e.key===N.G&&(Ir(this.state.activeTool.type)||t.some(e=>Ir(e.type)))&&(this.setState({openPopup:`elementBackground`}),e.stopPropagation()),e.key===N.S&&(this.setState({openPopup:`elementStroke`}),e.stopPropagation())}if(!e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===N.F){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;(this.state.activeTool.type===`text`||t.find(e=>M(e)||ut(e,this.scene.getNonDeletedElementsMap())))&&(e.preventDefault(),this.setState({openPopup:`fontFamily`}))}e[N.CTRL_OR_CMD]&&(e.key===N.BACKSPACE||e.key===N.DELETE)&&this.updateEditorAtom(Rk,`clearCanvas`);let n=e.key.toLocaleLowerCase(),r=n===N.S&&e.shiftKey&&!e[N.CTRL_OR_CMD],i=e.key===N.I||n===N.G&&e.shiftKey;(r||i)&&this.openEyeDropper({type:r?`stroke`:`background`})})),i(this,`onKeyUp`,qj(e=>{if(e.key===N.SPACE&&(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`||this.state.openDialog?.name===`elementLinkSelector`?Gw(this.interactiveCanvas,Kn.GRAB):Vr(this.state.activeTool.type)?Ww(this.interactiveCanvas):(Yw(this.interactiveCanvas,this.state),this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),mz=!1),e.key===N.ALT&&C({app:this,event:e}),(e.key===N.ALT&&this.state.bindMode===`skip`||!e[N.CTRL_OR_CMD]&&!xs(this.state))&&(this.setState({bindMode:`orbit`}),this.lastPointerMoveEvent&&Ys(`COMPLEX_BINDINGS`))){let e=la({clientX:this.lastPointerMoveEvent.clientX,clientY:this.lastPointerMoveEvent.clientY},this.state),t=go(O(e.x,e.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(this.state.selectedLinearElement){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());ss(e)&&this.handleDelayedBindModeChange(e,t)}}if(!e[N.CTRL_OR_CMD]){let t=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==t&&(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:t})}),C({app:this,event:e})}if(Pe(e.key)){Bo(this.scene.getSelectedElements(this.state).filter(jt),this.scene,this.state);let e=this.scene.getNonDeletedElementsMap();this.scene.getSelectedElements(this.state).filter(Ti).forEach(t=>{t.startBinding&&this.scene.mutateElement(t,{startBinding:{...t.startBinding,...Qr(t,e.get(t.startBinding.elementId),`start`,e)}}),t.endBinding&&this.scene.mutateElement(t,{endBinding:{...t.endBinding,...Qr(t,e.get(t.endBinding.elementId),`end`,e)}})}),this.setState({suggestedBinding:null})}if(e.altKey||this.flowChartNavigator.isExploring&&(this.flowChartNavigator.clear(),this.syncActionResult({captureUpdate:V.IMMEDIATELY})),!e[N.CTRL_OR_CMD]&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.pendingNodes?.length&&this.scene.insertElements(this.flowChartCreator.pendingNodes);let e=this.flowChartCreator.pendingNodes?.[0];e&&(this.setState(t=>({selectedElementIds:P({[e.id]:!0},t)})),ms([e],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())||this.scrollToContent(e,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})),this.flowChartCreator.clear(),this.syncActionResult({captureUpdate:V.IMMEDIATELY})}})),i(this,`isToolSupported`,e=>this.props.UIOptions.tools?.[e]!==!1),i(this,`setActiveTool`,(e,t=!1)=>{if(!this.isToolSupported(e.type)){console.warn(`"${e.type}" tool is disabled via "UIOptions.canvasActions.tools.${e.type}"`);return}let n=ka(this.state,e);n.type===`hand`?Gw(this.interactiveCanvas,Kn.GRAB):mz||Yw(this.interactiveCanvas,{...this.state,activeTool:n}),Rt(document.activeElement)&&this.focusContainer(),me(n.type)||this.setState({suggestedBinding:null}),n.type===`image`&&this.onImageToolbarButtonClick(),this.setState(e=>{let r={snapLines:e.snapLines.length?[]:e.snapLines,originSnapOffset:null,activeEmbeddable:null,selectedLinearElement:Vr(n.type)?e.selectedLinearElement:null};return n.type===`freedraw`&&this.store.scheduleCapture(),n.type===`lasso`?{...e,...r,activeTool:n,...t?{}:{selectedElementIds:P({},e),selectedGroupIds:P({},e),editingGroupId:null,multiElement:null}}:n.type===`selection`?{...e,...r,activeTool:n}:{...e,...r,activeTool:n,selectedElementIds:P({},e),selectedGroupIds:P({},e),editingGroupId:null,multiElement:null}})}),i(this,`setOpenDialog`,e=>{this.setState({openDialog:e})}),i(this,`setCursor`,e=>{Gw(this.interactiveCanvas,e)}),i(this,`resetCursor`,()=>{Ww(this.interactiveCanvas)}),i(this,`isTouchScreenMultiTouchGesture`,()=>Tz.pointers.size>=2),i(this,`getName`,()=>this.state.name||this.props.name||`${K(`labels.untitled`)}-${Fn()}`),i(this,`onGestureStart`,qj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null}),Tz.initialScale=this.state.zoom.value})),i(this,`onGestureChange`,qj(e=>{if(e.preventDefault(),this.isTouchScreenMultiTouchGesture())return;let t=Tz.initialScale;t&&this.setState(n=>({...Xw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:_i(t*e.scale)},n)}))})),i(this,`onGestureEnd`,qj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:P(this.state.previousSelectedElementIds,this.state)}),Tz.initialScale=null})),i(this,`startTextEditing`,({sceneX:e,sceneY:t,insertAtParentCenter:n=!0,container:r,autoEdit:i=!0})=>{let a=!1,o=n&&this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r);r&&o&&(ut(r,this.scene.getNonDeletedElementsMap())||(a=!0));let s=null,c=this.scene.getSelectedElements(this.state);s=c.length===1?M(c[0])?c[0]:r?ut(c[0],this.scene.getNonDeletedElementsMap()):this.getTextElementAtPosition(e,t):this.getTextElementAtPosition(e,t);let l=s?.fontFamily||this.state.currentItemFontFamily,d=s?.lineHeight||ba(l),f=this.state.currentItemFontSize;if(!s&&a&&r&&!jt(r)){let n=Xs(u({fontSize:f,fontFamily:l}),d),i=Yn(f,d),a=Math.max(r.height,i),s=Math.max(r.width,n);this.scene.mutateElement(r,{height:a,width:s}),e=r.x+s/2,t=r.y+a/2,o&&=this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r)}let p=this.getTopLayerFrameAtSceneCoords({x:e,y:t}),m=s||Li({x:o?o.elementCenterX:e,y:o?o.elementCenterY:t,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:``,fontSize:f,fontFamily:l,textAlign:o?`center`:this.state.currentItemTextAlign,verticalAlign:o?Lr.MIDDLE:`top`,containerId:a?r?.id:void 0,groupIds:r?.groupIds??[],lineHeight:d,angle:r?jt(r)?0:r.angle:0,frameId:p?p.id:null});if(!s&&a&&r&&this.scene.mutateElement(r,{boundElements:(r.boundElements||[]).concat({type:`text`,id:m.id})}),this.setState({editingTextElement:m}),!s)if(r&&a){let e=this.scene.getElementIndex(r.id);this.scene.insertElementAtIndex(m,e+1)}else this.scene.insertElement(m);i||s||r?this.handleTextWysiwyg(m,{isExistingElement:!!s}):this.setState({newElement:m,multiElement:null})}),i(this,`startImageCropping`,e=>{this.store.scheduleCapture(),this.setState({croppingElementId:e.id})}),i(this,`finishImageCropping`,()=>{this.state.croppingElementId&&(this.store.scheduleCapture(),this.setState({croppingElementId:null}))}),i(this,`handleCanvasDoubleClick`,e=>{if(this.state.multiElement||this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let t=this.scene.getSelectedElements(this.state),{x:n,y:r}=la(e,this.state);if(t.length===1&&b(t[0])){let i=t[0];if((e[N.CTRL_OR_CMD]&&Ti(i)||ca(i))&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==i.id)){this.actionManager.executeAction(XA);return}else if(this.state.selectedLinearElement&&dr(t[0])){let e=I.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),i=e?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,e,this.scene.getNonDeletedElementsMap()):-1;if(i&&i>-1){this.store.scheduleCapture(),I.deleteFixedSegment(t[0],this.scene,i);let a=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),o=a?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,a,this.scene.getNonDeletedElementsMap()):null;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,segmentMidpoint:{index:o,value:e,added:!1}},segmentMidPointHoveredCoords:a}});return}}else if(this.state.selectedLinearElement?.isEditing&&this.state.selectedLinearElement.elementId===i.id&&ca(i))return}if(t.length===1&&io(t[0])){this.startImageCropping(t[0]);return}if(Ww(this.interactiveCanvas),po(this.state).length>0){let e=this.getElementAtPosition(n,r),t=e&&we(e,this.state.selectedGroupIds);if(t){this.store.scheduleCapture(),this.setState(n=>({...n,...Hr({editingGroupId:t,selectedElementIds:{[e.id]:!0}},this.scene.getNonDeletedElements(),n,this)}));return}}if(Ww(this.interactiveCanvas),!e[N.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let t=this.getElementAtPosition(n,r);if(Rs(t)){this.setState({activeEmbeddable:{element:t,state:`active`}});return}if(!this.state.selectedLinearElement?.isEditing){let t=this.getTextBindableContainerAtPosition(n,r);if(t&&(xr(t)||!Po(t.backgroundColor)||Ui({point:O(n,r),element:t,elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(t)}))){let e=nn(t,this.state,this.scene.getNonDeletedElementsMap());n=e.x,r=e.y}this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:t})}}}),i(this,`getElementLinkAtPosition`,(e,t)=>{if(t&&t.locked)return;let n=this.scene.getNonDeletedElements(),r=-1;for(let i=n.length-1;i>=0;i--){let a=n[i];if(t&&a.id===t.id&&(r=i),a.link&&i>=r&&pn(a,this.scene.getNonDeletedElementsMap(),this.state,O(e.x,e.y),this.editorInterface.formFactor===`phone`))return a}}),i(this,`handleElementLinkClick`,e=>{let t=Se(O(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),O(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||t>10)return;let n=la(this.lastPointerDownEvent,this.state),r=this.scene.getNonDeletedElementsMap(),i=pn(this.hitLinkElement,r,this.state,O(n.x,n.y),this.editorInterface.formFactor===`phone`),a=la(this.lastPointerUpEvent,this.state),o=pn(this.hitLinkElement,r,this.state,O(a.x,a.y),this.editorInterface.formFactor===`phone`);if(i&&o){qE();let t=this.hitLinkElement.link;if(t){t=Hs(t);let n;if(this.props.onLinkOpen&&(n=Fi(F.EXCALIDRAW_LINK,e.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:t},n)),!n?.defaultPrevented){let e=p(t)?`_self`:`_blank`,n=window.open(void 0,e);n&&(n.opener=null,n.location=t)}}}}),i(this,`getTopLayerFrameAtSceneCoords`,e=>{let t=this.scene.getNonDeletedElementsMap(),n=this.scene.getNonDeletedFramesLikes().filter(n=>!n.locked&&ns(e,n,t));return n.length?n[n.length-1]:null}),i(this,`handleCanvasPointerMove`,e=>{this.savePointer(e.clientX,e.clientY,this.state.cursorButton),this.lastPointerMoveEvent=e.nativeEvent;let t=la(e,this.state),{x:n,y:r}=t;this.lastPointerMoveCoords={x:n,y:r},Tz.pointers.has(e.pointerId)&&Tz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});let i=Tz.initialScale;if(Tz.pointers.size===2&&Tz.lastCenter&&i&&Tz.initialDistance){let e=mj(Tz.pointers),t=e.x-Tz.lastCenter.x,n=e.y-Tz.lastCenter.y;Tz.lastCenter=e;let r=hj(Array.from(Tz.pointers.values())),a=this.state.activeTool.type===`freedraw`&&this.state.penMode?1:r/Tz.initialDistance,o=a?_i(i*a):this.state.zoom.value;this.setState(r=>{let i=Xw({viewportX:e.x,viewportY:e.y,nextZoom:o},r);return this.translateCanvas({zoom:i.zoom,scrollX:i.scrollX+t/o*2,scrollY:i.scrollY+n/o*2,shouldCacheIgnoreZoom:!0}),null}),this.resetShouldCacheIgnoreZoomDebounced()}else Tz.lastCenter=Tz.initialDistance=Tz.initialScale=null;if(mz||hz||gz||Fs(this.state))return;let a=nM(_z,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop).isOverEither;if(!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.multiElement&&(a?Ww(this.interactiveCanvas):Yw(this.interactiveCanvas,this.state)),!this.state.newElement&&Bj(this.state.activeTool.type)){let{originOffset:t,snapLines:i}=zj(this.scene.getNonDeletedElements(),this,{x:n,y:r},e,this.scene.getNonDeletedElementsMap());this.setState(e=>{let n=tr(e.snapLines,i),r=e.originSnapOffset?tr(e.originSnapOffset,t):t;return e.snapLines===n&&e.originSnapOffset===r?null:{snapLines:n,originSnapOffset:r}})}else !this.state.newElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.selectionElement&&this.setState(e=>e.snapLines.length?{snapLines:[]}:null);if(this.state.selectedLinearElement?.isEditing&&!this.state.selectedLinearElement.isDragging){let t=this.state.newElement?null:I.handlePointerMoveInEditMode(e,n,r,this);t&&t!==this.state.selectedLinearElement&&(0,_c.flushSync)(()=>{this.setState({selectedLinearElement:t})})}if(Et(this.state.activeTool.type)){let{newElement:e}=this.state;if(!e&&xs(this.state)){let e=O(n,r),t=this.scene.getNonDeletedElementsMap(),i=go(e,this.scene.getNonDeletedElements(),t,ii(this.state.zoom));i?this.setState({suggestedBinding:{element:i,midPoint:T(e,i,t,this.state.zoom)}}):this.state.suggestedBinding&&this.setState({suggestedBinding:null})}}if(this.state.multiElement&&this.state.selectedLinearElement){let{multiElement:t,selectedLinearElement:i}=this.state,{x:a,y:o,points:s}=t,c=s[s.length-1],{lastCommittedPoint:l}=i;if(Yw(this.interactiveCanvas,this.state),c===l)jt(this.state.newElement)&&xs(this.state)&&go(O(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),ii(this.state.zoom))?(this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n,y:r}}),this.setState({suggestedBinding:null,startBoundElement:null}),this.state.activeTool.locked||(Ww(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:P({...e.selectedElementIds,[t.id]:!0},e),selectedLinearElement:new I(t,this.scene.getNonDeletedElementsMap())})))):Se(O(n-a,r-o),c)>=8?(this.scene.mutateElement(t,{points:[...s,O(n-a,r-o)]},{informMutation:!1,isDragging:!1}),gt(this.state.selectedLinearElement?.initialState,`initialState must be set`),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:s[s.length-1],selectedPointsIndices:[t.points.length-1],initialState:{...this.state.selectedLinearElement.initialState,lastClickedPoint:t.points.length-1}}})):Gw(this.interactiveCanvas,Kn.POINTER);else if(s.length>2&&l&&Se(O(n-a,r-o),l)<8)Gw(this.interactiveCanvas,Kn.POINTER),this.scene.mutateElement(t,{points:s.slice(0,-1)},{informMutation:!1,isDragging:!1}),this.setState({selectedLinearElement:{...i,selectedPointsIndices:i.selectedPointsIndices?.includes(t.points.length)?[...i.selectedPointsIndices.filter(e=>e!==t.points.length&&e!==t.points.length-1),t.points.length-1]:i.selectedPointsIndices,lastCommittedPoint:t.points[t.points.length-1],initialState:{...i.initialState,lastClickedPoint:t.points.length-1}}});else{ra(s,this.state.zoom.value)&&Gw(this.interactiveCanvas,Kn.POINTER);let i=this.scene.getNonDeletedElementsMap();if(Ti(t)){let e=go(O(n,r),this.scene.getNonDeletedElements(),i);Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(t,e)}gt(this.state.selectedLinearElement,`Expected selectedLinearElement to be set to operate on a linear element`);let a=I.handlePointerMove(e.nativeEvent,this,n,r,this.state.selectedLinearElement);a&&this.setState(a)}return}if(this.state.activeTool.type===`arrow`){let e=go(O(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),ii(this.state.zoom)),t=O(n,r),i=this.scene.getNonDeletedElementsMap();e&&!fs(t,e,i)&&this.setState({suggestedBinding:{element:e,midPoint:T(t,e,i,this.state.zoom)}})}let o=!!e.buttons,s=this.state.activeTool.type===`laser`;if(o||!s&&this.state.activeTool.type!==`selection`&&this.state.activeTool.type!==`lasso`&&this.state.activeTool.type!==`text`&&this.state.activeTool.type!==`eraser`)return;let c=this.scene.getNonDeletedElements(),l=this.scene.getSelectedElements(this.state);if(l.length===1&&!a&&!this.state.selectedLinearElement?.isEditing){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r),(!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1)&&this.state.openDialog?.name!==`elementLinkSelector`&&!(l.length===1&&dr(l[0]))&&!(b(l[0])&&(this.editorInterface.userAgent.isMobileDevice||l[0].points.length===2))){let t=vs(c,this.state,n,r,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);if(t&&t.transformHandleType){Gw(this.interactiveCanvas,vo(t));return}}}else if(l.length>1&&!a&&this.state.openDialog?.name!==`elementLinkSelector`){let t=Qs(Ii(l),n,r,this.state.zoom,e.pointerType,this.editorInterface);if(t){Gw(this.interactiveCanvas,vo({transformHandleType:t}));return}}if(zr(this.state))return;let u=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),d=null;if(d=u&&u.locked?null:u,this.handleIframeLikeElementHover({hitElement:d,scenePointer:t,moveEvent:e})||(this.hitLinkElement=this.getElementLinkAtPosition(t,u)),this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id])Gw(this.interactiveCanvas,Kn.POINTER),GE(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap());else{if(qE(),s)return;d&&(d.link||rs(d))&&this.state.selectedElementIds[d.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:`info`}):this.state.activeTool.type===`text`?Gw(this.interactiveCanvas,M(d)?Kn.TEXT:Kn.CROSSHAIR):this.state.viewModeEnabled?Gw(this.interactiveCanvas,Kn.GRAB):this.state.openDialog?.name===`elementLinkSelector`||a||e[N.CTRL_OR_CMD]?Gw(this.interactiveCanvas,Kn.AUTO):(d||this.isHittingCommonBoundingBoxOfSelectedElements(t,l))&&!d?.locked&&(!d||!dr(d)||!(d.startBinding||d.endBinding))&&(this.state.activeTool.type!==`lasso`||l.length>0)&&Gw(this.interactiveCanvas,Kn.MOVE),this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r)}this.state.openDialog?.name===`elementLinkSelector`&&d?this.setState(e=>({hoveredElementIds:tr(e.hoveredElementIds,Hr({editingGroupId:e.editingGroupId,selectedElementIds:{[d.id]:!0}},this.scene.getNonDeletedElements(),e,this).selectedElementIds)})):this.state.openDialog?.name===`elementLinkSelector`&&!d&&this.setState(e=>({hoveredElementIds:tr(e.hoveredElementIds,{})}))}),i(this,`handleEraser`,(e,t)=>{let n=this.eraserTrail.addPointToPath(t.x,t.y,e.altKey);this.elementsPendingErasure=new Set(n),this.triggerRender()}),i(this,`handleTouchMove`,e=>{yz=!0}),i(this,`handleCanvasPointerDown`,e=>{if(!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let{x:t,y:n}=la(e,this.state);this.lastPointerMoveCoords={x:t,y:n};let r=e.target;if(r.setPointerCapture&&r.setPointerCapture(e.pointerId),this.maybeCleanupAfterMissingPointerUp(e.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.searchMatches&&(this.setState(e=>({searchMatches:e.searchMatches&&{focusedId:null,matches:e.searchMatches.matches.map(e=>({...e,focus:!1}))}})),this.updateEditorAtom(BP,null)),Cy.get(sD)&&this.updateEditorAtom(sD,null),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.state.openPopup&&this.setState({openPopup:null}),this.updateGestureOnPointerDown(e),e.pointerType===`touch`&&this.state.newElement&&this.state.newElement.type===`freedraw`){let e=this.state.newElement;this.updateScene({...e.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(t=>t.id!==e.id)}:{},appState:{newElement:null,editingTextElement:null,startBoundElement:null,suggestedBinding:null,selectedElementIds:P(Object.keys(this.state.selectedElementIds).filter(t=>t!==e.id).reduce((e,t)=>(e[t]=this.state.selectedElementIds[t],e),{}),this.state)},captureUpdate:this.state.openDialog?.name===`elementLinkSelector`?V.EVENTUALLY:V.NEVER});return}let i=document.getSelection();if(i?.anchorNode&&i.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(e),!this.state.penDetected&&e.pointerType===`pen`&&this.setState(e=>({penMode:!0,penDetected:!0})),!this.editorInterface.isTouchScreen&&[`pen`,`touch`].includes(e.pointerType)&&(this.editorInterface=Jr(this.editorInterface,{isTouchScreen:!0})),hz||(this.lastPointerDownEvent=e,this.handleCanvasPanUsingWheelOrSpaceDrag(e)))return;if(this.setState({lastPointerDownWith:e.pointerType,cursorButton:`down`}),this.savePointer(e.clientX,e.clientY,`down`),e.button===dn.ERASER&&this.state.activeTool.type!==va.eraser){this.setState({activeTool:ka(this.state,{type:va.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(e);let t=()=>{n(),r?.(),zr(this.state)&&this.setState({activeTool:ka(this.state,{...this.state.activeTool.lastActiveTool||{type:va.selection},lastActiveToolBeforeEraser:null})})},n=w(window,F.POINTER_UP,t,{once:!0}),r;requestAnimationFrame(()=>{r=this.missingPointerEventCleanupEmitter.once(t)})});return}if(e.button!==dn.MAIN&&e.button!==dn.TOUCH&&e.button!==dn.ERASER||Tz.pointers.size>1)return;let a=this.initialPointerDownState(e);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleDraggingScrollBar(e,a)||(this.clearSelectionIfNotUsingSelection(),this.handleSelectionOnPointerDown(e,a))||!(!this.state.penMode||e.pointerType!==`touch`||this.state.activeTool.type===`selection`||this.state.activeTool.type===`lasso`||this.state.activeTool.type===`text`||this.state.activeTool.type===`image`))return;if(this.state.activeTool.type===`lasso`){let t=a.hit.element&&this.isASelectedElement(a.hit.element);!a.hit.hasHitCommonBoundingBoxOfSelectedElements&&!a.resize.handleType&&!t&&(this.lassoTrail.startPath(a.origin.x,a.origin.y,e.shiftKey),a.drag.blockDragging=this.editorInterface.formFactor===`desktop`),this.editorInterface.formFactor!==`desktop`&&a.hit.element&&!t&&(this.setState(e=>{let t={...e.selectedElementIds,[a.hit.element.id]:!0},n=[];Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)});let r=a.hit.element;if(L(r))Di(n,r.id).forEach(e=>{delete t[e.id]});else if(r.frameId)t[r.frameId]&&delete t[r.id];else{let e=r.groupIds,i=new Set(e.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).filter(e=>L(e)).map(e=>e.id));i.size>0&&n.forEach(e=>{e.frameId&&i.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:r.link||rs(r)?`info`:!1}}),a.hit.wasAddedToSelection=!0)}else this.state.activeTool.type===`text`?this.handleTextOnPointerDown(e,a):this.state.activeTool.type===`arrow`||this.state.activeTool.type===`line`?this.handleLinearElementOnPointerDown(e,this.state.activeTool.type,a):this.state.activeTool.type===`freedraw`?this.handleFreeDrawElementOnPointerDown(e,this.state.activeTool.type,a):this.state.activeTool.type===`custom`?Yw(this.interactiveCanvas,this.state):this.state.activeTool.type===va.frame||this.state.activeTool.type===va.magicframe?this.createFrameElementOnPointerDown(a,this.state.activeTool.type):this.state.activeTool.type===`laser`?this.laserTrails.startPath(a.lastCoords.x,a.lastCoords.y):this.state.activeTool.type!==`eraser`&&this.state.activeTool.type!==`hand`&&this.state.activeTool.type!==`image`&&this.createGenericElementOnPointerDown(this.state.activeTool.type,a);this.props?.onPointerDown?.(this.state.activeTool,a),this.onPointerDownEmitter.trigger(this.state.activeTool,a,e),this.state.activeTool.type===`eraser`&&this.eraserTrail.startPath(a.lastCoords.x,a.lastCoords.y);let o=this.onPointerMoveFromPointerDownHandler(a),s=this.onPointerUpFromPointerDownHandler(a),c=this.onKeyDownFromPointerDownHandler(a),l=this.onKeyUpFromPointerDownHandler(a);this.missingPointerEventCleanupEmitter.once(t=>s(t||e.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type===`laser`)&&(window.addEventListener(F.POINTER_MOVE,o),window.addEventListener(F.POINTER_UP,s),window.addEventListener(F.KEYDOWN,c),window.addEventListener(F.KEYUP,l),a.eventListeners.onMove=o,a.eventListeners.onUp=s,a.eventListeners.onKeyUp=l,a.eventListeners.onKeyDown=c)}),i(this,`handleCanvasPointerUp`,e=>{if(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.removePointer(e),this.lastPointerUpEvent=e,!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let t=la({clientX:e.clientX,clientY:e.clientY},this.state),{x:n,y:r}=t;if(this.lastPointerMoveCoords={x:n,y:r},!this.handleIframeLikeCenterClick()){if(this.editorInterface.isTouchScreen){let e=this.getElementAtPosition(t.x,t.y,{includeLockedElements:!0});this.hitLinkElement=this.getElementLinkAtPosition(t,e)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?this.handleElementLinkClick(e):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})}}),i(this,`maybeOpenContextMenuAfterPointerDownOnTouchDevices`,e=>{e.pointerType===`touch`&&(yz=!1,vz?yz=!0:vz=window.setTimeout(()=>{vz=0,yz||this.handleCanvasContextMenu(e)},500))}),i(this,`resetContextMenuTimer`,()=>{clearTimeout(vz),vz=0,yz=!1}),i(this,`maybeCleanupAfterMissingPointerUp`,e=>{wz?.(),this.missingPointerEventCleanupEmitter.trigger(e).clear()}),i(this,`handleCanvasPanUsingWheelOrSpaceDrag`,e=>{if(!(Tz.pointers.size<=1&&(e.button===dn.WHEEL||e.button===dn.MAIN&&mz||Fs(this.state)||this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`)))return!1;hz=!0,this.focusContainer(),this.state.editingTextElement||e.preventDefault();let t=!1,n=/Linux/.test(window.navigator.platform);Gw(this.interactiveCanvas,Kn.GRABBING);let{clientX:r,clientY:i}=e,a=Jj(e=>{let a=r-e.clientX,o=i-e.clientY;if(r=e.clientX,i=e.clientY,n&&!t&&(Math.abs(a)>1||Math.abs(o)>1)){t=!0;let e=t=>{document.body.removeEventListener(F.PASTE,e),t.stopPropagation()},n=()=>{setTimeout(()=>{document.body.removeEventListener(F.PASTE,e),window.removeEventListener(F.POINTER_UP,n)},100)};document.body.addEventListener(F.PASTE,e),window.addEventListener(F.POINTER_UP,n)}this.translateCanvas({scrollX:this.state.scrollX-a/this.state.zoom.value,scrollY:this.state.scrollY-o/this.state.zoom.value})}),o=qj(wz=()=>{wz=null,hz=!1,mz||(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`?Gw(this.interactiveCanvas,Kn.GRAB):Yw(this.interactiveCanvas,this.state)),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(F.POINTER_MOVE,a),window.removeEventListener(F.POINTER_UP,o),window.removeEventListener(F.BLUR,o),a.flush()});return window.addEventListener(F.BLUR,o),window.addEventListener(F.POINTER_MOVE,a,{passive:!0}),window.addEventListener(F.POINTER_UP,o),!0}),i(this,`clearSelectionIfNotUsingSelection`,()=>{Vr(this.state.activeTool.type)||this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}),i(this,`handleSelectionOnPointerDown`,(e,t)=>{if(Vr(this.state.activeTool.type)){let n=this.scene.getNonDeletedElements(),r=this.scene.getNonDeletedElementsMap(),i=this.scene.getSelectedElements(this.state);if(i.length===1&&!this.state.selectedLinearElement?.isEditing&&!dr(i[0])&&!(b(i[0])&&(this.editorInterface.userAgent.isMobileDevice||i[0].points.length===2))&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let r=vs(n,this.state,t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);r!=null&&(r.transformHandleType===`rotation`?(this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType):(this.state.croppingElementId||this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType))}else i.length>1&&(t.resize.handleType=Qs(Ii(i),t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.editorInterface));if(t.resize.handleType)t.resize.isResizing=!0,t.resize.offset=pt(ls(t.resize.handleType,i,r,t.origin.x,t.origin.y)),i.length===1&&b(i[0])&&i[0].points.length===2&&(t.resize.arrowDirection=ai(t.resize.handleType,i[0]));else{if(this.state.selectedLinearElement){let n=this.state.selectedLinearElement,r=I.handlePointerDown(e,this,this.store,t.origin,n,this.scene);if(r.hitElement&&(t.hit.element=r.hitElement),r.linearElementEditor&&this.setState({selectedLinearElement:r.linearElementEditor}),r.didAddPoint)return!0;let i=this.scene.getNonDeletedElementsMap(),a=I.getElement(n.elementId,i);if(a&&ss(a)){let{hitFocusPoint:e,pointerOffset:r}=Uo(a,t,i,this.state);if(e)return this.setState({selectedLinearElement:{...n,hoveredFocusPointBinding:e,draggedFocusPointBinding:e,pointerOffset:r}}),!1}}let n=this.getElementsAtPosition(t.origin.x,t.origin.y,{includeLockedElements:!0}),r=n.filter(e=>!e.locked),i=this.getElementAtPosition(t.origin.x,t.origin.y,{allHitElements:n});if((!i||i.id!==this.state.activeLockedId)&&this.setState({activeLockedId:null}),i&&i.locked&&!r.some(e=>this.state.selectedElementIds[e.id])?t.hit.element=null:t.hit.element=t.hit.element??this.getElementAtPosition(t.origin.x,t.origin.y),this.hitLinkElement=this.getElementLinkAtPosition(t.origin,i),this.hitLinkElement)return!0;if(this.state.croppingElementId&&t.hit.element?.id!==this.state.croppingElementId&&this.finishImageCropping(),t.hit.element&&this.getElementLinkAtPosition({x:t.origin.x,y:t.origin.y},t.hit.element))return!1;t.hit.allHitElements=r;let a=t.hit.element,o=t.hit.allHitElements.some(e=>this.isASelectedElement(e));if((a===null||!o)&&!e.shiftKey&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(!this.state.selectedLinearElement?.isEditing||a&&a?.id!==this.state.selectedLinearElement?.elementId)&&this.clearSelection(a),this.state.selectedLinearElement?.isEditing)this.setState(e=>({selectedLinearElement:e.selectedLinearElement?{...e.selectedLinearElement,isEditing:!!a&&a.id===this.state.selectedLinearElement?.elementId}:null,selectedElementIds:e.selectedLinearElement?P({[e.selectedLinearElement.elementId]:!0},this.state):P({},e)}));else if(a!=null){if(e[N.CTRL_OR_CMD])return e.altKey?(this.state.openDialog?.name===`elementLinkSelector`&&this.setOpenDialog(null),this.lassoTrail.startPath(t.origin.x,t.origin.y,e.shiftKey),this.setActiveTool({type:`lasso`,fromSelection:!0}),!1):(this.state.selectedElementIds[a.id]||(t.hit.wasAddedToSelection=!0),this.setState(e=>({...Ut(e,a),previousSelectedElementIds:this.state.selectedElementIds})),!1);this.state.selectedElementIds[a.id]||(this.state.editingGroupId&&!Lo(a,this.state.editingGroupId)&&this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!o&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(e=>{let t={...e.selectedElementIds,[a.id]:!0},n=[];if(Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)}),L(a))Di(n,a.id).forEach(e=>{delete t[e.id]});else if(a.frameId)t[a.frameId]&&delete t[a.id];else{let e=a.groupIds,r=new Set(e.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).filter(e=>L(e)).map(e=>e.id));r.size>0&&n.forEach(e=>{e.frameId&&r.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return e.openDialog?.name===`elementLinkSelector`&&(a.groupIds.some(t=>e.selectedGroupIds[t])||(t={[a.id]:!0})),{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:a.link||rs(a)?`info`:!1}}),t.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1}),i(this,`handleTextOnPointerDown`,(e,t)=>{if(this.state.editingTextElement)return;let n=t.origin.x,r=t.origin.y,i=this.getElementAtPosition(n,r,{includeBoundTextElement:!0}),a=this.getTextBindableContainerAtPosition(n,r);xr(i)&&(a=i,n=i.x+i.width/2,r=i.y+i.height/2),this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:a,autoEdit:!1}),Ww(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})})}),i(this,`handleFreeDrawElementOnPointerDown`,(e,t,n)=>{let[r,i]=It(n.origin.x,n.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),o=e.pressure===.5,s=St({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:o,locked:!1,frameId:a?a.id:null,points:[O(0,0)],pressures:o?[]:[e.pressure]});this.scene.insertElement(s),this.setState(e=>{let t={...e.selectedElementIds};return delete t[s.id],{selectedElementIds:P(t,e)}});let c=go(O(n.origin.x,n.origin.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());this.setState({newElement:s,startBoundElement:c,suggestedBinding:null})}),i(this,`insertIframeElement`,({sceneX:e,sceneY:t,width:n,height:r})=>{let[i,a]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=jr({type:`iframe`,x:i,y:a,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`iframe`),opacity:this.state.currentItemOpacity,locked:!1,width:n,height:r});return this.scene.insertElement(o),o}),i(this,`insertEmbeddableElement`,({sceneX:e,sceneY:t,link:n})=>{let[r,i]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=qs(n);if(!a)return;a.error instanceof URIError&&this.setToast({message:K(`toast.unrecognizedLinkFormat`),closable:!0});let o=ga({type:`embeddable`,x:r,y:i,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`embeddable`),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:n});return this.scene.insertElement(o),o}),i(this,`newImagePlaceholder`,({sceneX:e,sceneY:t,addToFrameUnderCursor:n=!0})=>{let[r,i]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=n?this.getTopLayerFrameAtSceneCoords({x:r,y:i}):null,o=100/this.state.zoom.value;return gi({type:`image`,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:a?a.id:null,x:r-o/2,y:i-o/2,width:o,height:o})}),i(this,`handleLinearElementOnPointerDown`,(e,t,n)=>{if(e.ctrlKey&&(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),this.state.multiElement){let{multiElement:t,selectedLinearElement:r}=this.state;if(gt(r,`selectedLinearElement is expected to be set`),t.type===`line`&&ra(t.points,this.state.zoom.value)){(0,_c.flushSync)(()=>{this.setState({selectedLinearElement:{...r,lastCommittedPoint:t.points[t.points.length-1],initialState:{...r.initialState,lastClickedPoint:-1}}})}),this.actionManager.executeAction(oT);return}if(dr(t)&&t.points.length>1){this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}let{x:i,y:a}=t,{lastCommittedPoint:o}=r,s=xs(this.state)&&go(O(this.lastPointerMoveCoords?.x??i+t.points[t.points.length-1][0],this.lastPointerMoveCoords?.y??a+t.points[t.points.length-1][1]),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(ss(t)&&s||t.points.length>1&&o&&Se(O(n.origin.x-i,n.origin.y-a),o)<8){this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[t.id]:!0},e)})),Gw(this.interactiveCanvas,Kn.POINTER)}else{let[r,i]=It(n.origin.x,n.origin.y,e[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),{currentItemStartArrowhead:o,currentItemEndArrowhead:s}=this.state,[c,l]=t===`arrow`?[o,s]:[null,null],u=t===`arrow`?or({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemArrowType===ts.round?{type:Xa.PROPORTIONAL_RADIUS}:null,startArrowhead:c,endArrowhead:l,locked:!1,frameId:a?a.id:null,elbowed:this.state.currentItemArrowType===ts.elbow,fixedSegments:this.state.currentItemArrowType===ts.elbow?[]:null}):Tn({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness===`round`?{type:Xa.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:a?a.id:null}),d=O(n.origin.x,n.origin.y),f=this.scene.getNonDeletedElementsMap(),p=xs(this.state)?go(d,this.scene.getNonDeletedElements(),f):null;this.scene.mutateElement(u,{points:[O(0,0),O(0,0)]}),this.scene.insertElement(u),ss(u)&&Ur(u,new Map([[0,{point:O(0,0),isDragging:!1}]]),d[0],d[1],this.scene,this.state,{newArrow:!0,altKey:e.altKey,initialBinding:!0,angleLocked:mr(e.nativeEvent)}),(0,_c.flushSync)(()=>{this.setState(t=>{let r=null,i=t.selectedElementIds;if(b(u)){r=new I(u,this.scene.getNonDeletedElementsMap());let t=u.points.length-1;r={...r,selectedPointsIndices:[t],initialState:{...r.initialState,arrowStartIsInside:e.altKey,lastClickedPoint:t,origin:O(n.origin.x,n.origin.y)}}}return i=this.state.activeTool.locked?t.selectedElementIds:P({[u.id]:!0},t),{...t,bindMode:`orbit`,newElement:u,startBoundElement:p,suggestedBinding:p&&ss(u)?{element:p,midPoint:T(d,p,f,this.state.zoom)}:null,selectedElementIds:i,selectedLinearElement:r}})}),ss(u)&&Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(u,p)}}),i(this,`createGenericElementOnPointerDown`,(e,t)=>{let[n,r]=It(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.getTopLayerFrameAtSceneCoords({x:n,y:r}),a={x:n,y:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(e),locked:!1,frameId:i?i.id:null},o;o=e===`embeddable`?ga({type:`embeddable`,...a}):cn({type:e,...a}),o.type===`selection`?this.setState({selectionElement:o}):(this.scene.insertElement(o),this.setState({multiElement:null,newElement:o}))}),i(this,`createFrameElementOnPointerDown`,(e,t)=>{let[n,r]=It(e.origin.x,e.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i={x:n,y:r,opacity:this.state.currentItemOpacity,locked:!1,...On},a=t===va.magicframe?Pn(i):Ds(i);this.scene.insertElement(a),this.setState({multiElement:null,newElement:a})}),i(this,`restoreReadyToEraseElements`,()=>{this.elementsPendingErasure=new Set,this.triggerRender()}),i(this,`eraseElements`,()=>{let e=!1;this.elementsPendingErasure.forEach(e=>{let t=this.scene.getElement(e);if(ss(t)){if(t.startBinding){let e=this.scene.getElement(t.startBinding.elementId);jn(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}if(t.endBinding){let e=this.scene.getElement(t.endBinding.elementId);jn(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}}else un(t)&&t.boundElements?.forEach(e=>{if(e.type===`arrow`){let n=this.scene.getElement(e.id);n?.startBinding?.elementId===t.id&&jn(n,this.scene.getElementsMapIncludingDeleted(),{startBinding:null}),n?.endBinding?.elementId===t.id&&jn(n,this.scene.getElementsMapIncludingDeleted(),{endBinding:null})}})});let t=this.scene.getElementsIncludingDeleted().map(t=>this.elementsPendingErasure.has(t.id)||t.frameId&&this.elementsPendingErasure.has(t.frameId)||ya(t)&&this.elementsPendingErasure.has(t.containerId)?(e=!0,B(t,{isDeleted:!0})):t);this.elementsPendingErasure=new Set,e&&(this.store.scheduleCapture(),this.scene.replaceAllElements(t))}),i(this,`initializeImage`,async(e,t)=>{if(!xo(t))throw Error(K(`errors.unsupportedFileType`));let n=t.type;if(Gw(this.interactiveCanvas,`wait`),n===hs.svg)try{t=Xi(ae(await t.text()),t.name)}catch(e){throw console.warn(e),Error(K(`errors.svgImageInsertError`))}let r=await(this.props.generateIdForFile?.(t)||xn(t));if(!r)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),Error(K(`errors.imageInsertError`));if(!this.files[r]?.dataURL){try{t=await Bt(t,{maxWidthOrHeight:Eo})}catch(e){console.error(`Error trying to resizing image file on insertion`,e)}if(t.size>4194304)throw Error(K(`errors.fileTooBig`,{maxSize:`${Math.trunc(br/1024/1024)}MB`}))}let i=this.files[r]?.dataURL||await ia(t);return new Promise(async(t,a)=>{try{let a=this.getLatestInitializedImageElement(e,r);if(this.addMissingFiles([{mimeType:n,id:r,dataURL:i,created:Date.now(),lastRetrieved:Date.now()}]),!this.imageCache.get(r)){this.addNewImagesToImageCache();let{erroredFiles:e}=await this.updateImageCache([a]);if(e.size)throw Error(`Image cache update resulted with an error.`)}let o=await this.imageCache.get(r)?.image;if(o&&this.state.newElement?.id!==a.id){a=this.getLatestInitializedImageElement(e,r);let t=this.getImageNaturalDimensions(a,o);Object.assign(a,t)}t(a)}catch(e){console.error(e),a(Error(K(`errors.imageInsertError`)))}})}),i(this,`getLatestInitializedImageElement`,(e,t)=>B(this.scene.getElement(e.id)??e,{fileId:t})),i(this,`onImageToolbarButtonClick`,async()=>{try{let{x:e,y:t}=la({clientX:this.state.width/2+this.state.offsetLeft,clientY:this.state.height/2+this.state.offsetTop},this.state),n=await Wo({description:`Image`,extensions:Object.keys(Da),multiple:!0});this.insertImages(n,e,t)}catch(e){e.name===`AbortError`?console.warn(e):console.error(e),this.setState({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})},()=>{this.actionManager.executeAction(oT)})}}),i(this,`getImageNaturalDimensions`,(e,t)=>{let n=Math.max(this.state.height-120,160),r=Math.min(n,Math.floor(this.state.height*.5)/this.state.zoom.value),i=Math.min(t.naturalHeight,r),a=i*(t.naturalWidth/t.naturalHeight);return{x:e.x+e.width/2-a/2,y:e.y+e.height/2-i/2,width:a,height:i,crop:null}}),i(this,`updateImageCache`,async(e,t=this.files)=>{let{updatedFiles:n,erroredFiles:r}=await at({imageCache:this.imageCache,fileIds:e.map(e=>e.fileId),files:t});return r.size&&(this.store.scheduleAction(V.NEVER),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(e=>d(e)&&r.has(e.fileId)?B(e,{status:`error`}):e))),{updatedFiles:n,erroredFiles:r}}),i(this,`addNewImagesToImageCache`,async(e=qe(this.scene.getNonDeletedElements()),t=this.files)=>{let n=e.filter(e=>!e.isDeleted&&!this.imageCache.has(e.fileId));if(n.length){let{updatedFiles:e}=await this.updateImageCache(n,t);if(e.size)for(let t of n)e.has(t.fileId)&&bn.delete(t);e.size&&this.scene.triggerUpdate()}}),i(this,`scheduleImageRefresh`,(0,gc.default)(()=>{this.addNewImagesToImageCache()},500)),i(this,`handleInteractiveCanvasRef`,e=>{e===null?(this.interactiveCanvas?.removeEventListener(F.TOUCH_START,this.onTouchStart),this.interactiveCanvas?.removeEventListener(F.TOUCH_END,this.onTouchEnd)):(this.interactiveCanvas=e,this.interactiveCanvas.addEventListener(F.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(F.TOUCH_END,this.onTouchEnd))}),i(this,`insertImages`,async(e,t,n)=>{let r=50/this.state.zoom.value,i=Gr(e.map(()=>this.newImagePlaceholder({sceneX:t,sceneY:n})),t,n,r);i.forEach(e=>this.scene.insertElement(e));let a=await Promise.all(i.map(async(t,n)=>{try{return await this.initializeImage(t,await z(e[n]))}catch(e){return this.setState({errorMessage:e.message||K(`errors.imageInsertError`)}),B(t,{isDeleted:!0})}})),o=lr(a),s=Gr(a.filter(e=>!e.isDeleted),t,n,r),c=lr(s),l=this.scene.getElementsIncludingDeleted().map(e=>c.get(e.id)??o.get(e.id)??e);this.updateScene({appState:{selectedElementIds:P(Object.fromEntries(s.map(e=>[e.id,!0])),this.state)},elements:l,captureUpdate:V.IMMEDIATELY}),this.setState({},()=>{this.actionManager.executeAction(oT)})}),i(this,`handleAppOnDrop`,async e=>{let{x:t,y:n}=la(e,this.state),r=await DT(e),i=r.getFiles();if(i.length===1){let{file:e,fileHandle:t}=i[0];if(e&&(e.type===hs.png||e.type===hs.svg))try{let n=await $o(e,this.state,this.scene.getElementsIncludingDeleted(),t);this.syncActionResult({...n,appState:{...n.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:V.IMMEDIATELY});return}catch(e){if(e.name!==`EncodingError`)throw Error(K(`alerts.couldNotLoadInvalidFile`))}}let a=i.map(e=>e.file).filter(e=>xo(e));if(a.length>0&&this.isToolSupported(`image`))return this.insertImages(a,t,n);let o=r.getData(hs.excalidrawlibIds),s=r.getData(hs.excalidrawlib);if(o||s){try{let t=null;if(o){let{itemIds:e}=JSON.parse(o);t=(await this.library.getLatestLibrary()).filter(t=>e.includes(t.id))}else s&&(t=li(s));t?.length&&(t=t.map(e=>({...e,elements:Er({type:`everything`,elements:e.elements,randomizeSeed:!0}).duplicatedElements})),this.addElementsFromPasteOrLibrary({elements:QD(t),position:e,files:null}))}catch(e){this.setState({errorMessage:e.message})}return}if(i.length>0){let{file:e,fileHandle:t}=i[0];e&&await this.loadFileToCanvas(e,t)}let c=r.findByType(hs.text);if(c){let e=c.value;if(e&&Lt(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||qs(e)?.type===`video`)){let r=this.insertEmbeddableElement({sceneX:t,sceneY:n,link:Hs(e)});r&&(this.store.scheduleCapture(),this.setState({selectedElementIds:{[r.id]:!0}}))}}}),i(this,`loadFileToCanvas`,async(e,t)=>{e=await z(e);try{let n=this.scene.getElementsIncludingDeleted(),r;try{r=await Es(e,this.state,n,t)}catch(e){let t=e instanceof rn;if(t&&e.code===`IMAGE_NOT_CONTAINS_SCENE_DATA`&&!this.isToolSupported(`image`)){this.setState({isLoading:!1,errorMessage:K(`errors.imageToolNotSupported`)});return}let n=K(t?`alerts.cannotRestoreFromImage`:`alerts.couldNotLoadInvalidFile`);this.setState({isLoading:!1,errorMessage:n})}if(!r)return;r.type===hs.excalidraw?(ho(n.concat(r.data.elements)),this.store.scheduleMicroAction({action:V.NEVER,elements:n,appState:void 0}),this.setState({isLoading:!0}),this.syncActionResult({...r.data,appState:{...r.data.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:V.IMMEDIATELY})):r.type===hs.excalidrawlib&&await this.library.updateLibrary({libraryItems:e,merge:!0,openLibraryMenu:!0}).catch(e=>{console.error(e),this.setState({errorMessage:K(`errors.importLibraryError`)})})}catch(e){this.setState({isLoading:!1,errorMessage:e.message})}}),i(this,`handleCanvasContextMenu`,e=>{if(e.preventDefault(),(`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`touch`||`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`pen`&&e.button!==dn.SECONDARY)&&this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let{x:t,y:n}=la(e,this.state),r=this.getElementAtPosition(t,n,{preferSelected:!0,includeLockedElements:!0}),i=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:t,y:n},i),o=r||a?`element`:`canvas`,{top:s,left:c}=this.excalidrawContainerRef.current.getBoundingClientRect(),l=e.clientX-c,u=e.clientY-s;dC(`contextMenu`,`openContextMenu`,o),this.setState({...r&&!this.state.selectedElementIds[r.id]?{...this.state,...Hr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[r.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:b(r)?new I(r,this.scene.getNonDeletedElementsMap()):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:u,left:l,items:this.getContextMenuItems(o)}})})}),i(this,`maybeDragNewGenericElement`,(e,t,n=!0)=>{let r=this.state.selectionElement,i=e.lastCoords;if(r&&e.boxSelection.hasOccurred&&this.state.activeTool.type!==`eraser`){gs({newElement:r,elementType:this.state.activeTool.type,originX:e.origin.x,originY:e.origin.y,x:i.x,y:i.y,width:fr(e.origin.x,i.x),height:fr(e.origin.y,i.y),shouldMaintainAspectRatio:oa(t),shouldResizeFromCenter:!1,scene:this.scene,zoom:this.state.zoom.value,informMutation:!1});return}let a=this.state.newElement;if(!a)return;let[o,s]=It(i.x,i.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=d(a)&&this.imageCache.get(a.fileId)?.image,l=c&&!(c instanceof Promise)?c.width/c.height:null;this.maybeCacheReferenceSnapPoints(t,[a]);let{snapOffset:u,snapLines:f}=Rj(a,this,t,{x:e.originInGrid.x+(this.state.originSnapOffset?.x??0),y:e.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:o-e.originInGrid.x,y:s-e.originInGrid.y},this.scene.getNonDeletedElementsMap());o+=u.x,s+=u.y,this.setState({snapLines:f}),ss(a)||gs({newElement:a,elementType:this.state.activeTool.type,originX:e.originInGrid.x,originY:e.originInGrid.y,x:o,y:s,width:fr(e.originInGrid.x,o),height:fr(e.originInGrid.y,s),shouldMaintainAspectRatio:io(a)?!oa(t):oa(t),shouldResizeFromCenter:Ho(t),zoom:this.state.zoom.value,scene:this.scene,widthAspectRatio:l,originOffset:this.state.originSnapOffset,informMutation:n}),this.setState({newElement:a}),(this.state.activeTool.type===va.frame||this.state.activeTool.type===va.magicframe)&&this.setState({elementsToHighlight:kn(this.scene.getNonDeletedElements(),a,this.state,this.scene.getNonDeletedElementsMap())})}),i(this,`maybeHandleCrop`,(e,t)=>{if(!this.state.croppingElementId)return!1;let n=e.resize.handleType,r=e.lastCoords,[i,a]=It(r.x-e.resize.offset.x,r.y-e.resize.offset.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(n&&o&&io(o)){let s=e.originalElements.get(o.id),c=d(o)&&this.imageCache.get(o.fileId)?.image;if(s&&io(s)&&c&&!(c instanceof Promise)){let[l,u]=It(r.x,r.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),d={x:l-e.originInGrid.x,y:u-e.originInGrid.y};this.maybeCacheReferenceSnapPoints(t,[o]);let{snapOffset:f,snapLines:p}=Lj([o],[s],this,t,d,n);this.scene.mutateElement(o,Un(o,this.scene.getNonDeletedElementsMap(),n,c.naturalWidth,c.naturalHeight,i+f.x,a+f.y,t.shiftKey?s.width/s.height:void 0)),ue(o,this.scene),this.setState({isCropping:n&&n!==`rotation`,snapLines:p})}return!0}return!1}),i(this,`maybeHandleResize`,(e,t)=>{let n=this.scene.getSelectedElements(this.state),r=n.filter(e=>L(e)),i=e.resize.handleType;if(r.length>0&&i===`rotation`||n.length===1&&dr(n[0])||this.state.croppingElementId)return!1;this.setState({isResizing:i&&i!==`rotation`,isRotating:i===`rotation`,activeEmbeddable:null});let a=e.lastCoords,[o,s]=It(a.x-e.resize.offset.x,a.y-e.resize.offset.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=new Map;if(r.forEach(e=>{Di(this.scene.getNonDeletedElements(),e.id).forEach(t=>{c.set(e.id+t.id,{x:t.x-e.x,y:t.y-e.y})})}),!this.state.selectedElementsAreBeingDragged){let[r,c]=It(a.x,a.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l={x:r-e.originInGrid.x,y:c-e.originInGrid.y},u=[...e.originalElements.values()];this.maybeCacheReferenceSnapPoints(t,n);let{snapOffset:d,snapLines:f}=Lj(n,ir(u,this.state),this,t,l,i);o+=d.x,s+=d.y,this.setState({snapLines:f})}if(In(e.originalElements,i,n,this.scene,mr(t),Ho(t),n.some(e=>io(e))?!oa(t):oa(t),o,s,e.resize.center.x,e.resize.center.y)){let e=new Set;return r.forEach(t=>{kn(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()).forEach(t=>e.add(t))}),this.setState({elementsToHighlight:[...e]}),!0}return!1}),i(this,`getContextMenuItems`,e=>{let t=[];if(t.push(xE,bE),e===`canvas`)return this.state.viewModeEnabled?[...t,CE,wE,yk,OE]:[vE,bN,xE,bE,SE,bN,cC,QE,bN,CE,TE,EE,DE,wE,yk,OE];if(t.push(SE),this.state.viewModeEnabled)return[_E,...t];let n=this.editorInterface.formFactor===`desktop`?[bN,iC,aC,oC,sC]:[];return[bN,yE,_E,vE,bN,ej,tj,nj,bN,QA,bN,...t,bN,YT,XT,bN,eE,uj,kE,AE,NE,tE,bN,cE,...n,bN,pE,mE,bN,XA,bN,YE,AD,bN,lC,ZE,bN,rC]}),i(this,`handleWheel`,qj(e=>{if(!(e.target instanceof HTMLCanvasElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLIFrameElement||e.target instanceof HTMLElement&&e.target.classList.contains(Qn.FRAME_NAME))){e[N.CTRL_OR_CMD]&&e.preventDefault();return}if(e.preventDefault(),hz)return;let{deltaX:t,deltaY:n}=e;if(e.metaKey||e.ctrlKey){let e=Math.sign(n),t=qi*100,r=Math.abs(n),i=n;r>t&&(i=t*e);let a=this.state.zoom.value-i/100;a+=Math.log10(Math.max(1,this.state.zoom.value))*-e*Math.min(1,r/20),this.translateCanvas(e=>({...Xw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:_i(a)},e),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(e.shiftKey){this.translateCanvas(({zoom:e,scrollX:r})=>({scrollX:r-(n||t)/e.value}));return}this.translateCanvas(({zoom:e,scrollX:r,scrollY:i})=>({scrollX:r-t/e.value,scrollY:i-n/e.value}))})),i(this,`savePointer`,(e,t,n)=>{if(!e||!t)return;let{x:r,y:i}=la({clientX:e,clientY:t},this.state),a={x:r,y:i,tool:this.state.activeTool.type===`laser`?`laser`:`pointer`};this.props.onPointerUpdate?.({pointer:a,button:n,pointersMap:Tz.pointers})}),i(this,`resetShouldCacheIgnoreZoomDebounced`,wt(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300)),i(this,`updateDOMRect`,e=>{if(this.excalidrawContainerRef?.current){let{width:t,height:n,left:r,top:i}=this.excalidrawContainerRef.current.getBoundingClientRect(),{width:a,height:o,offsetTop:s,offsetLeft:c}=this.state;if(t===a&&n===o&&r===c&&i===s){e&&e();return}this.setState({width:t,height:n,offsetLeft:r,offsetTop:i},()=>{e&&e()})}}),i(this,`refresh`,()=>{this.setState({...this.getCanvasOffsets()})}),i(this,`watchState`,()=>{});let n=cs(),{viewModeEnabled:r=!1,zenModeEnabled:a=!1,gridModeEnabled:o=!1,objectsSnapModeEnabled:s=!1,theme:c=n.theme,name:l=`${K(`labels.untitled`)}-${Fn()}`}=t;this.state={...n,theme:c,exportWithDarkMode:c===R.DARK,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:r,zenModeEnabled:a,objectsSnapModeEnabled:s,gridModeEnabled:o??n.gridModeEnabled,name:l,width:window.innerWidth,height:window.innerHeight},this.refreshEditorInterface(),this.stylesPanelMode=Ka(this.editorInterface),this.id=Ca(),this.library=new ZD(this),this.actionManager=new fj(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new Dn,this.canvas=document.createElement(`canvas`),this.rc=Fo.canvas(this.canvas),this.renderer=new Vj(this.scene),this.visibleElements=[],this.store=new zo(this),this.history=new aj(this.store),this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new de(this.scene),this.history=new aj(this.store),this.actionManager.registerAll(eC),this.actionManager.registerAction(cj(this.history)),this.actionManager.registerAction(lj(this.history)),this.api=this.createExcalidrawAPI()}createExcalidrawAPI(){return{isDestroyed:!1,updateScene:this.updateScene,applyDeltas:this.applyDeltas,mutateElement:this.mutateElement,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,getSceneElementsMapIncludingDeleted:this.getSceneElementsMapIncludingDeleted,history:{clear:this.resetHistory},scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:e=>{this.actionManager.registerAction(e)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,getEditorInterface:()=>this.editorInterface,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:e=>this.onChangeEmitter.on(e),onIncrement:e=>this.store.onStoreIncrementEmitter.on(e),onPointerDown:e=>this.onPointerDownEmitter.on(e),onPointerUp:e=>this.onPointerUpEmitter.on(e),onScrollChange:e=>this.onScrollChangeEmitter.on(e),onUserFollow:e=>this.onUserFollowEmitter.on(e),onStateChange:this.onStateChange,onEvent:this.onEvent}}onWindowMessage(e){if(e.origin!==`https://player.vimeo.com`&&e.origin!==`https://www.youtube.com`)return;let t=null;try{t=JSON.parse(e.data)}catch{}if(t)switch(e.origin){case`https://player.vimeo.com`:if(t.method===`paused`){let n=null,r=document.body.querySelectorAll(`iframe.excalidraw__embeddable`);if(!r)break;for(let t of r)t.contentWindow===e.source&&(n=t.contentWindow);n?.postMessage(JSON.stringify({method:t.value?`play`:`pause`,value:!0}),`*`)}break;case`https://www.youtube.com`:if(t.event===`infoDelivery`&&t.info&&t.id&&typeof t.info.playerState==`number`){let e=t.id,n=t.info.playerState;Object.values(Ao).includes(n)&&bz.set(e,n)}break}}handleSkipBindMode(){if(this.state.selectedLinearElement?.initialState&&!this.state.selectedLinearElement.initialState.arrowStartIsInside){gt(this.lastPointerMoveCoords,`Missing last pointer move coords when changing bind skip mode for arrow start`);let e=this.scene.getNonDeletedElementsMap(),t=go(O(this.lastPointerMoveCoords.x,this.lastPointerMoveCoords.y),this.scene.getNonDeletedElements(),e),n=I.getElement(this.state.selectedLinearElement.elementId,e);n?.startBinding&&t?.id===n.startBinding.elementId&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:!0}}})}if(this.state.bindMode===`orbit`&&(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),(0,_c.flushSync)(()=>{this.setState({bindMode:`skip`})}),this.lastPointerMoveCoords&&this.state.selectedLinearElement?.selectedPointsIndices&&this.state.selectedLinearElement?.selectedPointsIndices.length)){let{x:e,y:t}=this.lastPointerMoveCoords,n=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;gt(n,`Last event must exist`);let r=e-this.state.selectedLinearElement.pointerOffset.x,i=t-this.state.selectedLinearElement.pointerOffset.y,a=this.state.multiElement?I.handlePointerMove(n,this,r,i,this.state.selectedLinearElement):I.handlePointDragging(n,this,r,i,this.state.selectedLinearElement);a&&this.setState(a)}}resetDelayedBindMode(){this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode!==`orbit`&&setTimeout(()=>this.setState({bindMode:`orbit`}))}handleDelayedBindModeChange(e,t){if(e.isDeleted||dr(e))return;let n=()=>{if(this.bindModeHandler=null,gt(this.lastPointerMoveCoords,`Expected lastPointerMoveCoords to be set`),!this.state.multiElement){if(!this.state.selectedLinearElement||!this.state.selectedLinearElement.selectedPointsIndices||!this.state.selectedLinearElement.selectedPointsIndices.length)return;let t=this.state.selectedLinearElement.selectedPointsIndices.includes(0),n=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1);if(!t&&!n||t&&n)return}let{x:t,y:n}=this.lastPointerMoveCoords,r=go(O(t,n),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(r&&this.state.bindMode!==`skip`){gt(this.state.selectedLinearElement?.elementId===e.id,`The selectedLinearElement is expected to not change while a bind mode timeout is ticking`);let i=this.state.selectedLinearElement.initialState.arrowStartIsInside||e.startBinding?.elementId===r.id;(0,_c.flushSync)(()=>{gt(this.state.selectedLinearElement,`this.state.selectedLinearElement must exist`),this.setState({bindMode:`inside`,selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:i}}})});let a=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;gt(a,`Last event must exist`);let o=t-this.state.selectedLinearElement.pointerOffset.x,s=n-this.state.selectedLinearElement.pointerOffset.y,c=this.state.multiElement?I.handlePointerMove(a,this,o,s,this.state.selectedLinearElement):I.handlePointDragging(a,this,o,s,this.state.selectedLinearElement);c&&this.setState(c)}},r=!1;if(this.state.selectedLinearElement?.selectedPointsIndices){let n=this.scene.getNonDeletedElementsMap(),i=this.state.selectedLinearElement.selectedPointsIndices.includes(0),a=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1),o=i?t:e.startBinding&&n.get(e.startBinding.elementId),s=a?t:e.endBinding&&n.get(e.endBinding.elementId),c=o&&m(o,n),l=s&&m(s,n);r=!!(c&&l&&o.id!==s.id&&oe(c,l))}let i=this.state.selectedLinearElement?.selectedPointsIndices?.includes(0),a=this.state.selectedLinearElement?.selectedPointsIndices?.includes(e.points.length-1),o=i?`startBinding`:a?`endBinding`:null,s=i?`endBinding`:a?`startBinding`:null,c=s&&e[s]?.mode===`inside`&&e[s]?.elementId===t?.id||o&&e[o]?.mode===`inside`&&t?.id===e[o]?.elementId;o&&s&&e[o]?.mode===`inside`&&t?.id!==e[o]?.elementId&&e[s]?.elementId!==e[o]?.elementId&&this.scene.mutateElement(e,{[o]:{...e[o],mode:`orbit`}},{informMutation:!1,isDragging:!0}),!t||this.previousHoveredBindableElement&&t.id!==this.previousHoveredBindableElement.id?(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode===`inside`&&(0,_c.flushSync)(()=>{this.setState({bindMode:`orbit`})}),this.previousHoveredBindableElement=null):!this.bindModeHandler&&(!this.state.newElement||!e.startBinding||r)&&!c&&(this.bindModeHandler=setTimeout(n,700)),this.previousHoveredBindableElement=t}cacheEmbeddableRef(e,t){t&&this.iFrameRefs.set(e.id,t)}getHTMLIFrameElement(e){return this.iFrameRefs.get(e.id)}handleIframeLikeCenterClick(){if(!this.lastPointerDownEvent||!this.lastPointerUpEvent||this.lastPointerDownEvent.button!==dn.MAIN||mz||!v(this.state.activeTool.type,[`laser`,`selection`,`lasso`]))return!1;let e=O(la({clientX:this.lastPointerDownEvent.clientX,clientY:this.lastPointerDownEvent.clientY},this.state)),t=O(la({clientX:this.lastPointerUpEvent.clientX,clientY:this.lastPointerUpEvent.clientY},this.state));if(Se(e,t)>10)return!1;let n=this.getElementAtPosition(e[0],e[1]);if(!(n&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<=300&&Tz.pointers.size<2&&Rs(n)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(n,this.lastPointerUpEvent,t[0],t[1]))))return!1;let r=n;if(this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`||(setTimeout(()=>{this.setState({activeEmbeddable:{element:r,state:`active`},selectedElementIds:{[r.id]:!0},newElement:null,selectionElement:null})},100),Vs(r)))return!0;let i=this.getHTMLIFrameElement(r);if(!i?.contentWindow)return!0;if(i.src.includes(`youtube`)){let e=bz.get(r.id);switch(e||(bz.set(r.id,Ao.UNSTARTED),i.contentWindow.postMessage(JSON.stringify({event:`listening`,id:r.id}),`*`)),e){case Ao.PLAYING:case Ao.BUFFERING:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`pauseVideo`,args:``}),`*`);break;default:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`playVideo`,args:``}),`*`)}}return i.src.includes(`player.vimeo.com`)&&i.contentWindow.postMessage(JSON.stringify({method:`paused`}),`*`),!0}isIframeLikeElementCenter(e,t,n,r){return e&&!t.altKey&&!t.shiftKey&&!t.metaKey&&!t.ctrlKey&&(this.state.activeEmbeddable?.element!==e||this.state.activeEmbeddable?.state===`hover`||!this.state.activeEmbeddable)&&n>=e.x+e.width/3&&n<=e.x+2*e.width/3&&r>=e.y+e.height/3&&r<=e.y+2*e.height/3}renderEmbeddables(){let e=this.state.zoom.value,t=this.state.width,n=this.state.height;return(0,W.jsx)(W.Fragment,{children:this.scene.getNonDeletedElements().filter(e=>rs(e)&&this.embedsValidationStatus.get(e.id)===!0||Vs(e)).map(r=>{let{x:i,y:a}=Ci({sceneX:r.x,sceneY:r.y},this.state),o=vn(r,t,n,this.state,this.scene.getNonDeletedElementsMap()),s=this.initializedEmbeds.has(r.id);if(o&&!s&&this.initializedEmbeds.add(r.id),!(o||s))return null;let c;if(Vs(r)){c=null;let e=(r.customData?.generationData??this.magicGenerations.get(r.id))||{status:`error`,message:`No generation data`,code:`ERR_NO_GENERATION_DATA`};if(e.status===`done`){let t=e.html;c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>t}}else if(e.status===`pending`)c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>cr(`
|
|
88
|
+
Please fix the Mermaid syntax and regenerate a valid diagram.`,isRepairFlow:!0})},onDeleteMessage:e=>{let t=u.messages.findIndex(t=>t.id===e&&t.type===`assistant`),n=u.messages.slice(0,t-1);d({...u,messages:n})},onInsertMessage:async t=>{let n=t.content||``;if(!n.trim()||!e.loaded)return;let r={current:{elements:[],files:null}};(await AF({canvasRef:s,data:r,mermaidToExcalidrawLib:e,setError:l,mermaidDefinition:n,theme:a.state.theme})).success&&MF({app:a,data:r,text:n,shouldSaveMermaidDataToStorage:!0})},onRetry:async e=>{let t=u.messages.findIndex(t=>t.id===e.id);if(t>0){let e=u.messages[t-1];e.type===`user`&&typeof e.content==`string`&&(h(),await _({prompt:e.content,isRepairFlow:!0}))}},onViewAsMermaid:()=>{typeof m?.content==`string`&&(jF(m.content),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},renderWarning:r,renderWelcomeScreen:n}),f&&(0,W.jsx)(gI,{canvasRef:s,hideErrorDetails:m?.errorType===`parse`,error:c,loaded:e.loaded,onInsert:()=>{MF({app:a,data:g})}})]})},vI=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>(0,W.jsx)(_I,{mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i}),yI=e=>{let t=lz(),n=(0,H.useRef)(null),r=(0,H.useRef)(0);return(0,W.jsx)(sv,{ref:n,className:`ttd-dialog-tabs-root`,value:e.tab,onValueChange:i=>{if(!i)return;let a=n.current?.closest(`.Modal__content`);if(a){let e=a.offsetHeight||0;e>r.current&&(r.current=e,a.style.minHeight=`min(${r.current}px, 100%)`)}e.dialog===`ttd`&&Sn([`text-to-diagram`,`mermaid`],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})};yI.displayName=`TTDDialogTabs`;var bI=yI,xI=({children:e,...t})=>(0,W.jsx)(cv,{className:`ttd-dialog-triggers`,...t,children:e});xI.displayName=`TTDDialogTabTriggers`;var SI=({children:e,tab:t,onSelect:n,...r})=>(0,W.jsx)(lv,{value:t,asChild:!0,onSelect:n,children:(0,W.jsx)(`button`,{type:`button`,className:`ttd-dialog-tab-trigger`,...r,children:e})});SI.displayName=`TTDDialogTabTrigger`;var CI=({tab:e,children:t,...n})=>(0,W.jsx)(uv,{...n,value:e,children:t});CI.displayName=`TTDDialogTab`;var wI=e=>{let t=gC();return t.openDialog?.name===`ttd`?(0,W.jsx)(TI,{...e,tab:t.openDialog.tab}):null};wI.WelcomeMessage=BF;var TI=oP(`TTDDialogBase`,({tab:e,...t})=>{let r=nz(),[i,a]=(0,H.useState)({loaded:!1,api:n(()=>import(`./excalidraw-mermaid-stub-LpuTrLnr.js`),__vite__mapDeps([70,71]),import.meta.url)});return(0,H.useEffect)(()=>{(async()=>{await i.api,a(e=>({...e,loaded:!0}))})()},[i.api]),(0,W.jsx)(dk,{className:`ttd-dialog`,onCloseRequest:()=>{r.setOpenDialog(null)},size:1520,title:!1,...t,autofocus:!1,children:(0,W.jsxs)(bI,{dialog:`ttd`,tab:e,children:[`__fallback`in t&&t.__fallback?(0,W.jsx)(`p`,{className:`dialog-mermaid-title`,children:K(`mermaid.title`)}):(0,W.jsxs)(xI,{children:[(0,W.jsx)(SI,{tab:`text-to-diagram`,children:(0,W.jsxs)(`div`,{className:`ttd-dialog-tab-trigger__content`,children:[K(`labels.textToDiagram`),(0,W.jsx)(`div`,{className:`ttd-dialog-tab-trigger__badge`,children:K(`chat.aiBeta`)})]})}),(0,W.jsx)(SI,{tab:`mermaid`,children:K(`mermaid.label`)})]}),!(`__fallback`in t)&&(0,W.jsx)(CI,{className:`ttd-dialog-content`,tab:`text-to-diagram`,children:(0,W.jsx)(vI,{mermaidToExcalidrawLib:i,onTextSubmit:t.onTextSubmit,renderWelcomeScreen:t.renderWelcomeScreen,renderWarning:t.renderWarning,persistenceAdapter:t.persistenceAdapter})}),(0,W.jsx)(CI,{className:`ttd-dialog-content`,tab:`mermaid`,children:(0,W.jsx)(zF,{mermaidToExcalidrawLib:i,isActive:e===`mermaid`})})]})})}),EI=.01,DI=10,OI=(e,t)=>!(t===`angle`&&L(e)),kI=(e,t)=>{let n=e+t/2;return n-n%t},AI=(e,t,n)=>Object.keys(e).map(e=>({original:(n??t).get(e),latest:t.get(e)})).filter(e=>e.original!==void 0&&e.latest!==void 0),jI=(e,t,n,r,i,a,o=!0)=>{if(ss(n)&&(n.startBinding||n.endBinding)){if(Math.abs(e-n.x)<10&&Math.abs(t-n.y)<10)return;vr(n,`start`,r),vr(n,`end`,r)}let s=r.getNonDeletedElementsMap(),c=s.get(n.id);if(!c)return;let[l,u]=[n.x+n.width/2,n.y+n.height/2],[d,f]=ke(O(n.x,n.y),O(l,u),n.angle),p=e-d,m=t-f,[h,g]=ke(O(e,t),O(l+p,u+m),-n.angle);r.mutateElement(c,{x:h,y:g},{informMutation:o,isDragging:!1}),Xn(c,r,i);let _=ut(n,a);if(_){let e=s.get(_.id);e&&r.mutateElement(e,{x:_.x+p,y:_.y+m},{informMutation:o,isDragging:!1})}if(L(n)){let e=Di(a,n.id);e.forEach(t=>{let n=s.get(t.id);if(!n)return;let[a,c]=[t.x+t.width/2,t.y+t.height/2],[l,u]=ke(O(t.x,t.y),O(a,c),t.angle),[d,f]=ke(O(Math.round(l+p),Math.round(u+m)),O(a+p,c+m),-t.angle);r.mutateElement(n,{x:d,y:f},{informMutation:o,isDragging:!1}),Xn(n,r,i,{simultaneouslyUpdated:e})})}},MI=(e,t)=>{let n=po(t).map(t=>Ki(e,t).reduce((e,t)=>(e[t.id]=!0,e),{}));return e.filter(e=>!Nn(e)).forEach(e=>{n.push({[e.id]:!0})}),n},NI=({label:e,icon:t,dragInputCallback:n,value:r,elements:i,editable:a=!0,shouldKeepAspectRatio:o,property:s,scene:c,appState:l,sensitivity:u=1,dragFinishedCallback:d})=>{let f=nz(),p=lz(),m=(0,H.useRef)(null),h=(0,H.useRef)(null),[g,_]=(0,H.useState)(r.toString()),v=(0,H.useRef)(null);v.current||={originalAppState:js(l),originalElements:i,lastUpdatedValue:g,updatePending:!1},(0,H.useEffect)(()=>{let e=r.toString();_(e),v.current.lastUpdatedValue=e},[r]);let y=(e,t,i)=>{if(!v.current.updatePending)return!1;v.current.updatePending=!1;let a=Number(e);if(isNaN(a)){_(r.toString());return}let l=Number(a.toFixed(2)),u=Number(r);(isNaN(u)||Math.abs(l-u)>=EI)&&(v.current.lastUpdatedValue=e,n({accumulatedChange:0,instantChange:0,originalElements:t,originalElementsMap:f.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:o,shouldChangeByStepSize:!1,scene:c,nextValue:l,property:s,originalAppState:i,setInputValue:e=>_(String(e)),app:f,setAppState:p}),f.syncActionResult({captureUpdate:V.IMMEDIATELY}))},b=(0,H.useRef)({});return b.current.handleInputValue=y,(0,H.useEffect)(()=>{let e=m.current,t=b.current;return()=>{let n=e?.value;n&&t.handleInputValue?.(n,v.current.originalElements,v.current.originalAppState),window.removeEventListener(F.POINTER_MOVE,t.onPointerMove,!1),window.removeEventListener(F.POINTER_UP,t.onPointerUp,!1)}},[a]),a?(0,W.jsxs)(`div`,{className:U(`drag-input-container`,!a&&`disabled`),"data-testid":e,children:[(0,W.jsx)(`div`,{className:`drag-input-label`,ref:h,onPointerDown:e=>{if(m.current&&a){document.body.classList.add(`excalidraw-cursor-resize`);let e=Number(m.current.value);isNaN(e)&&(e=0);let t=null,r=f.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,qn(t)),e),new Map),a=i.map(e=>r.get(e.id)),h=js(l),g=0,v=0,y=e=>{if(t&&r!==null&&a!==null){let i=e.clientX-t.x;i!==0&&(v+=i,Math.abs(v)>=u&&(v=Math.sign(v)*Math.floor(Math.abs(v)/u),g+=v,n({accumulatedChange:g,instantChange:v,originalElements:a,originalElementsMap:r,shouldKeepAspectRatio:o,shouldChangeByStepSize:e.shiftKey,property:s,scene:c,originalAppState:h,setInputValue:e=>_(String(e)),app:f,setAppState:p}),v=0))}t={x:e.clientX,y:e.clientY}},x=()=>{window.removeEventListener(F.POINTER_MOVE,y,!1),f.syncActionResult({captureUpdate:V.IMMEDIATELY}),d?.({app:f,setAppState:p,originalElements:a,originalAppState:h}),t=null,g=0,v=0,a=null,r=null,document.body.classList.remove(`excalidraw-cursor-resize`),window.removeEventListener(F.POINTER_UP,x,!1)};b.current.onPointerMove=y,b.current.onPointerUp=x,window.addEventListener(F.POINTER_MOVE,y,!1),window.addEventListener(F.POINTER_UP,x,!1)}},onPointerEnter:()=>{h.current&&(h.current.style.cursor=`ew-resize`)},children:t?(0,W.jsx)(mw,{icon:t}):e}),(0,W.jsx)(`input`,{className:`drag-input`,autoComplete:`off`,spellCheck:`false`,onKeyDown:e=>{if(a){let t=e.target;t instanceof HTMLInputElement&&e.key===N.ENTER&&(y(t.value,i,l),f.focusContainer())}},ref:m,value:g,onChange:e=>{v.current.updatePending=!0,_(e.target.value)},onFocus:e=>{e.target.select(),v.current.originalElements=i,v.current.originalAppState=js(l)},onBlur:e=>{g?a&&y(e.target.value,v.current.originalElements,v.current.originalAppState):_(r.toString())},disabled:!a})]}):null},PI=15,FI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i,app:a})=>{let o=i.getNonDeletedElementsMap(),s=t[0];if(s&&!dr(s)){let t=o.get(s.id);if(!t)return;if(r!==void 0){let e=Pt(r);i.mutateElement(t,{angle:e}),Xn(t,i,a.state);let n=ut(t,o);n&&!jt(t)&&i.mutateElement(n,{angle:e});return}let c=(Math.round(ha(s.angle)*100)/100+Math.round(e))%360;n&&(c=kI(c,PI)),c=c<0?c+360:c;let l=Pt(c);i.mutateElement(t,{angle:l}),Xn(t,i,a.state);let u=ut(t,o);u&&!jt(t)&&i.mutateElement(u,{angle:l})}},II=({element:e,scene:t,appState:n,property:r})=>(0,W.jsx)(NI,{label:`A`,icon:Yx,value:Math.round(ha(e.angle)%360*100)/100,elements:[e],dragInputCallback:FI,editable:OI(e,`angle`),scene:t,appState:n,property:r}),LI=5,RI=({property:e,scene:t,appState:n,setAppState:r})=>(0,W.jsx)(NI,{label:`Grid step`,sensitivity:8,elements:[],dragInputCallback:({nextValue:e,instantChange:t,shouldChangeByStepSize:n,setInputValue:i})=>{r(r=>{let a;return e?a=e:t&&(a=n?kI(r.gridStep+LI*Math.sign(t),LI):r.gridStep+t),a?(a=l(a),i(a),{gridStep:a}):(i(r.gridStep),null)})},scene:t,value:n.gridStep,property:e,appState:n}),zI=10,BI=e=>e.type===`image`,VI=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldKeepAspectRatio:r,shouldChangeByStepSize:i,nextValue:a,property:o,originalAppState:s,instantChange:c,scene:l,app:u,setAppState:d})=>{let f=l.getNonDeletedElementsMap(),p=t[0],m=f.get(p.id);if(p&&m){let t=r||BI(p),h=p.width/p.height;if(s.croppingElementId===p.id){let e=f.get(p.id);if(!e||!io(e)||!e.crop)return;let t=e.crop,n={...t},r=e.scale[0]===-1,i=e.scale[1]===-1,{width:s,height:u}=A(e),d=t.naturalWidth/s,m=t.naturalHeight/u,h=r?t.width+t.x:t.naturalWidth-t.x,g=i?t.height+t.y:t.naturalHeight-t.y,_=10*d,v=10*m;if(a!==void 0){if(o===`width`){let e=Ht(a*d,_,h);n={...n,width:e,x:r?t.x+t.width-e:t.x}}else if(o===`height`){let e=Ht(a*m,v,g);n={...n,height:e,y:i?t.y+t.height-e:t.y}}l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}let y=o===`width`?c:0,b=o===`height`?c:0,x=Ht(t.width+y,_,h),S=Ht(t.height+b,_,g);n={...t,x:r?t.x+t.width-x:t.x,y:i?t.y+t.height-S:t.y,width:x,height:S},l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}if(a!==void 0){if(nt(Math.max(o===`width`?a:t?a*h:p.width,1),Math.max(o===`height`?a:t?a/h:p.height,1),m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),L(m)){let e=kn(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap()),t=Ai(l.getElementsIncludingDeleted(),e,m,u);l.replaceAllElements(t)}return}{let r=o===`width`?e:0,a=o===`height`?e:0,c=Math.max(0,p.width+r);o===`width`&&(c=i?kI(c,zI):Math.round(c));let u=Math.max(0,p.height+a);o===`height`&&(u=i?kI(u,zI):Math.round(u)),t&&(o===`width`?u=Math.round(c/h*100)/100:c=Math.round(u*h*100)/100),u=Math.max(1,u),c=Math.max(1,c),nt(c,u,m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),L(m)&&d({elementsToHighlight:kn(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap())})}}},HI=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&L(o)){let n=kn(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=Ai(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},UI=({property:e,element:t,scene:n,appState:r})=>{let i=on(e===`width`?t.width:t.height,2);if(r.croppingElementId&&r.croppingElementId===t.id&&io(t)&&t.crop){let{width:n,height:r}=A(t);if(e===`width`){let e=n/t.crop.naturalWidth;i=on(t.crop.width*e,2)}if(e===`height`){let e=r/t.crop.naturalHeight;i=on(t.crop.height*e,2)}}return(0,W.jsx)(NI,{label:e===`width`?`W`:`H`,elements:[t],dragInputCallback:VI,value:i,editable:OI(t,e),scene:n,appState:r,property:e,dragFinishedCallback:HI})},WI=4,GI=4,KI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t[0];if(o){let t=a.get(o.id);if(!t||!M(t))return;let s;if(r!==void 0)s=Math.max(Math.round(r),WI);else if(o.type===`text`){let t=Math.round(o.fontSize);s=Math.max(t+Math.round(e),WI),n&&(s=kI(s,GI))}s&&(i.mutateElement(t,{fontSize:s}),Zi(t,i.getContainerElement(t),i))}},qI=({element:e,scene:t,appState:n,property:r})=>{let i=M(e)?e:xr(e)?ut(e,t.getNonDeletedElementsMap()):null;return i?(0,W.jsx)(NI,{label:`F`,value:Math.round(i.fontSize*10)/10,elements:[i],dragInputCallback:KI,icon:Rx,appState:n,scene:t,property:r}):null},JI=15,YI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,property:i,scene:a})=>{let o=a.getNonDeletedElementsMap(),s=t.map(e=>o.get(e.id)).filter(e=>e&&!Nn(e)&&OI(e,i)),c=t.filter(e=>!Nn(e)&&OI(e,i));if(r!==void 0){let e=Pt(r);for(let t of s){if(!t)continue;a.mutateElement(t,{angle:e});let n=ut(t,o);n&&!jt(t)&&a.mutateElement(n,{angle:e})}a.triggerUpdate();return}for(let t=0;t<s.length;t++){let r=s[t];if(!r)continue;let i=c[t],l=(Math.round(ha(i.angle)*100)/100+Math.round(e))%360;n&&(l=kI(l,JI)),l=l<0?l+360:l;let u=Pt(l);a.mutateElement(r,{angle:u});let d=ut(r,o);d&&!jt(r)&&a.mutateElement(d,{angle:u})}a.triggerUpdate()},XI=({elements:e,scene:t,appState:n,property:r})=>{let i=e.filter(e=>!Nn(e)&&OI(e,`angle`)),a=i.map(e=>Math.round(ha(e.angle)%360*100)/100);return(0,W.jsx)(NI,{label:`A`,icon:Yx,value:new Set(a).size===1?a[0]:`Mixed`,elements:e,dragInputCallback:YI,editable:i.some(e=>OI(e,`angle`)),appState:n,scene:t,property:r})},ZI=10,QI=(e,t,n,r)=>{let i=r.x-e,a=r.y-t,o=r.width*n,s=r.height*n;return{width:o,height:s,x:e+i*n,y:t+a*n,...Rr(r,o,s,!1),...M(r)?{fontSize:r.fontSize*n}:{}}},$I=(e,t,n,r,i,a,o,s)=>{let c=s.getNonDeletedElementsMap(),l=QI(e,t,r,a);s.mutateElement(i,l);let u=ut(a,o);if(u){let e=u.fontSize*r;ue(i,s);let t=c.get(u.id);t&&M(t)&&(s.mutateElement(t,{fontSize:e}),ci(i,s,n===`width`?`e`:`s`,!0))}},eL=(e,t,n,r,i,a,o,s,c,l)=>{a===`width`?t=Math.round(e/r*100)/100:e=Math.round(t*r*100)/100;let u=t/n;for(let e=0;e<s.length;e++){let t=s[e],n=o[e];$I(i[0],i[1],a,u,n,t,c,l)}},tL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,originalAppState:r,shouldChangeByStepSize:i,nextValue:a,scene:o,property:s,setAppState:c,app:l})=>{let u=o.getNonDeletedElementsMap(),d=MI(t,r);if(a!==void 0){for(let e of d){let t=AI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[i,c,l,u]=Ii(r),d=l-i,f=u-c,p=d/f;eL(Math.max(1,s===`width`?Math.max(0,a):d),Math.max(1,s===`height`?Math.max(0,a):f),f,p,O(i,c),s,e,r,n,o)}else{let[e]=t,c=e?.latest,u=e?.original;if(c&&u&&OI(c,s)){let e=s===`width`?Math.max(0,a):c.width;s===`width`&&(e=i?kI(e,ZI):Math.round(e));let t=s===`height`?Math.max(0,a):c.height;if(s===`height`&&(t=i?kI(t,ZI):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),nt(e,t,c,u,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),L(c)){let e=kn(o.getElementsIncludingDeleted(),c,r,o.getNonDeletedElementsMap()),t=Ai(o.getElementsIncludingDeleted(),e,c,l);o.replaceAllElements(t)}}}}o.triggerUpdate();return}let f=s===`width`?e:0,p=s===`height`?e:0,m=[];for(let e of d){let t=AI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[a,c,l,u]=Ii(r),d=l-a,m=u-c,h=d/m,g=Math.max(0,d+f);s===`width`&&(g=i?kI(g,ZI):Math.round(g));let _=Math.max(0,m+p);s===`height`&&(_=i?kI(_,ZI):Math.round(_)),g=Math.max(1,g),_=Math.max(1,_),eL(g,_,m,h,O(a,c),s,e,r,n,o)}else{let[e]=t,a=e?.latest,c=e?.original;if(a&&c&&OI(a,s)){let e=Math.max(0,c.width+f);s===`width`&&(e=i?kI(e,ZI):Math.round(e));let t=Math.max(0,c.height+p);if(s===`height`&&(t=i?kI(t,ZI):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),nt(e,t,a,c,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),L(a)){let e=kn(o.getElementsIncludingDeleted(),a,r,o.getNonDeletedElementsMap());m.push(...e)}}}}c({elementsToHighlight:m}),o.triggerUpdate()},nL=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&L(o)){let n=kn(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=Ai(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},rL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,H.useMemo)(()=>r.map(t=>{let r=AI(t,n);if(r.length>1){let[t,n,i,a]=Ii(r.map(e=>e.latest));return Math.round((e===`width`?i-t:a-n)*100)/100}let[i]=r;return Math.round((e===`width`?i.latest.width:i.latest.height)*100)/100}),[n,r,e]),s=new Set(o).size===1?Math.round(o[0]*100)/100:`Mixed`,c=o.length>0;return(0,W.jsx)(NI,{label:e===`width`?`W`:`H`,elements:t,dragInputCallback:tL,value:s,editable:c,appState:a,property:e,scene:i,dragFinishedCallback:nL})},iL=4,aL=4,oL=(e,t)=>e.reduce((e,n)=>{if(!n||Nn(n))return e;if(M(n))return e.push(n),e;if(xr(n)){let r=ut(n,t);if(r)return e.push(r),e}return e},[]),sL=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t.map(e=>a.get(e.id)),s;if(r){s=Math.max(Math.round(r),iL);for(let e of o)i.mutateElement(e,{fontSize:s}),Zi(e,i.getContainerElement(e),i);i.triggerUpdate()}else{let r=t;for(let t=0;t<o.length;t++){let a=o[t],s=r[t],c=Math.round(s.fontSize),l=Math.max(c+Math.round(e),iL);n&&(l=kI(l,aL)),i.mutateElement(a,{fontSize:l}),Zi(a,i.getContainerElement(a),i)}i.triggerUpdate()}},cL=({elements:e,scene:t,appState:n,property:r,elementsMap:i})=>{let a=oL(e,i);if(!a.length)return null;let o=a.map(e=>Math.round(e.fontSize*10)/10);return(0,W.jsx)(NI,{label:`F`,icon:Rx,elements:a,dragInputCallback:sL,value:new Set(o).size===1?o[0]:`Mixed`,editable:o.length>0,scene:t,property:r,appState:n})},lL=(e,t,n,r,i,a,o)=>{for(let s=0;s<r.length;s++){let c=r[s],[l,u]=[c.x+c.width/2,c.y+c.height/2],[d,f]=ke(O(c.x,c.y),O(l,u),c.angle);jI(e===`x`?Math.round(d+t):d,e===`y`?Math.round(f+n):f,c,a,o,i,!1)}},uL=(e,t,n,r,i,a)=>{let o=i.getNonDeletedElementsMap(),[s,c,,]=Ii(n),l=e-s,u=t-c;for(let e=0;e<n.length;e++){let t=n[e],s=o.get(t.id);if(s&&(!M(s)||!s.containerId)){let[e,n]=[s.x+s.width/2,s.y+s.height/2],[o,c]=ke(O(s.x,s.y),O(e,n),s.angle);jI(o+l,c+u,t,i,a,r,!1)}}},dL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldChangeByStepSize:r,nextValue:i,property:a,scene:o,originalAppState:s,app:c})=>{let l=o.getNonDeletedElementsMap();if(i!==void 0){for(let e of MI(t,s)){let t=AI(e,l,n);if(t.length>1){let[e,r,,]=Ii(t.map(e=>e.latest));uL(a===`x`?i:e,a===`y`?i:r,t.map(e=>e.original),n,o,c.state)}else{let e=t[0]?.original,r=t[0]?.latest;if(e&&r&&OI(r,a)){let[t,r]=[e.x+e.width/2,e.y+e.height/2],[s,l]=ke(O(e.x,e.y),O(t,r),e.angle);jI(a===`x`?i:s,a===`y`?i:l,e,o,c.state,n,!1)}}}o.triggerUpdate();return}let u=r?kI(e,DI):e;lL(a,a===`x`?u:0,a===`y`?u:0,t,n,o,c.state),o.triggerUpdate()},fL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,H.useMemo)(()=>r.map(t=>{let r=Object.keys(t).map(e=>n.get(e)).filter(e=>e!==void 0);if(r.length>1){let[t,n]=Ii(r);return Math.round((e===`x`?t:n)*100)/100}let[i]=r,[a,o]=[i.x+i.width/2,i.y+i.height/2],[s,c]=ke(O(i.x,i.y),O(a,o),i.angle);return Math.round((e===`x`?s:c)*100)/100}),[r,n,e]),s=new Set(o).size===1?o[0]:`Mixed`;return(0,W.jsx)(NI,{label:e===`x`?`X`:`Y`,elements:t,dragInputCallback:dL,value:s,property:e,scene:i,appState:a})},pL=({accumulatedChange:e,instantChange:t,originalElements:n,originalElementsMap:r,shouldChangeByStepSize:i,nextValue:a,property:o,scene:s,originalAppState:c,app:l})=>{let u=s.getNonDeletedElementsMap(),d=n[0],[f,p]=[d.x+d.width/2,d.y+d.height/2],[m,h]=ke(O(d.x,d.y),O(f,p),d.angle);if(c.croppingElementId===d.id){let e=u.get(d.id);if(!e||!io(e)||!e.crop)return;let n=e.crop,r=n,i=e.scale[0]===-1,c=e.scale[1]===-1,{width:l,height:f}=A(e);if(a!==void 0){if(o===`x`){let e=a*(n.naturalWidth/l);r=i?{...n,x:Ht(n.naturalWidth-e-n.width,0,n.naturalWidth-n.width)}:{...n,x:Ht(a*(n.naturalWidth/l),0,n.naturalWidth-n.width)}}o===`y`&&(r={...n,y:Ht(a*(n.naturalHeight/f),0,n.naturalHeight-n.height)}),s.mutateElement(e,{crop:r});return}let p=(o===`x`?t:0)*(i?-1:1),m=(o===`y`?t:0)*(c?-1:1);r={...n,x:Ht(n.x+p,0,n.naturalWidth-n.width),y:Ht(n.y+m,0,n.naturalHeight-n.height)},s.mutateElement(e,{crop:r});return}if(a!==void 0){jI(o===`x`?a:m,o===`y`?a:h,d,s,l.state,r);return}let g=o===`x`?e:0,_=o===`y`?e:0;jI(o===`x`?Math.round(i?kI(d.x+g,DI):m+g):m,o===`y`?Math.round(i?kI(d.y+_,DI):h+_):h,d,s,l.state,r)},mL=({property:e,element:t,elementsMap:n,scene:r,appState:i})=>{let[a,o]=ke(O(t.x,t.y),O(t.x+t.width/2,t.y+t.height/2),t.angle),s=on(e===`x`?a:o,2);if(i.croppingElementId===t.id&&io(t)&&t.crop){let n=hr(t);n&&(s=on(e===`x`?n.x:n.y,2))}return(0,W.jsx)(NI,{label:e===`x`?`X`:`Y`,elements:[t],dragInputCallback:pL,scene:r,value:s,property:e,appState:i})},hL=50,gL=e=>{let t=cz(),n=e.app.scene.getSceneNonce()||1,r=e.app.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}),i=Sj(e.app);return(0,W.jsx)(yL,{...e,appState:t,sceneNonce:n,selectedElements:r,gridModeEnabled:i})},_L=({children:e,columns:t=1,heading:n,style:r,...i})=>(0,W.jsx)(`div`,{className:U(`exc-stats__row`,{"exc-stats__row--heading":n}),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,...r},...i,children:e});_L.displayName=`StatsRow`;var vL=({children:e,order:t,style:n,...r})=>(0,W.jsx)(`div`,{className:`exc-stats__rows`,style:{order:t,...n},...r,children:e});vL.displayName=`StatsRows`,gL.StatsRow=_L,gL.StatsRows=vL;var yL=(0,H.memo)(({app:e,onClose:t,renderCustomStats:n,selectedElements:r,appState:i,sceneNonce:a,gridModeEnabled:o})=>{let s=e.scene,c=s.getNonDeletedElements(),l=s.getNonDeletedElementsMap(),u=lz(),d=r.length===1?r[0]:null,f=r.length>1?r:null,p=i.croppingElementId&&io(d),m=p?A(d):null,[h,g]=(0,H.useState)({width:0,height:0}),_=(0,H.useMemo)(()=>(0,gc.default)(e=>{let t=Ii(e);g({width:Math.round(t[2])-Math.round(t[0]),height:Math.round(t[3])-Math.round(t[1])})},hL),[]);(0,H.useEffect)(()=>{_(c)},[a,c,_]),(0,H.useEffect)(()=>()=>_.cancel(),[_]);let v=(0,H.useMemo)(()=>MI(r,i),[r,i]),y=(0,H.useMemo)(()=>Dr(r),[r]);return(0,W.jsx)(`div`,{className:`exc-stats`,children:(0,W.jsxs)(SC,{padding:3,children:[(0,W.jsxs)(`div`,{className:`title`,children:[(0,W.jsx)(`h2`,{children:K(`stats.title`)}),(0,W.jsx)(`div`,{className:`close`,onClick:t,children:nx})]}),(0,W.jsxs)(hw,{label:(0,W.jsx)(`h3`,{children:K(`stats.generalStats`)}),open:!!(i.stats.panels&Fr.generalStats),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Fr.generalStats}})),children:[(0,W.jsxs)(vL,{children:[(0,W.jsx)(_L,{heading:!0,children:K(`stats.scene`)}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.shapes`)}),(0,W.jsx)(`div`,{children:c.length})]}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.width`)}),(0,W.jsx)(`div`,{children:h.width})]}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.height`)}),(0,W.jsx)(`div`,{children:h.height})]}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_L,{heading:!0,children:`Canvas`}),(0,W.jsx)(_L,{children:(0,W.jsx)(RI,{property:`gridStep`,scene:s,appState:i,setAppState:u})})]})]}),n?.(c,i)]}),!y&&r.length>0&&(0,W.jsx)(`div`,{id:`elementStats`,style:{marginTop:12},children:(0,W.jsx)(hw,{label:(0,W.jsx)(`h3`,{children:K(`stats.elementProperties`)}),open:!!(i.stats.panels&Fr.elementProperties),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Fr.elementProperties}})),children:(0,W.jsxs)(vL,{children:[d&&(0,W.jsxs)(W.Fragment,{children:[p&&(0,W.jsx)(_L,{heading:!0,children:K(`labels.unCroppedDimension`)}),i.croppingElementId&&io(d)&&m&&(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.width`)}),(0,W.jsx)(`div`,{children:on(m.width,2)})]}),i.croppingElementId&&io(d)&&m&&(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.height`)}),(0,W.jsx)(`div`,{children:on(m.height,2)})]}),(0,W.jsx)(_L,{heading:!0,"data-testid":`stats-element-type`,style:{margin:`0.3125rem 0`},children:i.croppingElementId?K(`labels.imageCropping`):K(`element.${d.type}`)}),(0,W.jsx)(_L,{children:(0,W.jsx)(mL,{element:d,property:`x`,elementsMap:l,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(mL,{element:d,property:`y`,elementsMap:l,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(UI,{property:`width`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(UI,{property:`height`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(II,{property:`angle`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(qI,{property:`fontSize`,element:d,scene:s,appState:i})})]}),f&&(0,W.jsxs)(W.Fragment,{children:[Co(f)&&(0,W.jsx)(_L,{heading:!0,children:K(`element.group`)}),(0,W.jsxs)(_L,{columns:2,style:{margin:`0.3125rem 0`},children:[(0,W.jsx)(`div`,{children:K(`stats.shapes`)}),(0,W.jsx)(`div`,{children:r.length})]}),(0,W.jsx)(_L,{children:(0,W.jsx)(fL,{property:`x`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(fL,{property:`y`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(rL,{property:`width`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(rL,{property:`height`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(XI,{property:`angle`,elements:f,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(cL,{property:`fontSize`,elements:f,scene:s,appState:i,elementsMap:l})})]})]})})})]})})},(e,t)=>e.sceneNonce===t.sceneNonce&&e.selectedElements===t.selectedElements&&e.appState.stats.panels===t.appState.stats.panels&&e.gridModeEnabled===t.gridModeEnabled&&e.appState.gridStep===t.appState.gridStep&&e.appState.croppingElementId===t.appState.croppingElementId),bL=({sourceElementId:e,onClose:t,appState:n,scene:r,generateLinkForSelection:i=_a})=>{let a=r.getNonDeletedElementsMap(),o=a.get(e)?.link??null,[s,c]=(0,H.useState)(o),[l,u]=(0,H.useState)(!1);(0,H.useEffect)(()=>{let e=ir(a,n),t=o;if(e.length>0&&i){let r=Fa(e,n);r&&(t=Hs(i(r.id,r.type)))}c(t)},[a,n,n.selectedElementIds,o,i]);let d=(0,H.useCallback)(()=>{if(s&&s!==a.get(e)?.link){let t=a.get(e);t&&r.mutateElement(t,{link:s})}if(!s&&l&&e){let t=a.get(e);t&&r.mutateElement(t,{link:null})}t?.()},[e,s,a,l,r,t]);return(0,H.useEffect)(()=>{let e=e=>{n.openDialog?.name===`elementLinkSelector`&&e.key===N.ENTER&&d(),n.openDialog?.name===`elementLinkSelector`&&e.key===N.ESCAPE&&t?.()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n,t,d]),(0,W.jsxs)(`div`,{className:`ElementLinkDialog`,children:[(0,W.jsxs)(`div`,{className:`ElementLinkDialog__header`,children:[(0,W.jsx)(`h2`,{children:K(`elementLink.title`)}),(0,W.jsx)(`p`,{children:K(`elementLink.desc`)})]}),(0,W.jsxs)(`div`,{className:`ElementLinkDialog__input`,children:[(0,W.jsx)($O,{value:s??``,onChange:e=>{l||u(!0),c(e)},onKeyDown:e=>{e.key===N.ENTER&&d()},className:`ElementLinkDialog__input-field`,selectOnRender:!0}),o&&s&&(0,W.jsx)(X,{type:`button`,title:K(`buttons.remove`),"aria-label":K(`buttons.remove`),label:K(`buttons.remove`),onClick:()=>{c(null),u(!0)},className:`ElementLinkDialog__remove`,icon:pb})]}),(0,W.jsxs)(`div`,{className:`ElementLinkDialog__actions`,children:[(0,W.jsx)(aO,{label:K(`buttons.cancel`),onClick:()=>{t?.()},style:{marginRight:10}}),(0,W.jsx)(aO,{label:K(`buttons.confirm`),onClick:d,actionType:`primary`})]})]})},xL=({children:e,onClose:t})=>{let[n,r]=(0,H.useState)(!!e),{container:i}=oz(),a=H.useCallback(()=>{r(!1),t&&t(),i?.focus()},[t,i]);return(0,W.jsx)(W.Fragment,{children:n&&(0,W.jsx)(dk,{size:`small`,onCloseRequest:a,title:K(`errorDialog.title`),children:(0,W.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:e})})})},SL=()=>(0,W.jsxs)(`div`,{className:`HelpDialog__header`,children:[(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://docs.excalidraw.com`,target:`_blank`,rel:`noopener`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Sb}),K(`helpDialog.documentation`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://plus.excalidraw.com/blog`,target:`_blank`,rel:`noopener`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Sb}),K(`helpDialog.blog`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://github.com/excalidraw/excalidraw/issues`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Cb}),K(`helpDialog.github`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://youtube.com/@excalidraw`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:FS}),`YouTube`]})]}),CL=e=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{children:e.title}),(0,W.jsx)(`div`,{className:`HelpDialog__islands-container`,children:e.children})]}),wL=e=>(0,W.jsxs)(`div`,{className:`HelpDialog__island ${e.className}`,children:[(0,W.jsx)(`h4`,{className:`HelpDialog__island-title`,children:e.caption}),(0,W.jsx)(`div`,{className:`HelpDialog__island-content`,children:e.children})]});function*TL(e,t){let n=!0;for(let r of e)n||(yield t),n=!1,yield r}var EL=e=>e.replace(/\b[a-z]\b/,e=>e.toUpperCase()),$=({label:e,shortcuts:t,isOr:n=!0})=>{let r=t.map(e=>(e.endsWith(`++`)?[...e.slice(0,-2).split(`+`),`+`]:e.split(`+`)).map(e=>(0,W.jsx)(DL,{children:EL(e)},e)));return(0,W.jsxs)(`div`,{className:`HelpDialog__shortcut`,children:[(0,W.jsx)(`div`,{children:e}),(0,W.jsx)(`div`,{className:`HelpDialog__key-container`,children:[...TL(r,n?K(`helpDialog.or`):null)]})]})},DL=e=>(0,W.jsx)(`kbd`,{className:`HelpDialog__key`,...e}),OL=({onClose:e})=>(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(dk,{onCloseRequest:H.useCallback(()=>{e&&e()},[e]),title:K(`helpDialog.title`),className:`HelpDialog`,children:[(0,W.jsx)(SL,{}),(0,W.jsxs)(CL,{title:K(`helpDialog.shortcuts`),children:[(0,W.jsxs)(wL,{className:`HelpDialog__island--tools`,caption:K(`helpDialog.tools`),children:[(0,W.jsx)($,{label:K(`toolBar.hand`),shortcuts:[N.H]}),(0,W.jsx)($,{label:K(`toolBar.selection`),shortcuts:[N.V,N[1]]}),(0,W.jsx)($,{label:K(`toolBar.rectangle`),shortcuts:[N.R,N[2]]}),(0,W.jsx)($,{label:K(`toolBar.diamond`),shortcuts:[N.D,N[3]]}),(0,W.jsx)($,{label:K(`toolBar.ellipse`),shortcuts:[N.O,N[4]]}),(0,W.jsx)($,{label:K(`toolBar.arrow`),shortcuts:[N.A,N[5]]}),(0,W.jsx)($,{label:K(`toolBar.line`),shortcuts:[N.L,N[6]]}),(0,W.jsx)($,{label:K(`toolBar.freedraw`),shortcuts:[N.P,N[7]]}),(0,W.jsx)($,{label:K(`toolBar.text`),shortcuts:[N.T,N[8]]}),(0,W.jsx)($,{label:K(`toolBar.image`),shortcuts:[N[9]]}),(0,W.jsx)($,{label:K(`toolBar.eraser`),shortcuts:[N.E,N[0]]}),(0,W.jsx)($,{label:K(`toolBar.frame`),shortcuts:[N.F]}),(0,W.jsx)($,{label:K(`toolBar.laser`),shortcuts:[N.K]}),(0,W.jsx)($,{label:K(`labels.eyeDropper`),shortcuts:[N.I,`Shift+S`,`Shift+G`]}),(0,W.jsx)($,{label:K(`helpDialog.editLineArrowPoints`),shortcuts:[Q(`CtrlOrCmd+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.editText`),shortcuts:[Q(`Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.textNewLine`),shortcuts:[Q(`Enter`),Q(`Shift+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.textFinish`),shortcuts:[Q(`Esc`),Q(`CtrlOrCmd+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.curvedArrow`),shortcuts:[`A`,K(`helpDialog.click`),K(`helpDialog.click`),K(`helpDialog.click`)],isOr:!1}),(0,W.jsx)($,{label:K(`helpDialog.curvedLine`),shortcuts:[`L`,K(`helpDialog.click`),K(`helpDialog.click`),K(`helpDialog.click`)],isOr:!1}),(0,W.jsx)($,{label:K(`helpDialog.cropStart`),shortcuts:[K(`helpDialog.doubleClick`),Q(`Enter`)],isOr:!0}),(0,W.jsx)($,{label:K(`helpDialog.cropFinish`),shortcuts:[Q(`Enter`),Q(`Escape`)],isOr:!0}),(0,W.jsx)($,{label:K(`toolBar.lock`),shortcuts:[N.Q]}),(0,W.jsx)($,{label:K(`helpDialog.preventBinding`),shortcuts:[Q(`CtrlOrCmd`)]}),(0,W.jsx)($,{label:K(`toolBar.link`),shortcuts:[Q(`CtrlOrCmd+K`)]}),(0,W.jsx)($,{label:K(`toolBar.convertElementType`),shortcuts:[`Tab`,`Shift+Tab`],isOr:!0})]}),(0,W.jsxs)(wL,{className:`HelpDialog__island--view`,caption:K(`helpDialog.view`),children:[(0,W.jsx)($,{label:K(`buttons.zoomIn`),shortcuts:[Q(`CtrlOrCmd++`)]}),(0,W.jsx)($,{label:K(`buttons.zoomOut`),shortcuts:[Q(`CtrlOrCmd+-`)]}),(0,W.jsx)($,{label:K(`buttons.resetZoom`),shortcuts:[Q(`CtrlOrCmd+0`)]}),(0,W.jsx)($,{label:K(`helpDialog.zoomToFit`),shortcuts:[`Shift+1`]}),(0,W.jsx)($,{label:K(`helpDialog.zoomToSelection`),shortcuts:[`Shift+2`]}),(0,W.jsx)($,{label:K(`helpDialog.movePageUpDown`),shortcuts:[`PgUp/PgDn`]}),(0,W.jsx)($,{label:K(`helpDialog.movePageLeftRight`),shortcuts:[`Shift+PgUp/PgDn`]}),(0,W.jsx)($,{label:K(`buttons.zenMode`),shortcuts:[Q(`Alt+Z`)]}),(0,W.jsx)($,{label:K(`buttons.objectsSnapMode`),shortcuts:[Q(`Alt+S`)]}),(0,W.jsx)($,{label:K(`labels.toggleGrid`),shortcuts:[Q(`CtrlOrCmd+'`)]}),(0,W.jsx)($,{label:K(`labels.viewMode`),shortcuts:[Q(`Alt+R`)]}),(0,W.jsx)($,{label:K(`labels.toggleTheme`),shortcuts:[Q(`Alt+Shift+D`)]}),(0,W.jsx)($,{label:K(`stats.fullTitle`),shortcuts:[Q(`Alt+/`)]}),(0,W.jsx)($,{label:K(`search.title`),shortcuts:[ND(`searchMenu`)]}),(0,W.jsx)($,{label:K(`commandPalette.title`),shortcuts:xt?[ND(`commandPalette`)]:[ND(`commandPalette`),ND(`commandPalette`,1)]})]}),(0,W.jsxs)(wL,{className:`HelpDialog__island--editor`,caption:K(`helpDialog.editor`),children:[(0,W.jsx)($,{label:K(`helpDialog.createFlowchart`),shortcuts:[Q(`CtrlOrCmd+Arrow Key`)],isOr:!0}),(0,W.jsx)($,{label:K(`helpDialog.navigateFlowchart`),shortcuts:[Q(`Alt+Arrow Key`)],isOr:!0}),(0,W.jsx)($,{label:K(`labels.moveCanvas`),shortcuts:[Q(`Space+${K(`helpDialog.drag`)}`),Q(`Wheel+${K(`helpDialog.drag`)}`)],isOr:!0}),(0,W.jsx)($,{label:K(`buttons.clearReset`),shortcuts:[Q(`CtrlOrCmd+Delete`)]}),(0,W.jsx)($,{label:K(`labels.delete`),shortcuts:[Q(`Delete`)]}),(0,W.jsx)($,{label:K(`labels.cut`),shortcuts:[Q(`CtrlOrCmd+X`)]}),(0,W.jsx)($,{label:K(`labels.copy`),shortcuts:[Q(`CtrlOrCmd+C`)]}),(0,W.jsx)($,{label:K(`labels.paste`),shortcuts:[Q(`CtrlOrCmd+V`)]}),(0,W.jsx)($,{label:K(`labels.pasteAsPlaintext`),shortcuts:[Q(`CtrlOrCmd+Shift+V`)]}),(0,W.jsx)($,{label:K(`labels.selectAll`),shortcuts:[Q(`CtrlOrCmd+A`)]}),(0,W.jsx)($,{label:K(`labels.multiSelect`),shortcuts:[Q(`Shift+${K(`helpDialog.click`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.deepSelect`),shortcuts:[Q(`CtrlOrCmd+${K(`helpDialog.click`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.deepBoxSelect`),shortcuts:[Q(`CtrlOrCmd+${K(`helpDialog.drag`)}`)]}),(mT||xt)&&(0,W.jsx)($,{label:K(`labels.copyAsPng`),shortcuts:[Q(`Shift+Alt+C`)]}),(0,W.jsx)($,{label:K(`labels.copyStyles`),shortcuts:[Q(`CtrlOrCmd+Alt+C`)]}),(0,W.jsx)($,{label:K(`labels.pasteStyles`),shortcuts:[Q(`CtrlOrCmd+Alt+V`)]}),(0,W.jsx)($,{label:K(`labels.sendToBack`),shortcuts:[Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)]}),(0,W.jsx)($,{label:K(`labels.bringToFront`),shortcuts:[Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)]}),(0,W.jsx)($,{label:K(`labels.sendBackward`),shortcuts:[Q(`CtrlOrCmd+[`)]}),(0,W.jsx)($,{label:K(`labels.bringForward`),shortcuts:[Q(`CtrlOrCmd+]`)]}),(0,W.jsx)($,{label:K(`labels.alignTop`),shortcuts:[Q(`CtrlOrCmd+Shift+Up`)]}),(0,W.jsx)($,{label:K(`labels.alignBottom`),shortcuts:[Q(`CtrlOrCmd+Shift+Down`)]}),(0,W.jsx)($,{label:K(`labels.alignLeft`),shortcuts:[Q(`CtrlOrCmd+Shift+Left`)]}),(0,W.jsx)($,{label:K(`labels.alignRight`),shortcuts:[Q(`CtrlOrCmd+Shift+Right`)]}),(0,W.jsx)($,{label:K(`labels.duplicateSelection`),shortcuts:[Q(`CtrlOrCmd+D`),Q(`Alt+${K(`helpDialog.drag`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.toggleElementLock`),shortcuts:[Q(`CtrlOrCmd+Shift+L`)]}),(0,W.jsx)($,{label:K(`buttons.undo`),shortcuts:[Q(`CtrlOrCmd+Z`)]}),(0,W.jsx)($,{label:K(`buttons.redo`),shortcuts:tn?[Q(`CtrlOrCmd+Y`),Q(`CtrlOrCmd+Shift+Z`)]:[Q(`CtrlOrCmd+Shift+Z`)]}),(0,W.jsx)($,{label:K(`labels.group`),shortcuts:[Q(`CtrlOrCmd+G`)]}),(0,W.jsx)($,{label:K(`labels.ungroup`),shortcuts:[Q(`CtrlOrCmd+Shift+G`)]}),(0,W.jsx)($,{label:K(`labels.flipHorizontal`),shortcuts:[Q(`Shift+H`)]}),(0,W.jsx)($,{label:K(`labels.flipVertical`),shortcuts:[Q(`Shift+V`)]}),(0,W.jsx)($,{label:K(`labels.showStroke`),shortcuts:[Q(`S`)]}),(0,W.jsx)($,{label:K(`labels.showBackground`),shortcuts:[Q(`G`)]}),(0,W.jsx)($,{label:K(`labels.showFonts`),shortcuts:[Q(`Shift+F`)]}),(0,W.jsx)($,{label:K(`labels.decreaseFontSize`),shortcuts:[Q(`CtrlOrCmd+Shift+<`)]}),(0,W.jsx)($,{label:K(`labels.increaseFontSize`),shortcuts:[Q(`CtrlOrCmd+Shift+>`)]})]})]})]})}),kL=e=>Array.isArray(e)?`<kbd>${e.map(Q).join(` + `)}</kbd>`:`<kbd>${Q(e)}</kbd>`,AL=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let{activeTool:i,isResizing:a,isRotating:o,lastPointerDownWith:s}=e,c=e.multiElement!==null;if(e.openSidebar?.name===At.name&&e.openSidebar.tab===`search`&&e.searchMatches?.matches.length)return K(`hints.dismissSearch`,{shortcut:kL(`Escape`)});if(e.openSidebar&&!n.canFitSidebar)return null;if(zr(e))return K(`hints.eraserRevert`,{shortcut:kL(`Alt`)});let l=r.scene.getSelectedElements(e);if(e.selectedLinearElement?.isDragging&&l[0]?.type===`arrow`)return K(`hints.arrowBindModifiers`,{shortcut_1:kL(`Ctrl`),shortcut_2:kL(`Alt`)});if(i.type===`arrow`||i.type===`line`)return c?K(`hints.linearElementMulti`,{shortcut_1:kL(`Escape`),shortcut_2:kL(`Enter`)}):i.type===`arrow`?K(`hints.arrowTool`,{shortcut:kL(`A`)}):K(`hints.linearElement`);if(i.type===`freedraw`)return K(`hints.freeDraw`);if(i.type===`text`)return K(`hints.text`);if(i.type===`embeddable`)return K(`hints.embeddable`);if(a&&s===`mouse`&&l.length===1){let e=l[0];return b(e)&&e.points.length===2?K(`hints.lockAngle`,{shortcut:kL(`Shift`)}):io(e)?K(`hints.resizeImage`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)}):K(`hints.resize`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)})}if(o&&s===`mouse`)return K(`hints.rotate`,{shortcut:kL(`Shift`)});if(l.length===1&&M(l[0]))return K(`hints.text_selected`,{shortcut:kL(`Enter`)});if(e.editingTextElement)return K(`hints.text_editing`,{shortcut_1:kL(`Escape`),shortcut_2:kL([`CtrlOrCmd`,`Enter`])});if(e.croppingElementId)return K(`hints.leaveCropEditor`,{shortcut_1:kL(`Enter`),shortcut_2:kL(`Escape`)});if(l.length===1&&io(l[0]))return K(`hints.enterCropEditor`,{shortcut:kL(`Enter`)});if(i.type===`selection`){if(e.selectionElement&&!l.length&&!e.editingTextElement&&!e.selectedLinearElement?.isEditing)return K(`hints.deepBoxSelect`,{shortcut:kL(`CtrlOrCmd`)});if(Sj(r)&&e.selectedElementsAreBeingDragged)return K(`hints.disableSnapping`,{shortcut:kL(`CtrlOrCmd`)});if(!l.length&&!t)return K(`hints.canvasPanning`,{shortcut_1:kL(K(`keys.mmb`)),shortcut_2:kL(`Space`)});if(l.length===1){if(b(l[0]))return e.selectedLinearElement?.isEditing?e.selectedLinearElement.selectedPointsIndices?K(`hints.lineEditor_pointSelected`,{shortcut_1:kL(`Delete`),shortcut_2:kL([`CtrlOrCmd`,`D`])}):K(`hints.lineEditor_nothingSelected`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)}):ca(l[0])?K(`hints.lineEditor_line_info`,{shortcut:kL(`Enter`)}):K(`hints.lineEditor_info`,{shortcut_1:kL(`CtrlOrCmd`),shortcut_2:kL([`CtrlOrCmd`,`Enter`])});if(!e.newElement&&!e.selectedElementsAreBeingDragged&&k(l[0])){let e=K(`hints.bindTextToElement`,{shortcut:kL(`Enter`)}),t=K(`hints.createFlowchart`,{shortcut:kL([`CtrlOrCmd`,`↑↓`])});return Vi(l[0])?(Dt(l[0],r.scene.getNonDeletedElementsMap()),[e,t]):e}}}return null},jL=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let i=AL({appState:e,isMobile:t,editorInterface:n,app:r});return i?(0,W.jsx)(`div`,{className:`HintViewer`,children:(0,W.jsx)(`span`,{children:(Array.isArray(i)?i.map(e=>e.replace(/\. ?$/,``)).join(`, `):i).split(/(<kbd>[^<]+<\/kbd>)/g).map((e,t)=>{if(t%2==1){let n=e[0]===`<`&&e.match(/^<kbd>([^<]+)<\/kbd>$/);return(0,W.jsx)(`kbd`,{children:n?n[1]:e},t)}return e})})}):null},ML=2e3,NL=()=>{let[e,t]=(0,H.useState)(null),n=(0,H.useRef)(0);return{copyStatus:e,resetCopyStatus:(0,H.useCallback)(()=>{t(null)},[]),onCopy:()=>{clearTimeout(n.current),t(`success`),n.current=window.setTimeout(()=>{t(null)},ML)}}},PL=({title:e,name:t,checked:n,onChange:r,disabled:i=!1})=>(0,W.jsx)(`div`,{className:U(`Switch`,{toggled:n,disabled:i}),children:(0,W.jsx)(`input`,{name:t,id:t,title:e,type:`checkbox`,checked:n,disabled:i,onChange:()=>r(!n),onKeyDown:e=>{e.key===` `&&r(!n)}})}),FL=()=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{children:K(`canvasError.cannotShowPreview`)}),(0,W.jsx)(`p`,{children:(0,W.jsx)(`span`,{children:K(`canvasError.canvasTooBig`)})}),(0,W.jsxs)(`em`,{children:[`(`,K(`canvasError.canvasTooBigTip`),`)`]})]}),IL=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:r,onExportImage:i,name:a,exportWithDarkMode:o})=>{let s=Ya(t,e),[c,l]=(0,H.useState)(a),[u,d]=(0,H.useState)(s),[f,p]=(0,H.useState)(e.exportBackground),[m,h]=(0,H.useState)(e.exportEmbedScene),[g,_]=(0,H.useState)(e.exportScale),v=(0,H.useRef)(null),y=(0,H.useRef)(0),[b,x]=(0,H.useState)(null),{onCopy:S,copyStatus:C,resetCopyStatus:w}=NL();(0,H.useEffect)(()=>{w()},[c,f,o,g,m,w]);let{exportedElements:T,exportingFrame:E}=NT(t,e,u);return(0,H.useEffect)(()=>{let t=v.current;if(!t)return;let r=t.offsetWidth,i=t.offsetHeight;if(!r)return;let a=++y.current,s=()=>a!==y.current;return zD({elements:T,appState:{...e,name:c,exportBackground:f,exportWithDarkMode:o,exportScale:g,exportEmbedScene:m},files:n,exportPadding:10,maxWidthOrHeight:Math.max(r,i),exportingFrame:E}).then(async e=>{if(!s()){try{await er(e)}catch(e){throw e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(K(`canvasError.canvasTooBig`)):e}s()||(x(null),t.replaceChildren(e))}}).catch(e=>{s()||(console.error(e),x(e))}),()=>{y.current+=1}},[e,n,T,E,c,f,o,g,m]),(0,W.jsxs)(`div`,{className:`ImageExportModal`,children:[(0,W.jsx)(`h3`,{children:K(`imageExportDialog.header`)}),(0,W.jsxs)(`div`,{className:`ImageExportModal__preview`,children:[(0,W.jsx)(`div`,{className:`ImageExportModal__preview__canvas`,ref:v,children:b&&(0,W.jsx)(FL,{})}),(0,W.jsx)(`div`,{className:`ImageExportModal__preview__filename`,children:!no&&(0,W.jsx)(`input`,{type:`text`,className:`TextInput`,value:c,style:{width:`30ch`},onChange:e=>{l(e.target.value),r.executeAction(IT,`ui`,e.target.value)}})})]}),(0,W.jsxs)(`div`,{className:`ImageExportModal__settings`,children:[(0,W.jsx)(`h3`,{children:K(`imageExportDialog.header`)}),s&&(0,W.jsx)(LL,{label:K(`imageExportDialog.label.onlySelected`),name:`exportOnlySelected`,children:(0,W.jsx)(PL,{name:`exportOnlySelected`,checked:u,onChange:e=>{d(e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.withBackground`),name:`exportBackgroundSwitch`,children:(0,W.jsx)(PL,{name:`exportBackgroundSwitch`,checked:f,onChange:e=>{p(e),r.executeAction(RT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.darkMode`),name:`exportDarkModeSwitch`,children:(0,W.jsx)(PL,{name:`exportDarkModeSwitch`,checked:o,onChange:e=>{r.executeAction(qT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.embedScene`),tooltip:K(`imageExportDialog.tooltip.embedScene`),name:`exportEmbedSwitch`,children:(0,W.jsx)(PL,{name:`exportEmbedSwitch`,checked:m,onChange:e=>{h(e),r.executeAction(zT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.scale`),name:`exportScale`,children:(0,W.jsx)(uP,{name:`exportScale`,value:g,onChange:e=>{_(e),r.executeAction(LT,`ui`,e)},choices:Wi.map(e=>({value:e,label:`${e}\xD7`}))})}),(0,W.jsxs)(`div`,{className:`ImageExportModal__settings__buttons`,children:[(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.exportToPng`),onClick:()=>i(oi.png,T,{exportingFrame:E}),icon:Qx,children:K(`imageExportDialog.button.exportToPng`)}),(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.exportToSvg`),onClick:()=>i(oi.svg,T,{exportingFrame:E}),icon:Qx,children:K(`imageExportDialog.button.exportToSvg`)}),(mT||xt)&&(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.copyPngToClipboard`),status:C,onClick:async()=>{await i(oi.clipboard,T,{exportingFrame:E}),S()},icon:$x,children:K(`imageExportDialog.button.copyPngToClipboard`)})]})]})]})},LL=({label:e,children:t,tooltip:n,name:r})=>(0,W.jsxs)(`div`,{className:`ImageExportModal__settings__setting`,title:e,children:[(0,W.jsxs)(`label`,{htmlFor:r,className:`ImageExportModal__settings__setting__label`,children:[e,n&&(0,W.jsx)(Rw,{label:n,long:!0,children:tS})]}),(0,W.jsx)(`div`,{className:`ImageExportModal__settings__setting__content`,children:t})]}),RL=({elements:e,appState:t,files:n,actionManager:r,onExportImage:i,onCloseRequest:a,name:o})=>{let[{appStateSnapshot:s,elementsSnapshot:c}]=(0,H.useState)(()=>({appStateSnapshot:js(t),elementsSnapshot:js(e)}));return(0,W.jsx)(dk,{onCloseRequest:a,size:`wide`,title:!1,children:(0,W.jsx)(IL,{elementsSnapshot:c,appStateSnapshot:s,files:n,actionManager:r,onExportImage:i,name:o,exportWithDarkMode:t.exportWithDarkMode})})},zL={primary:{base:`var(--color-primary)`,darker:`var(--color-primary-darker)`,darkest:`var(--color-primary-darkest)`},lime:{base:`#74b816`,darker:`#66a80f`,darkest:`#5c940d`},pink:{base:`#d6336c`,darker:`#c2255c`,darkest:`#a61e4d`}},BL=({children:e,color:t})=>(0,W.jsx)(`div`,{className:`Card`,style:{"--card-color":zL[t].base,"--card-color-darker":zL[t].darker,"--card-color-darkest":zL[t].darkest},children:e}),VL=({elements:e,appState:t,setAppState:n,files:r,actionManager:i,exportOpts:a,canvas:o,onCloseRequest:s})=>{let{onExportToBackend:c}=a;return(0,W.jsx)(`div`,{className:`ExportDialog ExportDialog--json`,children:(0,W.jsxs)(`div`,{className:`ExportDialog-cards`,children:[a.saveFileToDisk&&(0,W.jsxs)(BL,{color:`lime`,children:[(0,W.jsx)(`div`,{className:`Card-icon`,children:Pb}),(0,W.jsx)(`h2`,{children:K(`exportDialog.disk_title`)}),(0,W.jsxs)(`div`,{className:`Card-details`,children:[K(`exportDialog.disk_details`),!no&&i.renderAction(`changeProjectName`)]}),(0,W.jsx)(X,{className:`Card-button`,type:`button`,title:K(`exportDialog.disk_button`),"aria-label":K(`exportDialog.disk_button`),showAriaLabel:!0,onClick:()=>{i.executeAction(GT,`ui`)}})]}),c&&(0,W.jsxs)(BL,{color:`pink`,children:[(0,W.jsx)(`div`,{className:`Card-icon`,children:Db}),(0,W.jsx)(`h2`,{children:K(`exportDialog.link_title`)}),(0,W.jsx)(`div`,{className:`Card-details`,children:K(`exportDialog.link_details`)}),(0,W.jsx)(X,{className:`Card-button`,type:`button`,title:K(`exportDialog.link_button`),"aria-label":K(`exportDialog.link_button`),showAriaLabel:!0,onClick:async()=>{try{dC(`export`,`link`,`ui (${Sr()})`),await c(e,t,r),s()}catch(e){n({errorMessage:e.message})}}})]}),a.renderCustomUI&&a.renderCustomUI(e,t,r,o)]})})},HL=({elements:e,appState:t,files:n,actionManager:r,exportOpts:i,canvas:a,setAppState:o})=>{let s=H.useCallback(()=>{o({openDialog:null})},[o]);return(0,W.jsx)(W.Fragment,{children:t.openDialog?.name===`jsonExport`&&(0,W.jsx)(dk,{onCloseRequest:s,title:K(`buttons.export`),children:(0,W.jsx)(VL,{elements:e,appState:t,setAppState:o,files:n,actionManager:r,onCloseRequest:s,exportOpts:i,canvas:a})})})},UL=`small`,WL=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__LaserPointer`,`ToolIcon_size_${UL}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":`toolbar-LaserPointer`}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:dS})]}),GL=({UIOptions:e})=>(0,W.jsxs)(PP,{__fallback:!0,children:[(0,W.jsx)(PP.DefaultItems.LoadScene,{}),(0,W.jsx)(PP.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,W.jsx)(PP.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,W.jsx)(PP.DefaultItems.SaveAsImage,{}),(0,W.jsx)(PP.DefaultItems.SearchMenu,{}),(0,W.jsx)(PP.DefaultItems.Help,{}),(0,W.jsx)(PP.DefaultItems.ClearCanvas,{}),(0,W.jsx)(PP.Separator,{}),(0,W.jsx)(PP.Group,{title:`Excalidraw links`,children:(0,W.jsx)(PP.DefaultItems.Socials,{})}),(0,W.jsx)(PP.Separator,{}),(0,W.jsx)(PP.DefaultItems.ToggleTheme,{}),(0,W.jsx)(PP.DefaultItems.ChangeCanvasBackground,{})]}),KL=()=>(0,W.jsxs)(RP,{__fallback:!0,children:[(0,W.jsx)(RP.Actions.SaveToDisk,{}),(0,W.jsx)(RP.Actions.ExportToImage,{})]}),qL=({actionManager:e,appState:t,files:n,setAppState:r,elements:i,canvas:a,onLockToggle:o,onHandToolToggle:s,onPenModeToggle:c,showExitZenModeBtn:l,renderTopLeftUI:u,renderTopRightUI:d,renderCustomStats:f,UIOptions:p,onExportImage:m,renderWelcomeScreen:h,children:g,app:_,isCollaborating:v,generateLinkForSelection:y})=>{let b=iz(),x=az()===`compact`,S=vk(),C=x?{menuTopGap:4,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:.5,islandPadding:1,collabMarginLeft:8}:{menuTopGap:6,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:1,islandPadding:1,collabMarginLeft:8},w=S.tunnelsJotai.Provider,[T,E]=vy(bC),D=()=>p.canvasActions.export?(0,W.jsx)(HL,{elements:i,appState:t,files:n,actionManager:e,exportOpts:p.canvasActions.export,canvas:a,setAppState:r}):null,O=()=>!p.canvasActions.saveAsImage||t.openDialog?.name!==`imageExport`?null:(0,W.jsx)(RL,{elements:i,appState:t,files:n,actionManager:e,onExportImage:m,onCloseRequest:()=>r({openDialog:null}),name:_.getName()}),k=()=>(0,W.jsxs)(`div`,{style:{position:`relative`},children:[(0,W.jsx)(S.MainMenuTunnel.Out,{}),h&&(0,W.jsx)(S.WelcomeScreenMenuHintTunnel.Out,{})]}),A=()=>{let n=x;return(0,W.jsx)(BN,{heading:`selectedShapeActions`,className:U(`selected-shape-actions zen-mode-transition`,{"transition-left":t.zenModeEnabled}),children:n?(0,W.jsx)(SC,{className:U(`compact-shape-actions-island`),padding:0,style:{maxHeight:`${t.height-166}px`},children:(0,W.jsx)(Ak,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_,setAppState:r})}):(0,W.jsx)(SC,{className:Qn.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:(0,W.jsx)(wk,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_})})})},ee=()=>{let n=oo(t,i),a=t.stats.open&&!t.zenModeEnabled&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`;return(0,W.jsx)(MN,{side:`top`,children:(0,W.jsxs)(`div`,{className:`App-menu App-menu_top`,children:[(0,W.jsxs)(_O.Col,{gap:C.menuTopGap,className:U(`App-menu_top__left`),children:[k(),(0,W.jsx)(`div`,{className:U(`selected-shape-actions-container`,{"selected-shape-actions-container--compact":x}),children:n&&A()})]}),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(0,W.jsx)(BN,{heading:`shapes`,className:`shapes-section`,children:e=>(0,W.jsxs)(`div`,{style:{position:`relative`},children:[h&&(0,W.jsx)(S.WelcomeScreenToolbarHintTunnel.Out,{}),(0,W.jsx)(_O.Col,{gap:C.toolbarColGap,align:`start`,children:(0,W.jsxs)(_O.Row,{gap:C.toolbarRowGap,className:U(`App-toolbar-container`,{"zen-mode":t.zenModeEnabled}),children:[(0,W.jsxs)(SC,{padding:C.islandPadding,className:U(`App-toolbar`,{"zen-mode":t.zenModeEnabled,"App-toolbar--compact":x}),children:[(0,W.jsx)(jL,{appState:t,isMobile:b.formFactor===`phone`,editorInterface:b,app:_}),e,(0,W.jsxs)(_O.Row,{gap:C.toolbarInnerRowGap,children:[(0,W.jsx)(PN,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>c(null),title:K(`toolBar.penMode`),penDetected:t.penDetected}),(0,W.jsx)(EN,{checked:t.activeTool.locked,onChange:o,title:K(`toolBar.lock`)}),(0,W.jsx)(`div`,{className:`App-toolbar__divider`}),(0,W.jsx)(Mk,{setAppState:r,activeTool:t.activeTool,UIOptions:p,app:_})]})]}),v&&(0,W.jsx)(SC,{style:{marginLeft:C.collabMarginLeft,alignSelf:`center`,height:`fit-content`},children:(0,W.jsx)(WL,{title:K(`toolBar.laser`),checked:t.activeTool.type===va.laser,onChange:()=>_.setActiveTool({type:va.laser}),isMobile:!0})})]})})]})}),(0,W.jsxs)(`div`,{className:U(`layer-ui__wrapper__top-right zen-mode-transition`,{"transition-right":t.zenModeEnabled,"layer-ui__wrapper__top-right--compact":x}),children:[t.collaborators.size>0&&(0,W.jsx)(KN,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),d?.(b.formFactor===`phone`,t),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(!ne||t.openSidebar?.name!==At.name)&&(0,W.jsx)(S.DefaultSidebarTriggerTunnel.Out,{}),a&&(0,W.jsx)(gL,{app:_,onClose:()=>{e.executeAction(OE)},renderCustomStats:f})]})]})})},te=()=>(0,W.jsx)($P,{__fallback:!0,onDock:e=>{dC(`sidebar`,`toggleDock (${e?`dock`:`undock`})`,`(${b.formFactor===`phone`?`mobile`:`desktop`})`)}}),ne=by(rP),j=(0,W.jsxs)(W.Fragment,{children:[g,(0,W.jsx)(GL,{UIOptions:p}),(0,W.jsx)($P.Trigger,{__fallback:!0,icon:YS,title:Ge(K(`toolBar.library`)),onToggle:e=>{e&&dC(`sidebar`,`${At.name} (open)`,`button (${b.formFactor===`phone`?`mobile`:`desktop`})`)},tab:At.defaultTab}),(0,W.jsx)(KL,{}),t.openDialog?.name===`ttd`&&(0,W.jsx)(wI,{__fallback:!0}),t.isLoading&&(0,W.jsx)(CN,{delay:250}),t.errorMessage&&(0,W.jsx)(xL,{onClose:()=>r({errorMessage:null}),children:t.errorMessage}),T&&b.formFactor!==`phone`&&(0,W.jsx)(xC,{colorPickerType:T.colorPickerType,onCancel:()=>{E(null)},onChange:(e,t,n,{altKey:a})=>{if(!(e!==`elementBackground`&&e!==`elementStroke`))if(n.length){for(let r of n)jn(r,lr(i),{[a&&T.swapPreviewOnAlt?e===`elementBackground`?`strokeColor`:`backgroundColor`:e===`elementBackground`?`backgroundColor`:`strokeColor`]:t}),bn.delete(r);_.scene.triggerUpdate()}else r(e===`elementBackground`?{currentItemBackgroundColor:t}:{currentItemStrokeColor:t})},onSelect:(e,t)=>{E(e=>e?.keepOpenOnAlt&&t.altKey?e:null),T?.onSelect?.(e,t)}}),t.openDialog?.name===`help`&&(0,W.jsx)(OL,{onClose:()=>{r({openDialog:null})}}),(0,W.jsx)(zk,{}),t.openDialog?.name===`elementLinkSelector`&&(0,W.jsx)(bL,{sourceElementId:t.openDialog.sourceElementId,onClose:()=>{r({openDialog:null})},scene:_.scene,appState:t,generateLinkForSelection:y}),(0,W.jsx)(S.OverwriteConfirmDialogTunnel.Out,{}),O(),D(),t.openDialog?.name===`charts`&&(0,W.jsx)(zN,{data:t.openDialog.data,rawText:t.openDialog.rawText,onClose:()=>r({openDialog:null})}),b.formFactor===`phone`&&(0,W.jsx)(FN,{app:_,appState:t,elements:i,actionManager:e,renderJSONExportDialog:D,renderImageExportDialog:O,setAppState:r,onHandToolToggle:s,onPenModeToggle:c,renderTopLeftUI:u,renderTopRightUI:d,renderSidebars:te,renderWelcomeScreen:h,UIOptions:p}),b.formFactor!==`phone`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`layer-ui__wrapper`,style:t.openSidebar&&ne&&b.canFitSidebar?{width:`calc(100% - var(--right-sidebar-width))`}:{},children:[h&&(0,W.jsx)(S.WelcomeScreenCenterTunnel.Out,{}),ee(),(0,W.jsx)(YN,{appState:t,actionManager:e,showExitZenModeBtn:l,renderWelcomeScreen:h}),(t.toast||t.scrolledOutside)&&(0,W.jsxs)(`div`,{className:`floating-status-stack`,children:[t.toast&&(0,W.jsx)(fT,{message:t.toast.message,onClose:()=>r({toast:null}),duration:t.toast.duration,closable:t.toast.closable}),!t.toast&&t.scrolledOutside&&(0,W.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...An(i,e)}))},children:K(`buttons.scrollBackToContent`)})]})]}),te()]})]});return(0,W.jsx)(hC.Provider,{value:t,children:(0,W.jsx)(w,{children:(0,W.jsx)(hk.Provider,{value:S,children:j})})})},JL=e=>{let{startBoundElement:t,cursorButton:n,scrollX:r,scrollY:i,...a}=e;return a},YL=H.memo(qL,(e,t)=>{if(e.children!==t.children)return!1;let{canvas:n,appState:r,...i}=e,{canvas:a,appState:o,...s}=t;return ji(JL(r),JL(o),{selectedElementIds:ji,selectedGroupIds:ji})&&ji(i,s)}),XL=`small`,ZL=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__MagicButton`,`ToolIcon_size_${XL}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:e.icon})]}),QL=({trails:e})=>{let t=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(t.current)for(let n of e)n.start(t.current);return()=>{for(let t of e)t.stop()}},e),(0,W.jsx)(`div`,{className:`SVGLayer`,children:(0,W.jsx)(`svg`,{ref:t})})},$L=`#ff6b6b`,eR=`#ff0000`,tR=1,nR=2,rR=(e,t)=>{if(!t.snapLines.length)return;let n=t.theme===R.LIGHT||t.zenModeEnabled?$L:eR,r=(t.zenModeEnabled?tR*1.5:tR)/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY);for(let i of t.snapLines)i.type===`pointer`?(e.lineWidth=r,e.strokeStyle=n,aR(i,e,t)):i.type===`gap`?(e.lineWidth=r,e.strokeStyle=n,cR(i.points[0],i.points[1],i.direction,t,e)):i.type===`points`&&(e.lineWidth=r,e.strokeStyle=n,iR(i,e,t));e.restore()},iR=(e,t,n)=>{if(!n.zenModeEnabled){let n=e.points[0],r=e.points[e.points.length-1];sR(n,r,t)}for(let r of e.points)oR(r,n,t)},aR=(e,t,n)=>{oR(e.points[0],n,t),n.zenModeEnabled||sR(e.points[0],e.points[1],t)},oR=([e,t],n,r)=>{r.save();let i=(n.zenModeEnabled?nR*1.5:nR)/n.zoom.value;r.beginPath(),r.moveTo(e-i,t-i),r.lineTo(e+i,t+i),r.moveTo(e+i,t-i),r.lineTo(e-i,t+i),r.stroke(),r.restore()},sR=(e,t,n)=>{n.beginPath(),n.lineTo(e[0],e[1]),n.lineTo(t[0],t[1]),n.stroke()},cR=(e,t,n,r,i)=>{let a=8/r.zoom.value,o=a/2,s=a/4;if(n===`horizontal`){let n=[(e[0]+t[0])/2,e[1]];r.zenModeEnabled||sR(O(e[0],e[1]-a),O(e[0],e[1]+a),i),sR(O(n[0]-s,n[1]-o),O(n[0]-s,n[1]+o),i),sR(O(n[0]+s,n[1]-o),O(n[0]+s,n[1]+o),i),r.zenModeEnabled||(sR(O(t[0],t[1]-a),O(t[0],t[1]+a),i),sR(e,t,i))}else{let n=[e[0],(e[1]+t[1])/2];r.zenModeEnabled||sR(O(e[0]-a,e[1]),O(e[0]+a,e[1]),i),sR(O(n[0]-o,n[1]-s),O(n[0]+o,n[1]-s),i),sR(O(n[0]-o,n[1]+s),O(n[0]+o,n[1]+s),i),r.zenModeEnabled||(sR(O(t[0]-a,t[1]),O(t[0]+a,t[1]),i),sR(e,t,i))}},lR=(e,t)=>{gt(t.selectedLinearElement,`selectedLinearElement is null`);let{segmentMidPointHoveredCoords:n}=t.selectedLinearElement;gt(n,`midPointCoords is null`),e.save(),e.translate(t.scrollX,t.scrollY),dR(n,e,t),e.restore()},uR=(e,t,n)=>{let{elementId:r,hoverPointIndex:i}=t.selectedLinearElement;if(t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(i)||t.selectedLinearElement?.isDragging)return;let a=I.getElement(r,n);if(!a)return;let o=I.getPointAtIndexGlobalCoordinates(a,i,n);e.save(),e.translate(t.scrollX,t.scrollY),dR(o,e,t),e.restore()},dR=(e,t,n)=>{t.fillStyle=`rgba(105, 101, 219, 0.4)`,De(t,e[0],e[1],I.POINT_HANDLE_SIZE/n.zoom.value,!1)},fR=(e,t,n)=>{e.save(),e.translate(t.scrollX,t.scrollY),dR(n,e,t),e.restore()},pR=(e,t,n,r,i,a,o)=>{e.strokeStyle=`#5e5ad8`,e.setLineDash([]),e.fillStyle=`rgba(255, 255, 255, 0.9)`,i?e.fillStyle=`rgba(134, 131, 226, 0.9)`:a&&(e.fillStyle=`rgba(177, 151, 252, 0.7)`),De(e,n[0],n[1],(o?r*(t.selectedLinearElement?.isEditing?1.5:2):r)/t.zoom.value,!a,!o||i)},mR=(e,t,n,r,i)=>{let a=t.element.frameId&&n.get(t.element.frameId);switch(a&&L(a)&&(e.translate(a.x,a.y),e.beginPath(),On.radius&&e.roundRect?e.roundRect(-1,-1,a.width+1,a.height+1,On.radius/r.zoom.value):e.rect(-1,-1,a.width+1,a.height+1),e.clip(),e.translate(-a.x,-a.y)),t.element.type){case`magicframe`:case`frame`:e.save(),e.translate(t.element.x,t.element.y),e.lineWidth=On.strokeWidth/r.zoom.value,e.strokeStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,On.radius&&e.roundRect?(e.beginPath(),e.roundRect(0,0,t.element.width,t.element.height,On.radius/r.zoom.value),e.stroke(),e.closePath()):e.strokeRect(0,0,t.element.width,t.element.height),e.restore();break;default:e.save();let i=Ae(t.element,n);switch(e.translate(i[0],i[1]),e.rotate(t.element.angle),e.translate(-i[0],-i[1]),e.translate(t.element.x,t.element.y),e.lineWidth=Ht(1.75,t.element.strokeWidth,4)/Math.max(.25,r.zoom.value),e.strokeStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,t.element.type){case`ellipse`:e.beginPath(),e.ellipse(t.element.width/2,t.element.height/2,t.element.width/2,t.element.height/2,0,0,2*Math.PI),e.closePath(),e.stroke();break;case`diamond`:{let[n,r]=ur(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break;default:{let[n,r]=ee(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break}e.restore();break}if(r.isMidpointSnappingEnabled&&(L(t.element)||un(t.element))){let a=r.selectedLinearElement,o=a?.elementId&&I.getElement(a?.elementId,n),s=i&&Ui({point:i,element:t.element,elementsMap:n,threshold:0,overrideShouldTestInside:!0}),c=o&&dr(o)||r.activeTool.type===`arrow`&&r.currentItemArrowType===`elbow`;if(!s||c){e.save();let a=Ae(t.element,n),o;if(t.element.type===`diamond`){let e=Ae(t.element,n);o=as(t.element).map(n=>{let r=ke(Os(n,.5),e,t.element.angle);return O(r[0],r[1])})}else o=[{x:t.element.width,y:t.element.height/2},{x:t.element.width/2,y:t.element.height},{x:0,y:t.element.height/2},{x:t.element.width/2,y:0}].map(e=>{let n=ke(O(e.x+t.element.x,e.y+t.element.y),a,t.element.angle);return O(n[0],n[1])});let l=i&&o.reduce((e,t,n)=>{let r=Se(t,i);return n===-1||r<e.distance?{idx:n,distance:r}:e},{idx:-1,distance:1/0}),u=4/r.zoom.value,d=ii(r.zoom)+t.element.strokeWidth/2;o.forEach((t,n)=>{let i=(!s||c)&&l?.idx===n&&l.distance<=d,a=!i&&(c||n===l?.idx&&l.distance<=d*2);i?(e.fillStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,e.beginPath(),e.arc(t[0],t[1],u,0,2*Math.PI),e.fill()):a&&(e.fillStyle=r.theme===R.DARK?`rgba(0, 0, 0, 0.8)`:`rgba(65, 65, 65, 0.5)`,e.beginPath(),e.arc(t[0],t[1],u,0,2*Math.PI),e.fill())}),e.restore()}}},hR=(e,t,n,r,i,a,o)=>{let s=e.state.bindMode===`orbit`&&e.bindModeHandler!==null,c=700-(o?.runtime??(s?0:700)),l=Ht(1/700*c,1e-4,1),u=n.strokeWidth/2,d=n.frameId&&r.get(n.frameId);switch(d&&L(d)&&(t.translate(d.x,d.y),t.beginPath(),On.radius&&t.roundRect?t.roundRect(-1,-1,d.width+1,d.height+1,On.radius/i.zoom.value):t.rect(-1,-1,d.width+1,d.height+1),t.clip(),t.translate(-d.x,-d.y)),n.type){case`magicframe`:case`frame`:t.save(),t.translate(n.x,n.y),t.lineWidth=On.strokeWidth/i.zoom.value,t.strokeStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l})`:`rgba(106, 189, 252, ${l})`,On.radius&&t.roundRect?(t.beginPath(),t.roundRect(0,0,n.width,n.height,On.radius/i.zoom.value),t.stroke(),t.closePath()):t.strokeRect(0,0,n.width,n.height),t.restore();break;default:t.save();let e=Ae(n,r),a=e[0]+i.scrollX,o=e[1]+i.scrollY;switch(t.translate(a,o),t.rotate(n.angle),t.translate(-a,-o),t.translate(n.x+i.scrollX-u,n.y+i.scrollY-u),t.lineWidth=Ht(2.5,n.strokeWidth*1.75,4)/Math.max(.25,i.zoom.value),t.strokeStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l/2})`:`rgba(106, 189, 252, ${l/2})`,n.type){case`ellipse`:t.beginPath(),t.ellipse((n.width+u*2)/2,(n.height+u*2)/2,(n.width+u*2)/2,(n.height+u*2)/2,0,0,2*Math.PI),t.closePath(),t.stroke();break;case`diamond`:{let[e,r]=ur(n,u);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+u,e[0][1]-n.y+u),t.lineTo(e[1][0]-n.x+u,e[1][1]-n.y+u),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+u,r[1]-n.y+u),t.bezierCurveTo(i[0]-n.x+u,i[1]-n.y+u,a[0]-n.x+u,a[1]-n.y+u,o[0]-n.x+u,o[1]-n.y+u),t.stroke()})}break;default:{let[e,r]=ee(n,u);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+u,e[0][1]-n.y+u),t.lineTo(e[1][0]-n.x+u,e[1][1]-n.y+u),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+u,r[1]-n.y+u),t.bezierCurveTo(i[0]-n.x+u,i[1]-n.y+u,a[0]-n.x+u,a[1]-n.y+u,o[0]-n.x+u,o[1]-n.y+u),t.stroke()})}break}t.restore();break}if(!s||(o?.runtime??0)>700)return;let f=.5*(Math.min(n.width,n.height)/2);if(!L(n)){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let e=1/700*c;if(t.strokeStyle=`rgba(0, 0, 0, 0.2)`,t.lineWidth=1/i.zoom.value,t.setLineDash([4/i.zoom.value,4/i.zoom.value]),t.lineDashOffset=-e*10/i.zoom.value,t.beginPath(),t.ellipse(n.width/2,n.height/2,f,f,0,0,2*Math.PI),t.stroke(),t.fillStyle=`rgba(0, 0, 0, 0.04)`,t.beginPath(),t.ellipse(n.width/2,n.height/2,f*(1-l),f*(1-l),0,0,2*Math.PI),t.fill(),t.restore(),i.isMidpointSnappingEnabled){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let e=5/i.zoom.value,a=e+5/i.zoom.value,o;if(n.type===`diamond`){let[,e]=ur(n),t=Ae(n,r);o=e.map(e=>{let r=ke(Os(e,.5),t,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}else{let e=Ae(n,r);o=[{x:n.width/2,y:0},{x:n.width,y:n.height/2},{x:n.width/2,y:n.height},{x:0,y:n.height/2}].map(t=>{let r=ke(O(t.x+n.x,t.y+n.y),e,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}o.forEach(e=>{t.clearRect(e.x-a,e.y-a,a*2,a*2)}),t.fillStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l})`:`rgba(106, 189, 252, ${l})`,o.forEach(n=>{t.beginPath(),t.arc(n.x,n.y,e,0,2*Math.PI),t.fill()}),t.restore()}}return{runtime:(o?.runtime??0)+a}},gR=(e,t,n,r,i,a,o)=>{if(n!==null){if(Ys(`COMPLEX_BINDINGS`))return hR(e,t,n.element,r,i,a,o);t.save(),t.translate(i.scrollX,i.scrollY),mR(t,n,r,i,e.lastPointerMoveCoords?O(e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y):null),t.restore()}},_R=(e,t,n)=>{let{angle:r,x1:i,y1:a,x2:o,y2:s,selectionColors:c,cx:l,cy:u,dashed:d,activeEmbeddable:f}=n,p=o-i,m=s-a,h=(n.padding??4)/t.zoom.value,g=8/t.zoom.value,_=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(f?4:1)/t.zoom.value;let v=c.length;for(let t=0;t<v;++t)e.strokeStyle=c[t],d&&e.setLineDash([g,_+(g+_)*(v-1)]),e.lineDashOffset=(g+_)*t,Oo(e,i-h,a-h,p+h*2,m+h*2,l,u,r);e.restore()},vR=(e,t,n,r)=>{let[i,a,o,s]=ei(n,r),c=o-i,l=s-a;e.strokeStyle=`rgb(0,118,255)`,e.lineWidth=On.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),Oo(e,i,a,c,l,i+c/2,a+l/2,n.angle,!1,On.radius/t.zoom.value),e.restore()},yR=(e,t,n,r)=>{let{colors:i=[`rgb(0,118,255)`],dashed:a=!1}=r||{},o=n.filter(e=>e.groupIds.length===0),s=n.filter(e=>e.groupIds.length>0),c=e=>{let[t,n,r,o]=Ii(e);return{angle:0,x1:t,x2:r,y1:n,y2:o,selectionColors:i,dashed:a,cx:t+(r-t)/2,cy:n+(o-n)/2,activeEmbeddable:!1}},l=e=>c(Ki(n,e));Object.entries(Kt(s,t)).filter(([e,t])=>t).map(([e,t])=>e).map(e=>l(e)).concat(o.map(e=>c([e]))).forEach(n=>_R(e,t,n))},bR=(e,t,n,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let i=I.getPointsGlobalCoordinates(n,r),{POINT_HANDLE_SIZE:a}=I,o=t.selectedLinearElement?.isEditing?a:a/2,s=dr(n),c=ca(n);if(i.forEach((r,a)=>{if(s&&a!==0&&a!==i.length-1)return;let l=a>0&&(a!==i.length-1||!c||!n.polygon)&&Tt(r,a===i.length-1?i[0]:i[a-1],2/t.zoom.value),u=!!t.selectedLinearElement?.isEditing&&!!t.selectedLinearElement?.selectedPointsIndices?.includes(a);c&&n.polygon&&!u&&a===n.points.length-1&&t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(0)&&(u=!0),pR(e,t,r,o,u,!1,l)}),dr(n)){let r=n.fixedSegments?.map(e=>e.index)||[];i.slice(0,-1).forEach((o,s)=>{I.isSegmentTooShort(n,i[s+1],i[s],s,t.zoom)||pR(e,t,O((o[0]+i[s+1][0])/2,(o[1]+i[s+1][1])/2),a/2,!1,!r.includes(s+1),!1)})}else I.getEditorMidPoints(n,r,t).filter((e,t,r)=>e!==null&&!(dr(n)&&(t===0||t===r.length-1))).forEach(n=>{(t.selectedLinearElement?.isEditing||i.length===2)&&pR(e,t,n,a/2,!1,!0,!1)});e.restore()},xR=(e,t,n,r)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([4/t.zoom.value,4/t.zoom.value]),e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(r[0],r[1]),e.stroke(),e.restore()},SR=(e,t,n,r,i)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([]),e.fillStyle=i?`rgba(134, 131, 226, 0.9)`:`rgba(255, 255, 255, 0.9)`,De(e,n[0],n[1],r/t.zoom.value,!0,!0),e.restore()},CR=({arrow:e,appState:t,type:n,context:r,elementsMap:i})=>{let a=n===`start`?e.startBinding:e.endBinding,o=a?.elementId&&i.get(a.elementId);if(!o||!un(o)||o.isDeleted)return;let s=xi(a.fixedPoint,o,i);if(!sa(s,e,o,i,t,n))return;let c=t.selectedLinearElement,l=!!c?.isDragging,u=n===`start`?0:e.points.length-1,d=!!c?.selectedPointsIndices?.includes(u);if(c?.hoveredFocusPointBinding===n&&!c.draggedFocusPointBinding&&fR(r,t,s),!(d&&l)){let s=xi(a.fixedPoint,o,i),l=c?.hoveredFocusPointBinding===n;xR(r,t,I.getPointAtIndexGlobalCoordinates(e,u,i),s),SR(r,t,s,hn/1.5,l)}},wR=(e,t,n,r,i)=>{Object.keys(r).forEach(a=>{let o=r[a];if(o!==void 0){let[r,s,c,l]=o;e.save(),e.lineWidth=1/n.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),a===`rotation`?De(e,r+c/2,s+l/2,c/2,!0):e.roundRect?(e.beginPath(),e.roundRect(r,s,c,l,2/n.zoom.value),e.fill(),e.stroke()):Oo(e,r,s,c,l,r+c/2,s+l/2,i,!0),e.restore()}})},TR=(e,t,n,r,i)=>{let[a,o,,,s,c]=ei(r,i),l=3/n.zoom.value,u=l/2,d=s-a+l,f=c-o+l,p=Math.min(20/n.zoom.value,d),m=Math.min(20/n.zoom.value,f);e.save(),e.fillStyle=t.selectionColor,e.strokeStyle=t.selectionColor,e.lineWidth=l,[[[-d,-f],[0,u],[p,u],[u,0],[u,m]],[[d-u,-f],[u,u],[-p+u,u],[0,0],[0,m]],[[-d,f],[0,-u],[p,-u],[u,0],[u,-m]],[[d-u,f],[u,-u],[-p+u,-u],[0,0],[0,-m]]].forEach(t=>{let[[n,i],[a,o],[l,u],[d,f],[p,m]]=t;e.save(),e.translate(s,c),e.rotate(r.angle),e.beginPath(),e.moveTo(n+a,i+o),e.lineTo(n+l,i+u),e.stroke(),e.beginPath(),e.moveTo(n+d,i+f),e.lineTo(n+p,i+m),e.stroke(),e.restore()}),e.restore()},ER=(e,t,n,r)=>{t.save();let i=4/n.zoom.value,a=e.width+i*2,o=e.height+i*2,s=e.x+a/2,c=e.y+o/2,l=-(a/2+i),u=-(o/2+i);t.translate(s+n.scrollX,c+n.scrollY),t.rotate(e.angle),t.lineWidth=1/n.zoom.value,t.strokeStyle=r,t.strokeRect(l,u,a,o),t.restore()},DR=({app:e,canvas:t,elementsMap:n,visibleElements:r,selectedElements:i,allElementsMap:a,scale:o,appState:s,renderConfig:c,editorInterface:l,animationState:u,deltaTime:d})=>{if(t===null)return{atLeastOneVisibleElement:!1,elementsMap:n};let[f,p]=_(t,o),m=u,h=ht({canvas:t,scale:o,normalizedWidth:f,normalizedHeight:p});h.save(),h.scale(s.zoom.value,s.zoom.value);let g;if(r.forEach(e=>{s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===e.id&&e&&(g=e)}),g&&bR(h,s,g,n),s.selectionElement&&!s.isCropping)try{Oa(s.selectionElement,h,s,c.selectionColor)}catch(e){console.error(e)}if(s.editingTextElement&&M(s.editingTextElement)){let e=a.get(s.editingTextElement.id);e&&!e.autoResize&&ER(e,h,s,c.selectionColor)}if(m=s.isBindingEnabled&&s.suggestedBinding?{...u,bindingHighlight:gR(e,h,s.suggestedBinding,a,s,d,u?.bindingHighlight)}:{...u,bindingHighlight:void 0},s.frameToHighlight&&vR(h,s,s.frameToHighlight,n),s.elementsToHighlight&&yR(h,s,s.elementsToHighlight),s.activeLockedId){let e=a.get(s.activeLockedId);yR(h,s,e?[e]:Ki(a,s.activeLockedId),{colors:[`#ced4da`],dashed:!0})}let v=i.some(e=>L(e));i.length===1&&s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===i[0].id&&bR(h,s,i[0],n);let y=s.selectedLinearElement,x=y&&I.getElement(y.elementId,a);if(x&&(s.selectedLinearElement.isDragging||(y.segmentMidPointHoveredCoords?lR(h,s):(dr(x)?y.hoverPointIndex===0||y.hoverPointIndex===x.points.length-1:y.hoverPointIndex>=0)&&uR(h,s,n)),jt(x)&&(CR({arrow:x,elementsMap:a,appState:s,context:h,type:`start`}),CR({arrow:x,elementsMap:a,appState:s,context:h,type:`end`}))),!s.multiElement&&!s.newElement&&!s.selectedLinearElement?.isEditing){let e=Jo(i,s,l),t=i.length===1&&b(i[0]);t&&s.selectedLinearElement?.elementId===i[0].id&&!i[0].locked&&bR(h,s,i[0],n);let r=c.selectionColor||`#000`;if(e){let e=lr(i),a=[];for(let i of n.values()){let o=[],l=c.remoteSelectedElementIds.get(i.id);if(t&&dr(i)&&(i.startBinding||i.endBinding)||(e.has(i.id)&&!ft(s,i)&&o.push(r),l&&o.push(...l.map(e=>iE(e,s.collaborators.get(e))))),o.length){let[e,t,r,c,u,d]=ei(i,n,!0);a.push({angle:i.angle,x1:e,y1:t,x2:r,y2:c,selectionColors:i.locked?[`#ced4da`]:o,dashed:!!l||i.locked,cx:u,cy:d,activeEmbeddable:s.activeEmbeddable?.element===i&&s.activeEmbeddable.state===`active`,padding:i.id===s.croppingElementId||io(i)?0:void 0})}}let o=e=>{let t=Ki(n,e),[r,i,o,s]=Ii(t);a.push({angle:0,x1:r,x2:o,y1:i,y2:s,selectionColors:t.some(e=>e.locked)?[`#ced4da`]:[`#000`],dashed:!0,cx:r+(o-r)/2,cy:i+(s-i)/2,activeEmbeddable:!1})};for(let e of po(s))o(e);s.editingGroupId&&o(s.editingGroupId),a.forEach(e=>_R(h,s,e))}if(h.save(),h.translate(s.scrollX,s.scrollY),i.length===1){h.fillStyle=`#fff`;let t=Ce(i[0],s.zoom,n,`mouse`,Ea(l));if(!s.viewModeEnabled&&e&&!M(s.editingTextElement)&&!s.croppingElementId&&wR(h,c,s,t,i[0].angle),s.croppingElementId&&!s.isCropping){let e=n.get(s.croppingElementId);e&&io(e)&&TR(h,c,s,e,n)}}else if(i.length>1&&!s.isRotating&&!i.some(e=>e.locked)){let e=4/s.zoom.value;h.fillStyle=`#fff`;let[t,a,o,u]=Ii(i,n),d=h.getLineDash();h.setLineDash([2/s.zoom.value]);let f=h.lineWidth;h.lineWidth=1/s.zoom.value,h.strokeStyle=r,Oo(h,t-e,a-e,o-t+e*2,u-a+e*2,(t+o)/2,(a+u)/2,0),h.lineWidth=f,h.setLineDash(d);let p=Do([t,a,o,u,(t+o)/2,(a+u)/2],0,s.zoom,`mouse`,v?{...Ea(l),rotation:!0}:Ea(l));i.some(e=>!e.locked)&&wR(h,c,s,p,0)}h.restore()}s.searchMatches?.matches.forEach(({id:e,focus:t,matchedLines:r})=>{let i=n.get(e);if(i){let[e,a,,,o,c]=ei(i,n,!0);h.save(),s.theme===R.LIGHT?t?h.fillStyle=`rgba(255, 124, 0, 0.4)`:h.fillStyle=`rgba(255, 226, 0, 0.4)`:t?h.fillStyle=`rgba(229, 82, 0, 0.4)`:h.fillStyle=`rgba(99, 52, 0, 0.4)`;let l=L(i)?s.zoom.value:1;h.translate(s.scrollX,s.scrollY),h.translate(o,c),h.rotate(i.angle),r.forEach(n=>{(n.showOnCanvas||t)&&h.fillRect(e+n.offsetX/l-o,a+n.offsetY/l-c,n.width/l,n.height/l)}),h.restore()}}),rR(h,s),h.restore(),oE({context:h,renderConfig:c,appState:s,normalizedWidth:f,normalizedHeight:p});let S;return c.renderScrollbars&&(S=tM(n,f,p,s),h.save(),h.fillStyle=eM,h.strokeStyle=`rgba(255,255,255,0.8)`,[S.horizontal,S.vertical].forEach(e=>{e&&nE(h,e.x,e.y,e.width,e.height,$j/2)}),h.restore()),{scrollBars:S,atLeastOneVisibleElement:r.length>0,elementsMap:n,animationState:m}},OR=e=>{let t=DR(e);return e.callback(t),t},kR=class e{static start(t,n){let r=n({deltaTime:0,state:void 0});r&&(e.animations.set(t,{animation:n,lastTime:0,state:r}),e.isRunning||(e.isRunning=!0,Yj()?requestAnimationFrame(e.tick):setTimeout(e.tick,0)))}static tick(){if(e.animations.size>0){for(let[t,n]of e.animations){let r=performance.now(),i=n.lastTime===0?0:r-n.lastTime,a=n.animation({deltaTime:i,state:n.state});if(a)n.lastTime=r,n.state=a;else if(e.animations.delete(t),e.animations.size===0){e.isRunning=!1;return}}Yj()?requestAnimationFrame(e.tick):setTimeout(e.tick,0)}}static running(t){return e.animations.has(t)}static cancel(t){e.animations.delete(t)}};i(kR,`isRunning`,!1),i(kR,`animations`,new Map);var AR=kR,jR=`animateInteractiveScene`,MR=e=>{let t=(0,H.useRef)(!1),n=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(!t.current){t.current=!0;return}let r=new Map,i=new Map,a=new Map,o=new Map,s=new Map;e.appState.collaborators.forEach((t,n)=>{if(t.selectedElementIds)for(let e of Object.keys(t.selectedElementIds))a.has(e)||a.set(e,[]),a.get(e).push(n);!t.pointer||t.pointer.renderCursor===!1||(t.username&&o.set(n,t.username),t.userState&&s.set(n,t.userState),i.set(n,Ci({sceneX:t.pointer.x,sceneY:t.pointer.y},e.appState)),r.set(n,t.button))});let c=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue(`--color-selection`)||`#6965db`;n.current={app:e.app,canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,allElementsMap:e.allElementsMap,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:i,remotePointerButton:r,remoteSelectedElementIds:a,remotePointerUsernames:o,remotePointerUserStates:s,selectionColor:c,renderScrollbars:e.renderScrollbars,lastViewportPosition:e.app.lastViewportPosition},editorInterface:e.editorInterface,callback:e.renderInteractiveSceneCallback,animationState:{bindingHighlight:void 0},deltaTime:0},AR.running(jR)||AR.start(jR,({deltaTime:e,state:t})=>{let r=OR({...n.current,deltaTime:e,animationState:t}).animationState;if(r){for(let e in r)if(r[e]!==void 0)return r}})}),(0,W.jsx)(`canvas`,{className:`excalidraw__canvas interactive`,style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled&&e.appState.activeTool.type!==`laser`?Kn.GRAB:Kn.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:K(`labels.drawingCanvas`)})},NR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,activeTool:e.activeTool,openDialog:e.openDialog,editingGroupId:e.editingGroupId,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,newElement:e.newElement,isBindingEnabled:e.isBindingEnabled,isMidpointSnappingEnabled:e.isMidpointSnappingEnabled,suggestedBinding:e.suggestedBinding,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled,editingTextElement:e.editingTextElement,isCropping:e.isCropping,croppingElementId:e.croppingElementId,searchMatches:e.searchMatches,activeLockedId:e.activeLockedId,hoveredElementIds:e.hoveredElementIds,frameRendering:e.frameRendering,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,currentItemArrowType:e.currentItemArrowType}),PR=H.memo(MR,(e,t)=>e.selectionNonce!==t.selectionNonce||e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements||e.renderScrollbars!==t.renderScrollbars?!1:ji(NR(e.appState),NR(t.appState))),FR=e=>{let t=(0,H.useRef)(null),n=(0,H.useRef)(!1);return(0,H.useEffect)(()=>{e.canvas.style.width=`${e.appState.width}px`,e.canvas.style.height=`${e.appState.height}px`,e.canvas.width=e.appState.width*e.scale,e.canvas.height=e.appState.height*e.scale},[e.appState.height,e.appState.width,e.canvas,e.scale]),(0,H.useEffect)(()=>{let r=t.current;if(!r)return;let i=e.canvas;n.current||(n.current=!0,r.replaceChildren(i),i.classList.add(`excalidraw__canvas`,`static`)),We({canvas:i,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},Yj())}),(0,W.jsx)(`div`,{className:`excalidraw__canvas-wrapper`,ref:t})},IR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,hoveredElementIds:e.hoveredElementIds,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,gridStep:e.gridStep,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId,currentHoveredFontFamily:e.currentHoveredFontFamily,croppingElementId:e.croppingElementId,suggestedBinding:e.suggestedBinding}),LR=H.memo(FR,(e,t)=>e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:ji(IR(e.appState),IR(t.appState))&&ji(e.renderConfig,t.renderConfig)),RR=({canvas:e,rc:t,newElement:n,elementsMap:r,allElementsMap:i,scale:a,appState:o,renderConfig:s})=>{if(e){let[c,l]=_(e,a),u=ht({canvas:e,scale:a,normalizedWidth:c,normalizedHeight:l});if(u.save(),u.scale(o.zoom.value,o.zoom.value),n&&n.type!==`selection`){if(na(n))return;if((n.frameId||o.frameToHighlight?.id)&&o.frameRendering.enabled&&o.frameRendering.clip){let e=Ts(n,r,o);e&&Yr(n,e,o,r)&&Ws(e,u,s,o)}_t(n,r,i,t,u,s,o)}else u.clearRect(0,0,c,l);u.restore()}},zR=mi(e=>{RR(e)}),BR=(e,t)=>{if(t){zR(e);return}RR(e)},VR=e=>{let t=(0,H.useRef)(null);return(0,H.useEffect)(()=>{t.current&&BR({canvas:t.current,scale:e.scale,newElement:e.appState.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},Yj())}),(0,W.jsx)(`canvas`,{className:`excalidraw__canvas`,style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:t})},HR=class{constructor(e){this.getState=e,i(this,`listeners`,[]),i(this,`onStateChange`,(e,t,n)=>{let{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}=this.normalize(e,t,n);return a?s&&(queueMicrotask(()=>{let e=this.getState();a(i(e),e)}),o)?()=>{}:this.subscribe({predicate:r,getValue:i,callback:a,once:o}):s?Promise.resolve(i(this.getState())):new Promise(e=>{this.subscribe({predicate:r,getValue:i,callback:t=>e(t),once:!0})})})}isStateChangePredicateOptions(e){return typeof e==`object`&&!Array.isArray(e)&&`predicate`in e}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}normalize(e,t,n){let r,i,a=t,o=n?.once??!1,s=!1;if(this.isStateChangePredicateOptions(e)){let{predicate:t,callback:n,once:c}=e;r=t,i=e=>e,a=n?(e,t)=>n(t):void 0,o=c??!1,s=t(this.getState())}else if(typeof e==`function`){let t=e;r=(e,n)=>t(e)!==t(n),i=e=>t(e)}else if(Array.isArray(e)){let t=e;r=(e,n)=>t.some(t=>e[t]!==n[t]),i=e=>e}else{let t=e;r=(e,n)=>e[t]!==n[t],i=e=>e[t]}return{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}}flush(e){if(!this.listeners.length)return;let t=this.getState(),n=[];for(let r of this.listeners)r.predicate(t,e)?(r.callback(r.getValue(t),t),r.once||n.push(r)):n.push(r);this.listeners=n}clear(){this.listeners=[]}},UR=({app:e,activeLockedId:t})=>{let n=e.scene.getElement(t),r=n?[n]:Ki(e.scene.getNonDeletedElementsMap(),t);if(r.length===0)return null;let[i,a]=Ii(r),{x:o,y:s}=Ci({sceneX:i,sceneY:a},e.state);return(0,W.jsx)(`div`,{className:`UnlockPopup`,style:{bottom:`${e.state.height+12-s+e.state.offsetTop}px`,left:`${o-e.state.offsetLeft}px`},onClick:()=>{(0,_c.flushSync)(()=>{let t=Kt(r,e.state);e.setState({selectedElementIds:r.reduce((e,t)=>({...e,[t.id]:!0}),{}),selectedGroupIds:t,activeLockedId:null})}),e.actionManager.executeAction(ZE)},title:K(`labels.elementLock.unlock`),children:qy})},WR=H.createContext(null),GR=H.createContext(null),KR={formFactor:`desktop`,desktopUIMode:`full`,userAgent:Ko(typeof navigator<`u`?navigator.userAgent:``),isTouchScreen:!1,canFitSidebar:!1,isLandscape:!0},qR=H.createContext(KR);qR.displayName=`EditorInterfaceContext`;var JR={"editor:mount":{cardinality:`once`,replay:`last`},"editor:initialize":{cardinality:`once`,replay:`last`},"editor:unmount":{cardinality:`once`,replay:`last`}},YR=H.createContext({container:null,id:null});YR.displayName=`ExcalidrawContainerContext`;var XR=H.createContext([]);XR.displayName=`ExcalidrawElementsContext`;var ZR=H.createContext({...cs(),width:0,height:0,offsetLeft:0,offsetTop:0});ZR.displayName=`ExcalidrawAppStateContext`;var QR=H.createContext(()=>{console.warn(`Uninitialized ExcalidrawSetAppStateContext context!`)});QR.displayName=`ExcalidrawSetAppStateContext`;var $R=H.createContext(null);$R.displayName=`ExcalidrawActionManagerContext`;var ez=H.createContext(null);ez.displayName=`ExcalidrawAPIContext`;var tz=H.createContext(null);tz.displayName=`ExcalidrawAPISetContext`;var nz=()=>(0,H.useContext)(WR),rz=()=>(0,H.useContext)(GR),iz=()=>(0,H.useContext)(qR),az=()=>Ka(iz()),oz=()=>(0,H.useContext)(YR),sz=()=>(0,H.useContext)(XR),cz=()=>(0,H.useContext)(ZR),lz=()=>(0,H.useContext)(QR),uz=()=>(0,H.useContext)($R),dz=!1,fz=0,pz=null,mz=!1,hz=!1,gz=!1,_z={horizontal:null,vertical:null},vz=0,yz=!1,bz=new Map,xz=!1,Sz=0,Cz=!1,wz=null,Tz={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},Ez=class e extends H.Component{constructor(t){super(t),i(this,`canvas`),i(this,`interactiveCanvas`,null),i(this,`sessionExportThemeOverride`),i(this,`rc`),i(this,`unmounted`,!1),i(this,`actionManager`),i(this,`editorInterface`,KR),i(this,`stylesPanelMode`,Ka(KR)),i(this,`excalidrawContainerRef`,H.createRef()),i(this,`scene`),i(this,`fonts`),i(this,`renderer`),i(this,`visibleElements`),i(this,`resizeObserver`),i(this,`library`),i(this,`libraryItemsFromStorage`),i(this,`id`),i(this,`store`),i(this,`history`),i(this,`excalidrawContainerValue`),i(this,`files`,{}),i(this,`imageCache`,new Map),i(this,`iFrameRefs`,new Map),i(this,`embedsValidationStatus`,new Map),i(this,`initializedEmbeds`,new Set),i(this,`elementsPendingErasure`,new Set),i(this,`_initialized`,!1),i(this,`editorLifecycleEvents`,new ve(JR)),i(this,`onEvent`,this.editorLifecycleEvents.on.bind(this.editorLifecycleEvents)),i(this,`appStateObserver`,new HR(()=>this.state)),i(this,`onStateChange`,this.appStateObserver.onStateChange),i(this,`flowChartCreator`,new ea),i(this,`flowChartNavigator`,new fn),i(this,`bindModeHandler`,null),i(this,`hitLinkElement`),i(this,`lastPointerDownEvent`,null),i(this,`lastPointerUpEvent`,null),i(this,`lastPointerMoveEvent`,null),i(this,`lastPointerMoveCoords`,null),i(this,`previousPointerMoveCoords`,null),i(this,`lastViewportPosition`,{x:0,y:0}),i(this,`animationFrameHandler`,new pj),i(this,`laserTrails`,new Kj(this.animationFrameHandler,this)),i(this,`eraserTrail`,new cM(this.animationFrameHandler,this)),i(this,`lassoTrail`,new sM(this.animationFrameHandler,this)),i(this,`onChangeEmitter`,new Be),i(this,`onPointerDownEmitter`,new Be),i(this,`onPointerUpEmitter`,new Be),i(this,`onUserFollowEmitter`,new Be),i(this,`onScrollChangeEmitter`,new Be),i(this,`missingPointerEventCleanupEmitter`,new Be),i(this,`onRemoveEventListenersEmitter`,new Be),i(this,`api`),i(this,`updateEditorAtom`,(e,...t)=>{let n=Cy.set(e,...t);return this.triggerRender(),n}),i(this,`previousHoveredBindableElement`,null),i(this,`getEffectiveGridSize`,()=>Sj(this)?this.state.gridSize:null),i(this,`handleIframeLikeElementHover`,({hitElement:e,scenePointer:t,moveEvent:n})=>e&&Rs(e)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(e,n,t.x,t.y))?(Gw(this.interactiveCanvas,Kn.POINTER),this.setState({activeEmbeddable:{element:e,state:`hover`}}),!0):(this.state.activeEmbeddable?.state===`hover`&&this.setState({activeEmbeddable:null}),!1)),i(this,`updateEmbedValidationStatus`,(e,t)=>{this.embedsValidationStatus.set(e.id,t),bn.delete(e)}),i(this,`updateEmbeddables`,()=>{let e=new Set,t=!1;this.scene.getNonDeletedElements().filter(n=>{if(rs(n)){if(e.add(n.id),!this.embedsValidationStatus.has(n.id)){t=!0;let e=Lt(n.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(n,e)}}else Vs(n)&&e.add(n.id);return!1}),t&&this.scene.triggerUpdate(),this.iFrameRefs.forEach((t,n)=>{e.has(n)||this.iFrameRefs.delete(n)})}),i(this,`getFrameNameDOMId`,e=>`${this.id}-frame-name-${e.id}`),i(this,`frameNameBoundsCache`,{get:e=>{let t=this.frameNameBoundsCache._cache.get(e.id);if(!t||t.zoom!==this.state.zoom.value||t.versionNonce!==e.versionNonce){let n=document.getElementById(this.getFrameNameDOMId(e));if(n){let r=n.getBoundingClientRect(),i=la({clientX:r.x,clientY:r.y},this.state),a=la({clientX:r.right,clientY:r.bottom},this.state);return t={x:i.x,y:i.y,width:a.x-i.x,height:a.y-i.y,angle:0,zoom:this.state.zoom.value,versionNonce:e.versionNonce},this.frameNameBoundsCache._cache.set(e.id,t),t}return null}return t},_cache:new Map}),i(this,`resetEditingFrame`,e=>{e&&this.scene.mutateElement(e,{name:e.name?.trim()||null}),this.setState({editingFrame:null})}),i(this,`renderFrameNames`,()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return this.state.editingFrame&&this.resetEditingFrame(null),null;let e=this.state.theme===R.DARK,t=this.scene.getNonDeletedFramesLikes(),n=t.length>0&&this.state.searchMatches?.focusedId&&L(this.scene.getElement(this.state.searchMatches.focusedId))?this.state.searchMatches.matches.find(e=>e.focus):null;return t.map(t=>{if(!vn(t,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap()))return this.state.editingFrame===t.id&&this.resetEditingFrame(t),null;let{x:r,y:i}=Ci({sceneX:t.x,sceneY:t.y},this.state),a,o=ua(t);if(t.id===this.state.editingFrame){let n=o;a=(0,W.jsx)(`input`,{autoFocus:!0,value:n,onChange:e=>{this.scene.mutateElement(t,{name:e.target.value})},onFocus:e=>e.target.select(),onBlur:()=>this.resetEditingFrame(t),onKeyDown:e=>{(e.key===N.ESCAPE||e.key===N.ENTER)&&this.resetEditingFrame(t)},style:{background:e?D(this.state.viewBackgroundColor):this.state.viewBackgroundColor,zIndex:2,border:`none`,display:`block`,padding:`6px`,borderRadius:4,boxShadow:`inset 0 0 0 1px var(--color-primary)`,fontFamily:`Assistant`,fontSize:`${On.nameFontSize}px`,transform:`translate(-6px, 6px)`,color:e?On.nameColorDarkTheme:On.nameColorLightTheme,overflow:`hidden`,maxWidth:`${document.body.clientWidth-r-6}px`},size:n.length+1||1,dir:`auto`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`})}else a=o;return(0,W.jsx)(`div`,{id:this.getFrameNameDOMId(t),className:Qn.FRAME_NAME,style:{position:`absolute`,bottom:`${this.state.height+On.nameOffsetY-i+this.state.offsetTop}px`,left:`${r-this.state.offsetLeft}px`,zIndex:2,fontSize:On.nameFontSize,color:e?On.nameColorDarkTheme:On.nameColorLightTheme,lineHeight:On.nameLineHeight,width:`max-content`,maxWidth:n?.id===t.id&&n?.focus?`none`:`${t.width*this.state.zoom.value}px`,overflow:t.id===this.state.editingFrame?`visible`:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,cursor:Kn.MOVE,pointerEvents:this.state.viewModeEnabled?uo.disabled:uo.enabled},onPointerDown:e=>this.handleCanvasPointerDown(e),onWheel:e=>this.handleWheel(e),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:t.id})},children:a},t.id)})}),i(this,`focusContainer`,()=>{this.excalidrawContainerRef.current?.focus()}),i(this,`getSceneElementsIncludingDeleted`,()=>this.scene.getElementsIncludingDeleted()),i(this,`getSceneElementsMapIncludingDeleted`,()=>this.scene.getElementsMapIncludingDeleted()),i(this,`getSceneElements`,()=>this.scene.getNonDeletedElements()),i(this,`onInsertElements`,e=>{this.addElementsFromPasteOrLibrary({elements:e,position:`center`,files:null})}),i(this,`onExportImage`,async(e,t,n)=>{dC(`export`,e,`ui`);let r=await PT(e,t,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:n.exportingFrame}).catch(te).catch(e=>{console.error(e),this.setState({errorMessage:e.message})});this.state.exportEmbedScene&&r&&ja(r)&&this.setState({fileHandle:r})}),i(this,`magicGenerations`,new Map),i(this,`updateMagicGeneration`,({frameElement:e,data:t})=>{t.status===`pending`?this.scene.mutateElement(e,{customData:{generationData:void 0}},{informMutation:!1,isDragging:!1}):this.scene.mutateElement(e,{customData:{generationData:t}},{informMutation:!1,isDragging:!1}),this.magicGenerations.set(e.id,t),this.triggerRender()}),i(this,`plugins`,{}),i(this,`onMagicframeToolSelect`,()=>{let e=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(e.length===0)this.setActiveTool({type:va.magicframe}),dC(`ai`,`tool-select (empty-selection)`,`d2c`);else{let t=e.length===1&&xe(e[0])&&e[0];if(!t&&e.some(e=>L(e)||e.frameId)){this.setActiveTool({type:va.magicframe});return}dC(`ai`,`tool-select (existing selection)`,`d2c`);let n;if(t)n=t;else{let[t,r,i,a]=Ii(e);n=Pn({...On,x:t-50,y:r-50,width:i-t+100,height:a-r+100,opacity:100,locked:!1}),this.scene.insertElement(n);for(let t of e)this.scene.mutateElement(t,{frameId:n.id});this.setState({selectedElementIds:{[n.id]:!0}})}this.onMagicFrameGenerate(n,`upstream`)}}),i(this,`openEyeDropper`,({type:e})=>{this.updateEditorAtom(bC,{swapPreviewOnAlt:!0,colorPickerType:e===`stroke`?`elementStroke`:`elementBackground`,onSelect:(t,n)=>{let r=e===`background`&&n.altKey||e===`stroke`&&!n.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!==`selection`?r?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:t},captureUpdate:V.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:t},captureUpdate:V.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(e=>this.state.selectedElementIds[e.id]?B(e,{[r?`strokeColor`:`backgroundColor`]:t}):e),captureUpdate:V.IMMEDIATELY})},keepOpenOnAlt:!1})}),i(this,`dismissLinearEditor`,()=>{setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isEditing:!1}})})}),i(this,`syncActionResult`,qj(e=>{if(this.unmounted||e===!1)return;this.store.scheduleAction(e.captureUpdate);let t=!1,n=null;if(e.elements&&(this.scene.replaceAllElements(e.elements),t=!0),e.files&&(this.addMissingFiles(e.files,e.replaceFiles),this.addNewImagesToImageCache()),e.appState||n||this.state.contextMenu){let r=e?.appState?.viewModeEnabled||!1,i=e?.appState?.zenModeEnabled||!1,a=e?.appState?.theme||this.props.theme||R.LIGHT,o=e?.appState?.name??this.state.name,s=e?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<`u`&&(r=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<`u`&&(i=this.props.zenModeEnabled),n=e.appState?.editingTextElement||null,e.elements&&n&&e.elements.forEach(e=>{n?.id===e.id&&n!==e&&Is(e)&&M(e)&&(n=e)}),n?.isDeleted&&(n=null),this.setState(t=>{let c=e.appState||{};return{...t,...c,contextMenu:null,editingTextElement:n,viewModeEnabled:r,zenModeEnabled:i,theme:a,name:o,errorMessage:s}}),t=!0}t||this.scene.triggerUpdate()})),i(this,`onBlur`,qj(()=>{mz=!1,this.setState({isBindingEnabled:this.state.bindingPreference===`enabled`})})),i(this,`onUnload`,()=>{this.onBlur()}),i(this,`disableEvent`,e=>{e.preventDefault()}),i(this,`resetHistory`,()=>{this.history.clear()}),i(this,`resetStore`,()=>{this.store.clear()}),i(this,`resetScene`,qj(e=>{this.scene.replaceAllElements([]),this.setState(t=>({...cs(),isLoading:e?.resetLoadingState?!1:t.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()})),i(this,`initializeScene`,async()=>{`launchQueue`in window&&`LaunchParams`in window&&window.launchQueue.setConsumer(async e=>{if(!e.files.length)return;let t=e.files[0],n=await t.getFile();this.loadFileToCanvas(new File([n],n.name||``,{type:n.type}),t)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let e=null;try{e=typeof this.props.initialData==`function`?await this.props.initialData()||null:await this.props.initialData||null,e?.libraryItems&&this.library.updateLibrary({libraryItems:e.libraryItems,merge:!0}).catch(e=>{console.error(e)})}catch(t){console.error(t),e={appState:{errorMessage:t.message||`Encountered an error during importing or restoring scene data`}}}let t=Sa(e?.elements,null,{repairBindings:!0,deleteInvisibleElements:!0}),n=gr(e?.appState,null),r=n.activeTool;n.preferredSelectionTool.initialized||(n.preferredSelectionTool={type:this.editorInterface.formFactor===`phone`?`lasso`:`selection`,initialized:!0}),n={...n,theme:this.props.theme||n.theme,openSidebar:n?.openSidebar||this.state.openSidebar,activeTool:r.type===`image`||r.type===`lasso`||r.type===`selection`?{...r,type:n.preferredSelectionTool.type}:n.activeTool,isLoading:!1,toast:this.state.toast},e?.scrollToContent&&(n={...n,...An(t,{...n,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.resetStore(),this.resetHistory(),this.syncActionResult({elements:t,appState:n,files:e?.files,captureUpdate:V.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(e=>{this.fonts.onLoaded(e)}),Bn(window.location.href)&&this.scrollToContent(window.location.href,{animate:!1})}),i(this,`getFormFactor`,(e,t)=>this.props.UIOptions.getFormFactor?.(e,t)??$a(e,t)),i(this,`refreshEditorInterface`,()=>{let e=this.excalidrawContainerRef.current;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect(),r=Zs(),i=Ko(typeof navigator<`u`?navigator.userAgent:``),a=this.props.UIOptions.dockedSidebarBreakpoint==null?Qi:this.props.UIOptions.dockedSidebarBreakpoint,o=Jr(this.editorInterface,{desktopUIMode:r??this.editorInterface.desktopUIMode,formFactor:this.getFormFactor(t,n),userAgent:i,canFitSidebar:t>a,isLandscape:t>n});this.editorInterface=o,this.reconcileStylesPanelMode(o)}),i(this,`reconcileStylesPanelMode`,e=>{let t=Ka(e);if(t===this.stylesPanelMode)return;let n=this.stylesPanelMode;this.stylesPanelMode=t,n!==`full`&&t===`full`&&this.setState(e=>({preferredSelectionTool:{type:`selection`,initialized:!0}}))}),i(this,`setDesktopUIMode`,e=>{let t=Ar(e);this.editorInterface=Jr(this.editorInterface,{desktopUIMode:t}),this.reconcileStylesPanelMode(this.editorInterface)}),i(this,`onResize`,qj(()=>{this.scene.getElementsIncludingDeleted().forEach(e=>bn.delete(e)),this.refreshEditorInterface(),this.updateDOMRect(),this.setState({})})),i(this,`onFullscreenChange`,()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state===`active`&&this.setState({activeEmbeddable:null})}),i(this,`renderInteractiveSceneCallback`,({atLeastOneVisibleElement:e,scrollBars:t,elementsMap:n})=>{t&&(_z=t);let r=this.state.editingTextElement?!1:!e&&n.size>0;this.state.scrolledOutside!==r&&this.setState({scrolledOutside:r}),this.scheduleImageRefresh()}),i(this,`onScroll`,wt(()=>{let{offsetTop:e,offsetLeft:t}=this.getCanvasOffsets();this.setState(n=>n.offsetLeft===t&&n.offsetTop===e?null:{offsetTop:e,offsetLeft:t})},100)),i(this,`onCut`,qj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Wr(e.target)||(this.actionManager.executeAction(yE,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onCopy`,qj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Wr(e.target)||(this.actionManager.executeAction(_E,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onTouchStart`,t=>{if(Yo&&t.preventDefault(),!dz){dz=!0,t.touches.length===1&&(pz={x:t.touches[0].clientX,y:t.touches[0].clientY}),clearTimeout(fz),fz=window.setTimeout(e.resetTapTwice,300);return}if(dz&&t.touches.length===1&&pz){let e=t.touches[0];Se(O(e.clientX,e.clientY),O(pz.x,pz.y))<=35&&(this.lassoTrail.endPath(),this.deselectElements(),this.handleCanvasDoubleClick({clientX:e.clientX,clientY:e.clientY})),dz=!1,clearTimeout(fz)}t.touches.length===2&&this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null})}),i(this,`onTouchEnd`,e=>{this.resetContextMenuTimer(),e.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:P(this.state.previousSelectedElementIds,this.state)}):Tz.pointers.clear()}),i(this,`pasteFromClipboard`,qj(async e=>{let t=!!xz,n=document.activeElement,r=this.excalidrawContainerRef.current?.contains(n);if(e&&!r)return;let i=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(e&&(!(i instanceof HTMLCanvasElement)||Wr(n)))return;let a=await DT(e),o=a.getFiles(),s=await OT(a,t);if(this.props.onPaste)try{if(await this.props.onPaste(s,e)===!1)return}catch(e){console.error(e)}await this.insertClipboardContent(s,o,t),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),e?.preventDefault()})),i(this,`addElementsFromPasteOrLibrary`,e=>{let t=Sa(e.elements,null,{deleteInvisibleElements:!0}),[n,r,i,a]=Ii(t),o=fr(n,i)/2,s=fr(r,a)/2,{x:c,y:l}=la({clientX:typeof e.position==`object`?e.position.clientX:e.position===`cursor`?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,clientY:typeof e.position==`object`?e.position.clientY:e.position===`cursor`?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop},this.state),[u,d]=It(c-o,l-s,this.getEffectiveGridSize()),{duplicatedElements:f}=Er({type:`everything`,elements:t.map(e=>B(e,{x:e.x+u-n,y:e.y+d-r})),randomizeSeed:!e.retainSeed}),p=this.scene.getElementsIncludingDeleted(),m=[...p,...f];m=this.props.onDuplicate?.(m,p)||m,fe(m,lr(f));let h=this.getTopLayerFrameAtSceneCoords({x:c,y:l});if(h){let e=ze(f,h);Je(m,e,h,this.state)}this.scene.replaceAllElements(m),f.forEach(e=>{M(e)&&ya(e)&&Zi(e,so(e,this.scene.getElementsMapIncludingDeleted()),this.scene)}),Or&&de.loadElementsFonts(f).then(e=>{this.fonts.onLoaded(e)}),e.files&&this.addMissingFiles(e.files);let g=Zn(f);this.store.scheduleCapture(),this.setState({...this.state,openSidebar:this.state.openSidebar&&this.editorInterface.canFitSidebar&&Cy.get(rP)?this.state.openSidebar:null,...Hr({editingGroupId:null,selectedElementIds:g.reduce((e,t)=>(ya(t)||(e[t.id]=!0),e),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{e.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),e.fitToContent&&this.scrollToContent(f,{fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()})}),i(this,`setAppState`,(e,t)=>{this.setState(e,t)}),i(this,`removePointer`,e=>{vz&&this.resetContextMenuTimer(),Tz.pointers.delete(e.pointerId)}),i(this,`toggleLock`,(e=`ui`)=>{this.state.activeTool.locked||dC(`toolbar`,`toggleLock`,`${e} (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),this.setState(e=>({activeTool:{...e.activeTool,...ka(this.state,e.activeTool.locked?{type:this.state.preferredSelectionTool.type}:e.activeTool),locked:!e.activeTool.locked}}))}),i(this,`updateFrameRendering`,e=>{this.setState(t=>{let n=typeof e==`function`?e(t.frameRendering):e;return{frameRendering:{enabled:n?.enabled??t.frameRendering.enabled,clip:n?.clip??t.frameRendering.clip,name:n?.name??t.frameRendering.name,outline:n?.outline??t.frameRendering.outline}}})}),i(this,`togglePenMode`,e=>{this.setState(t=>({penMode:e??!t.penMode,penDetected:!0}))}),i(this,`onHandToolToggle`,()=>{this.actionManager.executeAction(aT)}),i(this,`zoomCanvas`,e=>{this.setState({...Xw({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:_i(e)},this.state)})}),i(this,`cancelInProgressAnimation`,null),i(this,`scrollToContent`,(e=this.scene.getNonDeletedElements(),t)=>{if(typeof e==`string`){let n;if(n=Bn(e)?ne(e):e,n){let r=this.scene.getElementsFromId(n);r?.length?this.scrollToContent(r,{fitToContent:t?.fitToContent??!0,animate:t?.animate??!0}):Bn(e)&&this.setState({toast:{message:K(`elementLink.notFound`),duration:3e3,closable:!0}})}return}this.cancelInProgressAnimation?.();let n=Array.isArray(e)?e:[e],r=this.state.zoom,i=this.state.scrollX,a=this.state.scrollY;if(t?.fitToContent||t?.fitToViewport){let{appState:e}=rT({canvasOffsets:t.canvasOffsets,targetElements:n,appState:this.state,fitToViewport:!!t?.fitToViewport,viewportZoomFactor:t?.viewportZoomFactor,minZoom:t?.minZoom,maxZoom:t?.maxZoom});r=e.zoom,i=e.scrollX,a=e.scrollY}else{let e=An(n,this.state);i=e.scrollX,a=e.scrollY}if(t?.animate){let e=this.state.scrollX,n=this.state.scrollY,o=this.state.zoom.value,s=Ot({fromValues:{scrollX:e,scrollY:n,zoom:o},toValues:{scrollX:i,scrollY:a,zoom:r.value},interpolateValue:(e,t,n,r)=>{if(r===`zoom`)return e*(t/e)**+Oe(n)},onStep:({scrollX:e,scrollY:t,zoom:n})=>{this.setState({scrollX:e,scrollY:t,zoom:{value:n}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.setState({shouldCacheIgnoreZoom:!1})},duration:t?.duration??500});this.cancelInProgressAnimation=()=>{s(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:i,scrollY:a,zoom:r})}),i(this,`maybeUnfollowRemoteUser`,()=>{this.state.userToFollow&&this.setState({userToFollow:null})}),i(this,`translateCanvas`,e=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(e)}),i(this,`setToast`,e=>{this.setState({toast:e})}),i(this,`restoreFileFromShare`,async()=>{try{let e=await caches.open(`web-share-target`),t=await e.match(`shared-file`);if(t){let n=await t.blob(),r=new File([n],n.name||``,{type:n.type});this.loadFileToCanvas(r,null),await e.delete(`shared-file`),window.history.replaceState(null,dt,window.location.pathname)}}catch(e){this.setState({errorMessage:e.message})}}),i(this,`addFiles`,qj(e=>{let{addedFiles:t}=this.addMissingFiles(e);this.clearImageShapeCache(t),this.scene.triggerUpdate(),this.addNewImagesToImageCache()})),i(this,`addMissingFiles`,(e,t=!1)=>{let n=t?{}:{...this.files},r={},i=Array.isArray(e)?e:Object.values(e);for(let e of i)if(!n[e.id]&&(r[e.id]=e,n[e.id]=e,e.mimeType===hs.svg))try{let t=Qo(ae(Jn(e.dataURL)),hs.svg);e.dataURL!==t&&(e.version=(e.version??1)+1,e.dataURL=t)}catch(e){console.error(e)}return this.files=n,{addedFiles:r}}),i(this,`updateScene`,qj(e=>{let{elements:t,appState:n,collaborators:r,captureUpdate:i}=e;if(i){let e=t||void 0,r=n?Oi({...this.store.snapshot.appState,...n}):void 0;this.store.scheduleMicroAction({action:i,elements:e,appState:r})}n&&this.setState(n),t&&this.scene.replaceAllElements(t),r&&this.setState({collaborators:r})})),i(this,`applyDeltas`,(e,t)=>{let n=Ps.squash(...e),r={...this.state},i=new Map(this.scene.getElementsMapIncludingDeleted());return Ps.applyTo(n,i,r,t)}),i(this,`mutateElement`,(e,t,n=!0)=>this.scene.mutateElement(e,t,{informMutation:n,isDragging:!1})),i(this,`triggerRender`,e=>{e===!0?this.scene.triggerUpdate():this.setState({})}),i(this,`toggleSidebar`,({name:e,tab:t,force:n})=>{let r;r=n===void 0?this.state.openSidebar?.name===e&&this.state.openSidebar?.tab===t?null:e:n?e:null;let i=r?{name:r}:null;return i&&t&&(i.tab=t),this.setState({openSidebar:i}),!!r}),i(this,`updateCurrentCursorPosition`,qj(e=>{this.lastViewportPosition.x=e.clientX,this.lastViewportPosition.y=e.clientY})),i(this,`getEditorUIOffsets`,()=>{let e=this.excalidrawContainerRef?.current?.querySelector(`.App-toolbar`)?.getBoundingClientRect()?.bottom??0,t=this.excalidrawContainerRef?.current?.querySelector(`.sidebar`)?.getBoundingClientRect(),n=this.excalidrawContainerRef?.current?.querySelector(`.App-menu__left`)?.getBoundingClientRect();return My().rtl?{top:e+16,right:Math.max(this.state.width-(n?.left??this.state.width),0)+16,bottom:16,left:Math.max(t?.right??0,0)+16}:{top:e+16,right:Math.max(this.state.width-(t?.left??this.state.width)+16,0),bottom:16,left:Math.max(n?.right??0,0)+16}}),i(this,`onKeyDown`,qj(e=>{if(`Proxy`in window&&(!e.shiftKey&&/^[A-Z]$/.test(e.key)||e.shiftKey&&/^[a-z]$/.test(e.key))&&(e=new Proxy(e,{get(t,n){let r=t[n];return typeof r==`function`?r.bind(t):n===`key`?e.shiftKey?t.key.toUpperCase():t.key.toLowerCase():r}})),!Zr(e.target)){if((e.key===N.ESCAPE||e.key===N.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}let t=ir(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&io(t[0])&&e.key===N.ENTER){this.startImageCropping(t[0]);return}if(e.key===N.ESCAPE)this.updateEditorAtom(sD,null);else if(e.key===N.TAB&&(document.activeElement===this.excalidrawContainerRef?.current||document.activeElement?.classList.contains(Qn.CONVERT_ELEMENT_TYPE_POPUP))){e.preventDefault();let n=mD(t);Cy.get(sD)?.type===`panel`&&pD(this,{conversionType:n,direction:e.shiftKey?`left`:`right`})&&this.store.scheduleCapture(),n&&this.updateEditorAtom(sD,{type:`panel`})}if(e.key===N.ESCAPE&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.clear(),this.triggerRender(!0);return}let n=Pe(e.key);if(e[N.CTRL_OR_CMD]&&n&&!e.shiftKey){e.preventDefault();let t=ir(this.scene.getNonDeletedElementsMap(),this.state);t.length===1&&Vi(t[0])&&this.flowChartCreator.createNodes(t[0],this.state,Qe(e.key),this.scene),this.flowChartCreator.pendingNodes?.length&&!ms(this.flowChartCreator.pendingNodes,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(this.flowChartCreator.pendingNodes,{animate:!0,duration:300,fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()});return}if(e.altKey){let t=ir(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&n){e.preventDefault();let n=this.flowChartNavigator.exploreByDirection(t[0],this.scene.getNonDeletedElementsMap(),Qe(e.key));if(n){this.setState(e=>({selectedElementIds:P({[n]:!0},e)}));let e=this.scene.getNonDeletedElementsMap().get(n);e&&!ms([e],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(e,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})}return}}}if(e[N.CTRL_OR_CMD]&&e.key===N.P&&!e.shiftKey&&!e.altKey){this.setToast({message:K(`commandPalette.shortcutHint`,{shortcut:ND(`commandPalette`)})}),e.preventDefault();return}if(e[N.CTRL_OR_CMD]&&e.key.toLowerCase()===N.V&&(xz=e.shiftKey,clearTimeout(Sz),Sz=window.setTimeout(()=>{xz=!1},100)),e[N.CTRL_OR_CMD]&&Wr(e.target)&&(e.code===Gs.MINUS||e.code===Gs.EQUAL)){e.preventDefault();return}if(Wr(e.target)&&e.key!==N.ESCAPE||Pe(e.key)&&Zr(e.target))return;if(e.key===N.QUESTION_MARK){this.setState({openDialog:{name:`help`}});return}else if(e.key.toLowerCase()===N.E&&e.shiftKey&&e[N.CTRL_OR_CMD]){e.preventDefault(),this.setState({openDialog:{name:`imageExport`}});return}if(e.key===N.PAGE_UP||e.key===N.PAGE_DOWN){let t=(e.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;e.key===N.PAGE_DOWN&&(t=-t),e.shiftKey?this.translateCanvas(e=>({scrollX:e.scrollX+t})):this.translateCanvas(e=>({scrollY:e.scrollY+t}))}if(this.state.openDialog?.name===`elementLinkSelector`||(e.key===N.ALT&&(Ys(`COMPLEX_BINDINGS`)?this.handleSkipBindMode():C({app:this,event:e})),this.actionManager.handleKeyDown(e)))return;let t=this.props.viewModeEnabled===!0;if(!t&&this.state.viewModeEnabled&&e.key===N.ESCAPE){this.setActiveTool({type:`selection`});return}if(!t&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged){let t=mk(e.key,this);if(this.state.viewModeEnabled&&!v(t,[`laser`,`hand`]))return;if(t){this.state.activeTool.type!==t&&dC(`toolbar`,t,`keyboard (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),t===`arrow`&&this.state.activeTool.type===`arrow`&&this.setState(e=>({currentItemArrowType:e.currentItemArrowType===ts.sharp?ts.round:e.currentItemArrowType===ts.round?ts.elbow:ts.sharp})),t===`lasso`&&this.state.activeTool.type===`laser`?this.setActiveTool({type:this.state.preferredSelectionTool.type}):this.setActiveTool({type:t}),e.stopPropagation();return}else if(e.key===N.Q){this.toggleLock(`keyboard`),e.stopPropagation();return}}if(this.state.viewModeEnabled)return;if(e[N.CTRL_OR_CMD]&&!e.repeat&&(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),C({app:this,event:e})),Pe(e.key)){let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),n=new Set;t.filter(e=>ss(e)).filter(e=>{let n=e.startBinding&&!t.some(t=>t.id===e.startBinding?.elementId),r=e.endBinding&&!t.some(t=>t.id===e.endBinding?.elementId);return n||r}).forEach(e=>n.add(e.id)),t=t.filter(e=>!n.has(e.id));let r=this.getEffectiveGridSize()&&(e.shiftKey?1:this.getEffectiveGridSize())||(e.shiftKey?5:1),i=0,a=0;e.key===N.ARROW_LEFT?i=-r:e.key===N.ARROW_RIGHT?i=r:e.key===N.ARROW_UP?a=-r:e.key===N.ARROW_DOWN&&(a=r),t.forEach(e=>{this.scene.mutateElement(e,{x:e.x+i,y:e.y+a},{informMutation:!1,isDragging:!1}),ue(e,this.scene,{simultaneouslyUpdated:t})}),this.scene.triggerUpdate(),e.preventDefault()}else if(e.key===N.ENTER){let t=this.scene.getSelectedElements(this.state);if(t.length===1){let n=t[0];if(e[N.CTRL_OR_CMD]||ca(n))b(n)&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==n.id)&&(this.store.scheduleCapture(),dr(n)||this.actionManager.executeAction(XA));else if(M(n)||ni(n)){let t;M(n)||(t=n);let r=nn(n,this.state,this.scene.getNonDeletedElementsMap()),i=r.x,a=r.y;this.startTextEditing({sceneX:i,sceneY:a,container:t}),e.preventDefault();return}else L(n)&&this.setState({editingFrame:n.id})}}if(e.key===N.SPACE&&Tz.pointers.size===0&&(mz=!0,Gw(this.interactiveCanvas,Kn.GRAB),e.preventDefault()),(e.key===N.G||e.key===N.S)&&!e.altKey&&!e[N.CTRL_OR_CMD]){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;e.key===N.G&&(Ir(this.state.activeTool.type)||t.some(e=>Ir(e.type)))&&(this.setState({openPopup:`elementBackground`}),e.stopPropagation()),e.key===N.S&&(this.setState({openPopup:`elementStroke`}),e.stopPropagation())}if(!e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===N.F){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;(this.state.activeTool.type===`text`||t.find(e=>M(e)||ut(e,this.scene.getNonDeletedElementsMap())))&&(e.preventDefault(),this.setState({openPopup:`fontFamily`}))}e[N.CTRL_OR_CMD]&&(e.key===N.BACKSPACE||e.key===N.DELETE)&&this.updateEditorAtom(Rk,`clearCanvas`);let n=e.key.toLocaleLowerCase(),r=n===N.S&&e.shiftKey&&!e[N.CTRL_OR_CMD],i=e.key===N.I||n===N.G&&e.shiftKey;(r||i)&&this.openEyeDropper({type:r?`stroke`:`background`})})),i(this,`onKeyUp`,qj(e=>{if(e.key===N.SPACE&&(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`||this.state.openDialog?.name===`elementLinkSelector`?Gw(this.interactiveCanvas,Kn.GRAB):Vr(this.state.activeTool.type)?Ww(this.interactiveCanvas):(Yw(this.interactiveCanvas,this.state),this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),mz=!1),e.key===N.ALT&&C({app:this,event:e}),(e.key===N.ALT&&this.state.bindMode===`skip`||!e[N.CTRL_OR_CMD]&&!xs(this.state))&&(this.setState({bindMode:`orbit`}),this.lastPointerMoveEvent&&Ys(`COMPLEX_BINDINGS`))){let e=la({clientX:this.lastPointerMoveEvent.clientX,clientY:this.lastPointerMoveEvent.clientY},this.state),t=go(O(e.x,e.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(this.state.selectedLinearElement){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());ss(e)&&this.handleDelayedBindModeChange(e,t)}}if(!e[N.CTRL_OR_CMD]){let t=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==t&&(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:t})}),C({app:this,event:e})}if(Pe(e.key)){Bo(this.scene.getSelectedElements(this.state).filter(jt),this.scene,this.state);let e=this.scene.getNonDeletedElementsMap();this.scene.getSelectedElements(this.state).filter(Ti).forEach(t=>{t.startBinding&&this.scene.mutateElement(t,{startBinding:{...t.startBinding,...Qr(t,e.get(t.startBinding.elementId),`start`,e)}}),t.endBinding&&this.scene.mutateElement(t,{endBinding:{...t.endBinding,...Qr(t,e.get(t.endBinding.elementId),`end`,e)}})}),this.setState({suggestedBinding:null})}if(e.altKey||this.flowChartNavigator.isExploring&&(this.flowChartNavigator.clear(),this.syncActionResult({captureUpdate:V.IMMEDIATELY})),!e[N.CTRL_OR_CMD]&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.pendingNodes?.length&&this.scene.insertElements(this.flowChartCreator.pendingNodes);let e=this.flowChartCreator.pendingNodes?.[0];e&&(this.setState(t=>({selectedElementIds:P({[e.id]:!0},t)})),ms([e],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())||this.scrollToContent(e,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})),this.flowChartCreator.clear(),this.syncActionResult({captureUpdate:V.IMMEDIATELY})}})),i(this,`isToolSupported`,e=>this.props.UIOptions.tools?.[e]!==!1),i(this,`setActiveTool`,(e,t=!1)=>{if(!this.isToolSupported(e.type)){console.warn(`"${e.type}" tool is disabled via "UIOptions.canvasActions.tools.${e.type}"`);return}let n=ka(this.state,e);n.type===`hand`?Gw(this.interactiveCanvas,Kn.GRAB):mz||Yw(this.interactiveCanvas,{...this.state,activeTool:n}),Rt(document.activeElement)&&this.focusContainer(),me(n.type)||this.setState({suggestedBinding:null}),n.type===`image`&&this.onImageToolbarButtonClick(),this.setState(e=>{let r={snapLines:e.snapLines.length?[]:e.snapLines,originSnapOffset:null,activeEmbeddable:null,selectedLinearElement:Vr(n.type)?e.selectedLinearElement:null};return n.type===`freedraw`&&this.store.scheduleCapture(),n.type===`lasso`?{...e,...r,activeTool:n,...t?{}:{selectedElementIds:P({},e),selectedGroupIds:P({},e),editingGroupId:null,multiElement:null}}:n.type===`selection`?{...e,...r,activeTool:n}:{...e,...r,activeTool:n,selectedElementIds:P({},e),selectedGroupIds:P({},e),editingGroupId:null,multiElement:null}})}),i(this,`setOpenDialog`,e=>{this.setState({openDialog:e})}),i(this,`setCursor`,e=>{Gw(this.interactiveCanvas,e)}),i(this,`resetCursor`,()=>{Ww(this.interactiveCanvas)}),i(this,`isTouchScreenMultiTouchGesture`,()=>Tz.pointers.size>=2),i(this,`getName`,()=>this.state.name||this.props.name||`${K(`labels.untitled`)}-${Fn()}`),i(this,`onGestureStart`,qj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null}),Tz.initialScale=this.state.zoom.value})),i(this,`onGestureChange`,qj(e=>{if(e.preventDefault(),this.isTouchScreenMultiTouchGesture())return;let t=Tz.initialScale;t&&this.setState(n=>({...Xw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:_i(t*e.scale)},n)}))})),i(this,`onGestureEnd`,qj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:P(this.state.previousSelectedElementIds,this.state)}),Tz.initialScale=null})),i(this,`startTextEditing`,({sceneX:e,sceneY:t,insertAtParentCenter:n=!0,container:r,autoEdit:i=!0})=>{let a=!1,o=n&&this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r);r&&o&&(ut(r,this.scene.getNonDeletedElementsMap())||(a=!0));let s=null,c=this.scene.getSelectedElements(this.state);s=c.length===1?M(c[0])?c[0]:r?ut(c[0],this.scene.getNonDeletedElementsMap()):this.getTextElementAtPosition(e,t):this.getTextElementAtPosition(e,t);let l=s?.fontFamily||this.state.currentItemFontFamily,d=s?.lineHeight||ba(l),f=this.state.currentItemFontSize;if(!s&&a&&r&&!jt(r)){let n=Xs(u({fontSize:f,fontFamily:l}),d),i=Yn(f,d),a=Math.max(r.height,i),s=Math.max(r.width,n);this.scene.mutateElement(r,{height:a,width:s}),e=r.x+s/2,t=r.y+a/2,o&&=this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r)}let p=this.getTopLayerFrameAtSceneCoords({x:e,y:t}),m=s||Li({x:o?o.elementCenterX:e,y:o?o.elementCenterY:t,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:``,fontSize:f,fontFamily:l,textAlign:o?`center`:this.state.currentItemTextAlign,verticalAlign:o?Lr.MIDDLE:`top`,containerId:a?r?.id:void 0,groupIds:r?.groupIds??[],lineHeight:d,angle:r?jt(r)?0:r.angle:0,frameId:p?p.id:null});if(!s&&a&&r&&this.scene.mutateElement(r,{boundElements:(r.boundElements||[]).concat({type:`text`,id:m.id})}),this.setState({editingTextElement:m}),!s)if(r&&a){let e=this.scene.getElementIndex(r.id);this.scene.insertElementAtIndex(m,e+1)}else this.scene.insertElement(m);i||s||r?this.handleTextWysiwyg(m,{isExistingElement:!!s}):this.setState({newElement:m,multiElement:null})}),i(this,`startImageCropping`,e=>{this.store.scheduleCapture(),this.setState({croppingElementId:e.id})}),i(this,`finishImageCropping`,()=>{this.state.croppingElementId&&(this.store.scheduleCapture(),this.setState({croppingElementId:null}))}),i(this,`handleCanvasDoubleClick`,e=>{if(this.state.multiElement||this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let t=this.scene.getSelectedElements(this.state),{x:n,y:r}=la(e,this.state);if(t.length===1&&b(t[0])){let i=t[0];if((e[N.CTRL_OR_CMD]&&Ti(i)||ca(i))&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==i.id)){this.actionManager.executeAction(XA);return}else if(this.state.selectedLinearElement&&dr(t[0])){let e=I.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),i=e?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,e,this.scene.getNonDeletedElementsMap()):-1;if(i&&i>-1){this.store.scheduleCapture(),I.deleteFixedSegment(t[0],this.scene,i);let a=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),o=a?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,a,this.scene.getNonDeletedElementsMap()):null;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,segmentMidpoint:{index:o,value:e,added:!1}},segmentMidPointHoveredCoords:a}});return}}else if(this.state.selectedLinearElement?.isEditing&&this.state.selectedLinearElement.elementId===i.id&&ca(i))return}if(t.length===1&&io(t[0])){this.startImageCropping(t[0]);return}if(Ww(this.interactiveCanvas),po(this.state).length>0){let e=this.getElementAtPosition(n,r),t=e&&we(e,this.state.selectedGroupIds);if(t){this.store.scheduleCapture(),this.setState(n=>({...n,...Hr({editingGroupId:t,selectedElementIds:{[e.id]:!0}},this.scene.getNonDeletedElements(),n,this)}));return}}if(Ww(this.interactiveCanvas),!e[N.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let t=this.getElementAtPosition(n,r);if(Rs(t)){this.setState({activeEmbeddable:{element:t,state:`active`}});return}if(!this.state.selectedLinearElement?.isEditing){let t=this.getTextBindableContainerAtPosition(n,r);if(t&&(xr(t)||!Po(t.backgroundColor)||Ui({point:O(n,r),element:t,elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(t)}))){let e=nn(t,this.state,this.scene.getNonDeletedElementsMap());n=e.x,r=e.y}this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:t})}}}),i(this,`getElementLinkAtPosition`,(e,t)=>{if(t&&t.locked)return;let n=this.scene.getNonDeletedElements(),r=-1;for(let i=n.length-1;i>=0;i--){let a=n[i];if(t&&a.id===t.id&&(r=i),a.link&&i>=r&&pn(a,this.scene.getNonDeletedElementsMap(),this.state,O(e.x,e.y),this.editorInterface.formFactor===`phone`))return a}}),i(this,`handleElementLinkClick`,e=>{let t=Se(O(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),O(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||t>10)return;let n=la(this.lastPointerDownEvent,this.state),r=this.scene.getNonDeletedElementsMap(),i=pn(this.hitLinkElement,r,this.state,O(n.x,n.y),this.editorInterface.formFactor===`phone`),a=la(this.lastPointerUpEvent,this.state),o=pn(this.hitLinkElement,r,this.state,O(a.x,a.y),this.editorInterface.formFactor===`phone`);if(i&&o){qE();let t=this.hitLinkElement.link;if(t){t=Hs(t);let n;if(this.props.onLinkOpen&&(n=Fi(F.EXCALIDRAW_LINK,e.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:t},n)),!n?.defaultPrevented){let e=p(t)?`_self`:`_blank`,n=window.open(void 0,e);n&&(n.opener=null,n.location=t)}}}}),i(this,`getTopLayerFrameAtSceneCoords`,e=>{let t=this.scene.getNonDeletedElementsMap(),n=this.scene.getNonDeletedFramesLikes().filter(n=>!n.locked&&ns(e,n,t));return n.length?n[n.length-1]:null}),i(this,`handleCanvasPointerMove`,e=>{this.savePointer(e.clientX,e.clientY,this.state.cursorButton),this.lastPointerMoveEvent=e.nativeEvent;let t=la(e,this.state),{x:n,y:r}=t;this.lastPointerMoveCoords={x:n,y:r},Tz.pointers.has(e.pointerId)&&Tz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});let i=Tz.initialScale;if(Tz.pointers.size===2&&Tz.lastCenter&&i&&Tz.initialDistance){let e=mj(Tz.pointers),t=e.x-Tz.lastCenter.x,n=e.y-Tz.lastCenter.y;Tz.lastCenter=e;let r=hj(Array.from(Tz.pointers.values())),a=this.state.activeTool.type===`freedraw`&&this.state.penMode?1:r/Tz.initialDistance,o=a?_i(i*a):this.state.zoom.value;this.setState(r=>{let i=Xw({viewportX:e.x,viewportY:e.y,nextZoom:o},r);return this.translateCanvas({zoom:i.zoom,scrollX:i.scrollX+t/o*2,scrollY:i.scrollY+n/o*2,shouldCacheIgnoreZoom:!0}),null}),this.resetShouldCacheIgnoreZoomDebounced()}else Tz.lastCenter=Tz.initialDistance=Tz.initialScale=null;if(mz||hz||gz||Fs(this.state))return;let a=nM(_z,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop).isOverEither;if(!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.multiElement&&(a?Ww(this.interactiveCanvas):Yw(this.interactiveCanvas,this.state)),!this.state.newElement&&Bj(this.state.activeTool.type)){let{originOffset:t,snapLines:i}=zj(this.scene.getNonDeletedElements(),this,{x:n,y:r},e,this.scene.getNonDeletedElementsMap());this.setState(e=>{let n=tr(e.snapLines,i),r=e.originSnapOffset?tr(e.originSnapOffset,t):t;return e.snapLines===n&&e.originSnapOffset===r?null:{snapLines:n,originSnapOffset:r}})}else !this.state.newElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.selectionElement&&this.setState(e=>e.snapLines.length?{snapLines:[]}:null);if(this.state.selectedLinearElement?.isEditing&&!this.state.selectedLinearElement.isDragging){let t=this.state.newElement?null:I.handlePointerMoveInEditMode(e,n,r,this);t&&t!==this.state.selectedLinearElement&&(0,_c.flushSync)(()=>{this.setState({selectedLinearElement:t})})}if(Et(this.state.activeTool.type)){let{newElement:e}=this.state;if(!e&&xs(this.state)){let e=O(n,r),t=this.scene.getNonDeletedElementsMap(),i=go(e,this.scene.getNonDeletedElements(),t,ii(this.state.zoom));i?this.setState({suggestedBinding:{element:i,midPoint:T(e,i,t,this.state.zoom)}}):this.state.suggestedBinding&&this.setState({suggestedBinding:null})}}if(this.state.multiElement&&this.state.selectedLinearElement){let{multiElement:t,selectedLinearElement:i}=this.state,{x:a,y:o,points:s}=t,c=s[s.length-1],{lastCommittedPoint:l}=i;if(Yw(this.interactiveCanvas,this.state),c===l)jt(this.state.newElement)&&xs(this.state)&&go(O(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),ii(this.state.zoom))?(this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n,y:r}}),this.setState({suggestedBinding:null,startBoundElement:null}),this.state.activeTool.locked||(Ww(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:P({...e.selectedElementIds,[t.id]:!0},e),selectedLinearElement:new I(t,this.scene.getNonDeletedElementsMap())})))):Se(O(n-a,r-o),c)>=8?(this.scene.mutateElement(t,{points:[...s,O(n-a,r-o)]},{informMutation:!1,isDragging:!1}),gt(this.state.selectedLinearElement?.initialState,`initialState must be set`),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:s[s.length-1],selectedPointsIndices:[t.points.length-1],initialState:{...this.state.selectedLinearElement.initialState,lastClickedPoint:t.points.length-1}}})):Gw(this.interactiveCanvas,Kn.POINTER);else if(s.length>2&&l&&Se(O(n-a,r-o),l)<8)Gw(this.interactiveCanvas,Kn.POINTER),this.scene.mutateElement(t,{points:s.slice(0,-1)},{informMutation:!1,isDragging:!1}),this.setState({selectedLinearElement:{...i,selectedPointsIndices:i.selectedPointsIndices?.includes(t.points.length)?[...i.selectedPointsIndices.filter(e=>e!==t.points.length&&e!==t.points.length-1),t.points.length-1]:i.selectedPointsIndices,lastCommittedPoint:t.points[t.points.length-1],initialState:{...i.initialState,lastClickedPoint:t.points.length-1}}});else{ra(s,this.state.zoom.value)&&Gw(this.interactiveCanvas,Kn.POINTER);let i=this.scene.getNonDeletedElementsMap();if(Ti(t)){let e=go(O(n,r),this.scene.getNonDeletedElements(),i);Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(t,e)}gt(this.state.selectedLinearElement,`Expected selectedLinearElement to be set to operate on a linear element`);let a=I.handlePointerMove(e.nativeEvent,this,n,r,this.state.selectedLinearElement);a&&this.setState(a)}return}if(this.state.activeTool.type===`arrow`){let e=go(O(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),ii(this.state.zoom)),t=O(n,r),i=this.scene.getNonDeletedElementsMap();e&&!fs(t,e,i)&&this.setState({suggestedBinding:{element:e,midPoint:T(t,e,i,this.state.zoom)}})}let o=!!e.buttons,s=this.state.activeTool.type===`laser`;if(o||!s&&this.state.activeTool.type!==`selection`&&this.state.activeTool.type!==`lasso`&&this.state.activeTool.type!==`text`&&this.state.activeTool.type!==`eraser`)return;let c=this.scene.getNonDeletedElements(),l=this.scene.getSelectedElements(this.state);if(l.length===1&&!a&&!this.state.selectedLinearElement?.isEditing){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r),(!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1)&&this.state.openDialog?.name!==`elementLinkSelector`&&!(l.length===1&&dr(l[0]))&&!(b(l[0])&&(this.editorInterface.userAgent.isMobileDevice||l[0].points.length===2))){let t=vs(c,this.state,n,r,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);if(t&&t.transformHandleType){Gw(this.interactiveCanvas,vo(t));return}}}else if(l.length>1&&!a&&this.state.openDialog?.name!==`elementLinkSelector`){let t=Qs(Ii(l),n,r,this.state.zoom,e.pointerType,this.editorInterface);if(t){Gw(this.interactiveCanvas,vo({transformHandleType:t}));return}}if(zr(this.state))return;let u=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),d=null;if(d=u&&u.locked?null:u,this.handleIframeLikeElementHover({hitElement:d,scenePointer:t,moveEvent:e})||(this.hitLinkElement=this.getElementLinkAtPosition(t,u)),this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id])Gw(this.interactiveCanvas,Kn.POINTER),GE(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap());else{if(qE(),s)return;d&&(d.link||rs(d))&&this.state.selectedElementIds[d.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:`info`}):this.state.activeTool.type===`text`?Gw(this.interactiveCanvas,M(d)?Kn.TEXT:Kn.CROSSHAIR):this.state.viewModeEnabled?Gw(this.interactiveCanvas,Kn.GRAB):this.state.openDialog?.name===`elementLinkSelector`||a||e[N.CTRL_OR_CMD]?Gw(this.interactiveCanvas,Kn.AUTO):(d||this.isHittingCommonBoundingBoxOfSelectedElements(t,l))&&!d?.locked&&(!d||!dr(d)||!(d.startBinding||d.endBinding))&&(this.state.activeTool.type!==`lasso`||l.length>0)&&Gw(this.interactiveCanvas,Kn.MOVE),this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r)}this.state.openDialog?.name===`elementLinkSelector`&&d?this.setState(e=>({hoveredElementIds:tr(e.hoveredElementIds,Hr({editingGroupId:e.editingGroupId,selectedElementIds:{[d.id]:!0}},this.scene.getNonDeletedElements(),e,this).selectedElementIds)})):this.state.openDialog?.name===`elementLinkSelector`&&!d&&this.setState(e=>({hoveredElementIds:tr(e.hoveredElementIds,{})}))}),i(this,`handleEraser`,(e,t)=>{let n=this.eraserTrail.addPointToPath(t.x,t.y,e.altKey);this.elementsPendingErasure=new Set(n),this.triggerRender()}),i(this,`handleTouchMove`,e=>{yz=!0}),i(this,`handleCanvasPointerDown`,e=>{if(!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let{x:t,y:n}=la(e,this.state);this.lastPointerMoveCoords={x:t,y:n};let r=e.target;if(r.setPointerCapture&&r.setPointerCapture(e.pointerId),this.maybeCleanupAfterMissingPointerUp(e.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.searchMatches&&(this.setState(e=>({searchMatches:e.searchMatches&&{focusedId:null,matches:e.searchMatches.matches.map(e=>({...e,focus:!1}))}})),this.updateEditorAtom(BP,null)),Cy.get(sD)&&this.updateEditorAtom(sD,null),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.state.openPopup&&this.setState({openPopup:null}),this.updateGestureOnPointerDown(e),e.pointerType===`touch`&&this.state.newElement&&this.state.newElement.type===`freedraw`){let e=this.state.newElement;this.updateScene({...e.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(t=>t.id!==e.id)}:{},appState:{newElement:null,editingTextElement:null,startBoundElement:null,suggestedBinding:null,selectedElementIds:P(Object.keys(this.state.selectedElementIds).filter(t=>t!==e.id).reduce((e,t)=>(e[t]=this.state.selectedElementIds[t],e),{}),this.state)},captureUpdate:this.state.openDialog?.name===`elementLinkSelector`?V.EVENTUALLY:V.NEVER});return}let i=document.getSelection();if(i?.anchorNode&&i.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(e),!this.state.penDetected&&e.pointerType===`pen`&&this.setState(e=>({penMode:!0,penDetected:!0})),!this.editorInterface.isTouchScreen&&[`pen`,`touch`].includes(e.pointerType)&&(this.editorInterface=Jr(this.editorInterface,{isTouchScreen:!0})),hz||(this.lastPointerDownEvent=e,this.handleCanvasPanUsingWheelOrSpaceDrag(e)))return;if(this.setState({lastPointerDownWith:e.pointerType,cursorButton:`down`}),this.savePointer(e.clientX,e.clientY,`down`),e.button===dn.ERASER&&this.state.activeTool.type!==va.eraser){this.setState({activeTool:ka(this.state,{type:va.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(e);let t=()=>{n(),r?.(),zr(this.state)&&this.setState({activeTool:ka(this.state,{...this.state.activeTool.lastActiveTool||{type:va.selection},lastActiveToolBeforeEraser:null})})},n=w(window,F.POINTER_UP,t,{once:!0}),r;requestAnimationFrame(()=>{r=this.missingPointerEventCleanupEmitter.once(t)})});return}if(e.button!==dn.MAIN&&e.button!==dn.TOUCH&&e.button!==dn.ERASER||Tz.pointers.size>1)return;let a=this.initialPointerDownState(e);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleDraggingScrollBar(e,a)||(this.clearSelectionIfNotUsingSelection(),this.handleSelectionOnPointerDown(e,a))||!(!this.state.penMode||e.pointerType!==`touch`||this.state.activeTool.type===`selection`||this.state.activeTool.type===`lasso`||this.state.activeTool.type===`text`||this.state.activeTool.type===`image`))return;if(this.state.activeTool.type===`lasso`){let t=a.hit.element&&this.isASelectedElement(a.hit.element);!a.hit.hasHitCommonBoundingBoxOfSelectedElements&&!a.resize.handleType&&!t&&(this.lassoTrail.startPath(a.origin.x,a.origin.y,e.shiftKey),a.drag.blockDragging=this.editorInterface.formFactor===`desktop`),this.editorInterface.formFactor!==`desktop`&&a.hit.element&&!t&&(this.setState(e=>{let t={...e.selectedElementIds,[a.hit.element.id]:!0},n=[];Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)});let r=a.hit.element;if(L(r))Di(n,r.id).forEach(e=>{delete t[e.id]});else if(r.frameId)t[r.frameId]&&delete t[r.id];else{let e=r.groupIds,i=new Set(e.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).filter(e=>L(e)).map(e=>e.id));i.size>0&&n.forEach(e=>{e.frameId&&i.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:r.link||rs(r)?`info`:!1}}),a.hit.wasAddedToSelection=!0)}else this.state.activeTool.type===`text`?this.handleTextOnPointerDown(e,a):this.state.activeTool.type===`arrow`||this.state.activeTool.type===`line`?this.handleLinearElementOnPointerDown(e,this.state.activeTool.type,a):this.state.activeTool.type===`freedraw`?this.handleFreeDrawElementOnPointerDown(e,this.state.activeTool.type,a):this.state.activeTool.type===`custom`?Yw(this.interactiveCanvas,this.state):this.state.activeTool.type===va.frame||this.state.activeTool.type===va.magicframe?this.createFrameElementOnPointerDown(a,this.state.activeTool.type):this.state.activeTool.type===`laser`?this.laserTrails.startPath(a.lastCoords.x,a.lastCoords.y):this.state.activeTool.type!==`eraser`&&this.state.activeTool.type!==`hand`&&this.state.activeTool.type!==`image`&&this.createGenericElementOnPointerDown(this.state.activeTool.type,a);this.props?.onPointerDown?.(this.state.activeTool,a),this.onPointerDownEmitter.trigger(this.state.activeTool,a,e),this.state.activeTool.type===`eraser`&&this.eraserTrail.startPath(a.lastCoords.x,a.lastCoords.y);let o=this.onPointerMoveFromPointerDownHandler(a),s=this.onPointerUpFromPointerDownHandler(a),c=this.onKeyDownFromPointerDownHandler(a),l=this.onKeyUpFromPointerDownHandler(a);this.missingPointerEventCleanupEmitter.once(t=>s(t||e.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type===`laser`)&&(window.addEventListener(F.POINTER_MOVE,o),window.addEventListener(F.POINTER_UP,s),window.addEventListener(F.KEYDOWN,c),window.addEventListener(F.KEYUP,l),a.eventListeners.onMove=o,a.eventListeners.onUp=s,a.eventListeners.onKeyUp=l,a.eventListeners.onKeyDown=c)}),i(this,`handleCanvasPointerUp`,e=>{if(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.removePointer(e),this.lastPointerUpEvent=e,!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let t=la({clientX:e.clientX,clientY:e.clientY},this.state),{x:n,y:r}=t;if(this.lastPointerMoveCoords={x:n,y:r},!this.handleIframeLikeCenterClick()){if(this.editorInterface.isTouchScreen){let e=this.getElementAtPosition(t.x,t.y,{includeLockedElements:!0});this.hitLinkElement=this.getElementLinkAtPosition(t,e)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?this.handleElementLinkClick(e):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})}}),i(this,`maybeOpenContextMenuAfterPointerDownOnTouchDevices`,e=>{e.pointerType===`touch`&&(yz=!1,vz?yz=!0:vz=window.setTimeout(()=>{vz=0,yz||this.handleCanvasContextMenu(e)},500))}),i(this,`resetContextMenuTimer`,()=>{clearTimeout(vz),vz=0,yz=!1}),i(this,`maybeCleanupAfterMissingPointerUp`,e=>{wz?.(),this.missingPointerEventCleanupEmitter.trigger(e).clear()}),i(this,`handleCanvasPanUsingWheelOrSpaceDrag`,e=>{if(!(Tz.pointers.size<=1&&(e.button===dn.WHEEL||e.button===dn.MAIN&&mz||Fs(this.state)||this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`)))return!1;hz=!0,this.focusContainer(),this.state.editingTextElement||e.preventDefault();let t=!1,n=/Linux/.test(window.navigator.platform);Gw(this.interactiveCanvas,Kn.GRABBING);let{clientX:r,clientY:i}=e,a=Jj(e=>{let a=r-e.clientX,o=i-e.clientY;if(r=e.clientX,i=e.clientY,n&&!t&&(Math.abs(a)>1||Math.abs(o)>1)){t=!0;let e=t=>{document.body.removeEventListener(F.PASTE,e),t.stopPropagation()},n=()=>{setTimeout(()=>{document.body.removeEventListener(F.PASTE,e),window.removeEventListener(F.POINTER_UP,n)},100)};document.body.addEventListener(F.PASTE,e),window.addEventListener(F.POINTER_UP,n)}this.translateCanvas({scrollX:this.state.scrollX-a/this.state.zoom.value,scrollY:this.state.scrollY-o/this.state.zoom.value})}),o=qj(wz=()=>{wz=null,hz=!1,mz||(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`?Gw(this.interactiveCanvas,Kn.GRAB):Yw(this.interactiveCanvas,this.state)),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(F.POINTER_MOVE,a),window.removeEventListener(F.POINTER_UP,o),window.removeEventListener(F.BLUR,o),a.flush()});return window.addEventListener(F.BLUR,o),window.addEventListener(F.POINTER_MOVE,a,{passive:!0}),window.addEventListener(F.POINTER_UP,o),!0}),i(this,`clearSelectionIfNotUsingSelection`,()=>{Vr(this.state.activeTool.type)||this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}),i(this,`handleSelectionOnPointerDown`,(e,t)=>{if(Vr(this.state.activeTool.type)){let n=this.scene.getNonDeletedElements(),r=this.scene.getNonDeletedElementsMap(),i=this.scene.getSelectedElements(this.state);if(i.length===1&&!this.state.selectedLinearElement?.isEditing&&!dr(i[0])&&!(b(i[0])&&(this.editorInterface.userAgent.isMobileDevice||i[0].points.length===2))&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let r=vs(n,this.state,t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);r!=null&&(r.transformHandleType===`rotation`?(this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType):(this.state.croppingElementId||this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType))}else i.length>1&&(t.resize.handleType=Qs(Ii(i),t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.editorInterface));if(t.resize.handleType)t.resize.isResizing=!0,t.resize.offset=pt(ls(t.resize.handleType,i,r,t.origin.x,t.origin.y)),i.length===1&&b(i[0])&&i[0].points.length===2&&(t.resize.arrowDirection=ai(t.resize.handleType,i[0]));else{if(this.state.selectedLinearElement){let n=this.state.selectedLinearElement,r=I.handlePointerDown(e,this,this.store,t.origin,n,this.scene);if(r.hitElement&&(t.hit.element=r.hitElement),r.linearElementEditor&&this.setState({selectedLinearElement:r.linearElementEditor}),r.didAddPoint)return!0;let i=this.scene.getNonDeletedElementsMap(),a=I.getElement(n.elementId,i);if(a&&ss(a)){let{hitFocusPoint:e,pointerOffset:r}=Uo(a,t,i,this.state);if(e)return this.setState({selectedLinearElement:{...n,hoveredFocusPointBinding:e,draggedFocusPointBinding:e,pointerOffset:r}}),!1}}let n=this.getElementsAtPosition(t.origin.x,t.origin.y,{includeLockedElements:!0}),r=n.filter(e=>!e.locked),i=this.getElementAtPosition(t.origin.x,t.origin.y,{allHitElements:n});if((!i||i.id!==this.state.activeLockedId)&&this.setState({activeLockedId:null}),i&&i.locked&&!r.some(e=>this.state.selectedElementIds[e.id])?t.hit.element=null:t.hit.element=t.hit.element??this.getElementAtPosition(t.origin.x,t.origin.y),this.hitLinkElement=this.getElementLinkAtPosition(t.origin,i),this.hitLinkElement)return!0;if(this.state.croppingElementId&&t.hit.element?.id!==this.state.croppingElementId&&this.finishImageCropping(),t.hit.element&&this.getElementLinkAtPosition({x:t.origin.x,y:t.origin.y},t.hit.element))return!1;t.hit.allHitElements=r;let a=t.hit.element,o=t.hit.allHitElements.some(e=>this.isASelectedElement(e));if((a===null||!o)&&!e.shiftKey&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(!this.state.selectedLinearElement?.isEditing||a&&a?.id!==this.state.selectedLinearElement?.elementId)&&this.clearSelection(a),this.state.selectedLinearElement?.isEditing)this.setState(e=>({selectedLinearElement:e.selectedLinearElement?{...e.selectedLinearElement,isEditing:!!a&&a.id===this.state.selectedLinearElement?.elementId}:null,selectedElementIds:e.selectedLinearElement?P({[e.selectedLinearElement.elementId]:!0},this.state):P({},e)}));else if(a!=null){if(e[N.CTRL_OR_CMD])return e.altKey?(this.state.openDialog?.name===`elementLinkSelector`&&this.setOpenDialog(null),this.lassoTrail.startPath(t.origin.x,t.origin.y,e.shiftKey),this.setActiveTool({type:`lasso`,fromSelection:!0}),!1):(this.state.selectedElementIds[a.id]||(t.hit.wasAddedToSelection=!0),this.setState(e=>({...Ut(e,a),previousSelectedElementIds:this.state.selectedElementIds})),!1);this.state.selectedElementIds[a.id]||(this.state.editingGroupId&&!Lo(a,this.state.editingGroupId)&&this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!o&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(e=>{let t={...e.selectedElementIds,[a.id]:!0},n=[];if(Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)}),L(a))Di(n,a.id).forEach(e=>{delete t[e.id]});else if(a.frameId)t[a.frameId]&&delete t[a.id];else{let e=a.groupIds,r=new Set(e.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).filter(e=>L(e)).map(e=>e.id));r.size>0&&n.forEach(e=>{e.frameId&&r.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return e.openDialog?.name===`elementLinkSelector`&&(a.groupIds.some(t=>e.selectedGroupIds[t])||(t={[a.id]:!0})),{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:a.link||rs(a)?`info`:!1}}),t.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1}),i(this,`handleTextOnPointerDown`,(e,t)=>{if(this.state.editingTextElement)return;let n=t.origin.x,r=t.origin.y,i=this.getElementAtPosition(n,r,{includeBoundTextElement:!0}),a=this.getTextBindableContainerAtPosition(n,r);xr(i)&&(a=i,n=i.x+i.width/2,r=i.y+i.height/2),this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:a,autoEdit:!1}),Ww(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})})}),i(this,`handleFreeDrawElementOnPointerDown`,(e,t,n)=>{let[r,i]=It(n.origin.x,n.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),o=e.pressure===.5,s=St({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:o,locked:!1,frameId:a?a.id:null,points:[O(0,0)],pressures:o?[]:[e.pressure]});this.scene.insertElement(s),this.setState(e=>{let t={...e.selectedElementIds};return delete t[s.id],{selectedElementIds:P(t,e)}});let c=go(O(n.origin.x,n.origin.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());this.setState({newElement:s,startBoundElement:c,suggestedBinding:null})}),i(this,`insertIframeElement`,({sceneX:e,sceneY:t,width:n,height:r})=>{let[i,a]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=jr({type:`iframe`,x:i,y:a,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`iframe`),opacity:this.state.currentItemOpacity,locked:!1,width:n,height:r});return this.scene.insertElement(o),o}),i(this,`insertEmbeddableElement`,({sceneX:e,sceneY:t,link:n})=>{let[r,i]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=qs(n);if(!a)return;a.error instanceof URIError&&this.setToast({message:K(`toast.unrecognizedLinkFormat`),closable:!0});let o=ga({type:`embeddable`,x:r,y:i,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`embeddable`),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:n});return this.scene.insertElement(o),o}),i(this,`newImagePlaceholder`,({sceneX:e,sceneY:t,addToFrameUnderCursor:n=!0})=>{let[r,i]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=n?this.getTopLayerFrameAtSceneCoords({x:r,y:i}):null,o=100/this.state.zoom.value;return gi({type:`image`,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:a?a.id:null,x:r-o/2,y:i-o/2,width:o,height:o})}),i(this,`handleLinearElementOnPointerDown`,(e,t,n)=>{if(e.ctrlKey&&(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),this.state.multiElement){let{multiElement:t,selectedLinearElement:r}=this.state;if(gt(r,`selectedLinearElement is expected to be set`),t.type===`line`&&ra(t.points,this.state.zoom.value)){(0,_c.flushSync)(()=>{this.setState({selectedLinearElement:{...r,lastCommittedPoint:t.points[t.points.length-1],initialState:{...r.initialState,lastClickedPoint:-1}}})}),this.actionManager.executeAction(oT);return}if(dr(t)&&t.points.length>1){this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}let{x:i,y:a}=t,{lastCommittedPoint:o}=r,s=xs(this.state)&&go(O(this.lastPointerMoveCoords?.x??i+t.points[t.points.length-1][0],this.lastPointerMoveCoords?.y??a+t.points[t.points.length-1][1]),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(ss(t)&&s||t.points.length>1&&o&&Se(O(n.origin.x-i,n.origin.y-a),o)<8){this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[t.id]:!0},e)})),Gw(this.interactiveCanvas,Kn.POINTER)}else{let[r,i]=It(n.origin.x,n.origin.y,e[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),{currentItemStartArrowhead:o,currentItemEndArrowhead:s}=this.state,[c,l]=t===`arrow`?[o,s]:[null,null],u=t===`arrow`?or({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemArrowType===ts.round?{type:Xa.PROPORTIONAL_RADIUS}:null,startArrowhead:c,endArrowhead:l,locked:!1,frameId:a?a.id:null,elbowed:this.state.currentItemArrowType===ts.elbow,fixedSegments:this.state.currentItemArrowType===ts.elbow?[]:null}):Tn({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness===`round`?{type:Xa.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:a?a.id:null}),d=O(n.origin.x,n.origin.y),f=this.scene.getNonDeletedElementsMap(),p=xs(this.state)?go(d,this.scene.getNonDeletedElements(),f):null;this.scene.mutateElement(u,{points:[O(0,0),O(0,0)]}),this.scene.insertElement(u),ss(u)&&Ur(u,new Map([[0,{point:O(0,0),isDragging:!1}]]),d[0],d[1],this.scene,this.state,{newArrow:!0,altKey:e.altKey,initialBinding:!0,angleLocked:mr(e.nativeEvent)}),(0,_c.flushSync)(()=>{this.setState(t=>{let r=null,i=t.selectedElementIds;if(b(u)){r=new I(u,this.scene.getNonDeletedElementsMap());let t=u.points.length-1;r={...r,selectedPointsIndices:[t],initialState:{...r.initialState,arrowStartIsInside:e.altKey,lastClickedPoint:t,origin:O(n.origin.x,n.origin.y)}}}return i=this.state.activeTool.locked?t.selectedElementIds:P({[u.id]:!0},t),{...t,bindMode:`orbit`,newElement:u,startBoundElement:p,suggestedBinding:p&&ss(u)?{element:p,midPoint:T(d,p,f,this.state.zoom)}:null,selectedElementIds:i,selectedLinearElement:r}})}),ss(u)&&Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(u,p)}}),i(this,`createGenericElementOnPointerDown`,(e,t)=>{let[n,r]=It(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.getTopLayerFrameAtSceneCoords({x:n,y:r}),a={x:n,y:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(e),locked:!1,frameId:i?i.id:null},o;o=e===`embeddable`?ga({type:`embeddable`,...a}):cn({type:e,...a}),o.type===`selection`?this.setState({selectionElement:o}):(this.scene.insertElement(o),this.setState({multiElement:null,newElement:o}))}),i(this,`createFrameElementOnPointerDown`,(e,t)=>{let[n,r]=It(e.origin.x,e.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i={x:n,y:r,opacity:this.state.currentItemOpacity,locked:!1,...On},a=t===va.magicframe?Pn(i):Ds(i);this.scene.insertElement(a),this.setState({multiElement:null,newElement:a})}),i(this,`restoreReadyToEraseElements`,()=>{this.elementsPendingErasure=new Set,this.triggerRender()}),i(this,`eraseElements`,()=>{let e=!1;this.elementsPendingErasure.forEach(e=>{let t=this.scene.getElement(e);if(ss(t)){if(t.startBinding){let e=this.scene.getElement(t.startBinding.elementId);jn(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}if(t.endBinding){let e=this.scene.getElement(t.endBinding.elementId);jn(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}}else un(t)&&t.boundElements?.forEach(e=>{if(e.type===`arrow`){let n=this.scene.getElement(e.id);n?.startBinding?.elementId===t.id&&jn(n,this.scene.getElementsMapIncludingDeleted(),{startBinding:null}),n?.endBinding?.elementId===t.id&&jn(n,this.scene.getElementsMapIncludingDeleted(),{endBinding:null})}})});let t=this.scene.getElementsIncludingDeleted().map(t=>this.elementsPendingErasure.has(t.id)||t.frameId&&this.elementsPendingErasure.has(t.frameId)||ya(t)&&this.elementsPendingErasure.has(t.containerId)?(e=!0,B(t,{isDeleted:!0})):t);this.elementsPendingErasure=new Set,e&&(this.store.scheduleCapture(),this.scene.replaceAllElements(t))}),i(this,`initializeImage`,async(e,t)=>{if(!xo(t))throw Error(K(`errors.unsupportedFileType`));let n=t.type;if(Gw(this.interactiveCanvas,`wait`),n===hs.svg)try{t=Xi(ae(await t.text()),t.name)}catch(e){throw console.warn(e),Error(K(`errors.svgImageInsertError`))}let r=await(this.props.generateIdForFile?.(t)||xn(t));if(!r)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),Error(K(`errors.imageInsertError`));if(!this.files[r]?.dataURL){try{t=await Bt(t,{maxWidthOrHeight:Eo})}catch(e){console.error(`Error trying to resizing image file on insertion`,e)}if(t.size>4194304)throw Error(K(`errors.fileTooBig`,{maxSize:`${Math.trunc(br/1024/1024)}MB`}))}let i=this.files[r]?.dataURL||await ia(t);return new Promise(async(t,a)=>{try{let a=this.getLatestInitializedImageElement(e,r);if(this.addMissingFiles([{mimeType:n,id:r,dataURL:i,created:Date.now(),lastRetrieved:Date.now()}]),!this.imageCache.get(r)){this.addNewImagesToImageCache();let{erroredFiles:e}=await this.updateImageCache([a]);if(e.size)throw Error(`Image cache update resulted with an error.`)}let o=await this.imageCache.get(r)?.image;if(o&&this.state.newElement?.id!==a.id){a=this.getLatestInitializedImageElement(e,r);let t=this.getImageNaturalDimensions(a,o);Object.assign(a,t)}t(a)}catch(e){console.error(e),a(Error(K(`errors.imageInsertError`)))}})}),i(this,`getLatestInitializedImageElement`,(e,t)=>B(this.scene.getElement(e.id)??e,{fileId:t})),i(this,`onImageToolbarButtonClick`,async()=>{try{let{x:e,y:t}=la({clientX:this.state.width/2+this.state.offsetLeft,clientY:this.state.height/2+this.state.offsetTop},this.state),n=await Wo({description:`Image`,extensions:Object.keys(Da),multiple:!0});this.insertImages(n,e,t)}catch(e){e.name===`AbortError`?console.warn(e):console.error(e),this.setState({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})},()=>{this.actionManager.executeAction(oT)})}}),i(this,`getImageNaturalDimensions`,(e,t)=>{let n=Math.max(this.state.height-120,160),r=Math.min(n,Math.floor(this.state.height*.5)/this.state.zoom.value),i=Math.min(t.naturalHeight,r),a=i*(t.naturalWidth/t.naturalHeight);return{x:e.x+e.width/2-a/2,y:e.y+e.height/2-i/2,width:a,height:i,crop:null}}),i(this,`updateImageCache`,async(e,t=this.files)=>{let{updatedFiles:n,erroredFiles:r}=await at({imageCache:this.imageCache,fileIds:e.map(e=>e.fileId),files:t});return r.size&&(this.store.scheduleAction(V.NEVER),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(e=>d(e)&&r.has(e.fileId)?B(e,{status:`error`}):e))),{updatedFiles:n,erroredFiles:r}}),i(this,`addNewImagesToImageCache`,async(e=qe(this.scene.getNonDeletedElements()),t=this.files)=>{let n=e.filter(e=>!e.isDeleted&&!this.imageCache.has(e.fileId));if(n.length){let{updatedFiles:e}=await this.updateImageCache(n,t);if(e.size)for(let t of n)e.has(t.fileId)&&bn.delete(t);e.size&&this.scene.triggerUpdate()}}),i(this,`scheduleImageRefresh`,(0,gc.default)(()=>{this.addNewImagesToImageCache()},500)),i(this,`handleInteractiveCanvasRef`,e=>{e===null?(this.interactiveCanvas?.removeEventListener(F.TOUCH_START,this.onTouchStart),this.interactiveCanvas?.removeEventListener(F.TOUCH_END,this.onTouchEnd)):(this.interactiveCanvas=e,this.interactiveCanvas.addEventListener(F.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(F.TOUCH_END,this.onTouchEnd))}),i(this,`insertImages`,async(e,t,n)=>{let r=50/this.state.zoom.value,i=Gr(e.map(()=>this.newImagePlaceholder({sceneX:t,sceneY:n})),t,n,r);i.forEach(e=>this.scene.insertElement(e));let a=await Promise.all(i.map(async(t,n)=>{try{return await this.initializeImage(t,await z(e[n]))}catch(e){return this.setState({errorMessage:e.message||K(`errors.imageInsertError`)}),B(t,{isDeleted:!0})}})),o=lr(a),s=Gr(a.filter(e=>!e.isDeleted),t,n,r),c=lr(s),l=this.scene.getElementsIncludingDeleted().map(e=>c.get(e.id)??o.get(e.id)??e);this.updateScene({appState:{selectedElementIds:P(Object.fromEntries(s.map(e=>[e.id,!0])),this.state)},elements:l,captureUpdate:V.IMMEDIATELY}),this.setState({},()=>{this.actionManager.executeAction(oT)})}),i(this,`handleAppOnDrop`,async e=>{let{x:t,y:n}=la(e,this.state),r=await DT(e),i=r.getFiles();if(i.length===1){let{file:e,fileHandle:t}=i[0];if(e&&(e.type===hs.png||e.type===hs.svg))try{let n=await $o(e,this.state,this.scene.getElementsIncludingDeleted(),t);this.syncActionResult({...n,appState:{...n.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:V.IMMEDIATELY});return}catch(e){if(e.name!==`EncodingError`)throw Error(K(`alerts.couldNotLoadInvalidFile`))}}let a=i.map(e=>e.file).filter(e=>xo(e));if(a.length>0&&this.isToolSupported(`image`))return this.insertImages(a,t,n);let o=r.getData(hs.excalidrawlibIds),s=r.getData(hs.excalidrawlib);if(o||s){try{let t=null;if(o){let{itemIds:e}=JSON.parse(o);t=(await this.library.getLatestLibrary()).filter(t=>e.includes(t.id))}else s&&(t=li(s));t?.length&&(t=t.map(e=>({...e,elements:Er({type:`everything`,elements:e.elements,randomizeSeed:!0}).duplicatedElements})),this.addElementsFromPasteOrLibrary({elements:QD(t),position:e,files:null}))}catch(e){this.setState({errorMessage:e.message})}return}if(i.length>0){let{file:e,fileHandle:t}=i[0];e&&await this.loadFileToCanvas(e,t)}let c=r.findByType(hs.text);if(c){let e=c.value;if(e&&Lt(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||qs(e)?.type===`video`)){let r=this.insertEmbeddableElement({sceneX:t,sceneY:n,link:Hs(e)});r&&(this.store.scheduleCapture(),this.setState({selectedElementIds:{[r.id]:!0}}))}}}),i(this,`loadFileToCanvas`,async(e,t)=>{e=await z(e);try{let n=this.scene.getElementsIncludingDeleted(),r;try{r=await Es(e,this.state,n,t)}catch(e){let t=e instanceof rn;if(t&&e.code===`IMAGE_NOT_CONTAINS_SCENE_DATA`&&!this.isToolSupported(`image`)){this.setState({isLoading:!1,errorMessage:K(`errors.imageToolNotSupported`)});return}let n=K(t?`alerts.cannotRestoreFromImage`:`alerts.couldNotLoadInvalidFile`);this.setState({isLoading:!1,errorMessage:n})}if(!r)return;r.type===hs.excalidraw?(ho(n.concat(r.data.elements)),this.store.scheduleMicroAction({action:V.NEVER,elements:n,appState:void 0}),this.setState({isLoading:!0}),this.syncActionResult({...r.data,appState:{...r.data.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:V.IMMEDIATELY})):r.type===hs.excalidrawlib&&await this.library.updateLibrary({libraryItems:e,merge:!0,openLibraryMenu:!0}).catch(e=>{console.error(e),this.setState({errorMessage:K(`errors.importLibraryError`)})})}catch(e){this.setState({isLoading:!1,errorMessage:e.message})}}),i(this,`handleCanvasContextMenu`,e=>{if(e.preventDefault(),(`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`touch`||`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`pen`&&e.button!==dn.SECONDARY)&&this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let{x:t,y:n}=la(e,this.state),r=this.getElementAtPosition(t,n,{preferSelected:!0,includeLockedElements:!0}),i=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:t,y:n},i),o=r||a?`element`:`canvas`,{top:s,left:c}=this.excalidrawContainerRef.current.getBoundingClientRect(),l=e.clientX-c,u=e.clientY-s;dC(`contextMenu`,`openContextMenu`,o),this.setState({...r&&!this.state.selectedElementIds[r.id]?{...this.state,...Hr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[r.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:b(r)?new I(r,this.scene.getNonDeletedElementsMap()):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:u,left:l,items:this.getContextMenuItems(o)}})})}),i(this,`maybeDragNewGenericElement`,(e,t,n=!0)=>{let r=this.state.selectionElement,i=e.lastCoords;if(r&&e.boxSelection.hasOccurred&&this.state.activeTool.type!==`eraser`){gs({newElement:r,elementType:this.state.activeTool.type,originX:e.origin.x,originY:e.origin.y,x:i.x,y:i.y,width:fr(e.origin.x,i.x),height:fr(e.origin.y,i.y),shouldMaintainAspectRatio:oa(t),shouldResizeFromCenter:!1,scene:this.scene,zoom:this.state.zoom.value,informMutation:!1});return}let a=this.state.newElement;if(!a)return;let[o,s]=It(i.x,i.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=d(a)&&this.imageCache.get(a.fileId)?.image,l=c&&!(c instanceof Promise)?c.width/c.height:null;this.maybeCacheReferenceSnapPoints(t,[a]);let{snapOffset:u,snapLines:f}=Rj(a,this,t,{x:e.originInGrid.x+(this.state.originSnapOffset?.x??0),y:e.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:o-e.originInGrid.x,y:s-e.originInGrid.y},this.scene.getNonDeletedElementsMap());o+=u.x,s+=u.y,this.setState({snapLines:f}),ss(a)||gs({newElement:a,elementType:this.state.activeTool.type,originX:e.originInGrid.x,originY:e.originInGrid.y,x:o,y:s,width:fr(e.originInGrid.x,o),height:fr(e.originInGrid.y,s),shouldMaintainAspectRatio:io(a)?!oa(t):oa(t),shouldResizeFromCenter:Ho(t),zoom:this.state.zoom.value,scene:this.scene,widthAspectRatio:l,originOffset:this.state.originSnapOffset,informMutation:n}),this.setState({newElement:a}),(this.state.activeTool.type===va.frame||this.state.activeTool.type===va.magicframe)&&this.setState({elementsToHighlight:kn(this.scene.getNonDeletedElements(),a,this.state,this.scene.getNonDeletedElementsMap())})}),i(this,`maybeHandleCrop`,(e,t)=>{if(!this.state.croppingElementId)return!1;let n=e.resize.handleType,r=e.lastCoords,[i,a]=It(r.x-e.resize.offset.x,r.y-e.resize.offset.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(n&&o&&io(o)){let s=e.originalElements.get(o.id),c=d(o)&&this.imageCache.get(o.fileId)?.image;if(s&&io(s)&&c&&!(c instanceof Promise)){let[l,u]=It(r.x,r.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),d={x:l-e.originInGrid.x,y:u-e.originInGrid.y};this.maybeCacheReferenceSnapPoints(t,[o]);let{snapOffset:f,snapLines:p}=Lj([o],[s],this,t,d,n);this.scene.mutateElement(o,Un(o,this.scene.getNonDeletedElementsMap(),n,c.naturalWidth,c.naturalHeight,i+f.x,a+f.y,t.shiftKey?s.width/s.height:void 0)),ue(o,this.scene),this.setState({isCropping:n&&n!==`rotation`,snapLines:p})}return!0}return!1}),i(this,`maybeHandleResize`,(e,t)=>{let n=this.scene.getSelectedElements(this.state),r=n.filter(e=>L(e)),i=e.resize.handleType;if(r.length>0&&i===`rotation`||n.length===1&&dr(n[0])||this.state.croppingElementId)return!1;this.setState({isResizing:i&&i!==`rotation`,isRotating:i===`rotation`,activeEmbeddable:null});let a=e.lastCoords,[o,s]=It(a.x-e.resize.offset.x,a.y-e.resize.offset.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=new Map;if(r.forEach(e=>{Di(this.scene.getNonDeletedElements(),e.id).forEach(t=>{c.set(e.id+t.id,{x:t.x-e.x,y:t.y-e.y})})}),!this.state.selectedElementsAreBeingDragged){let[r,c]=It(a.x,a.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l={x:r-e.originInGrid.x,y:c-e.originInGrid.y},u=[...e.originalElements.values()];this.maybeCacheReferenceSnapPoints(t,n);let{snapOffset:d,snapLines:f}=Lj(n,ir(u,this.state),this,t,l,i);o+=d.x,s+=d.y,this.setState({snapLines:f})}if(In(e.originalElements,i,n,this.scene,mr(t),Ho(t),n.some(e=>io(e))?!oa(t):oa(t),o,s,e.resize.center.x,e.resize.center.y)){let e=new Set;return r.forEach(t=>{kn(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()).forEach(t=>e.add(t))}),this.setState({elementsToHighlight:[...e]}),!0}return!1}),i(this,`getContextMenuItems`,e=>{let t=[];if(t.push(xE,bE),e===`canvas`)return this.state.viewModeEnabled?[...t,CE,wE,yk,OE]:[vE,bN,xE,bE,SE,bN,cC,QE,bN,CE,TE,EE,DE,wE,yk,OE];if(t.push(SE),this.state.viewModeEnabled)return[_E,...t];let n=this.editorInterface.formFactor===`desktop`?[bN,iC,aC,oC,sC]:[];return[bN,yE,_E,vE,bN,ej,tj,nj,bN,QA,bN,...t,bN,YT,XT,bN,eE,uj,kE,AE,NE,tE,bN,cE,...n,bN,pE,mE,bN,XA,bN,YE,AD,bN,lC,ZE,bN,rC]}),i(this,`handleWheel`,qj(e=>{if(!(e.target instanceof HTMLCanvasElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLIFrameElement||e.target instanceof HTMLElement&&e.target.classList.contains(Qn.FRAME_NAME))){e[N.CTRL_OR_CMD]&&e.preventDefault();return}if(e.preventDefault(),hz)return;let{deltaX:t,deltaY:n}=e;if(e.metaKey||e.ctrlKey){let e=Math.sign(n),t=qi*100,r=Math.abs(n),i=n;r>t&&(i=t*e);let a=this.state.zoom.value-i/100;a+=Math.log10(Math.max(1,this.state.zoom.value))*-e*Math.min(1,r/20),this.translateCanvas(e=>({...Xw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:_i(a)},e),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(e.shiftKey){this.translateCanvas(({zoom:e,scrollX:r})=>({scrollX:r-(n||t)/e.value}));return}this.translateCanvas(({zoom:e,scrollX:r,scrollY:i})=>({scrollX:r-t/e.value,scrollY:i-n/e.value}))})),i(this,`savePointer`,(e,t,n)=>{if(!e||!t)return;let{x:r,y:i}=la({clientX:e,clientY:t},this.state),a={x:r,y:i,tool:this.state.activeTool.type===`laser`?`laser`:`pointer`};this.props.onPointerUpdate?.({pointer:a,button:n,pointersMap:Tz.pointers})}),i(this,`resetShouldCacheIgnoreZoomDebounced`,wt(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300)),i(this,`updateDOMRect`,e=>{if(this.excalidrawContainerRef?.current){let{width:t,height:n,left:r,top:i}=this.excalidrawContainerRef.current.getBoundingClientRect(),{width:a,height:o,offsetTop:s,offsetLeft:c}=this.state;if(t===a&&n===o&&r===c&&i===s){e&&e();return}this.setState({width:t,height:n,offsetLeft:r,offsetTop:i},()=>{e&&e()})}}),i(this,`refresh`,()=>{this.setState({...this.getCanvasOffsets()})}),i(this,`watchState`,()=>{});let n=cs(),{viewModeEnabled:r=!1,zenModeEnabled:a=!1,gridModeEnabled:o=!1,objectsSnapModeEnabled:s=!1,theme:c=n.theme,name:l=`${K(`labels.untitled`)}-${Fn()}`}=t;this.state={...n,theme:c,exportWithDarkMode:c===R.DARK,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:r,zenModeEnabled:a,objectsSnapModeEnabled:s,gridModeEnabled:o??n.gridModeEnabled,name:l,width:window.innerWidth,height:window.innerHeight},this.refreshEditorInterface(),this.stylesPanelMode=Ka(this.editorInterface),this.id=Ca(),this.library=new ZD(this),this.actionManager=new fj(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new Dn,this.canvas=document.createElement(`canvas`),this.rc=Fo.canvas(this.canvas),this.renderer=new Vj(this.scene),this.visibleElements=[],this.store=new zo(this),this.history=new aj(this.store),this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new de(this.scene),this.history=new aj(this.store),this.actionManager.registerAll(eC),this.actionManager.registerAction(cj(this.history)),this.actionManager.registerAction(lj(this.history)),this.api=this.createExcalidrawAPI()}createExcalidrawAPI(){return{isDestroyed:!1,updateScene:this.updateScene,applyDeltas:this.applyDeltas,mutateElement:this.mutateElement,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,getSceneElementsMapIncludingDeleted:this.getSceneElementsMapIncludingDeleted,history:{clear:this.resetHistory},scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:e=>{this.actionManager.registerAction(e)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,getEditorInterface:()=>this.editorInterface,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:e=>this.onChangeEmitter.on(e),onIncrement:e=>this.store.onStoreIncrementEmitter.on(e),onPointerDown:e=>this.onPointerDownEmitter.on(e),onPointerUp:e=>this.onPointerUpEmitter.on(e),onScrollChange:e=>this.onScrollChangeEmitter.on(e),onUserFollow:e=>this.onUserFollowEmitter.on(e),onStateChange:this.onStateChange,onEvent:this.onEvent}}onWindowMessage(e){if(e.origin!==`https://player.vimeo.com`&&e.origin!==`https://www.youtube.com`)return;let t=null;try{t=JSON.parse(e.data)}catch{}if(t)switch(e.origin){case`https://player.vimeo.com`:if(t.method===`paused`){let n=null,r=document.body.querySelectorAll(`iframe.excalidraw__embeddable`);if(!r)break;for(let t of r)t.contentWindow===e.source&&(n=t.contentWindow);n?.postMessage(JSON.stringify({method:t.value?`play`:`pause`,value:!0}),`*`)}break;case`https://www.youtube.com`:if(t.event===`infoDelivery`&&t.info&&t.id&&typeof t.info.playerState==`number`){let e=t.id,n=t.info.playerState;Object.values(Ao).includes(n)&&bz.set(e,n)}break}}handleSkipBindMode(){if(this.state.selectedLinearElement?.initialState&&!this.state.selectedLinearElement.initialState.arrowStartIsInside){gt(this.lastPointerMoveCoords,`Missing last pointer move coords when changing bind skip mode for arrow start`);let e=this.scene.getNonDeletedElementsMap(),t=go(O(this.lastPointerMoveCoords.x,this.lastPointerMoveCoords.y),this.scene.getNonDeletedElements(),e),n=I.getElement(this.state.selectedLinearElement.elementId,e);n?.startBinding&&t?.id===n.startBinding.elementId&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:!0}}})}if(this.state.bindMode===`orbit`&&(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),(0,_c.flushSync)(()=>{this.setState({bindMode:`skip`})}),this.lastPointerMoveCoords&&this.state.selectedLinearElement?.selectedPointsIndices&&this.state.selectedLinearElement?.selectedPointsIndices.length)){let{x:e,y:t}=this.lastPointerMoveCoords,n=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;gt(n,`Last event must exist`);let r=e-this.state.selectedLinearElement.pointerOffset.x,i=t-this.state.selectedLinearElement.pointerOffset.y,a=this.state.multiElement?I.handlePointerMove(n,this,r,i,this.state.selectedLinearElement):I.handlePointDragging(n,this,r,i,this.state.selectedLinearElement);a&&this.setState(a)}}resetDelayedBindMode(){this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode!==`orbit`&&setTimeout(()=>this.setState({bindMode:`orbit`}))}handleDelayedBindModeChange(e,t){if(e.isDeleted||dr(e))return;let n=()=>{if(this.bindModeHandler=null,gt(this.lastPointerMoveCoords,`Expected lastPointerMoveCoords to be set`),!this.state.multiElement){if(!this.state.selectedLinearElement||!this.state.selectedLinearElement.selectedPointsIndices||!this.state.selectedLinearElement.selectedPointsIndices.length)return;let t=this.state.selectedLinearElement.selectedPointsIndices.includes(0),n=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1);if(!t&&!n||t&&n)return}let{x:t,y:n}=this.lastPointerMoveCoords,r=go(O(t,n),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(r&&this.state.bindMode!==`skip`){gt(this.state.selectedLinearElement?.elementId===e.id,`The selectedLinearElement is expected to not change while a bind mode timeout is ticking`);let i=this.state.selectedLinearElement.initialState.arrowStartIsInside||e.startBinding?.elementId===r.id;(0,_c.flushSync)(()=>{gt(this.state.selectedLinearElement,`this.state.selectedLinearElement must exist`),this.setState({bindMode:`inside`,selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:i}}})});let a=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;gt(a,`Last event must exist`);let o=t-this.state.selectedLinearElement.pointerOffset.x,s=n-this.state.selectedLinearElement.pointerOffset.y,c=this.state.multiElement?I.handlePointerMove(a,this,o,s,this.state.selectedLinearElement):I.handlePointDragging(a,this,o,s,this.state.selectedLinearElement);c&&this.setState(c)}},r=!1;if(this.state.selectedLinearElement?.selectedPointsIndices){let n=this.scene.getNonDeletedElementsMap(),i=this.state.selectedLinearElement.selectedPointsIndices.includes(0),a=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1),o=i?t:e.startBinding&&n.get(e.startBinding.elementId),s=a?t:e.endBinding&&n.get(e.endBinding.elementId),c=o&&m(o,n),l=s&&m(s,n);r=!!(c&&l&&o.id!==s.id&&oe(c,l))}let i=this.state.selectedLinearElement?.selectedPointsIndices?.includes(0),a=this.state.selectedLinearElement?.selectedPointsIndices?.includes(e.points.length-1),o=i?`startBinding`:a?`endBinding`:null,s=i?`endBinding`:a?`startBinding`:null,c=s&&e[s]?.mode===`inside`&&e[s]?.elementId===t?.id||o&&e[o]?.mode===`inside`&&t?.id===e[o]?.elementId;o&&s&&e[o]?.mode===`inside`&&t?.id!==e[o]?.elementId&&e[s]?.elementId!==e[o]?.elementId&&this.scene.mutateElement(e,{[o]:{...e[o],mode:`orbit`}},{informMutation:!1,isDragging:!0}),!t||this.previousHoveredBindableElement&&t.id!==this.previousHoveredBindableElement.id?(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode===`inside`&&(0,_c.flushSync)(()=>{this.setState({bindMode:`orbit`})}),this.previousHoveredBindableElement=null):!this.bindModeHandler&&(!this.state.newElement||!e.startBinding||r)&&!c&&(this.bindModeHandler=setTimeout(n,700)),this.previousHoveredBindableElement=t}cacheEmbeddableRef(e,t){t&&this.iFrameRefs.set(e.id,t)}getHTMLIFrameElement(e){return this.iFrameRefs.get(e.id)}handleIframeLikeCenterClick(){if(!this.lastPointerDownEvent||!this.lastPointerUpEvent||this.lastPointerDownEvent.button!==dn.MAIN||mz||!v(this.state.activeTool.type,[`laser`,`selection`,`lasso`]))return!1;let e=O(la({clientX:this.lastPointerDownEvent.clientX,clientY:this.lastPointerDownEvent.clientY},this.state)),t=O(la({clientX:this.lastPointerUpEvent.clientX,clientY:this.lastPointerUpEvent.clientY},this.state));if(Se(e,t)>10)return!1;let n=this.getElementAtPosition(e[0],e[1]);if(!(n&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<=300&&Tz.pointers.size<2&&Rs(n)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(n,this.lastPointerUpEvent,t[0],t[1]))))return!1;let r=n;if(this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`||(setTimeout(()=>{this.setState({activeEmbeddable:{element:r,state:`active`},selectedElementIds:{[r.id]:!0},newElement:null,selectionElement:null})},100),Vs(r)))return!0;let i=this.getHTMLIFrameElement(r);if(!i?.contentWindow)return!0;if(i.src.includes(`youtube`)){let e=bz.get(r.id);switch(e||(bz.set(r.id,Ao.UNSTARTED),i.contentWindow.postMessage(JSON.stringify({event:`listening`,id:r.id}),`*`)),e){case Ao.PLAYING:case Ao.BUFFERING:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`pauseVideo`,args:``}),`*`);break;default:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`playVideo`,args:``}),`*`)}}return i.src.includes(`player.vimeo.com`)&&i.contentWindow.postMessage(JSON.stringify({method:`paused`}),`*`),!0}isIframeLikeElementCenter(e,t,n,r){return e&&!t.altKey&&!t.shiftKey&&!t.metaKey&&!t.ctrlKey&&(this.state.activeEmbeddable?.element!==e||this.state.activeEmbeddable?.state===`hover`||!this.state.activeEmbeddable)&&n>=e.x+e.width/3&&n<=e.x+2*e.width/3&&r>=e.y+e.height/3&&r<=e.y+2*e.height/3}renderEmbeddables(){let e=this.state.zoom.value,t=this.state.width,n=this.state.height;return(0,W.jsx)(W.Fragment,{children:this.scene.getNonDeletedElements().filter(e=>rs(e)&&this.embedsValidationStatus.get(e.id)===!0||Vs(e)).map(r=>{let{x:i,y:a}=Ci({sceneX:r.x,sceneY:r.y},this.state),o=vn(r,t,n,this.state,this.scene.getNonDeletedElementsMap()),s=this.initializedEmbeds.has(r.id);if(o&&!s&&this.initializedEmbeds.add(r.id),!(o||s))return null;let c;if(Vs(r)){c=null;let e=(r.customData?.generationData??this.magicGenerations.get(r.id))||{status:`error`,message:`No generation data`,code:`ERR_NO_GENERATION_DATA`};if(e.status===`done`){let t=e.html;c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>t}}else if(e.status===`pending`)c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>cr(`
|
|
89
89
|
<style>
|
|
90
90
|
html, body {
|
|
91
91
|
width: 100%;
|
|
@@ -176,7 +176,7 @@ Please fix the Mermaid syntax and regenerate a valid diagram.`,isRepairFlow:!0})
|
|
|
176
176
|
</style>
|
|
177
177
|
<h1>Error!</h1>
|
|
178
178
|
<h3>${t}</h3>
|
|
179
|
-
`)}}}else c=qs(ws(r.link||``));let l=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`,u=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`hover`;return(0,W.jsx)(`div`,{className:U(`excalidraw__embeddable-container`,{"is-hovered":u}),style:{transform:o?`translate(${i-this.state.offsetLeft}px, ${a-this.state.offsetTop}px) scale(${e})`:`none`,display:o?`block`:`none`,opacity:eo(r,No(r,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure,null,this.state.openDialog?.name===`elementLinkSelector`?mo:1),"--embeddable-radius":`${Fe(Math.min(r.width,r.height),r)}px`},children:(0,W.jsxs)(`div`,{className:`excalidraw__embeddable-container__inner`,style:{width:o?`${r.width}px`:0,height:o?`${r.height}px`:0,transform:o?`rotate(${r.angle}rad)`:`none`,pointerEvents:l?uo.enabled:uo.disabled},children:[u&&(0,W.jsx)(`div`,{className:`excalidraw__embeddable-hint`,children:K(`buttons.embeddableInteractionButton`)}),(0,W.jsx)(`div`,{className:`excalidraw__embeddable__outer`,style:{padding:`${r.strokeWidth}px`},children:(rs(r)?this.props.renderEmbeddable?.(r,this.state):null)??(0,W.jsx)(`iframe`,{ref:e=>this.cacheEmbeddableRef(r,e),className:`excalidraw__embeddable`,srcDoc:c?.type===`document`?c.srcdoc(this.state.theme):void 0,src:c?.type===`document`?void 0:c?.link??``,scrolling:`no`,referrerPolicy:`no-referrer-when-downgrade`,title:`Excalidraw Embedded Content`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,sandbox:`${c?.sandbox?.allowSameOrigin?`allow-same-origin`:``} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})]})},r.id)})})}toggleOverscrollBehavior(e){document.documentElement.style.overscrollBehaviorX=e.type===`pointerenter`?`none`:`auto`}render(){let e=this.scene.getSelectedElements(this.state),{renderTopRightUI:t,renderTopLeftUI:n,renderCustomStats:r}=this.props,i=this.scene.getSceneNonce(),{elementsMap:a,visibleElements:o}=this.renderer.getRenderableElements({sceneNonce:i,zoom:this.state.zoom,offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,height:this.state.height,width:this.state.width,editingTextElement:this.state.editingTextElement,newElementId:this.state.newElement?.id});this.visibleElements=o;let s=this.scene.getNonDeletedElementsMap(),c=`setPointerCapture`in HTMLElement.prototype?!1:this.state.selectionElement||this.state.newElement||this.state.selectedElementsAreBeingDragged||this.state.resizingElement||this.state.activeTool.type===`laser`&&this.state.cursorButton===`down`,l=e[0],u=Cy.get(sD)?.type===`panel`;return(0,W.jsx)(`div`,{translate:`no`,className:U(`excalidraw excalidraw-container notranslate`,{"excalidraw--view-mode":this.state.viewModeEnabled||this.state.openDialog?.name===`elementLinkSelector`,"excalidraw--mobile":this.editorInterface.formFactor===`phone`}),style:{"--ui-pointerEvents":c?uo.disabled:uo.enabled,"--right-sidebar-width":`302px`},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:(0,W.jsx)(ez.Provider,{value:this.api,children:(0,W.jsx)(WR.Provider,{value:this,children:(0,W.jsx)(GR.Provider,{value:this.props,children:(0,W.jsx)(YR.Provider,{value:this.excalidrawContainerValue,children:(0,W.jsx)(qR.Provider,{value:this.editorInterface,children:(0,W.jsx)(QR.Provider,{value:this.setAppState,children:(0,W.jsx)(ZR.Provider,{value:this.state,children:(0,W.jsxs)(XR.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,W.jsxs)($R.Provider,{value:this.actionManager,children:[(0,W.jsx)(YL,{canvas:this.canvas,appState:this.state,files:this.files,setAppState:this.setAppState,actionManager:this.actionManager,elements:this.scene.getNonDeletedElements(),onLockToggle:this.toggleLock,onPenModeToggle:this.togglePenMode,onHandToolToggle:this.onHandToolToggle,langCode:My().code,renderTopLeftUI:n,renderTopRightUI:t,renderCustomStats:r,showExitZenModeBtn:typeof this.props?.zenModeEnabled>`u`&&this.state.zenModeEnabled,UIOptions:this.props.UIOptions,onExportImage:this.onExportImage,renderWelcomeScreen:!this.state.isLoading&&this.state.showWelcomeScreen&&this.state.activeTool.type===this.state.preferredSelectionTool.type&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,generateLinkForSelection:this.props.generateLinkForSelection,children:this.props.children}),(0,W.jsx)(`div`,{className:`excalidraw-textEditorContainer`}),(0,W.jsx)(`div`,{className:`excalidraw-contextMenuContainer`}),(0,W.jsx)(`div`,{className:`excalidraw-eye-dropper-container`}),(0,W.jsx)(QL,{trails:[this.laserTrails,this.lassoTrail,this.eraserTrail]}),e.length===1&&this.state.openDialog?.name!==`elementLinkSelector`&&this.state.showHyperlinkPopup&&(0,W.jsx)(VE,{element:l,scene:this.scene,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast,updateEmbedValidationStatus:this.updateEmbedValidationStatus},l.id),this.props.aiEnabled!==!1&&e.length===1&&xe(l)&&(0,W.jsx)(Wj,{element:l,elementsMap:a,children:(0,W.jsx)(ZL,{title:K(`labels.convertToCode`),icon:fS,checked:!1,onChange:()=>this.onMagicFrameGenerate(l,`button`)})}),e.length===1&&Vs(l)&&l.customData?.generationData?.status===`done`&&(0,W.jsxs)(Wj,{element:l,elementsMap:a,children:[(0,W.jsx)(ZL,{title:K(`labels.copySource`),icon:$x,checked:!1,onChange:()=>this.onIframeSrcCopy(l)}),(0,W.jsx)(ZL,{title:`Enter fullscreen`,icon:pS,checked:!1,onChange:()=>{let e=this.getHTMLIFrameElement(l);if(e)try{e.requestFullscreen(),this.setState({activeEmbeddable:{element:l,state:`active`},selectedElementIds:{[l.id]:!0},newElement:null,selectionElement:null})}catch(e){console.warn(e),this.setState({errorMessage:`Couldn't enter fullscreen`})}}})]}),this.state.contextMenu&&(0,W.jsx)(xN,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:e=>{this.setState({contextMenu:null},()=>{this.focusContainer(),e?.()})}}),(0,W.jsx)(LR,{canvas:this.canvas,rc:this.rc,elementsMap:a,allElementsMap:s,visibleElements:o,sceneNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:Sj(this),canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:this.flowChartCreator.pendingNodes,theme:this.state.theme}}),this.state.newElement&&(0,W.jsx)(VR,{appState:this.state,scale:window.devicePixelRatio,rc:this.rc,elementsMap:a,allElementsMap:s,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!1,canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:null,theme:this.state.theme}}),(0,W.jsx)(PR,{app:this,containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elementsMap:a,visibleElements:o,allElementsMap:s,selectedElements:e,sceneNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderScrollbars:this.props.renderScrollbars===!0,editorInterface:this.editorInterface,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,W.jsx)(SN,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames(),this.state.activeLockedId&&(0,W.jsx)(UR,{app:this,activeLockedId:this.state.activeLockedId}),u&&(0,W.jsx)(OD,{app:this})]}),this.renderEmbeddables()]})})})})})})})})})}setPlugins(e){Object.assign(this.plugins,e)}async onMagicFrameGenerate(e,t){let n=this.plugins.diagramToCode?.generate;if(!n){this.setState({errorMessage:`No diagram to code plugin found`});return}let r=fo(this.scene.getNonDeletedElements(),e).filter(e=>!xe(e));if(!r.length){t===`button`?(this.setState({errorMessage:`Cannot generate from an empty frame`}),dC(`ai`,`generate (no-children)`,`d2c`)):this.setActiveTool({type:`magicframe`});return}let i=this.insertIframeElement({sceneX:e.x+e.width+30,sceneY:e.y,width:e.width,height:e.height});if(i){this.updateMagicGeneration({frameElement:i,data:{status:`pending`}}),this.setState({selectedElementIds:{[i.id]:!0}}),dC(`ai`,`generate (start)`,`d2c`);try{let{html:t}=await n({frame:e,children:r});if(dC(`ai`,`generate (success)`,`d2c`),!t.trim()){this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:`Nothing genereated :(`}});return}let a=t.includes(`<!DOCTYPE html>`)&&t.includes(`</html>`)?t.slice(t.indexOf(`<!DOCTYPE html>`),t.indexOf(`</html>`)+7):t;this.updateMagicGeneration({frameElement:i,data:{status:`done`,html:a}})}catch(e){dC(`ai`,`generate (failed)`,`d2c`),this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:e.message||`Unknown error during generation`}})}}}onIframeSrcCopy(e){e.customData?.generationData?.status===`done`&&(AT(e.customData.generationData.html),this.setToast({message:`copied to clipboard`,closable:!1,duration:1500}))}clearImageShapeCache(e){let t=e??this.files;this.scene.getNonDeletedElements().forEach(e=>{d(e)&&t[e.fileId]&&(this.imageCache.delete(e.fileId),bn.delete(e))})}async componentDidMount(){this.unmounted=!1,this.api=this.createExcalidrawAPI(),this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,(h()||Vt())&&(this.setState.bind(this),Object.defineProperties(window.h,{state:{configurable:!0,get:()=>this.state},setState:{configurable:!0,value:(...e)=>this.setState(...e)},app:{configurable:!0,value:this},history:{configurable:!0,value:this.history},store:{configurable:!0,value:this.store},fonts:{configurable:!0,value:this.fonts}})),this.store.onDurableIncrementEmitter.on(e=>{this.history.record(e.delta)}),this.props.onIncrement&&this.store.onStoreIncrementEmitter.on(e=>{this.props.onIncrement?.(e)}),this.scene.onUpdate(this.triggerRender),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),He&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorInterface(),this.updateDOMRect()}),this.resizeObserver?.observe(this.excalidrawContainerRef.current)),new URLSearchParams(window.location.search.slice(1)).has(`web-share-target`)?this.restoreFileFromShare():this.updateDOMRect(this.initializeScene),Ss()&&!x()&&this.setState({errorMessage:(0,W.jsx)(vN,{})});let e={excalidrawAPI:this.api,container:this.excalidrawContainerRef.current};this.editorLifecycleEvents.emit(`editor:mount`,e),this.props.onMount?.(e),this.props.onExcalidrawAPI?.(this.api)}componentWillUnmount(){this.api={...this.api,isDestroyed:!0};for(let e of Object.keys(this.api))(e.startsWith(`get`)||e===`onStateChange`||e===`onEvent`)&&typeof this.api[e]==`function`&&(this.api[e]=()=>{throw Error("ExcalidrawAPI is no longer usable after the editor has been unmounted and will return invalid/empty data. You should check for `ExcalidrawAPI.isDestroyed` before calling get* methods on subscribing to state/event changes.")});this.editorLifecycleEvents.emit(`editor:unmount`),this.props.onUnmount?.(),this.props.onExcalidrawAPI?.(null),window.launchQueue?.setConsumer(()=>{}),this.renderer.destroy(),this.scene.destroy(),this.scene=new Dn,this.fonts=new de(this.scene),this.renderer=new Vj(this.scene),this.files={},this.imageCache.clear(),this.resizeObserver?.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.library.destroy(),this.laserTrails.stop(),this.eraserTrail.stop(),this.onChangeEmitter.clear(),this.store.onStoreIncrementEmitter.clear(),this.store.onDurableIncrementEmitter.clear(),this.appStateObserver.clear(),this.editorLifecycleEvents.clear(),bn.destroy(),xj.destroy(),clearTimeout(vz),Ya.clearCache(),Hr.clearCache(),vz=0,document.documentElement.style.overscrollBehaviorX=``}removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(w(document,F.KEYDOWN,this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(w(this.excalidrawContainerRef.current,F.WHEEL,this.handleWheel,{passive:!1}),w(window,F.MESSAGE,this.onWindowMessage,!1),w(document,F.POINTER_UP,this.removePointer,{passive:!1}),w(document,F.COPY,this.onCopy,{passive:!1}),w(document,F.KEYUP,this.onKeyUp,{passive:!0}),w(document,F.POINTER_MOVE,this.updateCurrentCursorPosition,{passive:!1}),w(document.fonts,`loadingdone`,e=>{let t=e.fontfaces;this.fonts.onLoaded(t)},{passive:!1}),w(document,F.GESTURE_START,this.onGestureStart,!1),w(document,F.GESTURE_CHANGE,this.onGestureChange,!1),w(document,F.GESTURE_END,this.onGestureEnd,!1),w(window,F.FOCUS,()=>{this.maybeCleanupAfterMissingPointerUp(null),this.triggerRender(!0)},{passive:!1})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(w(document,F.FULLSCREENCHANGE,this.onFullscreenChange,{passive:!1}),w(document,F.PASTE,this.pasteFromClipboard,{passive:!1}),w(document,F.CUT,this.onCut,{passive:!1}),w(window,F.RESIZE,this.onResize,!1),w(window,F.UNLOAD,this.onUnload,!1),w(window,F.BLUR,this.onBlur,!1),w(this.excalidrawContainerRef.current,F.WHEEL,this.handleWheel,{passive:!1}),w(this.excalidrawContainerRef.current,F.DRAG_OVER,this.disableEvent,!1),w(this.excalidrawContainerRef.current,F.DROP,this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(w(sr(this.excalidrawContainerRef.current),F.SCROLL,this.onScroll,{passive:!1})))}componentDidUpdate(e,t){!this._initialized&&!this.state.isLoading&&(this._initialized=!0,this.editorLifecycleEvents.emit(`editor:initialize`,this.api),this.props.onInitialize?.(this.api)),this.appStateObserver.flush(t),this.updateEmbeddables();let n=this.scene.getElementsIncludingDeleted(),r=this.scene.getElementsMapIncludingDeleted(),i=(this.sessionExportThemeOverride??this.state.theme)===R.DARK;this.state.exportWithDarkMode!==i&&this.setState({exportWithDarkMode:i}),!this.state.showWelcomeScreen&&!n.length&&this.setState({showWelcomeScreen:!0}),t.userToFollow&&!this.state.collaborators.has(t.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),(t.zoom.value!==this.state.zoom.value||t.scrollX!==this.state.scrollX||t.scrollY!==this.state.scrollY)&&(this.props?.onScrollChange?.(this.state.scrollX,this.state.scrollY,this.state.zoom),this.onScrollChangeEmitter.trigger(this.state.scrollX,this.state.scrollY,this.state.zoom)),t.userToFollow!==this.state.userToFollow&&(t.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:t.userToFollow,action:`UNFOLLOW`}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:`FOLLOW`})),Object.keys(this.state.selectedElementIds).length&&zr(this.state)&&this.setState({activeTool:ka(this.state,{type:`selection`})}),this.state.activeTool.type===`eraser`&&t.theme!==this.state.theme&&Jw(this.interactiveCanvas,this.state.theme),t.activeTool.type===`selection`&&this.state.activeTool.type!==`selection`&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),e.langCode!==this.props.langCode&&this.updateLanguage(),zr(t)&&!zr(this.state)&&this.eraserTrail.endPath(),e.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),t.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),(t.openDialog?.name===`elementLinkSelector`||this.state.openDialog?.name===`elementLinkSelector`)&&t.openDialog?.name!==this.state.openDialog?.name&&(this.deselectElements(),this.setState({hoveredElementIds:{}})),e.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),e.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),this.excalidrawContainerRef.current?.classList.toggle(`theme--dark`,this.state.theme===R.DARK),this.state.selectedLinearElement?.isEditing&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.actionManager.executeAction(oT)}),this.state.editingTextElement?.isDeleted&&this.setState({editingTextElement:null}),this.store.commit(r,this.state),this.state.isLoading||(this.props.onChange?.(n,this.state,this.files),this.onChangeEmitter.trigger(n,this.state,this.files))}static resetTapTwice(){dz=!1,pz=null}async insertClipboardContent(e,t,r){let{x:i,y:a}=la({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state);if(e.errorMessage){this.setState({errorMessage:e.errorMessage});return}if(t.length===0&&!r&&e.mixedContent){await this.addElementsFromMixedContentPaste(e.mixedContent,{isPlainPaste:r,sceneX:i,sceneY:a});return}if(!r&&e.text){let t=hN(e.text);if(t.ok){this.setState({openDialog:{name:`charts`,data:t.data,rawText:e.text}});return}}let o=t.map(e=>e.file);if(o.length===0&&e.text&&!r){let t=e.text.trim();t.startsWith(`<svg`)&&t.endsWith(`</svg>`)&&o.push(Xi(t))}if(o.length>0){this.isToolSupported(`image`)?await this.insertImages(o,i,a):this.setState({errorMessage:K(`errors.imageToolNotSupported`)});return}if(e.elements){let t=e.programmaticAPI?sn(e.elements):e.elements;this.addElementsFromPasteOrLibrary({elements:t,files:e.files||null,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`,retainSeed:r});return}if(!e.text)return;if(!r&&rM(e.text)){let t=await n(()=>import(`./excalidraw-mermaid-stub-C1ZaaI05.js`),__vite__mapDeps([70,71]),import.meta.url);try{let{elements:n,files:r={}}=await t.parseMermaidToExcalidraw(e.text),i=sn(n,{regenerateIds:!0});this.addElementsFromPasteOrLibrary({elements:i,files:r,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`});return}catch(e){console.warn(`parsing pasted text as mermaid definition failed: ${e.message}`)}}let s=Wa(e.text).split(/\n+/).map(e=>e.trim()).filter(Boolean),c=s.map(e=>Gi(e)).filter(e=>Lt(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||qs(e)?.type===`video`));if(!r&&c.length>0&&c.length===s.length){let e=[];for(let t of c){let n=e[e.length-1],r=this.insertEmbeddableElement({sceneX:n?n.x+n.width+20:i,sceneY:a,link:Hs(t)});r&&e.push(r)}e.length&&(this.store.scheduleCapture(),this.setState({selectedElementIds:Object.fromEntries(e.map(e=>[e.id,!0]))}));return}this.addTextFromPaste(e.text,r)}async addElementsFromMixedContentPaste(e,{isPlainPaste:t,sceneX:n,sceneY:r}){if(!t&&e.some(e=>e.type===`imageUrl`)&&this.isToolSupported(`image`)){let t=e.filter(e=>e.type===`imageUrl`).map(e=>e.value),i=await Promise.all(t.map(async e=>{try{return{file:await Ja(e)}}catch(e){let t=e.message;return e.cause===`FETCH_ERROR`?t=K(`errors.failedToFetchImage`):e.cause===`UNSUPPORTED`&&(t=K(`errors.unsupportedFileType`)),{errorMessage:t}}})),a=i.filter(e=>!!e.file).map(e=>e.file);await this.insertImages(a,n,r);let o=i.find(e=>!!e.errorMessage);o&&o.errorMessage&&this.setState({errorMessage:o.errorMessage})}else{let n=e.filter(e=>e.type===`text`);n.length&&this.addTextFromPaste(n.map(e=>e.value).join(`
|
|
179
|
+
`)}}}else c=qs(ws(r.link||``));let l=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`,u=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`hover`;return(0,W.jsx)(`div`,{className:U(`excalidraw__embeddable-container`,{"is-hovered":u}),style:{transform:o?`translate(${i-this.state.offsetLeft}px, ${a-this.state.offsetTop}px) scale(${e})`:`none`,display:o?`block`:`none`,opacity:eo(r,No(r,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure,null,this.state.openDialog?.name===`elementLinkSelector`?mo:1),"--embeddable-radius":`${Fe(Math.min(r.width,r.height),r)}px`},children:(0,W.jsxs)(`div`,{className:`excalidraw__embeddable-container__inner`,style:{width:o?`${r.width}px`:0,height:o?`${r.height}px`:0,transform:o?`rotate(${r.angle}rad)`:`none`,pointerEvents:l?uo.enabled:uo.disabled},children:[u&&(0,W.jsx)(`div`,{className:`excalidraw__embeddable-hint`,children:K(`buttons.embeddableInteractionButton`)}),(0,W.jsx)(`div`,{className:`excalidraw__embeddable__outer`,style:{padding:`${r.strokeWidth}px`},children:(rs(r)?this.props.renderEmbeddable?.(r,this.state):null)??(0,W.jsx)(`iframe`,{ref:e=>this.cacheEmbeddableRef(r,e),className:`excalidraw__embeddable`,srcDoc:c?.type===`document`?c.srcdoc(this.state.theme):void 0,src:c?.type===`document`?void 0:c?.link??``,scrolling:`no`,referrerPolicy:`no-referrer-when-downgrade`,title:`Excalidraw Embedded Content`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,sandbox:`${c?.sandbox?.allowSameOrigin?`allow-same-origin`:``} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})]})},r.id)})})}toggleOverscrollBehavior(e){document.documentElement.style.overscrollBehaviorX=e.type===`pointerenter`?`none`:`auto`}render(){let e=this.scene.getSelectedElements(this.state),{renderTopRightUI:t,renderTopLeftUI:n,renderCustomStats:r}=this.props,i=this.scene.getSceneNonce(),{elementsMap:a,visibleElements:o}=this.renderer.getRenderableElements({sceneNonce:i,zoom:this.state.zoom,offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,height:this.state.height,width:this.state.width,editingTextElement:this.state.editingTextElement,newElementId:this.state.newElement?.id});this.visibleElements=o;let s=this.scene.getNonDeletedElementsMap(),c=`setPointerCapture`in HTMLElement.prototype?!1:this.state.selectionElement||this.state.newElement||this.state.selectedElementsAreBeingDragged||this.state.resizingElement||this.state.activeTool.type===`laser`&&this.state.cursorButton===`down`,l=e[0],u=Cy.get(sD)?.type===`panel`;return(0,W.jsx)(`div`,{translate:`no`,className:U(`excalidraw excalidraw-container notranslate`,{"excalidraw--view-mode":this.state.viewModeEnabled||this.state.openDialog?.name===`elementLinkSelector`,"excalidraw--mobile":this.editorInterface.formFactor===`phone`}),style:{"--ui-pointerEvents":c?uo.disabled:uo.enabled,"--right-sidebar-width":`302px`},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:(0,W.jsx)(ez.Provider,{value:this.api,children:(0,W.jsx)(WR.Provider,{value:this,children:(0,W.jsx)(GR.Provider,{value:this.props,children:(0,W.jsx)(YR.Provider,{value:this.excalidrawContainerValue,children:(0,W.jsx)(qR.Provider,{value:this.editorInterface,children:(0,W.jsx)(QR.Provider,{value:this.setAppState,children:(0,W.jsx)(ZR.Provider,{value:this.state,children:(0,W.jsxs)(XR.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,W.jsxs)($R.Provider,{value:this.actionManager,children:[(0,W.jsx)(YL,{canvas:this.canvas,appState:this.state,files:this.files,setAppState:this.setAppState,actionManager:this.actionManager,elements:this.scene.getNonDeletedElements(),onLockToggle:this.toggleLock,onPenModeToggle:this.togglePenMode,onHandToolToggle:this.onHandToolToggle,langCode:My().code,renderTopLeftUI:n,renderTopRightUI:t,renderCustomStats:r,showExitZenModeBtn:typeof this.props?.zenModeEnabled>`u`&&this.state.zenModeEnabled,UIOptions:this.props.UIOptions,onExportImage:this.onExportImage,renderWelcomeScreen:!this.state.isLoading&&this.state.showWelcomeScreen&&this.state.activeTool.type===this.state.preferredSelectionTool.type&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,generateLinkForSelection:this.props.generateLinkForSelection,children:this.props.children}),(0,W.jsx)(`div`,{className:`excalidraw-textEditorContainer`}),(0,W.jsx)(`div`,{className:`excalidraw-contextMenuContainer`}),(0,W.jsx)(`div`,{className:`excalidraw-eye-dropper-container`}),(0,W.jsx)(QL,{trails:[this.laserTrails,this.lassoTrail,this.eraserTrail]}),e.length===1&&this.state.openDialog?.name!==`elementLinkSelector`&&this.state.showHyperlinkPopup&&(0,W.jsx)(VE,{element:l,scene:this.scene,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast,updateEmbedValidationStatus:this.updateEmbedValidationStatus},l.id),this.props.aiEnabled!==!1&&e.length===1&&xe(l)&&(0,W.jsx)(Wj,{element:l,elementsMap:a,children:(0,W.jsx)(ZL,{title:K(`labels.convertToCode`),icon:fS,checked:!1,onChange:()=>this.onMagicFrameGenerate(l,`button`)})}),e.length===1&&Vs(l)&&l.customData?.generationData?.status===`done`&&(0,W.jsxs)(Wj,{element:l,elementsMap:a,children:[(0,W.jsx)(ZL,{title:K(`labels.copySource`),icon:$x,checked:!1,onChange:()=>this.onIframeSrcCopy(l)}),(0,W.jsx)(ZL,{title:`Enter fullscreen`,icon:pS,checked:!1,onChange:()=>{let e=this.getHTMLIFrameElement(l);if(e)try{e.requestFullscreen(),this.setState({activeEmbeddable:{element:l,state:`active`},selectedElementIds:{[l.id]:!0},newElement:null,selectionElement:null})}catch(e){console.warn(e),this.setState({errorMessage:`Couldn't enter fullscreen`})}}})]}),this.state.contextMenu&&(0,W.jsx)(xN,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:e=>{this.setState({contextMenu:null},()=>{this.focusContainer(),e?.()})}}),(0,W.jsx)(LR,{canvas:this.canvas,rc:this.rc,elementsMap:a,allElementsMap:s,visibleElements:o,sceneNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:Sj(this),canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:this.flowChartCreator.pendingNodes,theme:this.state.theme}}),this.state.newElement&&(0,W.jsx)(VR,{appState:this.state,scale:window.devicePixelRatio,rc:this.rc,elementsMap:a,allElementsMap:s,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!1,canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:null,theme:this.state.theme}}),(0,W.jsx)(PR,{app:this,containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elementsMap:a,visibleElements:o,allElementsMap:s,selectedElements:e,sceneNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderScrollbars:this.props.renderScrollbars===!0,editorInterface:this.editorInterface,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,W.jsx)(SN,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames(),this.state.activeLockedId&&(0,W.jsx)(UR,{app:this,activeLockedId:this.state.activeLockedId}),u&&(0,W.jsx)(OD,{app:this})]}),this.renderEmbeddables()]})})})})})})})})})}setPlugins(e){Object.assign(this.plugins,e)}async onMagicFrameGenerate(e,t){let n=this.plugins.diagramToCode?.generate;if(!n){this.setState({errorMessage:`No diagram to code plugin found`});return}let r=fo(this.scene.getNonDeletedElements(),e).filter(e=>!xe(e));if(!r.length){t===`button`?(this.setState({errorMessage:`Cannot generate from an empty frame`}),dC(`ai`,`generate (no-children)`,`d2c`)):this.setActiveTool({type:`magicframe`});return}let i=this.insertIframeElement({sceneX:e.x+e.width+30,sceneY:e.y,width:e.width,height:e.height});if(i){this.updateMagicGeneration({frameElement:i,data:{status:`pending`}}),this.setState({selectedElementIds:{[i.id]:!0}}),dC(`ai`,`generate (start)`,`d2c`);try{let{html:t}=await n({frame:e,children:r});if(dC(`ai`,`generate (success)`,`d2c`),!t.trim()){this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:`Nothing genereated :(`}});return}let a=t.includes(`<!DOCTYPE html>`)&&t.includes(`</html>`)?t.slice(t.indexOf(`<!DOCTYPE html>`),t.indexOf(`</html>`)+7):t;this.updateMagicGeneration({frameElement:i,data:{status:`done`,html:a}})}catch(e){dC(`ai`,`generate (failed)`,`d2c`),this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:e.message||`Unknown error during generation`}})}}}onIframeSrcCopy(e){e.customData?.generationData?.status===`done`&&(AT(e.customData.generationData.html),this.setToast({message:`copied to clipboard`,closable:!1,duration:1500}))}clearImageShapeCache(e){let t=e??this.files;this.scene.getNonDeletedElements().forEach(e=>{d(e)&&t[e.fileId]&&(this.imageCache.delete(e.fileId),bn.delete(e))})}async componentDidMount(){this.unmounted=!1,this.api=this.createExcalidrawAPI(),this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,(h()||Vt())&&(this.setState.bind(this),Object.defineProperties(window.h,{state:{configurable:!0,get:()=>this.state},setState:{configurable:!0,value:(...e)=>this.setState(...e)},app:{configurable:!0,value:this},history:{configurable:!0,value:this.history},store:{configurable:!0,value:this.store},fonts:{configurable:!0,value:this.fonts}})),this.store.onDurableIncrementEmitter.on(e=>{this.history.record(e.delta)}),this.props.onIncrement&&this.store.onStoreIncrementEmitter.on(e=>{this.props.onIncrement?.(e)}),this.scene.onUpdate(this.triggerRender),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),He&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorInterface(),this.updateDOMRect()}),this.resizeObserver?.observe(this.excalidrawContainerRef.current)),new URLSearchParams(window.location.search.slice(1)).has(`web-share-target`)?this.restoreFileFromShare():this.updateDOMRect(this.initializeScene),Ss()&&!x()&&this.setState({errorMessage:(0,W.jsx)(vN,{})});let e={excalidrawAPI:this.api,container:this.excalidrawContainerRef.current};this.editorLifecycleEvents.emit(`editor:mount`,e),this.props.onMount?.(e),this.props.onExcalidrawAPI?.(this.api)}componentWillUnmount(){this.api={...this.api,isDestroyed:!0};for(let e of Object.keys(this.api))(e.startsWith(`get`)||e===`onStateChange`||e===`onEvent`)&&typeof this.api[e]==`function`&&(this.api[e]=()=>{throw Error("ExcalidrawAPI is no longer usable after the editor has been unmounted and will return invalid/empty data. You should check for `ExcalidrawAPI.isDestroyed` before calling get* methods on subscribing to state/event changes.")});this.editorLifecycleEvents.emit(`editor:unmount`),this.props.onUnmount?.(),this.props.onExcalidrawAPI?.(null),window.launchQueue?.setConsumer(()=>{}),this.renderer.destroy(),this.scene.destroy(),this.scene=new Dn,this.fonts=new de(this.scene),this.renderer=new Vj(this.scene),this.files={},this.imageCache.clear(),this.resizeObserver?.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.library.destroy(),this.laserTrails.stop(),this.eraserTrail.stop(),this.onChangeEmitter.clear(),this.store.onStoreIncrementEmitter.clear(),this.store.onDurableIncrementEmitter.clear(),this.appStateObserver.clear(),this.editorLifecycleEvents.clear(),bn.destroy(),xj.destroy(),clearTimeout(vz),Ya.clearCache(),Hr.clearCache(),vz=0,document.documentElement.style.overscrollBehaviorX=``}removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(w(document,F.KEYDOWN,this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(w(this.excalidrawContainerRef.current,F.WHEEL,this.handleWheel,{passive:!1}),w(window,F.MESSAGE,this.onWindowMessage,!1),w(document,F.POINTER_UP,this.removePointer,{passive:!1}),w(document,F.COPY,this.onCopy,{passive:!1}),w(document,F.KEYUP,this.onKeyUp,{passive:!0}),w(document,F.POINTER_MOVE,this.updateCurrentCursorPosition,{passive:!1}),w(document.fonts,`loadingdone`,e=>{let t=e.fontfaces;this.fonts.onLoaded(t)},{passive:!1}),w(document,F.GESTURE_START,this.onGestureStart,!1),w(document,F.GESTURE_CHANGE,this.onGestureChange,!1),w(document,F.GESTURE_END,this.onGestureEnd,!1),w(window,F.FOCUS,()=>{this.maybeCleanupAfterMissingPointerUp(null),this.triggerRender(!0)},{passive:!1})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(w(document,F.FULLSCREENCHANGE,this.onFullscreenChange,{passive:!1}),w(document,F.PASTE,this.pasteFromClipboard,{passive:!1}),w(document,F.CUT,this.onCut,{passive:!1}),w(window,F.RESIZE,this.onResize,!1),w(window,F.UNLOAD,this.onUnload,!1),w(window,F.BLUR,this.onBlur,!1),w(this.excalidrawContainerRef.current,F.WHEEL,this.handleWheel,{passive:!1}),w(this.excalidrawContainerRef.current,F.DRAG_OVER,this.disableEvent,!1),w(this.excalidrawContainerRef.current,F.DROP,this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(w(sr(this.excalidrawContainerRef.current),F.SCROLL,this.onScroll,{passive:!1})))}componentDidUpdate(e,t){!this._initialized&&!this.state.isLoading&&(this._initialized=!0,this.editorLifecycleEvents.emit(`editor:initialize`,this.api),this.props.onInitialize?.(this.api)),this.appStateObserver.flush(t),this.updateEmbeddables();let n=this.scene.getElementsIncludingDeleted(),r=this.scene.getElementsMapIncludingDeleted(),i=(this.sessionExportThemeOverride??this.state.theme)===R.DARK;this.state.exportWithDarkMode!==i&&this.setState({exportWithDarkMode:i}),!this.state.showWelcomeScreen&&!n.length&&this.setState({showWelcomeScreen:!0}),t.userToFollow&&!this.state.collaborators.has(t.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),(t.zoom.value!==this.state.zoom.value||t.scrollX!==this.state.scrollX||t.scrollY!==this.state.scrollY)&&(this.props?.onScrollChange?.(this.state.scrollX,this.state.scrollY,this.state.zoom),this.onScrollChangeEmitter.trigger(this.state.scrollX,this.state.scrollY,this.state.zoom)),t.userToFollow!==this.state.userToFollow&&(t.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:t.userToFollow,action:`UNFOLLOW`}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:`FOLLOW`})),Object.keys(this.state.selectedElementIds).length&&zr(this.state)&&this.setState({activeTool:ka(this.state,{type:`selection`})}),this.state.activeTool.type===`eraser`&&t.theme!==this.state.theme&&Jw(this.interactiveCanvas,this.state.theme),t.activeTool.type===`selection`&&this.state.activeTool.type!==`selection`&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),e.langCode!==this.props.langCode&&this.updateLanguage(),zr(t)&&!zr(this.state)&&this.eraserTrail.endPath(),e.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),t.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),(t.openDialog?.name===`elementLinkSelector`||this.state.openDialog?.name===`elementLinkSelector`)&&t.openDialog?.name!==this.state.openDialog?.name&&(this.deselectElements(),this.setState({hoveredElementIds:{}})),e.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),e.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),this.excalidrawContainerRef.current?.classList.toggle(`theme--dark`,this.state.theme===R.DARK),this.state.selectedLinearElement?.isEditing&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.actionManager.executeAction(oT)}),this.state.editingTextElement?.isDeleted&&this.setState({editingTextElement:null}),this.store.commit(r,this.state),this.state.isLoading||(this.props.onChange?.(n,this.state,this.files),this.onChangeEmitter.trigger(n,this.state,this.files))}static resetTapTwice(){dz=!1,pz=null}async insertClipboardContent(e,t,r){let{x:i,y:a}=la({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state);if(e.errorMessage){this.setState({errorMessage:e.errorMessage});return}if(t.length===0&&!r&&e.mixedContent){await this.addElementsFromMixedContentPaste(e.mixedContent,{isPlainPaste:r,sceneX:i,sceneY:a});return}if(!r&&e.text){let t=hN(e.text);if(t.ok){this.setState({openDialog:{name:`charts`,data:t.data,rawText:e.text}});return}}let o=t.map(e=>e.file);if(o.length===0&&e.text&&!r){let t=e.text.trim();t.startsWith(`<svg`)&&t.endsWith(`</svg>`)&&o.push(Xi(t))}if(o.length>0){this.isToolSupported(`image`)?await this.insertImages(o,i,a):this.setState({errorMessage:K(`errors.imageToolNotSupported`)});return}if(e.elements){let t=e.programmaticAPI?sn(e.elements):e.elements;this.addElementsFromPasteOrLibrary({elements:t,files:e.files||null,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`,retainSeed:r});return}if(!e.text)return;if(!r&&rM(e.text)){let t=await n(()=>import(`./excalidraw-mermaid-stub-LpuTrLnr.js`),__vite__mapDeps([70,71]),import.meta.url);try{let{elements:n,files:r={}}=await t.parseMermaidToExcalidraw(e.text),i=sn(n,{regenerateIds:!0});this.addElementsFromPasteOrLibrary({elements:i,files:r,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`});return}catch(e){console.warn(`parsing pasted text as mermaid definition failed: ${e.message}`)}}let s=Wa(e.text).split(/\n+/).map(e=>e.trim()).filter(Boolean),c=s.map(e=>Gi(e)).filter(e=>Lt(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||qs(e)?.type===`video`));if(!r&&c.length>0&&c.length===s.length){let e=[];for(let t of c){let n=e[e.length-1],r=this.insertEmbeddableElement({sceneX:n?n.x+n.width+20:i,sceneY:a,link:Hs(t)});r&&e.push(r)}e.length&&(this.store.scheduleCapture(),this.setState({selectedElementIds:Object.fromEntries(e.map(e=>[e.id,!0]))}));return}this.addTextFromPaste(e.text,r)}async addElementsFromMixedContentPaste(e,{isPlainPaste:t,sceneX:n,sceneY:r}){if(!t&&e.some(e=>e.type===`imageUrl`)&&this.isToolSupported(`image`)){let t=e.filter(e=>e.type===`imageUrl`).map(e=>e.value),i=await Promise.all(t.map(async e=>{try{return{file:await Ja(e)}}catch(e){let t=e.message;return e.cause===`FETCH_ERROR`?t=K(`errors.failedToFetchImage`):e.cause===`UNSUPPORTED`&&(t=K(`errors.unsupportedFileType`)),{errorMessage:t}}})),a=i.filter(e=>!!e.file).map(e=>e.file);await this.insertImages(a,n,r);let o=i.find(e=>!!e.errorMessage);o&&o.errorMessage&&this.setState({errorMessage:o.errorMessage})}else{let n=e.filter(e=>e.type===`text`);n.length&&this.addTextFromPaste(n.map(e=>e.value).join(`
|
|
180
180
|
|
|
181
181
|
`),t)}}addTextFromPaste(e,t=!1){let{x:n,y:r}=la({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),i={x:n,y:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roundness:null,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:e,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:Ns,verticalAlign:`top`,locked:!1},a=u({fontSize:i.fontSize,fontFamily:i.fontFamily}),o=ba(i.fontFamily),[s,,c]=Ue(this.state),l=Math.max(Math.min((c-s)*.5,800),200),d=r,f=t?[e]:e.split(`
|
|
182
|
-
`),p=f.reduce((e,t,r)=>{let s=Va(t).trim();if(s.length){let t=this.getTopLayerFrameAtSceneCoords({x:n,y:d}),r=gn(s,a,o),c=r.width>l,u=c?Jt(s,a,l):s;r=c?gn(u,a,o):r;let f=n-r.width/2,p=d-r.height/2,m=Li({...i,x:f,y:p,text:u,originalText:s,lineHeight:o,autoResize:!c,frameId:t?t.id:null});e.push(m),d+=m.height+10}else f[r-1]?.trim()&&(d+=qo(i.fontSize,o)+10);return e},[]);p.length!==0&&(this.scene.insertElements(p),this.store.scheduleCapture(),this.setState({selectedElementIds:P(Object.fromEntries(p.map(e=>[e.id,!0])),this.state)}),!t&&p.length>1&&Cz===!1&&this.editorInterface.formFactor!==`phone`&&(this.setToast({message:K(`toast.pasteAsSingleElement`,{shortcut:Q(`CtrlOrCmd+Shift+V`)}),duration:5e3}),Cz=!0))}handleTextWysiwyg(e,{isExistingElement:t=!1}){let n=this.scene.getElementsMapIncludingDeleted(),r=(t,r)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(i=>i.id===e.id&&M(i)?B(i,{originalText:t,isDeleted:r??i.isDeleted,...he(i,so(i,n),n,t)}):i)])};Zj({id:e.id,canvas:this.canvas,getViewportCoords:(e,t)=>{let{x:n,y:r}=Ci({sceneX:e,sceneY:t},this.state);return[n-this.state.offsetLeft,r-this.state.offsetTop]},onChange:qj(t=>{r(t,!1),Is(e)&&ue(e,this.scene)}),onSubmit:qj(({viaKeyboard:n,nextOriginalText:i})=>{let a=!i.trim();if(r(i,a),!a&&n){let t=e.containerId?e.containerId:e.id;(0,_c.flushSync)(()=>{this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[t]:!0},e)}))})}a&&Go(this.scene.getNonDeletedElements(),[e]),(!a||t)&&this.store.scheduleCapture(),(0,_c.flushSync)(()=>{this.setState({newElement:null,editingTextElement:null})}),this.state.activeTool.locked&&Yw(this.interactiveCanvas,this.state),this.focusContainer()}),element:e,excalidrawContainer:this.excalidrawContainerRef.current,app:this,autoSelect:!this.editorInterface.isTouchScreen}),this.deselectElements(),r(e.originalText,!1)}deselectElements(){this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(e,t){let n=this.getElementAtPosition(e,t,{includeBoundTextElement:!0});return n&&M(n)&&!n.isDeleted?n:null}getElementAtPosition(e,t,n){let r=[];if(r=n&&`allHitElements`in n?n?.allHitElements||[]:this.getElementsAtPosition(e,t,{includeBoundTextElement:n?.includeBoundTextElement,includeLockedElements:n?.includeLockedElements}),r.length>1){if(n?.preferSelected){for(let e=r.length-1;e>-1;e--)if(this.state.selectedElementIds[r[e].id])return r[e]}let i=r[r.length-1];return Ui({point:O(e,t),element:i,threshold:this.getElementHitThreshold(i)/2,elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:L(i)?this.frameNameBoundsCache.get(i):null})?i:r[r.length-2]}return r.length===1?r[0]:null}getElementsAtPosition(e,t,n){let r=[],i=this.scene.getNonDeletedElementsMap();return(n?.includeBoundTextElement&&n?.includeLockedElements?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(e=>(n?.includeLockedElements||!e.locked)&&(n?.includeBoundTextElement||!(M(e)&&e.containerId)))).filter(n=>this.hitElement(e,t,n)).filter(n=>{let r=No(n,i);return r&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?ns({x:e,y:t},r,i):!0}).filter(e=>Vs(e)?(r.push(e),!1):!0).concat(r)}getElementHitThreshold(e){return Math.max(e.strokeWidth/2+.1,.85*(an/this.state.zoom.value))}hitElement(e,t,n,r=!0){return r&&this.state.selectedElementIds[n.id]&&Jo([n],this.state,this.editorInterface)&&Re(O(e,t),n,this.scene.getNonDeletedElementsMap(),this.getElementHitThreshold(n))||Hn(O(e,t),n,this.scene.getNonDeletedElementsMap())?!0:Ui({point:O(e,t),element:n,threshold:this.getElementHitThreshold(n),elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:L(n)?this.frameNameBoundsCache.get(n):null})}getTextBindableContainerAtPosition(e,t){let n=this.scene.getNonDeletedElements(),r=this.scene.getSelectedElements(this.state);if(r.length===1)return k(r[0],!1)?r[0]:null;let i=null;for(let r=n.length-1;r>=0;--r){if(n[r].isDeleted)continue;let[a,o,s,c]=ei(n[r],this.scene.getNonDeletedElementsMap());if(jt(n[r])&&Ui({point:O(e,t),element:n[r],elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(n[r])})){i=n[r];break}else if(a<e&&e<s&&o<t&&t<c){i=n[r];break}}return k(i,!1)?i:null}handleHoverSelectedLinearElement(e,t,n){let r=this.scene.getNonDeletedElementsMap(),i=I.getElement(e.elementId,r);if(i)if(this.state.selectedLinearElement){let a=-1,o=null;Ui({point:O(t,n),element:i,elementsMap:r,threshold:this.getElementHitThreshold(i)})?(a=I.getPointIndexUnderCursor(i,r,this.state.zoom,t,n),o=I.getSegmentMidpointHitCoords(e,{x:t,y:n},this.state,this.scene.getNonDeletedElementsMap()),(dr(i)?a===0||a===i.points.length-1:a>=0)||o?Gw(this.interactiveCanvas,Kn.POINTER):this.hitElement(t,n,i)&&(!dr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Gw(this.interactiveCanvas,Kn.MOVE)):this.hitElement(t,n,i)&&(!dr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Gw(this.interactiveCanvas,Kn.MOVE),this.state.selectedLinearElement.hoverPointIndex!==a&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:a}}),I.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,o)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:o}});let s=null,c=i;(c.startBinding||c.endBinding)&&(s=La(i,t,n,this.scene,this.state)),this.state.selectedLinearElement.hoveredFocusPointBinding!==s&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1,hoveredFocusPointBinding:s}}),s&&Gw(this.interactiveCanvas,Kn.POINTER)}else Gw(this.interactiveCanvas,Kn.AUTO)}updateGestureOnPointerDown(e){Tz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),Tz.pointers.size===2&&(Tz.lastCenter=mj(Tz.pointers),Tz.initialScale=this.state.zoom.value,Tz.initialDistance=hj(Array.from(Tz.pointers.values())))}initialPointerDownState(e){let t=la(e,this.state),n=this.scene.getSelectedElements(this.state),[r,i,a,o]=Ii(n),s=n.findIndex(dr)===0;return{origin:t,withCmdOrCtrl:e[N.CTRL_OR_CMD],originInGrid:pt(It(t.x,t.y,e[N.CTRL_OR_CMD]||s?null:this.getEffectiveGridSize())),scrollbars:nM(_z,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop),lastCoords:{...t},originalElements:this.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,qn(t)),e),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:`origin`,center:{x:(a+r)/2,y:(o+i)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(t,n)},drag:{hasOccurred:!1,offset:null,origin:{...t},blockDragging:!1},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1}}}handleDraggingScrollBar(e,t){if(!(t.scrollbars.isOverEither&&!this.state.multiElement))return!1;gz=!0,t.lastCoords.x=e.clientX,t.lastCoords.y=e.clientY;let n=Jj(e=>{e.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(e,t)}),r=qj(()=>{wz=null,gz=!1,Yw(this.interactiveCanvas,this.state),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(F.POINTER_MOVE,n),window.removeEventListener(F.POINTER_UP,r),n.flush()});return wz=r,window.addEventListener(F.POINTER_MOVE,n),window.addEventListener(F.POINTER_UP,r),!0}isASelectedElement(e){return e!=null&&this.state.selectedElementIds[e.id]}isHittingCommonBoundingBoxOfSelectedElements(e,t){if(t.length<2)return!1;let n=Math.max(an/this.state.zoom.value,1),[r,i,a,o]=Ii(t);return e.x>r-n&&e.x<a+n&&e.y>i-n&&e.y<o+n}getCurrentItemRoundness(e){return this.state.currentItemRoundness===`round`?{type:Ga(e)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null}maybeCacheReferenceSnapPoints(e,t,n=!1){Cj({event:e,app:this,selectedElements:t})&&(n||!xj.getReferenceSnapPoints())&&xj.setReferenceSnapPoints(kj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(e,t,n=!1){Cj({event:e,app:this,selectedElements:t})&&(n||!xj.getVisibleGaps())&&xj.setVisibleGaps(Dj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(e){return qj(t=>{this.maybeHandleResize(e,t)||this.maybeDragNewGenericElement(e,t)})}onKeyUpFromPointerDownHandler(e){return qj(t=>{t.key===N.ALT&&t.preventDefault(),!this.maybeHandleResize(e,t)&&this.maybeDragNewGenericElement(e,t)})}onPointerMoveFromPointerDownHandler(e){return Jj(t=>{if(this.state.openDialog?.name===`elementLinkSelector`)return;let n=la(t,this.state);if(this.state.activeLockedId&&this.setState({activeLockedId:null}),this.state.selectedLinearElement&&this.state.selectedLinearElement.elbowed&&this.state.selectedLinearElement.initialState.segmentMidpoint.index){let[e,r]=It(n.x,n.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.state.selectedLinearElement.initialState.segmentMidpoint.index;if(i<0){let t=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:e,y:r},this.state,this.scene.getNonDeletedElementsMap());i=t?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,t,this.scene.getNonDeletedElementsMap()):-1}let a=I.moveFixedSegment(this.state.selectedLinearElement,i,e,r,this.scene);this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0,segmentMidPointHoveredCoords:a.segmentMidPointHoveredCoords,initialState:a.initialState}});return}let r=this.previousPointerMoveCoords??e.origin;if(this.previousPointerMoveCoords=n,e.drag.offset===null&&(e.drag.offset=pt(Qa(this.scene.getSelectedElements(this.state),e.origin.x,e.origin.y))),!(t.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(t,e))return;if(zr(this.state)){this.handleEraser(t,n);return}this.state.activeTool.type===`laser`&&this.laserTrails.addPointToPath(n.x,n.y);let[i,a]=It(n.x,n.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize());if(e.resize.isResizing&&(e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeHandleCrop(e,t)||this.maybeHandleResize(e,t)))return!0;let o=this.scene.getNonDeletedElementsMap();if(this.state.selectedLinearElement){let r=this.state.selectedLinearElement;if(r.draggedFocusPointBinding){Pr(r,o,n,this.scene,this.state,this.getEffectiveGridSize(),t.altKey),this.setState({selectedLinearElement:{...r,isDragging:!1,selectedPointsIndices:[],initialState:{...r.initialState,lastClickedPoint:-1}}});return}if(I.shouldAddMidpoint(this.state.selectedLinearElement,n,this.state,o)){let e=I.addMidpoint(this.state.selectedLinearElement,n,this,!t[N.CTRL_OR_CMD],this.scene);if(!e)return;(0,_c.flushSync)(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:e.pointerDownState,selectedPointsIndices:e.selectedPointsIndices,segmentMidPointHoveredCoords:null}})});return}else{if(r.initialState.segmentMidpoint.value!==null&&!r.initialState.segmentMidpoint.added)return;if(r.initialState.lastClickedPoint>-1){let i=I.getElement(r.elementId,o);if(i?.isDeleted)return;if(ss(i)){let e=go(O(n.x,n.y),this.scene.getNonDeletedElements(),o);Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(i,e)}if(t.altKey&&!this.state.selectedLinearElement?.initialState?.arrowStartIsInside&&Ys(`COMPLEX_BINDINGS`)&&this.handleSkipBindMode(),r.initialState.lastClickedPoint===-1)return;let a=I.handlePointDragging(t,this,n.x,n.y,r);if(a){e.lastCoords.x=n.x,e.lastCoords.y=n.y,e.drag.hasOccurred=!0,(a.suggestedBinding!==this.state.suggestedBinding||!ji(a.selectedLinearElement?.selectedPointsIndices??[],this.state.selectedLinearElement?.selectedPointsIndices??[])||a.selectedLinearElement?.hoverPointIndex!==this.state.selectedLinearElement?.hoverPointIndex||a.selectedLinearElement?.customLineAngle!==this.state.selectedLinearElement?.customLineAngle||this.state.selectedLinearElement.isDragging!==a.selectedLinearElement?.isDragging||this.state.selectedLinearElement?.initialState?.altFocusPoint!==a.selectedLinearElement?.initialState?.altFocusPoint)&&this.setState(a);return}}}}let s=e.hit.allHitElements.some(e=>this.isASelectedElement(e)),c=this.state.selectedLinearElement?.isEditing&&t.shiftKey&&this.state.selectedLinearElement.elementId===e.hit.element?.id;if((s||e.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!c&&!e.drag.blockDragging){let i=this.scene.getSelectedElements(this.state);if(i.length>0&&i.every(e=>e.locked))return;let a=i.find(e=>L(e)),s=this.getTopLayerFrameAtSceneCoords(n),c=s&&!a?s:null;if(this.state.frameToHighlight!==c&&(0,_c.flushSync)(()=>{this.setState({frameToHighlight:c})}),e.drag.hasOccurred=!0,this.state.activeTool.type===`lasso`&&this.lassoTrail.hasCurrentTrail&&!(this.editorInterface.formFactor!==`desktop`&&e.hit.element)&&!this.state.activeTool.fromSelection)return;if(this.state.activeTool.type===`lasso`&&i.length>0&&e.drag.hasOccurred&&!this.state.activeTool.fromSelection&&this.lassoTrail.endPath(),i.length>0&&!e.withCmdOrCtrl&&!this.state.editingTextElement&&this.state.activeEmbeddable?.state!==`active`){let a={x:n.x-e.drag.origin.x,y:n.y-e.drag.origin.y},s=[...e.originalElements.values()],c=t.shiftKey;if(c){let e=Math.abs(a.x),t=Math.abs(a.y),n=c&&e<t,r=c&&e>t;n&&(a.x=0),r&&(a.y=0)}if(this.state.croppingElementId){let t=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(t&&io(t)&&t.crop!==null&&e.hit.element===t){let e=t.crop,i=d(t)&&this.imageCache.get(t.fileId)?.image;if(i&&!(i instanceof Promise)){let a=A(t),s=nr(n.x-r.x,n.y-r.y);s[0]*=i.naturalWidth/a.width,s[1]*=i.naturalHeight/a.height;let[c,l,u,d,f,p]=ei(t,o),m=Mn(ke(O(c,l),O(f,p),t.angle)),h=Mn(ke(O(u,l),O(f,p),t.angle)),g=Mn(ke(O(c,d),O(f,p),t.angle)),_=Zt(y(h,m)),v=Zt(y(g,m)),b=nr(ys(s,_),ys(s,v)),x={...e,x:Ht(e.x-b[0]*Math.sign(t.scale[0]),0,i.naturalWidth-e.width),y:Ht(e.y-b[1]*Math.sign(t.scale[1]),0,i.naturalHeight-e.height)};this.scene.mutateElement(t,{crop:x});return}}}this.maybeCacheVisibleGaps(t,i),this.maybeCacheReferenceSnapPoints(t,i);let{snapOffset:l,snapLines:u}=jj(s,a,this,t,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:u}),this.state.editingFrame||bo(e,i,a,this.scene,l,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),this.setState({selectedElementsAreBeingDragged:!0,selectionElement:null}),t.altKey&&!e.hit.hasBeenDuplicated){e.hit.hasBeenDuplicated=!0;let n=this.scene.getElementsIncludingDeleted(),r=e.hit.element,i=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});r&&e.hit.wasAddedToSelection&&!i.find(e=>e.id===r.id)&&i.push(r);let a=new Map(i.map(e=>[e.id,e])),{duplicatedElements:o,duplicateElementsMap:s,elementsWithDuplicates:c,origIdToDuplicateId:l}=Er({type:`in-place`,elements:n,appState:this.state,randomizeSeed:!0,idsOfElementsToDuplicate:a,overrides:({duplicateElement:e,origElement:t})=>({frameId:e.frameId??t.frameId,seed:se()})});o.forEach(t=>{e.originalElements.set(t.id,qn(t))});let u=c.map(t=>{if(a.has(t.id)){let n=e.originalElements.get(t.id);if(n)return B(t,{x:n.x,y:n.y})}return t}),d=this.props.onDuplicate?.(u,n),f=fe(d||u,lr(o));(0,_c.flushSync)(()=>{if(e.hit.element){let t=l.get(e.hit.element.id),n=t&&s.get(t);e.hit.element=n||null}e.hit.allHitElements=e.hit.allHitElements.reduce((e,t)=>{let n=l.get(t.id),r=n&&s.get(n);return r&&e.push(r),e},[]),e.drag.origin=la(t,this.state),this.setState(e=>({...Br(o,this.scene.getNonDeletedElements(),e)})),this.scene.replaceAllElements(f),i.forEach(e=>{un(e)&&e.boundElements?.some(e=>e.type===`arrow`)&&ue(e,this.scene)}),this.maybeCacheVisibleGaps(t,i,!0),this.maybeCacheReferenceSnapPoints(t,i,!0)})}return}}if(this.state.selectionElement){if(e.lastCoords.x=n.x,e.lastCoords.y=n.y,t.altKey){this.setActiveTool({type:`lasso`,fromSelection:!0},t.shiftKey),this.lassoTrail.startPath(e.origin.x,e.origin.y,t.shiftKey),this.setAppState({selectionElement:null});return}this.maybeDragNewGenericElement(e,t)}else if(this.state.activeTool.type===`lasso`)!t.altKey&&this.state.activeTool.fromSelection?(this.setActiveTool({type:`selection`}),this.createGenericElementOnPointerDown(`selection`,e),e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t),this.lassoTrail.endPath()):this.lassoTrail.addPointToPath(n.x,n.y,t.shiftKey);else{let r=this.state.newElement;if(!r)return;if(r.type===`freedraw`){let e=r.points,i=n.x-r.x,a=n.y-r.y,o=e.length>0&&e[e.length-1];if(!(o&&o[0]===i&&o[1]===a)){let n=r.simulatePressure?r.pressures:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...e,O(i,a)],pressures:n},{informMutation:!1,isDragging:!1}),this.setState({newElement:r})}}else if(b(r)&&!r.isDeleted){e.drag.hasOccurred=!0;let n=r.points;gt(n.length>1,`Do not create linear elements with less than 2 points`);let o=this.state.selectedLinearElement;o||=(o=new I(r,this.scene.getNonDeletedElementsMap()),{...o,selectedPointsIndices:[1],initialState:{...o.initialState,lastClickedPoint:1}}),this.setState({newElement:r,...I.handlePointDragging(t,this,i,a,o)})}else e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t,!1)}if(this.state.activeTool.type===`selection`){e.boxSelection.hasOccurred=!0;let n=this.scene.getNonDeletedElements();if(this.state.selectedLinearElement?.isEditing)I.handleBoxSelection(t,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let r=!0;!t.shiftKey&&Ya(n,this.state)&&(e.withCmdOrCtrl&&e.hit.element?this.setState(t=>Hr({...t,selectedElementIds:{[e.hit.element.id]:!0}},this.scene.getNonDeletedElements(),t,this)):r=!1);let i=this.state.selectionElement?Ta(n,this.state.selectionElement,this.scene.getNonDeletedElementsMap(),!1):[];this.setState(t=>{let n={...r&&t.selectedElementIds,...i.reduce((e,t)=>(e[t.id]=!0,e),{})};return e.hit.element&&(i.length?delete n[e.hit.element.id]:n[e.hit.element.id]=!0),t=r?t:{...t,selectedGroupIds:{},editingGroupId:null},{...Hr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.scene.getNonDeletedElements(),t,this),selectedLinearElement:i.length===1&&b(i[0])?new I(i[0],this.scene.getNonDeletedElementsMap()):null,showHyperlinkPopup:i.length===1&&(i[0].link||rs(i[0]))?`info`:!1}})}}})}handlePointerMoveOverScrollbars(e,t){if(t.scrollbars.isOverHorizontal){let n=e.clientX,r=n-t.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-r*(_z.horizontal?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.x=n,!0}if(t.scrollbars.isOverVertical){let n=e.clientY,r=n-t.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-r*(_z.vertical?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.y=n,!0}return!1}onPointerUpFromPointerDownHandler(e){return qj(t=>{let n=this.scene.getNonDeletedElementsMap();this.removePointer(t),e.drag.blockDragging=!1,e.eventListeners.onMove&&e.eventListeners.onMove.flush();let{newElement:r,resizingElement:i,croppingElementId:a,multiElement:o,activeTool:s,isResizing:c,isRotating:l,isCropping:d}=this.state;this.setState(e=>({isResizing:!1,isRotating:!1,isCropping:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:`up`,snapLines:tr(e.snapLines,[]),originSnapOffset:null})),this.lassoTrail.endPath(),this.previousPointerMoveCoords=null,xj.setReferenceSnapPoints(null),xj.setVisibleGaps(null),this.savePointer(t.clientX,t.clientY,`up`);let f=e.hit.allHitElements,p=la({clientX:t.clientX,clientY:t.clientY},this.state);if(this.state.activeTool.type===`selection`&&!e.boxSelection.hasOccurred&&!e.resize.isResizing&&!f.some(e=>this.state.selectedElementIds[e.id])){let e=this.getElementAtPosition(p.x,p.y,{includeLockedElements:!0});this.store.scheduleCapture(),e?.locked?this.setState({activeLockedId:e.groupIds.length>0?e.groupIds.at(-1)||``:e.id}):this.setState({activeLockedId:null})}else this.setState({activeLockedId:null});if(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.setState({selectedElementsAreBeingDragged:!1,bindMode:`orbit`}),e.drag.hasOccurred&&e.hit?.element?.id){let t=n.get(e.hit.element.id);un(t)&&t.boundElements?.filter(e=>e.type===`arrow`).map(e=>n.get(e.id)).filter(e=>dr(e)).forEach(e=>{e&&this.scene.mutateElement(e,{})})}if(this.state.selectedLinearElement?.isEditing&&!this.state.newElement&&this.state.selectedLinearElement.draggedFocusPointBinding===null)if(!e.boxSelection.hasOccurred&&e.hit?.element?.id!==this.state.selectedLinearElement.elementId&&this.state.selectedLinearElement.draggedFocusPointBinding===null)this.actionManager.executeAction(oT);else{let e=I.handlePointerUp(t,this.state.selectedLinearElement,this.state,this.scene);this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p}),e!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:e,suggestedBinding:null})}else if(this.state.selectedLinearElement){if(this.state.selectedLinearElement.elbowed){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());e&&this.scene.mutateElement(e,{})}if(this.state.selectedLinearElement.draggedFocusPointBinding?(yr(this.state.selectedLinearElement,this.scene),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,draggedFocusPointBinding:null}})):e.hit?.element?.id===this.state.selectedLinearElement.elementId?this.state.selectedLinearElement.isDragging&&(this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1}}),this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p})):this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null}),this.state.newElement&&this.state.multiElement&&b(this.state.newElement)&&this.state.selectedLinearElement){let{multiElement:e}=this.state;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:e.points[e.points.length-1]}})}}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener(F.POINTER_MOVE,e.eventListeners.onMove),window.removeEventListener(F.POINTER_UP,e.eventListeners.onUp),window.removeEventListener(F.KEYDOWN,e.eventListeners.onKeyDown),window.removeEventListener(F.KEYUP,e.eventListeners.onKeyUp),this.props?.onPointerUp?.(s,e),this.onPointerUpEmitter.trigger(this.state.activeTool,e,t),r?.type===`freedraw`){let e=la(t,this.state),n=r.points,i=e.x-r.x,a=e.y-r.y;i===n[0][0]&&a===n[0][1]&&(a+=1e-4,i+=1e-4);let o=r.simulatePressure?[]:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...n,O(i,a)],pressures:o}),this.actionManager.executeAction(oT);return}if(b(r)){r.points.length>1&&r.points[1][0]!==0&&r.points[1][1]!==0&&this.store.scheduleCapture();let n=la(t,this.state),i=Se(O(n.x,n.y),O(e.origin.x,e.origin.y))*this.state.zoom.value;if((!e.drag.hasOccurred||i<20)&&r&&!o)if(this.editorInterface.isTouchScreen){let e=Math.min(this.state.width*.7/this.state.zoom.value,100);this.scene.mutateElement(r,{x:r.x-e/2,points:[O(0,0),O(e,0)]},{informMutation:!1,isDragging:!1}),this.actionManager.executeAction(oT)}else{let e=n.x-r.x,t=n.y-r.y;this.scene.mutateElement(r,{points:[r.points[0],O(e,t)]},{informMutation:!1,isDragging:!1}),this.setState({multiElement:r,newElement:r})}else e.drag.hasOccurred&&!o&&(b(r)&&this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p}),this.setState({suggestedBinding:null,startBoundElement:null}),s.locked?this.setState(e=>({newElement:null})):(Ww(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:P({...e.selectedElementIds,[r.id]:!0},e),selectedLinearElement:new I(r,this.scene.getNonDeletedElementsMap())}))),this.scene.triggerUpdate());return}if(M(r)){let e=Ve(u({fontSize:r.fontSize,fontFamily:r.fontFamily}),r.lineHeight);r.width<e&&this.scene.mutateElement(r,{autoResize:!0}),this.resetCursor(),this.handleTextWysiwyg(r,{isExistingElement:!0})}if(s.type!==`selection`&&r&&na(r)){this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==r.id),appState:{newElement:null},captureUpdate:V.NEVER});return}if(L(r)){let e=zi(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(Je(this.scene.getElementsMapIncludingDeleted(),e,r,this.state))}if(r&&(this.scene.mutateElement(r,$i(r),{informMutation:!1,isDragging:!1}),this.scene.triggerUpdate()),e.drag.hasOccurred){let e=la(t,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){let e=this.scene.getElement(this.state.selectedLinearElement.elementId);if(e?.frameId){let t=No(e,n);t&&e&&(pr(e,t,this.scene.getNonDeletedElementsMap())||(this.scene.mutateElement(e,{groupIds:[]}),Pi([e],this.scene.getNonDeletedElementsMap()),this.scene.triggerUpdate()))}}else{let t=this.getTopLayerFrameAtSceneCoords(e),n=this.scene.getSelectedElements(this.state),r=this.scene.getElementsMapIncludingDeleted(),i=e=>{if(e.length>0){for(let t of e){let e=t.groupIds.indexOf(this.state.editingGroupId);this.scene.mutateElement(t,{groupIds:t.groupIds.slice(0,e)},{informMutation:!1,isDragging:!1})}r.forEach(e=>{e.groupIds.length&&Ki(r,e.groupIds[e.groupIds.length-1]).length<2&&this.scene.mutateElement(e,{groupIds:[]},{informMutation:!1,isDragging:!1})}),this.setState({editingGroupId:null})}};if(t&&!this.state.selectedElementIds[t.id]){let e=n.filter(e=>e.frameId!==t.id&&qr(e,r,this.state));this.state.editingGroupId&&i(e),r=Je(r,e,t,this.state)}else !t&&this.state.editingGroupId&&i(n.filter(e=>e.frameId&&!qr(e,r,this.state)));r=lo(r,this.state,this),this.scene.replaceAllElements(r)}}if(i&&this.store.scheduleCapture(),i&&na(i)&&this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==i.id),captureUpdate:V.NEVER}),e.resize.isResizing){let e=lo(this.scene.getElementsIncludingDeleted(),this.state,this),t=this.scene.getSelectedElements(this.state).filter(e=>L(e));for(let r of t)e=Ai(e,kn(this.scene.getElementsIncludingDeleted(),r,this.state,n),r,this);this.scene.replaceAllElements(e)}let m=e.hit.element;this.state.selectedLinearElement?.elementId!==m?.id&&b(m)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new I(m,this.scene.getNonDeletedElementsMap())}),(!a||a&&(!m&&!d||m&&m.id!==a))&&this.finishImageCropping();let h=this.lastPointerDownEvent,g=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(zr(this.state)&&h&&g){if(this.eraserTrail.endPath(),Se(O(h.clientX,h.clientY),O(g.clientX,g.clientY))===0){let e=la({clientX:g.clientX,clientY:g.clientY},this.state);this.getElementsAtPosition(e.x,e.y).forEach(e=>this.elementsPendingErasure.add(e.id))}this.eraseElements();return}else this.elementsPendingErasure.size&&this.restoreReadyToEraseElements();if(m&&!e.drag.hasOccurred&&!e.hit.wasAddedToSelection&&(!this.state.selectedLinearElement?.isEditing||!e.boxSelection.hasOccurred)&&this.state.activeTool.type!==`lasso`&&(t.shiftKey&&!this.state.selectedLinearElement?.isEditing?this.state.selectedElementIds[m.id]?ft(this.state,m)?this.setState(e=>{let t={...e.selectedElementIds};for(let e of m.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)))delete t[e.id];return{selectedGroupIds:{...e.selectedElementIds,...m.groupIds.map(e=>({[e]:!1})).reduce((e,t)=>({...e,...t}),{})},selectedElementIds:P(t,e)}}):this.state.selectedLinearElement?.isDragging||this.setState(e=>{let t={...e.selectedElementIds};delete t[m.id];let n=ir(this.scene.getNonDeletedElements(),{selectedElementIds:t});return{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:n.length===1&&b(n[0])?new I(n[0],this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}}):m.frameId&&this.state.selectedElementIds[m.frameId]?this.setState(e=>{let t={...e.selectedElementIds,[m.id]:!0};return delete t[m.frameId],(this.scene.getElement(m.frameId)?.groupIds??[]).flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}),{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:m.link||rs(m)?`info`:!1}}):this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[m.id]:!0},e)})):this.setState(e=>({...Hr({editingGroupId:e.editingGroupId,selectedElementIds:{[m.id]:!0}},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:b(m)&&e.selectedLinearElement?.elementId!==m.id?new I(m,this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}))),this.state.activeTool.type!==`lasso`&&!(m&&dr(m))&&!e.drag.hasOccurred&&!this.state.isResizing&&(m&&vt({point:O(e.origin.x,e.origin.y),element:m,elementsMap:n,threshold:this.getElementHitThreshold(m),frameNameBound:L(m)?this.frameNameBoundsCache.get(m):null},n)||!m&&e.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.selectedLinearElement?.isEditing?this.actionManager.executeAction(XA):this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),Gw(this.interactiveCanvas,Kn.AUTO);return}if(!s.locked&&s.type!==`freedraw`&&r&&this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[r.id]:!0},e),showHyperlinkPopup:rs(r)&&!r.link?`editor`:e.showHyperlinkPopup})),(s.type!==`selection`||Ya(this.scene.getNonDeletedElements(),this.state)||!ji(this.state.previousSelectedElementIds,this.state.selectedElementIds))&&this.store.scheduleCapture(),(e.drag.hasOccurred&&!this.state.selectedLinearElement||c||l||d)&&Bo(this.scene.getSelectedElements(this.state).filter(jt),this.scene,this.state),s.type===`laser`){this.laserTrails.endPath();return}!s.locked&&s.type!==`freedraw`&&(s.type!==`lasso`||s.type===`lasso`&&s.fromSelection)?(Ww(this.interactiveCanvas),this.setState({newElement:null,suggestedBinding:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})})):this.setState({newElement:null,suggestedBinding:null})})}clearSelection(e){this.setState(t=>({selectedElementIds:P({},t),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:t.editingGroupId&&e!=null&&Lo(e,t.editingGroupId)?t.editingGroupId:null})),this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds,selectedLinearElement:null})}getTextWysiwygSnappedToCenterPosition(e,t,n,r){if(r){let i=r.x+r.width/2,a=r.y+r.height/2,o=nn(r,n,this.scene.getNonDeletedElementsMap());if(o&&(i=o.x,a=o.y),Math.hypot(e-i,t-a)<30){let{x:e,y:t}=Ci({sceneX:i,sceneY:a},n);return{viewportX:e,viewportY:t,elementCenterX:i,elementCenterY:a}}}}getCanvasOffsets(){if(this.excalidrawContainerRef?.current){let{left:e,top:t}=this.excalidrawContainerRef.current.getBoundingClientRect();return{offsetLeft:e,offsetTop:t}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){await jy(Dy.find(e=>e.code===this.props.langCode)||Ey),this.setAppState({})}};(h()||Vt())&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(ho(e))}},scene:{configurable:!0,get(){return this.app?.scene}}}));var Dz=Ez,Oz=e=>{let[t,n]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let t=async()=>{await jy(r),n(!1)},r=Dy.find(t=>t.code===e.langCode)||Ey;t()},[e.langCode]),t?(0,W.jsx)(CN,{theme:e.theme}):e.children},kz=({children:e})=>{let{FooterCenterTunnel:t}=gk(),n=gC();return(0,W.jsx)(t.In,{children:(0,W.jsx)(`div`,{className:U(`footer-center zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})};kz.displayName=`FooterCenter`;var Az=({isCollaborating:e,onSelect:t,editorInterface:n,...r})=>{let i=gC(),a=n?.formFactor!==`desktop`||i.width<1440;return(0,W.jsxs)(QO,{...r,className:U(`collab-button`,{active:e}),type:`button`,onSelect:t,style:{position:`relative`,width:a?void 0:`auto`},title:K(`labels.liveCollaboration`),children:[a?zb:K(`labels.share`),i.collaborators.size>0&&(0,W.jsx)(`div`,{className:`CollabButton-collaborators`,children:i.collaborators.size})]})};Az.displayName=`LiveCollaborationTrigger`;var jz=()=>(0,W.jsx)(`svg`,{viewBox:`0 0 40 40`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`ExcalidrawLogo-icon`,children:(0,W.jsx)(`path`,{d:`M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z`,fill:`currentColor`})}),Mz=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 450 55`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,className:`ExcalidrawLogo-text`,children:[(0,W.jsx)(`path`,{d:`M429.27 96.74c2.47-1.39 4.78-3.02 6.83-4.95 1.43-1.35 2.73-2.86 3.81-4.51-.66.9-1.4 1.77-2.23 2.59-2.91 2.84-5.72 5.09-8.42 6.87h.01ZM343.6 69.36c.33 3.13.58 6.27.79 9.4.09 1.37.18 2.75.25 4.12-.12-4.46-.27-8.93-.5-13.39-.11-2.08-.24-4.16-.4-6.24-.06 1.79-.11 3.85-.13 6.11h-.01ZM378.47 98.34c.01-.37.07-1.13.01-6.51-.11 1.9-.22 3.81-.31 5.71-.07 1.42-.22 2.91-.16 4.35.39.03.78.07 1.17.1-.92-.85-.76-2.01-.72-3.66l.01.01ZM344.09 86.12c-.09-2.41-.22-4.83-.39-7.24v12.21c.15-.05.32-.09.47-.14.05-1.61-.03-3.23-.09-4.83h.01ZM440.69 66.79c-.22-.34-.45-.67-.69-.99-3.71-4.87-9.91-7.14-15.65-8.55-1.05-.26-2.12-.49-3.18-.71 2.29.59 4.48 1.26 6.64 2.02 7.19 2.54 10.57 5.41 12.88 8.23ZM305.09 72.46l1.2 3.6c.84 2.53 1.67 5.06 2.46 7.61.24.78.5 1.57.73 2.36.22-.04.44-.08.67-.12a776.9 776.9 0 0 1-5.01-13.57c-.02.04-.03.09-.05.13v-.01ZM345.49 90.25v.31c1.48-.42 3.05-.83 4.66-1.2-1.56.25-3.12.52-4.66.89ZM371.02 90.22c0-.57-.04-1.14-.11-1.71-.06-.02-.12-.04-.19-.05-.21-.05-.43-.08-.65-.11.42.16.74.88.95 1.87ZM398.93 54.23c-.13 0-.27-.01-.4-.02l.03.4c.11-.15.23-.27.37-.38ZM401.57 62.28v-.15c-1.22-.24-2.86-.61-3.23-1.25-.09-.15-.18-.51-.27-.98-.09.37-.2.73-.33 1.09 1.24.56 2.52.98 3.83 1.29ZM421.73 88.68c-2.97 1.65-6.28 3.12-9.69 3.68v.18c4.72-.14 11.63-3.85 16.33-8.38-2.04 1.75-4.33 3.24-6.63 4.53l-.01-.01ZM411.28 80.92c-.05-1.2-.09-2.4-.15-3.6-.21 5.66-.46 11.38-.47 14.51.24-.02.48-.04.71-.07.15-3.61.05-7.23-.09-10.83v-.01Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`M425.38 67.41c-3.5-1.45-7.19-2.57-14.06-3.62.09 1.97.06 4.88-.03 8.12.03.04.06.09.06.15.19 1.36.28 2.73.37 4.1.25 3.77.39 7.55.41 11.33 0 1.38-.01 2.76-.07 4.13 1.4-.25 2.78-.65 4.12-1.15 4.07-1.5 7.94-3.78 11.28-6.54 2.33-1.92 5.13-4.49 5.88-7.58.63-3.53-2.45-6.68-7.97-8.96l.01.02ZM411.35 92.53v-.06l-.34.03c.11.01.22.03.34.03ZM314.26 64.06c-.23-.59-.47-1.17-.7-1.75.57 1.62 1.11 3.25 1.6 4.9l.15.54 2.35 6.05c.32.82.66 1.64.98 2.46-1.38-4.1-2.83-8.17-4.39-12.2h.01ZM156.82 103.07c-.18.13-.38.23-.58.33 1.32-.03 2.66-.2 3.93-.34.86-.09 1.72-.22 2.58-.33-2.12.1-4.12.17-5.94.34h.01ZM210.14 68.88s.03.04.05.07c.18-.31.39-.64.58-.96-.21.3-.42.6-.64.89h.01ZM201.65 82.8c-.5.77-1.02 1.56-1.49 2.37 1.11-1.55 2.21-3.1 3.2-4.59-.23.23-.49.51-.75.79-.32.47-.65.95-.96 1.43ZM194.03 98.66c-.33-.4-.65-.84-1.05-1.17-.24-.2-.07-.49.17-.56-.23-.26-.42-.5-.63-.75 1.51-2.55 3.93-5.87 6.4-9.28-.17-.08-.29-.28-.2-.49.04-.09.09-.17.13-.26-1.21 1.78-2.42 3.55-3.61 5.33-.87 1.31-1.74 2.64-2.54 4-.29.5-.63 1.04-.87 1.61.81.65 1.63 1.27 2.47 1.88-.09-.11-.18-.21-.27-.32v.01ZM307.79 82.93c-1-3.17-2.05-6.32-3.1-9.48-1.62 4.08-3.69 9.17-6.16 15.19 3.32-1.04 6.77-1.87 10.27-2.5-.32-1.08-.67-2.15-1.01-3.21ZM149.5 80.7c.05-1.71.04-3.43 0-5.14-.1 2.26-.16 4.51-.22 6.77-.02.73-.03 1.46-.04 2.19.14-1.27.2-2.55.24-3.82h.02ZM228.98 98.3c.39 1.25.91 3.03.94 3.91.06-.03.12-.07.17-.1.08-1.29-.55-2.65-1.11-3.81ZM307.72 53.36c.81.5 1.53 1.04 2.07 1.49-.38-.8-.78-1.58-1.21-2.35-.17.03-.34.06-.51.11-.43.12-.86.26-1.29.41.35-.01.53.1.94.34ZM283.69 96.14c3.91-7.25 6.89-13.35 8.88-18.15l1.1-2.66c-1.27 2.64-2.56 5.27-3.83 7.9-1.53 3.15-3.06 6.31-4.58 9.47-.87 1.81-1.76 3.62-2.54 5.47.04.02.07.04.11.07.05.05.1.09.15.14.05-.73.27-1.48.71-2.24ZM289.92 103.23s-.04.01-.05.03c0-.02.04-.03.05-.04.05-.05.11-.1.16-.15l.21-.21c-.55 0-1.5-.27-2.55-.72.4.26.8.51 1.22.74.24.13.48.26.73.37.05.02.1.03.14.05a.27.27 0 0 1 .08-.07h.01ZM269.23 68.49c-.39-.19-.82-.48-1.33-.87-3.06-1.56-6.31-2.78-9.36-2.35-3.5.49-5.7 1.11-7.74 2.44 5.71-2.6 12.82-2.07 18.44.79l-.01-.01ZM177.87 53.69l1.06.03c-.96-.22-2-.25-2.89-.3-4.95-.26-9.99.33-14.86 1.19-2.44.43-4.88.95-7.28 1.59 9.09-1.76 15.69-2.77 23.97-2.51ZM219.85 55.51c-.18.12-.36.27-.56.45-.45.53-.86 1.11-1.26 1.66-1.91 2.61-3.71 5.31-5.57 7.95l-.12.18 8.05-10.11c-.18-.05-.36-.1-.55-.13h.01ZM510.71 54.1c.12-.15.29-.3.53-.45.69-.4 3.72-.63 5.87-.74-.36-.02-.73-.04-1.09-.05-1.84-.03-3.67.09-5.49.35.05.3.12.59.18.88v.01ZM510.76 86.02c1.37-3.07 2.49-6.27 3.57-9.46.55-1.64 1.12-3.3 1.6-4.97-1.59 4.01-3.67 9.14-6.2 15.3.24-.08.5-.14.74-.22.1-.22.19-.44.29-.65ZM566.95 75.76c.11-.02.23.03.31.11-.05-.13-.09-.26-.14-.39-.05.09-.11.18-.17.28ZM511.33 86.41c3.08-.89 6.24-1.62 9.46-2.14-1.51-3.98-2.98-7.96-4.39-11.87-.05.15-.09.31-.14.46-1.02 3.32-2.15 6.61-3.39 9.85-.48 1.25-.98 2.49-1.53 3.7h-.01ZM578.24 74.45c.11-.44.23-.87.35-1.31-.31.7-.64 1.39-.97 2.08.09.21.19.4.28.61.12-.46.23-.92.35-1.38h-.01ZM520.62 53.11c-.09 0-.18-.01-.28-.02.38.34.29 1.08.93 2.53l6.65 17.15c2.2 5.68 4.69 11.36 7.41 16.87l1.06 2.17c-2.95-7.05-5.92-14.08-8.87-21.13-1.58-3.79-3.16-7.59-4.7-11.4-.78-1.92-1.73-3.89-2.25-5.91-.03-.1 0-.19.04-.26h.01ZM578.78 77.87c1.45-5.77 3.07-10.43 3.58-13.36.05-.34.16-.88.31-1.55-.67 1.79-1.37 3.56-2.08 5.33-.12.43-.23.86-.35 1.29-.65 2.43-1.29 4.86-1.9 7.3.14.33.29.65.43 1l.01-.01ZM545.3 94.66c.02-.44.03-.83.05-1.12.02-1.01.05-2.02.11-3.02.03-6.66-.46-14.33-1.46-22.8-.13-.42-.27-1.24-.56-2.89 0-.02 0-.04-.01-.06.62 6.61.95 13.25 1.32 19.87.17 3.08.33 6.16.52 9.23.02.25.03.52.04.78l-.01.01ZM580.77 102.81c.13.2.27.38.37.49.27-.11.53-.22.8-.32-.43.09-.82.05-1.17-.16v-.01ZM530.48 104.07h.33c-.36-.13-.71-.32-1.04-.56.14.24.3.47.45.7.06-.08.14-.13.26-.13v-.01ZM542.63 58.82c.06.23.11.47.15.71.14-.33.36-.62.7-.86-.28.05-.57.11-.85.15ZM583.81 57.87c.15-.7.29-1.41.42-2.11-.14.45-.28.9-.42 1.34-.46 1.44-.89 2.89-1.31 4.34.44-1.19.88-2.37 1.31-3.57ZM523.62 91.48c-4.66 1.17-9.05 2.89-14.02 5.27 4.65-1.84 9.48-3.29 14.28-4.63-.09-.22-.17-.41-.26-.64ZM460.64 78.3c-.04-2.9-.11-5.81-.28-8.71-.1-1.68-.17-3.43-.5-5.09-.07.02-.14.03-.2.05.3 6.54.45 12.17.51 17.12.17-.07.34-.14.51-.2 0-1.06-.01-2.11-.03-3.17h-.01ZM470.63 63.24c-3.38-.26-6.81.32-10.1 1.1.41 2.01.47 4.14.57 6.18.18 3.55.25 7.11.27 10.67 3.31-1.38 6.5-3.12 9.3-5.35 1.96-1.56 3.86-3.41 5.02-5.66.73-1.41 1.19-3.22.26-4.65-1.09-1.7-3.46-2.14-5.32-2.29ZM460.29 63.68c1-.24 2.01-.46 3.04-.65-1.15.16-2.37.38-3.71.69v.13c.07-.02.15-.04.22-.05.11-.13.3-.18.45-.11v-.01ZM457.24 100.96c.43-.03.86-.07 1.29-.11.14-.49.27-.99.38-1.49-.44.7-1 1.23-1.67 1.6ZM482.88 104.98c-.18.23-.36.38-.55.47.14.09.27.19.4.28a70.76 70.76 0 0 0 4.37-4.63c.76-.89 1.52-1.81 2.19-2.77-.3-.27-.61-.53-.92-.79-.07 1.94-4.62 6.32-5.49 7.45v-.01Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`M474.36 63.31c-.4-.16-.84-.27-1.29-.37 1.56.42 3.08 1.22 3.76 2.74.62 1.4.32 2.95-.28 4.32.7-1.22.94-2.34.74-3.47-.24-1.33-1.19-2.54-2.93-3.21v-.01ZM477.34 89.18c-1.2-.81-2.4-1.62-3.6-2.42-.14.1-.26.19-.4.29 1.4.67 2.73 1.39 4 2.13ZM465.88 93.85c.37.25.74.5 1.1.75.46.32.92.65 1.38.97-1.57-1.2-2.01-1.61-2.49-1.72h.01ZM574.92 90.06c-2.28-5.21-4.93-11.13-5.67-12.26-.1-.15-1.57-3.01-1.63-3.08 0 0-.01.02-.02.02.4 1.37 1.09 2.69 1.65 3.99 2.14 4.95 4.36 9.86 6.67 14.73.6 1.26 1.21 2.52 1.83 3.78-.75-2.01-1.64-4.45-2.83-7.18ZM448.73 65.29c.1.2.22.38.34.57.22-.02.43-.06.65-.08v-.08c-.14-.05-.25 0-.99-.41ZM460.16 94.81c-.02.31-.06.59-.1.89-.03 1.71-.33 3.43-.79 5.07.15-.02.3-.03.45-.05.01-.04.02-.08.03-.11.09-.34.15-.69.2-1.03.17-1.07.25-2.16.33-3.24.05-.69.08-1.39.12-2.08-.27.1-.27.26-.24.57v-.02Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`m328.67 98.12-3.22-6.58c-1.29-2.63-2.53-5.29-3.72-7.97-.25-.85-.52-1.69-.79-2.53-.81-2.57-1.67-5.12-2.55-7.67-1.92-5.53-3.9-11.08-6.32-16.41-.72-1.58-1.46-3.44-2.63-4.79-.03-.17-.16-.29-.34-.36a.282.282 0 0 0-.23-.04c-.06-.01-.12 0-.18.01-.74.06-1.5.38-2.19.61-2.22.77-4.4 1.64-6.63 2.38-.03-.08-.06-.16-.09-.25-.15-.42-.82-.24-.67.19.03.09.07.19.1.28l-.18.06c-.36.11-.28.6 0 .68.18 1.18.63 2.36.98 3.49.03.09.06.17.08.26-.08.23-.17.46-.24.64-.37.98-.79 1.94-1.21 2.9-1.27 2.89-2.62 5.75-3.98 8.6-3.18 6.67-6.44 13.31-9.64 19.97-1.08 2.25-2.2 4.5-3.15 6.81-.13.32.24.5.5.37 1.34 1.33 2.84 2.5 4.4 3.57.65.44 1.31.87 2.01 1.24.4.22.86.48 1.33.5.24.01.35-.19.33-.37.11-.1.21-.21.28-.28.41-.41.81-.84 1.2-1.26.85-.92 1.69-1.87 2.5-2.84 6.31-2.34 12.6-4.31 18.71-5.84 2.14 5.3 3.43 8.43 3.97 9.58.55 1.05 1.15 1.88 1.82 2.52 1.32.56 6.96-.03 9.23-1.96.87-1.28 1.19-2.67.93-4.15-.09-.5-.22-.95-.4-1.33l-.01-.03Zm-20.09-45.61c.43.77.83 1.56 1.21 2.35-.54-.45-1.27-.99-2.07-1.49-.42-.24-.6-.35-.94-.34.43-.15.85-.29 1.29-.41.17-.05.34-.08.51-.11Zm-25.86 45.66c.78-1.85 1.67-3.66 2.54-5.47 1.51-3.16 3.05-6.31 4.58-9.47 1.28-2.63 2.56-5.26 3.83-7.9l-1.1 2.66c-1.99 4.79-4.97 10.9-8.88 18.15-.43.76-.66 1.51-.71 2.24-.05-.05-.1-.09-.15-.14a.259.259 0 0 0-.11-.07Zm6.24 4.71c-.42-.23-.82-.48-1.22-.74 1.05.45 2 .72 2.55.72l-.21.21c-.05.05-.11.1-.16.15-.01.01-.04.03-.05.04 0-.02.03-.02.05-.03a.27.27 0 0 0-.08.07c-.05-.02-.1-.03-.14-.05-.25-.1-.49-.24-.73-.37h-.01Zm15.73-29.43c1.05 3.15 2.1 6.31 3.1 9.48.34 1.06.69 2.13 1.01 3.21-3.5.63-6.95 1.46-10.27 2.5 2.48-6.03 4.54-11.11 6.16-15.19Zm4.79 12.57c-.23-.79-.49-1.58-.73-2.36-.79-2.54-1.63-5.08-2.46-7.61l-1.2-3.6c.02-.04.04-.09.05-.13 1.6 4.45 3.28 9 5.01 13.57l-.67.12v.01Zm5.83-18.27-.15-.54c-.49-1.64-1.03-3.28-1.6-4.9.23.58.47 1.17.7 1.75 1.56 4.03 3.01 8.1 4.39 12.2-.33-.82-.67-1.64-.98-2.46l-2.35-6.05h-.01ZM390.43 79.37c-.13-10.43-.22-17.5-.24-19.97-.24-1.6.21-2.88-.65-3.65-.14-.13-.32-.23-.52-.32h.03c.45 0 .45-.69 0-.7-1.75-.03-3.5-.04-5.25-.14-1.38-.08-2.76-.21-4.15-.31-.07 0-.12.01-.17.04-.21-.07-.47.03-.45.31l.03.45c-.11.14-.19.3-.22.5-.21 1.26-.32 13.67-.36 23.59-.32 5.79-.67 11.57-.97 17.36-.09 1.73-.29 3.54-.21 5.3-.39.02-.38.64.04.69v.12c.05.44.74.45.7 0v-.06c1.1.09 2.2.21 3.3.3 1.14.19 2.44.2 3.29.17 1.73-.05 2.92-.05 3.8-.37.45-.05.9-.11 1.35-.17.44-.06.25-.73-.19-.67h-.01c.24-.32.45-.72.62-1.25.66-1.84.41-6.36.34-11.33l-.13-9.9.02.01Zm-12.26 18.17c.09-1.91.2-3.81.31-5.71.06 5.38 0 6.14-.01 6.51-.05 1.65-.21 2.81.72 3.66-.39-.04-.78-.07-1.17-.1-.06-1.44.09-2.93.16-4.35l-.01-.01ZM588.97 53.85c-2.06-.25-3.17-.51-3.76-.6a.3.3 0 0 1 .04-.08c.22-.39-.39-.75-.6-.35-.56 1.02-.9 2.19-1.26 3.29-.61 1.88-1.17 3.78-1.72 5.68-.63 2.19-1.24 4.39-1.83 6.59-.81 2.03-1.67 4.05-2.61 6.03-1.7-3.64-3.11-6.04-4.03-7.57-2.26-3.74-2.85-5.48-3.57-6.08l.31-.09c.43-.12.25-.8-.19-.67-1.06.3-2.12.6-3.17.95-.93.32-1.85.69-2.76 1.07-.13.05-.19.16-.22.27-.04.02-.08.05-.11.07-.04-.06-.07-.12-.11-.18a.354.354 0 0 0-.48-.12c-.16.09-.22.32-.13.48l.33.54c0 .09.02.18.06.28.51 1.16.78 1.38.72 1.47-2.42 3.44-5.41 7.86-6.2 9.1-1.27 1.97-2.01 3.14-2.45 3.84l-.91-6.56-.43-4.1c-.19-1.85-.37-3.23-.53-4.13-.19-1.1-.3-2.15-.45-3.16-.2-1.36-.29-2.06-.47-2.42h.04c.45.02.45-.68 0-.7-3.43-.16-6.81.94-10.17 1.48-.24-.22-.73-.04-.58.32.24.59.33 1.25.43 1.87.17 1.06.29 2.13.4 3.2.32 3.09.53 6.2.74 9.3.44 6.75.77 13.51 1.17 20.26.11 1.95.13 3.96.46 5.89.05.3.37.31.55.14.74 1.71 2.87 1.27 6.13 1.27 1.34 0 2.39.04 2.99-.11.02.32.48.53.63.18 3.61-8.26 7.41-16.46 12.05-24.2.03-.05.04-.1.05-.15.3.73.64 1.45.94 2.16.97 2.26 1.97 4.52 2.98 6.76 2.26 5.03 4.54 10.07 7.09 14.96.47.9.94 1.79 1.47 2.65.2.32.4.67.66.96-.18.25 0 .68.34.54.91-.38 1.82-.75 2.76-1.07 1.04-.35 2.11-.65 3.17-.95.39-.11.28-.66-.07-.68.62-.4.95-.96.87-1.91-.3-3.34.72-7.47.86-8.52l2.14-11.43c1.75-10.74 3.13-17.51 3.23-20.86.02-.49.08-2.84.13-3.24.17-1.25.48-1-4.96-1.65l.03-.02Zm-46.19 5.67c-.04-.24-.09-.48-.15-.71l.85-.15c-.34.24-.56.53-.7.86Zm1.95 25.12c-.36-6.63-.7-13.26-1.32-19.87 0 .02 0 .04.01.06.29 1.65.44 2.47.56 2.89 1 8.46 1.5 16.14 1.46 22.8-.06.99-.1 2-.11 3.02-.01.29-.03.68-.05 1.12-.01-.26-.03-.53-.04-.78-.19-3.08-.35-6.16-.52-9.23l.01-.01Zm36.4 18.66c-.11-.11-.24-.29-.37-.49.35.21.74.26 1.17.16-.27.11-.53.22-.8.32v.01Zm-.89-33.72c.12-.43.23-.86.35-1.29.71-1.77 1.41-3.55 2.08-5.33-.15.68-.26 1.22-.31 1.55-.5 2.94-2.13 7.59-3.58 13.36-.15-.35-.29-.66-.43-1 .61-2.44 1.25-4.87 1.9-7.3l-.01.01Zm3.56-12.48c.14-.44.28-.89.42-1.34-.13.7-.27 1.41-.42 2.11-.43 1.19-.86 2.38-1.31 3.57.42-1.45.85-2.9 1.31-4.34Zm-5.22 16.05c-.11.44-.23.87-.35 1.31-.12.46-.23.92-.35 1.38-.1-.22-.19-.4-.28-.61.34-.69.66-1.38.97-2.08h.01Zm-11.64 2.62c.06-.1.12-.19.17-.28.05.13.09.26.14.39a.398.398 0 0 0-.31-.11Zm2.3 2.98c-.56-1.3-1.25-2.63-1.65-3.99 0 0 .01-.02.02-.02.06.08 1.52 2.93 1.63 3.08.73 1.13 3.38 7.04 5.67 12.26 1.2 2.73 2.08 5.17 2.83 7.18-.62-1.25-1.23-2.51-1.83-3.78-2.31-4.87-4.53-9.78-6.67-14.73ZM275.92 87.03c-1.06-2.18-1.13-3.45-2.44-2.93-1.52.57-2.94 1.3-4.5 2.1-1.4.72-2.68 1.44-3.92 2.12.01-.25-.24-.5-.51-.34-4.8 2.93-12.41 4.7-17.28 1.31-1.98-1.77-3.32-4.15-3.97-5.78-.29-.95-.49-1.94-.63-2.93-.14-3.34 1.58-6.53 3.9-9.12.8-.79 1.68-1.51 2.66-2.12 3.7-2.3 8.22-3.07 12.51-2.51 2.71.35 5.32 1.24 7.71 2.55.39.22.75-.39.35-.6-.18-.1-.37-.18-.55-.27.56.27 1.03.33 1.51.19l-.48.39c-.15.11-.23.3-.13.48.09.15.33.24.48.13 1.3-.97 2.46-2.09 3.45-3.37.37-.29.64-.6.65-.97v-.02c.08-.33-.03-.7-.21-1.08-.31-.87-.98-2.01-2.19-3.26-2.43-2.52-3.79-3.45-5.68-4.26-1.14-.49-3.12-1.06-4.42-1.23-3.28-.42-10.64-1.21-18.18 4.11-7.74 5.46-11.94 12.3-12.23 20.61-.08 2.06.04 3.98.34 5.71.74 4.18 2.57 8 5.44 11.34 4.26 4.99 9.76 7.52 16.34 7.52 4.85 0 9.69-1.77 14.89-4.62.23-.12.45-.23.68-.35 2.19-1.1 4.37-2.23 6.46-3.5.49-.3 1.03-.61 1.5-.98 1.47-.87 1.11-1.12.49-2.95-.39-1.14-.76-2.7-2.06-5.36l.02-.01Zm-17.38-21.76c3.05-.42 6.31.79 9.36 2.35.51.39.94.68 1.33.87-5.61-2.86-12.72-3.39-18.44-.79 2.05-1.33 4.24-1.95 7.74-2.44l.01.01ZM443.67 72.67c-.4-2.2-1.15-4.33-2.37-6.22-1.49-2.32-3.58-4.19-5.91-5.64-6.17-3.81-13.75-5.11-20.83-6.01-3.23-.41-6.47-.69-9.72-.92l-1.39-.12c-.85-.07-1.52-.1-2.05-.1-1.08-.06-2.17-.12-3.25-.17-.08 0-.14.02-.19.05-.1.05-.18.14-.16.3.27 2.55-.01 5.12-.92 7.52-.15.38.4.56.62.28 1.32.59 2.68 1.05 4.08 1.37 0 2.78-.14 7.58-.33 12.91 0 0 0 .02-.01.03-.61 3.66-.79 7.42-1 11.12-.23 4.01-.43 8.03-.44 12.05 0 .64 0 1.28.03 1.93.02.31 0 .68.15.96.06.11.14.16.24.17-.2.17-.21.54.11.59 3.83.67 7.78.71 11.68.25 2.3-.19 4.87-.65 7.65-1.56 1.85-.54 3.67-1.18 5.43-1.91 7.2-3.02 14.31-8.07 17.35-15.53.76-1.86 1.17-3.8 1.31-5.75.3-1.93.28-3.82-.09-5.58l.01-.02Zm-19.32-15.42c5.74 1.41 11.94 3.68 15.65 8.55.25.32.47.65.69.99-2.3-2.82-5.68-5.69-12.88-8.23-2.16-.76-4.35-1.43-6.64-2.02 1.06.21 2.13.45 3.18.71Zm-25.82-3.04c.13 0 .27.01.4.02-.14.1-.26.23-.37.38 0-.13-.02-.26-.03-.4Zm34.82 22.17c-.75 3.09-3.55 5.66-5.88 7.58-3.35 2.76-7.21 5.03-11.28 6.54-1.33.49-2.71.9-4.12 1.15.06-1.38.08-2.76.07-4.13-.02-3.78-.16-7.56-.41-11.33-.09-1.37-.18-2.74-.37-4.1 0-.06-.03-.11-.06-.15.09-3.25.12-6.16.03-8.12 6.86 1.05 10.56 2.17 14.06 3.62 5.52 2.28 8.59 5.44 7.97 8.96l-.01-.02Zm-22 16.15c-.12 0-.23-.02-.34-.03l.34-.03v.06Zm-.69-.7c0-3.13.26-8.84.47-14.51.06 1.2.11 2.41.15 3.6.15 3.6.25 7.23.09 10.83-.24.03-.48.05-.71.07v.01Zm-12.33-30.94c.37.63 2.01 1.01 3.23 1.25v.15c-1.31-.31-2.59-.73-3.83-1.29.12-.36.23-.72.33-1.09.08.48.18.84.27.98Zm13.7 31.65v-.18c3.41-.56 6.71-2.02 9.69-3.68 2.31-1.28 4.59-2.78 6.63-4.53-4.69 4.53-11.61 8.24-16.33 8.38l.01.01Zm24.07-.75c-2.05 1.93-4.37 3.56-6.83 4.95 2.7-1.78 5.52-4.03 8.42-6.87.82-.82 1.56-1.69 2.23-2.59-1.08 1.65-2.38 3.16-3.81 4.51h-.01ZM187.16 92.14c-.79-2.47-2.1-7.12-3.1-6.87-.19-.01-2.09.77-4.08 1.54-3.06 1.18-5.91 2.13-10.09 2.82-2.74.42-5.87 1.01-10.61 1.06.04-3.34.05-6.01.05-7.99 7.97-.65 12.33-2.11 16.37-3.55 1.11-.39 2.69-1.01 2.63-1.8-.08-.35-.55-1.39-1.17-2.61-.47-1.16-.98-2.31-1.61-3.38-.42-.71-1.04-1.69-1.86-2.06-.11-.08-.22-.13-.29-.12-.02 0-.04 0-.07.01-.19-.04-.39-.05-.6-.01-.17.03-.24.15-.25.28-.04.02-.09.04-.14.05-4.33 1.48-8.85 2.33-13.24 3.61a499.1 499.1 0 0 0-.31-8.19c4.51-.99 8.88-1.38 13.11-1.82 3.68-.38 6.28.12 7.47.34.59.11.9.16 1.16.18h.1c-.1.37.44.66.62.28.02-.04.03-.08.05-.13.15.2.53.22.62-.1.17-.58.19-1.21.21-1.81v-.36c.03-.15.05-.3.07-.45.52-2.47.33-5.09-.64-7.44-.11-.27-.44-.28-.6-.14-.08-.21-.15-.42-.24-.62-.19-.41-.79-.05-.6.35.03.07.05.15.09.22-.98-.42-2.15-.54-3.17-.63-2.17-.19-4.37-.14-6.54 0-5.7.35-11.4 1.3-16.91 2.79-2.08.56-4.13 1.22-6.14 2-4.54 1.05-3.79 1.51-2.17 6.07.18.51.46 1.68.54 1.94.82 2.47 1.08 2.13 3.1 2.13s0 .05 0 .08h.52c-.48 2.66-.51 5.45-.62 8.13-.15 3.48-.22 6.96-.28 10.45 0 .41-.01.82-.02 1.23-.16.29-.33.57-.51.85-.05.38-.09.77-.14 1.18-.42 3.52-.59 6.48-.52 8.8v.34c.02.47.05.76.06.87.16 1.57-.26 3.47 1.35 3.79 1.61.32 3.5.55 4.85.55.11 0 .22-.02.33-.02 1.79.24 3.67.05 5.45-.12 2.85-.28 5.69-.7 8.51-1.19 3.03-.53 6.05-1.14 9.04-1.86 2.4-.58 4.82-1.19 7.13-2.06.51-.19 1.73-.57 2.46-1.14 1.81-.68 2.18-1 1.57-2.67-.23-.62-.48-1.49-.91-2.78l-.03-.02Zm-11.12-38.71c.89.05 1.93.08 2.89.3-.33 0-.68-.02-1.06-.03-8.28-.26-14.88.75-23.97 2.51 2.41-.64 4.85-1.16 7.28-1.59 4.87-.86 9.91-1.45 14.86-1.19Zm-26.53 22.13c.03 1.71.04 3.43 0 5.14-.04 1.27-.11 2.55-.24 3.82 0-.73.02-1.46.04-2.19.05-2.26.12-4.51.22-6.77h-.02Zm6.73 27.85c.2-.1.4-.21.58-.33 1.82-.17 3.82-.24 5.94-.34-.86.11-1.72.24-2.58.33-1.27.14-2.61.31-3.93.34h-.01ZM534.48 85.44c-3.52-8.38-7.07-16.75-10.5-25.17-.63-1.54-1.25-3.09-1.86-4.65-.31-.8-.65-1.6-.87-2.43-.04-.17-.17-.24-.31-.25.1-.2 0-.51-.29-.53-1.59-.08-3.18-.22-4.78-.25-1.96-.03-3.91.13-5.84.42-.31.05-.31.38-.13.56-.03.06-.05.14-.04.22.23 1.54.63 3.06 1.16 4.53.13.35.27.7.41 1.06l-2.68 6.18c-.11.03-.2.09-.25.22-.67 1.9-1.52 3.73-2.34 5.56a536.85 536.85 0 0 1-3.9 8.45c-2.64 5.64-5.34 11.25-7.91 16.93-.44.97-.88 1.94-1.29 2.93-.2.48-.47 1-.55 1.52v.05c-.02.12.02.26.16.34 1.19.73 2.41 1.41 3.66 2.05 1.2.62 2.45 1.25 3.76 1.61.43.12.62-.55.19-.67-1.13-.31-2.2-.83-3.24-1.36 1.09.36 2.1.69 2.75.93 2.82 1.01 2.38 1.1 4.3-3.75 2.1-1.09 4.34-1.96 6.53-2.79 4.35-1.64 8.8-3.03 13.27-4.29.82 2.01 1.77 3.97 2.72 5.92.35.83.62 1.45.79 1.82.22.42.45.8.69 1.15.17.33.33.67.5 1 .42.8.84 1.63 1.4 2.35.23.29.6 0 .55-.31 1.53-.02 3.06-.07 4.58-.27.92-.12 1.82-.32 2.71-.54 1.39-.27 3.85-1.11 3.74-1.42-.67-1.96-1.55-3.87-2.34-5.78-1.57-3.78-3.16-7.56-4.75-11.33v-.01Zm-11.65-26.16c1.54 3.81 3.12 7.6 4.7 11.4 2.94 7.05 5.91 14.09 8.87 21.13l-1.06-2.17c-2.71-5.51-5.2-11.19-7.41-16.87l-6.65-17.15c-.65-1.45-.55-2.19-.93-2.53.09 0 .18.01.28.02a.29.29 0 0 0-.04.26c.52 2.02 1.47 3.98 2.25 5.91h-.01Zm-6.58 13.58c.05-.15.09-.31.14-.46 1.41 3.92 2.88 7.9 4.39 11.87-3.22.52-6.38 1.25-9.46 2.14.55-1.22 1.05-2.46 1.53-3.7 1.24-3.24 2.37-6.53 3.39-9.85h.01Zm-.23-20c.36 0 .73.03 1.09.05-2.15.1-5.18.33-5.87.74-.24.15-.41.3-.53.45-.06-.29-.13-.58-.18-.88 1.82-.26 3.65-.39 5.49-.35v-.01Zm-.09 18.72c-.49 1.67-1.05 3.33-1.6 4.97-1.07 3.19-2.19 6.38-3.57 9.46-.09.21-.19.43-.29.65-.25.07-.5.14-.74.22 2.53-6.16 4.61-11.29 6.2-15.3Zm-6.34 25.16c4.97-2.38 9.37-4.1 14.02-5.27l.26.64c-4.8 1.35-9.63 2.8-14.28 4.63Zm20.17 6.76c.33.23.68.42 1.04.56h-.33c-.12 0-.21.06-.26.13-.15-.23-.31-.45-.45-.7v.01ZM226.57 91.75c-3.55-4.74-6.68-9.11-9.31-12.99 9.2-15.25 10.05-17.81 10.35-18.38.17-.34 1.09-2.27.64-2.53-1.13-.65-1.03-.65-2.97-1.71-1.19-.65-3.04-1.61-4.53-2.12-1.71-.59-1.24-.36-3 2.77-.06.1-.11.2-.17.3-.75 1.02-1.48 2.05-2.2 3.09-1.88 2.71-3.73 5.45-5.69 8.1-3.68-4.91-6.88-8.76-9.51-11.43-.15-.15-.3-.29-.46-.42-1.27-1.28-7.24 3.53-7.93 5.58-.09.09-.19.16-.28.25-.27.26.03.64.33.58.19.65.5 1.29.94 1.91 3.85 5.06 7.19 9.76 9.94 14-1.23 2.61-3.06 5-4.67 7.38l-2.28 3.33c-.5.66-.93 1.23-1.29 1.69-.67.93-2.09 2.61-2.3 3.87-.51.85-1.16 1.84-1.29 2.83-.06.44.61.63.67.19.01-.08.04-.15.06-.22 1.36 1.08 2.76 2.11 4.19 3.11 1.3.91 2.62 1.85 4.04 2.56.21.1.4 0 .48-.17.24.07.48.14.72.2.44.1.62-.57.19-.67-2.02-.48-3.77-1.57-5.23-3.02-.47-.46-.9-.96-1.32-1.46 1.74 1.35 4.2 2.89 5.89 4.14 1.39 1.03 2.85-2.27 4.22-4.2 1.86-2.64 3.96-5.86 5.52-8.29l10.39 14.51c.67.81 1.14 1.21 1.57 1.36-.05.24.12.51.41.4 1.53-.58 3.05-1.19 4.54-1.87 1.52-.69 3.06-1.45 4.36-2.5a.28.28 0 0 0 .12-.23c1.66-1.1.81-1.74-1.41-4.91-1.13-1.58-1.71-2.36-3.7-5.01l-.03-.02Zm2.41 6.54c.56 1.15 1.19 2.52 1.11 3.81-.06.04-.12.07-.17.1-.03-.88-.55-2.66-.94-3.91Zm-16.51-32.73c1.86-2.65 3.65-5.35 5.57-7.95.4-.55.81-1.13 1.26-1.66.19-.18.38-.33.56-.45.18.03.36.08.55.13l-8.05 10.11.12-.18h-.01ZM192.7 95.48c.79-1.37 1.66-2.69 2.54-4 1.19-1.79 2.4-3.56 3.61-5.33-.04.09-.09.17-.13.26-.1.22.03.41.2.49-2.47 3.42-4.89 6.73-6.4 9.28.21.24.4.48.63.75-.24.07-.4.36-.17.56.4.33.72.77 1.05 1.17.09.11.18.21.27.32-.84-.61-1.66-1.24-2.47-1.88.24-.57.58-1.11.87-1.61v-.01Zm7.46-10.32c.47-.81.98-1.59 1.49-2.37.31-.48.64-.95.96-1.43.26-.29.52-.56.75-.79-.99 1.48-2.09 3.03-3.2 4.59Zm10.03-16.22s-.03-.05-.05-.07c.22-.29.43-.59.64-.89-.2.32-.4.65-.58.96h-.01ZM371.54 87.96c-.01-.08-.01-.16-.03-.23-.06-.38-.58-.29-.66.03-.3-.05-.6-.08-.81-.11-1.14-.15-2.29-.19-3.44-.2 1.04-.09 2.09-.18 3.14-.23.45-.02.45-.72 0-.7-6.57.35-13.14 1.23-19.65 2.11-1.53.21-3.05.42-4.57.68-.01 0-.02.01-.04.01-.04-3.33-.13-6.66-.24-9.99-.19-5.7-.4-11.41-.88-17.1-.13-1.51-.23-3.07-.49-4.58 0-.25 0-.48-.02-.68-.06-1.19-.04-2.61-.68-2.78-.16-.07-.72-.16-1.5-.24.22-.17.16-.62-.2-.63-1.19-.04-2.39.09-3.57.23-1.2.14-2.41.32-3.59.6-.16-.1-.41-.06-.5.12-.06.02-.13.03-.19.05-.35.1-.29.55-.03.66-.26.6-.19 2.27-.21 3-.02.66-.66 33.73-.9 40.3-.03.65.06 1.12.04 1.45-.16 3.05.87 4.96 6.34 3.93 1.09-.08 2.75-.77 5.36-1.43 4.13-1.04 5.78-1.52 6.2-1.65 6.43-1.69 6.78-1.97 11.72-2.43.55-.05 4.8-.38 6.03-.3.64.04 1.19.07 1.65.1.09 0 .16-.03.24-.05.1.27.56.33.66-.02.39-1.32.61-2.71.78-4.08.2-1.61.29-3.24.15-4.86.24.03.52-.23.38-.53-.09-.2-.27-.33-.49-.43v-.02Zm-.63.56c.07.57.11 1.14.11 1.71-.21-.99-.53-1.71-.95-1.87.22.03.44.06.65.11.06.01.12.04.19.05Zm-25.41 1.73c1.54-.36 3.1-.64 4.66-.89-1.61.37-3.18.77-4.66 1.2v-.31Zm-.86-7.37c-.07-1.37-.16-2.75-.25-4.12-.21-3.13-.45-6.27-.79-9.4.02-2.25.08-4.31.13-6.11.16 2.08.29 4.16.4 6.24.23 4.46.38 8.93.5 13.39h.01Zm-.94-4c.16 2.41.29 4.83.39 7.24.06 1.6.14 3.22.09 4.83-.15.05-.32.09-.47.14V78.88h-.01ZM483.72 92.83c-3.05-2.28-6.22-4.4-9.38-6.51 8.86-6.49 13.49-12.95 13.73-19.23.04-.76 0-1.5-.13-2.2-.67-3.82-3.5-6.68-8.39-8.48.13.04.27.08.4.13 3.92 1.39 7.74 4.23 8.5 8.56.34 1.95-.05 3.96-.98 5.69-.21.4.39.75.6.35 1.86-3.46 1.46-7.55-.97-10.63-3.53-4.47-9.76-5.88-15.16-6.16-2.32-.12-4.64-.04-6.95.19-6 .32-12.71 1.68-17.63 3.21-.37.11-.67.23-.92.35-.2-.17-.62.02-.57.37v.03c-.64.68-.18 1.64.48 3.21.38.91.67 1.89 1.15 2.58.32.76.68 1.51 1.13 2.19.14.21.38.19.53.07.19-.02.38-.05.57-.08v1.57c-.06.06-.1.13-.11.23-.27 4.18-.34 8.38-.48 12.57l-.3 9.03c-.24 3.91-.44 6.77-.46 7.26-.05.88-.11 1.95.07 2.81-.01.22-.02.43-.04.65 0 .11-.02.23-.03.35 0 .05-.03.27-.01.16-.05.4.5.59.64.28.05.04.12.08.2.08 1.75.13 3.5.28 5.25.3 1.69.02 3.38-.12 5.06-.32.08.23.36.39.55.15.06-.08.11-.17.16-.26.18-.09.24-.32.18-.48.05-.2.1-.4.13-.6.16-.86.25-1.74.33-2.62.11-1.17.17-2.34.23-3.51.15-.01.32-.03.52-.04.36-.03 1.73-.15 2.06-.15.39 0 .7-.02.95-.04 1.76 1.11 3.45 2.35 5.14 3.55 2.83 2.01 5.64 4.04 8.47 6.04 1.42 1 2.85 2 4.29 2.97.1.06.19.07.27.04.08 0 .17-.02.25-.1 1.61-1.56 3.15-3.18 4.6-4.88.75-.88 1.49-1.78 2.15-2.73.01.01.03.02.04.03.34.3.83-.2.49-.49-2.16-1.9-4.34-3.76-6.64-5.48l.03-.01Zm-6.38-3.65a55.72 55.72 0 0 0-4-2.13c.14-.1.26-.19.4-.29 1.2.81 2.4 1.61 3.6 2.42Zm-20.1 11.78c.67-.37 1.23-.91 1.67-1.6-.11.5-.24 1-.38 1.49-.43.04-.86.08-1.29.11Zm2.38-37.24c1.34-.31 2.56-.52 3.71-.69-1.03.19-2.04.41-3.04.65-.14-.07-.34-.02-.45.11-.07.02-.15.04-.22.05v-.13.01Zm.04.84c.07-.02.14-.03.2-.05.34 1.66.41 3.41.5 5.09.17 2.9.24 5.81.28 8.71l.03 3.17c-.17.07-.34.14-.51.2-.06-4.96-.21-10.58-.51-17.12h.01Zm16.04 5.62c-1.16 2.25-3.06 4.1-5.02 5.66-2.8 2.23-5.99 3.97-9.3 5.35-.01-3.56-.09-7.12-.27-10.67-.1-2.04-.16-4.16-.57-6.18 3.3-.78 6.72-1.36 10.1-1.1 1.85.14 4.23.59 5.32 2.29.92 1.43.46 3.24-.26 4.65Zm.85-.18c.6-1.37.9-2.92.28-4.32-.67-1.52-2.2-2.32-3.76-2.74.46.1.89.21 1.29.37 1.74.67 2.69 1.88 2.93 3.21.2 1.13-.05 2.25-.74 3.47V70Zm-27.47-4.14c-.12-.19-.23-.38-.34-.57.74.42.85.36.99.41v.08c-.22.03-.43.06-.65.08Zm11.21 30.46c-.08 1.08-.16 2.17-.33 3.24-.05.35-.11.69-.2 1.03 0 .04-.02.07-.03.11-.15.02-.3.04-.45.05.45-1.64.76-3.36.79-5.07.03-.29.08-.57.1-.89-.03-.31-.03-.47.24-.57-.04.69-.07 1.39-.12 2.08v.02Zm5.6-2.47c.48.11.92.52 2.49 1.72-.46-.32-.92-.65-1.38-.97-.37-.25-.73-.5-1.1-.75h-.01Zm21.23 7.24a70.76 70.76 0 0 1-4.37 4.63c-.14-.09-.27-.19-.4-.28.19-.09.37-.24.55-.47.87-1.14 5.43-5.51 5.49-7.45.31.26.62.53.92.79-.67.97-1.42 1.88-2.19 2.77v.01Z`,fill:`currentColor`,transform:`translate(-144.023 -51.76)`})]}),Nz=({style:e,size:t=`small`,withText:n})=>(0,W.jsxs)(`div`,{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,W.jsx)(jz,{}),n&&(0,W.jsx)(Mz,{})]}),Pz=({icon:e,shortcut:t,children:n})=>{let r=iz();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__icon`,children:e}),(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__text`,children:n}),t&&r.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__shortcut`,children:t})]})};Pz.displayName=`WelcomeScreenMenuItemContent`;var Fz=({onSelect:e,children:t,icon:n,shortcut:r,className:i=``,...a})=>(0,W.jsx)(`button`,{...a,type:`button`,className:`welcome-screen-menu-item ${i}`,onClick:e,children:(0,W.jsx)(Pz,{icon:n,shortcut:r,children:t})});Fz.displayName=`WelcomeScreenMenuItem`;var Iz=({children:e,href:t,icon:n,shortcut:r,className:i=``,...a})=>(0,W.jsx)(`a`,{...a,className:`welcome-screen-menu-item ${i}`,href:t,target:`_blank`,rel:`noopener`,children:(0,W.jsx)(Pz,{icon:n,shortcut:r,children:e})});Iz.displayName=`WelcomeScreenMenuItemLink`;var Lz=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsx)(`div`,{className:`welcome-screen-center`,children:e||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Rz,{}),(0,W.jsx)(zz,{children:K(`welcomeScreen.defaults.center_heading`)}),(0,W.jsxs)(Bz,{children:[(0,W.jsx)(Hz,{}),(0,W.jsx)(Vz,{})]})]})})})};Lz.displayName=`Center`;var Rz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-center__logo excalifont welcome-screen-decor`,children:e||(0,W.jsx)(Nz,{withText:!0})});Rz.displayName=`Logo`;var zz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-center__heading welcome-screen-decor excalifont`,children:e});zz.displayName=`Heading`;var Bz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-menu`,children:e});Bz.displayName=`Menu`;var Vz=()=>{let e=uz();return(0,W.jsx)(Fz,{onSelect:()=>e.executeAction(ZT),shortcut:`?`,icon:bb,children:K(`helpDialog.title`)})};Vz.displayName=`MenuItemHelp`;var Hz=()=>{let e=gC(),t=uz();return e.viewModeEnabled?null:(0,W.jsx)(Fz,{onSelect:()=>t.executeAction(KT),shortcut:ND(`loadScene`),icon:Ab,children:K(`buttons.load`)})};Hz.displayName=`MenuItemLoadScene`;var Uz=({onSelect:e})=>{let{t}=Fy();return(0,W.jsx)(Fz,{shortcut:null,onSelect:e,icon:ex,children:t(`labels.liveCollaboration`)})};Uz.displayName=`MenuItemLiveCollaborationTrigger`,Lz.Logo=Rz,Lz.Heading=zz,Lz.Menu=Bz,Lz.MenuItem=Fz,Lz.MenuItemLink=Iz,Lz.MenuItemHelp=Vz,Lz.MenuItemLoadScene=Hz,Lz.MenuItemLiveCollaborationTrigger=Uz;var Wz=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu`,children:[Jy,(0,W.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||K(`welcomeScreen.defaults.menuHint`)})]})})};Wz.displayName=`MenuHint`;var Gz=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar`,children:[(0,W.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||K(`welcomeScreen.defaults.toolbarHint`)}),Xy]})})};Gz.displayName=`ToolbarHint`;var Kz=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help`,children:[(0,W.jsx)(`div`,{children:e||K(`welcomeScreen.defaults.helpHint`)}),Yy]})})};Kz.displayName=`HelpHint`;var qz=e=>(0,W.jsx)(W.Fragment,{children:e.children||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Lz,{}),(0,W.jsx)(Wz,{}),(0,W.jsx)(Gz,{}),(0,W.jsx)(Kz,{})]})});qz.displayName=`WelcomeScreen`,qz.Center=Lz,qz.Hints={MenuHint:Wz,ToolbarHint:Gz,HelpHint:Kz};var Jz=()=>{Array.prototype.at||Object.defineProperty(Array.prototype,`at`,{value:function(e){if(e=Math.trunc(e)||0,e<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML=``,this.append(...e)})},Yz=(e,t,n)=>!!(t&&(t.id===e.editingTextElement?.id||t.id===e.resizingElement?.id||t.id===e.newElement?.id||t.version>n.version||t.version===n.version&&t.versionNonce<=n.versionNonce)),Xz=(0,gc.default)((e,t,n)=>{(Vt()||h()||window?.DEBUG_FRACTIONAL_INDICES)&&zt(ho(e.map(e=>({...e}))),{shouldThrow:h()||Vt(),includeBoundTextValidation:!0,reconciliationContext:{localElements:t,remoteElements:n}})},1e3*60,{leading:!0,trailing:!1}),Zz=(e,t,n)=>{let r=lr(e),i=[],a=new Set;for(let e of t)if(!a.has(e.id)){let t=r.get(e.id),o=Yz(n,t,e);t&&o?(i.push(t),a.add(t.id)):(i.push(e),a.add(e.id))}for(let t of e)a.has(t.id)||(i.push(t),a.add(t.id));let o=jo(i);return Xz(o,e,t),ho(o),o},Qz=({children:e,icon:t})=>{let{t:n}=Fy(),{TTDDialogTriggerTunnel:r}=gk(),i=lz();return(0,W.jsx)(r.In,{children:(0,W.jsx)(HO.Item,{onSelect:()=>{dC(`ai`,`dialog open`,`ttd`),i({openDialog:{name:`ttd`,tab:`text-to-diagram`}})},icon:t??gS,badge:(0,W.jsx)(HO.Item.Badge,{children:`AI`}),children:e??n(`labels.textToDiagram`)})})};Qz.displayName=`TTDDialogTrigger`,Jz();var $z=H.memo(e=>{let{onExport:t,onChange:r,onIncrement:i,initialData:a,onExcalidrawAPI:o,onMount:s,onUnmount:c,onInitialize:l,isCollaborating:u=!1,onPointerUpdate:d,renderTopLeftUI:f,renderTopRightUI:p,langCode:m=Ey.code,viewModeEnabled:h,zenModeEnabled:g,gridModeEnabled:_,libraryReturnUrl:v,theme:y,name:b,renderCustomStats:x,onPaste:S,detectScroll:C=!0,handleKeyboardGlobally:w=!1,onLibraryChange:T,autoFocus:E=!1,generateIdForFile:D,onLinkOpen:O,generateLinkForSelection:k,onPointerDown:A,onPointerUp:ee,onScrollChange:te,onDuplicate:ne,children:j,validateEmbeddable:re,renderEmbeddable:ie,aiEnabled:ae,showDeprecatedFonts:oe,renderScrollbars:se}=e,ce=e.UIOptions?.canvasActions,le={...e.UIOptions,canvasActions:{...Nt.canvasActions,...ce},tools:{image:e.UIOptions?.tools?.image??!0}};ce?.export&&(le.canvasActions.export.saveFileToDisk=ce.export?.saveFileToDisk??Nt.canvasActions.export.saveFileToDisk),le.canvasActions.toggleTheme===null&&typeof y>`u`&&(le.canvasActions.toggleTheme=!0);let ue=(0,H.useContext)(tz),de=(0,H.useRef)(o);de.current=o;let fe=(0,H.useCallback)(e=>{ue?.(e),de.current?.(e)},[ue]);return(0,H.useEffect)(()=>{(async()=>{await n(()=>import(`./roundRect-CDlbNkEg.js`),[],import.meta.url)})();let e=e=>{typeof e.scale==`number`&&e.scale!==1&&e.preventDefault()};return document.addEventListener(`touchmove`,e,{passive:!1}),()=>{document.removeEventListener(`touchmove`,e)}},[]),(0,W.jsx)(Sy,{store:Cy,children:(0,W.jsx)(Oz,{langCode:m,theme:y,children:(0,W.jsx)(Dz,{onExport:t,onChange:r,onIncrement:i,initialData:a,onExcalidrawAPI:fe,onMount:s,onUnmount:c,onInitialize:l,isCollaborating:u,onPointerUpdate:d,renderTopLeftUI:f,renderTopRightUI:p,langCode:m,viewModeEnabled:h,zenModeEnabled:g,gridModeEnabled:_,libraryReturnUrl:v,theme:y,name:b,renderCustomStats:x,UIOptions:le,onPaste:S,detectScroll:C,handleKeyboardGlobally:w,onLibraryChange:T,autoFocus:E,generateIdForFile:D,onLinkOpen:O,generateLinkForSelection:k,onPointerDown:A,onPointerUp:ee,onScrollChange:te,onDuplicate:ne,validateEmbeddable:re,renderEmbeddable:ie,aiEnabled:ae!==!1,showDeprecatedFonts:oe,renderScrollbars:se,children:j})})})},(e,t)=>{if(e.children!==t.children)return!1;let{initialData:n,UIOptions:r={},...i}=e,{initialData:a,UIOptions:o={},...s}=t,c=Object.keys(r),l=Object.keys(o);return c.length===l.length?c.every(e=>e===`getFormFactor`?!0:e===`canvasActions`?Object.keys(r.canvasActions).every(e=>e===`export`&&r?.canvasActions?.export&&o?.canvasActions?.export?r.canvasActions.export.saveFileToDisk===o.canvasActions.export.saveFileToDisk:r?.canvasActions?.[e]===o?.canvasActions?.[e]):r[e]===o[e])&&ji(i,s):!1});$z.displayName=`Excalidraw`;function eB(e){let t=String(e||``).trim().replace(/\s+/g,` `);return t?t.slice(0,24):null}function tB(){return{type:`excalidraw`,version:2,source:`collabmd`,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function nB(e){return!e||typeof e!=`object`?tB():{type:`excalidraw`,version:2,source:`collabmd`,elements:Array.isArray(e.elements)?e.elements:[],appState:{gridSize:e.appState?.gridSize??null,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`},files:e.files&&typeof e.files==`object`?e.files:{}}}function rB(e){return iB(e)||tB()}function iB(e){if(!e)return null;try{return nB(JSON.parse(e))}catch{return null}}function aB(e,{theme:t=`dark`}={}){return{elements:e.elements||[],appState:{theme:t,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`,gridSize:e.appState?.gridSize??null},files:e.files||{}}}function oB(e,t,n){return nB({elements:Array.isArray(e)?e:[],appState:{gridSize:t?.gridSize??null,viewBackgroundColor:t?.viewBackgroundColor??`#ffffff`},files:n||{}})}var sB=[`#ef4444`,`#f97316`,`#eab308`,`#22c55e`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#ec4899`,`#14b8a6`,`#f59e0b`,`#6366f1`,`#10b981`,`#f43f5e`,`#0ea5e9`,`#a855f7`];function cB(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function lB(){let e=new Uint8Array(8);return globalThis.crypto?.getRandomValues?.(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function uB(e){return sB[cB(e)%sB.length]}function dB(e,t){return t&&/^#[0-9a-fA-F]{8}$/.test(t)?t:/^#[0-9a-fA-F]{6}$/.test(e)?`${e}33`:`#0ea5e933`}function fB({params:e,storedUserName:t,generatePeerIdFn:n=lB}){let r=eB(e.get(`userName`))||eB(t)||`User`,i=e.get(`userPeerId`)||n(),a=e.get(`userColor`)||uB(`${r}-${i}`);return{color:a,colorLight:dB(a,e.get(`userColorLight`)),name:r,peerId:i}}function pB({currentUser:e,nextUser:t={},generatePeerIdFn:n=lB}){let r=eB(t.name)||e?.name||`User`,i=t.peerId||e?.peerId||n(),a=t.color||e?.color||uB(`${r}-${i}`);return{color:a,colorLight:dB(a,t.colorLight||e?.colorLight),name:r,peerId:i}}function mB(e){if(!e||typeof e!=`object`)return;let t=Number(e.scrollX),n=Number(e.scrollY),r=Number(e.zoom);if(!(!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||r<=0))return{scrollX:t,scrollY:n,zoom:r}}function hB(e){let t=new Map;return e&&e.getStates().forEach((n,r)=>{let i=n?.user;if(!i)return;let a=n.pointer&&Number.isFinite(n.pointer.x)&&Number.isFinite(n.pointer.y)?{x:n.pointer.x,y:n.pointer.y,tool:n.pointer.tool===`laser`?`laser`:`pointer`}:void 0,o=mB(n.viewport);t.set(String(r),{button:n.pointerButton===`down`?`down`:`up`,color:{background:dB(i.color||`#0ea5e9`,i.colorLight),stroke:i.color||`#0ea5e9`},id:i.peerId||String(r),isCurrentUser:r===e.clientID,pointer:a,viewport:o,selectedElementIds:n.selectedElementIds||void 0,socketId:String(r),username:i.name||`User`})}),t}function gB(e,t){if(!(e instanceof Map)||!t)return null;for(let n of e.values())if(n?.id===t)return n;return null}var _B=`excalidraw`,vB=2,yB=`collabmd`,bB=`excalidraw-app-state`,xB=`excalidraw-elements`,SB=`excalidraw-files`,CB=`excalidraw-meta`,wB=`codemirror`,TB=`schemaVersion`;function EB(){return{type:_B,version:vB,source:yB,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function DB(e={}){return{gridSize:e?.gridSize??null,viewBackgroundColor:e?.viewBackgroundColor??`#ffffff`}}function OB(e){return!e||typeof e!=`object`?EB():{type:_B,version:vB,source:yB,elements:Array.isArray(e.elements)?e.elements:[],appState:DB(e.appState),files:e.files&&typeof e.files==`object`?e.files:{}}}function kB(e,{fallbackToEmpty:t=!0}={}){if(!e)return t?EB():null;try{return OB(JSON.parse(e))}catch{return t?EB():null}}function AB(e){if(e!==void 0)return JSON.parse(JSON.stringify(e))}function jB(e){return`${Number.isFinite(Number(e?.version))?Number(e.version):0}:${Number.isFinite(Number(e?.versionNonce))?Number(e.versionNonce):0}:${Number.isFinite(Number(e?.updated))?Number(e.updated):0}`}function MB(e,t){let n=Number(e?.version)||0,r=Number(t?.version)||0;if(n!==r)return n-r;let i=Number(e?.versionNonce)||0,a=Number(t?.versionNonce)||0;if(i!==a)return i-a;let o=Number(e?.updated)||0,s=Number(t?.updated)||0;return o===s?String(e?.id||``).localeCompare(String(t?.id||``)):o-s}function NB(e,t){let n=e?.index??``,r=t?.index??``;return n===r?String(e?.id||``).localeCompare(String(t?.id||``)):String(n).localeCompare(String(r))}function PB(e,t,{create:n=!1}={}){let r=e.get(t);if(r instanceof ic)return r;if(!n)return null;let i=new ic;return e.set(t,i),i}function FB(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return null}return!e||typeof e!=`object`?null:AB(e)}function IB(e){if(!(e instanceof ic)||e.size===0)return null;let t=null;return e.forEach(e=>{let n=FB(e);!n||!n.id||(!t||MB(n,t)>0)&&(t=n)}),t}function LB(e,t,{maxRevisions:n=2}={}){let r=jB(t),i=AB(t),a=e.get(r);return(a&&typeof a==`object`?JSON.stringify(a):``)===JSON.stringify(i)?!1:(e.set(r,i),RB(e,n),!0)}function RB(e,t=2){if(!(e instanceof ic)||e.size<=t)return;let n=[];for(e.forEach((e,t)=>{let r=FB(e);if(!r){n.push({element:null,key:t});return}n.push({element:r,key:t})}),n.sort((e,t)=>e.element?t.element?MB(e.element,t.element):1:-1);n.length>t;){let t=n.shift();t?.key&&e.delete(t.key)}}function zB(e){return[...e].sort(NB)}function BB(e){if(!e)return!1;let t=e.getMap(CB);return Number(t.get(`schemaVersion`))===1?!0:e.getMap(`excalidraw-elements`).size>0||e.getMap(`excalidraw-files`).size>0||e.getMap(`excalidraw-app-state`).size>0}function VB(e){let t=e.getMap(CB);return Number(t.get(`schemaVersion`))!==1&&t.set(TB,1),t}function HB(e,{includeDeleted:t=!0}={}){if(!e)return EB();let n=e.getMap(xB),r=e.getMap(SB),i=e.getMap(bB),a=[];n.forEach(e=>{let n=IB(e);n&&(!t&&n.isDeleted||a.push(n))});let o={};return r.forEach((e,t)=>{!e||typeof e!=`object`||(o[t]=AB(e))}),OB({appState:{gridSize:i.get(`gridSize`),viewBackgroundColor:i.get(`viewBackgroundColor`)},elements:zB(a),files:o})}function UB(e,t,{maxRevisionsPerElement:n=2}={}){if(!e)return EB();let r=OB(t);VB(e);let i=e.getMap(xB),a=e.getMap(SB),o=e.getMap(bB);Array.from(i.keys()).forEach(e=>i.delete(e)),Array.from(a.keys()).forEach(e=>a.delete(e)),Array.from(o.keys()).forEach(e=>o.delete(e)),r.elements.forEach(e=>{e?.id&&LB(PB(i,e.id,{create:!0}),e,{maxRevisions:n})}),Object.entries(r.files||{}).forEach(([e,t])=>{a.set(e,AB(t))});let s=DB(r.appState);return o.set(`gridSize`,s.gridSize),o.set(`viewBackgroundColor`,s.viewBackgroundColor),r}function WB(e,t,{maxRevisionsPerElement:n=2}={}){if(!e)return!1;let r=OB(t);VB(e);let i=e.getMap(xB),a=e.getMap(SB),o=e.getMap(bB),s=new Set,c=!1;r.elements.forEach(e=>{e?.id&&(s.add(e.id),c=LB(PB(i,e.id,{create:!0}),e,{maxRevisions:n})||c)}),Array.from(i.keys()).forEach(e=>{s.has(e)||(i.delete(e),c=!0)});let l=r.files||{};Object.entries(l).forEach(([e,t])=>{let n=AB(t),r=a.get(e);JSON.stringify(r)!==JSON.stringify(n)&&(a.set(e,n),c=!0)}),Array.from(a.keys()).forEach(e=>{e in l||(a.delete(e),c=!0)});let u=DB(r.appState);return Object.entries(u).forEach(([e,t])=>{o.get(e)!==t&&(o.set(e,t),c=!0)}),Array.from(o.keys()).forEach(e=>{e in u||(o.delete(e),c=!0)}),c}function GB(e){return e?kB(e.getText(wB).toString(),{fallbackToEmpty:!1}):null}var KB=250,qB=48,JB=4e3,YB=class{constructor({cancelAnimationFrameFn:e=e=>cancelAnimationFrame(e),clearTimeoutFn:t=e=>clearTimeout(e),emptySceneGuardMs:n=KB,filePath:r=``,now:i=()=>Date.now(),onCollaboratorsChange:a=()=>{},onRemoteSceneJson:o=()=>{},requestAnimationFrameFn:s=e=>requestAnimationFrame(e),resolveWsBaseUrlFn:c=nc,saveThrottleMs:l=qB,setTimeoutFn:u=(e,t)=>window.setTimeout(e,t),syncTimeoutMs:d=JB,vaultClient:f,websocketProviderFactory:p=(e,t,n,r)=>new rc(e,t,n,r),ydocFactory:m=()=>new ac}){this.cancelAnimationFrameFn=e,this.clearTimeoutFn=t,this.emptySceneGuardMs=n,this.filePath=r,this.now=i,this.onCollaboratorsChange=a,this.onRemoteSceneJson=o,this.requestAnimationFrameFn=s,this.resolveWsBaseUrlFn=c,this.saveThrottleMs=l,this.setTimeoutFn=u,this.syncTimeoutMs=d,this.vaultClient=f,this.websocketProviderFactory=p,this.ydocFactory=m,this.ydoc=null,this.roomMeta=null,this.roomElements=null,this.roomFiles=null,this.roomAppState=null,this.provider=null,this.awareness=null,this.localUser=null,this.handleProviderSync=null,this.lastSceneJson=``,this.sceneSyncTimer=null,this.lastSceneSyncAt=0,this.pendingSceneSyncPayload=null,this.pointerAwarenessFrame=0,this.pendingPointerPayload=null,this.viewportAwarenessFrame=0,this.pendingViewportPayload=null,this.lastViewportSignature=``,this.lastSelectedIdsSignature=``,this.pendingEmptySceneCandidate=null,this.canWriteToRoom=!1,this.waitingForAuthoritativeSync=!1,this.applyingSharedSnapshotDepth=0,this.handleAwarenessChange=()=>{this.onCollaboratorsChange(hB(this.awareness))},this.handleStructuredSceneUpdate=()=>{if(!this.ydoc)return;let e=this.getStructuredSceneJson();!e||e===this.lastSceneJson||(this.unlockRoomWrites(),this.pendingEmptySceneCandidate=null,this.lastSceneJson=JSON.stringify(rB(e)),this.onRemoteSceneJson(this.lastSceneJson))}}getLastSceneJson(){return this.lastSceneJson}getLocalUser(){return this.localUser}getHistoryState(){return{canRedo:!1,canUndo:!1,head:null,length:null}}canRedo(){return this.getHistoryState().canRedo}canUndo(){return this.getHistoryState().canUndo}isApplyingSharedSnapshot(){return this.applyingSharedSnapshotDepth>0}beginApplyingSharedSnapshot(){this.applyingSharedSnapshotDepth+=1}endApplyingSharedSnapshot(){this.applyingSharedSnapshotDepth=Math.max(0,this.applyingSharedSnapshotDepth-1)}subscribeHistoryState(e){return typeof e==`function`&&e(this.getHistoryState()),()=>{}}setLocalUser(e={}){return this.localUser=pB({currentUser:this.localUser,nextUser:e}),this.awareness&&this.awareness.setLocalStateField(`user`,this.localUser),this.handleAwarenessChange(),this.localUser}async connect({initialUser:e=null}={}){if(this.localUser=e,!this.filePath){let e=tB();return this.lastSceneJson=JSON.stringify(e),e}this.ydoc=this.ydocFactory(),this.roomMeta=this.ydoc.getMap(CB),this.roomElements=this.ydoc.getMap(xB),this.roomFiles=this.ydoc.getMap(SB),this.roomAppState=this.ydoc.getMap(bB),this.provider=this.websocketProviderFactory(this.resolveWsBaseUrlFn(),this.filePath,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),oc(this.provider),this.awareness=this.provider.awareness,this.localUser&&this.awareness.setLocalStateField(`user`,this.localUser),this.awareness.setLocalStateField(`pointerButton`,`up`),this.awareness.setLocalStateField(`selectedElementIds`,{}),this.awareness.on(`change`,this.handleAwarenessChange),this.handleProviderSync=e=>{e&&(this.unlockRoomWrites(),this.handleStructuredSceneUpdate())},this.provider.on(`sync`,this.handleProviderSync);let t=await this.waitForSync(this.provider,this.syncTimeoutMs),n=this.getStructuredSceneJson(),r=!1;if(!n){let e=await this.loadSceneFromApi(),t=this.getStructuredSceneJson();t?n=t:(n=JSON.stringify(e),r=!0)}return n||=JSON.stringify(tB()),this.waitingForAuthoritativeSync=r&&!t,this.canWriteToRoom=!this.waitingForAuthoritativeSync,this.lastSceneJson=JSON.stringify(rB(n)),!r&&this.canWriteToRoom&&!BB(this.ydoc)&&this.ydoc.transact(()=>{this.replaceStructuredSceneWithinTransaction(this.lastSceneJson)},`excalidraw-legacy-migrate`),this.roomMeta.observe(this.handleStructuredSceneUpdate),this.roomElements.observeDeep(this.handleStructuredSceneUpdate),this.roomFiles.observeDeep(this.handleStructuredSceneUpdate),this.roomAppState.observe(this.handleStructuredSceneUpdate),r&&this.canWriteToRoom&&this.commitSceneJson(this.lastSceneJson,{origin:`excalidraw-api-fallback`}),this.handleStructuredSceneUpdate(),this.handleAwarenessChange(),rB(this.lastSceneJson)}async loadSceneFromApi({createIfMissing:e=!0}={}){if(!this.filePath)return tB();try{return rB((await this.vaultClient.readFile(this.filePath)).content)}catch(t){if(t?.status!==404||!e)throw t?.status===404?Error(t.message||`Excalidraw file not found`):Error(t?.message||`Failed to load Excalidraw file`)}let t=tB();try{return await this.vaultClient.createFile({content:JSON.stringify(t),path:this.filePath}),t}catch(e){if(e?.status===409)try{return rB((await this.vaultClient.readFile(this.filePath)).content)}catch(e){throw Error(e?.message||`Failed to load existing Excalidraw file after create conflict`)}throw Error(e?.message||`Failed to create Excalidraw file`)}}waitForSync(e,t=JB){return e.synced?Promise.resolve(!0):new Promise(n=>{let r=!1,i=t=>{!t||r||(r=!0,this.clearTimeoutFn(a),e.off(`sync`,i),n(!0))},a=this.setTimeoutFn(()=>{r||(r=!0,e.off(`sync`,i),n(!1))},t);e.on(`sync`,i)})}unlockRoomWrites(){this.waitingForAuthoritativeSync=!1,this.canWriteToRoom=!0,!this.getStructuredSceneJson()&&this.lastSceneJson&&this.commitSceneJson(this.lastSceneJson,{origin:`excalidraw-authoritative-seed`}),this.pendingSceneSyncPayload&&this.scheduleSceneSyncFlush()}getStructuredSceneJson(){if(!this.ydoc)return``;if(BB(this.ydoc))return JSON.stringify(HB(this.ydoc));let e=GB(this.ydoc);return e?JSON.stringify(e):``}replaceStructuredSceneWithinTransaction(e){if(!this.ydoc)return;let t=iB(e);t&&(VB(this.ydoc),UB(this.ydoc,t))}scheduleSceneSync(e,t,n){this.pendingSceneSyncPayload={appState:t,elements:e,files:n},this.canWriteToRoom&&this.scheduleSceneSyncFlush()}scheduleSceneSyncFlush(){if(this.sceneSyncTimer!==null)return;let e=this.now()-this.lastSceneSyncAt,t=Math.max(0,this.saveThrottleMs-e);this.sceneSyncTimer=this.setTimeoutFn(()=>{this.sceneSyncTimer=null,this.flushSceneSync()},t)}flushSceneSync(){if(!this.ydoc||!this.pendingSceneSyncPayload)return;let{elements:e,appState:t,files:n}=this.pendingSceneSyncPayload;this.pendingSceneSyncPayload=null;let r=oB(e,t,n),i=JSON.stringify(r);if(this.shouldDelayEmptySceneCommit(i)){this.pendingSceneSyncPayload={appState:t,elements:e,files:n},this.scheduleDelayedEmptySceneCommit();return}i!==this.lastSceneJson&&(this.lastSceneSyncAt=this.now(),this.commitSceneJson(i,{origin:`excalidraw-local-change`})),this.pendingEmptySceneCandidate=null,this.pendingSceneSyncPayload&&this.scheduleSceneSyncFlush()}hasRemoteCollaborators(){if(!this.awareness)return!1;for(let[e,t]of this.awareness.getStates())if(e!==this.awareness.clientID&&t?.user)return!0;return!1}shouldDelayEmptySceneCommit(e){if(!this.emptySceneGuardMs||!this.hasRemoteCollaborators()||rB(e).elements.length>0||rB(this.lastSceneJson||this.getStructuredSceneJson()).elements.length===0)return this.pendingEmptySceneCandidate=null,!1;let t=this.now();return!this.pendingEmptySceneCandidate||this.pendingEmptySceneCandidate.previousSceneJson!==this.lastSceneJson?(this.pendingEmptySceneCandidate={firstSeenAt:t,previousSceneJson:this.lastSceneJson},console.warn(`[excalidraw:${this.filePath}] Delaying suspicious empty scene commit during active collaboration`),!0):t-this.pendingEmptySceneCandidate.firstSeenAt<this.emptySceneGuardMs}scheduleDelayedEmptySceneCommit(){if(this.sceneSyncTimer!==null)return;let e=this.pendingEmptySceneCandidate?.firstSeenAt??this.now(),t=this.now()-e,n=Math.max(0,this.emptySceneGuardMs-t);this.sceneSyncTimer=this.setTimeoutFn(()=>{this.sceneSyncTimer=null,this.flushSceneSync()},n)}flushPointerAwarenessPayload(){this.pointerAwarenessFrame=0,!(!this.awareness||!this.pendingPointerPayload)&&(this.awareness.setLocalStateField(`pointer`,this.pendingPointerPayload.pointer),this.awareness.setLocalStateField(`pointerButton`,this.pendingPointerPayload.button),this.pendingPointerPayload=null)}normalizeViewportAwareness(e){if(!e||typeof e!=`object`)return null;let t=Number(e.scrollX),n=Number(e.scrollY),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||r<=0?null:{scrollX:t,scrollY:n,zoom:r}}scheduleLocalPointerAwareness(e){!this.awareness||!e?.pointer||(this.pendingPointerPayload={button:e.button===`down`?`down`:`up`,pointer:{x:e.pointer.x,y:e.pointer.y,tool:e.pointer.tool===`laser`?`laser`:`pointer`}},!this.pointerAwarenessFrame&&(this.pointerAwarenessFrame=this.requestAnimationFrameFn(()=>this.flushPointerAwarenessPayload())))}flushViewportAwarenessPayload(){this.viewportAwarenessFrame=0,!(!this.awareness||!this.pendingViewportPayload)&&(this.awareness.setLocalStateField(`viewport`,this.pendingViewportPayload),this.pendingViewportPayload=null)}scheduleLocalViewportAwareness(e){if(!this.awareness)return;let t=this.normalizeViewportAwareness(e);if(!t)return;let n=`${t.scrollX}:${t.scrollY}:${t.zoom}`;n!==this.lastViewportSignature&&(this.lastViewportSignature=n,this.pendingViewportPayload=t,!this.viewportAwarenessFrame&&(this.viewportAwarenessFrame=this.requestAnimationFrameFn(()=>this.flushViewportAwarenessPayload())))}syncLocalSelectionAwareness(e){if(!this.awareness)return;let t=e?.selectedElementIds||{},n=Object.keys(t).sort().join(`,`);n!==this.lastSelectedIdsSignature&&(this.lastSelectedIdsSignature=n,this.awareness.setLocalStateField(`selectedElementIds`,t))}commitSceneJson(e,{origin:t=`excalidraw-room-write`}={}){let n=JSON.stringify(rB(e));if(!this.ydoc){let e=n!==this.lastSceneJson;return this.lastSceneJson=n,e}return n===this.getStructuredSceneJson()&&n===this.lastSceneJson?!1:(this.lastSceneJson=n,this.ydoc.transact(()=>{WB(this.ydoc,rB(n))},t),!0)}disconnect(){this.flushSceneSync(),this.clearTimeoutFn(this.sceneSyncTimer),this.sceneSyncTimer=null,this.pendingSceneSyncPayload=null,this.pointerAwarenessFrame&&this.cancelAnimationFrameFn(this.pointerAwarenessFrame),this.pointerAwarenessFrame=0,this.pendingPointerPayload=null,this.viewportAwarenessFrame&&this.cancelAnimationFrameFn(this.viewportAwarenessFrame),this.viewportAwarenessFrame=0,this.pendingViewportPayload=null,this.lastViewportSignature=``,this.lastSelectedIdsSignature=``,this.pendingEmptySceneCandidate=null,this.roomMeta?.unobserve(this.handleStructuredSceneUpdate),this.roomElements?.unobserveDeep(this.handleStructuredSceneUpdate),this.roomFiles?.unobserveDeep(this.handleStructuredSceneUpdate),this.roomAppState?.unobserve(this.handleStructuredSceneUpdate),this.awareness&&(this.awareness.off(`change`,this.handleAwarenessChange),this.awareness.setLocalState(null)),this.awareness=null,this.provider&&this.handleProviderSync&&this.provider.off(`sync`,this.handleProviderSync),this.handleProviderSync=null,this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.ydoc?.destroy(),this.ydoc=null,this.roomMeta=null,this.roomElements=null,this.roomFiles=null,this.roomAppState=null,this.localUser=null,this.canWriteToRoom=!1,this.waitingForAuthoritativeSync=!1,this.applyingSharedSnapshotDepth=0}},XB=new URLSearchParams(window.location.search),ZB=XB.get(`file`),QB=XB.get(`test`)===`1`,$B=XB.get(`mode`)===`preview`,eV=window.location.origin,tV=Number.parseInt(XB.get(`syncTimeoutMs`)||``,10),nV=null,rV=XB.get(`theme`)||`dark`,iV=fB({params:XB,storedUserName:localStorage.getItem(`collabmd-user-name`)}),aV=``,oV=!1,sV=!1,cV=``,lV=null,uV=0,dV=new Map,fV=null,pV=null,mV=!1,hV=0,gV=``,_V=[],vV=0,yV=null,bV=!0,xV=new YB({filePath:ZB,onCollaboratorsChange:e=>{if(!oV){lV=e;return}DV(e)},onRemoteSceneJson:e=>{OV(e)},syncTimeoutMs:Number.isFinite(tV)?tV:void 0,vaultClient:cc});function SV(e){let t=document.querySelector(`[data-testid="button-${e}"]`);return t instanceof HTMLButtonElement?t:null}function CV(){let e=SV(`undo`),t=SV(`redo`);return{canRedo:!!t&&!t.disabled,canUndo:!!e&&!e.disabled,head:null,length:null}}function wV(e){let t=SV(e);return!t||t.disabled?!1:(t.click(),!0)}function TV(e={}){iV=pB({currentUser:iV,nextUser:e}),xV.setLocalUser(iV)}QB&&(window.__COLLABMD_EXCALIDRAW_TEST__={getElementBounds:e=>{let t=nV?.getSceneElementsIncludingDeleted?.()?.find(t=>t.id===e&&!t.isDeleted);return t?{centerX:t.x+t.width/2,centerY:t.y+t.height/2,height:t.height,width:t.width,x:t.x,y:t.y}:null},getElementCount:()=>nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted).length??0,getElementIds:()=>nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted).map(e=>e.id).sort()??[],getHistoryState:()=>CV(),getLocalUserName:()=>iV?.name||``,getLocalPeerId:()=>iV?.peerId||``,getViewport:()=>{let e=nV?.getAppState?.();return e?{scrollX:e.scrollX,scrollY:e.scrollY,zoom:e.zoom?.value??null}:null},isViewMode:()=>!!nV?.getAppState?.().viewModeEnabled,getSceneJson:()=>xV.getLastSceneJson(),isAuthoritativeReady:()=>!!nV&&oV&&xV.canWriteToRoom===!0&&xV.waitingForAuthoritativeSync===!1&&xV.isApplyingSharedSnapshot()===!1,isReady:()=>oV&&!!nV&&!!SV(`undo`)&&!!SV(`redo`),redoShared:()=>wV(`redo`),setScene:e=>{NV(nB(e),{captureUpdate:V.IMMEDIATELY})},setViewport:e=>{if(!nV)return;let t=nV.getAppState();nV.updateScene({appState:{scrollX:Number.isFinite(e?.scrollX)?e.scrollX:t.scrollX,scrollY:Number.isFinite(e?.scrollY)?e.scrollY:t.scrollY,zoom:Number.isFinite(e?.zoom)&&e.zoom>0?{value:e.zoom}:t.zoom},captureUpdate:V.NEVER})},undoShared:()=>wV(`undo`)});function EV(e){if(dV=e instanceof Map?e:new Map,!nV){lV=dV;return}if(nV.updateScene({collaborators:dV,captureUpdate:V.NEVER}),pV){VV(pV);return}BV(dV)}function DV(e){yV=e,!vV&&(vV=requestAnimationFrame(()=>{vV=0;let e=yV;yV=null,EV(e)}))}function OV(e){let t=rB(e),n=JSON.stringify(t);if(!(n===aV&&!cV)){if(aV=n,!nV||!oV){cV=n;return}MV(t)}}function kV({trackedSharedSnapshot:e=!1}={}){uV+=1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{uV=Math.max(0,uV-1),e&&xV.endApplyingSharedSnapshot(),uV===0&&(sV=!1)})})}function AV(){hV+=1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{hV=Math.max(0,hV-1),hV===0&&(mV=!1)})})}function jV(e){let t=nV.getAppState(),n=nV.getSceneElementsIncludingDeleted?.()||nV.getSceneElements(),r=Sa(e?.elements||[],n,{repairBindings:!0}),i=gr(e?.appState||{},t),a=Zz(n,r,t);return{appState:{theme:rV,viewBackgroundColor:i.viewBackgroundColor??`#ffffff`,gridSize:i.gridSize??null},elements:a,files:e?.files||{}}}function MV(e,{captureUpdate:t=V.NEVER,trackedSharedSnapshot:n=!0}={}){let r=jV(e);sV=!0,n&&xV.beginApplyingSharedSnapshot();try{nV.updateScene({...r,captureUpdate:t})}finally{kV({trackedSharedSnapshot:n})}LV()}function NV(e,{captureUpdate:t=V.IMMEDIATELY}={}){let n=nB(e),r=JSON.stringify(n);if(aV=r,!nV||!oV){cV=r;return}nV.updateScene({...jV(n),captureUpdate:t}),sV&&xV.commitSceneJson(r,{origin:`excalidraw-local-scene-apply`})}function PV(){OV(xV.getLastSceneJson())}function FV(e,t={}){window.parent.postMessage({source:`excalidraw-editor`,type:e,...t},eV)}function IV(){return nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted)??[]}function LV(){if(!bV||!nV)return;let e=IV();e.length!==0&&(bV=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{nV&&nV.scrollToContent(e,{animate:!1,fitToViewport:!0,maxZoom:2,viewportZoomFactor:$B?.92:.88})})}))}function RV(){if(!oV||!nV||mV)return;let e=nV.getAppState();xV.scheduleLocalViewportAwareness({scrollX:e.scrollX,scrollY:e.scrollY,zoom:e.zoom?.value})}function zV(e,{force:t=!1}={}){let n=e?String(e):null,r=fV!==n;fV=n,r&&(gV=``),fV&&BV(dV,{force:t||r})}function BV(e=dV,{force:t=!1}={}){if(!nV||!fV)return;let n=e?.get?.(String(fV))?.viewport;if(!n)return;let r=`${fV}:${n.scrollX}:${n.scrollY}:${n.zoom}`;!t&&r===gV||(gV=r,mV=!0,nV.updateScene({appState:{scrollX:n.scrollX,scrollY:n.scrollY,zoom:{value:n.zoom}},captureUpdate:V.NEVER}),AV())}function VV(e){if(pV=e||null,!nV)return;if(!e){nV.updateScene({appState:{userToFollow:null},captureUpdate:V.NEVER}),zV(null,{force:!0}),pV=null;return}let t=gB(dV,e);t?.socketId&&(nV.updateScene({appState:{userToFollow:{socketId:t.socketId,username:t.username||``}},captureUpdate:V.NEVER}),zV(t.socketId,{force:!0}),pV=null)}function HV(){oV=!1,lV=null,dV=new Map,fV=null,pV=null,mV=!1,hV=0,gV=``,vV&&cancelAnimationFrame(vV),vV=0,yV=null,_V.forEach(e=>e()),_V=[],xV.disconnect()}var UV=!1;function WV(){UV||(UV=!0,HV())}async function GV({intervalMs:e=10,maxWaitMs:t=150}={}){let n=performance.now();for(;performance.now()-n<t;){let t=xV.provider?.ws;if(!t||t.readyState!==WebSocket.OPEN||t.bufferedAmount===0)return;await new Promise(t=>window.setTimeout(t,e))}}async function KV(){xV.flushSceneSync(),await GV()}window.addEventListener(`pagehide`,WV),window.addEventListener(`message`,e=>{if(e.origin!==eV)return;let t=e.data;if(!(!t||t.source!==`collabmd-host`)){if(t.type===`set-theme`){rV=t.theme||`dark`,nV&&(sV=!0,nV.updateScene({appState:{theme:rV},captureUpdate:V.NEVER}),kV());return}if(t.type===`set-user`){TV(t.user);return}if(t.type===`follow-user`){VV(t.peerId||null);return}t.type===`prepare-disconnect`&&(async()=>{await KV(),FV(`disconnect-ready`,{requestId:t.requestId||``})})()}});function qV(e,t,n){!oV||sV||(aV=JSON.stringify(nB({elements:e,appState:t,files:n})),xV.scheduleSceneSync(e,t,n))}function JV(e){nV=e,_V.forEach(e=>e()),_V=[],_V.push(e.onStateChange([`scrollX`,`scrollY`,`zoom`],()=>{RV()})),_V.push(e.onStateChange(`userToFollow`,e=>{if(e?.socketId){zV(e.socketId,{force:!0});return}zV(null,{force:!0})}));let t=cV||xV.getLastSceneJson();cV=``,MV(rB(t)),lV&&=(nV.updateScene({collaborators:lV,captureUpdate:V.NEVER}),null),oV=!0,RV(),PV(),pV&&VV(pV),LV(),FV(`ready`)}function YV({excalidrawAPI:e}){nV=e}async function XV(){let e=document.getElementById(`loadingState`);try{await sc();let t=aB(await xV.connect({initialUser:iV}),{theme:rV});e?.remove();let n={onMount:YV,onInitialize:e=>{JV(e)},onUnmount:()=>{_V.forEach(e=>e()),_V=[],nV=null,oV=!1},initialData:t,aiEnabled:!1,isCollaborating:!0,onChange:(e,t,n)=>{qV(e,t,n),xV.syncLocalSelectionAwareness(t)},onPointerUpdate:e=>{xV.scheduleLocalPointerAwareness(e)},theme:rV,viewModeEnabled:$B,zenModeEnabled:$B,UIOptions:{canvasActions:{export:!1,loadScene:!1,saveToActiveFile:!1,toggleTheme:!1}}};(0,mc.createRoot)(document.getElementById(`root`)).render(H.createElement(()=>H.createElement(`div`,{style:{height:`100vh`,width:`100%`}},H.createElement($z,n))))}catch(t){console.error(`[excalidraw] Failed to initialize:`,t),FV(`error`,{message:t instanceof Error?t.message:`Failed to load Excalidraw`}),e&&(e.className=`loading-state error`,e.textContent=`Failed to load Excalidraw: ${t instanceof Error?t.message:String(t)}`)}}XV();
|
|
182
|
+
`),p=f.reduce((e,t,r)=>{let s=Va(t).trim();if(s.length){let t=this.getTopLayerFrameAtSceneCoords({x:n,y:d}),r=gn(s,a,o),c=r.width>l,u=c?Jt(s,a,l):s;r=c?gn(u,a,o):r;let f=n-r.width/2,p=d-r.height/2,m=Li({...i,x:f,y:p,text:u,originalText:s,lineHeight:o,autoResize:!c,frameId:t?t.id:null});e.push(m),d+=m.height+10}else f[r-1]?.trim()&&(d+=qo(i.fontSize,o)+10);return e},[]);p.length!==0&&(this.scene.insertElements(p),this.store.scheduleCapture(),this.setState({selectedElementIds:P(Object.fromEntries(p.map(e=>[e.id,!0])),this.state)}),!t&&p.length>1&&Cz===!1&&this.editorInterface.formFactor!==`phone`&&(this.setToast({message:K(`toast.pasteAsSingleElement`,{shortcut:Q(`CtrlOrCmd+Shift+V`)}),duration:5e3}),Cz=!0))}handleTextWysiwyg(e,{isExistingElement:t=!1}){let n=this.scene.getElementsMapIncludingDeleted(),r=(t,r)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(i=>i.id===e.id&&M(i)?B(i,{originalText:t,isDeleted:r??i.isDeleted,...he(i,so(i,n),n,t)}):i)])};Zj({id:e.id,canvas:this.canvas,getViewportCoords:(e,t)=>{let{x:n,y:r}=Ci({sceneX:e,sceneY:t},this.state);return[n-this.state.offsetLeft,r-this.state.offsetTop]},onChange:qj(t=>{r(t,!1),Is(e)&&ue(e,this.scene)}),onSubmit:qj(({viaKeyboard:n,nextOriginalText:i})=>{let a=!i.trim();if(r(i,a),!a&&n){let t=e.containerId?e.containerId:e.id;(0,_c.flushSync)(()=>{this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[t]:!0},e)}))})}a&&Go(this.scene.getNonDeletedElements(),[e]),(!a||t)&&this.store.scheduleCapture(),(0,_c.flushSync)(()=>{this.setState({newElement:null,editingTextElement:null})}),this.state.activeTool.locked&&Yw(this.interactiveCanvas,this.state),this.focusContainer()}),element:e,excalidrawContainer:this.excalidrawContainerRef.current,app:this,autoSelect:!this.editorInterface.isTouchScreen}),this.deselectElements(),r(e.originalText,!1)}deselectElements(){this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(e,t){let n=this.getElementAtPosition(e,t,{includeBoundTextElement:!0});return n&&M(n)&&!n.isDeleted?n:null}getElementAtPosition(e,t,n){let r=[];if(r=n&&`allHitElements`in n?n?.allHitElements||[]:this.getElementsAtPosition(e,t,{includeBoundTextElement:n?.includeBoundTextElement,includeLockedElements:n?.includeLockedElements}),r.length>1){if(n?.preferSelected){for(let e=r.length-1;e>-1;e--)if(this.state.selectedElementIds[r[e].id])return r[e]}let i=r[r.length-1];return Ui({point:O(e,t),element:i,threshold:this.getElementHitThreshold(i)/2,elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:L(i)?this.frameNameBoundsCache.get(i):null})?i:r[r.length-2]}return r.length===1?r[0]:null}getElementsAtPosition(e,t,n){let r=[],i=this.scene.getNonDeletedElementsMap();return(n?.includeBoundTextElement&&n?.includeLockedElements?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(e=>(n?.includeLockedElements||!e.locked)&&(n?.includeBoundTextElement||!(M(e)&&e.containerId)))).filter(n=>this.hitElement(e,t,n)).filter(n=>{let r=No(n,i);return r&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?ns({x:e,y:t},r,i):!0}).filter(e=>Vs(e)?(r.push(e),!1):!0).concat(r)}getElementHitThreshold(e){return Math.max(e.strokeWidth/2+.1,.85*(an/this.state.zoom.value))}hitElement(e,t,n,r=!0){return r&&this.state.selectedElementIds[n.id]&&Jo([n],this.state,this.editorInterface)&&Re(O(e,t),n,this.scene.getNonDeletedElementsMap(),this.getElementHitThreshold(n))||Hn(O(e,t),n,this.scene.getNonDeletedElementsMap())?!0:Ui({point:O(e,t),element:n,threshold:this.getElementHitThreshold(n),elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:L(n)?this.frameNameBoundsCache.get(n):null})}getTextBindableContainerAtPosition(e,t){let n=this.scene.getNonDeletedElements(),r=this.scene.getSelectedElements(this.state);if(r.length===1)return k(r[0],!1)?r[0]:null;let i=null;for(let r=n.length-1;r>=0;--r){if(n[r].isDeleted)continue;let[a,o,s,c]=ei(n[r],this.scene.getNonDeletedElementsMap());if(jt(n[r])&&Ui({point:O(e,t),element:n[r],elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(n[r])})){i=n[r];break}else if(a<e&&e<s&&o<t&&t<c){i=n[r];break}}return k(i,!1)?i:null}handleHoverSelectedLinearElement(e,t,n){let r=this.scene.getNonDeletedElementsMap(),i=I.getElement(e.elementId,r);if(i)if(this.state.selectedLinearElement){let a=-1,o=null;Ui({point:O(t,n),element:i,elementsMap:r,threshold:this.getElementHitThreshold(i)})?(a=I.getPointIndexUnderCursor(i,r,this.state.zoom,t,n),o=I.getSegmentMidpointHitCoords(e,{x:t,y:n},this.state,this.scene.getNonDeletedElementsMap()),(dr(i)?a===0||a===i.points.length-1:a>=0)||o?Gw(this.interactiveCanvas,Kn.POINTER):this.hitElement(t,n,i)&&(!dr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Gw(this.interactiveCanvas,Kn.MOVE)):this.hitElement(t,n,i)&&(!dr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Gw(this.interactiveCanvas,Kn.MOVE),this.state.selectedLinearElement.hoverPointIndex!==a&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:a}}),I.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,o)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:o}});let s=null,c=i;(c.startBinding||c.endBinding)&&(s=La(i,t,n,this.scene,this.state)),this.state.selectedLinearElement.hoveredFocusPointBinding!==s&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1,hoveredFocusPointBinding:s}}),s&&Gw(this.interactiveCanvas,Kn.POINTER)}else Gw(this.interactiveCanvas,Kn.AUTO)}updateGestureOnPointerDown(e){Tz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),Tz.pointers.size===2&&(Tz.lastCenter=mj(Tz.pointers),Tz.initialScale=this.state.zoom.value,Tz.initialDistance=hj(Array.from(Tz.pointers.values())))}initialPointerDownState(e){let t=la(e,this.state),n=this.scene.getSelectedElements(this.state),[r,i,a,o]=Ii(n),s=n.findIndex(dr)===0;return{origin:t,withCmdOrCtrl:e[N.CTRL_OR_CMD],originInGrid:pt(It(t.x,t.y,e[N.CTRL_OR_CMD]||s?null:this.getEffectiveGridSize())),scrollbars:nM(_z,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop),lastCoords:{...t},originalElements:this.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,qn(t)),e),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:`origin`,center:{x:(a+r)/2,y:(o+i)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(t,n)},drag:{hasOccurred:!1,offset:null,origin:{...t},blockDragging:!1},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1}}}handleDraggingScrollBar(e,t){if(!(t.scrollbars.isOverEither&&!this.state.multiElement))return!1;gz=!0,t.lastCoords.x=e.clientX,t.lastCoords.y=e.clientY;let n=Jj(e=>{e.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(e,t)}),r=qj(()=>{wz=null,gz=!1,Yw(this.interactiveCanvas,this.state),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(F.POINTER_MOVE,n),window.removeEventListener(F.POINTER_UP,r),n.flush()});return wz=r,window.addEventListener(F.POINTER_MOVE,n),window.addEventListener(F.POINTER_UP,r),!0}isASelectedElement(e){return e!=null&&this.state.selectedElementIds[e.id]}isHittingCommonBoundingBoxOfSelectedElements(e,t){if(t.length<2)return!1;let n=Math.max(an/this.state.zoom.value,1),[r,i,a,o]=Ii(t);return e.x>r-n&&e.x<a+n&&e.y>i-n&&e.y<o+n}getCurrentItemRoundness(e){return this.state.currentItemRoundness===`round`?{type:Ga(e)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null}maybeCacheReferenceSnapPoints(e,t,n=!1){Cj({event:e,app:this,selectedElements:t})&&(n||!xj.getReferenceSnapPoints())&&xj.setReferenceSnapPoints(kj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(e,t,n=!1){Cj({event:e,app:this,selectedElements:t})&&(n||!xj.getVisibleGaps())&&xj.setVisibleGaps(Dj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(e){return qj(t=>{this.maybeHandleResize(e,t)||this.maybeDragNewGenericElement(e,t)})}onKeyUpFromPointerDownHandler(e){return qj(t=>{t.key===N.ALT&&t.preventDefault(),!this.maybeHandleResize(e,t)&&this.maybeDragNewGenericElement(e,t)})}onPointerMoveFromPointerDownHandler(e){return Jj(t=>{if(this.state.openDialog?.name===`elementLinkSelector`)return;let n=la(t,this.state);if(this.state.activeLockedId&&this.setState({activeLockedId:null}),this.state.selectedLinearElement&&this.state.selectedLinearElement.elbowed&&this.state.selectedLinearElement.initialState.segmentMidpoint.index){let[e,r]=It(n.x,n.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.state.selectedLinearElement.initialState.segmentMidpoint.index;if(i<0){let t=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:e,y:r},this.state,this.scene.getNonDeletedElementsMap());i=t?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,t,this.scene.getNonDeletedElementsMap()):-1}let a=I.moveFixedSegment(this.state.selectedLinearElement,i,e,r,this.scene);this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0,segmentMidPointHoveredCoords:a.segmentMidPointHoveredCoords,initialState:a.initialState}});return}let r=this.previousPointerMoveCoords??e.origin;if(this.previousPointerMoveCoords=n,e.drag.offset===null&&(e.drag.offset=pt(Qa(this.scene.getSelectedElements(this.state),e.origin.x,e.origin.y))),!(t.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(t,e))return;if(zr(this.state)){this.handleEraser(t,n);return}this.state.activeTool.type===`laser`&&this.laserTrails.addPointToPath(n.x,n.y);let[i,a]=It(n.x,n.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize());if(e.resize.isResizing&&(e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeHandleCrop(e,t)||this.maybeHandleResize(e,t)))return!0;let o=this.scene.getNonDeletedElementsMap();if(this.state.selectedLinearElement){let r=this.state.selectedLinearElement;if(r.draggedFocusPointBinding){Pr(r,o,n,this.scene,this.state,this.getEffectiveGridSize(),t.altKey),this.setState({selectedLinearElement:{...r,isDragging:!1,selectedPointsIndices:[],initialState:{...r.initialState,lastClickedPoint:-1}}});return}if(I.shouldAddMidpoint(this.state.selectedLinearElement,n,this.state,o)){let e=I.addMidpoint(this.state.selectedLinearElement,n,this,!t[N.CTRL_OR_CMD],this.scene);if(!e)return;(0,_c.flushSync)(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:e.pointerDownState,selectedPointsIndices:e.selectedPointsIndices,segmentMidPointHoveredCoords:null}})});return}else{if(r.initialState.segmentMidpoint.value!==null&&!r.initialState.segmentMidpoint.added)return;if(r.initialState.lastClickedPoint>-1){let i=I.getElement(r.elementId,o);if(i?.isDeleted)return;if(ss(i)){let e=go(O(n.x,n.y),this.scene.getNonDeletedElements(),o);Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(i,e)}if(t.altKey&&!this.state.selectedLinearElement?.initialState?.arrowStartIsInside&&Ys(`COMPLEX_BINDINGS`)&&this.handleSkipBindMode(),r.initialState.lastClickedPoint===-1)return;let a=I.handlePointDragging(t,this,n.x,n.y,r);if(a){e.lastCoords.x=n.x,e.lastCoords.y=n.y,e.drag.hasOccurred=!0,(a.suggestedBinding!==this.state.suggestedBinding||!ji(a.selectedLinearElement?.selectedPointsIndices??[],this.state.selectedLinearElement?.selectedPointsIndices??[])||a.selectedLinearElement?.hoverPointIndex!==this.state.selectedLinearElement?.hoverPointIndex||a.selectedLinearElement?.customLineAngle!==this.state.selectedLinearElement?.customLineAngle||this.state.selectedLinearElement.isDragging!==a.selectedLinearElement?.isDragging||this.state.selectedLinearElement?.initialState?.altFocusPoint!==a.selectedLinearElement?.initialState?.altFocusPoint)&&this.setState(a);return}}}}let s=e.hit.allHitElements.some(e=>this.isASelectedElement(e)),c=this.state.selectedLinearElement?.isEditing&&t.shiftKey&&this.state.selectedLinearElement.elementId===e.hit.element?.id;if((s||e.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!c&&!e.drag.blockDragging){let i=this.scene.getSelectedElements(this.state);if(i.length>0&&i.every(e=>e.locked))return;let a=i.find(e=>L(e)),s=this.getTopLayerFrameAtSceneCoords(n),c=s&&!a?s:null;if(this.state.frameToHighlight!==c&&(0,_c.flushSync)(()=>{this.setState({frameToHighlight:c})}),e.drag.hasOccurred=!0,this.state.activeTool.type===`lasso`&&this.lassoTrail.hasCurrentTrail&&!(this.editorInterface.formFactor!==`desktop`&&e.hit.element)&&!this.state.activeTool.fromSelection)return;if(this.state.activeTool.type===`lasso`&&i.length>0&&e.drag.hasOccurred&&!this.state.activeTool.fromSelection&&this.lassoTrail.endPath(),i.length>0&&!e.withCmdOrCtrl&&!this.state.editingTextElement&&this.state.activeEmbeddable?.state!==`active`){let a={x:n.x-e.drag.origin.x,y:n.y-e.drag.origin.y},s=[...e.originalElements.values()],c=t.shiftKey;if(c){let e=Math.abs(a.x),t=Math.abs(a.y),n=c&&e<t,r=c&&e>t;n&&(a.x=0),r&&(a.y=0)}if(this.state.croppingElementId){let t=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(t&&io(t)&&t.crop!==null&&e.hit.element===t){let e=t.crop,i=d(t)&&this.imageCache.get(t.fileId)?.image;if(i&&!(i instanceof Promise)){let a=A(t),s=nr(n.x-r.x,n.y-r.y);s[0]*=i.naturalWidth/a.width,s[1]*=i.naturalHeight/a.height;let[c,l,u,d,f,p]=ei(t,o),m=Mn(ke(O(c,l),O(f,p),t.angle)),h=Mn(ke(O(u,l),O(f,p),t.angle)),g=Mn(ke(O(c,d),O(f,p),t.angle)),_=Zt(y(h,m)),v=Zt(y(g,m)),b=nr(ys(s,_),ys(s,v)),x={...e,x:Ht(e.x-b[0]*Math.sign(t.scale[0]),0,i.naturalWidth-e.width),y:Ht(e.y-b[1]*Math.sign(t.scale[1]),0,i.naturalHeight-e.height)};this.scene.mutateElement(t,{crop:x});return}}}this.maybeCacheVisibleGaps(t,i),this.maybeCacheReferenceSnapPoints(t,i);let{snapOffset:l,snapLines:u}=jj(s,a,this,t,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:u}),this.state.editingFrame||bo(e,i,a,this.scene,l,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),this.setState({selectedElementsAreBeingDragged:!0,selectionElement:null}),t.altKey&&!e.hit.hasBeenDuplicated){e.hit.hasBeenDuplicated=!0;let n=this.scene.getElementsIncludingDeleted(),r=e.hit.element,i=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});r&&e.hit.wasAddedToSelection&&!i.find(e=>e.id===r.id)&&i.push(r);let a=new Map(i.map(e=>[e.id,e])),{duplicatedElements:o,duplicateElementsMap:s,elementsWithDuplicates:c,origIdToDuplicateId:l}=Er({type:`in-place`,elements:n,appState:this.state,randomizeSeed:!0,idsOfElementsToDuplicate:a,overrides:({duplicateElement:e,origElement:t})=>({frameId:e.frameId??t.frameId,seed:se()})});o.forEach(t=>{e.originalElements.set(t.id,qn(t))});let u=c.map(t=>{if(a.has(t.id)){let n=e.originalElements.get(t.id);if(n)return B(t,{x:n.x,y:n.y})}return t}),d=this.props.onDuplicate?.(u,n),f=fe(d||u,lr(o));(0,_c.flushSync)(()=>{if(e.hit.element){let t=l.get(e.hit.element.id),n=t&&s.get(t);e.hit.element=n||null}e.hit.allHitElements=e.hit.allHitElements.reduce((e,t)=>{let n=l.get(t.id),r=n&&s.get(n);return r&&e.push(r),e},[]),e.drag.origin=la(t,this.state),this.setState(e=>({...Br(o,this.scene.getNonDeletedElements(),e)})),this.scene.replaceAllElements(f),i.forEach(e=>{un(e)&&e.boundElements?.some(e=>e.type===`arrow`)&&ue(e,this.scene)}),this.maybeCacheVisibleGaps(t,i,!0),this.maybeCacheReferenceSnapPoints(t,i,!0)})}return}}if(this.state.selectionElement){if(e.lastCoords.x=n.x,e.lastCoords.y=n.y,t.altKey){this.setActiveTool({type:`lasso`,fromSelection:!0},t.shiftKey),this.lassoTrail.startPath(e.origin.x,e.origin.y,t.shiftKey),this.setAppState({selectionElement:null});return}this.maybeDragNewGenericElement(e,t)}else if(this.state.activeTool.type===`lasso`)!t.altKey&&this.state.activeTool.fromSelection?(this.setActiveTool({type:`selection`}),this.createGenericElementOnPointerDown(`selection`,e),e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t),this.lassoTrail.endPath()):this.lassoTrail.addPointToPath(n.x,n.y,t.shiftKey);else{let r=this.state.newElement;if(!r)return;if(r.type===`freedraw`){let e=r.points,i=n.x-r.x,a=n.y-r.y,o=e.length>0&&e[e.length-1];if(!(o&&o[0]===i&&o[1]===a)){let n=r.simulatePressure?r.pressures:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...e,O(i,a)],pressures:n},{informMutation:!1,isDragging:!1}),this.setState({newElement:r})}}else if(b(r)&&!r.isDeleted){e.drag.hasOccurred=!0;let n=r.points;gt(n.length>1,`Do not create linear elements with less than 2 points`);let o=this.state.selectedLinearElement;o||=(o=new I(r,this.scene.getNonDeletedElementsMap()),{...o,selectedPointsIndices:[1],initialState:{...o.initialState,lastClickedPoint:1}}),this.setState({newElement:r,...I.handlePointDragging(t,this,i,a,o)})}else e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t,!1)}if(this.state.activeTool.type===`selection`){e.boxSelection.hasOccurred=!0;let n=this.scene.getNonDeletedElements();if(this.state.selectedLinearElement?.isEditing)I.handleBoxSelection(t,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let r=!0;!t.shiftKey&&Ya(n,this.state)&&(e.withCmdOrCtrl&&e.hit.element?this.setState(t=>Hr({...t,selectedElementIds:{[e.hit.element.id]:!0}},this.scene.getNonDeletedElements(),t,this)):r=!1);let i=this.state.selectionElement?Ta(n,this.state.selectionElement,this.scene.getNonDeletedElementsMap(),!1):[];this.setState(t=>{let n={...r&&t.selectedElementIds,...i.reduce((e,t)=>(e[t.id]=!0,e),{})};return e.hit.element&&(i.length?delete n[e.hit.element.id]:n[e.hit.element.id]=!0),t=r?t:{...t,selectedGroupIds:{},editingGroupId:null},{...Hr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.scene.getNonDeletedElements(),t,this),selectedLinearElement:i.length===1&&b(i[0])?new I(i[0],this.scene.getNonDeletedElementsMap()):null,showHyperlinkPopup:i.length===1&&(i[0].link||rs(i[0]))?`info`:!1}})}}})}handlePointerMoveOverScrollbars(e,t){if(t.scrollbars.isOverHorizontal){let n=e.clientX,r=n-t.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-r*(_z.horizontal?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.x=n,!0}if(t.scrollbars.isOverVertical){let n=e.clientY,r=n-t.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-r*(_z.vertical?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.y=n,!0}return!1}onPointerUpFromPointerDownHandler(e){return qj(t=>{let n=this.scene.getNonDeletedElementsMap();this.removePointer(t),e.drag.blockDragging=!1,e.eventListeners.onMove&&e.eventListeners.onMove.flush();let{newElement:r,resizingElement:i,croppingElementId:a,multiElement:o,activeTool:s,isResizing:c,isRotating:l,isCropping:d}=this.state;this.setState(e=>({isResizing:!1,isRotating:!1,isCropping:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:`up`,snapLines:tr(e.snapLines,[]),originSnapOffset:null})),this.lassoTrail.endPath(),this.previousPointerMoveCoords=null,xj.setReferenceSnapPoints(null),xj.setVisibleGaps(null),this.savePointer(t.clientX,t.clientY,`up`);let f=e.hit.allHitElements,p=la({clientX:t.clientX,clientY:t.clientY},this.state);if(this.state.activeTool.type===`selection`&&!e.boxSelection.hasOccurred&&!e.resize.isResizing&&!f.some(e=>this.state.selectedElementIds[e.id])){let e=this.getElementAtPosition(p.x,p.y,{includeLockedElements:!0});this.store.scheduleCapture(),e?.locked?this.setState({activeLockedId:e.groupIds.length>0?e.groupIds.at(-1)||``:e.id}):this.setState({activeLockedId:null})}else this.setState({activeLockedId:null});if(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.setState({selectedElementsAreBeingDragged:!1,bindMode:`orbit`}),e.drag.hasOccurred&&e.hit?.element?.id){let t=n.get(e.hit.element.id);un(t)&&t.boundElements?.filter(e=>e.type===`arrow`).map(e=>n.get(e.id)).filter(e=>dr(e)).forEach(e=>{e&&this.scene.mutateElement(e,{})})}if(this.state.selectedLinearElement?.isEditing&&!this.state.newElement&&this.state.selectedLinearElement.draggedFocusPointBinding===null)if(!e.boxSelection.hasOccurred&&e.hit?.element?.id!==this.state.selectedLinearElement.elementId&&this.state.selectedLinearElement.draggedFocusPointBinding===null)this.actionManager.executeAction(oT);else{let e=I.handlePointerUp(t,this.state.selectedLinearElement,this.state,this.scene);this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p}),e!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:e,suggestedBinding:null})}else if(this.state.selectedLinearElement){if(this.state.selectedLinearElement.elbowed){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());e&&this.scene.mutateElement(e,{})}if(this.state.selectedLinearElement.draggedFocusPointBinding?(yr(this.state.selectedLinearElement,this.scene),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,draggedFocusPointBinding:null}})):e.hit?.element?.id===this.state.selectedLinearElement.elementId?this.state.selectedLinearElement.isDragging&&(this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1}}),this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p})):this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null}),this.state.newElement&&this.state.multiElement&&b(this.state.newElement)&&this.state.selectedLinearElement){let{multiElement:e}=this.state;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:e.points[e.points.length-1]}})}}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener(F.POINTER_MOVE,e.eventListeners.onMove),window.removeEventListener(F.POINTER_UP,e.eventListeners.onUp),window.removeEventListener(F.KEYDOWN,e.eventListeners.onKeyDown),window.removeEventListener(F.KEYUP,e.eventListeners.onKeyUp),this.props?.onPointerUp?.(s,e),this.onPointerUpEmitter.trigger(this.state.activeTool,e,t),r?.type===`freedraw`){let e=la(t,this.state),n=r.points,i=e.x-r.x,a=e.y-r.y;i===n[0][0]&&a===n[0][1]&&(a+=1e-4,i+=1e-4);let o=r.simulatePressure?[]:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...n,O(i,a)],pressures:o}),this.actionManager.executeAction(oT);return}if(b(r)){r.points.length>1&&r.points[1][0]!==0&&r.points[1][1]!==0&&this.store.scheduleCapture();let n=la(t,this.state),i=Se(O(n.x,n.y),O(e.origin.x,e.origin.y))*this.state.zoom.value;if((!e.drag.hasOccurred||i<20)&&r&&!o)if(this.editorInterface.isTouchScreen){let e=Math.min(this.state.width*.7/this.state.zoom.value,100);this.scene.mutateElement(r,{x:r.x-e/2,points:[O(0,0),O(e,0)]},{informMutation:!1,isDragging:!1}),this.actionManager.executeAction(oT)}else{let e=n.x-r.x,t=n.y-r.y;this.scene.mutateElement(r,{points:[r.points[0],O(e,t)]},{informMutation:!1,isDragging:!1}),this.setState({multiElement:r,newElement:r})}else e.drag.hasOccurred&&!o&&(b(r)&&this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p}),this.setState({suggestedBinding:null,startBoundElement:null}),s.locked?this.setState(e=>({newElement:null})):(Ww(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:P({...e.selectedElementIds,[r.id]:!0},e),selectedLinearElement:new I(r,this.scene.getNonDeletedElementsMap())}))),this.scene.triggerUpdate());return}if(M(r)){let e=Ve(u({fontSize:r.fontSize,fontFamily:r.fontFamily}),r.lineHeight);r.width<e&&this.scene.mutateElement(r,{autoResize:!0}),this.resetCursor(),this.handleTextWysiwyg(r,{isExistingElement:!0})}if(s.type!==`selection`&&r&&na(r)){this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==r.id),appState:{newElement:null},captureUpdate:V.NEVER});return}if(L(r)){let e=zi(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(Je(this.scene.getElementsMapIncludingDeleted(),e,r,this.state))}if(r&&(this.scene.mutateElement(r,$i(r),{informMutation:!1,isDragging:!1}),this.scene.triggerUpdate()),e.drag.hasOccurred){let e=la(t,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){let e=this.scene.getElement(this.state.selectedLinearElement.elementId);if(e?.frameId){let t=No(e,n);t&&e&&(pr(e,t,this.scene.getNonDeletedElementsMap())||(this.scene.mutateElement(e,{groupIds:[]}),Pi([e],this.scene.getNonDeletedElementsMap()),this.scene.triggerUpdate()))}}else{let t=this.getTopLayerFrameAtSceneCoords(e),n=this.scene.getSelectedElements(this.state),r=this.scene.getElementsMapIncludingDeleted(),i=e=>{if(e.length>0){for(let t of e){let e=t.groupIds.indexOf(this.state.editingGroupId);this.scene.mutateElement(t,{groupIds:t.groupIds.slice(0,e)},{informMutation:!1,isDragging:!1})}r.forEach(e=>{e.groupIds.length&&Ki(r,e.groupIds[e.groupIds.length-1]).length<2&&this.scene.mutateElement(e,{groupIds:[]},{informMutation:!1,isDragging:!1})}),this.setState({editingGroupId:null})}};if(t&&!this.state.selectedElementIds[t.id]){let e=n.filter(e=>e.frameId!==t.id&&qr(e,r,this.state));this.state.editingGroupId&&i(e),r=Je(r,e,t,this.state)}else !t&&this.state.editingGroupId&&i(n.filter(e=>e.frameId&&!qr(e,r,this.state)));r=lo(r,this.state,this),this.scene.replaceAllElements(r)}}if(i&&this.store.scheduleCapture(),i&&na(i)&&this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==i.id),captureUpdate:V.NEVER}),e.resize.isResizing){let e=lo(this.scene.getElementsIncludingDeleted(),this.state,this),t=this.scene.getSelectedElements(this.state).filter(e=>L(e));for(let r of t)e=Ai(e,kn(this.scene.getElementsIncludingDeleted(),r,this.state,n),r,this);this.scene.replaceAllElements(e)}let m=e.hit.element;this.state.selectedLinearElement?.elementId!==m?.id&&b(m)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new I(m,this.scene.getNonDeletedElementsMap())}),(!a||a&&(!m&&!d||m&&m.id!==a))&&this.finishImageCropping();let h=this.lastPointerDownEvent,g=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(zr(this.state)&&h&&g){if(this.eraserTrail.endPath(),Se(O(h.clientX,h.clientY),O(g.clientX,g.clientY))===0){let e=la({clientX:g.clientX,clientY:g.clientY},this.state);this.getElementsAtPosition(e.x,e.y).forEach(e=>this.elementsPendingErasure.add(e.id))}this.eraseElements();return}else this.elementsPendingErasure.size&&this.restoreReadyToEraseElements();if(m&&!e.drag.hasOccurred&&!e.hit.wasAddedToSelection&&(!this.state.selectedLinearElement?.isEditing||!e.boxSelection.hasOccurred)&&this.state.activeTool.type!==`lasso`&&(t.shiftKey&&!this.state.selectedLinearElement?.isEditing?this.state.selectedElementIds[m.id]?ft(this.state,m)?this.setState(e=>{let t={...e.selectedElementIds};for(let e of m.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)))delete t[e.id];return{selectedGroupIds:{...e.selectedElementIds,...m.groupIds.map(e=>({[e]:!1})).reduce((e,t)=>({...e,...t}),{})},selectedElementIds:P(t,e)}}):this.state.selectedLinearElement?.isDragging||this.setState(e=>{let t={...e.selectedElementIds};delete t[m.id];let n=ir(this.scene.getNonDeletedElements(),{selectedElementIds:t});return{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:n.length===1&&b(n[0])?new I(n[0],this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}}):m.frameId&&this.state.selectedElementIds[m.frameId]?this.setState(e=>{let t={...e.selectedElementIds,[m.id]:!0};return delete t[m.frameId],(this.scene.getElement(m.frameId)?.groupIds??[]).flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}),{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:m.link||rs(m)?`info`:!1}}):this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[m.id]:!0},e)})):this.setState(e=>({...Hr({editingGroupId:e.editingGroupId,selectedElementIds:{[m.id]:!0}},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:b(m)&&e.selectedLinearElement?.elementId!==m.id?new I(m,this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}))),this.state.activeTool.type!==`lasso`&&!(m&&dr(m))&&!e.drag.hasOccurred&&!this.state.isResizing&&(m&&vt({point:O(e.origin.x,e.origin.y),element:m,elementsMap:n,threshold:this.getElementHitThreshold(m),frameNameBound:L(m)?this.frameNameBoundsCache.get(m):null},n)||!m&&e.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.selectedLinearElement?.isEditing?this.actionManager.executeAction(XA):this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),Gw(this.interactiveCanvas,Kn.AUTO);return}if(!s.locked&&s.type!==`freedraw`&&r&&this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[r.id]:!0},e),showHyperlinkPopup:rs(r)&&!r.link?`editor`:e.showHyperlinkPopup})),(s.type!==`selection`||Ya(this.scene.getNonDeletedElements(),this.state)||!ji(this.state.previousSelectedElementIds,this.state.selectedElementIds))&&this.store.scheduleCapture(),(e.drag.hasOccurred&&!this.state.selectedLinearElement||c||l||d)&&Bo(this.scene.getSelectedElements(this.state).filter(jt),this.scene,this.state),s.type===`laser`){this.laserTrails.endPath();return}!s.locked&&s.type!==`freedraw`&&(s.type!==`lasso`||s.type===`lasso`&&s.fromSelection)?(Ww(this.interactiveCanvas),this.setState({newElement:null,suggestedBinding:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})})):this.setState({newElement:null,suggestedBinding:null})})}clearSelection(e){this.setState(t=>({selectedElementIds:P({},t),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:t.editingGroupId&&e!=null&&Lo(e,t.editingGroupId)?t.editingGroupId:null})),this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds,selectedLinearElement:null})}getTextWysiwygSnappedToCenterPosition(e,t,n,r){if(r){let i=r.x+r.width/2,a=r.y+r.height/2,o=nn(r,n,this.scene.getNonDeletedElementsMap());if(o&&(i=o.x,a=o.y),Math.hypot(e-i,t-a)<30){let{x:e,y:t}=Ci({sceneX:i,sceneY:a},n);return{viewportX:e,viewportY:t,elementCenterX:i,elementCenterY:a}}}}getCanvasOffsets(){if(this.excalidrawContainerRef?.current){let{left:e,top:t}=this.excalidrawContainerRef.current.getBoundingClientRect();return{offsetLeft:e,offsetTop:t}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){await jy(Dy.find(e=>e.code===this.props.langCode)||Ey),this.setAppState({})}};(h()||Vt())&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(ho(e))}},scene:{configurable:!0,get(){return this.app?.scene}}}));var Dz=Ez,Oz=e=>{let[t,n]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let t=async()=>{await jy(r),n(!1)},r=Dy.find(t=>t.code===e.langCode)||Ey;t()},[e.langCode]),t?(0,W.jsx)(CN,{theme:e.theme}):e.children},kz=({children:e})=>{let{FooterCenterTunnel:t}=gk(),n=gC();return(0,W.jsx)(t.In,{children:(0,W.jsx)(`div`,{className:U(`footer-center zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})};kz.displayName=`FooterCenter`;var Az=({isCollaborating:e,onSelect:t,editorInterface:n,...r})=>{let i=gC(),a=n?.formFactor!==`desktop`||i.width<1440;return(0,W.jsxs)(QO,{...r,className:U(`collab-button`,{active:e}),type:`button`,onSelect:t,style:{position:`relative`,width:a?void 0:`auto`},title:K(`labels.liveCollaboration`),children:[a?zb:K(`labels.share`),i.collaborators.size>0&&(0,W.jsx)(`div`,{className:`CollabButton-collaborators`,children:i.collaborators.size})]})};Az.displayName=`LiveCollaborationTrigger`;var jz=()=>(0,W.jsx)(`svg`,{viewBox:`0 0 40 40`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`ExcalidrawLogo-icon`,children:(0,W.jsx)(`path`,{d:`M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z`,fill:`currentColor`})}),Mz=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 450 55`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,className:`ExcalidrawLogo-text`,children:[(0,W.jsx)(`path`,{d:`M429.27 96.74c2.47-1.39 4.78-3.02 6.83-4.95 1.43-1.35 2.73-2.86 3.81-4.51-.66.9-1.4 1.77-2.23 2.59-2.91 2.84-5.72 5.09-8.42 6.87h.01ZM343.6 69.36c.33 3.13.58 6.27.79 9.4.09 1.37.18 2.75.25 4.12-.12-4.46-.27-8.93-.5-13.39-.11-2.08-.24-4.16-.4-6.24-.06 1.79-.11 3.85-.13 6.11h-.01ZM378.47 98.34c.01-.37.07-1.13.01-6.51-.11 1.9-.22 3.81-.31 5.71-.07 1.42-.22 2.91-.16 4.35.39.03.78.07 1.17.1-.92-.85-.76-2.01-.72-3.66l.01.01ZM344.09 86.12c-.09-2.41-.22-4.83-.39-7.24v12.21c.15-.05.32-.09.47-.14.05-1.61-.03-3.23-.09-4.83h.01ZM440.69 66.79c-.22-.34-.45-.67-.69-.99-3.71-4.87-9.91-7.14-15.65-8.55-1.05-.26-2.12-.49-3.18-.71 2.29.59 4.48 1.26 6.64 2.02 7.19 2.54 10.57 5.41 12.88 8.23ZM305.09 72.46l1.2 3.6c.84 2.53 1.67 5.06 2.46 7.61.24.78.5 1.57.73 2.36.22-.04.44-.08.67-.12a776.9 776.9 0 0 1-5.01-13.57c-.02.04-.03.09-.05.13v-.01ZM345.49 90.25v.31c1.48-.42 3.05-.83 4.66-1.2-1.56.25-3.12.52-4.66.89ZM371.02 90.22c0-.57-.04-1.14-.11-1.71-.06-.02-.12-.04-.19-.05-.21-.05-.43-.08-.65-.11.42.16.74.88.95 1.87ZM398.93 54.23c-.13 0-.27-.01-.4-.02l.03.4c.11-.15.23-.27.37-.38ZM401.57 62.28v-.15c-1.22-.24-2.86-.61-3.23-1.25-.09-.15-.18-.51-.27-.98-.09.37-.2.73-.33 1.09 1.24.56 2.52.98 3.83 1.29ZM421.73 88.68c-2.97 1.65-6.28 3.12-9.69 3.68v.18c4.72-.14 11.63-3.85 16.33-8.38-2.04 1.75-4.33 3.24-6.63 4.53l-.01-.01ZM411.28 80.92c-.05-1.2-.09-2.4-.15-3.6-.21 5.66-.46 11.38-.47 14.51.24-.02.48-.04.71-.07.15-3.61.05-7.23-.09-10.83v-.01Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`M425.38 67.41c-3.5-1.45-7.19-2.57-14.06-3.62.09 1.97.06 4.88-.03 8.12.03.04.06.09.06.15.19 1.36.28 2.73.37 4.1.25 3.77.39 7.55.41 11.33 0 1.38-.01 2.76-.07 4.13 1.4-.25 2.78-.65 4.12-1.15 4.07-1.5 7.94-3.78 11.28-6.54 2.33-1.92 5.13-4.49 5.88-7.58.63-3.53-2.45-6.68-7.97-8.96l.01.02ZM411.35 92.53v-.06l-.34.03c.11.01.22.03.34.03ZM314.26 64.06c-.23-.59-.47-1.17-.7-1.75.57 1.62 1.11 3.25 1.6 4.9l.15.54 2.35 6.05c.32.82.66 1.64.98 2.46-1.38-4.1-2.83-8.17-4.39-12.2h.01ZM156.82 103.07c-.18.13-.38.23-.58.33 1.32-.03 2.66-.2 3.93-.34.86-.09 1.72-.22 2.58-.33-2.12.1-4.12.17-5.94.34h.01ZM210.14 68.88s.03.04.05.07c.18-.31.39-.64.58-.96-.21.3-.42.6-.64.89h.01ZM201.65 82.8c-.5.77-1.02 1.56-1.49 2.37 1.11-1.55 2.21-3.1 3.2-4.59-.23.23-.49.51-.75.79-.32.47-.65.95-.96 1.43ZM194.03 98.66c-.33-.4-.65-.84-1.05-1.17-.24-.2-.07-.49.17-.56-.23-.26-.42-.5-.63-.75 1.51-2.55 3.93-5.87 6.4-9.28-.17-.08-.29-.28-.2-.49.04-.09.09-.17.13-.26-1.21 1.78-2.42 3.55-3.61 5.33-.87 1.31-1.74 2.64-2.54 4-.29.5-.63 1.04-.87 1.61.81.65 1.63 1.27 2.47 1.88-.09-.11-.18-.21-.27-.32v.01ZM307.79 82.93c-1-3.17-2.05-6.32-3.1-9.48-1.62 4.08-3.69 9.17-6.16 15.19 3.32-1.04 6.77-1.87 10.27-2.5-.32-1.08-.67-2.15-1.01-3.21ZM149.5 80.7c.05-1.71.04-3.43 0-5.14-.1 2.26-.16 4.51-.22 6.77-.02.73-.03 1.46-.04 2.19.14-1.27.2-2.55.24-3.82h.02ZM228.98 98.3c.39 1.25.91 3.03.94 3.91.06-.03.12-.07.17-.1.08-1.29-.55-2.65-1.11-3.81ZM307.72 53.36c.81.5 1.53 1.04 2.07 1.49-.38-.8-.78-1.58-1.21-2.35-.17.03-.34.06-.51.11-.43.12-.86.26-1.29.41.35-.01.53.1.94.34ZM283.69 96.14c3.91-7.25 6.89-13.35 8.88-18.15l1.1-2.66c-1.27 2.64-2.56 5.27-3.83 7.9-1.53 3.15-3.06 6.31-4.58 9.47-.87 1.81-1.76 3.62-2.54 5.47.04.02.07.04.11.07.05.05.1.09.15.14.05-.73.27-1.48.71-2.24ZM289.92 103.23s-.04.01-.05.03c0-.02.04-.03.05-.04.05-.05.11-.1.16-.15l.21-.21c-.55 0-1.5-.27-2.55-.72.4.26.8.51 1.22.74.24.13.48.26.73.37.05.02.1.03.14.05a.27.27 0 0 1 .08-.07h.01ZM269.23 68.49c-.39-.19-.82-.48-1.33-.87-3.06-1.56-6.31-2.78-9.36-2.35-3.5.49-5.7 1.11-7.74 2.44 5.71-2.6 12.82-2.07 18.44.79l-.01-.01ZM177.87 53.69l1.06.03c-.96-.22-2-.25-2.89-.3-4.95-.26-9.99.33-14.86 1.19-2.44.43-4.88.95-7.28 1.59 9.09-1.76 15.69-2.77 23.97-2.51ZM219.85 55.51c-.18.12-.36.27-.56.45-.45.53-.86 1.11-1.26 1.66-1.91 2.61-3.71 5.31-5.57 7.95l-.12.18 8.05-10.11c-.18-.05-.36-.1-.55-.13h.01ZM510.71 54.1c.12-.15.29-.3.53-.45.69-.4 3.72-.63 5.87-.74-.36-.02-.73-.04-1.09-.05-1.84-.03-3.67.09-5.49.35.05.3.12.59.18.88v.01ZM510.76 86.02c1.37-3.07 2.49-6.27 3.57-9.46.55-1.64 1.12-3.3 1.6-4.97-1.59 4.01-3.67 9.14-6.2 15.3.24-.08.5-.14.74-.22.1-.22.19-.44.29-.65ZM566.95 75.76c.11-.02.23.03.31.11-.05-.13-.09-.26-.14-.39-.05.09-.11.18-.17.28ZM511.33 86.41c3.08-.89 6.24-1.62 9.46-2.14-1.51-3.98-2.98-7.96-4.39-11.87-.05.15-.09.31-.14.46-1.02 3.32-2.15 6.61-3.39 9.85-.48 1.25-.98 2.49-1.53 3.7h-.01ZM578.24 74.45c.11-.44.23-.87.35-1.31-.31.7-.64 1.39-.97 2.08.09.21.19.4.28.61.12-.46.23-.92.35-1.38h-.01ZM520.62 53.11c-.09 0-.18-.01-.28-.02.38.34.29 1.08.93 2.53l6.65 17.15c2.2 5.68 4.69 11.36 7.41 16.87l1.06 2.17c-2.95-7.05-5.92-14.08-8.87-21.13-1.58-3.79-3.16-7.59-4.7-11.4-.78-1.92-1.73-3.89-2.25-5.91-.03-.1 0-.19.04-.26h.01ZM578.78 77.87c1.45-5.77 3.07-10.43 3.58-13.36.05-.34.16-.88.31-1.55-.67 1.79-1.37 3.56-2.08 5.33-.12.43-.23.86-.35 1.29-.65 2.43-1.29 4.86-1.9 7.3.14.33.29.65.43 1l.01-.01ZM545.3 94.66c.02-.44.03-.83.05-1.12.02-1.01.05-2.02.11-3.02.03-6.66-.46-14.33-1.46-22.8-.13-.42-.27-1.24-.56-2.89 0-.02 0-.04-.01-.06.62 6.61.95 13.25 1.32 19.87.17 3.08.33 6.16.52 9.23.02.25.03.52.04.78l-.01.01ZM580.77 102.81c.13.2.27.38.37.49.27-.11.53-.22.8-.32-.43.09-.82.05-1.17-.16v-.01ZM530.48 104.07h.33c-.36-.13-.71-.32-1.04-.56.14.24.3.47.45.7.06-.08.14-.13.26-.13v-.01ZM542.63 58.82c.06.23.11.47.15.71.14-.33.36-.62.7-.86-.28.05-.57.11-.85.15ZM583.81 57.87c.15-.7.29-1.41.42-2.11-.14.45-.28.9-.42 1.34-.46 1.44-.89 2.89-1.31 4.34.44-1.19.88-2.37 1.31-3.57ZM523.62 91.48c-4.66 1.17-9.05 2.89-14.02 5.27 4.65-1.84 9.48-3.29 14.28-4.63-.09-.22-.17-.41-.26-.64ZM460.64 78.3c-.04-2.9-.11-5.81-.28-8.71-.1-1.68-.17-3.43-.5-5.09-.07.02-.14.03-.2.05.3 6.54.45 12.17.51 17.12.17-.07.34-.14.51-.2 0-1.06-.01-2.11-.03-3.17h-.01ZM470.63 63.24c-3.38-.26-6.81.32-10.1 1.1.41 2.01.47 4.14.57 6.18.18 3.55.25 7.11.27 10.67 3.31-1.38 6.5-3.12 9.3-5.35 1.96-1.56 3.86-3.41 5.02-5.66.73-1.41 1.19-3.22.26-4.65-1.09-1.7-3.46-2.14-5.32-2.29ZM460.29 63.68c1-.24 2.01-.46 3.04-.65-1.15.16-2.37.38-3.71.69v.13c.07-.02.15-.04.22-.05.11-.13.3-.18.45-.11v-.01ZM457.24 100.96c.43-.03.86-.07 1.29-.11.14-.49.27-.99.38-1.49-.44.7-1 1.23-1.67 1.6ZM482.88 104.98c-.18.23-.36.38-.55.47.14.09.27.19.4.28a70.76 70.76 0 0 0 4.37-4.63c.76-.89 1.52-1.81 2.19-2.77-.3-.27-.61-.53-.92-.79-.07 1.94-4.62 6.32-5.49 7.45v-.01Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`M474.36 63.31c-.4-.16-.84-.27-1.29-.37 1.56.42 3.08 1.22 3.76 2.74.62 1.4.32 2.95-.28 4.32.7-1.22.94-2.34.74-3.47-.24-1.33-1.19-2.54-2.93-3.21v-.01ZM477.34 89.18c-1.2-.81-2.4-1.62-3.6-2.42-.14.1-.26.19-.4.29 1.4.67 2.73 1.39 4 2.13ZM465.88 93.85c.37.25.74.5 1.1.75.46.32.92.65 1.38.97-1.57-1.2-2.01-1.61-2.49-1.72h.01ZM574.92 90.06c-2.28-5.21-4.93-11.13-5.67-12.26-.1-.15-1.57-3.01-1.63-3.08 0 0-.01.02-.02.02.4 1.37 1.09 2.69 1.65 3.99 2.14 4.95 4.36 9.86 6.67 14.73.6 1.26 1.21 2.52 1.83 3.78-.75-2.01-1.64-4.45-2.83-7.18ZM448.73 65.29c.1.2.22.38.34.57.22-.02.43-.06.65-.08v-.08c-.14-.05-.25 0-.99-.41ZM460.16 94.81c-.02.31-.06.59-.1.89-.03 1.71-.33 3.43-.79 5.07.15-.02.3-.03.45-.05.01-.04.02-.08.03-.11.09-.34.15-.69.2-1.03.17-1.07.25-2.16.33-3.24.05-.69.08-1.39.12-2.08-.27.1-.27.26-.24.57v-.02Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`m328.67 98.12-3.22-6.58c-1.29-2.63-2.53-5.29-3.72-7.97-.25-.85-.52-1.69-.79-2.53-.81-2.57-1.67-5.12-2.55-7.67-1.92-5.53-3.9-11.08-6.32-16.41-.72-1.58-1.46-3.44-2.63-4.79-.03-.17-.16-.29-.34-.36a.282.282 0 0 0-.23-.04c-.06-.01-.12 0-.18.01-.74.06-1.5.38-2.19.61-2.22.77-4.4 1.64-6.63 2.38-.03-.08-.06-.16-.09-.25-.15-.42-.82-.24-.67.19.03.09.07.19.1.28l-.18.06c-.36.11-.28.6 0 .68.18 1.18.63 2.36.98 3.49.03.09.06.17.08.26-.08.23-.17.46-.24.64-.37.98-.79 1.94-1.21 2.9-1.27 2.89-2.62 5.75-3.98 8.6-3.18 6.67-6.44 13.31-9.64 19.97-1.08 2.25-2.2 4.5-3.15 6.81-.13.32.24.5.5.37 1.34 1.33 2.84 2.5 4.4 3.57.65.44 1.31.87 2.01 1.24.4.22.86.48 1.33.5.24.01.35-.19.33-.37.11-.1.21-.21.28-.28.41-.41.81-.84 1.2-1.26.85-.92 1.69-1.87 2.5-2.84 6.31-2.34 12.6-4.31 18.71-5.84 2.14 5.3 3.43 8.43 3.97 9.58.55 1.05 1.15 1.88 1.82 2.52 1.32.56 6.96-.03 9.23-1.96.87-1.28 1.19-2.67.93-4.15-.09-.5-.22-.95-.4-1.33l-.01-.03Zm-20.09-45.61c.43.77.83 1.56 1.21 2.35-.54-.45-1.27-.99-2.07-1.49-.42-.24-.6-.35-.94-.34.43-.15.85-.29 1.29-.41.17-.05.34-.08.51-.11Zm-25.86 45.66c.78-1.85 1.67-3.66 2.54-5.47 1.51-3.16 3.05-6.31 4.58-9.47 1.28-2.63 2.56-5.26 3.83-7.9l-1.1 2.66c-1.99 4.79-4.97 10.9-8.88 18.15-.43.76-.66 1.51-.71 2.24-.05-.05-.1-.09-.15-.14a.259.259 0 0 0-.11-.07Zm6.24 4.71c-.42-.23-.82-.48-1.22-.74 1.05.45 2 .72 2.55.72l-.21.21c-.05.05-.11.1-.16.15-.01.01-.04.03-.05.04 0-.02.03-.02.05-.03a.27.27 0 0 0-.08.07c-.05-.02-.1-.03-.14-.05-.25-.1-.49-.24-.73-.37h-.01Zm15.73-29.43c1.05 3.15 2.1 6.31 3.1 9.48.34 1.06.69 2.13 1.01 3.21-3.5.63-6.95 1.46-10.27 2.5 2.48-6.03 4.54-11.11 6.16-15.19Zm4.79 12.57c-.23-.79-.49-1.58-.73-2.36-.79-2.54-1.63-5.08-2.46-7.61l-1.2-3.6c.02-.04.04-.09.05-.13 1.6 4.45 3.28 9 5.01 13.57l-.67.12v.01Zm5.83-18.27-.15-.54c-.49-1.64-1.03-3.28-1.6-4.9.23.58.47 1.17.7 1.75 1.56 4.03 3.01 8.1 4.39 12.2-.33-.82-.67-1.64-.98-2.46l-2.35-6.05h-.01ZM390.43 79.37c-.13-10.43-.22-17.5-.24-19.97-.24-1.6.21-2.88-.65-3.65-.14-.13-.32-.23-.52-.32h.03c.45 0 .45-.69 0-.7-1.75-.03-3.5-.04-5.25-.14-1.38-.08-2.76-.21-4.15-.31-.07 0-.12.01-.17.04-.21-.07-.47.03-.45.31l.03.45c-.11.14-.19.3-.22.5-.21 1.26-.32 13.67-.36 23.59-.32 5.79-.67 11.57-.97 17.36-.09 1.73-.29 3.54-.21 5.3-.39.02-.38.64.04.69v.12c.05.44.74.45.7 0v-.06c1.1.09 2.2.21 3.3.3 1.14.19 2.44.2 3.29.17 1.73-.05 2.92-.05 3.8-.37.45-.05.9-.11 1.35-.17.44-.06.25-.73-.19-.67h-.01c.24-.32.45-.72.62-1.25.66-1.84.41-6.36.34-11.33l-.13-9.9.02.01Zm-12.26 18.17c.09-1.91.2-3.81.31-5.71.06 5.38 0 6.14-.01 6.51-.05 1.65-.21 2.81.72 3.66-.39-.04-.78-.07-1.17-.1-.06-1.44.09-2.93.16-4.35l-.01-.01ZM588.97 53.85c-2.06-.25-3.17-.51-3.76-.6a.3.3 0 0 1 .04-.08c.22-.39-.39-.75-.6-.35-.56 1.02-.9 2.19-1.26 3.29-.61 1.88-1.17 3.78-1.72 5.68-.63 2.19-1.24 4.39-1.83 6.59-.81 2.03-1.67 4.05-2.61 6.03-1.7-3.64-3.11-6.04-4.03-7.57-2.26-3.74-2.85-5.48-3.57-6.08l.31-.09c.43-.12.25-.8-.19-.67-1.06.3-2.12.6-3.17.95-.93.32-1.85.69-2.76 1.07-.13.05-.19.16-.22.27-.04.02-.08.05-.11.07-.04-.06-.07-.12-.11-.18a.354.354 0 0 0-.48-.12c-.16.09-.22.32-.13.48l.33.54c0 .09.02.18.06.28.51 1.16.78 1.38.72 1.47-2.42 3.44-5.41 7.86-6.2 9.1-1.27 1.97-2.01 3.14-2.45 3.84l-.91-6.56-.43-4.1c-.19-1.85-.37-3.23-.53-4.13-.19-1.1-.3-2.15-.45-3.16-.2-1.36-.29-2.06-.47-2.42h.04c.45.02.45-.68 0-.7-3.43-.16-6.81.94-10.17 1.48-.24-.22-.73-.04-.58.32.24.59.33 1.25.43 1.87.17 1.06.29 2.13.4 3.2.32 3.09.53 6.2.74 9.3.44 6.75.77 13.51 1.17 20.26.11 1.95.13 3.96.46 5.89.05.3.37.31.55.14.74 1.71 2.87 1.27 6.13 1.27 1.34 0 2.39.04 2.99-.11.02.32.48.53.63.18 3.61-8.26 7.41-16.46 12.05-24.2.03-.05.04-.1.05-.15.3.73.64 1.45.94 2.16.97 2.26 1.97 4.52 2.98 6.76 2.26 5.03 4.54 10.07 7.09 14.96.47.9.94 1.79 1.47 2.65.2.32.4.67.66.96-.18.25 0 .68.34.54.91-.38 1.82-.75 2.76-1.07 1.04-.35 2.11-.65 3.17-.95.39-.11.28-.66-.07-.68.62-.4.95-.96.87-1.91-.3-3.34.72-7.47.86-8.52l2.14-11.43c1.75-10.74 3.13-17.51 3.23-20.86.02-.49.08-2.84.13-3.24.17-1.25.48-1-4.96-1.65l.03-.02Zm-46.19 5.67c-.04-.24-.09-.48-.15-.71l.85-.15c-.34.24-.56.53-.7.86Zm1.95 25.12c-.36-6.63-.7-13.26-1.32-19.87 0 .02 0 .04.01.06.29 1.65.44 2.47.56 2.89 1 8.46 1.5 16.14 1.46 22.8-.06.99-.1 2-.11 3.02-.01.29-.03.68-.05 1.12-.01-.26-.03-.53-.04-.78-.19-3.08-.35-6.16-.52-9.23l.01-.01Zm36.4 18.66c-.11-.11-.24-.29-.37-.49.35.21.74.26 1.17.16-.27.11-.53.22-.8.32v.01Zm-.89-33.72c.12-.43.23-.86.35-1.29.71-1.77 1.41-3.55 2.08-5.33-.15.68-.26 1.22-.31 1.55-.5 2.94-2.13 7.59-3.58 13.36-.15-.35-.29-.66-.43-1 .61-2.44 1.25-4.87 1.9-7.3l-.01.01Zm3.56-12.48c.14-.44.28-.89.42-1.34-.13.7-.27 1.41-.42 2.11-.43 1.19-.86 2.38-1.31 3.57.42-1.45.85-2.9 1.31-4.34Zm-5.22 16.05c-.11.44-.23.87-.35 1.31-.12.46-.23.92-.35 1.38-.1-.22-.19-.4-.28-.61.34-.69.66-1.38.97-2.08h.01Zm-11.64 2.62c.06-.1.12-.19.17-.28.05.13.09.26.14.39a.398.398 0 0 0-.31-.11Zm2.3 2.98c-.56-1.3-1.25-2.63-1.65-3.99 0 0 .01-.02.02-.02.06.08 1.52 2.93 1.63 3.08.73 1.13 3.38 7.04 5.67 12.26 1.2 2.73 2.08 5.17 2.83 7.18-.62-1.25-1.23-2.51-1.83-3.78-2.31-4.87-4.53-9.78-6.67-14.73ZM275.92 87.03c-1.06-2.18-1.13-3.45-2.44-2.93-1.52.57-2.94 1.3-4.5 2.1-1.4.72-2.68 1.44-3.92 2.12.01-.25-.24-.5-.51-.34-4.8 2.93-12.41 4.7-17.28 1.31-1.98-1.77-3.32-4.15-3.97-5.78-.29-.95-.49-1.94-.63-2.93-.14-3.34 1.58-6.53 3.9-9.12.8-.79 1.68-1.51 2.66-2.12 3.7-2.3 8.22-3.07 12.51-2.51 2.71.35 5.32 1.24 7.71 2.55.39.22.75-.39.35-.6-.18-.1-.37-.18-.55-.27.56.27 1.03.33 1.51.19l-.48.39c-.15.11-.23.3-.13.48.09.15.33.24.48.13 1.3-.97 2.46-2.09 3.45-3.37.37-.29.64-.6.65-.97v-.02c.08-.33-.03-.7-.21-1.08-.31-.87-.98-2.01-2.19-3.26-2.43-2.52-3.79-3.45-5.68-4.26-1.14-.49-3.12-1.06-4.42-1.23-3.28-.42-10.64-1.21-18.18 4.11-7.74 5.46-11.94 12.3-12.23 20.61-.08 2.06.04 3.98.34 5.71.74 4.18 2.57 8 5.44 11.34 4.26 4.99 9.76 7.52 16.34 7.52 4.85 0 9.69-1.77 14.89-4.62.23-.12.45-.23.68-.35 2.19-1.1 4.37-2.23 6.46-3.5.49-.3 1.03-.61 1.5-.98 1.47-.87 1.11-1.12.49-2.95-.39-1.14-.76-2.7-2.06-5.36l.02-.01Zm-17.38-21.76c3.05-.42 6.31.79 9.36 2.35.51.39.94.68 1.33.87-5.61-2.86-12.72-3.39-18.44-.79 2.05-1.33 4.24-1.95 7.74-2.44l.01.01ZM443.67 72.67c-.4-2.2-1.15-4.33-2.37-6.22-1.49-2.32-3.58-4.19-5.91-5.64-6.17-3.81-13.75-5.11-20.83-6.01-3.23-.41-6.47-.69-9.72-.92l-1.39-.12c-.85-.07-1.52-.1-2.05-.1-1.08-.06-2.17-.12-3.25-.17-.08 0-.14.02-.19.05-.1.05-.18.14-.16.3.27 2.55-.01 5.12-.92 7.52-.15.38.4.56.62.28 1.32.59 2.68 1.05 4.08 1.37 0 2.78-.14 7.58-.33 12.91 0 0 0 .02-.01.03-.61 3.66-.79 7.42-1 11.12-.23 4.01-.43 8.03-.44 12.05 0 .64 0 1.28.03 1.93.02.31 0 .68.15.96.06.11.14.16.24.17-.2.17-.21.54.11.59 3.83.67 7.78.71 11.68.25 2.3-.19 4.87-.65 7.65-1.56 1.85-.54 3.67-1.18 5.43-1.91 7.2-3.02 14.31-8.07 17.35-15.53.76-1.86 1.17-3.8 1.31-5.75.3-1.93.28-3.82-.09-5.58l.01-.02Zm-19.32-15.42c5.74 1.41 11.94 3.68 15.65 8.55.25.32.47.65.69.99-2.3-2.82-5.68-5.69-12.88-8.23-2.16-.76-4.35-1.43-6.64-2.02 1.06.21 2.13.45 3.18.71Zm-25.82-3.04c.13 0 .27.01.4.02-.14.1-.26.23-.37.38 0-.13-.02-.26-.03-.4Zm34.82 22.17c-.75 3.09-3.55 5.66-5.88 7.58-3.35 2.76-7.21 5.03-11.28 6.54-1.33.49-2.71.9-4.12 1.15.06-1.38.08-2.76.07-4.13-.02-3.78-.16-7.56-.41-11.33-.09-1.37-.18-2.74-.37-4.1 0-.06-.03-.11-.06-.15.09-3.25.12-6.16.03-8.12 6.86 1.05 10.56 2.17 14.06 3.62 5.52 2.28 8.59 5.44 7.97 8.96l-.01-.02Zm-22 16.15c-.12 0-.23-.02-.34-.03l.34-.03v.06Zm-.69-.7c0-3.13.26-8.84.47-14.51.06 1.2.11 2.41.15 3.6.15 3.6.25 7.23.09 10.83-.24.03-.48.05-.71.07v.01Zm-12.33-30.94c.37.63 2.01 1.01 3.23 1.25v.15c-1.31-.31-2.59-.73-3.83-1.29.12-.36.23-.72.33-1.09.08.48.18.84.27.98Zm13.7 31.65v-.18c3.41-.56 6.71-2.02 9.69-3.68 2.31-1.28 4.59-2.78 6.63-4.53-4.69 4.53-11.61 8.24-16.33 8.38l.01.01Zm24.07-.75c-2.05 1.93-4.37 3.56-6.83 4.95 2.7-1.78 5.52-4.03 8.42-6.87.82-.82 1.56-1.69 2.23-2.59-1.08 1.65-2.38 3.16-3.81 4.51h-.01ZM187.16 92.14c-.79-2.47-2.1-7.12-3.1-6.87-.19-.01-2.09.77-4.08 1.54-3.06 1.18-5.91 2.13-10.09 2.82-2.74.42-5.87 1.01-10.61 1.06.04-3.34.05-6.01.05-7.99 7.97-.65 12.33-2.11 16.37-3.55 1.11-.39 2.69-1.01 2.63-1.8-.08-.35-.55-1.39-1.17-2.61-.47-1.16-.98-2.31-1.61-3.38-.42-.71-1.04-1.69-1.86-2.06-.11-.08-.22-.13-.29-.12-.02 0-.04 0-.07.01-.19-.04-.39-.05-.6-.01-.17.03-.24.15-.25.28-.04.02-.09.04-.14.05-4.33 1.48-8.85 2.33-13.24 3.61a499.1 499.1 0 0 0-.31-8.19c4.51-.99 8.88-1.38 13.11-1.82 3.68-.38 6.28.12 7.47.34.59.11.9.16 1.16.18h.1c-.1.37.44.66.62.28.02-.04.03-.08.05-.13.15.2.53.22.62-.1.17-.58.19-1.21.21-1.81v-.36c.03-.15.05-.3.07-.45.52-2.47.33-5.09-.64-7.44-.11-.27-.44-.28-.6-.14-.08-.21-.15-.42-.24-.62-.19-.41-.79-.05-.6.35.03.07.05.15.09.22-.98-.42-2.15-.54-3.17-.63-2.17-.19-4.37-.14-6.54 0-5.7.35-11.4 1.3-16.91 2.79-2.08.56-4.13 1.22-6.14 2-4.54 1.05-3.79 1.51-2.17 6.07.18.51.46 1.68.54 1.94.82 2.47 1.08 2.13 3.1 2.13s0 .05 0 .08h.52c-.48 2.66-.51 5.45-.62 8.13-.15 3.48-.22 6.96-.28 10.45 0 .41-.01.82-.02 1.23-.16.29-.33.57-.51.85-.05.38-.09.77-.14 1.18-.42 3.52-.59 6.48-.52 8.8v.34c.02.47.05.76.06.87.16 1.57-.26 3.47 1.35 3.79 1.61.32 3.5.55 4.85.55.11 0 .22-.02.33-.02 1.79.24 3.67.05 5.45-.12 2.85-.28 5.69-.7 8.51-1.19 3.03-.53 6.05-1.14 9.04-1.86 2.4-.58 4.82-1.19 7.13-2.06.51-.19 1.73-.57 2.46-1.14 1.81-.68 2.18-1 1.57-2.67-.23-.62-.48-1.49-.91-2.78l-.03-.02Zm-11.12-38.71c.89.05 1.93.08 2.89.3-.33 0-.68-.02-1.06-.03-8.28-.26-14.88.75-23.97 2.51 2.41-.64 4.85-1.16 7.28-1.59 4.87-.86 9.91-1.45 14.86-1.19Zm-26.53 22.13c.03 1.71.04 3.43 0 5.14-.04 1.27-.11 2.55-.24 3.82 0-.73.02-1.46.04-2.19.05-2.26.12-4.51.22-6.77h-.02Zm6.73 27.85c.2-.1.4-.21.58-.33 1.82-.17 3.82-.24 5.94-.34-.86.11-1.72.24-2.58.33-1.27.14-2.61.31-3.93.34h-.01ZM534.48 85.44c-3.52-8.38-7.07-16.75-10.5-25.17-.63-1.54-1.25-3.09-1.86-4.65-.31-.8-.65-1.6-.87-2.43-.04-.17-.17-.24-.31-.25.1-.2 0-.51-.29-.53-1.59-.08-3.18-.22-4.78-.25-1.96-.03-3.91.13-5.84.42-.31.05-.31.38-.13.56-.03.06-.05.14-.04.22.23 1.54.63 3.06 1.16 4.53.13.35.27.7.41 1.06l-2.68 6.18c-.11.03-.2.09-.25.22-.67 1.9-1.52 3.73-2.34 5.56a536.85 536.85 0 0 1-3.9 8.45c-2.64 5.64-5.34 11.25-7.91 16.93-.44.97-.88 1.94-1.29 2.93-.2.48-.47 1-.55 1.52v.05c-.02.12.02.26.16.34 1.19.73 2.41 1.41 3.66 2.05 1.2.62 2.45 1.25 3.76 1.61.43.12.62-.55.19-.67-1.13-.31-2.2-.83-3.24-1.36 1.09.36 2.1.69 2.75.93 2.82 1.01 2.38 1.1 4.3-3.75 2.1-1.09 4.34-1.96 6.53-2.79 4.35-1.64 8.8-3.03 13.27-4.29.82 2.01 1.77 3.97 2.72 5.92.35.83.62 1.45.79 1.82.22.42.45.8.69 1.15.17.33.33.67.5 1 .42.8.84 1.63 1.4 2.35.23.29.6 0 .55-.31 1.53-.02 3.06-.07 4.58-.27.92-.12 1.82-.32 2.71-.54 1.39-.27 3.85-1.11 3.74-1.42-.67-1.96-1.55-3.87-2.34-5.78-1.57-3.78-3.16-7.56-4.75-11.33v-.01Zm-11.65-26.16c1.54 3.81 3.12 7.6 4.7 11.4 2.94 7.05 5.91 14.09 8.87 21.13l-1.06-2.17c-2.71-5.51-5.2-11.19-7.41-16.87l-6.65-17.15c-.65-1.45-.55-2.19-.93-2.53.09 0 .18.01.28.02a.29.29 0 0 0-.04.26c.52 2.02 1.47 3.98 2.25 5.91h-.01Zm-6.58 13.58c.05-.15.09-.31.14-.46 1.41 3.92 2.88 7.9 4.39 11.87-3.22.52-6.38 1.25-9.46 2.14.55-1.22 1.05-2.46 1.53-3.7 1.24-3.24 2.37-6.53 3.39-9.85h.01Zm-.23-20c.36 0 .73.03 1.09.05-2.15.1-5.18.33-5.87.74-.24.15-.41.3-.53.45-.06-.29-.13-.58-.18-.88 1.82-.26 3.65-.39 5.49-.35v-.01Zm-.09 18.72c-.49 1.67-1.05 3.33-1.6 4.97-1.07 3.19-2.19 6.38-3.57 9.46-.09.21-.19.43-.29.65-.25.07-.5.14-.74.22 2.53-6.16 4.61-11.29 6.2-15.3Zm-6.34 25.16c4.97-2.38 9.37-4.1 14.02-5.27l.26.64c-4.8 1.35-9.63 2.8-14.28 4.63Zm20.17 6.76c.33.23.68.42 1.04.56h-.33c-.12 0-.21.06-.26.13-.15-.23-.31-.45-.45-.7v.01ZM226.57 91.75c-3.55-4.74-6.68-9.11-9.31-12.99 9.2-15.25 10.05-17.81 10.35-18.38.17-.34 1.09-2.27.64-2.53-1.13-.65-1.03-.65-2.97-1.71-1.19-.65-3.04-1.61-4.53-2.12-1.71-.59-1.24-.36-3 2.77-.06.1-.11.2-.17.3-.75 1.02-1.48 2.05-2.2 3.09-1.88 2.71-3.73 5.45-5.69 8.1-3.68-4.91-6.88-8.76-9.51-11.43-.15-.15-.3-.29-.46-.42-1.27-1.28-7.24 3.53-7.93 5.58-.09.09-.19.16-.28.25-.27.26.03.64.33.58.19.65.5 1.29.94 1.91 3.85 5.06 7.19 9.76 9.94 14-1.23 2.61-3.06 5-4.67 7.38l-2.28 3.33c-.5.66-.93 1.23-1.29 1.69-.67.93-2.09 2.61-2.3 3.87-.51.85-1.16 1.84-1.29 2.83-.06.44.61.63.67.19.01-.08.04-.15.06-.22 1.36 1.08 2.76 2.11 4.19 3.11 1.3.91 2.62 1.85 4.04 2.56.21.1.4 0 .48-.17.24.07.48.14.72.2.44.1.62-.57.19-.67-2.02-.48-3.77-1.57-5.23-3.02-.47-.46-.9-.96-1.32-1.46 1.74 1.35 4.2 2.89 5.89 4.14 1.39 1.03 2.85-2.27 4.22-4.2 1.86-2.64 3.96-5.86 5.52-8.29l10.39 14.51c.67.81 1.14 1.21 1.57 1.36-.05.24.12.51.41.4 1.53-.58 3.05-1.19 4.54-1.87 1.52-.69 3.06-1.45 4.36-2.5a.28.28 0 0 0 .12-.23c1.66-1.1.81-1.74-1.41-4.91-1.13-1.58-1.71-2.36-3.7-5.01l-.03-.02Zm2.41 6.54c.56 1.15 1.19 2.52 1.11 3.81-.06.04-.12.07-.17.1-.03-.88-.55-2.66-.94-3.91Zm-16.51-32.73c1.86-2.65 3.65-5.35 5.57-7.95.4-.55.81-1.13 1.26-1.66.19-.18.38-.33.56-.45.18.03.36.08.55.13l-8.05 10.11.12-.18h-.01ZM192.7 95.48c.79-1.37 1.66-2.69 2.54-4 1.19-1.79 2.4-3.56 3.61-5.33-.04.09-.09.17-.13.26-.1.22.03.41.2.49-2.47 3.42-4.89 6.73-6.4 9.28.21.24.4.48.63.75-.24.07-.4.36-.17.56.4.33.72.77 1.05 1.17.09.11.18.21.27.32-.84-.61-1.66-1.24-2.47-1.88.24-.57.58-1.11.87-1.61v-.01Zm7.46-10.32c.47-.81.98-1.59 1.49-2.37.31-.48.64-.95.96-1.43.26-.29.52-.56.75-.79-.99 1.48-2.09 3.03-3.2 4.59Zm10.03-16.22s-.03-.05-.05-.07c.22-.29.43-.59.64-.89-.2.32-.4.65-.58.96h-.01ZM371.54 87.96c-.01-.08-.01-.16-.03-.23-.06-.38-.58-.29-.66.03-.3-.05-.6-.08-.81-.11-1.14-.15-2.29-.19-3.44-.2 1.04-.09 2.09-.18 3.14-.23.45-.02.45-.72 0-.7-6.57.35-13.14 1.23-19.65 2.11-1.53.21-3.05.42-4.57.68-.01 0-.02.01-.04.01-.04-3.33-.13-6.66-.24-9.99-.19-5.7-.4-11.41-.88-17.1-.13-1.51-.23-3.07-.49-4.58 0-.25 0-.48-.02-.68-.06-1.19-.04-2.61-.68-2.78-.16-.07-.72-.16-1.5-.24.22-.17.16-.62-.2-.63-1.19-.04-2.39.09-3.57.23-1.2.14-2.41.32-3.59.6-.16-.1-.41-.06-.5.12-.06.02-.13.03-.19.05-.35.1-.29.55-.03.66-.26.6-.19 2.27-.21 3-.02.66-.66 33.73-.9 40.3-.03.65.06 1.12.04 1.45-.16 3.05.87 4.96 6.34 3.93 1.09-.08 2.75-.77 5.36-1.43 4.13-1.04 5.78-1.52 6.2-1.65 6.43-1.69 6.78-1.97 11.72-2.43.55-.05 4.8-.38 6.03-.3.64.04 1.19.07 1.65.1.09 0 .16-.03.24-.05.1.27.56.33.66-.02.39-1.32.61-2.71.78-4.08.2-1.61.29-3.24.15-4.86.24.03.52-.23.38-.53-.09-.2-.27-.33-.49-.43v-.02Zm-.63.56c.07.57.11 1.14.11 1.71-.21-.99-.53-1.71-.95-1.87.22.03.44.06.65.11.06.01.12.04.19.05Zm-25.41 1.73c1.54-.36 3.1-.64 4.66-.89-1.61.37-3.18.77-4.66 1.2v-.31Zm-.86-7.37c-.07-1.37-.16-2.75-.25-4.12-.21-3.13-.45-6.27-.79-9.4.02-2.25.08-4.31.13-6.11.16 2.08.29 4.16.4 6.24.23 4.46.38 8.93.5 13.39h.01Zm-.94-4c.16 2.41.29 4.83.39 7.24.06 1.6.14 3.22.09 4.83-.15.05-.32.09-.47.14V78.88h-.01ZM483.72 92.83c-3.05-2.28-6.22-4.4-9.38-6.51 8.86-6.49 13.49-12.95 13.73-19.23.04-.76 0-1.5-.13-2.2-.67-3.82-3.5-6.68-8.39-8.48.13.04.27.08.4.13 3.92 1.39 7.74 4.23 8.5 8.56.34 1.95-.05 3.96-.98 5.69-.21.4.39.75.6.35 1.86-3.46 1.46-7.55-.97-10.63-3.53-4.47-9.76-5.88-15.16-6.16-2.32-.12-4.64-.04-6.95.19-6 .32-12.71 1.68-17.63 3.21-.37.11-.67.23-.92.35-.2-.17-.62.02-.57.37v.03c-.64.68-.18 1.64.48 3.21.38.91.67 1.89 1.15 2.58.32.76.68 1.51 1.13 2.19.14.21.38.19.53.07.19-.02.38-.05.57-.08v1.57c-.06.06-.1.13-.11.23-.27 4.18-.34 8.38-.48 12.57l-.3 9.03c-.24 3.91-.44 6.77-.46 7.26-.05.88-.11 1.95.07 2.81-.01.22-.02.43-.04.65 0 .11-.02.23-.03.35 0 .05-.03.27-.01.16-.05.4.5.59.64.28.05.04.12.08.2.08 1.75.13 3.5.28 5.25.3 1.69.02 3.38-.12 5.06-.32.08.23.36.39.55.15.06-.08.11-.17.16-.26.18-.09.24-.32.18-.48.05-.2.1-.4.13-.6.16-.86.25-1.74.33-2.62.11-1.17.17-2.34.23-3.51.15-.01.32-.03.52-.04.36-.03 1.73-.15 2.06-.15.39 0 .7-.02.95-.04 1.76 1.11 3.45 2.35 5.14 3.55 2.83 2.01 5.64 4.04 8.47 6.04 1.42 1 2.85 2 4.29 2.97.1.06.19.07.27.04.08 0 .17-.02.25-.1 1.61-1.56 3.15-3.18 4.6-4.88.75-.88 1.49-1.78 2.15-2.73.01.01.03.02.04.03.34.3.83-.2.49-.49-2.16-1.9-4.34-3.76-6.64-5.48l.03-.01Zm-6.38-3.65a55.72 55.72 0 0 0-4-2.13c.14-.1.26-.19.4-.29 1.2.81 2.4 1.61 3.6 2.42Zm-20.1 11.78c.67-.37 1.23-.91 1.67-1.6-.11.5-.24 1-.38 1.49-.43.04-.86.08-1.29.11Zm2.38-37.24c1.34-.31 2.56-.52 3.71-.69-1.03.19-2.04.41-3.04.65-.14-.07-.34-.02-.45.11-.07.02-.15.04-.22.05v-.13.01Zm.04.84c.07-.02.14-.03.2-.05.34 1.66.41 3.41.5 5.09.17 2.9.24 5.81.28 8.71l.03 3.17c-.17.07-.34.14-.51.2-.06-4.96-.21-10.58-.51-17.12h.01Zm16.04 5.62c-1.16 2.25-3.06 4.1-5.02 5.66-2.8 2.23-5.99 3.97-9.3 5.35-.01-3.56-.09-7.12-.27-10.67-.1-2.04-.16-4.16-.57-6.18 3.3-.78 6.72-1.36 10.1-1.1 1.85.14 4.23.59 5.32 2.29.92 1.43.46 3.24-.26 4.65Zm.85-.18c.6-1.37.9-2.92.28-4.32-.67-1.52-2.2-2.32-3.76-2.74.46.1.89.21 1.29.37 1.74.67 2.69 1.88 2.93 3.21.2 1.13-.05 2.25-.74 3.47V70Zm-27.47-4.14c-.12-.19-.23-.38-.34-.57.74.42.85.36.99.41v.08c-.22.03-.43.06-.65.08Zm11.21 30.46c-.08 1.08-.16 2.17-.33 3.24-.05.35-.11.69-.2 1.03 0 .04-.02.07-.03.11-.15.02-.3.04-.45.05.45-1.64.76-3.36.79-5.07.03-.29.08-.57.1-.89-.03-.31-.03-.47.24-.57-.04.69-.07 1.39-.12 2.08v.02Zm5.6-2.47c.48.11.92.52 2.49 1.72-.46-.32-.92-.65-1.38-.97-.37-.25-.73-.5-1.1-.75h-.01Zm21.23 7.24a70.76 70.76 0 0 1-4.37 4.63c-.14-.09-.27-.19-.4-.28.19-.09.37-.24.55-.47.87-1.14 5.43-5.51 5.49-7.45.31.26.62.53.92.79-.67.97-1.42 1.88-2.19 2.77v.01Z`,fill:`currentColor`,transform:`translate(-144.023 -51.76)`})]}),Nz=({style:e,size:t=`small`,withText:n})=>(0,W.jsxs)(`div`,{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,W.jsx)(jz,{}),n&&(0,W.jsx)(Mz,{})]}),Pz=({icon:e,shortcut:t,children:n})=>{let r=iz();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__icon`,children:e}),(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__text`,children:n}),t&&r.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__shortcut`,children:t})]})};Pz.displayName=`WelcomeScreenMenuItemContent`;var Fz=({onSelect:e,children:t,icon:n,shortcut:r,className:i=``,...a})=>(0,W.jsx)(`button`,{...a,type:`button`,className:`welcome-screen-menu-item ${i}`,onClick:e,children:(0,W.jsx)(Pz,{icon:n,shortcut:r,children:t})});Fz.displayName=`WelcomeScreenMenuItem`;var Iz=({children:e,href:t,icon:n,shortcut:r,className:i=``,...a})=>(0,W.jsx)(`a`,{...a,className:`welcome-screen-menu-item ${i}`,href:t,target:`_blank`,rel:`noopener`,children:(0,W.jsx)(Pz,{icon:n,shortcut:r,children:e})});Iz.displayName=`WelcomeScreenMenuItemLink`;var Lz=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsx)(`div`,{className:`welcome-screen-center`,children:e||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Rz,{}),(0,W.jsx)(zz,{children:K(`welcomeScreen.defaults.center_heading`)}),(0,W.jsxs)(Bz,{children:[(0,W.jsx)(Hz,{}),(0,W.jsx)(Vz,{})]})]})})})};Lz.displayName=`Center`;var Rz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-center__logo excalifont welcome-screen-decor`,children:e||(0,W.jsx)(Nz,{withText:!0})});Rz.displayName=`Logo`;var zz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-center__heading welcome-screen-decor excalifont`,children:e});zz.displayName=`Heading`;var Bz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-menu`,children:e});Bz.displayName=`Menu`;var Vz=()=>{let e=uz();return(0,W.jsx)(Fz,{onSelect:()=>e.executeAction(ZT),shortcut:`?`,icon:bb,children:K(`helpDialog.title`)})};Vz.displayName=`MenuItemHelp`;var Hz=()=>{let e=gC(),t=uz();return e.viewModeEnabled?null:(0,W.jsx)(Fz,{onSelect:()=>t.executeAction(KT),shortcut:ND(`loadScene`),icon:Ab,children:K(`buttons.load`)})};Hz.displayName=`MenuItemLoadScene`;var Uz=({onSelect:e})=>{let{t}=Fy();return(0,W.jsx)(Fz,{shortcut:null,onSelect:e,icon:ex,children:t(`labels.liveCollaboration`)})};Uz.displayName=`MenuItemLiveCollaborationTrigger`,Lz.Logo=Rz,Lz.Heading=zz,Lz.Menu=Bz,Lz.MenuItem=Fz,Lz.MenuItemLink=Iz,Lz.MenuItemHelp=Vz,Lz.MenuItemLoadScene=Hz,Lz.MenuItemLiveCollaborationTrigger=Uz;var Wz=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu`,children:[Jy,(0,W.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||K(`welcomeScreen.defaults.menuHint`)})]})})};Wz.displayName=`MenuHint`;var Gz=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar`,children:[(0,W.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||K(`welcomeScreen.defaults.toolbarHint`)}),Xy]})})};Gz.displayName=`ToolbarHint`;var Kz=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help`,children:[(0,W.jsx)(`div`,{children:e||K(`welcomeScreen.defaults.helpHint`)}),Yy]})})};Kz.displayName=`HelpHint`;var qz=e=>(0,W.jsx)(W.Fragment,{children:e.children||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Lz,{}),(0,W.jsx)(Wz,{}),(0,W.jsx)(Gz,{}),(0,W.jsx)(Kz,{})]})});qz.displayName=`WelcomeScreen`,qz.Center=Lz,qz.Hints={MenuHint:Wz,ToolbarHint:Gz,HelpHint:Kz};var Jz=()=>{Array.prototype.at||Object.defineProperty(Array.prototype,`at`,{value:function(e){if(e=Math.trunc(e)||0,e<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML=``,this.append(...e)})},Yz=(e,t,n)=>!!(t&&(t.id===e.editingTextElement?.id||t.id===e.resizingElement?.id||t.id===e.newElement?.id||t.version>n.version||t.version===n.version&&t.versionNonce<=n.versionNonce)),Xz=(0,gc.default)((e,t,n)=>{(Vt()||h()||window?.DEBUG_FRACTIONAL_INDICES)&&zt(ho(e.map(e=>({...e}))),{shouldThrow:h()||Vt(),includeBoundTextValidation:!0,reconciliationContext:{localElements:t,remoteElements:n}})},1e3*60,{leading:!0,trailing:!1}),Zz=(e,t,n)=>{let r=lr(e),i=[],a=new Set;for(let e of t)if(!a.has(e.id)){let t=r.get(e.id),o=Yz(n,t,e);t&&o?(i.push(t),a.add(t.id)):(i.push(e),a.add(e.id))}for(let t of e)a.has(t.id)||(i.push(t),a.add(t.id));let o=jo(i);return Xz(o,e,t),ho(o),o},Qz=({children:e,icon:t})=>{let{t:n}=Fy(),{TTDDialogTriggerTunnel:r}=gk(),i=lz();return(0,W.jsx)(r.In,{children:(0,W.jsx)(HO.Item,{onSelect:()=>{dC(`ai`,`dialog open`,`ttd`),i({openDialog:{name:`ttd`,tab:`text-to-diagram`}})},icon:t??gS,badge:(0,W.jsx)(HO.Item.Badge,{children:`AI`}),children:e??n(`labels.textToDiagram`)})})};Qz.displayName=`TTDDialogTrigger`,Jz();var $z=H.memo(e=>{let{onExport:t,onChange:r,onIncrement:i,initialData:a,onExcalidrawAPI:o,onMount:s,onUnmount:c,onInitialize:l,isCollaborating:u=!1,onPointerUpdate:d,renderTopLeftUI:f,renderTopRightUI:p,langCode:m=Ey.code,viewModeEnabled:h,zenModeEnabled:g,gridModeEnabled:_,libraryReturnUrl:v,theme:y,name:b,renderCustomStats:x,onPaste:S,detectScroll:C=!0,handleKeyboardGlobally:w=!1,onLibraryChange:T,autoFocus:E=!1,generateIdForFile:D,onLinkOpen:O,generateLinkForSelection:k,onPointerDown:A,onPointerUp:ee,onScrollChange:te,onDuplicate:ne,children:j,validateEmbeddable:re,renderEmbeddable:ie,aiEnabled:ae,showDeprecatedFonts:oe,renderScrollbars:se}=e,ce=e.UIOptions?.canvasActions,le={...e.UIOptions,canvasActions:{...Nt.canvasActions,...ce},tools:{image:e.UIOptions?.tools?.image??!0}};ce?.export&&(le.canvasActions.export.saveFileToDisk=ce.export?.saveFileToDisk??Nt.canvasActions.export.saveFileToDisk),le.canvasActions.toggleTheme===null&&typeof y>`u`&&(le.canvasActions.toggleTheme=!0);let ue=(0,H.useContext)(tz),de=(0,H.useRef)(o);de.current=o;let fe=(0,H.useCallback)(e=>{ue?.(e),de.current?.(e)},[ue]);return(0,H.useEffect)(()=>{(async()=>{await n(()=>import(`./roundRect-CTz-kxJH.js`),[],import.meta.url)})();let e=e=>{typeof e.scale==`number`&&e.scale!==1&&e.preventDefault()};return document.addEventListener(`touchmove`,e,{passive:!1}),()=>{document.removeEventListener(`touchmove`,e)}},[]),(0,W.jsx)(Sy,{store:Cy,children:(0,W.jsx)(Oz,{langCode:m,theme:y,children:(0,W.jsx)(Dz,{onExport:t,onChange:r,onIncrement:i,initialData:a,onExcalidrawAPI:fe,onMount:s,onUnmount:c,onInitialize:l,isCollaborating:u,onPointerUpdate:d,renderTopLeftUI:f,renderTopRightUI:p,langCode:m,viewModeEnabled:h,zenModeEnabled:g,gridModeEnabled:_,libraryReturnUrl:v,theme:y,name:b,renderCustomStats:x,UIOptions:le,onPaste:S,detectScroll:C,handleKeyboardGlobally:w,onLibraryChange:T,autoFocus:E,generateIdForFile:D,onLinkOpen:O,generateLinkForSelection:k,onPointerDown:A,onPointerUp:ee,onScrollChange:te,onDuplicate:ne,validateEmbeddable:re,renderEmbeddable:ie,aiEnabled:ae!==!1,showDeprecatedFonts:oe,renderScrollbars:se,children:j})})})},(e,t)=>{if(e.children!==t.children)return!1;let{initialData:n,UIOptions:r={},...i}=e,{initialData:a,UIOptions:o={},...s}=t,c=Object.keys(r),l=Object.keys(o);return c.length===l.length?c.every(e=>e===`getFormFactor`?!0:e===`canvasActions`?Object.keys(r.canvasActions).every(e=>e===`export`&&r?.canvasActions?.export&&o?.canvasActions?.export?r.canvasActions.export.saveFileToDisk===o.canvasActions.export.saveFileToDisk:r?.canvasActions?.[e]===o?.canvasActions?.[e]):r[e]===o[e])&&ji(i,s):!1});$z.displayName=`Excalidraw`;function eB(e){let t=String(e||``).trim().replace(/\s+/g,` `);return t?t.slice(0,24):null}function tB(){return{type:`excalidraw`,version:2,source:`collabmd`,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function nB(e){return!e||typeof e!=`object`?tB():{type:`excalidraw`,version:2,source:`collabmd`,elements:Array.isArray(e.elements)?e.elements:[],appState:{gridSize:e.appState?.gridSize??null,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`},files:e.files&&typeof e.files==`object`?e.files:{}}}function rB(e){return iB(e)||tB()}function iB(e){if(!e)return null;try{return nB(JSON.parse(e))}catch{return null}}function aB(e,{theme:t=`dark`}={}){return{elements:e.elements||[],appState:{theme:t,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`,gridSize:e.appState?.gridSize??null},files:e.files||{}}}function oB(e,t,n){return nB({elements:Array.isArray(e)?e:[],appState:{gridSize:t?.gridSize??null,viewBackgroundColor:t?.viewBackgroundColor??`#ffffff`},files:n||{}})}var sB=[`#ef4444`,`#f97316`,`#eab308`,`#22c55e`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#ec4899`,`#14b8a6`,`#f59e0b`,`#6366f1`,`#10b981`,`#f43f5e`,`#0ea5e9`,`#a855f7`];function cB(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function lB(){let e=new Uint8Array(8);return globalThis.crypto?.getRandomValues?.(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function uB(e){return sB[cB(e)%sB.length]}function dB(e,t){return t&&/^#[0-9a-fA-F]{8}$/.test(t)?t:/^#[0-9a-fA-F]{6}$/.test(e)?`${e}33`:`#0ea5e933`}function fB({params:e,storedUserName:t,generatePeerIdFn:n=lB}){let r=eB(e.get(`userName`))||eB(t)||`User`,i=e.get(`userPeerId`)||n(),a=e.get(`userColor`)||uB(`${r}-${i}`);return{color:a,colorLight:dB(a,e.get(`userColorLight`)),name:r,peerId:i}}function pB({currentUser:e,nextUser:t={},generatePeerIdFn:n=lB}){let r=eB(t.name)||e?.name||`User`,i=t.peerId||e?.peerId||n(),a=t.color||e?.color||uB(`${r}-${i}`);return{color:a,colorLight:dB(a,t.colorLight||e?.colorLight),name:r,peerId:i}}function mB(e){if(!e||typeof e!=`object`)return;let t=Number(e.scrollX),n=Number(e.scrollY),r=Number(e.zoom);if(!(!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||r<=0))return{scrollX:t,scrollY:n,zoom:r}}function hB(e){let t=new Map;return e&&e.getStates().forEach((n,r)=>{let i=n?.user;if(!i)return;let a=n.pointer&&Number.isFinite(n.pointer.x)&&Number.isFinite(n.pointer.y)?{x:n.pointer.x,y:n.pointer.y,tool:n.pointer.tool===`laser`?`laser`:`pointer`}:void 0,o=mB(n.viewport);t.set(String(r),{button:n.pointerButton===`down`?`down`:`up`,color:{background:dB(i.color||`#0ea5e9`,i.colorLight),stroke:i.color||`#0ea5e9`},id:i.peerId||String(r),isCurrentUser:r===e.clientID,pointer:a,viewport:o,selectedElementIds:n.selectedElementIds||void 0,socketId:String(r),username:i.name||`User`})}),t}function gB(e,t){if(!(e instanceof Map)||!t)return null;for(let n of e.values())if(n?.id===t)return n;return null}var _B=`excalidraw`,vB=2,yB=`collabmd`,bB=`excalidraw-app-state`,xB=`excalidraw-elements`,SB=`excalidraw-files`,CB=`excalidraw-meta`,wB=`codemirror`,TB=`schemaVersion`;function EB(){return{type:_B,version:vB,source:yB,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function DB(e={}){return{gridSize:e?.gridSize??null,viewBackgroundColor:e?.viewBackgroundColor??`#ffffff`}}function OB(e){return!e||typeof e!=`object`?EB():{type:_B,version:vB,source:yB,elements:Array.isArray(e.elements)?e.elements:[],appState:DB(e.appState),files:e.files&&typeof e.files==`object`?e.files:{}}}function kB(e,{fallbackToEmpty:t=!0}={}){if(!e)return t?EB():null;try{return OB(JSON.parse(e))}catch{return t?EB():null}}function AB(e){if(e!==void 0)return JSON.parse(JSON.stringify(e))}function jB(e){return`${Number.isFinite(Number(e?.version))?Number(e.version):0}:${Number.isFinite(Number(e?.versionNonce))?Number(e.versionNonce):0}:${Number.isFinite(Number(e?.updated))?Number(e.updated):0}`}function MB(e,t){let n=Number(e?.version)||0,r=Number(t?.version)||0;if(n!==r)return n-r;let i=Number(e?.versionNonce)||0,a=Number(t?.versionNonce)||0;if(i!==a)return i-a;let o=Number(e?.updated)||0,s=Number(t?.updated)||0;return o===s?String(e?.id||``).localeCompare(String(t?.id||``)):o-s}function NB(e,t){let n=e?.index??``,r=t?.index??``;return n===r?String(e?.id||``).localeCompare(String(t?.id||``)):String(n).localeCompare(String(r))}function PB(e,t,{create:n=!1}={}){let r=e.get(t);if(r instanceof rc)return r;if(!n)return null;let i=new rc;return e.set(t,i),i}function FB(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return null}return!e||typeof e!=`object`?null:AB(e)}function IB(e){if(!(e instanceof rc)||e.size===0)return null;let t=null;return e.forEach(e=>{let n=FB(e);!n||!n.id||(!t||MB(n,t)>0)&&(t=n)}),t}function LB(e,t,{maxRevisions:n=2}={}){let r=jB(t),i=AB(t),a=e.get(r);return(a&&typeof a==`object`?JSON.stringify(a):``)===JSON.stringify(i)?!1:(e.set(r,i),RB(e,n),!0)}function RB(e,t=2){if(!(e instanceof rc)||e.size<=t)return;let n=[];for(e.forEach((e,t)=>{let r=FB(e);if(!r){n.push({element:null,key:t});return}n.push({element:r,key:t})}),n.sort((e,t)=>e.element?t.element?MB(e.element,t.element):1:-1);n.length>t;){let t=n.shift();t?.key&&e.delete(t.key)}}function zB(e){return[...e].sort(NB)}function BB(e){if(!e)return!1;let t=e.getMap(CB);return Number(t.get(`schemaVersion`))===1?!0:e.getMap(`excalidraw-elements`).size>0||e.getMap(`excalidraw-files`).size>0||e.getMap(`excalidraw-app-state`).size>0}function VB(e){let t=e.getMap(CB);return Number(t.get(`schemaVersion`))!==1&&t.set(TB,1),t}function HB(e,{includeDeleted:t=!0}={}){if(!e)return EB();let n=e.getMap(xB),r=e.getMap(SB),i=e.getMap(bB),a=[];n.forEach(e=>{let n=IB(e);n&&(!t&&n.isDeleted||a.push(n))});let o={};return r.forEach((e,t)=>{!e||typeof e!=`object`||(o[t]=AB(e))}),OB({appState:{gridSize:i.get(`gridSize`),viewBackgroundColor:i.get(`viewBackgroundColor`)},elements:zB(a),files:o})}function UB(e,t,{maxRevisionsPerElement:n=2}={}){if(!e)return EB();let r=OB(t);VB(e);let i=e.getMap(xB),a=e.getMap(SB),o=e.getMap(bB);Array.from(i.keys()).forEach(e=>i.delete(e)),Array.from(a.keys()).forEach(e=>a.delete(e)),Array.from(o.keys()).forEach(e=>o.delete(e)),r.elements.forEach(e=>{e?.id&&LB(PB(i,e.id,{create:!0}),e,{maxRevisions:n})}),Object.entries(r.files||{}).forEach(([e,t])=>{a.set(e,AB(t))});let s=DB(r.appState);return o.set(`gridSize`,s.gridSize),o.set(`viewBackgroundColor`,s.viewBackgroundColor),r}function WB(e,t,{maxRevisionsPerElement:n=2}={}){if(!e)return!1;let r=OB(t);VB(e);let i=e.getMap(xB),a=e.getMap(SB),o=e.getMap(bB),s=new Set,c=!1;r.elements.forEach(e=>{e?.id&&(s.add(e.id),c=LB(PB(i,e.id,{create:!0}),e,{maxRevisions:n})||c)}),Array.from(i.keys()).forEach(e=>{s.has(e)||(i.delete(e),c=!0)});let l=r.files||{};Object.entries(l).forEach(([e,t])=>{let n=AB(t),r=a.get(e);JSON.stringify(r)!==JSON.stringify(n)&&(a.set(e,n),c=!0)}),Array.from(a.keys()).forEach(e=>{e in l||(a.delete(e),c=!0)});let u=DB(r.appState);return Object.entries(u).forEach(([e,t])=>{o.get(e)!==t&&(o.set(e,t),c=!0)}),Array.from(o.keys()).forEach(e=>{e in u||(o.delete(e),c=!0)}),c}function GB(e){return e?kB(e.getText(wB).toString(),{fallbackToEmpty:!1}):null}var KB=250,qB=48,JB=4e3,YB=class{constructor({cancelAnimationFrameFn:e=e=>cancelAnimationFrame(e),clearTimeoutFn:t=e=>clearTimeout(e),emptySceneGuardMs:n=KB,filePath:r=``,now:i=()=>Date.now(),onCollaboratorsChange:a=()=>{},onRemoteSceneJson:o=()=>{},requestAnimationFrameFn:s=e=>requestAnimationFrame(e),resolveWsBaseUrlFn:c=tc,saveThrottleMs:l=qB,setTimeoutFn:u=(e,t)=>window.setTimeout(e,t),syncTimeoutMs:d=JB,vaultClient:f,websocketProviderFactory:p=(e,t,n,r)=>new nc(e,t,n,r),ydocFactory:m=()=>new ic}){this.cancelAnimationFrameFn=e,this.clearTimeoutFn=t,this.emptySceneGuardMs=n,this.filePath=r,this.now=i,this.onCollaboratorsChange=a,this.onRemoteSceneJson=o,this.requestAnimationFrameFn=s,this.resolveWsBaseUrlFn=c,this.saveThrottleMs=l,this.setTimeoutFn=u,this.syncTimeoutMs=d,this.vaultClient=f,this.websocketProviderFactory=p,this.ydocFactory=m,this.ydoc=null,this.roomMeta=null,this.roomElements=null,this.roomFiles=null,this.roomAppState=null,this.provider=null,this.awareness=null,this.localUser=null,this.handleProviderSync=null,this.lastSceneJson=``,this.sceneSyncTimer=null,this.lastSceneSyncAt=0,this.pendingSceneSyncPayload=null,this.pointerAwarenessFrame=0,this.pendingPointerPayload=null,this.viewportAwarenessFrame=0,this.pendingViewportPayload=null,this.lastViewportSignature=``,this.lastSelectedIdsSignature=``,this.pendingEmptySceneCandidate=null,this.canWriteToRoom=!1,this.waitingForAuthoritativeSync=!1,this.applyingSharedSnapshotDepth=0,this.handleAwarenessChange=()=>{this.onCollaboratorsChange(hB(this.awareness))},this.handleStructuredSceneUpdate=()=>{if(!this.ydoc)return;let e=this.getStructuredSceneJson();!e||e===this.lastSceneJson||(this.unlockRoomWrites(),this.pendingEmptySceneCandidate=null,this.lastSceneJson=JSON.stringify(rB(e)),this.onRemoteSceneJson(this.lastSceneJson))}}getLastSceneJson(){return this.lastSceneJson}getLocalUser(){return this.localUser}getHistoryState(){return{canRedo:!1,canUndo:!1,head:null,length:null}}canRedo(){return this.getHistoryState().canRedo}canUndo(){return this.getHistoryState().canUndo}isApplyingSharedSnapshot(){return this.applyingSharedSnapshotDepth>0}beginApplyingSharedSnapshot(){this.applyingSharedSnapshotDepth+=1}endApplyingSharedSnapshot(){this.applyingSharedSnapshotDepth=Math.max(0,this.applyingSharedSnapshotDepth-1)}subscribeHistoryState(e){return typeof e==`function`&&e(this.getHistoryState()),()=>{}}setLocalUser(e={}){return this.localUser=pB({currentUser:this.localUser,nextUser:e}),this.awareness&&this.awareness.setLocalStateField(`user`,this.localUser),this.handleAwarenessChange(),this.localUser}async connect({initialUser:e=null}={}){if(this.localUser=e,!this.filePath){let e=tB();return this.lastSceneJson=JSON.stringify(e),e}this.ydoc=this.ydocFactory(),this.roomMeta=this.ydoc.getMap(CB),this.roomElements=this.ydoc.getMap(xB),this.roomFiles=this.ydoc.getMap(SB),this.roomAppState=this.ydoc.getMap(bB),this.provider=this.websocketProviderFactory(this.resolveWsBaseUrlFn(),this.filePath,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),ac(this.provider),this.awareness=this.provider.awareness,this.localUser&&this.awareness.setLocalStateField(`user`,this.localUser),this.awareness.setLocalStateField(`pointerButton`,`up`),this.awareness.setLocalStateField(`selectedElementIds`,{}),this.awareness.on(`change`,this.handleAwarenessChange),this.handleProviderSync=e=>{e&&(this.unlockRoomWrites(),this.handleStructuredSceneUpdate())},this.provider.on(`sync`,this.handleProviderSync);let t=await this.waitForSync(this.provider,this.syncTimeoutMs),n=this.getStructuredSceneJson(),r=!1;if(!n){let e=await this.loadSceneFromApi(),t=this.getStructuredSceneJson();t?n=t:(n=JSON.stringify(e),r=!0)}return n||=JSON.stringify(tB()),this.waitingForAuthoritativeSync=r&&!t,this.canWriteToRoom=!this.waitingForAuthoritativeSync,this.lastSceneJson=JSON.stringify(rB(n)),!r&&this.canWriteToRoom&&!BB(this.ydoc)&&this.ydoc.transact(()=>{this.replaceStructuredSceneWithinTransaction(this.lastSceneJson)},`excalidraw-legacy-migrate`),this.roomMeta.observe(this.handleStructuredSceneUpdate),this.roomElements.observeDeep(this.handleStructuredSceneUpdate),this.roomFiles.observeDeep(this.handleStructuredSceneUpdate),this.roomAppState.observe(this.handleStructuredSceneUpdate),r&&this.canWriteToRoom&&this.commitSceneJson(this.lastSceneJson,{origin:`excalidraw-api-fallback`}),this.handleStructuredSceneUpdate(),this.handleAwarenessChange(),rB(this.lastSceneJson)}async loadSceneFromApi({createIfMissing:e=!0}={}){if(!this.filePath)return tB();try{return rB((await this.vaultClient.readFile(this.filePath)).content)}catch(t){if(t?.status!==404||!e)throw t?.status===404?Error(t.message||`Excalidraw file not found`):Error(t?.message||`Failed to load Excalidraw file`)}let t=tB();try{return await this.vaultClient.createFile({content:JSON.stringify(t),path:this.filePath}),t}catch(e){if(e?.status===409)try{return rB((await this.vaultClient.readFile(this.filePath)).content)}catch(e){throw Error(e?.message||`Failed to load existing Excalidraw file after create conflict`)}throw Error(e?.message||`Failed to create Excalidraw file`)}}waitForSync(e,t=JB){return e.synced?Promise.resolve(!0):new Promise(n=>{let r=!1,i=t=>{!t||r||(r=!0,this.clearTimeoutFn(a),e.off(`sync`,i),n(!0))},a=this.setTimeoutFn(()=>{r||(r=!0,e.off(`sync`,i),n(!1))},t);e.on(`sync`,i)})}unlockRoomWrites(){this.waitingForAuthoritativeSync=!1,this.canWriteToRoom=!0,!this.getStructuredSceneJson()&&this.lastSceneJson&&this.commitSceneJson(this.lastSceneJson,{origin:`excalidraw-authoritative-seed`}),this.pendingSceneSyncPayload&&this.scheduleSceneSyncFlush()}getStructuredSceneJson(){if(!this.ydoc)return``;if(BB(this.ydoc))return JSON.stringify(HB(this.ydoc));let e=GB(this.ydoc);return e?JSON.stringify(e):``}replaceStructuredSceneWithinTransaction(e){if(!this.ydoc)return;let t=iB(e);t&&(VB(this.ydoc),UB(this.ydoc,t))}scheduleSceneSync(e,t,n){this.pendingSceneSyncPayload={appState:t,elements:e,files:n},this.canWriteToRoom&&this.scheduleSceneSyncFlush()}scheduleSceneSyncFlush(){if(this.sceneSyncTimer!==null)return;let e=this.now()-this.lastSceneSyncAt,t=Math.max(0,this.saveThrottleMs-e);this.sceneSyncTimer=this.setTimeoutFn(()=>{this.sceneSyncTimer=null,this.flushSceneSync()},t)}flushSceneSync(){if(!this.ydoc||!this.pendingSceneSyncPayload)return;let{elements:e,appState:t,files:n}=this.pendingSceneSyncPayload;this.pendingSceneSyncPayload=null;let r=oB(e,t,n),i=JSON.stringify(r);if(this.shouldDelayEmptySceneCommit(i)){this.pendingSceneSyncPayload={appState:t,elements:e,files:n},this.scheduleDelayedEmptySceneCommit();return}i!==this.lastSceneJson&&(this.lastSceneSyncAt=this.now(),this.commitSceneJson(i,{origin:`excalidraw-local-change`})),this.pendingEmptySceneCandidate=null,this.pendingSceneSyncPayload&&this.scheduleSceneSyncFlush()}hasRemoteCollaborators(){if(!this.awareness)return!1;for(let[e,t]of this.awareness.getStates())if(e!==this.awareness.clientID&&t?.user)return!0;return!1}shouldDelayEmptySceneCommit(e){if(!this.emptySceneGuardMs||!this.hasRemoteCollaborators()||rB(e).elements.length>0||rB(this.lastSceneJson||this.getStructuredSceneJson()).elements.length===0)return this.pendingEmptySceneCandidate=null,!1;let t=this.now();return!this.pendingEmptySceneCandidate||this.pendingEmptySceneCandidate.previousSceneJson!==this.lastSceneJson?(this.pendingEmptySceneCandidate={firstSeenAt:t,previousSceneJson:this.lastSceneJson},console.warn(`[excalidraw:${this.filePath}] Delaying suspicious empty scene commit during active collaboration`),!0):t-this.pendingEmptySceneCandidate.firstSeenAt<this.emptySceneGuardMs}scheduleDelayedEmptySceneCommit(){if(this.sceneSyncTimer!==null)return;let e=this.pendingEmptySceneCandidate?.firstSeenAt??this.now(),t=this.now()-e,n=Math.max(0,this.emptySceneGuardMs-t);this.sceneSyncTimer=this.setTimeoutFn(()=>{this.sceneSyncTimer=null,this.flushSceneSync()},n)}flushPointerAwarenessPayload(){this.pointerAwarenessFrame=0,!(!this.awareness||!this.pendingPointerPayload)&&(this.awareness.setLocalStateField(`pointer`,this.pendingPointerPayload.pointer),this.awareness.setLocalStateField(`pointerButton`,this.pendingPointerPayload.button),this.pendingPointerPayload=null)}normalizeViewportAwareness(e){if(!e||typeof e!=`object`)return null;let t=Number(e.scrollX),n=Number(e.scrollY),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||r<=0?null:{scrollX:t,scrollY:n,zoom:r}}scheduleLocalPointerAwareness(e){!this.awareness||!e?.pointer||(this.pendingPointerPayload={button:e.button===`down`?`down`:`up`,pointer:{x:e.pointer.x,y:e.pointer.y,tool:e.pointer.tool===`laser`?`laser`:`pointer`}},!this.pointerAwarenessFrame&&(this.pointerAwarenessFrame=this.requestAnimationFrameFn(()=>this.flushPointerAwarenessPayload())))}flushViewportAwarenessPayload(){this.viewportAwarenessFrame=0,!(!this.awareness||!this.pendingViewportPayload)&&(this.awareness.setLocalStateField(`viewport`,this.pendingViewportPayload),this.pendingViewportPayload=null)}scheduleLocalViewportAwareness(e){if(!this.awareness)return;let t=this.normalizeViewportAwareness(e);if(!t)return;let n=`${t.scrollX}:${t.scrollY}:${t.zoom}`;n!==this.lastViewportSignature&&(this.lastViewportSignature=n,this.pendingViewportPayload=t,!this.viewportAwarenessFrame&&(this.viewportAwarenessFrame=this.requestAnimationFrameFn(()=>this.flushViewportAwarenessPayload())))}syncLocalSelectionAwareness(e){if(!this.awareness)return;let t=e?.selectedElementIds||{},n=Object.keys(t).sort().join(`,`);n!==this.lastSelectedIdsSignature&&(this.lastSelectedIdsSignature=n,this.awareness.setLocalStateField(`selectedElementIds`,t))}commitSceneJson(e,{origin:t=`excalidraw-room-write`}={}){let n=JSON.stringify(rB(e));if(!this.ydoc){let e=n!==this.lastSceneJson;return this.lastSceneJson=n,e}return n===this.getStructuredSceneJson()&&n===this.lastSceneJson?!1:(this.lastSceneJson=n,this.ydoc.transact(()=>{WB(this.ydoc,rB(n))},t),!0)}disconnect(){this.flushSceneSync(),this.clearTimeoutFn(this.sceneSyncTimer),this.sceneSyncTimer=null,this.pendingSceneSyncPayload=null,this.pointerAwarenessFrame&&this.cancelAnimationFrameFn(this.pointerAwarenessFrame),this.pointerAwarenessFrame=0,this.pendingPointerPayload=null,this.viewportAwarenessFrame&&this.cancelAnimationFrameFn(this.viewportAwarenessFrame),this.viewportAwarenessFrame=0,this.pendingViewportPayload=null,this.lastViewportSignature=``,this.lastSelectedIdsSignature=``,this.pendingEmptySceneCandidate=null,this.roomMeta?.unobserve(this.handleStructuredSceneUpdate),this.roomElements?.unobserveDeep(this.handleStructuredSceneUpdate),this.roomFiles?.unobserveDeep(this.handleStructuredSceneUpdate),this.roomAppState?.unobserve(this.handleStructuredSceneUpdate),this.awareness&&(this.awareness.off(`change`,this.handleAwarenessChange),this.awareness.setLocalState(null)),this.awareness=null,this.provider&&this.handleProviderSync&&this.provider.off(`sync`,this.handleProviderSync),this.handleProviderSync=null,this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.ydoc?.destroy(),this.ydoc=null,this.roomMeta=null,this.roomElements=null,this.roomFiles=null,this.roomAppState=null,this.localUser=null,this.canWriteToRoom=!1,this.waitingForAuthoritativeSync=!1,this.applyingSharedSnapshotDepth=0}},XB=new URLSearchParams(window.location.search),ZB=XB.get(`file`),QB=XB.get(`test`)===`1`,$B=XB.get(`mode`)===`preview`,eV=window.location.origin,tV=Number.parseInt(XB.get(`syncTimeoutMs`)||``,10),nV=null,rV=XB.get(`theme`)||`dark`,iV=fB({params:XB,storedUserName:localStorage.getItem(`collabmd-user-name`)}),aV=``,oV=!1,sV=!1,cV=``,lV=null,uV=0,dV=new Map,fV=null,pV=null,mV=!1,hV=0,gV=``,_V=[],vV=0,yV=null,bV=!0,xV=new YB({filePath:ZB,onCollaboratorsChange:e=>{if(!oV){lV=e;return}DV(e)},onRemoteSceneJson:e=>{OV(e)},syncTimeoutMs:Number.isFinite(tV)?tV:void 0,vaultClient:sc});function SV(e){let t=document.querySelector(`[data-testid="button-${e}"]`);return t instanceof HTMLButtonElement?t:null}function CV(){let e=SV(`undo`),t=SV(`redo`);return{canRedo:!!t&&!t.disabled,canUndo:!!e&&!e.disabled,head:null,length:null}}function wV(e){let t=SV(e);return!t||t.disabled?!1:(t.click(),!0)}function TV(e={}){iV=pB({currentUser:iV,nextUser:e}),xV.setLocalUser(iV)}QB&&(window.__COLLABMD_EXCALIDRAW_TEST__={getElementBounds:e=>{let t=nV?.getSceneElementsIncludingDeleted?.()?.find(t=>t.id===e&&!t.isDeleted);return t?{centerX:t.x+t.width/2,centerY:t.y+t.height/2,height:t.height,width:t.width,x:t.x,y:t.y}:null},getElementCount:()=>nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted).length??0,getElementIds:()=>nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted).map(e=>e.id).sort()??[],getHistoryState:()=>CV(),getLocalUserName:()=>iV?.name||``,getLocalPeerId:()=>iV?.peerId||``,getViewport:()=>{let e=nV?.getAppState?.();return e?{scrollX:e.scrollX,scrollY:e.scrollY,zoom:e.zoom?.value??null}:null},isViewMode:()=>!!nV?.getAppState?.().viewModeEnabled,getSceneJson:()=>xV.getLastSceneJson(),isAuthoritativeReady:()=>!!nV&&oV&&xV.canWriteToRoom===!0&&xV.waitingForAuthoritativeSync===!1&&xV.isApplyingSharedSnapshot()===!1,isReady:()=>oV&&!!nV&&!!SV(`undo`)&&!!SV(`redo`),redoShared:()=>wV(`redo`),setScene:e=>{NV(nB(e),{captureUpdate:V.IMMEDIATELY})},setViewport:e=>{if(!nV)return;let t=nV.getAppState();nV.updateScene({appState:{scrollX:Number.isFinite(e?.scrollX)?e.scrollX:t.scrollX,scrollY:Number.isFinite(e?.scrollY)?e.scrollY:t.scrollY,zoom:Number.isFinite(e?.zoom)&&e.zoom>0?{value:e.zoom}:t.zoom},captureUpdate:V.NEVER})},undoShared:()=>wV(`undo`)});function EV(e){if(dV=e instanceof Map?e:new Map,!nV){lV=dV;return}if(nV.updateScene({collaborators:dV,captureUpdate:V.NEVER}),pV){VV(pV);return}BV(dV)}function DV(e){yV=e,!vV&&(vV=requestAnimationFrame(()=>{vV=0;let e=yV;yV=null,EV(e)}))}function OV(e){let t=rB(e),n=JSON.stringify(t);if(!(n===aV&&!cV)){if(aV=n,!nV||!oV){cV=n;return}MV(t)}}function kV({trackedSharedSnapshot:e=!1}={}){uV+=1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{uV=Math.max(0,uV-1),e&&xV.endApplyingSharedSnapshot(),uV===0&&(sV=!1)})})}function AV(){hV+=1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{hV=Math.max(0,hV-1),hV===0&&(mV=!1)})})}function jV(e){let t=nV.getAppState(),n=nV.getSceneElementsIncludingDeleted?.()||nV.getSceneElements(),r=Sa(e?.elements||[],n,{repairBindings:!0}),i=gr(e?.appState||{},t),a=Zz(n,r,t);return{appState:{theme:rV,viewBackgroundColor:i.viewBackgroundColor??`#ffffff`,gridSize:i.gridSize??null},elements:a,files:e?.files||{}}}function MV(e,{captureUpdate:t=V.NEVER,trackedSharedSnapshot:n=!0}={}){let r=jV(e);sV=!0,n&&xV.beginApplyingSharedSnapshot();try{nV.updateScene({...r,captureUpdate:t})}finally{kV({trackedSharedSnapshot:n})}LV()}function NV(e,{captureUpdate:t=V.IMMEDIATELY}={}){let n=nB(e),r=JSON.stringify(n);if(aV=r,!nV||!oV){cV=r;return}nV.updateScene({...jV(n),captureUpdate:t}),sV&&xV.commitSceneJson(r,{origin:`excalidraw-local-scene-apply`})}function PV(){OV(xV.getLastSceneJson())}function FV(e,t={}){window.parent.postMessage({source:`excalidraw-editor`,type:e,...t},eV)}function IV(){return nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted)??[]}function LV(){if(!bV||!nV)return;let e=IV();e.length!==0&&(bV=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{nV&&nV.scrollToContent(e,{animate:!1,fitToViewport:!0,maxZoom:2,viewportZoomFactor:$B?.92:.88})})}))}function RV(){if(!oV||!nV||mV)return;let e=nV.getAppState();xV.scheduleLocalViewportAwareness({scrollX:e.scrollX,scrollY:e.scrollY,zoom:e.zoom?.value})}function zV(e,{force:t=!1}={}){let n=e?String(e):null,r=fV!==n;fV=n,r&&(gV=``),fV&&BV(dV,{force:t||r})}function BV(e=dV,{force:t=!1}={}){if(!nV||!fV)return;let n=e?.get?.(String(fV))?.viewport;if(!n)return;let r=`${fV}:${n.scrollX}:${n.scrollY}:${n.zoom}`;!t&&r===gV||(gV=r,mV=!0,nV.updateScene({appState:{scrollX:n.scrollX,scrollY:n.scrollY,zoom:{value:n.zoom}},captureUpdate:V.NEVER}),AV())}function VV(e){if(pV=e||null,!nV)return;if(!e){nV.updateScene({appState:{userToFollow:null},captureUpdate:V.NEVER}),zV(null,{force:!0}),pV=null;return}let t=gB(dV,e);t?.socketId&&(nV.updateScene({appState:{userToFollow:{socketId:t.socketId,username:t.username||``}},captureUpdate:V.NEVER}),zV(t.socketId,{force:!0}),pV=null)}function HV(){oV=!1,lV=null,dV=new Map,fV=null,pV=null,mV=!1,hV=0,gV=``,vV&&cancelAnimationFrame(vV),vV=0,yV=null,_V.forEach(e=>e()),_V=[],xV.disconnect()}var UV=!1;function WV(){UV||(UV=!0,HV())}async function GV({intervalMs:e=10,maxWaitMs:t=150}={}){let n=performance.now();for(;performance.now()-n<t;){let t=xV.provider?.ws;if(!t||t.readyState!==WebSocket.OPEN||t.bufferedAmount===0)return;await new Promise(t=>window.setTimeout(t,e))}}async function KV(){xV.flushSceneSync(),await GV()}window.addEventListener(`pagehide`,WV),window.addEventListener(`message`,e=>{if(e.origin!==eV)return;let t=e.data;if(!(!t||t.source!==`collabmd-host`)){if(t.type===`set-theme`){rV=t.theme||`dark`,nV&&(sV=!0,nV.updateScene({appState:{theme:rV},captureUpdate:V.NEVER}),kV());return}if(t.type===`set-user`){TV(t.user);return}if(t.type===`follow-user`){VV(t.peerId||null);return}t.type===`prepare-disconnect`&&(async()=>{await KV(),FV(`disconnect-ready`,{requestId:t.requestId||``})})()}});function qV(e,t,n){!oV||sV||(aV=JSON.stringify(nB({elements:e,appState:t,files:n})),xV.scheduleSceneSync(e,t,n))}function JV(e){nV=e,_V.forEach(e=>e()),_V=[],_V.push(e.onStateChange([`scrollX`,`scrollY`,`zoom`],()=>{RV()})),_V.push(e.onStateChange(`userToFollow`,e=>{if(e?.socketId){zV(e.socketId,{force:!0});return}zV(null,{force:!0})}));let t=cV||xV.getLastSceneJson();cV=``,MV(rB(t)),lV&&=(nV.updateScene({collaborators:lV,captureUpdate:V.NEVER}),null),oV=!0,RV(),PV(),pV&&VV(pV),LV(),FV(`ready`)}function YV({excalidrawAPI:e}){nV=e}async function XV(){let e=document.getElementById(`loadingState`);try{await oc();let t=aB(await xV.connect({initialUser:iV}),{theme:rV});e?.remove();let n={onMount:YV,onInitialize:e=>{JV(e)},onUnmount:()=>{_V.forEach(e=>e()),_V=[],nV=null,oV=!1},initialData:t,aiEnabled:!1,isCollaborating:!0,onChange:(e,t,n)=>{qV(e,t,n),xV.syncLocalSelectionAwareness(t)},onPointerUpdate:e=>{xV.scheduleLocalPointerAwareness(e)},theme:rV,viewModeEnabled:$B,zenModeEnabled:$B,UIOptions:{canvasActions:{export:!1,loadScene:!1,saveToActiveFile:!1,toggleTheme:!1}}};(0,mc.createRoot)(document.getElementById(`root`)).render(H.createElement(()=>H.createElement(`div`,{style:{height:`100vh`,width:`100%`}},H.createElement($z,n))))}catch(t){console.error(`[excalidraw] Failed to initialize:`,t),FV(`error`,{message:t instanceof Error?t.message:`Failed to load Excalidraw`}),e&&(e.className=`loading-state error`,e.textContent=`Failed to load Excalidraw: ${t instanceof Error?t.message:String(t)}`)}}XV();
|